From e1c3bad4d0ee9ef250ee7ae48eae3ad11e149f2a Mon Sep 17 00:00:00 2001 From: Video Date: Thu, 17 Jun 2021 06:56:52 -0600 Subject: [PATCH] Even more punishment log types Here's what I've changed in this commit: - Adds /blockcmd to the punishment log (FS-239) - Adds /blockedit and /blockpvp to the punishment log (FS-240) - Adds /cage to the punishment log (FS-241) - Adds /orbit to the punishment log (FS-242) - Changes the order of operations in some commands to be a bit more consistent --- .../totalfreedommod/command/Command_blockcmd.java | 6 +++++- .../totalfreedommod/command/Command_blockedit.java | 4 ++++ .../totalfreedommod/command/Command_blockpvp.java | 3 +++ .../totalfreedommod/command/Command_cage.java | 4 ++++ .../totalfreedommod/command/Command_orbit.java | 8 ++++++-- .../totalfreedommod/punishments/PunishmentType.java | 7 ++++++- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java index fece338d..ee2ba733 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.punishments.Punishment; +import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; @@ -75,9 +77,11 @@ public class Command_blockcmd extends FreedomCommand FPlayer playerdata = plugin.pl.getPlayer(player); if (!playerdata.allCommandsBlocked()) { - playerdata.setCommandsBlocked(true); FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true); + playerdata.setCommandsBlocked(true); msg("Blocked commands for " + player.getName() + "."); + + plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.BLOCKCMD, null)); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java index e1904553..cba22999 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.punishments.Punishment; +import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.ArrayUtils; @@ -128,6 +130,8 @@ public class Command_blockedit extends FreedomCommand msg(player2, "Your block modification abilities have been blocked.", ChatColor.RED); msg("Blocked all block modification abilities for " + player2.getName()); + + plugin.pul.logPunishment(new Punishment(player2.getName(), FUtil.getIp(player2), sender.getName(), PunishmentType.BLOCKEDIT, null)); } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java index 0471724c..9c4bee0f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.punishments.Punishment; +import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang3.ArrayUtils; @@ -125,6 +127,7 @@ public class Command_blockpvp extends FreedomCommand { Command_smite.smite(sender, p, reason); } + plugin.pul.logPunishment(new Punishment(p.getName(), FUtil.getIp(p), sender.getName(), PunishmentType.BLOCKPVP, null)); msg(p, "Your PVP has been disabled.", ChatColor.RED); msg("Disabled PVP for " + p.getName()); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index 5cc72009..46f20d8e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -5,6 +5,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.punishments.Punishment; +import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; @@ -111,6 +113,8 @@ public class Command_cage extends FreedomCommand { FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true); } + + plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.CAGE, null)); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java index 08894999..06320f31 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.punishments.Punishment; +import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; @@ -56,11 +58,13 @@ public class Command_orbit extends FreedomCommand } } + FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false); + player.setGameMode(GameMode.SURVIVAL); playerdata.startOrbiting(strength); - player.setVelocity(new Vector(0, strength, 0)); - FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false); + + plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.ORBIT, null)); return true; } } \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/punishments/PunishmentType.java b/src/main/java/me/totalfreedom/totalfreedommod/punishments/PunishmentType.java index e7b82e85..1c710350 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/punishments/PunishmentType.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/punishments/PunishmentType.java @@ -8,5 +8,10 @@ public enum PunishmentType TEMPBAN, BAN, DOOM, - WARN + WARN, + CAGE, + BLOCKEDIT, + BLOCKPVP, + BLOCKCMD, + ORBIT }