From 7c148988f9efc8864ac8f6ab82350a54aa895117 Mon Sep 17 00:00:00 2001 From: StevenLawson Date: Fri, 29 Aug 2014 16:08:22 -0400 Subject: [PATCH] Resolve compatibility issues with JRE 7. Change settings file name. --- .gitignore | 2 +- .../BukkitTelnetClient/BTC_ConfigLoader.java | 4 ++-- .../BTC_PlayerListDecoder.java | 6 ++++++ .../BukkitTelnetClient.java | 2 ++ .../BukkitTelnetClient/ConfigEntry.java | 21 +++++++++++++++++-- .../BukkitTelnetClient/ConfigEntryList.java | 21 +++++++++++++++++-- .../{settings.xml => btc_settings.xml} | 4 ++++ 7 files changed, 53 insertions(+), 7 deletions(-) rename src/main/resources/{settings.xml => btc_settings.xml} (97%) diff --git a/.gitignore b/.gitignore index 6913fda..d90dee8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /target/ -settings.xml +/btc_settings.xml diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_ConfigLoader.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_ConfigLoader.java index 711a3ec..fffc3df 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_ConfigLoader.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_ConfigLoader.java @@ -32,7 +32,7 @@ import org.xml.sax.SAXException; public class BTC_ConfigLoader { - private static final String SETTINGS_FILE = "settings.xml"; + private static final String SETTINGS_FILE = "btc_settings.xml"; private final ServerEntry.ServerEntryList servers = new ServerEntry.ServerEntryList(); private final PlayerCommandEntry.PlayerCommandEntryList playerCommands = new PlayerCommandEntry.PlayerCommandEntryList(); @@ -44,7 +44,7 @@ public class BTC_ConfigLoader public boolean load(boolean verbose) { - File settings = new File("settings.xml"); + File settings = new File(SETTINGS_FILE); if (!settings.exists()) { diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_PlayerListDecoder.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_PlayerListDecoder.java index 75de5e6..8dd6b39 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_PlayerListDecoder.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/BTC_PlayerListDecoder.java @@ -112,6 +112,12 @@ public class BTC_PlayerListDecoder { return array.getJSONObject(index++); } + + @Override + public void remove() + { + throw new UnsupportedOperationException(); + } }; } } diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java index 4bb61f6..08e1baa 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/BukkitTelnetClient.java @@ -18,6 +18,8 @@ */ package me.StevenLawson.BukkitTelnetClient; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.UnsupportedLookAndFeelException; diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntry.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntry.java index cdb25a1..9f695de 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntry.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntry.java @@ -18,6 +18,7 @@ */ package me.StevenLawson.BukkitTelnetClient; +import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.logging.Level; @@ -49,7 +50,15 @@ public abstract class ConfigEntry final Element itemElement = (Element) itemNode; for (final Method method : getClass().getDeclaredMethods()) { - final ParameterSetter annotation = method.getDeclaredAnnotation(ParameterSetter.class); + ParameterSetter annotation = null; + for (Annotation _annotation : method.getDeclaredAnnotations()) + { + if (_annotation instanceof ParameterSetter) + { + annotation = (ParameterSetter) _annotation; + break; + } + } if (annotation == null) { continue; @@ -90,7 +99,15 @@ public abstract class ConfigEntry for (final Method method : getClass().getDeclaredMethods()) { - final ParameterGetter annotation = method.getDeclaredAnnotation(ParameterGetter.class); + ParameterGetter annotation = null; + for (Annotation _annotation : method.getDeclaredAnnotations()) + { + if (_annotation instanceof ParameterGetter) + { + annotation = (ParameterGetter) _annotation; + break; + } + } if (annotation == null) { continue; diff --git a/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntryList.java b/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntryList.java index 3b6d1bf..0e84490 100644 --- a/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntryList.java +++ b/src/main/java/me/StevenLawson/BukkitTelnetClient/ConfigEntryList.java @@ -18,6 +18,7 @@ */ package me.StevenLawson.BukkitTelnetClient; +import java.lang.annotation.Annotation; import java.lang.reflect.*; import java.util.*; import java.util.logging.Level; @@ -55,7 +56,15 @@ public abstract class ConfigEntryList for (final Method method : getEntryClass().getDeclaredMethods()) { - final ParameterGetter annotation = method.getDeclaredAnnotation(ParameterGetter.class); + ParameterGetter annotation = null; + for (Annotation _annotation : method.getDeclaredAnnotations()) + { + if (_annotation instanceof ParameterGetter) + { + annotation = (ParameterGetter) _annotation; + break; + } + } if (annotation == null) { continue; @@ -114,7 +123,15 @@ public abstract class ConfigEntryList final Element itemElement = (Element) itemNode; for (final Method method : getEntryClass().getDeclaredMethods()) { - final ParameterSetter annotation = method.getDeclaredAnnotation(ParameterSetter.class); + ParameterSetter annotation = null; + for (Annotation _annotation : method.getDeclaredAnnotations()) + { + if (_annotation instanceof ParameterSetter) + { + annotation = (ParameterSetter) _annotation; + break; + } + } if (annotation == null) { continue; diff --git a/src/main/resources/settings.xml b/src/main/resources/btc_settings.xml similarity index 97% rename from src/main/resources/settings.xml rename to src/main/resources/btc_settings.xml index 6afcfa4..a1b30bb 100644 --- a/src/main/resources/settings.xml +++ b/src/main/resources/btc_settings.xml @@ -74,6 +74,10 @@ Seen IP seen $TARGET_IP + + Clear Nickname + nick $TARGET_NAME off +