From 129ef7b6bf47789d052f0b11c9a51d7e180a300d Mon Sep 17 00:00:00 2001 From: Taah Date: Fri, 3 May 2024 14:41:12 -0700 Subject: [PATCH 1/6] Remind me to read the documentation next time... coreprotect is supposed to be called asynchronously lol --- server/src/main/java/dev/plex/command/impl/BanCMD.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..f1093be 100644 --- a/server/src/main/java/dev/plex/command/impl/BanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BanCMD.java @@ -122,7 +122,7 @@ public class BanCMD extends PlexCommand 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 fa1a8a91ba0c468433181b54baf9b02e2d128a10 Mon Sep 17 00:00:00 2001 From: Taah Date: Fri, 3 May 2024 14:54:04 -0700 Subject: [PATCH 2/6] add jenkins webhook for tf --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index d467590..8ec2e6f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,6 +14,7 @@ pipeline { archiveArtifacts artifacts: "build/libs/*.jar", fingerprint: true javadoc javadocDir: "server/build/docs/javadoc", keepAll: false discordSend description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** ${currentBuild.currentResult}", enableArtifactsList: true, footer: "Built with Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, scmWebUrl: "https://github.com/plexusorg/Plex", showChangeset: true, title: env.JOB_NAME, webhookURL: env.WEBHOOK_URL + discordSend description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** ${currentBuild.currentResult}", enableArtifactsList: true, footer: "Built with Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, scmWebUrl: "https://github.com/plexusorg/Plex", showChangeset: true, title: env.JOB_NAME, webhookURL: env.TF_WEBHOOK_URL cleanWs() } } From a5d77036a9cb05d1210888f273cb9b04756e9258 Mon Sep 17 00:00:00 2001 From: Taah Date: Mon, 6 May 2024 12:26:21 -0700 Subject: [PATCH 3/6] closes #91 add rollback only if -rb is specified --- .../java/dev/plex/command/impl/BanCMD.java | 25 ++++++++----------- .../dev/plex/command/impl/TempbanCMD.java | 4 +-- 2 files 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 f1093be..5195ab4 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,6 +21,11 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.Collections; +import java.util.List; + @CommandParameters(name = "ban", usage = "/ [reason] [-nrb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online") @CommandPermissions(permission = "plex.ban", source = RequiredCommandSource.ANY) @@ -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() ? "No reason provided." : 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,9 +114,9 @@ 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.getAsyncScheduler().runNow(plugin, scheduledTask -> { plugin.getCoreProtectHook().coreProtectAPI().performRollback(86400, Collections.singletonList(plexPlayer.getName()), null, null, null, null, 0, null); 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..d11f52f 100644 --- a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -53,13 +53,13 @@ public class TempbanCMD extends PlexCommand } Punishment punishment = new Punishment(target.getUuid(), getUUID(sender)); punishment.setType(PunishmentType.TEMPBAN); - boolean rollBack = true; + boolean rollBack = false; if (args.length > 2) { reason = StringUtils.join(args, " ", 2, args.length); String newReason = StringUtils.normalizeSpace(reason.replace("-nrb", "")); punishment.setReason(newReason.trim().isEmpty() ? "No reason provided." : newReason); - rollBack = !reason.startsWith("-nrb") && !reason.endsWith("-nrb"); + rollBack = reason.startsWith("-rb") || reason.endsWith("-rb"); } else { From efcb9b45dff59d780ab0e2e4bd81d7f3ce81e0e6 Mon Sep 17 00:00:00 2001 From: Taah Date: Mon, 6 May 2024 12:29:30 -0700 Subject: [PATCH 4/6] oh update usage too --- server/src/main/java/dev/plex/command/impl/BanCMD.java | 2 +- server/src/main/java/dev/plex/command/impl/TempbanCMD.java | 2 +- 2 files 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 5195ab4..ccf552a 100644 --- a/server/src/main/java/dev/plex/command/impl/BanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BanCMD.java @@ -26,7 +26,7 @@ import java.time.ZonedDateTime; import java.util.Collections; import java.util.List; -@CommandParameters(name = "ban", usage = "/ [reason] [-nrb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online") +@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 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 d11f52f..fa24afc 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 = "/