diff options
6 files changed, 33 insertions, 9 deletions
diff --git a/Essentials/src/net/ess3/Teleport.java b/Essentials/src/net/ess3/Teleport.java index 9fcc5202f..9ca5ff875 100644 --- a/Essentials/src/net/ess3/Teleport.java +++ b/Essentials/src/net/ess3/Teleport.java @@ -28,13 +28,13 @@ public class Teleport implements Runnable, ITeleport private final Location location; private final Entity entity; - public Target(Location location) + Target(Location location) { this.location = location; this.entity = null; } - public Target(Entity entity) + Target(Entity entity) { this.entity = entity; this.location = null; diff --git a/Essentials/src/net/ess3/api/IUserMap.java b/Essentials/src/net/ess3/api/IUserMap.java index 0a027e5ae..807489804 100644 --- a/Essentials/src/net/ess3/api/IUserMap.java +++ b/Essentials/src/net/ess3/api/IUserMap.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.Set; import net.ess3.user.PlayerNotFoundException; import net.ess3.user.TooManyMatchesException; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -52,4 +53,6 @@ public interface IUserMap extends IReload public void addPrejoinedPlayer(Player player); public void removePrejoinedPlayer(Player player); + + public Object getPlayer(LivingEntity livingEntity); } diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java index dad113f08..ae858e78e 100644 --- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java @@ -6,11 +6,13 @@ import net.ess3.api.IEssentials; import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; +import net.ess3.user.User; import net.ess3.user.UserData.TimestampType; import org.bukkit.Material; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -54,6 +56,11 @@ public class EssentialsEntityListener implements Listener { event.setCancelled(true); } + if (attacker.isVanished() && !Permissions.VANISH_PVP.isAuthorized(attacker)) + { + event.setCancelled(true); + } + final ItemStack itemstack = ((Player)eAttack).getItemInHand(); final List<String> commandList = attacker.getData().getPowertool(itemstack.getType()); if (commandList != null && !commandList.isEmpty()) @@ -186,4 +193,20 @@ public class EssentialsEntityListener implements Listener event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onPotionSplashEvent(final PotionSplashEvent event) + { + for (LivingEntity entity : event.getAffectedEntities()) + { + if (entity instanceof Player) + { + User user = (User)ess.getUserMap().getPlayer(entity); + if (user.isGodModeEnabled()) + { + event.setIntensity(entity, 0d); + } + } + } + } } diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java index 20bf64c8b..22ddcdd42 100644 --- a/Essentials/src/net/ess3/permissions/Permissions.java +++ b/Essentials/src/net/ess3/permissions/Permissions.java @@ -107,7 +107,8 @@ public enum Permissions implements IPermission WARP_LIST(PermissionDefault.TRUE), WARP_HIDDEN, WARP_OTHERS, - VANISH_SEE_OTHERS; + VANISH_SEE_OTHERS, + VANISH_PVP; private static final String base = "essentials."; private final String permission; private final PermissionDefault defaultPerm; diff --git a/Essentials/src/net/ess3/utils/DescParseTickFormat.java b/Essentials/src/net/ess3/utils/DescParseTickFormat.java index 1c93a3575..a0ec8094f 100644 --- a/Essentials/src/net/ess3/utils/DescParseTickFormat.java +++ b/Essentials/src/net/ess3/utils/DescParseTickFormat.java @@ -266,11 +266,11 @@ public final class DescParseTickFormat // How many ingame days have passed since the server start? final long days = ticks / ticksPerDay; - ticks = ticks - days * ticksPerDay; + ticks -= ticks * ticksPerDay; // How many hours on the last day? final long hours = ticks / ticksPerHour; - ticks = ticks - hours * ticksPerHour; + ticks -= ticks * ticksPerHour; // How many minutes on the last day? final long minutes = (long)Math.floor(ticks / ticksPerMinute); diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java index 8d392448e..f79e851be 100644 --- a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java +++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java @@ -1,9 +1,6 @@ package net.ess3.utils.textreader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; public class SimpleTextInput implements IText |