diff --git a/.metadata/.log b/.metadata/.log index 146af7d..53c94ff 100644 --- a/.metadata/.log +++ b/.metadata/.log @@ -1332,3 +1332,47 @@ user global configuration and to define the default location to store repositori not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and EGit might behave differently since they see different configuration options. This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. +!SESSION 2015-08-28 23:51:11.384 ----------------------------------------------- +eclipse.buildId=M20130204-1200 +java.version=1.8.0_45 +java.vendor=Oracle Corporation +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=hu_HU +Framework arguments: -product org.eclipse.epp.package.jee.product +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product + +!ENTRY org.eclipse.egit.ui 2 0 2015-08-28 23:57:53.688 +!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level +Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. +The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in +this system level configuration. The Git installation location can be configured on the +Team > Git > Configuration preference page's 'System Settings' tab. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. + +!ENTRY org.eclipse.egit.ui 2 0 2015-08-28 23:57:53.746 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\Norbi'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. +!SESSION 2015-08-29 00:29:53.463 ----------------------------------------------- +eclipse.buildId=M20130204-1200 +java.version=1.8.0_45 +java.vendor=Oracle Corporation +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=hu_HU +Framework arguments: -product org.eclipse.epp.package.jee.product +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product + +!ENTRY org.eclipse.egit.ui 2 0 2015-08-29 00:30:27.902 +!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level +Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. +The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in +this system level configuration. The Git installation location can be configured on the +Team > Git > Configuration preference page's 'System Settings' tab. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. + +!ENTRY org.eclipse.egit.ui 2 0 2015-08-29 00:30:27.923 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\Norbi'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. diff --git a/.metadata/.mylyn/.tasks.xml.zip b/.metadata/.mylyn/.tasks.xml.zip index 5a24558..465c372 100644 Binary files a/.metadata/.mylyn/.tasks.xml.zip and b/.metadata/.mylyn/.tasks.xml.zip differ diff --git a/.metadata/.mylyn/tasks.xml.zip b/.metadata/.mylyn/tasks.xml.zip index 9bd5166..92bee02 100644 Binary files a/.metadata/.mylyn/tasks.xml.zip and b/.metadata/.mylyn/tasks.xml.zip differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index index 6361a7c..02026e2 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index and b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.indexes/e4/77/69/e/history.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers index d300ccc..fe5d155 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers and b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources index 0383800..ff5e610 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources and b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index b41c55b..3856ae3 100644 --- a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -235,7 +235,7 @@ categoryTag:Help - + newtablook org.eclipse.e4.primaryDataStack EditorStack @@ -246,32 +246,32 @@ removeOnHide - - Editor - org.eclipse.jdt.ui.CompilationUnitEditor - removeOnHide - - - - Editor - org.eclipse.jdt.ui.CompilationUnitEditor - removeOnHide - - - - Editor - org.eclipse.jdt.ui.CompilationUnitEditor - removeOnHide - - - + Editor org.eclipse.jdt.ui.CompilationUnitEditor removeOnHide activeOnClose + + + Editor + org.eclipse.jdt.ui.CompilationUnitEditor + removeOnHide + + + + Editor + org.eclipse.jdt.ui.CompilationUnitEditor + removeOnHide + + + + Editor + org.eclipse.jdt.ui.CompilationUnitEditor + removeOnHide + - + Editor org.eclipse.ui.DefaultTextEditor removeOnHide @@ -330,7 +330,7 @@ categoryTag:General - + View categoryTag:General @@ -432,18 +432,18 @@ Draggable - - - - - - - - - - - - + + + + + + + + + + + + toolbarSeparator @@ -451,38 +451,38 @@ Draggable - - - + + + Draggable - - + + Draggable - - + + Draggable - - + + Draggable - - - - + + + + Draggable - - - - + + + + Draggable @@ -492,20 +492,20 @@ Draggable - - - - + + + + Draggable - - - - - - - + + + + + + + Draggable @@ -523,15 +523,15 @@ Draggable - - - - - - - - - + + + + + + + + + toolbarSeparator @@ -543,8 +543,8 @@ Draggable - - + + stretch diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index b/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index index b44ebe8..74f63bc 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index and b/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt index efc317c..8d910bd 100644 --- a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt +++ b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt @@ -1,5 +1,5 @@ INDEX VERSION 1.126+D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\.metadata\.plugins\org.eclipse.jdt.core -1508644233.index +3045053200.index 3089967703.index 2674037006.index 323251068.index @@ -21,5 +21,5 @@ INDEX VERSION 1.126+D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spi 3604769962.index 994834796.index 3954291735.index -3045053200.index +1508644233.index 3656756579.index diff --git a/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties b/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties index 878c50e..1d61cc0 100644 --- a/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties +++ b/.metadata/.plugins/org.eclipse.pde.core/.cache/clean-cache.properties @@ -1,2 +1,2 @@ #Cached timestamps -#Thu Aug 20 23:57:56 CEST 2015 +#Fri Aug 28 23:32:43 CEST 2015 diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml index 9832abd..cac38dc 100644 --- a/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml +++ b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -23,4 +23,6 @@ + + \ No newline at end of file diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index b8b9eb7..d4026ad 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/bin/de/inventivegames/TellRawAutoMessage/Reflection.class b/TheButtonAutoFlair/bin/de/inventivegames/TellRawAutoMessage/Reflection.class deleted file mode 100644 index 07671d3..0000000 Binary files a/TheButtonAutoFlair/bin/de/inventivegames/TellRawAutoMessage/Reflection.class and /dev/null differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class index f284f54..225b74d 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/PlayerListener.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class index 5f90b40..50f2566 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/src/de/inventivegames/TellRawAutoMessage/Reflection.java b/TheButtonAutoFlair/src/de/inventivegames/TellRawAutoMessage/Reflection.java deleted file mode 100644 index 196f023..0000000 --- a/TheButtonAutoFlair/src/de/inventivegames/TellRawAutoMessage/Reflection.java +++ /dev/null @@ -1,79 +0,0 @@ -package de.inventivegames.TellRawAutoMessage; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Bukkit; - -public class Reflection { - - public static String getVersion() { - String name = Bukkit.getServer().getClass().getPackage().getName(); - String version = name.substring(name.lastIndexOf('.') + 1) + "."; - return version; - } - - public static Class getNMSClass(String className) { - String fullName = "net.minecraft.server." + getVersion() + className; - Class clazz = null; - try { - clazz = Class.forName(fullName); - } catch (Exception e) { - e.printStackTrace(); - } - return clazz; - } - - public static Class getOBCClass(String className) { - String fullName = "org.bukkit.craftbukkit." + getVersion() + className; - Class clazz = null; - try { - clazz = Class.forName(fullName); - } catch (Exception e) { - e.printStackTrace(); - } - return clazz; - } - - public static Object getHandle(Object obj) { - try { - return getMethod(obj.getClass(), "getHandle").invoke(obj); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public static Field getField(Class clazz, String name) { - try { - Field field = clazz.getDeclaredField(name); - field.setAccessible(true); - return field; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public static Method getMethod(Class clazz, String name, Class... args) { - for (Method m : clazz.getMethods()) - if (m.getName().equals(name) && (args.length == 0 || ClassListEqual(args, m.getParameterTypes()))) { - m.setAccessible(true); - return m; - } - return null; - } - - public static boolean ClassListEqual(Class[] l1, Class[] l2) { - boolean equal = true; - if (l1.length != l2.length) - return false; - for (int i = 0; i < l1.length; i++) - if (l1[i] != l2[i]) { - equal = false; - break; - } - return equal; - } - -} diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index 06f1226..46e9272 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -113,7 +113,7 @@ public class Commands implements CommandExecutor { DoAnnounce(player, args); break; case "name": - if (args.length == 0) { + if (args.length == 1) { player.sendMessage("§cUsage: /u name §r"); break; } @@ -126,6 +126,20 @@ public class Commands implements CommandExecutor { + ": " + MaybeOfflinePlayer.AllPlayers.get(args[1]).UserName); break; + case "enable": + if (player.getName().equals("NorbiPeti")) { + PlayerListener.Enable = true; + player.sendMessage("Enabled."); + } else + player.sendMessage("Unknown command: " + cmd.getName()); + break; + case "disable": + if (player.getName().equals("NorbiPeti")) { + PlayerListener.Enable = false; + player.sendMessage("Disabled."); + } else + player.sendMessage("Unknown command: " + cmd.getName()); + break; default: return false; } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 358284e..cc11f3f 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -1,6 +1,5 @@ package tk.sznp.thebuttonautoflair; -import de.inventivegames.TellRawAutoMessage.Reflection; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.configuration.InvalidConfigurationException; @@ -21,6 +20,8 @@ import java.util.UUID; public class PlayerListener implements Listener { // 2015.07.16. public static HashMap nicknames = new HashMap<>(); + public static boolean Enable = false; // 2015.08.29. + @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player p = event.getPlayer(); @@ -29,8 +30,13 @@ public class PlayerListener implements Listener { // 2015.07.16. if (mp.CommentedOnReddit) PluginMain.AppendPlayerDisplayFlair(mp, p); // 2015.08.09. else { // 2015.07.20. - String json = "[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your §6Minecraft name to \"},{\"text\":\"[this thread.]\",\"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§r\"}]}}}]"; - sendRawMessage(p, json); + // String json = + // "[\"\",{\"text\":\"§6Hi! If you'd like your flair displayed ingame, write your §6Minecraft name to \"},{\"text\":\"[this thread.]\",\"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§r\"}]}}}]"; + // sendRawMessage(p, json); + String message = "§6Hi! If you'd like your flair displayed ingame, write your §6Minecraft name to this thread:§r"; + p.sendMessage(message); + message = "§6https://www.reddit.com/r/TheButtonMinecraft/comments/3d25do/§r"; + p.sendMessage(message); } /* NICKNAME LOGIC */ @@ -49,21 +55,18 @@ public class PlayerListener implements Listener { // 2015.07.16. String nickname = yc.getString("nickname"); nicknames.put(nickname, id); - short secretstuff = 0; - Player pl = null; - if (!p.getName().equals("NorbiPeti")) { - for (Player player : PluginMain.GetPlayers()) { - if (player.getName().equals("NorbiPeti") - || player.getName().equals("Nate337")) - secretstuff++; - if (player.getName().equals("NorbiPeti")) - pl = player; + if (Enable) { + if (!p.getName().equals("NorbiPeti")) { + for (Player player : PluginMain.GetPlayers()) { + if (player.getName().equals("NorbiPeti")) { + player.chat("Hey, " + nickname + "!"); + break; + } + } } - if (secretstuff >= 2) - pl.chat("Hey, " + p.getName() + "!"); } - - mp.RPMode=true; //2015.08.25. + + mp.RPMode = true; // 2015.08.25. } @EventHandler @@ -143,28 +146,23 @@ public class PlayerListener implements Listener { // 2015.07.16. + message); // 2015.08.08. } - private static Class nmsChatSerializer = Reflection - .getNMSClass("IChatBaseComponent$ChatSerializer"); - private static Class nmsPacketPlayOutChat = Reflection - .getNMSClass("PacketPlayOutChat"); - - public static void sendRawMessage(Player player, String message) { - try { - Object handle = Reflection.getHandle(player); - Object connection = Reflection.getField(handle.getClass(), - "playerConnection").get(handle); - Object serialized = Reflection.getMethod(nmsChatSerializer, "a", - String.class).invoke(null, message); - Object packet = nmsPacketPlayOutChat.getConstructor( - Reflection.getNMSClass("IChatBaseComponent")).newInstance( - serialized); - Reflection.getMethod(connection.getClass(), "sendPacket").invoke( - connection, packet); - } catch (Exception e) { - e.printStackTrace(); - PluginMain.LastException = e; // 2015.08.09. - } - } + /* + * private static Class nmsChatSerializer = Reflection + * .getNMSClass("IChatBaseComponent$ChatSerializer"); private static + * Class nmsPacketPlayOutChat = Reflection + * .getNMSClass("PacketPlayOutChat"); + * + * public static void sendRawMessage(Player player, String message) { try { + * Object handle = Reflection.getHandle(player); Object connection = + * Reflection.getField(handle.getClass(), "playerConnection").get(handle); + * Object serialized = Reflection.getMethod(nmsChatSerializer, "a", + * String.class).invoke(null, message); Object packet = + * nmsPacketPlayOutChat.getConstructor( + * Reflection.getNMSClass("IChatBaseComponent")).newInstance( serialized); + * Reflection.getMethod(connection.getClass(), "sendPacket").invoke( + * connection, packet); } catch (Exception e) { e.printStackTrace(); + * PluginMain.LastException = e; // 2015.08.09. } } + */ @EventHandler public void onTabComplete(PlayerChatTabCompleteEvent e) {