diff --git a/RemoteSystemsTempFiles/.project b/RemoteSystemsTempFiles/.project new file mode 100644 index 0000000..5447a64 --- /dev/null +++ b/RemoteSystemsTempFiles/.project @@ -0,0 +1,12 @@ + + + RemoteSystemsTempFiles + + + + + + + org.eclipse.rse.ui.remoteSystemsTempNature + + diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index c3b3267..2d4d601 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/.classpath b/TheButtonAutoFlair/.classpath index b46944c..46076ca 100644 --- a/TheButtonAutoFlair/.classpath +++ b/TheButtonAutoFlair/.classpath @@ -1,10 +1,14 @@ - - - + - + + + + + + + @@ -13,5 +17,11 @@ - + + + + + + + diff --git a/TheButtonAutoFlair/.project b/TheButtonAutoFlair/.project index 17a4a46..2014bbd 100644 --- a/TheButtonAutoFlair/.project +++ b/TheButtonAutoFlair/.project @@ -10,8 +10,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature diff --git a/TheButtonAutoFlair/.settings/org.eclipse.jdt.core.prefs b/TheButtonAutoFlair/.settings/org.eclipse.jdt.core.prefs index 7341ab1..6249222 100644 --- a/TheButtonAutoFlair/.settings/org.eclipse.jdt.core.prefs +++ b/TheButtonAutoFlair/.settings/org.eclipse.jdt.core.prefs @@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.7 diff --git a/TheButtonAutoFlair/.settings/org.eclipse.m2e.core.prefs b/TheButtonAutoFlair/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/TheButtonAutoFlair/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/TheButtonAutoFlair/bin/org/json/HTTP.class b/TheButtonAutoFlair/bin/org/json/HTTP.class index adc60a9..27dbc18 100644 Binary files a/TheButtonAutoFlair/bin/org/json/HTTP.class and b/TheButtonAutoFlair/bin/org/json/HTTP.class differ diff --git a/TheButtonAutoFlair/bin/org/json/JSONML.class b/TheButtonAutoFlair/bin/org/json/JSONML.class index 990c552..a8b7f58 100644 Binary files a/TheButtonAutoFlair/bin/org/json/JSONML.class and b/TheButtonAutoFlair/bin/org/json/JSONML.class differ diff --git a/TheButtonAutoFlair/bin/org/json/JSONObject.class b/TheButtonAutoFlair/bin/org/json/JSONObject.class index d35d404..eec00c7 100644 Binary files a/TheButtonAutoFlair/bin/org/json/JSONObject.class and b/TheButtonAutoFlair/bin/org/json/JSONObject.class differ diff --git a/TheButtonAutoFlair/bin/org/json/JSONTokener.class b/TheButtonAutoFlair/bin/org/json/JSONTokener.class index 964ef46..895bb76 100644 Binary files a/TheButtonAutoFlair/bin/org/json/JSONTokener.class and b/TheButtonAutoFlair/bin/org/json/JSONTokener.class differ diff --git a/TheButtonAutoFlair/bin/org/json/XML.class b/TheButtonAutoFlair/bin/org/json/XML.class index 2141cde..d63989d 100644 Binary files a/TheButtonAutoFlair/bin/org/json/XML.class and b/TheButtonAutoFlair/bin/org/json/XML.class differ diff --git a/TheButtonAutoFlair/bin/org/json/XMLTokener.class b/TheButtonAutoFlair/bin/org/json/XMLTokener.class index e173cd0..7bb49ad 100644 Binary files a/TheButtonAutoFlair/bin/org/json/XMLTokener.class and b/TheButtonAutoFlair/bin/org/json/XMLTokener.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class index cc4fd69..a49d868 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$2.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$2.class new file mode 100644 index 0000000..5dd2551 Binary files /dev/null and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands$2.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class index 427ea00..8b0bdf1 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/FlairStates.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/FlairStates.class new file mode 100644 index 0000000..6ed709b Binary files /dev/null and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/FlairStates.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class index f83805e..4ae1c88 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class index 4b2d92a..7d83a6c 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class index 52a7305..eecc230 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener$2.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class index 6119806..a849d9c 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class index 6f549f0..26362cd 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class differ diff --git a/TheButtonAutoFlair/htmlcleaner-2.16.jar b/TheButtonAutoFlair/htmlcleaner-2.16.jar new file mode 100644 index 0000000..75dc35f Binary files /dev/null and b/TheButtonAutoFlair/htmlcleaner-2.16.jar differ diff --git a/TheButtonAutoFlair/htmlcleaner_licence.txt b/TheButtonAutoFlair/htmlcleaner_licence.txt new file mode 100644 index 0000000..a7c2554 --- /dev/null +++ b/TheButtonAutoFlair/htmlcleaner_licence.txt @@ -0,0 +1,35 @@ +Copyright (c) 2006-2015, the HTMLCleaner project +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* The name of HtmlCleaner may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +You can contact Vladimir Nikic by sending e-mail to +nikic_vladimir@yahoo.com. Please include the word "HtmlCleaner" in the +subject line. \ No newline at end of file diff --git a/TheButtonAutoFlair/plugin.yml b/TheButtonAutoFlair/plugin.yml index b09eba5..670f695 100644 --- a/TheButtonAutoFlair/plugin.yml +++ b/TheButtonAutoFlair/plugin.yml @@ -11,5 +11,7 @@ commands: ooc: description: Send message in Out-of-Character usage: "&cUsage: /ooc &r" + unlol: + description: Unlol the last lol. Context: https://www.reddit.com/r/TheButtonMinecraft/comments/3urd29//cxnecs8 author: NorbiPeti depend: [Essentials, Towny, TownyChat, Minigames] diff --git a/TheButtonAutoFlair/pom.xml b/TheButtonAutoFlair/pom.xml new file mode 100644 index 0000000..76df524 --- /dev/null +++ b/TheButtonAutoFlair/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + TheButtonMCPlugin + 0.0.1-SNAPSHOT + The Button Minecraft Plugin + The Button Minecraft Plugin + + src + + + src + + **/*.java + + + + + + maven-compiler-plugin + 3.3 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.2 + + + package + + shade + + + + + classworlds:classworlds + junit:junit + jmock:* + *:xml-apis + org.apache.maven:lib:tests + log4j:log4j:jar: + + + + + + + + + tk.sznp + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + org.spigotmc + spigot-api + 1.8.8-R0.1-SNAPSHOT + provided + + + \ No newline at end of file diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index b574fc7..a37ede2 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -27,6 +27,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Random; +import java.util.Timer; public class Commands implements CommandExecutor { @@ -44,81 +45,102 @@ public class Commands implements CommandExecutor { return false; MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(player .getUniqueId()); // 2015.08.08. - if (!p.CommentedOnReddit - && !args[0].toLowerCase().equals("admin") - && !args[0].toLowerCase().equals("ignore") - && !args[0].toLowerCase().equals("kittycannon")) { + if (p.FlairState.equals(FlairStates.NoComment)) { player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r"); return true; } - if (!p.FlairRecognised - && !args[0].toLowerCase().equals("admin") - && !args[0].toLowerCase().equals("ignore") - && !args[0].toLowerCase().equals("kittycannon")) { - player.sendMessage("Sorry, but your flair isn't recorded. Please ask a mod to set it for you."); - return true; - } - if (!p.FlairDecided && !args[0].toLowerCase().equals("admin") - && !args[0].toLowerCase().equals("ignore") - && !args[0].toLowerCase().equals("kittycannon")) { - player.sendMessage("Please select between /u nonpresser and /u cantpress"); - return true; - } switch (args[0].toLowerCase()) // toLowerCase: 2015.08.09. { case "accept": { - if (p.IgnoredFlair) - p.IgnoredFlair = false; // 2015.08.08. - if (!p.AcceptedFlair) { - String flair = p.Flair; // 2015.08.08. - p.AcceptedFlair = true; // 2015.08.08. - PluginMain.AppendPlayerDisplayFlair(p, player); - player.sendMessage("§bYour flair has been set:§r " - + flair); - } else + if (args.length < 2 && p.UserNames.size() > 1) { + player.sendMessage("§9Multiple users commented your name. §bPlease pick one using /u accept "); + StringBuilder sb = new StringBuilder(); + sb.append("§6Usernames:"); + for (String username : p.UserNames) + sb.append(" ").append(username); + player.sendMessage(sb.toString()); + return true; + } + if (p.FlairState.equals(FlairStates.NoComment) + || p.UserNames.size() == 0) { + player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r"); + return true; + } + if (args.length > 1 && !p.UserNames.contains(args[1])) { + player.sendMessage("§cError: Unknown name: " + args[1] + + "§r"); + return true; + } + if (p.Working) { + player.sendMessage("§cError: Something is already in progress.§r"); + return true; + } + + if ((args.length > 1 ? args[1] : p.UserNames.get(0)) + .equals(p.UserName)) { player.sendMessage("§cYou already have this user's flair.§r"); + return true; + } + if (args.length > 1) + p.UserName = args[1]; + else + p.UserName = p.UserNames.get(0); + + player.sendMessage("§bObtaining flair..."); + p.Working = true; + Timer timer = new Timer(); + PlayerJoinTimerTask tt = new PlayerJoinTimerTask() { + @Override + public void run() { + try { + PluginMain.Instance.DownloadFlair(mp); + } catch (Exception e) { + e.printStackTrace(); + } + + Player player = Bukkit.getPlayer(mp.UUID); + if (mp.FlairState.equals(FlairStates.Commented)) { + player.sendMessage("Sorry, but your flair isn't recorded. Please ask an admin to set it for you. Also, prepare a comment on /r/thebutton, if possible."); + return; + } + String flair = mp.GetFormattedFlair(); + mp.FlairState = FlairStates.Accepted; + PluginMain.ConfirmUserMessage(mp); + player.sendMessage("§bYour flair has been set:§r " + + flair); + mp.Working = false; + } + }; + tt.mp = p; + timer.schedule(tt, 20); break; } case "ignore": { - if (p.AcceptedFlair) - p.AcceptedFlair = false; // 2015.08.08. - if (!p.IgnoredFlair) { - p.IgnoredFlair = true; - player.sendMessage("§bYou have ignored this request. You can still use /u accept though.§r"); + if (p.FlairState.equals(FlairStates.NoComment)) { + player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r"); + return true; + } + if (p.FlairState.equals(FlairStates.Commented)) { + player.sendMessage("Sorry, but your flair isn't recorded. Please ask a mod to set it for you."); + return true; + } + if (!p.FlairState.equals(FlairStates.Ignored)) { + p.FlairState = FlairStates.Ignored; + p.FlairTime = ""; + p.UserName = ""; + player.sendMessage("§bYou have removed your flair. You can still use /u accept to get one.§r"); } else - player.sendMessage("§cYou already ignored this request.§r"); + player.sendMessage("§cYou already removed your flair.§r"); break; } case "admin": // 2015.08.09. DoAdmin(player, args); break; - case "nonpresser": // 2015.08.09. - if (!p.AcceptedFlair) { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if (p.FlairDecided) { - player.sendMessage("§cYou have already set the flair type.§r"); - break; - } - SetPlayerFlair(player, p, "§7(--s)§r"); - break; - case "cantpress": // 2015.08.09. - if (!p.AcceptedFlair) { - player.sendMessage("§cYou need to accept the flair first.§r"); - break; - } - if (p.FlairDecided) { - player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); - break; - } - SetPlayerFlair(player, p, "§r(??s)§r"); - break; case "opme": // 2015.08.10. - player.sendMessage("It would be nice, isn't it?"); // Sometimes - // I'm - // bored - // too + player.sendMessage("It would be nice, wouldn't it?"); // Sometimes + // I'm + // bored + // too break; case "announce": DoAnnounce(player, args, null); @@ -128,14 +150,14 @@ public class Commands implements CommandExecutor { player.sendMessage("§cUsage: /u name §r"); break; } - if (!MaybeOfflinePlayer.AllPlayers.containsKey(args[1])) { + MaybeOfflinePlayer mp = MaybeOfflinePlayer + .GetFromName(args[1]); + if (mp == null) { player.sendMessage("§cUnknown user: " + args[1]); break; } - player.sendMessage("§bUsername of " - + args[1] - + ": " - + MaybeOfflinePlayer.AllPlayers.get(args[1]).UserName); + player.sendMessage("§bUsername of " + args[1] + ": " + + mp.UserName); break; case "enable": if (player.getName().equals("NorbiPeti")) { @@ -175,6 +197,8 @@ public class Commands implements CommandExecutor { MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true; } return true; + case "unlol": // TODO: Unlol + return true; default: player.sendMessage("Unknown command: " + cmd.getName()); break; @@ -207,9 +231,9 @@ public class Commands implements CommandExecutor { for (Player p : PluginMain.GetPlayers()) { MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p .getUniqueId()); - // if(mp.Flair!=null) - if (mp.CommentedOnReddit) { - PluginMain.AppendPlayerDisplayFlair(mp, p); // 2015.08.09. + if (mp.FlairState.equals(FlairStates.Recognised) + || mp.FlairState.equals(FlairStates.Commented)) { + PluginMain.ConfirmUserMessage(mp); } String msg = "§bNote: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; // 2015.08.09. p.sendMessage(msg); // 2015.08.09. @@ -307,13 +331,9 @@ public class Commands implements CommandExecutor { return; } SendMessage(player, "Player name: " + p.PlayerName); - SendMessage(player, "User flair: " + p.Flair); + SendMessage(player, "User flair: " + p.GetFormattedFlair()); SendMessage(player, "Username: " + p.UserName); - SendMessage(player, "Flair accepted: " + p.AcceptedFlair); - SendMessage(player, "Flair ignored: " + p.IgnoredFlair); - SendMessage(player, "Flair decided: " + p.FlairDecided); - SendMessage(player, "Flair recognised: " + p.FlairRecognised); - SendMessage(player, "Commented on Reddit: " + p.CommentedOnReddit); + SendMessage(player, "Flair state: " + p.FlairState); } private static void SendMessage(Player player, String message) { // 2015.08.09. @@ -334,26 +354,21 @@ public class Commands implements CommandExecutor { } private static void SetPlayerFlair(Player player, - MaybeOfflinePlayer targetplayer, String flair) { // 2015.08.09. - flair = flair.replace('&', '§'); - targetplayer.Flair = flair; - targetplayer.CommentedOnReddit = true; // Or at least has a flair in - // some way - targetplayer.FlairRecognised = true; - SendMessage(player, "§bThe flair has been set. Player: " - + targetplayer.PlayerName + " Flair: " + flair + "§r"); + MaybeOfflinePlayer targetplayer, short flaircolor, String flairtime) { + targetplayer.FlairColor = flaircolor; + targetplayer.FlairTime = flairtime; + targetplayer.FlairState = FlairStates.Accepted; + targetplayer.UserName = ""; + SendMessage(player, + "§bThe flair has been set. Player: " + targetplayer.PlayerName + + " Flair: " + targetplayer.GetFormattedFlair() + "§r"); } private static void DoSetFlair(Player player, String[] args) { // args[0] is "admin" - args[1] is "setflair" if (args.length < 4) { SendMessage(player, - "§cUsage: /u admin setflair "); - return; - } - if (args[3].charAt(0) != '&') { - SendMessage(player, - "§cYou need to start the flair with a color code: &6(19s)&r"); + "§cUsage: /u admin setflair [number]"); return; } Player p = Bukkit.getPlayer(args[2]); @@ -361,8 +376,17 @@ public class Commands implements CommandExecutor { SendMessage(player, "§cPLayer not found.&r"); return; } + short flaircolor = 0x00; + try { + flaircolor = Short.parseShort(args[3], 16); + } catch (Exception e) { + SendMessage(player, + "§cFlaircolor must be a hexadecimal number (don't include &)."); + return; + } SetPlayerFlair(player, - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()), args[3]); + MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()), + flaircolor, (args.length < 5 ? "" : args[4])); } private static void DoUpdatePlugin(Player player) { // 2015.08.10. diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/FlairStates.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/FlairStates.java new file mode 100644 index 0000000..13668bd --- /dev/null +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/FlairStates.java @@ -0,0 +1,5 @@ +package tk.sznp.thebuttonautoflair; + +public enum FlairStates { + Accepted, Ignored, Recognised, Commented, NoComment +} diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/JarUtils.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/JarUtils.java new file mode 100644 index 0000000..fcb69fa --- /dev/null +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/JarUtils.java @@ -0,0 +1,90 @@ +package tk.sznp.thebuttonautoflair; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.net.URLDecoder; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class JarUtils { + + public static boolean extractFromJar(final String fileName, + final String dest) throws IOException { + if (getRunningJar() == null) { + return false; + } + final File file = new File(dest); + if (file.isDirectory()) { + file.mkdir(); + return false; + } + if (!file.exists()) { + file.getParentFile().mkdirs(); + } + + final JarFile jar = getRunningJar(); + final Enumeration e = jar.entries(); + while (e.hasMoreElements()) { + final JarEntry je = e.nextElement(); + if (!je.getName().contains(fileName)) { + continue; + } + final InputStream in = new BufferedInputStream( + jar.getInputStream(je)); + final OutputStream out = new BufferedOutputStream( + new FileOutputStream(file)); + copyInputStream(in, out); + jar.close(); + return true; + } + jar.close(); + return false; + } + + private final static void copyInputStream(final InputStream in, + final OutputStream out) throws IOException { + try { + final byte[] buff = new byte[4096]; + int n; + while ((n = in.read(buff)) > 0) { + out.write(buff, 0, n); + } + } finally { + out.flush(); + out.close(); + in.close(); + } + } + + public static URL getJarUrl(final File file) throws IOException { + return new URL("jar:" + file.toURI().toURL().toExternalForm() + "!/"); + } + + public static JarFile getRunningJar() throws IOException { + if (!RUNNING_FROM_JAR) { + return null; // null if not running from jar + } + String path = new File(JarUtils.class.getProtectionDomain() + .getCodeSource().getLocation().getPath()).getAbsolutePath(); + path = URLDecoder.decode(path, "UTF-8"); + return new JarFile(path); + } + + private static boolean RUNNING_FROM_JAR = false; + + static { + final URL resource = JarUtils.class.getClassLoader().getResource( + "plugin.yml"); + if (resource != null) { + RUNNING_FROM_JAR = true; + } + } + +} diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java index 601b07d..9d8da54 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java @@ -1,25 +1,25 @@ package tk.sznp.thebuttonautoflair; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.UUID; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; -public class MaybeOfflinePlayer { // 2015.08.08. +public class MaybeOfflinePlayer { public String PlayerName; public String UserName; - public String Flair; // If the user comments their name, it gets set, it - // doesn't matter if they accepted it or not - public boolean AcceptedFlair; - public boolean IgnoredFlair; - public boolean FlairDecided; // 2015.08.09. //TODO: Detect date - public boolean FlairRecognised; // 2015.08.10. - public boolean CommentedOnReddit; // 2015.08.10. - public boolean RPMode; // 2015.08.25. - public boolean PressedF; // 2015.09.18. - public Location SavedLocation; // 2015.10.02. + public List UserNames; + public String FlairTime; + public short FlairColor; + public FlairStates FlairState; + public boolean RPMode = true; + public boolean PressedF; + public Location SavedLocation; + public boolean Working; public UUID UUID; @@ -28,9 +28,11 @@ public class MaybeOfflinePlayer { // 2015.08.08. public static MaybeOfflinePlayer AddPlayerIfNeeded(UUID uuid) { if (!AllPlayers.containsKey(uuid)) { MaybeOfflinePlayer player = new MaybeOfflinePlayer(); - // player.PlayerName = playername; player.UUID = uuid; - player.Flair = ""; // 2015.08.10. + player.FlairColor = 0; + player.FlairTime = ""; + player.FlairState = FlairStates.NoComment; + player.UserNames = new ArrayList<>(); AllPlayers.put(uuid, player); return player; } @@ -44,38 +46,44 @@ public class MaybeOfflinePlayer { // 2015.08.08. MaybeOfflinePlayer mp = AddPlayerIfNeeded(java.util.UUID .fromString(cs2.getString("uuid"))); mp.UserName = cs2.getString("username"); - mp.Flair = cs2.getString("flair"); - mp.AcceptedFlair = cs2.getBoolean("acceptedflair"); - mp.IgnoredFlair = cs2.getBoolean("ignoredflair"); - mp.FlairDecided = cs2.getBoolean("flairdecided"); - mp.FlairRecognised = cs2.getBoolean("flairrecognised"); - mp.CommentedOnReddit = cs2.getBoolean("commentedonreddit"); + mp.FlairColor = (short) cs2.getInt("flaircolor"); + mp.FlairTime = cs2.getString("flairtime"); + String flairstate = cs2.getString("flairstate"); + if (flairstate != null) + mp.FlairState = FlairStates.valueOf(flairstate); + else + mp.FlairState = FlairStates.NoComment; mp.PlayerName = cs2.getString("playername"); + mp.UserNames = cs2.getStringList("usernames"); } } public static void Save(YamlConfiguration yc) { - ConfigurationSection cs = yc - .createSection("players"); + ConfigurationSection cs = yc.createSection("players"); for (MaybeOfflinePlayer mp : MaybeOfflinePlayer.AllPlayers.values()) { ConfigurationSection cs2 = cs.createSection(mp.UUID.toString()); cs2.set("playername", mp.PlayerName); cs2.set("username", mp.UserName); - cs2.set("flair", mp.Flair); - cs2.set("acceptedflair", mp.AcceptedFlair); - cs2.set("ignoredflair", mp.IgnoredFlair); - cs2.set("flairdecided", mp.FlairDecided); - cs2.set("flairrecognised", mp.FlairRecognised); - cs2.set("commentedonreddit", mp.CommentedOnReddit); + cs2.set("flaircolor", mp.FlairColor); + cs2.set("flairtime", mp.FlairTime); + cs2.set("flairstate", mp.FlairState.toString()); cs2.set("uuid", mp.UUID.toString()); + cs2.set("usernames", mp.UserNames); } } - - public static MaybeOfflinePlayer GetFromName(String name) - { - for(MaybeOfflinePlayer mp : AllPlayers.values()) - if(mp.PlayerName.equalsIgnoreCase(name)) + + public static MaybeOfflinePlayer GetFromName(String name) { + for (MaybeOfflinePlayer mp : AllPlayers.values()) + if (mp.PlayerName.equalsIgnoreCase(name)) return mp; return null; } + + public String GetFormattedFlair() { + if (FlairColor == 0x00) + return ""; + if (FlairTime == null || FlairTime.length() == 0) + return String.format("§%x(??s)§r", FlairColor); + return String.format("§%x(%ss)§r", FlairColor, FlairTime); + } } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 059407b..07ceb6f 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -40,15 +40,15 @@ public class PlayerListener implements Listener { // 2015.07.16. MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p .getUniqueId()); mp.PlayerName = p.getName(); // 2015.10.17. 0:58 - if (mp.CommentedOnReddit) + if (!mp.FlairState.equals(FlairStates.NoComment)) // if (false) - PluginMain.AppendPlayerDisplayFlair(mp, p); // 2015.08.09. + PluginMain.ConfirmUserMessage(mp); // 2015.08.09. else { // 2015.07.20. Timer timer = new Timer(); PlayerJoinTimerTask tt = new PlayerJoinTimerTask() { @Override public void run() { - if (!mp.IgnoredFlair) { + if (mp.FlairState.equals(FlairStates.NoComment)) { String json = "[\"\",{\"text\":\"If you'd like your /r/TheButton flair displayed ingame, write your Minecraft name to \",\"color\":\"aqua\"},{\"text\":\"[this thread].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]"; PluginMain.Instance.getServer().dispatchCommand( PluginMain.Console, @@ -121,9 +121,7 @@ public class PlayerListener implements Listener { // 2015.07.16. public void onPlayerChat(AsyncPlayerChatEvent event) { MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event .getPlayer().getUniqueId()); - String flair = player.Flair; // 2015.08.08. - if (player.IgnoredFlair) - flair = ""; + String flair = player.GetFormattedFlair(); String message = event.getMessage(); // 2015.08.08. for (Player p : PluginMain.GetPlayers()) { // 2015.08.12. String color = ""; // 2015.08.17. @@ -135,11 +133,10 @@ public class PlayerListener implements Listener { // 2015.07.16. (float) NotificationPitch); // 2015.08.14. MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p .getUniqueId()); // 2015.08.17. - if (mp.Flair.length() > 1) - color = mp.Flair.substring(0, 2); + color = String.format("%x", mp.FlairColor); } - message = message.replaceAll(p.getName(), color + p.getName() + message = message.replace(p.getName(), color + p.getName() + (event.getMessage().startsWith("§2>") ? "§2" : "§r")); } for (String n : nicknames.keySet()) { @@ -147,14 +144,14 @@ public class PlayerListener implements Listener { // 2015.07.16. String nwithoutformatting = new String(n); int index; while ((index = nwithoutformatting.indexOf("§k")) != -1) - nwithoutformatting = nwithoutformatting.replaceAll("§k" + nwithoutformatting = nwithoutformatting.replace("§k" + nwithoutformatting.charAt(index + 2), ""); // Support // for // one // random // char while ((index = nwithoutformatting.indexOf('§')) != -1) - nwithoutformatting = nwithoutformatting.replaceAll("§" + nwithoutformatting = nwithoutformatting.replace("§" + nwithoutformatting.charAt(index + 1), ""); if (message.contains(nwithoutformatting)) { p = Bukkit.getPlayer(nicknames.get(n)); @@ -166,7 +163,7 @@ public class PlayerListener implements Listener { // 2015.07.16. MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()); // 2015.08.17. } if (p != null) { - message = message.replaceAll(nwithoutformatting, n + message = message.replace(nwithoutformatting, n + (event.getMessage().startsWith("§2>") ? "§2" : "§r")); } } @@ -193,14 +190,14 @@ public class PlayerListener implements Listener { // 2015.07.16. String nwithoutformatting = nickname; int index; while ((index = nwithoutformatting.indexOf("§k")) != -1) - nwithoutformatting = nwithoutformatting.replaceAll("§k" + nwithoutformatting = nwithoutformatting.replace("§k" + nwithoutformatting.charAt(index + 2), ""); // Support // for // one // random // char while ((index = nwithoutformatting.indexOf('§')) != -1) - nwithoutformatting = nwithoutformatting.replaceAll("§" + nwithoutformatting = nwithoutformatting.replace("§" + nwithoutformatting.charAt(index + 1), ""); if (nwithoutformatting.startsWith(name) && !nwithoutformatting.equals(Bukkit.getPlayer( diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index e645b44..22bbfb2 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -7,19 +7,24 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.htmlcleaner.HtmlCleaner; +import org.htmlcleaner.TagNode; import org.json.JSONArray; import org.json.JSONObject; import java.io.*; import java.lang.String; +import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLClassLoader; import java.net.URLConnection; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; +import java.util.Date; +import java.util.TimeZone; public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. // A user, which flair isn't obtainable: @@ -30,7 +35,30 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. // Fired when plugin is first enabled @Override public void onEnable() { - System.out.println("The Button Minecraft server plugin"); + try { + System.out.println("Extracting necessary libraries..."); + final File[] libs = new File[] { new File(getDataFolder(), + "htmlcleaner-2.16.jar") }; + for (final File lib : libs) { + if (!lib.exists()) { + JarUtils.extractFromJar(lib.getName(), + lib.getAbsolutePath()); + } + } + for (final File lib : libs) { + if (!lib.exists()) { + getLogger().warning( + "Failed to load plugin! Could not find lib: " + + lib.getName()); + Bukkit.getServer().getPluginManager().disablePlugin(this); + return; + } + addClassPath(JarUtils.getJarUrl(lib)); + } + } catch (final Exception e) { + e.printStackTrace(); + } + getServer().getPluginManager().registerEvents(new PlayerListener(), this); Commands comm = new Commands(); @@ -71,8 +99,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. stop = true; } - public void ThreadMethod() // <-- 2015.07.16. - { + private void ThreadMethod() { while (!stop) { try { String body = DownloadString("https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/autoflair_system_comment_your_minecraft_name_and/.json?limit=1000"); @@ -97,29 +124,15 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign); if (mp == null) continue; - if (HasIGFlair(mp.UUID)) - continue; + if (!mp.UserNames.contains(author)) + mp.UserNames.add(author); + if (mp.FlairState.equals(FlairStates.NoComment)) + mp.FlairState = FlairStates.Commented; try { Thread.sleep(10); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } - String[] flairdata = DownloadString( - "http://karmadecay.com/thebutton-data.php?users=" - + author).replace("\"", "").split(":"); - String flair; - if (flairdata.length > 1) // 2015.07.15. - flair = flairdata[1]; - else - flair = ""; - if (flair != "-1") - flair = flair + "s"; - String flairclass; - if (flairdata.length > 2) - flairclass = flairdata[2]; - else - flairclass = "unknown"; - SetFlair(mp.UUID, flair, flairclass, author); } try { Thread.sleep(10000); @@ -133,6 +146,24 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. } } + public void DownloadFlair(MaybeOfflinePlayer mp) + throws MalformedURLException, IOException { + String[] flairdata = DownloadString( + "http://karmadecay.com/thebutton-data.php?users=" + mp.UserName) + .replace("\"", "").split(":"); + String flair; + if (flairdata.length > 1) + flair = flairdata[1]; + else + flair = ""; + String flairclass; + if (flairdata.length > 2) + flairclass = flairdata[2]; + else + flairclass = "unknown"; + SetFlair(mp, flair, flairclass, mp.UserName); + } + public static Exception LastException; // 2015.08.09. public String DownloadString(String urlstr) throws MalformedURLException, @@ -148,88 +179,90 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. return body; } - public static Map TownColors = new HashMap(); // 2015.07.20. - - public Boolean HasIGFlair(UUID uuid) { - MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(uuid); // 2015.08.08. - return p.CommentedOnReddit; // 2015.08.10. - } - - public void SetFlair(UUID uuid, String text, String flairclass, + private void SetFlair(MaybeOfflinePlayer p, String text, String flairclass, String username) { - MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(uuid); // 2015.08.08. - String finalflair; - p.FlairDecided = true; - p.FlairRecognised = true; - p.CommentedOnReddit = true; p.UserName = username; + p.FlairState = FlairStates.Recognised; switch (flairclass) { case "press-1": - finalflair = "§c(" + text + ")§r"; + p.FlairColor = 0xc; break; case "press-2": - finalflair = "§6(" + text + ")§r"; + p.FlairColor = 0x6; break; case "press-3": - finalflair = "§e(" + text + ")§r"; + p.FlairColor = 0xe; break; case "press-4": - finalflair = "§a(" + text + ")§r"; + p.FlairColor = 0xa; break; case "press-5": - finalflair = "§9(" + text + ")§r"; + p.FlairColor = 0x9; break; case "press-6": - finalflair = "§5(" + text + ")§r"; + p.FlairColor = 0x5; break; case "no-press": - finalflair = "§7(--s)§r"; + p.FlairColor = 0x7; break; case "cheater": - finalflair = "§5(" + text + ")§r"; + p.FlairColor = 0x5; break; - case "cant-press": // 2015.08.08. - finalflair = "§r(??s)§r"; + case "cant-press": + p.FlairColor = 0xf; break; case "unknown": if (text.equals("-1")) // If true, only non-presser/can't press; if // false, any flair - p.FlairDecided = false; - else - p.FlairRecognised = false; - finalflair = ""; - break; + { + try { + if (CheckForJoinDate(p)) { + p.FlairColor = 0x7; + p.FlairTime = "--"; + } else { + p.FlairColor = 0xf; + p.FlairTime = "--"; + } + } catch (Exception e) { + p.FlairState = FlairStates.Commented; // Flair unknown + p.FlairColor = 0; + e.printStackTrace(); + } + } else { + p.FlairState = FlairStates.Commented; // Flair unknown + p.FlairColor = 0; + } + return; default: return; } - p.Flair = finalflair; // 2015.08.08. - System.out.println("Added flair for " + p.PlayerName); - AppendPlayerDisplayFlair(p, Bukkit.getPlayer(uuid)); + p.FlairTime = text; } - public static String GetFlair(Player player) { // 2015.07.16. - String flair = MaybeOfflinePlayer.AllPlayers.get(player.getUniqueId()).Flair; // 2015.08.08. - return flair; // 2015.08.10. + public static boolean CheckForJoinDate(MaybeOfflinePlayer mp) + throws Exception { + URL url = new URL("https://www.reddit.com/u/" + mp.UserName); + URLConnection con = url.openConnection(); + con.setRequestProperty("User-Agent", "TheButtonAutoFlair"); + InputStream in = con.getInputStream(); + HtmlCleaner cleaner = new HtmlCleaner(); + TagNode node = cleaner.clean(in); + + node = node.getElementsByAttValue("class", "age", true, true)[0]; + node = node.getElementsByName("time", false)[0]; + String joindate = node.getAttributeByName("datetime"); + SimpleDateFormat parserSDF = new SimpleDateFormat("yyyy-MM-dd"); + joindate = joindate.split("T")[0]; + Date date = parserSDF.parse(joindate); + return date.before(new Calendar.Builder() + .setTimeZone(TimeZone.getTimeZone("UTC")).setDate(2015, 4, 1) + .build().getTime()); } - public static void AppendPlayerDisplayFlair(MaybeOfflinePlayer player, - Player p) // <-- 2015.08.09. - { - - if (MaybeOfflinePlayer.AllPlayers.get(p.getUniqueId()).IgnoredFlair) - return; - if (MaybeOfflinePlayer.AllPlayers.get(p.getUniqueId()).AcceptedFlair) { - if (!player.FlairDecided) - p.sendMessage("§9Your flair type is unknown. Are you a non-presser or a can't press? (/u nonpresser or /u cantpress)§r"); // 2015.08.09. - } else - p.sendMessage("§9Are you Reddit user " + player.UserName - + "?§r §6Type /u accept or /u ignore§r"); - } - - public static String GetColorForTown(String townname) { // 2015.07.20. - if (TownColors.containsKey(townname)) - return TownColors.get(townname); - return ""; + public static void ConfirmUserMessage(MaybeOfflinePlayer mp) { + Player p = Bukkit.getPlayer(mp.UUID); + if (mp.FlairState.equals(FlairStates.Commented) && p != null) + p.sendMessage("§9" + "?§r §6Type /u accept or /u ignore§r"); } public static Collection GetPlayers() { @@ -239,17 +272,15 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. public static ArrayList AnnounceMessages = new ArrayList<>(); public static int AnnounceTime = 15 * 60 * 1000; - public static void LoadFiles(boolean reload) // <-- 2015.08.09. - { - if (reload) { // 2015.08.09. + public static void LoadFiles(boolean reload) { + if (reload) { System.out .println("The Button Minecraft plugin cleanup for reloading..."); MaybeOfflinePlayer.AllPlayers.clear(); - TownColors.clear(); AnnounceMessages.clear(); Commands.Quiz.clear(); } - System.out.println("Loading files for The Button Minecraft plugin..."); // 2015.08.09. + System.out.println("Loading files for The Button Minecraft plugin..."); try { File file = new File("announcemessages.txt"); if (file.exists()) @@ -276,16 +307,15 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. System.out.println("The Button Minecraft plugin loaded files!"); } catch (IOException e) { System.out.println("Error!\n" + e); - LastException = e; // 2015.08.09. + LastException = e; } catch (InvalidConfigurationException e) { System.out.println("Error!\n" + e); - LastException = e; // 2015.08.09. + LastException = e; } } - public static void SaveFiles() // <-- 2015.08.09. - { - System.out.println("Saving files for The Button Minecraft plugin..."); // 2015.08.09. + public static void SaveFiles() { + System.out.println("Saving files for The Button Minecraft plugin..."); try { File file = new File("thebuttonmc.yml"); YamlConfiguration yc = new YamlConfiguration(); @@ -299,7 +329,23 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. System.out.println("The Button Minecraft plugin saved files!"); } catch (IOException e) { System.out.println("Error!\n" + e); - LastException = e; // 2015.08.09. + LastException = e; + } + } + + private void addClassPath(final URL url) throws IOException { + final URLClassLoader sysloader = (URLClassLoader) ClassLoader + .getSystemClassLoader(); + final Class sysclass = URLClassLoader.class; + try { + final Method method = sysclass.getDeclaredMethod("addURL", + new Class[] { URL.class }); + method.setAccessible(true); + method.invoke(sysloader, new Object[] { url }); + } catch (final Throwable t) { + t.printStackTrace(); + throw new IOException("Error adding " + url + + " to system classloader"); } } } diff --git a/TheButtonAutoFlair/target/classes/org/json/CDL.class b/TheButtonAutoFlair/target/classes/org/json/CDL.class new file mode 100644 index 0000000..ceeef9a Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/CDL.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/Cookie.class b/TheButtonAutoFlair/target/classes/org/json/Cookie.class new file mode 100644 index 0000000..7799866 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/Cookie.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/CookieList.class b/TheButtonAutoFlair/target/classes/org/json/CookieList.class new file mode 100644 index 0000000..80c3d23 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/CookieList.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/HTTP.class b/TheButtonAutoFlair/target/classes/org/json/HTTP.class new file mode 100644 index 0000000..27dbc18 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/HTTP.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/HTTPTokener.class b/TheButtonAutoFlair/target/classes/org/json/HTTPTokener.class new file mode 100644 index 0000000..f9e5bcd Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/HTTPTokener.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONArray.class b/TheButtonAutoFlair/target/classes/org/json/JSONArray.class new file mode 100644 index 0000000..db0e324 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONArray.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONException.class b/TheButtonAutoFlair/target/classes/org/json/JSONException.class new file mode 100644 index 0000000..bc646c9 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONException.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONML.class b/TheButtonAutoFlair/target/classes/org/json/JSONML.class new file mode 100644 index 0000000..a8b7f58 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONML.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONObject$Null.class b/TheButtonAutoFlair/target/classes/org/json/JSONObject$Null.class new file mode 100644 index 0000000..0e5a505 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONObject$Null.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONObject.class b/TheButtonAutoFlair/target/classes/org/json/JSONObject.class new file mode 100644 index 0000000..eec00c7 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONObject.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONString.class b/TheButtonAutoFlair/target/classes/org/json/JSONString.class new file mode 100644 index 0000000..f891964 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONString.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONStringer.class b/TheButtonAutoFlair/target/classes/org/json/JSONStringer.class new file mode 100644 index 0000000..5a1fefa Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONStringer.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONTokener.class b/TheButtonAutoFlair/target/classes/org/json/JSONTokener.class new file mode 100644 index 0000000..895bb76 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONTokener.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/JSONWriter.class b/TheButtonAutoFlair/target/classes/org/json/JSONWriter.class new file mode 100644 index 0000000..70d8c6f Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/JSONWriter.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/Property.class b/TheButtonAutoFlair/target/classes/org/json/Property.class new file mode 100644 index 0000000..2202081 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/Property.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/README b/TheButtonAutoFlair/target/classes/org/json/README new file mode 100644 index 0000000..2de22ff --- /dev/null +++ b/TheButtonAutoFlair/target/classes/org/json/README @@ -0,0 +1,73 @@ +JSON in Java [package org.json] + +This package needs a new owner. I have not used it in over a decade, and I do +not have time to maintain programs that I do not use. + +If you think you can give this package a good home, please contact me. + +Douglas Crockford +douglas@crockford.com + +2015-02-06 + + +JSON is a light-weight, language independent, data interchange format. +See http://www.JSON.org/ + +The files in this package implement JSON encoders/decoders in Java. +It also includes the capability to convert between JSON and XML, HTTP +headers, Cookies, and CDL. + +This is a reference implementation. There is a large number of JSON packages +in Java. Perhaps someday the Java community will standardize on one. Until +then, choose carefully. + +The license includes this restriction: "The software shall be used for good, +not evil." If your conscience cannot live with that, then choose a different +package. + +The package compiles on Java 1.8. + + +JSONObject.java: The JSONObject can parse text from a String or a JSONTokener +to produce a map-like object. The object provides methods for manipulating its +contents, and for producing a JSON compliant object serialization. + +JSONArray.java: The JSONObject can parse text from a String or a JSONTokener +to produce a vector-like object. The object provides methods for manipulating +its contents, and for producing a JSON compliant array serialization. + +JSONTokener.java: The JSONTokener breaks a text into a sequence of individual +tokens. It can be constructed from a String, Reader, or InputStream. + +JSONException.java: The JSONException is the standard exception type thrown +by this package. + + +JSONString.java: The JSONString interface requires a toJSONString method, +allowing an object to provide its own serialization. + +JSONStringer.java: The JSONStringer provides a convenient facility for +building JSON strings. + +JSONWriter.java: The JSONWriter provides a convenient facility for building +JSON text through a writer. + + +CDL.java: CDL provides support for converting between JSON and comma +delimited lists. + +Cookie.java: Cookie provides support for converting between JSON and cookies. + +CookieList.java: CookieList provides support for converting between JSON and +cookie lists. + +HTTP.java: HTTP provides support for converting between JSON and HTTP headers. + +HTTPTokener.java: HTTPTokener extends JSONTokener for parsing HTTP headers. + +XML.java: XML provides support for converting between JSON and XML. + +JSONML.java: JSONML provides support for converting between JSONML and XML. + +XMLTokener.java: XMLTokener extends JSONTokener for parsing XML text. diff --git a/TheButtonAutoFlair/target/classes/org/json/XML.class b/TheButtonAutoFlair/target/classes/org/json/XML.class new file mode 100644 index 0000000..d63989d Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/XML.class differ diff --git a/TheButtonAutoFlair/target/classes/org/json/XMLTokener.class b/TheButtonAutoFlair/target/classes/org/json/XMLTokener.class new file mode 100644 index 0000000..7bb49ad Binary files /dev/null and b/TheButtonAutoFlair/target/classes/org/json/XMLTokener.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/AnnouncerThread.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/AnnouncerThread.class new file mode 100644 index 0000000..1a353e9 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/AnnouncerThread.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class new file mode 100644 index 0000000..4839659 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class new file mode 100644 index 0000000..6d7119e Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class new file mode 100644 index 0000000..f0d4e50 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/FlairStates.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/FlairStates.class new file mode 100644 index 0000000..6ed709b Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/FlairStates.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/JarUtils.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/JarUtils.class new file mode 100644 index 0000000..643a1df Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/JarUtils.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class new file mode 100644 index 0000000..dbff9ae Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerJoinTimerTask.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerJoinTimerTask.class new file mode 100644 index 0000000..a45f0d5 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerJoinTimerTask.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class new file mode 100644 index 0000000..7d83a6c Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class new file mode 100644 index 0000000..eecc230 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class new file mode 100644 index 0000000..a849d9c Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class similarity index 70% rename from TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class rename to TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class index 92a062f..4257a51 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class similarity index 87% rename from TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class rename to TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class index c814479..5c7b657 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class new file mode 100644 index 0000000..4d1ff80 Binary files /dev/null and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class differ