diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index 5948419..2a5c43b 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 26bf949..dee718d 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -163,6 +163,16 @@ public class PlayerListener implements Listener { } }, 120); } + else if(!mp.FlairState.equals(FlairStates.Accepted) && !mp.FlairState + .equals(FlairStates.Commented)) + { + String json = String + .format("[\"\",{\"text\":\"Welcome! You appear to log in from a non-premium account. Please verify your /r/thebutton flair to play, \",\"color\":\"aqua\"},{\"text\":\"[here].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]", + PluginMain.FlairThreadURL); + PluginMain.Instance.getServer().dispatchCommand( + PluginMain.Console, + "tellraw " + mp.PlayerName + " " + json); + } } @EventHandler diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index b1b73e5..bd0a3c9 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -171,6 +171,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign); if (mp == null) continue; + if (!JoinedBefore(mp, 2015, 6, 5)) + continue; if (!mp.UserNames.contains(author)) mp.UserNames.add(author); if (mp.FlairState.equals(FlairStates.NoComment)) { @@ -301,6 +303,11 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. public static boolean CheckForJoinDate(MaybeOfflinePlayer mp) throws Exception { + return JoinedBefore(mp, 2015, 4, 1); + } + + public static boolean JoinedBefore(MaybeOfflinePlayer mp, int year, + int month, int day) throws Exception { URL url = new URL("https://www.reddit.com/u/" + mp.UserName); URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "TheButtonAutoFlair"); @@ -315,8 +322,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. 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()); + .setTimeZone(TimeZone.getTimeZone("UTC")) + .setDate(year, month, day).build().getTime()); } public static void ConfirmUserMessage(MaybeOfflinePlayer mp) { diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$5.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$5.class index 3fd36ce..4ce7c3f 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$5.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$5.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$6.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$6.class index 9f4cd80..9d53810 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$6.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$6.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class index 1a803b5..e4b8237 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class index e519024..46005b0 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class differ