From dc10c40578e413651b4ccd2447ed7d00f9bae9fd Mon Sep 17 00:00:00 2001 From: Elmon11 Date: Sun, 21 Mar 2021 13:57:24 +0100 Subject: [PATCH 1/4] noclear option in smite --- .../totalfreedommod/command/Command_smite.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index 708d36bf..b82921cd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/ [reason] [-q]") +@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/ [reason] [-nc | -q]") public class Command_smite extends FreedomCommand { @@ -54,7 +54,10 @@ public class Command_smite extends FreedomCommand player.setGameMode(GameMode.SURVIVAL); // Clear inventory - player.getInventory().clear(); + if (!args[args.length - 1].equalsIgnoreCase("-nc")) + { + player.getInventory().clear(); + } // Strike with lightning effect final Location targetPos = player.getLocation(); @@ -122,4 +125,4 @@ public class Command_smite extends FreedomCommand return true; } -} \ No newline at end of file +} From 9713fcabd6a23cb29bdc12ec24ca3718b2804b09 Mon Sep 17 00:00:00 2001 From: Elmon11 Date: Sun, 21 Mar 2021 18:25:28 +0100 Subject: [PATCH 2/4] Should work fingers crossed --- .../command/Command_smite.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index b82921cd..ff4dd20d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/ [reason] [-nc | -q]") +@CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/ [reason] [-c | -q]") public class Command_smite extends FreedomCommand { @@ -29,7 +29,7 @@ public class Command_smite extends FreedomCommand smite(sender, player, reason, false); } - public static void smite(CommandSender sender, Player player, String reason, Boolean silent) + public static void smite(CommandSender sender, Player player, String reason, Boolean silent, Boolean clearinv) { player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60); @@ -54,7 +54,7 @@ public class Command_smite extends FreedomCommand player.setGameMode(GameMode.SURVIVAL); // Clear inventory - if (!args[args.length - 1].equalsIgnoreCase("-nc")) + if (clearinv) { player.getInventory().clear(); } @@ -91,6 +91,7 @@ public class Command_smite extends FreedomCommand String reason = null; boolean silent = false; + boolean clearinv = false; if (args.length >= 2) { if (args[args.length - 1].equalsIgnoreCase("-q")) @@ -106,6 +107,21 @@ public class Command_smite extends FreedomCommand } } else + { + if + { + if args[args.length - 1].equalsIgnoreCase("-c") + { + clearinv = true + } + + if (args.length >= 3) + { + reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); + } + } + } + else { reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); } @@ -119,7 +135,7 @@ public class Command_smite extends FreedomCommand return true; } - smite(sender, player, reason, silent); + smite(sender, player, reason, silent, clearinv); plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.SMITE, reason)); From e45655edbbfe4156d700001dc8084108adfc6522 Mon Sep 17 00:00:00 2001 From: Elmon11 Date: Sun, 21 Mar 2021 18:33:38 +0100 Subject: [PATCH 3/4] im a clown --- .../totalfreedom/totalfreedommod/command/Command_smite.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index ff4dd20d..eb9bd7ed 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -108,11 +108,11 @@ public class Command_smite extends FreedomCommand } else { - if + if (args[args.length - 1].equalsIgnoreCase("-c")) { - if args[args.length - 1].equalsIgnoreCase("-c") + if (args[args.length - 1].equalsIgnoreCase("-c")) { - clearinv = true + clearinv = true; } if (args.length >= 3) From 2dbbb5c2624374147c16113223b99914621262a6 Mon Sep 17 00:00:00 2001 From: Elmon11 Date: Sun, 21 Mar 2021 19:07:07 +0100 Subject: [PATCH 4/4] Intellij says this is fine so if it breaks again gg --- .../command/Command_smite.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index eb9bd7ed..4a53fa28 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -21,12 +21,12 @@ public class Command_smite extends FreedomCommand public static void smite(CommandSender sender, Player player) { - smite(sender, player, null, false); + smite(sender, player, null, false, false); } public static void smite(CommandSender sender, Player player, String reason) { - smite(sender, player, reason, false); + smite(sender, player, reason, false, false); } public static void smite(CommandSender sender, Player player, String reason, Boolean silent, Boolean clearinv) @@ -106,19 +106,16 @@ public class Command_smite extends FreedomCommand reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); } } - else + else if (args[args.length - 1].equalsIgnoreCase("-c")) { if (args[args.length - 1].equalsIgnoreCase("-c")) { - if (args[args.length - 1].equalsIgnoreCase("-c")) - { - clearinv = true; - } - - if (args.length >= 3) - { - reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); - } + clearinv = true; + } + + if (args.length >= 3) + { + reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " "); } } else