Possible fix for #30, still needs testing
This commit is contained in:
parent
2d46c3bc20
commit
da87a1293e
1 changed files with 844 additions and 871 deletions
|
@ -105,19 +105,20 @@ public class PlayerListener implements Listener {
|
||||||
if (ispremium
|
if (ispremium
|
||||||
&& mp.FlairState.equals(FlairStates.NoComment)) {
|
&& mp.FlairState.equals(FlairStates.NoComment)) {
|
||||||
String json = String
|
String json = String
|
||||||
.format("[\"\",{\"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\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
|
.format("[\"\",{\"text\":\"If you're from Reddit and 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\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
|
||||||
PluginMain.FlairThreadURL);
|
PluginMain.FlairThreadURL);
|
||||||
PluginMain.Instance.getServer().dispatchCommand(
|
PluginMain.Instance.getServer().dispatchCommand(
|
||||||
PluginMain.Console,
|
PluginMain.Console,
|
||||||
"tellraw " + mp.PlayerName + " " + json);
|
"tellraw " + mp.PlayerName + " " + json);
|
||||||
json = "[\"\",{\"text\":\"If you don't want the flair, type /u ignore to prevent this message after next login.\",\"color\":\"aqua\"}]";
|
json = "[\"\",{\"text\":\"If you aren't from Reddit or don't want the flair, type /u ignore to prevent this message after next login.\",\"color\":\"aqua\"}]";
|
||||||
PluginMain.Instance.getServer().dispatchCommand(
|
PluginMain.Instance.getServer().dispatchCommand(
|
||||||
PluginMain.Console,
|
PluginMain.Console,
|
||||||
"tellraw " + mp.PlayerName + " " + json);
|
"tellraw " + mp.PlayerName + " " + json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tt.mp = mp;;
|
tt.mp = mp;
|
||||||
|
;
|
||||||
timer.schedule(tt, 15 * 1000);
|
timer.schedule(tt, 15 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,48 +137,20 @@ public class PlayerListener implements Listener {
|
||||||
boolean ispremium = pp != null && pp.isPremium();
|
boolean ispremium = pp != null && pp.isPremium();
|
||||||
final MaybeOfflinePlayer mplayer = mp;
|
final MaybeOfflinePlayer mplayer = mp;
|
||||||
|
|
||||||
if (mp.LoginWarningCount < LoginWarningCountTotal - 1) {
|
if (mp.LoginWarningCount < LoginWarningCountTotal) {
|
||||||
if (AuthMe.getInstance().api.isAuthenticated(player)) // The
|
if (AuthMe.getInstance().api.isAuthenticated(player)) {
|
||||||
// player
|
// The player logged in in any way
|
||||||
// logged
|
if (!ispremium
|
||||||
// in
|
&& !mp.FlairState.equals(FlairStates.Accepted)
|
||||||
// in
|
&& !mp.FlairState.equals(FlairStates.Commented)) {
|
||||||
// any
|
// The player isn't premium, and doesn't have a
|
||||||
// way
|
// flair
|
||||||
{
|
String json = String
|
||||||
{
|
.format("[\"\",{\"text\":\"Welcome! If you are a premium Minecraft user, please do /premium and relog, otherwise please verify your /r/thebutton flair to play, \",\"color\":\"gold\"},{\"text\":\"[here].\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
|
||||||
if (!ispremium
|
PluginMain.FlairThreadURL);
|
||||||
&& !mp.FlairState
|
PluginMain.Instance.getServer().dispatchCommand(
|
||||||
.equals(FlairStates.Accepted)
|
PluginMain.Console,
|
||||||
&& !mp.FlairState
|
"tellraw " + mp.PlayerName + " " + json);
|
||||||
.equals(FlairStates.Commented)) { // The
|
|
||||||
// player
|
|
||||||
// isn't
|
|
||||||
// premium,
|
|
||||||
// and
|
|
||||||
// doesn't
|
|
||||||
// have
|
|
||||||
// a
|
|
||||||
// flair
|
|
||||||
// //
|
|
||||||
// The
|
|
||||||
// player
|
|
||||||
// isn't
|
|
||||||
// premium,
|
|
||||||
// and
|
|
||||||
// doesn't
|
|
||||||
// have
|
|
||||||
// a
|
|
||||||
// flair
|
|
||||||
String json = String
|
|
||||||
.format("[\"\",{\"text\":\"Welcome! If you are a premium Minecraft user, please do /premium and relog, otherwise please verify your /r/thebutton flair to play, \",\"color\":\"gold\"},{\"text\":\"[here].\",\"color\":\"gold\",\"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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue