Changed flair thread URL

This commit is contained in:
Norbi Peti 2016-01-28 17:50:49 +01:00
parent ade248bf90
commit e24a7b663e
7 changed files with 6 additions and 4 deletions

Binary file not shown.

View file

@ -80,7 +80,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
@Override
public void run() {
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\"}]}}}]";
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\"}]}}}]", PluginMain.FlairThreadURL);
PluginMain.Instance.getServer().dispatchCommand(
PluginMain.Console,
"tellraw " + mp.PlayerName + " " + json);
@ -353,7 +353,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
json.append(String.format("{\"text\":\"%s\",\"color\":\"%s\"}]",
formattedmessage, (greentext ? "green"
: player.CurrentChannel.Color)));
//System.out.println(formattedmessage); // TO!DO: TMP
// System.out.println(formattedmessage); // TO!DO: TMP
if (player.CurrentChannel.equals(Channel.TownChat)
|| player.CurrentChannel.equals(Channel.NationChat))
// for (Resident resident :
@ -561,7 +561,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
} else
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
String.format("tellraw @a %s", json.toString()));
//System.out.println("JSON: " + json); // TO!DO: TMP
// System.out.println("JSON: " + json); // TO!DO: TMP
PluginMain.Instance
.getServer()
.getConsoleSender()

View file

@ -43,6 +43,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
public static PluginMain Instance;
public static ConsoleCommandSender Console; // 2015.08.12.
public static Scoreboard SB;
public final static String FlairThreadURL = "https://www.reddit.com/r/TheButtonMinecraft/comments/433ptk/autoflair_thread/";
public TownyUniverse TU;
public ArrayList<Town> Towns;
public ArrayList<Nation> Nations;
@ -139,7 +140,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
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");
String body = DownloadString(FlairThreadURL
+ ".json?limit=1000");
JSONArray json = new JSONArray(body).getJSONObject(1)
.getJSONObject("data").getJSONArray("children");
for (Object obj : json) {