diff --git a/src/main/java/dev/plex/command/impl/AdminChatCMD.java b/src/main/java/dev/plex/command/impl/AdminChatCMD.java index 6434d94..5c4800b 100644 --- a/src/main/java/dev/plex/command/impl/AdminChatCMD.java +++ b/src/main/java/dev/plex/command/impl/AdminChatCMD.java @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @CommandPermissions(level = Rank.ADMIN, permission = "plex.adminchat", source = RequiredCommandSource.ANY) -@CommandParameters(name = "adminchat", description = "Talk privately with other admins", usage = "/ ", aliases = "o,ac,sc,staffchat") +@CommandParameters(name = "adminchat", description = "Talk privately with other admins", usage = "/ ", aliases = "o,ac,sc,staffchat") public class AdminChatCMD extends PlexCommand { @Override diff --git a/src/main/java/dev/plex/command/impl/DebugCMD.java b/src/main/java/dev/plex/command/impl/DebugCMD.java index 8971d76..74cb65e 100644 --- a/src/main/java/dev/plex/command/impl/DebugCMD.java +++ b/src/main/java/dev/plex/command/impl/DebugCMD.java @@ -7,6 +7,7 @@ import dev.plex.command.annotation.CommandPermissions; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexLog; import dev.plex.util.PlexUtils; +import java.util.List; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.Bukkit; @@ -16,8 +17,6 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.List; - @CommandParameters(name = "debug", description = "Debug command", usage = "/ [player]") @CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug") public class DebugCMD extends PlexCommand diff --git a/src/main/java/dev/plex/command/impl/MuteCMD.java b/src/main/java/dev/plex/command/impl/MuteCMD.java index b76adef..c5c99ea 100644 --- a/src/main/java/dev/plex/command/impl/MuteCMD.java +++ b/src/main/java/dev/plex/command/impl/MuteCMD.java @@ -11,16 +11,15 @@ import dev.plex.punishment.Punishment; import dev.plex.punishment.PunishmentType; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexUtils; +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; import net.kyori.adventure.text.Component; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; - @CommandParameters(name = "mute", description = "Mute a player on the server", usage = "/ ", aliases = "stfu") @CommandPermissions(level = Rank.ADMIN, permission = "plex.mute") public class MuteCMD extends PlexCommand diff --git a/src/main/java/dev/plex/command/impl/TagCMD.java b/src/main/java/dev/plex/command/impl/TagCMD.java index 33a46dc..4082a0c 100644 --- a/src/main/java/dev/plex/command/impl/TagCMD.java +++ b/src/main/java/dev/plex/command/impl/TagCMD.java @@ -85,8 +85,14 @@ public class TagCMD extends PlexCommand private Component removeEvents(Component component) { - if (component.clickEvent() != null) component = component.clickEvent(null); - if (component.hoverEvent() != null) component = component.hoverEvent(null); + if (component.clickEvent() != null) + { + component = component.clickEvent(null); + } + if (component.hoverEvent() != null) + { + component = component.hoverEvent(null); + } return component; } } diff --git a/src/main/java/dev/plex/command/impl/TempbanCMD.java b/src/main/java/dev/plex/command/impl/TempbanCMD.java index f704211..69f8c74 100644 --- a/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -6,7 +6,6 @@ import dev.plex.cache.PlayerCache; import dev.plex.command.PlexCommand; import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandPermissions; -import dev.plex.command.exception.PlayerNotBannedException; import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.source.RequiredCommandSource; import dev.plex.player.PlexPlayer; @@ -15,7 +14,6 @@ import dev.plex.punishment.Punishment; import dev.plex.punishment.PunishmentType; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexUtils; -import java.time.LocalDateTime; import java.util.List; import java.util.UUID; import net.kyori.adventure.text.Component; diff --git a/src/main/java/dev/plex/command/impl/UnmuteCMD.java b/src/main/java/dev/plex/command/impl/UnmuteCMD.java index da1cec2..642c45e 100644 --- a/src/main/java/dev/plex/command/impl/UnmuteCMD.java +++ b/src/main/java/dev/plex/command/impl/UnmuteCMD.java @@ -9,14 +9,13 @@ import dev.plex.command.exception.CommandFailException; import dev.plex.player.PunishedPlayer; import dev.plex.rank.enums.Rank; import dev.plex.util.PlexUtils; +import java.util.List; import net.kyori.adventure.text.Component; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.List; - @CommandPermissions(level = Rank.ADMIN, permission = "plex.unmute") @CommandParameters(name = "unmute", description = "Unmute a player", usage = "/ ") public class UnmuteCMD extends PlexCommand diff --git a/src/main/java/dev/plex/event/AdminAddEvent.java b/src/main/java/dev/plex/event/AdminAddEvent.java index bb6f3fb..190b44f 100644 --- a/src/main/java/dev/plex/event/AdminAddEvent.java +++ b/src/main/java/dev/plex/event/AdminAddEvent.java @@ -26,15 +26,15 @@ public class AdminAddEvent extends Event */ private final PlexPlayer plexPlayer; + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public HandlerList getHandlers() { return handlers; } - public static HandlerList getHandlerList() - { - return handlers; - } - } diff --git a/src/main/java/dev/plex/event/AdminRemoveEvent.java b/src/main/java/dev/plex/event/AdminRemoveEvent.java index 67038a8..06b0e6c 100644 --- a/src/main/java/dev/plex/event/AdminRemoveEvent.java +++ b/src/main/java/dev/plex/event/AdminRemoveEvent.java @@ -26,14 +26,14 @@ public class AdminRemoveEvent extends Event */ private final PlexPlayer plexPlayer; + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public HandlerList getHandlers() { return handlers; } - - public static HandlerList getHandlerList() - { - return handlers; - } } diff --git a/src/main/java/dev/plex/event/AdminSetRankEvent.java b/src/main/java/dev/plex/event/AdminSetRankEvent.java index a13f7e5..eee0304 100644 --- a/src/main/java/dev/plex/event/AdminSetRankEvent.java +++ b/src/main/java/dev/plex/event/AdminSetRankEvent.java @@ -32,14 +32,14 @@ public class AdminSetRankEvent extends Event */ private final Rank rank; + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public HandlerList getHandlers() { return handlers; } - - public static HandlerList getHandlerList() - { - return handlers; - } } diff --git a/src/main/java/dev/plex/event/GameModeUpdateEvent.java b/src/main/java/dev/plex/event/GameModeUpdateEvent.java index dc359ab..eaf0687 100644 --- a/src/main/java/dev/plex/event/GameModeUpdateEvent.java +++ b/src/main/java/dev/plex/event/GameModeUpdateEvent.java @@ -21,14 +21,14 @@ public class GameModeUpdateEvent extends Event private final GameMode gameMode; + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public @NotNull HandlerList getHandlers() { return handlers; } - - public static HandlerList getHandlerList() - { - return handlers; - } } diff --git a/src/main/java/dev/plex/event/PunishedPlayerFreezeEvent.java b/src/main/java/dev/plex/event/PunishedPlayerFreezeEvent.java index a753974..2cc27af 100644 --- a/src/main/java/dev/plex/event/PunishedPlayerFreezeEvent.java +++ b/src/main/java/dev/plex/event/PunishedPlayerFreezeEvent.java @@ -32,14 +32,14 @@ public class PunishedPlayerFreezeEvent extends PunishedPlayerEvent implements Ca this.frozen = frozen; } + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public HandlerList getHandlers() { return handlers; } - - public static HandlerList getHandlerList() - { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/dev/plex/event/PunishedPlayerMuteEvent.java b/src/main/java/dev/plex/event/PunishedPlayerMuteEvent.java index 6d76cc4..4a725ab 100644 --- a/src/main/java/dev/plex/event/PunishedPlayerMuteEvent.java +++ b/src/main/java/dev/plex/event/PunishedPlayerMuteEvent.java @@ -32,14 +32,14 @@ public class PunishedPlayerMuteEvent extends PunishedPlayerEvent implements Canc this.muted = muted; } + public static HandlerList getHandlerList() + { + return handlers; + } + @Override public HandlerList getHandlers() { return handlers; } - - public static HandlerList getHandlerList() - { - return handlers; - } } \ No newline at end of file diff --git a/src/main/java/dev/plex/listener/impl/ChatListener.java b/src/main/java/dev/plex/listener/impl/ChatListener.java index 177e032..8048c6d 100644 --- a/src/main/java/dev/plex/listener/impl/ChatListener.java +++ b/src/main/java/dev/plex/listener/impl/ChatListener.java @@ -22,6 +22,29 @@ public class ChatListener extends PlexListener { private final PlexChatRenderer renderer = new PlexChatRenderer(); + public static void adminChat(CommandSender sender, String message) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (plugin.getSystem().equalsIgnoreCase("ranks")) + { + PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId()); + if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)) + { + player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); + } + } + else if (plugin.getSystem().equalsIgnoreCase("permissions")) + { + if (player.hasPermission("plex.adminchat")) + { + player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); + } + } + } + plugin.getServer().getConsoleSender().sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); + } + @EventHandler public void onChat(AsyncChatEvent event) { @@ -47,29 +70,6 @@ public class ChatListener extends PlexListener event.renderer(renderer); } - public static void adminChat(CommandSender sender, String message) - { - for (Player player : Bukkit.getOnlinePlayers()) - { - if (plugin.getSystem().equalsIgnoreCase("ranks")) - { - PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId()); - if (plexPlayer.getRankFromString().isAtLeast(Rank.ADMIN)) - { - player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); - } - } - else if (plugin.getSystem().equalsIgnoreCase("permissions")) - { - if (player.hasPermission("plex.adminchat")) - { - player.sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); - } - } - } - plugin.getServer().getConsoleSender().sendMessage(PlexUtils.messageComponent("adminChatFormat", sender.getName(), message)); - } - public static class PlexChatRenderer implements ChatRenderer { public boolean hasPrefix; diff --git a/src/main/java/dev/plex/listener/impl/PlayerListener.java b/src/main/java/dev/plex/listener/impl/PlayerListener.java index cbde48c..fc595a2 100644 --- a/src/main/java/dev/plex/listener/impl/PlayerListener.java +++ b/src/main/java/dev/plex/listener/impl/PlayerListener.java @@ -69,7 +69,7 @@ public class PlayerListener extends PlexListener { PlexUtils.broadcast( Component.text(ChatColor.AQUA + player.getName() + " is ").color(NamedTextColor.AQUA) - .append(LegacyComponentSerializer.legacyAmpersand().deserialize(loginMessage))); + .append(LegacyComponentSerializer.legacyAmpersand().deserialize(loginMessage))); } } diff --git a/src/main/java/dev/plex/menu/PunishedPlayerMenu.java b/src/main/java/dev/plex/menu/PunishedPlayerMenu.java index 4ee0c3e..3444a80 100644 --- a/src/main/java/dev/plex/menu/PunishedPlayerMenu.java +++ b/src/main/java/dev/plex/menu/PunishedPlayerMenu.java @@ -111,8 +111,14 @@ public class PunishedPlayerMenu extends AbstractMenu return; } ItemStack item = event.getCurrentItem(); - if (!item.hasItemMeta()) return; - if (!item.getItemMeta().hasDisplayName()) return; + if (!item.hasItemMeta()) + { + return; + } + if (!item.getItemMeta().hasDisplayName()) + { + return; + } event.setCancelled(true); if (item.getType() == Material.FEATHER) { diff --git a/src/main/java/dev/plex/punishment/Punishment.java b/src/main/java/dev/plex/punishment/Punishment.java index cebc727..3aadd6f 100644 --- a/src/main/java/dev/plex/punishment/Punishment.java +++ b/src/main/java/dev/plex/punishment/Punishment.java @@ -19,21 +19,17 @@ import net.kyori.adventure.text.Component; @Setter public class Punishment { + private static final String banUrl = Plex.get().config.getString("banning.ban_url"); + private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a"); private final UUID punished; private final UUID punisher; - private final List IPS; - private String punishedUsername; - private PunishmentType type; private String reason; - private boolean customTime; private boolean active; // Field is only for bans - private LocalDateTime endDate; - public Punishment(UUID punished, UUID punisher) { this.punished = punished; @@ -47,22 +43,19 @@ public class Punishment this.endDate = null; } - private static final String banUrl = Plex.get().config.getString("banning.ban_url"); - private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a"); - public static Component generateBanMessage(Punishment punishment) { return PlexUtils.messageComponent("banMessage", banUrl, punishment.getReason(), DATE_FORMAT.format(punishment.getEndDate()), punishment.getPunisher() == null ? "CONSOLE" : MojangUtils.getInfo(punishment.getPunisher().toString()).getUsername()); } - public String toJSON() - { - return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).create().toJson(this); - } - public static Punishment fromJson(String json) { return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer()).create().fromJson(json, Punishment.class); } + + public String toJSON() + { + return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).create().toJson(this); + } } diff --git a/src/main/java/dev/plex/services/impl/GameRuleService.java b/src/main/java/dev/plex/services/impl/GameRuleService.java index 96af258..f7f97b9 100644 --- a/src/main/java/dev/plex/services/impl/GameRuleService.java +++ b/src/main/java/dev/plex/services/impl/GameRuleService.java @@ -1,18 +1,11 @@ package dev.plex.services.impl; -import dev.plex.Plex; import dev.plex.services.AbstractService; import dev.plex.util.PlexLog; import dev.plex.util.PlexUtils; -import org.apache.commons.lang.BooleanUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.lang3.EnumUtils; import org.bukkit.Bukkit; -import org.bukkit.GameRule; import org.bukkit.World; -import java.util.Locale; - public class GameRuleService extends AbstractService { public GameRuleService() @@ -30,8 +23,6 @@ public class GameRuleService extends AbstractService } } - - @Override public int repeatInSeconds() { diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java index 4b7c80b..bb87349 100644 --- a/src/main/java/dev/plex/util/PlexUtils.java +++ b/src/main/java/dev/plex/util/PlexUtils.java @@ -44,12 +44,6 @@ import org.json.simple.parser.ParseException; public class PlexUtils extends PlexBase { - public static Map CHAT_COLOR_NAMES; - public static List CHAT_COLOR_POOL; - public static List DEVELOPERS = - Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo - "f5cd54c4-3a24-4213-9a56-c06c49594dff" // Taahh - ); private static final Random RANDOM; private static final List regxList = new ArrayList<>() {{ @@ -61,6 +55,12 @@ public class PlexUtils extends PlexBase add("m"); add("s"); }}; + public static Map CHAT_COLOR_NAMES; + public static List CHAT_COLOR_POOL; + public static List DEVELOPERS = + Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo + "f5cd54c4-3a24-4213-9a56-c06c49594dff" // Taahh + ); static { diff --git a/src/main/java/dev/plex/world/CustomChunkGenerator.java b/src/main/java/dev/plex/world/CustomChunkGenerator.java index 1d5d496..9708382 100644 --- a/src/main/java/dev/plex/world/CustomChunkGenerator.java +++ b/src/main/java/dev/plex/world/CustomChunkGenerator.java @@ -8,8 +8,8 @@ import org.bukkit.generator.ChunkGenerator; public abstract class CustomChunkGenerator extends ChunkGenerator { - protected int height; private final List populators; + protected int height; protected CustomChunkGenerator(int height, BlockPopulator... populators) { diff --git a/src/main/java/dev/plex/world/CustomWorld.java b/src/main/java/dev/plex/world/CustomWorld.java index f637311..e6b574f 100644 --- a/src/main/java/dev/plex/world/CustomWorld.java +++ b/src/main/java/dev/plex/world/CustomWorld.java @@ -24,17 +24,6 @@ public class CustomWorld extends WorldCreator this.generator(this.chunks); } - @Override - public ChunkGenerator generator() - { - return chunks; - } - - public World generate() - { - return this.createWorld(); - } - public static World generateConfigFlatWorld(String name) { if (!plugin.config.contains("worlds." + name)) @@ -66,4 +55,15 @@ public class CustomWorld extends WorldCreator }; return customWorld.generate(); } + + @Override + public ChunkGenerator generator() + { + return chunks; + } + + public World generate() + { + return this.createWorld(); + } } \ No newline at end of file