diff --git a/src/WorldGuardListener.java b/src/WorldGuardListener.java index 75f2072c..002cc459 100644 --- a/src/WorldGuardListener.java +++ b/src/WorldGuardListener.java @@ -59,6 +59,10 @@ public class WorldGuardListener extends PluginListener { * List of players with god mode on. */ private Set invinciblePlayers = new HashSet(); + /** + * List of amphibious players. + */ + private Set amphibiousPlayers = new HashSet(); /** * Used to keep recent join times. */ @@ -93,8 +97,6 @@ public class WorldGuardListener extends PluginListener { private int spawnProtection; private boolean kickOnDeath; private Blacklist blacklist; - private boolean hasAmphibiousGroup; - private boolean hasInvincibleGroup; /** * Construct the listener. @@ -252,16 +254,6 @@ public void loadConfiguration() { } } } - - hasAmphibiousGroup = etc.getDataSource().getGroup("wg-amphibious") != null; - if (!hasAmphibiousGroup) { - logger.log(Level.INFO, "Ignore the error about wg-amphibious."); - } - - hasInvincibleGroup = etc.getDataSource().getGroup("wg-invincible") != null; - if (!hasInvincibleGroup) { - logger.log(Level.INFO, "Ignore the error about wg-invincible."); - } } /** @@ -299,9 +291,13 @@ public void onLogin(Player player) { recentLogins.put(player.getName(), System.currentTimeMillis()); } - if (hasInvincibleGroup && player.isInGroup("wg-invincible")) { + if (player.isInGroup("wg-invincible")) { invinciblePlayers.add(player.getName()); } + + if (player.isInGroup("wg-amphibious")) { + amphibiousPlayers.add(player.getName()); + } } /** @@ -1006,8 +1002,8 @@ public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, return true; } - if (hasAmphibiousGroup && type == PluginLoader.DamageType.WATER - && player.isInGroup("wg-amphibious")) { + if (type == PluginLoader.DamageType.WATER + && amphibiousPlayers.contains(player.getName())) { return true; } } @@ -1024,6 +1020,7 @@ public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, public void onDisconnect(Player player) { BlacklistEntry.forgetPlayer(player); invinciblePlayers.remove(player.getName()); + amphibiousPlayers.remove(player.getName()); recentLogins.remove(player.getName()); }