From 50e01cb3c04cd73c37362f626b8af2defc7c02c2 Mon Sep 17 00:00:00 2001 From: obvWolf Date: Wed, 28 Feb 2024 01:24:47 -0600 Subject: [PATCH] The dupeban editor randomly decided to break --- .gitignore | 2 ++ .../trouper/ultradupe/cmds/UltraDupeCommand.java | 14 ++++++++++---- src/main/resources/plugin.yml | 16 +++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 14e5aca..1d34370 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /.idea/ /.gradle/ /build/ +/.gradle/ + diff --git a/src/main/java/me/trouper/ultradupe/cmds/UltraDupeCommand.java b/src/main/java/me/trouper/ultradupe/cmds/UltraDupeCommand.java index 96d55ba..a907a55 100644 --- a/src/main/java/me/trouper/ultradupe/cmds/UltraDupeCommand.java +++ b/src/main/java/me/trouper/ultradupe/cmds/UltraDupeCommand.java @@ -59,7 +59,13 @@ public class UltraDupeCommand implements CustomCommand { @Override public void dispatchCompletions(CompletionBuilder b) { - b.then(b.arg("[]")); + b.then(b.arg("dupebans") + .then(b.arg("item") + .then(b.arg("add","remove"))) + .then(b.arg("material") + .then(b.arg("add", "remove"))) + ).then(b.arg("toggle") + .then(b.arg("debug","bypass"))); } private void handleItemEdit(Player p, Args args) { @@ -98,14 +104,14 @@ public class UltraDupeCommand implements CustomCommand { } switch (args.get(2).toString()) { case "add" -> { - Material m = p.getInventory().getItemInMainHand().getType(); if (UltraDupe.dupeBanStorage.bannedMaterials.contains(m)) { p.sendMessage(Component.text(Text.prefix("&7The material &c%s&7 is already on the dupe ban list.".formatted(Text.cleanName(m.toString()))))); return; } + p.sendMessage(Component.text(Text.prefix("&7Adding &c%s&7 to the dupe ban list.".formatted(Text.cleanName(m.toString()))))); UltraDupe.dupeBanStorage.bannedMaterials.add(m); - p.sendMessage(Component.text(Text.prefix("&7You have added &c%s&7 to the dupe ban list.".formatted(Text.cleanName(m.toString()))))); + UltraDupe.dupeBanStorage.save(); } case "remove" -> { @@ -114,8 +120,8 @@ public class UltraDupeCommand implements CustomCommand { p.sendMessage(Component.text(Text.prefix("&7The material &c%s&7 is not on the dupe ban list.".formatted(Text.cleanName(m.toString()))))); return; } + p.sendMessage(Component.text(Text.prefix("&7Removing&a%s&7 from the dupe ban list.".formatted(Text.cleanName(m.toString()))))); UltraDupe.dupeBanStorage.bannedMaterials.remove(m); - p.sendMessage(Component.text(Text.prefix("&7You have removed &a%s&7 from the dupe ban list.".formatted(Text.cleanName(m.toString()))))); UltraDupe.dupeBanStorage.save(); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5c34cdc..3d3d471 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -29,23 +29,29 @@ permissions: description: edit the dupe ban list commands: + ultradupe: + description: Admin command to edit and bypass dupebans + usage: /ultradupe + permission: ultradupe.admin + aliases: + - ud duplicate: description: A command for testing. - usage: /ultradupe - permission: ultradupe.info + usage: /dupe [int] + permission: ultradupe.dupe permission-message: You do not have permission! aliases: - dupe - d multiply: description: A command for testing. - usage: /ultradupe - permission: ultradupe.info + usage: /multiply [int] + permission: ultradupe.multiply permission-message: You do not have permission! aliases: - mult - m dupebans: description: dupe bans - usage: /dupebans [add|remove] + usage: /dupebans permission: ultradupe.dupebans \ No newline at end of file