Skip to content

Commit

Permalink
chore: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkuth committed Sep 5, 2024
1 parent 10eb489 commit 2317f18
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/main/java/dev/pinkuth/maintenance/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

/**
Expand Down Expand Up @@ -50,4 +51,4 @@ public static void onServerTransferRequest(ServerTransferRequestEvent event) {
player.sendToFallback(previous, reason);
}
}
}
}
14 changes: 4 additions & 10 deletions src/main/java/dev/pinkuth/maintenance/Maintenance.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,9 +38,4 @@ public void onEnable() {
public void onDisable() {
maintenanceManager.save();
}

public MaintenanceManager getMaintenanceManager() {
return maintenanceManager;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ public void save() {
Maintenance.getInstance().getConfig().setBoolean("global", global);
Maintenance.getInstance().getConfig().save();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MaintenanceCommand extends Command {

public MaintenanceCommand() {
super("maintenance", CommandSettings.builder()
.setUsageMessage("/mtn <on|off> [server]")
.setUsageMessage("/maintenance <on|off> [server]")
.setDescription("Enable or disable maintenance mode")
.setAliases("mtn")
.setPermission("maintenance.change").build());
Expand All @@ -40,4 +40,4 @@ public boolean onExecute(CommandSender sender, String alias, String[] args) {
}
return true;
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Maintenance
version: 1.2.2
main: dev.pinkuth.maintenance.Maintenance
author: pinkuth
author: pinkuth

0 comments on commit 2317f18

Please sign in to comment.