diff --git a/src/main/java/co/uk/legendeffects/openafk/commands/IsAFKCommand.java b/src/main/java/co/uk/legendeffects/openafk/commands/IsAFKCommand.java index 5d2bd24..e105fd2 100644 --- a/src/main/java/co/uk/legendeffects/openafk/commands/IsAFKCommand.java +++ b/src/main/java/co/uk/legendeffects/openafk/commands/IsAFKCommand.java @@ -30,30 +30,24 @@ public boolean onCommand(CommandSender sender, Command command, String label, St if(args[0].length() == 36) { Player target = Bukkit.getPlayer(UUID.fromString(args[0])); - if(target == null) { - sender.sendMessage(OpenAFK.parse(plugin.getConfig().getString("messages.isAfk.unknown"))); - return true; - } - - if(plugin.isAfkPlayer(target)) { - sender.sendMessage(OpenAFK.parse(target, plugin.getConfig().getString("messages.isAfk.afk"))); - } else { - sender.sendMessage(OpenAFK.parse(target, plugin.getConfig().getString("messages.isAfk.notAfk"))); - } - return true; + return sendIsAFKResponse(sender, target); } Player target = Bukkit.getPlayer(args[0]); + return sendIsAFKResponse(sender, target); + } + + private boolean sendIsAFKResponse(CommandSender sender, Player target) { if(target == null) { sender.sendMessage(OpenAFK.parse(plugin.getConfig().getString("messages.isAfk.unknown"))); return true; } + if(plugin.isAfkPlayer(target)) { sender.sendMessage(OpenAFK.parse(target, plugin.getConfig().getString("messages.isAfk.afk"))); } else { sender.sendMessage(OpenAFK.parse(target, plugin.getConfig().getString("messages.isAfk.notAfk"))); } - return true; } } diff --git a/src/main/java/co/uk/legendeffects/openafk/detection/FishingDetection.java b/src/main/java/co/uk/legendeffects/openafk/detection/FishingDetection.java index 25f6764..b1d8473 100644 --- a/src/main/java/co/uk/legendeffects/openafk/detection/FishingDetection.java +++ b/src/main/java/co/uk/legendeffects/openafk/detection/FishingDetection.java @@ -22,8 +22,8 @@ public FishingDetection(OpenAFK plugin) { this.plugin = plugin; } - private Set playersFishing = new HashSet<>(); - private HashMap violationLevel = new HashMap<>(); + private final Set playersFishing = new HashSet<>(); + private final HashMap violationLevel = new HashMap<>(); @EventHandler public void fishEvent(PlayerFishEvent event) { diff --git a/src/main/java/co/uk/legendeffects/openafk/handlers/OnBlockPlace.java b/src/main/java/co/uk/legendeffects/openafk/handlers/OnBlockPlace.java index 85391f4..50bbfc3 100644 --- a/src/main/java/co/uk/legendeffects/openafk/handlers/OnBlockPlace.java +++ b/src/main/java/co/uk/legendeffects/openafk/handlers/OnBlockPlace.java @@ -13,7 +13,7 @@ public OnBlockPlace(OpenAFK plugin) { } @EventHandler - public void onBlockBreak(BlockPlaceEvent event) { + public void onBlockPlace(BlockPlaceEvent event) { if(!plugin.getConfig().getBoolean("detection.events.blockPlaceEvent")) { return; } diff --git a/src/main/java/co/uk/legendeffects/openafk/handlers/OnChat.java b/src/main/java/co/uk/legendeffects/openafk/handlers/OnChat.java index 2049742..27afc93 100644 --- a/src/main/java/co/uk/legendeffects/openafk/handlers/OnChat.java +++ b/src/main/java/co/uk/legendeffects/openafk/handlers/OnChat.java @@ -13,7 +13,7 @@ public OnChat(OpenAFK plugin) { } @EventHandler - public void onBlockBreak(AsyncPlayerChatEvent event) { + public void onChat(AsyncPlayerChatEvent event) { if(!plugin.getConfig().getBoolean("detection.events.chatEvent")) { return; } diff --git a/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerConnect.java b/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerConnect.java index 1766c83..5a37af6 100644 --- a/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerConnect.java +++ b/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerConnect.java @@ -16,7 +16,7 @@ public PlayerConnect(OpenAFK plugin) { } @EventHandler - public void handler(PlayerJoinEvent event) { + public void onPlayerConnect(PlayerJoinEvent event) { Player player = event.getPlayer(); DataHandler data = plugin.getPlayerData(); diff --git a/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerDisconnect.java b/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerDisconnect.java index 7bdf486..729dca3 100644 --- a/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerDisconnect.java +++ b/src/main/java/co/uk/legendeffects/openafk/handlers/PlayerDisconnect.java @@ -14,7 +14,7 @@ public PlayerDisconnect(OpenAFK openAFK) { } @EventHandler - public void Handler(PlayerQuitEvent event) { + public void onPlayerDisconnect(PlayerQuitEvent event) { if(this.openAFK.isAfkPlayer(event.getPlayer())) { openAFK.getActionParser().parse(event.getPlayer(), ActionType.OTHER, "onAfkDisconnect"); }