mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 12:45:57 +01:00
Cleanup some listener code.
This commit is contained in:
parent
c83e983dea
commit
2162a4abe4
@ -20,7 +20,6 @@ public class AuthMeBlockListener implements Listener {
|
||||
* @param instance AuthMe
|
||||
*/
|
||||
public AuthMeBlockListener(AuthMe instance) {
|
||||
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@ -31,8 +30,9 @@ public class AuthMeBlockListener implements Listener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (Utils.checkAuth(event.getPlayer()))
|
||||
if (Utils.checkAuth(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -43,8 +43,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player == null || Utils.checkAuth(player)) {
|
||||
if (Utils.checkAuth(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
|
@ -183,12 +183,12 @@ public class AuthMeEntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Projectile projectile = event.getEntity();
|
||||
Player player = null;
|
||||
if (projectile == null) {
|
||||
if (event.getEntity() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = null;
|
||||
Projectile projectile = event.getEntity();
|
||||
if (shooterIsProjectileSource) {
|
||||
ProjectileSource shooter = projectile.getShooter();
|
||||
if (shooter == null || !(shooter instanceof Player)) {
|
||||
|
@ -93,12 +93,15 @@ public class AuthMePlayerListener implements Listener {
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String cmd = event.getMessage().split(" ")[0].toLowerCase();
|
||||
if (Settings.useEssentialsMotd && cmd.equals("/motd"))
|
||||
if (Settings.useEssentialsMotd && cmd.equals("/motd")) {
|
||||
return;
|
||||
if (Settings.allowCommands.contains(cmd))
|
||||
}
|
||||
if (Settings.allowCommands.contains(cmd)) {
|
||||
return;
|
||||
if (Utils.checkAuth(event.getPlayer()))
|
||||
}
|
||||
if (Utils.checkAuth(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -167,12 +170,8 @@ public class AuthMePlayerListener implements Listener {
|
||||
*
|
||||
* @param event PlayerMoveEvent
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.isMovementAllowed && Settings.getMovementRadius <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ public class AuthMePlayerListener16 implements Listener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
|
||||
public void onPlayerEditBook(PlayerEditBookEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player == null || Utils.checkAuth(player))
|
||||
if (Utils.checkAuth(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ public class AuthMePlayerListener18 implements Listener {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player == null || Utils.checkAuth(player))
|
||||
if (Utils.checkAuth(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user