From 2317f18289df2fa0b7951245b6403c7d4394975b Mon Sep 17 00:00:00 2001 From: zP1nky Date: Thu, 5 Sep 2024 22:25:51 +0100 Subject: [PATCH] chore: Clean up --- .../dev/pinkuth/maintenance/EventListener.java | 5 +++-- .../java/dev/pinkuth/maintenance/Maintenance.java | 14 ++++---------- .../pinkuth/maintenance/MaintenanceManager.java | 2 +- .../maintenance/command/MaintenanceCommand.java | 4 ++-- src/main/resources/plugin.yml | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/main/java/dev/pinkuth/maintenance/EventListener.java b/src/main/java/dev/pinkuth/maintenance/EventListener.java index bdb0f3f..b71c9af 100644 --- a/src/main/java/dev/pinkuth/maintenance/EventListener.java +++ b/src/main/java/dev/pinkuth/maintenance/EventListener.java @@ -19,8 +19,9 @@ public static void onLogin(PlayerLoginEvent event) { // Handle global maintenance (disconnects player is enabled) MaintenanceManager maintenanceManager = Maintenance.getInstance().getMaintenanceManager(); - if (maintenanceManager.isGlobalMaintenanceEnabled()) + if (maintenanceManager.isGlobalMaintenanceEnabled()) { player.disconnect(maintenanceManager.getMaintenanceMessage(MaintenanceManager.TYPE_JOIN)); + } } /** @@ -50,4 +51,4 @@ public static void onServerTransferRequest(ServerTransferRequestEvent event) { player.sendToFallback(previous, reason); } } -} +} \ No newline at end of file diff --git a/src/main/java/dev/pinkuth/maintenance/Maintenance.java b/src/main/java/dev/pinkuth/maintenance/Maintenance.java index 8244cf5..e46794c 100644 --- a/src/main/java/dev/pinkuth/maintenance/Maintenance.java +++ b/src/main/java/dev/pinkuth/maintenance/Maintenance.java @@ -4,16 +4,15 @@ import dev.waterdog.waterdogpe.event.defaults.ServerTransferRequestEvent; import dev.waterdog.waterdogpe.plugin.Plugin; import dev.waterdog.waterdogpe.event.defaults.PlayerLoginEvent; +import lombok.Getter; +@Getter public final class Maintenance extends Plugin { + @Getter private static Maintenance instance; private MaintenanceManager maintenanceManager; - public static Maintenance getInstance() { - return instance; - } - @Override public void onEnable() { instance = this; @@ -39,9 +38,4 @@ public void onEnable() { public void onDisable() { maintenanceManager.save(); } - - public MaintenanceManager getMaintenanceManager() { - return maintenanceManager; - } - -} +} \ No newline at end of file diff --git a/src/main/java/dev/pinkuth/maintenance/MaintenanceManager.java b/src/main/java/dev/pinkuth/maintenance/MaintenanceManager.java index 885a4ab..5de4abd 100644 --- a/src/main/java/dev/pinkuth/maintenance/MaintenanceManager.java +++ b/src/main/java/dev/pinkuth/maintenance/MaintenanceManager.java @@ -107,4 +107,4 @@ public void save() { Maintenance.getInstance().getConfig().setBoolean("global", global); Maintenance.getInstance().getConfig().save(); } -} +} \ No newline at end of file diff --git a/src/main/java/dev/pinkuth/maintenance/command/MaintenanceCommand.java b/src/main/java/dev/pinkuth/maintenance/command/MaintenanceCommand.java index 2dddbc8..63abbd3 100644 --- a/src/main/java/dev/pinkuth/maintenance/command/MaintenanceCommand.java +++ b/src/main/java/dev/pinkuth/maintenance/command/MaintenanceCommand.java @@ -14,7 +14,7 @@ public class MaintenanceCommand extends Command { public MaintenanceCommand() { super("maintenance", CommandSettings.builder() - .setUsageMessage("/mtn [server]") + .setUsageMessage("/maintenance [server]") .setDescription("Enable or disable maintenance mode") .setAliases("mtn") .setPermission("maintenance.change").build()); @@ -40,4 +40,4 @@ public boolean onExecute(CommandSender sender, String alias, String[] args) { } return true; } -} +} \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 68ec58b..b726806 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,4 +1,4 @@ name: Maintenance version: 1.2.2 main: dev.pinkuth.maintenance.Maintenance -author: pinkuth +author: pinkuth \ No newline at end of file