From 0add60322e3957cd3def9d47bd57b5fa71855e64 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:22:05 -0400 Subject: [PATCH 01/22] Update messages.yml --- server/src/main/resources/messages.yml | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/server/src/main/resources/messages.yml b/server/src/main/resources/messages.yml index 9b97556..2376c4d 100644 --- a/server/src/main/resources/messages.yml +++ b/server/src/main/resources/messages.yml @@ -27,6 +27,8 @@ indefBanMessageReason: "Your {0} is indefinitely banned! You may appeal at playerNotFound: "Player not found!" specifyPlayer: "You must specify a player!" worldNotFound: "World not found!" +# This will always be used for punishments where the sanctioning administrator has not provided a reason. Will ignore MiniMessage tags. +noReasonProvided: "No reason provided." # 0 - The world you have been teleported to playerWorldTeleport: "You have been teleported to {0}." # 0 - The person who is freezing @@ -210,3 +212,41 @@ playersMaterialCleared: "{0} has been removed from the following players: nobodyHasThatMaterial: "No one online has that in their inventory." # 0 - The attempted material name materialNotFound: "{0} is not a valid item/block name." +# 0 - The players name +loginMessage: "{0} joined the game" +# 0 - The string that wasn't a valid integer +notANumber: "{0} is not a valid number!" +# 0 - Players currently online +# 1 - Max players +listHeader: "There is currently {0} player online out of {1} players." +# 0 - Players currently online +# 1 - Max players +listHeaderPlural: "There are currently {0} players online out of {1} players." +# 0 - Player who is having their notes fetched +notesHeader: "Player notes for: {0}" +# 0 - Note ID +# 1 - Author of the note +# 2 - Timestamp +notePrefix: "{0} - Written by: {1} on {2}" +# 0 - The content of the note +noteLine: "# {0}" +# 0 - The player +# 1 - The number of notes logged for said player +playerNoteAlert: "{0} has {1} note. Click here to view their note." +# 0 - The player +# 1 - The number of notes logged for said player +playerNoteAlertPlural: "{0} has {1} notes. Click here to view their notes." +smiteTitleHeader: "You've been smitten." +# 0 - The reason for the smite. Will default to noReasonProvided if no reason is specified. +# 1 - The admin / staff member +smiteTitleMessage: "Be sure to follow the rules!" +# 0 - The player +# 1 - The reason for the smite. Will default to noReasonProvided if no reason is specified. +# 2 - The admin / staff member +smiteBroadcast: "{0} has been smitten! - Reason: {1} - Smitten by: {2}" +# 0 - The player +smittenQuietly: "Smitten {0} quietly." +# 0 - The reason for being smitten +smitten: "You've been smitten. Reason: {0}" +nukerKickMessage: "Please turn off your nuker!" +antiSpamMessage: "Please refrain from spamming messages." From 7d94717de59d9d77376e988108c2a56dc9634560 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:23:37 -0400 Subject: [PATCH 02/22] Update BanCMD.java --- server/src/main/java/dev/plex/command/impl/BanCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/BanCMD.java b/server/src/main/java/dev/plex/command/impl/BanCMD.java index 05d59c0..39edc80 100644 --- a/server/src/main/java/dev/plex/command/impl/BanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BanCMD.java @@ -68,12 +68,12 @@ public class BanCMD extends PlexCommand { reason = StringUtils.join(args, " ", 1, args.length); String newReason = StringUtils.normalizeSpace(reason.replace("-nrb", "")); - punishment.setReason(newReason.trim().isEmpty() ? "No reason provided." : newReason); + punishment.setReason(newReason.trim().isEmpty() ? messageString("noReasonProvided") : newReason); rollBack = !reason.startsWith("-nrb") && !reason.endsWith("-nrb"); } else { - punishment.setReason("No reason provided."); + punishment.setReason(messageString("noReasonProvided")); } punishment.setPunishedUsername(plexPlayer.getName()); ZonedDateTime date = ZonedDateTime.now(ZoneId.of(TimeUtils.TIMEZONE)); From 5040c76dc6617c39d13e718a4b1a02884c4cf60e Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:24:49 -0400 Subject: [PATCH 03/22] Update BcastLoginMessageCMD.java --- .../main/java/dev/plex/command/impl/BcastLoginMessageCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java b/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java index bfc69d8..2eac9e4 100644 --- a/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java @@ -41,7 +41,7 @@ public class BcastLoginMessageCMD extends PlexCommand if (!loginMessage.isEmpty()) { PlexUtils.broadcast(PlexUtils.stringToComponent(loginMessage)); - PlexUtils.broadcast(mmString("" + plexPlayer.getName() + " joined the game")); + PlexUtils.broadcast(messageComponent("loginMessage", plexPlayer.getName())); } else { @@ -56,4 +56,4 @@ public class BcastLoginMessageCMD extends PlexCommand { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of(); } -} \ No newline at end of file +} From bc163aa51a2fa633c0447076fdfd4bae4ae4c3fd Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:25:26 -0400 Subject: [PATCH 04/22] Update EntityWipeCMD.java --- server/src/main/java/dev/plex/command/impl/EntityWipeCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/EntityWipeCMD.java b/server/src/main/java/dev/plex/command/impl/EntityWipeCMD.java index 2904815..936ee32 100644 --- a/server/src/main/java/dev/plex/command/impl/EntityWipeCMD.java +++ b/server/src/main/java/dev/plex/command/impl/EntityWipeCMD.java @@ -134,7 +134,7 @@ public class EntityWipeCMD extends PlexCommand } catch (NumberFormatException ex) { - sender.sendMessage(mmString("" + string + " is not a valid number!")); + sender.sendMessage(messageComponent("notANumber", string)); } return null; } @@ -155,4 +155,4 @@ public class EntityWipeCMD extends PlexCommand } return true; } -} \ No newline at end of file +} From 5a7a2c18357cc833965a914c67710f8ec7d59c6d Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:25:49 -0400 Subject: [PATCH 05/22] Update KickCMD.java --- server/src/main/java/dev/plex/command/impl/KickCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/KickCMD.java b/server/src/main/java/dev/plex/command/impl/KickCMD.java index ffe5078..af15a5c 100644 --- a/server/src/main/java/dev/plex/command/impl/KickCMD.java +++ b/server/src/main/java/dev/plex/command/impl/KickCMD.java @@ -38,7 +38,7 @@ public class KickCMD extends PlexCommand } PlexPlayer plexPlayer = DataUtils.getPlayer(args[0]); - String reason = "No reason provided"; + String reason = messageString("noReasonProvided"); if (plexPlayer == null) { @@ -74,4 +74,4 @@ public class KickCMD extends PlexCommand { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of(); } -} \ No newline at end of file +} From 8f55be369ff15a584b06b2b5ac8d87d3c8fdde9e Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:26:20 -0400 Subject: [PATCH 06/22] Update ListCMD.java --- .../main/java/dev/plex/command/impl/ListCMD.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/ListCMD.java b/server/src/main/java/dev/plex/command/impl/ListCMD.java index 809d857..b57a6c5 100644 --- a/server/src/main/java/dev/plex/command/impl/ListCMD.java +++ b/server/src/main/java/dev/plex/command/impl/ListCMD.java @@ -2,6 +2,7 @@ package dev.plex.command.impl; import com.google.common.collect.Lists; import dev.plex.command.PlexCommand; +import dev.plex.util.PlexUtils; import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandPermissions; import dev.plex.hook.VaultHook; @@ -27,17 +28,7 @@ public class ListCMD extends PlexCommand List players = Lists.newArrayList(Bukkit.getOnlinePlayers()); players.removeIf(PlayerMeta::isVanished); Component list = Component.empty(); - Component header = Component.text("There " + (players.size() == 1 ? "is" : "are") + " currently").color(NamedTextColor.GRAY) - .append(Component.space()) - .append(Component.text(players.size()).color(NamedTextColor.YELLOW)) - .append(Component.space()) - .append(Component.text(players.size() == 1 ? "player" : "players").color(NamedTextColor.GRAY)) - .append(Component.space()) - .append(Component.text("online out of").color(NamedTextColor.GRAY)) - .append(Component.space()) - .append(Component.text(Bukkit.getMaxPlayers()).color(NamedTextColor.YELLOW)) - .append(Component.space()) - .append(Component.text(Bukkit.getMaxPlayers() == 1 ? "player." : "players.").color(NamedTextColor.GRAY)); + Component header = PlexUtils.messageComponent(players.size() == 1 ? "listHeader" : "listHeaderPlural", players.size(), Bukkit.getMaxPlayers()); send(sender, header); if (players.isEmpty()) { From 773f320cb6b940b4c5451b94f3e396909c89a42a Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:27:17 -0400 Subject: [PATCH 07/22] Update NotesCMD.java --- server/src/main/java/dev/plex/command/impl/NotesCMD.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/NotesCMD.java b/server/src/main/java/dev/plex/command/impl/NotesCMD.java index ca0eb88..ab36610 100644 --- a/server/src/main/java/dev/plex/command/impl/NotesCMD.java +++ b/server/src/main/java/dev/plex/command/impl/NotesCMD.java @@ -124,11 +124,11 @@ public class NotesCMD extends PlexCommand private void readNotes(@NotNull CommandSender sender, PlexPlayer plexPlayer, List notes) { - AtomicReference noteList = new AtomicReference<>(Component.text("Player notes for: " + plexPlayer.getName()).color(NamedTextColor.GREEN)); + AtomicReference noteList = new AtomicReference<>(messageComponent("notesHeader", plexPlayer.getName())); for (Note note : notes) { - Component noteLine = mmString("" + note.getId() + " - Written by: " + DataUtils.getPlayer(note.getWrittenBy()).getName() + " on " + TimeUtils.useTimezone(note.getTimestamp())); - noteLine = noteLine.append(mmString("# " + note.getNote())); + Component noteLine = messageComponent("notePrefix", note.getId(), DataUtils.getPlayer(note.getWrittenBy()).getName(), TimeUtils.useTimezone(note.getTimestamp())); + noteLine = noteLine.append(messageComponent("noteLine", note.getNote())); noteList.set(noteList.get().append(Component.newline())); noteList.set(noteList.get().append(noteLine)); } @@ -152,4 +152,4 @@ public class NotesCMD extends PlexCommand } return Collections.emptyList(); } -} \ No newline at end of file +} From 647f17b5bd747de6d4cdfa5b77c2a4932953aa18 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:27:47 -0400 Subject: [PATCH 08/22] Update SmiteCMD.java --- .../main/java/dev/plex/command/impl/SmiteCMD.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/SmiteCMD.java b/server/src/main/java/dev/plex/command/impl/SmiteCMD.java index 197208e..58fa334 100644 --- a/server/src/main/java/dev/plex/command/impl/SmiteCMD.java +++ b/server/src/main/java/dev/plex/command/impl/SmiteCMD.java @@ -78,21 +78,16 @@ public class SmiteCMD extends PlexCommand final Player player = getNonNullPlayer(args[0]); final PlexPlayer plexPlayer = getPlexPlayer(player); - Title title = Title.title(Component.text("You've been smitten.").color(NamedTextColor.RED), Component.text("Be sure to follow the rules!").color(NamedTextColor.YELLOW)); + Title title = Title.title(messageComponent("smiteTitleHeader"), messageComponent("smiteTitleMessage", reason, sender.getName())); player.showTitle(title); if (!silent) { - PlexUtils.broadcast(mmString("" + player.getName() + " has been a naughty, naughty boy.")); - if (reason != null) - { - PlexUtils.broadcast(mmString(" Reason: " + "" + reason)); - } - PlexUtils.broadcast(mmString(" Smitten by: " + "" + sender.getName())); + PlexUtils.broadcast(messageComponent("smiteBroadcast", player.getName(), reason != null ? reason : messageString("noReasonProvided"), sender.getName())); } else { - send(sender, "Smitten " + player.getName() + " quietly."); + send(sender, messageComponent("smittenQuietly", player.getName())); } // Set gamemode to survival @@ -129,8 +124,8 @@ public class SmiteCMD extends PlexCommand if (reason != null) { punishment.setReason(reason); - send(player, mmString("You've been smitten. Reason: " + reason)); } + send(player, messageComponent("smitten", reason != null ? reason : messageString("noReasonProvided"))); return null; } @@ -143,4 +138,4 @@ public class SmiteCMD extends PlexCommand } return Collections.emptyList(); } -} \ No newline at end of file +} From 0c7b280aef7e8900646f516826f352e4d55dcd8a Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:28:34 -0400 Subject: [PATCH 09/22] Update TempbanCMD.java --- server/src/main/java/dev/plex/command/impl/TempbanCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java index bada248..e295524 100644 --- a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -58,12 +58,12 @@ public class TempbanCMD extends PlexCommand { reason = StringUtils.join(args, " ", 2, args.length); String newReason = StringUtils.normalizeSpace(reason.replace("-nrb", "")); - punishment.setReason(newReason.trim().isEmpty() ? "No reason provided." : newReason); + punishment.setReason(newReason.trim().isEmpty() ? messageString("noReasonProvided") : newReason); rollBack = !reason.startsWith("-nrb") && !reason.endsWith("-nrb"); } else { - punishment.setReason("No reason provided."); + punishment.setReason(messageString("noReasonProvided")); } punishment.setPunishedUsername(target.getName()); punishment.setEndDate(TimeUtils.createDate(args[1])); From 6e5f0d7bebdd9d75d6b26a8ac442ffbd20285721 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:29:24 -0400 Subject: [PATCH 10/22] Update AntiNukerListener.java --- .../main/java/dev/plex/listener/impl/AntiNukerListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/AntiNukerListener.java b/server/src/main/java/dev/plex/listener/impl/AntiNukerListener.java index 447c003..9c4f8c6 100644 --- a/server/src/main/java/dev/plex/listener/impl/AntiNukerListener.java +++ b/server/src/main/java/dev/plex/listener/impl/AntiNukerListener.java @@ -1,6 +1,7 @@ package dev.plex.listener.impl; import dev.plex.listener.PlexListener; +import dev.plex.util.PlexUtils; import dev.plex.services.impl.TimingService; import net.kyori.adventure.text.Component; import org.bukkit.event.EventHandler; @@ -19,7 +20,7 @@ public class AntiNukerListener extends PlexListener if (getCount(event.getPlayer().getUniqueId()) > 200L) { TimingService.strikes.merge(event.getPlayer().getUniqueId(), 1L, Long::sum); - event.getPlayer().kick(Component.text("Please turn off your nuker!")); + event.getPlayer().kick(PlexUtils.messageComponent("nukerKickMessage")); event.setCancelled(true); } } @@ -31,7 +32,7 @@ public class AntiNukerListener extends PlexListener if (getCount(event.getPlayer().getUniqueId()) > 200L) { TimingService.strikes.merge(event.getPlayer().getUniqueId(), 1L, Long::sum); - event.getPlayer().kick(Component.text("Please turn off your nuker!")); + event.getPlayer().kick(PlexUtils.messageComponent("nukerKickMessage")); event.setCancelled(true); } } From 344df2b2252126bf00a0c3627f521cff8a625ecf Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:29:38 -0400 Subject: [PATCH 11/22] Update AntiSpamListener.java --- .../main/java/dev/plex/listener/impl/AntiSpamListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/AntiSpamListener.java b/server/src/main/java/dev/plex/listener/impl/AntiSpamListener.java index 1de01e0..4b87aac 100644 --- a/server/src/main/java/dev/plex/listener/impl/AntiSpamListener.java +++ b/server/src/main/java/dev/plex/listener/impl/AntiSpamListener.java @@ -1,6 +1,7 @@ package dev.plex.listener.impl; import dev.plex.listener.PlexListener; +import dev.plex.util.PlexUtils; import dev.plex.services.impl.TimingService; import io.papermc.paper.event.player.AsyncChatEvent; import net.kyori.adventure.text.Component; @@ -19,7 +20,7 @@ public class AntiSpamListener extends PlexListener TimingService.spamCooldown.merge(event.getPlayer().getUniqueId(), 1L, Long::sum); if (getCount(event.getPlayer().getUniqueId()) > 8L) { - event.getPlayer().sendMessage(Component.text("Please refrain from spamming messages.").color(NamedTextColor.GRAY)); + event.getPlayer().sendMessage(PlexUtils.messageComponent("antiSpamMessage")); event.setCancelled(true); } } @@ -30,7 +31,7 @@ public class AntiSpamListener extends PlexListener TimingService.spamCooldown.merge(event.getPlayer().getUniqueId(), 1L, Long::sum); if (getCount(event.getPlayer().getUniqueId()) > 8L) { - event.getPlayer().sendMessage(Component.text("Please refrain from spamming commands.").color(NamedTextColor.GRAY)); + event.getPlayer().sendMessage(PlexUtils.messageComponent("antiSpamMessage")); event.setCancelled(true); } } From 5b3a37835ac568c091553f5336c45eee3759a929 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:30:22 -0400 Subject: [PATCH 12/22] Update PlayerListener.java --- .../src/main/java/dev/plex/listener/impl/PlayerListener.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/PlayerListener.java b/server/src/main/java/dev/plex/listener/impl/PlayerListener.java index ebe8a51..9878f6b 100644 --- a/server/src/main/java/dev/plex/listener/impl/PlayerListener.java +++ b/server/src/main/java/dev/plex/listener/impl/PlayerListener.java @@ -71,11 +71,9 @@ public class PlayerListener extends PlexListener plugin.getSqlNotes().getNotes(plexPlayer.getUuid()).whenComplete((notes, ex) -> { - String plural = notes.size() == 1 ? "note." : "notes."; if (!notes.isEmpty()) { - PlexUtils.broadcastToAdmins(Component.text(plexPlayer.getName() + " has " + notes.size() + " " + plural).color(NamedTextColor.GOLD), "plex.notes.notify"); - PlexUtils.broadcastToAdmins(Component.text("Click to view their " + plural).clickEvent(ClickEvent.runCommand("/notes " + plexPlayer.getName() + " list")).color(NamedTextColor.GOLD), "plex.notes.notify"); + PlexUtils.broadcastToAdmins(PlexUtils.messageComponent(notes.size() == 1 ? "playerNoteAlert" : "playerNoteAlertPlural", plexPlayer.getName(), notes.size()), "plex.notes.notify"); } }); } From e2b3488aa77d6ff68b6f31a07d0fba149a46f308 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:31:33 -0400 Subject: [PATCH 13/22] Update ServerListener.java --- .../plex/listener/impl/ServerListener.java | 192 +++++++++++++++--- 1 file changed, 166 insertions(+), 26 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/ServerListener.java b/server/src/main/java/dev/plex/listener/impl/ServerListener.java index 78d6049..9b93804 100644 --- a/server/src/main/java/dev/plex/listener/impl/ServerListener.java +++ b/server/src/main/java/dev/plex/listener/impl/ServerListener.java @@ -1,47 +1,187 @@ package dev.plex.listener.impl; -import com.destroystokyo.paper.event.server.PaperServerListPingEvent; import dev.plex.listener.PlexListener; -import dev.plex.util.PlexUtils; -import dev.plex.util.RandomUtil; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.block.data.Openable; +import org.bukkit.command.Command; +import org.bukkit.command.PluginIdentifiableCommand; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.player.*; +import java.util.Arrays; import java.util.List; -import java.util.concurrent.atomic.AtomicReference; -public class ServerListener extends PlexListener +public class WorldListener extends PlexListener { - @EventHandler - public void onServerPing(PaperServerListPingEvent event) + private final List EDIT_COMMANDS = Arrays.asList("bigtree", "ebigtree", "largetree", "elargetree", "break", "ebreak", "antioch", "nuke", "editsign", "tree", "etree"); + + @EventHandler(priority = EventPriority.LOWEST) + public void onBlockPlace(BlockPlaceEvent event) { - String baseMotd = plugin.config.getString("server.motd"); - baseMotd = baseMotd.replace("\\n", "\n"); - baseMotd = baseMotd.replace("%servername%", plugin.config.getString("server.name")); - baseMotd = baseMotd.replace("%mcversion%", Bukkit.getBukkitVersion().split("-")[0]); - if (plugin.config.getBoolean("server.colorize_motd")) + if (!canModifyWorld(event.getPlayer(), true)) { - AtomicReference motd = new AtomicReference<>(Component.empty()); - for (final String word : baseMotd.split(" ")) - { - motd.set(motd.get().append(Component.text(word).color(RandomUtil.getRandomColor()))); - motd.set(motd.get().append(Component.space())); - } - event.motd(motd.get()); + event.setCancelled(true); } - else + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onBlockBreak(BlockBreakEvent event) + { + if (!canModifyWorld(event.getPlayer(), true)) { - event.motd(PlexUtils.mmDeserialize(baseMotd.trim())); + event.setCancelled(true); } - if (plugin.config.contains("server.sample")) + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteractWorld(PlayerInteractEvent event) + { + if (event.getInteractionPoint() != null && event.getInteractionPoint().getBlock().getBlockData() instanceof Openable) return; + if (!canModifyWorld(event.getPlayer(), true)) { - List samples = plugin.config.getStringList("server.sample"); - if (!samples.isEmpty()) + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteractWorld(PlayerInteractEntityEvent event) + { + if (!canModifyWorld(event.getPlayer(), true)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteractWorld(PlayerItemDamageEvent event) + { + if (!canModifyWorld(event.getPlayer(), true)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInteractWorld(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Player player)) return; + if (!canModifyWorld(player, true)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onEntitySpawn(EntitySpawnEvent event) + { + if (event.getEntityType() != EntityType.SLIME) + { + return; + } + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) + { + // If the person has permission to modify the world, we don't need to block WorldEdit + if (canModifyWorld(event.getPlayer(), false)) + { + return; + } + + String message = event.getMessage(); + // Don't check the arguments + message = message.replaceAll("\\s.*", "").replaceFirst("/", ""); + Command command = Bukkit.getCommandMap().getCommand(message); + if (command != null) + { + // This does check for aliases + boolean isWeCommand = command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin().equals(Bukkit.getPluginManager().getPlugin("WorldEdit")); + boolean isFaweCommand = command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin().equals(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit")); + if (isWeCommand || isFaweCommand || EDIT_COMMANDS.contains(message.toLowerCase())) { - event.getPlayerSample().clear(); - event.getPlayerSample().addAll(samples.stream().map(string -> string.replace("&", "§")).map(Bukkit::createProfile).toList()); + String noEdit = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.message"); + event.getPlayer().sendMessage(MiniMessage.miniMessage().deserialize(noEdit)); + event.setCancelled(true); } } } + + @EventHandler(priority = EventPriority.LOWEST) + public void onWorldTeleport(PlayerTeleportEvent event) + { + if (!canEnterWorld(event.getPlayer(), event.getTo().getWorld())) + { + event.setCancelled(true); + } + } + + /** + * Check if a Player has the ability to modify the world they are in + * + * @param player The player who wants to modify the world + * @param showMessage Whether the message from the config.yml should be shown + * @return Returns true if the person has the ability to modify the world + */ + private boolean canModifyWorld(Player player, boolean showMessage) + { + World world = player.getWorld(); + String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.permission"); + if (permission == null) + { + return true; + } + if (player.hasPermission(permission)) + { + return true; + } + + if (showMessage) + { + String noEdit = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.message"); + if (noEdit != null) + { + player.sendMessage(MiniMessage.miniMessage().deserialize(noEdit)); + } + } + return false; + } + + /** + * Check if a Player has the ability to enter the requested world + * + * @param player The player who wants to enter the world + * @return Returns true if the person has the ability to enter the world + */ + private boolean canEnterWorld(Player player, World destination) + { + String permission = plugin.config.getString("worlds." + destination.getName().toLowerCase() + ".entry.permission"); + if (permission == null) + { + return true; + } + if (player.hasPermission(permission)) + { + return true; + } + + String noEntry = plugin.config.getString("worlds." + destination.getName().toLowerCase() + ".entry.message"); + if (noEntry != null) + { + player.sendMessage(MiniMessage.miniMessage().deserialize(noEntry)); + } + return false; + } } From a0471e63f60c3100de97f05b6d7aeb8868ae2a61 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:42:33 -0400 Subject: [PATCH 14/22] Update WorldListener.java --- .../src/main/java/dev/plex/listener/impl/WorldListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/WorldListener.java b/server/src/main/java/dev/plex/listener/impl/WorldListener.java index e789568..49982df 100644 --- a/server/src/main/java/dev/plex/listener/impl/WorldListener.java +++ b/server/src/main/java/dev/plex/listener/impl/WorldListener.java @@ -112,7 +112,8 @@ public class WorldListener extends PlexListener boolean isFaweCommand = command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin().equals(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit")); if (isWeCommand || isFaweCommand || EDIT_COMMANDS.contains(message.toLowerCase())) { - event.getPlayer().sendMessage(Component.text("You do not have permission to use that command in this world.").color(NamedTextColor.RED)); + String noEdit = plugin.config.getString("worlds." + event.getPlayer().getWorld().getName().toLowerCase() + ".modification.message"); + event.getPlayer().sendMessage(MiniMessage.miniMessage().deserialize(noEdit)); event.setCancelled(true); } } @@ -183,4 +184,4 @@ public class WorldListener extends PlexListener } return false; } -} \ No newline at end of file +} From d7ad94d2701f014dceda144bfd0372636366ef6f Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Thu, 2 May 2024 17:43:06 -0400 Subject: [PATCH 15/22] overrwrote the wrong file :( --- .../plex/listener/impl/ServerListener.java | 200 +++--------------- 1 file changed, 30 insertions(+), 170 deletions(-) diff --git a/server/src/main/java/dev/plex/listener/impl/ServerListener.java b/server/src/main/java/dev/plex/listener/impl/ServerListener.java index 9b93804..78d6049 100644 --- a/server/src/main/java/dev/plex/listener/impl/ServerListener.java +++ b/server/src/main/java/dev/plex/listener/impl/ServerListener.java @@ -1,187 +1,47 @@ package dev.plex.listener.impl; +import com.destroystokyo.paper.event.server.PaperServerListPingEvent; import dev.plex.listener.PlexListener; +import dev.plex.util.PlexUtils; +import dev.plex.util.RandomUtil; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.block.data.Openable; -import org.bukkit.command.Command; -import org.bukkit.command.PluginIdentifiableCommand; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.player.*; -import java.util.Arrays; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; -public class WorldListener extends PlexListener +public class ServerListener extends PlexListener { - private final List EDIT_COMMANDS = Arrays.asList("bigtree", "ebigtree", "largetree", "elargetree", "break", "ebreak", "antioch", "nuke", "editsign", "tree", "etree"); - - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockPlace(BlockPlaceEvent event) + @EventHandler + public void onServerPing(PaperServerListPingEvent event) { - if (!canModifyWorld(event.getPlayer(), true)) + String baseMotd = plugin.config.getString("server.motd"); + baseMotd = baseMotd.replace("\\n", "\n"); + baseMotd = baseMotd.replace("%servername%", plugin.config.getString("server.name")); + baseMotd = baseMotd.replace("%mcversion%", Bukkit.getBukkitVersion().split("-")[0]); + if (plugin.config.getBoolean("server.colorize_motd")) { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockBreak(BlockBreakEvent event) - { - if (!canModifyWorld(event.getPlayer(), true)) - { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onInteractWorld(PlayerInteractEvent event) - { - if (event.getInteractionPoint() != null && event.getInteractionPoint().getBlock().getBlockData() instanceof Openable) return; - if (!canModifyWorld(event.getPlayer(), true)) - { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onInteractWorld(PlayerInteractEntityEvent event) - { - if (!canModifyWorld(event.getPlayer(), true)) - { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onInteractWorld(PlayerItemDamageEvent event) - { - if (!canModifyWorld(event.getPlayer(), true)) - { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onInteractWorld(EntityDamageByEntityEvent event) - { - if (!(event.getDamager() instanceof Player player)) return; - if (!canModifyWorld(player, true)) - { - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onEntitySpawn(EntitySpawnEvent event) - { - if (event.getEntityType() != EntityType.SLIME) - { - return; - } - event.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) - { - // If the person has permission to modify the world, we don't need to block WorldEdit - if (canModifyWorld(event.getPlayer(), false)) - { - return; - } - - String message = event.getMessage(); - // Don't check the arguments - message = message.replaceAll("\\s.*", "").replaceFirst("/", ""); - Command command = Bukkit.getCommandMap().getCommand(message); - if (command != null) - { - // This does check for aliases - boolean isWeCommand = command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin().equals(Bukkit.getPluginManager().getPlugin("WorldEdit")); - boolean isFaweCommand = command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin().equals(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit")); - if (isWeCommand || isFaweCommand || EDIT_COMMANDS.contains(message.toLowerCase())) + AtomicReference motd = new AtomicReference<>(Component.empty()); + for (final String word : baseMotd.split(" ")) { - String noEdit = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.message"); - event.getPlayer().sendMessage(MiniMessage.miniMessage().deserialize(noEdit)); - event.setCancelled(true); + motd.set(motd.get().append(Component.text(word).color(RandomUtil.getRandomColor()))); + motd.set(motd.get().append(Component.space())); + } + event.motd(motd.get()); + } + else + { + event.motd(PlexUtils.mmDeserialize(baseMotd.trim())); + } + if (plugin.config.contains("server.sample")) + { + List samples = plugin.config.getStringList("server.sample"); + if (!samples.isEmpty()) + { + event.getPlayerSample().clear(); + event.getPlayerSample().addAll(samples.stream().map(string -> string.replace("&", "§")).map(Bukkit::createProfile).toList()); } } } - - @EventHandler(priority = EventPriority.LOWEST) - public void onWorldTeleport(PlayerTeleportEvent event) - { - if (!canEnterWorld(event.getPlayer(), event.getTo().getWorld())) - { - event.setCancelled(true); - } - } - - /** - * Check if a Player has the ability to modify the world they are in - * - * @param player The player who wants to modify the world - * @param showMessage Whether the message from the config.yml should be shown - * @return Returns true if the person has the ability to modify the world - */ - private boolean canModifyWorld(Player player, boolean showMessage) - { - World world = player.getWorld(); - String permission = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.permission"); - if (permission == null) - { - return true; - } - if (player.hasPermission(permission)) - { - return true; - } - - if (showMessage) - { - String noEdit = plugin.config.getString("worlds." + world.getName().toLowerCase() + ".modification.message"); - if (noEdit != null) - { - player.sendMessage(MiniMessage.miniMessage().deserialize(noEdit)); - } - } - return false; - } - - /** - * Check if a Player has the ability to enter the requested world - * - * @param player The player who wants to enter the world - * @return Returns true if the person has the ability to enter the world - */ - private boolean canEnterWorld(Player player, World destination) - { - String permission = plugin.config.getString("worlds." + destination.getName().toLowerCase() + ".entry.permission"); - if (permission == null) - { - return true; - } - if (player.hasPermission(permission)) - { - return true; - } - - String noEntry = plugin.config.getString("worlds." + destination.getName().toLowerCase() + ".entry.message"); - if (noEntry != null) - { - player.sendMessage(MiniMessage.miniMessage().deserialize(noEntry)); - } - return false; - } } From c0966a0f5e651a902af6169a76a23d759682419b Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Sat, 4 May 2024 02:44:53 -0400 Subject: [PATCH 16/22] Update messages.yml --- server/src/main/resources/messages.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/main/resources/messages.yml b/server/src/main/resources/messages.yml index 2376c4d..fb74a4c 100644 --- a/server/src/main/resources/messages.yml +++ b/server/src/main/resources/messages.yml @@ -250,3 +250,13 @@ smittenQuietly: "Smitten {0} quietly." smitten: "You've been smitten. Reason: {0}" nukerKickMessage: "Please turn off your nuker!" antiSpamMessage: "Please refrain from spamming messages." +# 0 - The player +banExpiredBroadcast: "Plex - Automatically unbanning {0}" +# 0 - The player +redisResetSuccessful: "Successfuly reset {0}'s Redis punishments!" +redisResetPlayerNotFound: "Couldn't find player in Redis punishments." +reappliedGamerules: "All game rules have been re-applied!" +commandNotFound: "That command could not be found!" +# 0 - The command +# 1 - A list of aliases found +commandAliases: "Aliases for {0} are: {1}" From f1680174ae34db4f8646578c60d256d3e21e3a39 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Sat, 4 May 2024 02:45:39 -0400 Subject: [PATCH 17/22] Update DebugCMD.java --- .../main/java/dev/plex/command/impl/DebugCMD.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/DebugCMD.java b/server/src/main/java/dev/plex/command/impl/DebugCMD.java index a1635f2..02f6a2c 100644 --- a/server/src/main/java/dev/plex/command/impl/DebugCMD.java +++ b/server/src/main/java/dev/plex/command/impl/DebugCMD.java @@ -41,9 +41,9 @@ public class DebugCMD extends PlexCommand if (plugin.getRedisConnection().getJedis().exists(player.getUniqueId().toString())) { plugin.getRedisConnection().getJedis().del(player.getUniqueId().toString()); - return componentFromString("Successfully reset " + player.getName() + "'s Redis punishments!").color(NamedTextColor.YELLOW); + return messageComponent("redisResetSuccessful", player.getName()); } - return componentFromString("Couldn't find player in Redis punishments."); + return messageComponent("redisResetPlayerNotFound"); } } if (args[0].equalsIgnoreCase("gamerules")) @@ -62,7 +62,7 @@ public class DebugCMD extends PlexCommand PlexLog.log("Set specific gamerules for world: " + world.toLowerCase(Locale.ROOT)); } } - return mmString("Re-applied game all the game rules!"); + return messageComponent("reappliedGamerules"); } if (args[0].equalsIgnoreCase("aliases")) { @@ -72,9 +72,9 @@ public class DebugCMD extends PlexCommand Command command = plugin.getServer().getCommandMap().getCommand(commandName); if (command == null) { - return mmString("That command could not be found!"); + return messageComponent("commandNotFound"); } - return mmString("Aliases for " + commandName + " are: " + Arrays.toString(command.getAliases().toArray(new String[0]))); + return messageComponent("commandAliases", commandName, Arrays.toString(command.getAliases().toArray(new String[0]))); } } if (args[0].equalsIgnoreCase("pagination")) @@ -94,4 +94,4 @@ public class DebugCMD extends PlexCommand { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of(); } -} \ No newline at end of file +} From 7383e0d9bb935d64ceeb6f56271beb6592c2e7cf Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Sat, 4 May 2024 02:46:07 -0400 Subject: [PATCH 18/22] Update BanService.java --- server/src/main/java/dev/plex/services/impl/BanService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/dev/plex/services/impl/BanService.java b/server/src/main/java/dev/plex/services/impl/BanService.java index d76f8b3..2d587f6 100644 --- a/server/src/main/java/dev/plex/services/impl/BanService.java +++ b/server/src/main/java/dev/plex/services/impl/BanService.java @@ -3,6 +3,7 @@ package dev.plex.services.impl; import dev.plex.Plex; import dev.plex.services.AbstractService; import dev.plex.util.TimeUtils; +import dev.plex.util.PlexUtils; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import net.kyori.adventure.text.Component; import org.bukkit.Bukkit; @@ -27,7 +28,7 @@ public class BanService extends AbstractService if (ZonedDateTime.now(ZoneId.of(TimeUtils.TIMEZONE)).isAfter(punishment.getEndDate())) { Plex.get().getPunishmentManager().unban(punishment); - Bukkit.broadcast(Component.text("Plex - Unbanned " + Bukkit.getOfflinePlayer(punishment.getPunished()).getName())); + Bukkit.broadcast(PlexUtils.messageComponent("banExpiredBroadcast", Bukkit.getOfflinePlayer(punishment.getPunished()).getName())); } }); }); From 5c609b3d8f755afd00a61f4caea9458ab3178534 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Sat, 4 May 2024 05:19:41 -0400 Subject: [PATCH 19/22] Since this'll be a problem for some reason I'm restoring the original message --- server/src/main/resources/messages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/resources/messages.yml b/server/src/main/resources/messages.yml index fb74a4c..96576a9 100644 --- a/server/src/main/resources/messages.yml +++ b/server/src/main/resources/messages.yml @@ -243,7 +243,7 @@ smiteTitleMessage: "Be sure to follow the rules!" # 0 - The player # 1 - The reason for the smite. Will default to noReasonProvided if no reason is specified. # 2 - The admin / staff member -smiteBroadcast: "{0} has been smitten! - Reason: {1} - Smitten by: {2}" +smiteBroadcast: "{0} has been a naughty, naughty boy. - Reason: {1} - Smitten by: {2}" # 0 - The player smittenQuietly: "Smitten {0} quietly." # 0 - The reason for being smitten From 52cc738d4d1892e35a5332d198df4ccd1e91439d Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Mon, 6 May 2024 15:34:18 -0400 Subject: [PATCH 20/22] fix merge conflict --- .../java/dev/plex/command/impl/BanCMD.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/BanCMD.java b/server/src/main/java/dev/plex/command/impl/BanCMD.java index 39edc80..bd74b02 100644 --- a/server/src/main/java/dev/plex/command/impl/BanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BanCMD.java @@ -13,17 +13,7 @@ import dev.plex.util.BungeeUtil; import dev.plex.util.PlexLog; import dev.plex.util.PlexUtils; import dev.plex.util.TimeUtils; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import net.kyori.adventure.text.Component; -import network.darkhelmet.prism.api.PrismParameters; -import network.darkhelmet.prism.api.Result; -import network.darkhelmet.prism.api.actions.PrismProcessType; import org.apache.commons.lang3.StringUtils; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -31,7 +21,12 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "ban", usage = "/ [reason] [-nrb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online") +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.Collections; +import java.util.List; + +@CommandParameters(name = "ban", usage = "/ [reason] [-rb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online") @CommandPermissions(permission = "plex.ban", source = RequiredCommandSource.ANY) public class BanCMD extends PlexCommand @@ -63,13 +58,13 @@ public class BanCMD extends PlexCommand String reason; Punishment punishment = new Punishment(plexPlayer.getUuid(), getUUID(sender)); punishment.setType(PunishmentType.BAN); - boolean rollBack = true; + boolean rollBack = false; if (args.length > 1) { reason = StringUtils.join(args, " ", 1, args.length); String newReason = StringUtils.normalizeSpace(reason.replace("-nrb", "")); punishment.setReason(newReason.trim().isEmpty() ? messageString("noReasonProvided") : newReason); - rollBack = !reason.startsWith("-nrb") && !reason.endsWith("-nrb"); + rollBack = reason.startsWith("-rb") || reason.endsWith("-rb"); } else { @@ -94,7 +89,7 @@ public class BanCMD extends PlexCommand if (rollBack) { - if (plugin.getPrismHook() != null && plugin.getPrismHook().hasPrism()) + /*if (plugin.getPrismHook() != null && plugin.getPrismHook().hasPrism()) { PrismParameters parameters = plugin.getPrismHook().prismApi().createParameters(); parameters.addActionType("block-place"); @@ -119,10 +114,10 @@ public class BanCMD extends PlexCommand } }); } - else if (plugin.getCoreProtectHook() != null && plugin.getCoreProtectHook().hasCoreProtect()) + else */ + if (plugin.getCoreProtectHook() != null && plugin.getCoreProtectHook().hasCoreProtect()) { - PlexLog.debug("Testing coreprotect"); - Bukkit.getGlobalRegionScheduler().run(plugin, scheduledTask -> + Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask -> { plugin.getCoreProtectHook().coreProtectAPI().performRollback(86400, Collections.singletonList(plexPlayer.getName()), null, null, null, null, 0, null); }); From 50d969975c132cf79fae4758b8c52d25635e2484 Mon Sep 17 00:00:00 2001 From: Deauthorized <49701242+Deauthorized@users.noreply.github.com> Date: Mon, 6 May 2024 15:37:56 -0400 Subject: [PATCH 21/22] fix merge conflict --- server/src/main/java/dev/plex/command/impl/TempbanCMD.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java index e295524..285781a 100644 --- a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; -@CommandParameters(name = "tempban", usage = "/