diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_MainPanel.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_MainPanel.java index 1db38b0..6ddf554 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_MainPanel.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_MainPanel.java @@ -346,12 +346,7 @@ public class BTC_MainPanel extends javax.swing.JFrame if (_source instanceof PlayerListPopupItem_Command) { final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source; - - final PlayerInfo _player = source.getPlayer(); - final PlayerCommandEntry _command = source.getCommand(); - - final String output = String.format(_command.getFormat(), _player.getName()); - + final String output = source.getCommand().buildOutput(source.getPlayer(), true); BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100); } else if (_source instanceof PlayerListPopupItem) diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/PlayerCommandEntry.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/PlayerCommandEntry.java index 3470a7d..526d260 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/PlayerCommandEntry.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/PlayerCommandEntry.java @@ -19,6 +19,8 @@ package me.StevenLawson.BukkitTelnetClient; import java.util.ArrayList; +import javax.swing.JOptionPane; +import org.apache.commons.lang3.StringUtils; public class PlayerCommandEntry extends ConfigEntry { @@ -53,6 +55,33 @@ public class PlayerCommandEntry extends ConfigEntry this.name = name; } + public String buildOutput(PlayerInfo player, boolean useReasonPrompt) + { + String output = StringUtils.replaceEach(getFormat(), + new String[] + { + "$TARGET_NAME", + "$TARGET_IP", + "$TARGET_UUID", + }, new String[] + { + player.getName(), + player.getIp(), + player.getUuid() + } + ); + + if (useReasonPrompt && output.contains("$REASON")) + { + final String reason = StringUtils.trimToEmpty( + JOptionPane.showInputDialog(null, "Input reason:\n" + output, "Input Reason", JOptionPane.PLAIN_MESSAGE) + ); + output = StringUtils.replace(output, "$REASON", reason); + } + + return StringUtils.trimToEmpty(output); + } + public static class PlayerCommandEntryList extends ConfigEntryList { public PlayerCommandEntryList() diff --git a/src/main/resources/settings.xml b/src/main/resources/settings.xml index df3fbad..6afcfa4 100644 --- a/src/main/resources/settings.xml +++ b/src/main/resources/settings.xml @@ -4,59 +4,75 @@ Ban - glist ban %s + glist ban $TARGET_NAME Toggle Mute - mute %s + mute $TARGET_NAME Kick - tempban %s 10s Kicked + tempban $TARGET_NAME 10s Kicked + + + Tempban 5m + Reason + tempban $TARGET_NAME 5m $REASON Tempban 5m - tempban %s 5m + tempban $TARGET_NAME 5m Smite - smite %s + smite $TARGET_NAME Op - op %s + op $TARGET_NAME Deop - deop %s + deop $TARGET_NAME + + + GTFO + Reason + gtfo $TARGET_NAME $REASON GTFO - gtfo %s + gtfo $TARGET_NAME Toggle Freeze - fr %s + fr $TARGET_NAME Cage - cage %s + cage $TARGET_NAME Uncage - cage %s off + cage $TARGET_NAME off Doom - doom %s + doom $TARGET_NAME Creative - creative %s + creative $TARGET_NAME Survival - survival %s + survival $TARGET_NAME + + + Seen Name + seen $TARGET_NAME + + + Seen IP + seen $TARGET_IP