mirror of
https://github.com/TotalFreedomMC/ZeroTelnetClient.git
synced 2024-12-22 08:15:17 +00:00
* Fixed encoding glitch that causes special characters not to show up.
* Maven build script will now generate a Windows EXE file. * Minor cleanup & updates to take advantage of JDK/JRE 8 features and syntax.
This commit is contained in:
parent
930a4a37e6
commit
1408e4d09e
21 changed files with 283 additions and 225 deletions
BIN
FreedomTelnetClient v2.0.06.exe
Normal file
BIN
FreedomTelnetClient v2.0.06.exe
Normal file
Binary file not shown.
12
README.md
12
README.md
|
@ -3,15 +3,13 @@ FreedomTelnetClient
|
|||
|
||||
FreedomTelnetClient (previously BukkitTelnetClient) is a telnet client for use with the BukkitTelnet and TotalFreedomMod CraftBukkit plugins.
|
||||
|
||||
Grab the latest release binary (2.0.5) here:
|
||||
Grab the latest release binary (2.0.06) here:
|
||||
|
||||
https://github.com/StevenLawson/FreedomTelnetClient/releases/latest
|
||||
|
||||
New features for 2.0.5
|
||||
New features for 2.0.06 (6/27/2017)
|
||||
---------------------
|
||||
|
||||
* ftc_settings.xml file:
|
||||
* Lets you define custom commands for the player list's right-click dropdown.
|
||||
* Saves a history of your servers with a a descriptive name for the server address.
|
||||
* Define "favorite" command buttons for new "Commands" tab.
|
||||
* "Reason" input dialog for applicable commands (any command that has a $REASON wildcard).
|
||||
* Fixed encoding glitch that causes special characters not to show up.
|
||||
* (For Coders) Maven build script will now generate a Windows EXE file.
|
||||
* (For Coders) Minor cleanup & updates to take advantage of JDK/JRE 8 features and syntax.
|
||||
|
|
BIN
icon.ico
Normal file
BIN
icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 75 KiB |
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>run</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath me.StevenLawson.BukkitTelnetClient.BukkitTelnetClient</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
</actions>
|
169
pom.xml
169
pom.xml
|
@ -3,14 +3,105 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>me.StevenLawson</groupId>
|
||||
<artifactId>FreedomTelnetClient</artifactId>
|
||||
<version>2.0.5</version>
|
||||
<version>2.0.06</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>FreedomTelnetClient</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<version>${project.version}</version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20170516</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<revisionOnScmFailure>true</revisionOnScmFailure>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-timestamp-date</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create-timestamp</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<timestampFormat>MM/dd/yyyy</timestampFormat>
|
||||
<timestampPropertyName>timestampDate</timestampPropertyName>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>create-timestamp-combined</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create-timestamp</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<timestampFormat>MMddyy-HHmmss</timestampFormat>
|
||||
<timestampPropertyName>timestampCombined</timestampPropertyName>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>write-project-properties</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.build.outputDirectory}/my.properties</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>2.4.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -30,34 +121,50 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.akathist.maven.plugins.launch4j</groupId>
|
||||
<artifactId>launch4j-maven-plugin</artifactId>
|
||||
<version>1.7.18</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>launch4j</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<dontWrapJar>false</dontWrapJar>
|
||||
<headerType>gui</headerType>
|
||||
<jar>${project.build.directory}/${project.build.finalName}-shaded.jar</jar>
|
||||
<outfile>${project.build.directory}/${project.build.finalName}-${timestampCombined}.exe</outfile>
|
||||
<errTitle></errTitle>
|
||||
<cmdLine></cmdLine>
|
||||
<chdir>.</chdir>
|
||||
<priority>normal</priority>
|
||||
<downloadUrl>http://java.com/download</downloadUrl>
|
||||
<supportUrl></supportUrl>
|
||||
<stayAlive>false</stayAlive>
|
||||
<restartOnCrash>false</restartOnCrash>
|
||||
<manifest></manifest>
|
||||
<icon>icon.ico</icon>
|
||||
<singleInstance>
|
||||
<mutexName>${project.artifactId}</mutexName>
|
||||
<windowTitle></windowTitle>
|
||||
</singleInstance>
|
||||
<jre>
|
||||
<path>jre</path>
|
||||
<bundledJre64Bit>false</bundledJre64Bit>
|
||||
<bundledJreAsFallback>false</bundledJreAsFallback>
|
||||
<minVersion>1.8.0_0</minVersion>
|
||||
<maxVersion></maxVersion>
|
||||
<jdkPreference>preferJre</jdkPreference>
|
||||
<runtimeBits>64/32</runtimeBits>
|
||||
</jre>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20140107</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
<name>FreedomTelnetClient</name>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -19,15 +19,13 @@
|
|||
package me.StevenLawson.BukkitTelnetClient;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.Timer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.commons.net.telnet.TelnetClient;
|
||||
|
||||
|
@ -142,7 +140,7 @@ public class BTC_ConnectionManager
|
|||
return;
|
||||
}
|
||||
|
||||
this.telnetClient.getOutputStream().write((text + "\r\n").getBytes());
|
||||
this.telnetClient.getOutputStream().write((text + "\r\n").getBytes(StandardCharsets.UTF_8));
|
||||
this.telnetClient.getOutputStream().flush();
|
||||
}
|
||||
catch (IOException ex)
|
||||
|
@ -153,15 +151,7 @@ public class BTC_ConnectionManager
|
|||
|
||||
public void sendDelayedCommand(final String text, final boolean verbose, final int delay)
|
||||
{
|
||||
final Timer timer = new Timer(delay, new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae)
|
||||
{
|
||||
sendCommand(text, verbose);
|
||||
}
|
||||
});
|
||||
|
||||
final Timer timer = new Timer(delay, event -> sendCommand(text, verbose));
|
||||
timer.setRepeats(false);
|
||||
timer.start();
|
||||
}
|
||||
|
@ -173,74 +163,70 @@ public class BTC_ConnectionManager
|
|||
return;
|
||||
}
|
||||
|
||||
this.connectThread = new Thread(new Runnable()
|
||||
this.connectThread = new Thread(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
final BTC_MainPanel btc = BukkitTelnetClient.mainPanel;
|
||||
|
||||
try
|
||||
{
|
||||
final BTC_MainPanel btc = BukkitTelnetClient.mainPanel;
|
||||
BTC_ConnectionManager.this.telnetClient.connect(hostname, port);
|
||||
BTC_ConnectionManager.this.canDoDisconnect = true;
|
||||
|
||||
try
|
||||
btc.getBtnSend().setEnabled(true);
|
||||
btc.getTxtCommand().setEnabled(true);
|
||||
btc.getTxtCommand().requestFocusInWindow();
|
||||
|
||||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(telnetClient.getInputStream(), StandardCharsets.UTF_8)))
|
||||
{
|
||||
BTC_ConnectionManager.this.telnetClient.connect(hostname, port);
|
||||
BTC_ConnectionManager.this.canDoDisconnect = true;
|
||||
|
||||
btc.getBtnSend().setEnabled(true);
|
||||
btc.getTxtCommand().setEnabled(true);
|
||||
btc.getTxtCommand().requestFocusInWindow();
|
||||
|
||||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(telnetClient.getInputStream())))
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null)
|
||||
{
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null)
|
||||
String _loginName = null;
|
||||
if (BTC_ConnectionManager.this.loginName == null)
|
||||
{
|
||||
String _loginName = null;
|
||||
if (BTC_ConnectionManager.this.loginName == null)
|
||||
_loginName = checkForLoginMessage(line);
|
||||
}
|
||||
if (_loginName != null)
|
||||
{
|
||||
BTC_ConnectionManager.this.loginName = _loginName;
|
||||
updateTitle(true);
|
||||
sendDelayedCommand("telnet.enhanced", false, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
final PlayerInfo selectedPlayer = btc.getSelectedPlayer();
|
||||
String selectedPlayerName = null;
|
||||
if (selectedPlayer != null)
|
||||
{
|
||||
_loginName = checkForLoginMessage(line);
|
||||
selectedPlayerName = selectedPlayer.getName();
|
||||
}
|
||||
if (_loginName != null)
|
||||
|
||||
if (BTC_PlayerListDecoder.checkForPlayerListMessage(line, btc.getPlayerList()))
|
||||
{
|
||||
BTC_ConnectionManager.this.loginName = _loginName;
|
||||
updateTitle(true);
|
||||
sendDelayedCommand("telnet.enhanced", false, 100);
|
||||
btc.updatePlayerList(selectedPlayerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
final PlayerInfo selectedPlayer = btc.getSelectedPlayer();
|
||||
String selectedPlayerName = null;
|
||||
if (selectedPlayer != null)
|
||||
final BTC_TelnetMessage message = new BTC_TelnetMessage(line);
|
||||
if (!message.skip())
|
||||
{
|
||||
selectedPlayerName = selectedPlayer.getName();
|
||||
}
|
||||
|
||||
if (BTC_PlayerListDecoder.checkForPlayerListMessage(line, btc.getPlayerList()))
|
||||
{
|
||||
btc.updatePlayerList(selectedPlayerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
final BTC_TelnetMessage message = new BTC_TelnetMessage(line);
|
||||
if (!message.skip())
|
||||
{
|
||||
btc.writeToConsole(message);
|
||||
}
|
||||
btc.writeToConsole(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggerDisconnect();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
btc.writeToConsole(new BTC_ConsoleMessage(ex.getMessage() + SystemUtils.LINE_SEPARATOR + ExceptionUtils.getStackTrace(ex)));
|
||||
}
|
||||
|
||||
finishDisconnect();
|
||||
|
||||
BTC_ConnectionManager.this.connectThread = null;
|
||||
triggerDisconnect();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
btc.writeToConsole(new BTC_ConsoleMessage(ex.getMessage() + System.lineSeparator() + ExceptionUtils.getStackTrace(ex)));
|
||||
}
|
||||
|
||||
finishDisconnect();
|
||||
|
||||
BTC_ConnectionManager.this.connectThread = null;
|
||||
});
|
||||
this.connectThread.start();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -19,7 +19,6 @@
|
|||
package me.StevenLawson.BukkitTelnetClient;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Collection;
|
||||
import javax.swing.JButton;
|
||||
|
@ -31,15 +30,11 @@ public class BTC_FavoriteButtonsPanel extends JPanel
|
|||
{
|
||||
super.setLayout(new GridBagLayout());
|
||||
|
||||
final ActionListener actionListener = new ActionListener()
|
||||
final ActionListener actionListener = event ->
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event)
|
||||
if (BukkitTelnetClient.mainPanel != null)
|
||||
{
|
||||
if (BukkitTelnetClient.mainPanel != null)
|
||||
{
|
||||
BukkitTelnetClient.mainPanel.getConnectionManager().sendDelayedCommand(event.getActionCommand(), true, 100);
|
||||
}
|
||||
BukkitTelnetClient.mainPanel.getConnectionManager().sendDelayedCommand(event.getActionCommand(), true, 100);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -30,7 +30,6 @@ import javax.swing.Timer;
|
|||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.text.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
public class BTC_MainPanel extends javax.swing.JFrame
|
||||
{
|
||||
|
@ -128,16 +127,14 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
|||
|
||||
private void writeToConsoleImmediately(final BTC_ConsoleMessage message, final boolean isTelnetError)
|
||||
{
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
if (isTelnetError && chkIgnoreErrors.isSelected())
|
||||
{
|
||||
// Do Nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isTelnetError && chkIgnoreErrors.isSelected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final StyledDocument styledDocument = mainOutput.getStyledDocument();
|
||||
|
||||
int startLength = styledDocument.getLength();
|
||||
|
@ -146,7 +143,7 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
|||
{
|
||||
styledDocument.insertString(
|
||||
styledDocument.getLength(),
|
||||
message.getMessage() + SystemUtils.LINE_SEPARATOR,
|
||||
message.getMessage() + System.lineSeparator(),
|
||||
StyleContext.getDefaultStyleContext().addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, message.getColor())
|
||||
);
|
||||
}
|
||||
|
@ -165,14 +162,7 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
|||
{
|
||||
BTC_MainPanel.this.mainOutput.setCaretPosition(startLength);
|
||||
|
||||
final Timer timer = new Timer(10, new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent ae)
|
||||
{
|
||||
vScroll.setValue(vScroll.getMaximum());
|
||||
}
|
||||
});
|
||||
final Timer timer = new Timer(10, event -> vScroll.setValue(vScroll.getMaximum()));
|
||||
timer.setRepeats(false);
|
||||
timer.start();
|
||||
}
|
||||
|
@ -241,26 +231,22 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
|||
|
||||
public final void updatePlayerList(final String selectedPlayerName)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
EventQueue.invokeLater(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
playerListTableModel.fireTableDataChanged();
|
||||
|
||||
BTC_MainPanel.this.txtNumPlayers.setText("" + playerList.size());
|
||||
|
||||
if (selectedPlayerName != null)
|
||||
{
|
||||
playerListTableModel.fireTableDataChanged();
|
||||
final JTable table = BTC_MainPanel.this.tblPlayers;
|
||||
final ListSelectionModel selectionModel = table.getSelectionModel();
|
||||
|
||||
BTC_MainPanel.this.txtNumPlayers.setText("" + playerList.size());
|
||||
|
||||
if (selectedPlayerName != null)
|
||||
for (PlayerInfo player : playerList)
|
||||
{
|
||||
final JTable table = BTC_MainPanel.this.tblPlayers;
|
||||
final ListSelectionModel selectionModel = table.getSelectionModel();
|
||||
|
||||
for (PlayerInfo player : playerList)
|
||||
if (player.getName().equals(selectedPlayerName))
|
||||
{
|
||||
if (player.getName().equals(selectedPlayerName))
|
||||
{
|
||||
selectionModel.setSelectionInterval(0, table.convertRowIndexToView(playerList.indexOf(player)));
|
||||
}
|
||||
selectionModel.setSelectionInterval(0, table.convertRowIndexToView(playerList.indexOf(player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,44 +323,40 @@ public class BTC_MainPanel extends javax.swing.JFrame
|
|||
|
||||
popup.addSeparator();
|
||||
|
||||
final ActionListener popupAction = new ActionListener()
|
||||
final ActionListener popupAction = actionEvent ->
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent)
|
||||
Object _source = actionEvent.getSource();
|
||||
if (_source instanceof PlayerListPopupItem_Command)
|
||||
{
|
||||
Object _source = actionEvent.getSource();
|
||||
if (_source instanceof PlayerListPopupItem_Command)
|
||||
{
|
||||
final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
|
||||
final String output = source.getCommand().buildOutput(source.getPlayer(), true);
|
||||
BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
|
||||
}
|
||||
else if (_source instanceof PlayerListPopupItem)
|
||||
{
|
||||
final PlayerListPopupItem source = (PlayerListPopupItem) _source;
|
||||
final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
|
||||
final String output = source.getCommand().buildOutput(source.getPlayer(), true);
|
||||
BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
|
||||
}
|
||||
else if (_source instanceof PlayerListPopupItem)
|
||||
{
|
||||
final PlayerListPopupItem source = (PlayerListPopupItem) _source;
|
||||
|
||||
final PlayerInfo _player = source.getPlayer();
|
||||
final PlayerInfo _player = source.getPlayer();
|
||||
|
||||
switch (actionEvent.getActionCommand())
|
||||
switch (actionEvent.getActionCommand())
|
||||
{
|
||||
case "Copy IP":
|
||||
{
|
||||
case "Copy IP":
|
||||
{
|
||||
copyToClipboard(_player.getIp());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied IP to clipboard: " + _player.getIp()));
|
||||
break;
|
||||
}
|
||||
case "Copy Name":
|
||||
{
|
||||
copyToClipboard(_player.getName());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied name to clipboard: " + _player.getName()));
|
||||
break;
|
||||
}
|
||||
case "Copy UUID":
|
||||
{
|
||||
copyToClipboard(_player.getUuid());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid()));
|
||||
break;
|
||||
}
|
||||
copyToClipboard(_player.getIp());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied IP to clipboard: " + _player.getIp()));
|
||||
break;
|
||||
}
|
||||
case "Copy Name":
|
||||
{
|
||||
copyToClipboard(_player.getName());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied name to clipboard: " + _player.getName()));
|
||||
break;
|
||||
}
|
||||
case "Copy UUID":
|
||||
{
|
||||
copyToClipboard(_player.getUuid());
|
||||
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -18,14 +18,17 @@
|
|||
*/
|
||||
package me.StevenLawson.BukkitTelnetClient;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
public class BukkitTelnetClient
|
||||
{
|
||||
public static final String VERSION_STRING = "v2.0.5";
|
||||
public static final String VERSION_STRING = getVersionString();
|
||||
public static final Logger LOGGER = Logger.getLogger(BukkitTelnetClient.class.getName());
|
||||
public static BTC_MainPanel mainPanel = null;
|
||||
public static BTC_ConfigLoader config = new BTC_ConfigLoader();
|
||||
|
@ -36,14 +39,10 @@ public class BukkitTelnetClient
|
|||
|
||||
findAndSetLookAndFeel("Windows");
|
||||
|
||||
java.awt.EventQueue.invokeLater(new Runnable()
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mainPanel = new BTC_MainPanel();
|
||||
mainPanel.setup();
|
||||
}
|
||||
mainPanel = new BTC_MainPanel();
|
||||
mainPanel.setup();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,4 +99,19 @@ public class BukkitTelnetClient
|
|||
|
||||
return annotation;
|
||||
}
|
||||
|
||||
public static String getVersionString()
|
||||
{
|
||||
try (final InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("my.properties"))
|
||||
{
|
||||
final Properties properties = new Properties();
|
||||
properties.load(inputStream);
|
||||
return String.format("v%s", properties.getProperty("version"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -57,7 +57,7 @@ public class FavoriteButtonEntry extends ConfigEntry
|
|||
{
|
||||
public FavoriteButtonEntryList()
|
||||
{
|
||||
super(new ArrayList<FavoriteButtonEntry>(), FavoriteButtonEntry.class);
|
||||
super(new ArrayList<>(), FavoriteButtonEntry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -86,7 +86,7 @@ public class PlayerCommandEntry extends ConfigEntry
|
|||
{
|
||||
public PlayerCommandEntryList()
|
||||
{
|
||||
super(new ArrayList<PlayerCommandEntry>(), PlayerCommandEntry.class);
|
||||
super(new ArrayList<>(), PlayerCommandEntry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -207,13 +207,6 @@ public class PlayerInfo
|
|||
|
||||
public static Comparator<PlayerInfo> getComparator()
|
||||
{
|
||||
return new Comparator<PlayerInfo>()
|
||||
{
|
||||
@Override
|
||||
public int compare(PlayerInfo a, PlayerInfo b)
|
||||
{
|
||||
return a.getName().compareTo(b.getName());
|
||||
}
|
||||
};
|
||||
return (PlayerInfo a, PlayerInfo b) -> a.getName().compareTo(b.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2014 Steven Lawson
|
||||
* Copyright (C) 2012-2017 Steven Lawson
|
||||
*
|
||||
* This file is part of FreedomTelnetClient.
|
||||
*
|
||||
|
@ -121,7 +121,7 @@ public class ServerEntry extends ConfigEntry
|
|||
{
|
||||
public ServerEntryList()
|
||||
{
|
||||
super(new HashSet<ServerEntry>(), ServerEntry.class);
|
||||
super(new HashSet<>(), ServerEntry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue