mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-02 16:47:32 +02:00
Made amphibious feature in WorldGuard more efficient and fixed missing group console spam.
This commit is contained in:
parent
3f8bac582c
commit
74016bf93e
@ -59,6 +59,10 @@ public class WorldGuardListener extends PluginListener {
|
|||||||
* List of players with god mode on.
|
* List of players with god mode on.
|
||||||
*/
|
*/
|
||||||
private Set<String> invinciblePlayers = new HashSet<String>();
|
private Set<String> invinciblePlayers = new HashSet<String>();
|
||||||
|
/**
|
||||||
|
* List of amphibious players.
|
||||||
|
*/
|
||||||
|
private Set<String> amphibiousPlayers = new HashSet<String>();
|
||||||
/**
|
/**
|
||||||
* Used to keep recent join times.
|
* Used to keep recent join times.
|
||||||
*/
|
*/
|
||||||
@ -93,8 +97,6 @@ public class WorldGuardListener extends PluginListener {
|
|||||||
private int spawnProtection;
|
private int spawnProtection;
|
||||||
private boolean kickOnDeath;
|
private boolean kickOnDeath;
|
||||||
private Blacklist blacklist;
|
private Blacklist blacklist;
|
||||||
private boolean hasAmphibiousGroup;
|
|
||||||
private boolean hasInvincibleGroup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the listener.
|
* 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());
|
recentLogins.put(player.getName(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasInvincibleGroup && player.isInGroup("wg-invincible")) {
|
if (player.isInGroup("wg-invincible")) {
|
||||||
invinciblePlayers.add(player.getName());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAmphibiousGroup && type == PluginLoader.DamageType.WATER
|
if (type == PluginLoader.DamageType.WATER
|
||||||
&& player.isInGroup("wg-amphibious")) {
|
&& amphibiousPlayers.contains(player.getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1024,6 +1020,7 @@ public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker,
|
|||||||
public void onDisconnect(Player player) {
|
public void onDisconnect(Player player) {
|
||||||
BlacklistEntry.forgetPlayer(player);
|
BlacklistEntry.forgetPlayer(player);
|
||||||
invinciblePlayers.remove(player.getName());
|
invinciblePlayers.remove(player.getName());
|
||||||
|
amphibiousPlayers.remove(player.getName());
|
||||||
recentLogins.remove(player.getName());
|
recentLogins.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user