* 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:
StevenLawson 2017-06-27 21:47:41 -04:00
parent 930a4a37e6
commit 1408e4d09e
21 changed files with 283 additions and 225 deletions

Binary file not shown.

View file

@ -3,15 +3,13 @@ FreedomTelnetClient
FreedomTelnetClient (previously BukkitTelnetClient) is a telnet client for use with the BukkitTelnet and TotalFreedomMod CraftBukkit plugins. 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 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: * Fixed encoding glitch that causes special characters not to show up.
* Lets you define custom commands for the player list's right-click dropdown. * (For Coders) Maven build script will now generate a Windows EXE file.
* Saves a history of your servers with a a descriptive name for the server address. * (For Coders) Minor cleanup & updates to take advantage of JDK/JRE 8 features and syntax.
* Define "favorite" command buttons for new "Commands" tab.
* "Reason" input dialog for applicable commands (any command that has a $REASON wildcard).

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View file

@ -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
View file

@ -3,14 +3,105 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>me.StevenLawson</groupId> <groupId>me.StevenLawson</groupId>
<artifactId>FreedomTelnetClient</artifactId> <artifactId>FreedomTelnetClient</artifactId>
<version>2.0.5</version> <version>2.0.06</version>
<packaging>jar</packaging> <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> <build>
<plugins> <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> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.3</version> <version>2.4.3</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -30,34 +121,50 @@
</execution> </execution>
</executions> </executions>
</plugin> </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> </plugins>
</build> </build>
<dependencies> </project>
<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>

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -19,15 +19,13 @@
package me.StevenLawson.BukkitTelnetClient; package me.StevenLawson.BukkitTelnetClient;
import java.awt.Color; import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.swing.Timer; import javax.swing.Timer;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.net.telnet.TelnetClient; import org.apache.commons.net.telnet.TelnetClient;
@ -142,7 +140,7 @@ public class BTC_ConnectionManager
return; return;
} }
this.telnetClient.getOutputStream().write((text + "\r\n").getBytes()); this.telnetClient.getOutputStream().write((text + "\r\n").getBytes(StandardCharsets.UTF_8));
this.telnetClient.getOutputStream().flush(); this.telnetClient.getOutputStream().flush();
} }
catch (IOException ex) catch (IOException ex)
@ -153,15 +151,7 @@ public class BTC_ConnectionManager
public void sendDelayedCommand(final String text, final boolean verbose, final int delay) public void sendDelayedCommand(final String text, final boolean verbose, final int delay)
{ {
final Timer timer = new Timer(delay, new ActionListener() final Timer timer = new Timer(delay, event -> sendCommand(text, verbose));
{
@Override
public void actionPerformed(ActionEvent ae)
{
sendCommand(text, verbose);
}
});
timer.setRepeats(false); timer.setRepeats(false);
timer.start(); timer.start();
} }
@ -173,74 +163,70 @@ public class BTC_ConnectionManager
return; return;
} }
this.connectThread = new Thread(new Runnable() this.connectThread = new Thread(() ->
{ {
@Override final BTC_MainPanel btc = BukkitTelnetClient.mainPanel;
public void run()
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); String line;
BTC_ConnectionManager.this.canDoDisconnect = true; while ((line = reader.readLine()) != null)
btc.getBtnSend().setEnabled(true);
btc.getTxtCommand().setEnabled(true);
btc.getTxtCommand().requestFocusInWindow();
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(telnetClient.getInputStream())))
{ {
String line; String _loginName = null;
while ((line = reader.readLine()) != null) if (BTC_ConnectionManager.this.loginName == null)
{ {
String _loginName = null; _loginName = checkForLoginMessage(line);
if (BTC_ConnectionManager.this.loginName == null) }
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; btc.updatePlayerList(selectedPlayerName);
updateTitle(true);
sendDelayedCommand("telnet.enhanced", false, 100);
} }
else else
{ {
final PlayerInfo selectedPlayer = btc.getSelectedPlayer(); final BTC_TelnetMessage message = new BTC_TelnetMessage(line);
String selectedPlayerName = null; if (!message.skip())
if (selectedPlayer != null)
{ {
selectedPlayerName = selectedPlayer.getName(); btc.writeToConsole(message);
}
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);
}
} }
} }
} }
} }
triggerDisconnect();
}
catch (IOException ex)
{
btc.writeToConsole(new BTC_ConsoleMessage(ex.getMessage() + SystemUtils.LINE_SEPARATOR + ExceptionUtils.getStackTrace(ex)));
} }
finishDisconnect(); triggerDisconnect();
BTC_ConnectionManager.this.connectThread = null;
} }
catch (IOException ex)
{
btc.writeToConsole(new BTC_ConsoleMessage(ex.getMessage() + System.lineSeparator() + ExceptionUtils.getStackTrace(ex)));
}
finishDisconnect();
BTC_ConnectionManager.this.connectThread = null;
}); });
this.connectThread.start(); this.connectThread.start();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -19,7 +19,6 @@
package me.StevenLawson.BukkitTelnetClient; package me.StevenLawson.BukkitTelnetClient;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Collection; import java.util.Collection;
import javax.swing.JButton; import javax.swing.JButton;
@ -31,15 +30,11 @@ public class BTC_FavoriteButtonsPanel extends JPanel
{ {
super.setLayout(new GridBagLayout()); super.setLayout(new GridBagLayout());
final ActionListener actionListener = new ActionListener() final ActionListener actionListener = event ->
{ {
@Override if (BukkitTelnetClient.mainPanel != null)
public void actionPerformed(final ActionEvent event)
{ {
if (BukkitTelnetClient.mainPanel != null) BukkitTelnetClient.mainPanel.getConnectionManager().sendDelayedCommand(event.getActionCommand(), true, 100);
{
BukkitTelnetClient.mainPanel.getConnectionManager().sendDelayedCommand(event.getActionCommand(), true, 100);
}
} }
}; };

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -30,7 +30,6 @@ import javax.swing.Timer;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.text.*; import javax.swing.text.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
public class BTC_MainPanel extends javax.swing.JFrame 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) private void writeToConsoleImmediately(final BTC_ConsoleMessage message, final boolean isTelnetError)
{ {
SwingUtilities.invokeLater(new Runnable() SwingUtilities.invokeLater(() ->
{ {
@Override if (isTelnetError && chkIgnoreErrors.isSelected())
public void run() {
// Do Nothing
}
else
{ {
if (isTelnetError && chkIgnoreErrors.isSelected())
{
return;
}
final StyledDocument styledDocument = mainOutput.getStyledDocument(); final StyledDocument styledDocument = mainOutput.getStyledDocument();
int startLength = styledDocument.getLength(); int startLength = styledDocument.getLength();
@ -146,7 +143,7 @@ public class BTC_MainPanel extends javax.swing.JFrame
{ {
styledDocument.insertString( styledDocument.insertString(
styledDocument.getLength(), styledDocument.getLength(),
message.getMessage() + SystemUtils.LINE_SEPARATOR, message.getMessage() + System.lineSeparator(),
StyleContext.getDefaultStyleContext().addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, message.getColor()) 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); BTC_MainPanel.this.mainOutput.setCaretPosition(startLength);
final Timer timer = new Timer(10, new ActionListener() final Timer timer = new Timer(10, event -> vScroll.setValue(vScroll.getMaximum()));
{
@Override
public void actionPerformed(ActionEvent ae)
{
vScroll.setValue(vScroll.getMaximum());
}
});
timer.setRepeats(false); timer.setRepeats(false);
timer.start(); timer.start();
} }
@ -241,26 +231,22 @@ public class BTC_MainPanel extends javax.swing.JFrame
public final void updatePlayerList(final String selectedPlayerName) public final void updatePlayerList(final String selectedPlayerName)
{ {
EventQueue.invokeLater(new Runnable() EventQueue.invokeLater(() ->
{ {
@Override playerListTableModel.fireTableDataChanged();
public void run()
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()); for (PlayerInfo player : playerList)
if (selectedPlayerName != null)
{ {
final JTable table = BTC_MainPanel.this.tblPlayers; if (player.getName().equals(selectedPlayerName))
final ListSelectionModel selectionModel = table.getSelectionModel();
for (PlayerInfo player : playerList)
{ {
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(); popup.addSeparator();
final ActionListener popupAction = new ActionListener() final ActionListener popupAction = actionEvent ->
{ {
@Override Object _source = actionEvent.getSource();
public void actionPerformed(ActionEvent actionEvent) if (_source instanceof PlayerListPopupItem_Command)
{ {
Object _source = actionEvent.getSource(); final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
if (_source instanceof PlayerListPopupItem_Command) final String output = source.getCommand().buildOutput(source.getPlayer(), true);
{ BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source; }
final String output = source.getCommand().buildOutput(source.getPlayer(), true); else if (_source instanceof PlayerListPopupItem)
BTC_MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100); {
} final PlayerListPopupItem source = (PlayerListPopupItem) _source;
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()));
copyToClipboard(_player.getIp()); break;
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied IP to clipboard: " + _player.getIp())); }
break; case "Copy Name":
} {
case "Copy Name": copyToClipboard(_player.getName());
{ BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied name to clipboard: " + _player.getName()));
copyToClipboard(_player.getName()); break;
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied name to clipboard: " + _player.getName())); }
break; case "Copy UUID":
} {
case "Copy UUID": copyToClipboard(_player.getUuid());
{ BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid()));
copyToClipboard(_player.getUuid()); break;
BTC_MainPanel.this.writeToConsole(new BTC_ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid()));
break;
}
} }
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -18,14 +18,17 @@
*/ */
package me.StevenLawson.BukkitTelnetClient; package me.StevenLawson.BukkitTelnetClient;
import java.io.InputStream;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.SwingUtilities;
public class BukkitTelnetClient 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 final Logger LOGGER = Logger.getLogger(BukkitTelnetClient.class.getName());
public static BTC_MainPanel mainPanel = null; public static BTC_MainPanel mainPanel = null;
public static BTC_ConfigLoader config = new BTC_ConfigLoader(); public static BTC_ConfigLoader config = new BTC_ConfigLoader();
@ -36,14 +39,10 @@ public class BukkitTelnetClient
findAndSetLookAndFeel("Windows"); findAndSetLookAndFeel("Windows");
java.awt.EventQueue.invokeLater(new Runnable() SwingUtilities.invokeLater(() ->
{ {
@Override mainPanel = new BTC_MainPanel();
public void run() mainPanel.setup();
{
mainPanel = new BTC_MainPanel();
mainPanel.setup();
}
}); });
} }
@ -100,4 +99,19 @@ public class BukkitTelnetClient
return annotation; 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";
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -57,7 +57,7 @@ public class FavoriteButtonEntry extends ConfigEntry
{ {
public FavoriteButtonEntryList() public FavoriteButtonEntryList()
{ {
super(new ArrayList<FavoriteButtonEntry>(), FavoriteButtonEntry.class); super(new ArrayList<>(), FavoriteButtonEntry.class);
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -86,7 +86,7 @@ public class PlayerCommandEntry extends ConfigEntry
{ {
public PlayerCommandEntryList() public PlayerCommandEntryList()
{ {
super(new ArrayList<PlayerCommandEntry>(), PlayerCommandEntry.class); super(new ArrayList<>(), PlayerCommandEntry.class);
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -207,13 +207,6 @@ public class PlayerInfo
public static Comparator<PlayerInfo> getComparator() public static Comparator<PlayerInfo> getComparator()
{ {
return new Comparator<PlayerInfo>() return (PlayerInfo a, PlayerInfo b) -> a.getName().compareTo(b.getName());
{
@Override
public int compare(PlayerInfo a, PlayerInfo b)
{
return a.getName().compareTo(b.getName());
}
};
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2014 Steven Lawson * Copyright (C) 2012-2017 Steven Lawson
* *
* This file is part of FreedomTelnetClient. * This file is part of FreedomTelnetClient.
* *
@ -121,7 +121,7 @@ public class ServerEntry extends ConfigEntry
{ {
public ServerEntryList() public ServerEntryList()
{ {
super(new HashSet<ServerEntry>(), ServerEntry.class); super(new HashSet<>(), ServerEntry.class);
} }
@Override @Override