Did some stuff
This commit is contained in:
parent
c54a8e2a6d
commit
c6a19599e0
7 changed files with 19 additions and 2 deletions
Binary file not shown.
|
@ -163,6 +163,16 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}, 120);
|
}, 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
|
@EventHandler
|
||||||
|
|
|
@ -171,6 +171,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign);
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign);
|
||||||
if (mp == null)
|
if (mp == null)
|
||||||
continue;
|
continue;
|
||||||
|
if (!JoinedBefore(mp, 2015, 6, 5))
|
||||||
|
continue;
|
||||||
if (!mp.UserNames.contains(author))
|
if (!mp.UserNames.contains(author))
|
||||||
mp.UserNames.add(author);
|
mp.UserNames.add(author);
|
||||||
if (mp.FlairState.equals(FlairStates.NoComment)) {
|
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)
|
public static boolean CheckForJoinDate(MaybeOfflinePlayer mp)
|
||||||
throws Exception {
|
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);
|
URL url = new URL("https://www.reddit.com/u/" + mp.UserName);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
con.setRequestProperty("User-Agent", "TheButtonAutoFlair");
|
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];
|
joindate = joindate.split("T")[0];
|
||||||
Date date = parserSDF.parse(joindate);
|
Date date = parserSDF.parse(joindate);
|
||||||
return date.before(new Calendar.Builder()
|
return date.before(new Calendar.Builder()
|
||||||
.setTimeZone(TimeZone.getTimeZone("UTC")).setDate(2015, 4, 1)
|
.setTimeZone(TimeZone.getTimeZone("UTC"))
|
||||||
.build().getTime());
|
.setDate(year, month, day).build().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ConfirmUserMessage(MaybeOfflinePlayer mp) {
|
public static void ConfirmUserMessage(MaybeOfflinePlayer mp) {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue