From cfa4b5fc59327791a542d23a220a0e3b3dc542a0 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 19 Jul 2021 23:03:04 +0800 Subject: [PATCH] Delete unused files --- .../trait/text/TextAddPrompt.java | 30 ------- .../trait/text/TextStartPrompt.java | 82 ------------------- 2 files changed, 112 deletions(-) delete mode 100644 main/src/main/java/net/citizensnpcs/trait/text/TextAddPrompt.java delete mode 100644 main/src/main/java/net/citizensnpcs/trait/text/TextStartPrompt.java diff --git a/main/src/main/java/net/citizensnpcs/trait/text/TextAddPrompt.java b/main/src/main/java/net/citizensnpcs/trait/text/TextAddPrompt.java deleted file mode 100644 index c945f32bf..000000000 --- a/main/src/main/java/net/citizensnpcs/trait/text/TextAddPrompt.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.citizensnpcs.trait.text; - -import net.citizensnpcs.api.util.Messaging; -import net.citizensnpcs.util.Messages; - -import org.bukkit.ChatColor; -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.Prompt; -import org.bukkit.conversations.StringPrompt; -import org.bukkit.entity.Player; - -public class TextAddPrompt extends StringPrompt { - private final Text text; - - public TextAddPrompt(Text text) { - this.text = text; - } - - @Override - public Prompt acceptInput(ConversationContext context, String input) { - text.add(input); - Messaging.sendTr((Player) context.getForWhom(), Messages.TEXT_EDITOR_ADDED_ENTRY, input); - return new TextStartPrompt(text); - } - - @Override - public String getPromptText(ConversationContext context) { - return ChatColor.GREEN + Messaging.tr(Messages.TEXT_EDITOR_ADD_PROMPT); - } -} \ No newline at end of file diff --git a/main/src/main/java/net/citizensnpcs/trait/text/TextStartPrompt.java b/main/src/main/java/net/citizensnpcs/trait/text/TextStartPrompt.java deleted file mode 100644 index a7e1944cf..000000000 --- a/main/src/main/java/net/citizensnpcs/trait/text/TextStartPrompt.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.citizensnpcs.trait.text; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.Prompt; -import org.bukkit.conversations.StringPrompt; - -import net.citizensnpcs.Settings.Setting; -import net.citizensnpcs.api.util.Messaging; -import net.citizensnpcs.util.Messages; - -public class TextStartPrompt extends StringPrompt { - private final Text text; - - public TextStartPrompt(Text text) { - this.text = text; - } - - @Override - public Prompt acceptInput(ConversationContext context, String original) { - String[] parts = ChatColor.stripColor(original.trim()).split(" "); - String input = parts[0]; - CommandSender sender = (CommandSender) context.getForWhom(); - if (input.equalsIgnoreCase("add")) - return new TextAddPrompt(text); - else if (input.equalsIgnoreCase("edit")) - return new TextEditStartPrompt(text); - else if (input.equalsIgnoreCase("remove")) - return new TextRemovePrompt(text); - else if (input.equalsIgnoreCase("delay")) { - try { - int delay = Integer.parseInt(parts[1]); - text.setDelay(delay); - Messaging.sendTr(sender, Messages.TEXT_EDITOR_DELAY_SET, delay); - } catch (NumberFormatException e) { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_DELAY); - } catch (ArrayIndexOutOfBoundsException e) { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_DELAY); - } - } else if (input.equalsIgnoreCase("random")) - Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANDOM_TALKER_SET, text.toggleRandomTalker()); - else if (input.equalsIgnoreCase("realistic looking")) - Messaging.sendTr(sender, Messages.TEXT_EDITOR_REALISTIC_LOOKING_SET, text.toggleRealisticLooking()); - else if (input.equalsIgnoreCase("close") || input.equalsIgnoreCase("talk-close")) - Messaging.sendTr(sender, Messages.TEXT_EDITOR_CLOSE_TALKER_SET, text.toggle()); - else if (input.equalsIgnoreCase("range")) { - try { - double range = Math.min(Math.max(0, Double.parseDouble(parts[1])), Setting.MAX_TEXT_RANGE.asDouble()); - text.setRange(range); - Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANGE_SET, range); - } catch (NumberFormatException e) { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_RANGE); - } catch (ArrayIndexOutOfBoundsException e) { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_RANGE); - } - } else if (input.equalsIgnoreCase("item")) { - if (parts.length > 1) { - text.setItemInHandPattern(parts[1]); - Messaging.sendTr(sender, Messages.TEXT_EDITOR_SET_ITEM, parts[1]); - } else { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_MISSING_ITEM_PATTERN); - } - } else if (input.equalsIgnoreCase("help")) { - context.setSessionData("said-text", false); - Messaging.send(sender, getPromptText(context)); - } else { - Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_EDIT_TYPE); - } - - return new TextStartPrompt(text); - } - - @Override - public String getPromptText(ConversationContext context) { - if (context.getSessionData("said-text") == Boolean.TRUE) - return ""; - String text = Messaging.tr(Messages.TEXT_EDITOR_START_PROMPT); - context.setSessionData("said-text", Boolean.TRUE); - return text; - } -} \ No newline at end of file