mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Listener Cleanup
This commit is contained in:
parent
d72f831519
commit
0e0a96b6d8
5 changed files with 27 additions and 21 deletions
|
@ -20,7 +20,6 @@ public class EssentialsBlockListener implements Listener
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
|
||||||
// Do not rely on getItemInHand();
|
// Do not rely on getItemInHand();
|
||||||
// http://leaky.bukkit.org/issues/663
|
// http://leaky.bukkit.org/issues/663
|
||||||
final ItemStack is = Util.convertBlockToItem(event.getBlockPlaced());
|
final ItemStack is = Util.convertBlockToItem(event.getBlockPlaced());
|
||||||
|
@ -28,6 +27,7 @@ public class EssentialsBlockListener implements Listener
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final User user = ess.getUser(event.getPlayer());
|
||||||
final boolean unlimitedForUser = user.hasUnlimited(is);
|
final boolean unlimitedForUser = user.hasUnlimited(is);
|
||||||
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
|
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,6 +383,7 @@ public class Settings implements ISettings
|
||||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
||||||
enabledSigns = _getEnabledSigns();
|
enabledSigns = _getEnabledSigns();
|
||||||
teleportInvulnerability = _isTeleportInvulnerability();
|
teleportInvulnerability = _isTeleportInvulnerability();
|
||||||
|
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
|
||||||
itemSpawnBl = _getItemSpawnBlacklist();
|
itemSpawnBl = _getItemSpawnBlacklist();
|
||||||
kits = _getKits();
|
kits = _getKits();
|
||||||
chatFormats.clear();
|
chatFormats.clear();
|
||||||
|
@ -695,9 +696,15 @@ public class Settings implements ISettings
|
||||||
{
|
{
|
||||||
return config.getBoolean("register-back-in-listener", false);
|
return config.getBoolean("register-back-in-listener", false);
|
||||||
}
|
}
|
||||||
|
private boolean disableItemPickupWhileAfk;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getDisableItemPickupWhileAfk()
|
public boolean getDisableItemPickupWhileAfk()
|
||||||
|
{
|
||||||
|
return disableItemPickupWhileAfk;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean _getDisableItemPickupWhileAfk()
|
||||||
{
|
{
|
||||||
return config.getBoolean("disable-item-pickup-while-afk", true);
|
return config.getBoolean("disable-item-pickup-while-afk", true);
|
||||||
}
|
}
|
||||||
|
@ -746,7 +753,6 @@ public class Settings implements ISettings
|
||||||
{
|
{
|
||||||
this.metricsEnabled = metricsEnabled;
|
this.metricsEnabled = metricsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean teleportInvulnerability;
|
private boolean teleportInvulnerability;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,10 +25,10 @@ public class SignBlockListener implements Listener
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,10 @@ public class SignBlockListener implements Listener
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onSignChange(final SignChangeEvent event)
|
public void onSignChange(final SignChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +107,10 @@ public class SignBlockListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,10 +141,10 @@ public class SignBlockListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockBurn(final BlockBurnEvent event)
|
public void onBlockBurn(final BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,10 @@ public class SignBlockListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockIgnite(final BlockIgniteEvent event)
|
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ public class SignEntityListener implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ public class SignPlayerListener implements Listener
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ public class SignPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int mat = block.getTypeId();
|
|
||||||
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
|
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
|
||||||
{
|
{
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue