mirror of
https://github.com/TotalFreedomMC/ZeroTelnetClient.git
synced 2024-12-22 16:25:14 +00:00
Added more wildcard parameters for player commands + an optional 'reason' dialog.
This commit is contained in:
parent
88c6b73b0b
commit
051a53ab21
3 changed files with 60 additions and 20 deletions
|
@ -346,12 +346,7 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
||||||
if (_source instanceof PlayerListPopupItem_Command)
|
if (_source instanceof PlayerListPopupItem_Command)
|
||||||
{
|
{
|
||||||
final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
|
final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
|
||||||
|
final String output = source.getCommand().buildOutput(source.getPlayer(), true);
|
||||||
final PlayerInfo _player = source.getPlayer();
|
|
||||||
final PlayerCommandEntry _command = source.getCommand();
|
|
||||||
|
|
||||||
final String output = String.format(_command.getFormat(), _player.getName());
|
|
||||||
|
|
||||||
BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
|
BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
|
||||||
}
|
}
|
||||||
else if (_source instanceof PlayerListPopupItem)
|
else if (_source instanceof PlayerListPopupItem)
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
package me.StevenLawson.BukkitTelnetClient;
|
package me.StevenLawson.BukkitTelnetClient;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class PlayerCommandEntry extends ConfigEntry
|
public class PlayerCommandEntry extends ConfigEntry
|
||||||
{
|
{
|
||||||
|
@ -53,6 +55,33 @@ public class PlayerCommandEntry extends ConfigEntry
|
||||||
this.name = name;
|
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<PlayerCommandEntry>
|
public static class PlayerCommandEntryList extends ConfigEntryList<PlayerCommandEntry>
|
||||||
{
|
{
|
||||||
public PlayerCommandEntryList()
|
public PlayerCommandEntryList()
|
||||||
|
|
|
@ -4,59 +4,75 @@
|
||||||
<playerCommands>
|
<playerCommands>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Ban</name>
|
<name>Ban</name>
|
||||||
<format>glist ban %s</format>
|
<format>glist ban $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Toggle Mute</name>
|
<name>Toggle Mute</name>
|
||||||
<format>mute %s</format>
|
<format>mute $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Kick</name>
|
<name>Kick</name>
|
||||||
<format>tempban %s 10s Kicked</format>
|
<format>tempban $TARGET_NAME 10s Kicked</format>
|
||||||
|
</playerCommand>
|
||||||
|
<playerCommand>
|
||||||
|
<name>Tempban 5m + Reason</name>
|
||||||
|
<format>tempban $TARGET_NAME 5m $REASON</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Tempban 5m</name>
|
<name>Tempban 5m</name>
|
||||||
<format>tempban %s 5m</format>
|
<format>tempban $TARGET_NAME 5m</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Smite</name>
|
<name>Smite</name>
|
||||||
<format>smite %s</format>
|
<format>smite $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Op</name>
|
<name>Op</name>
|
||||||
<format>op %s</format>
|
<format>op $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Deop</name>
|
<name>Deop</name>
|
||||||
<format>deop %s</format>
|
<format>deop $TARGET_NAME</format>
|
||||||
|
</playerCommand>
|
||||||
|
<playerCommand>
|
||||||
|
<name>GTFO + Reason</name>
|
||||||
|
<format>gtfo $TARGET_NAME $REASON</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>GTFO</name>
|
<name>GTFO</name>
|
||||||
<format>gtfo %s</format>
|
<format>gtfo $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Toggle Freeze</name>
|
<name>Toggle Freeze</name>
|
||||||
<format>fr %s</format>
|
<format>fr $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Cage</name>
|
<name>Cage</name>
|
||||||
<format>cage %s</format>
|
<format>cage $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Uncage</name>
|
<name>Uncage</name>
|
||||||
<format>cage %s off</format>
|
<format>cage $TARGET_NAME off</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Doom</name>
|
<name>Doom</name>
|
||||||
<format>doom %s</format>
|
<format>doom $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Creative</name>
|
<name>Creative</name>
|
||||||
<format>creative %s</format>
|
<format>creative $TARGET_NAME</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
<playerCommand>
|
<playerCommand>
|
||||||
<name>Survival</name>
|
<name>Survival</name>
|
||||||
<format>survival %s</format>
|
<format>survival $TARGET_NAME</format>
|
||||||
|
</playerCommand>
|
||||||
|
<playerCommand>
|
||||||
|
<name>Seen Name</name>
|
||||||
|
<format>seen $TARGET_NAME</format>
|
||||||
|
</playerCommand>
|
||||||
|
<playerCommand>
|
||||||
|
<name>Seen IP</name>
|
||||||
|
<format>seen $TARGET_IP</format>
|
||||||
</playerCommand>
|
</playerCommand>
|
||||||
</playerCommands>
|
</playerCommands>
|
||||||
<favoriteButtons>
|
<favoriteButtons>
|
||||||
|
|
Loading…
Reference in a new issue