diff --git a/.metadata/.mylyn/.tasks.xml.zip b/.metadata/.mylyn/.tasks.xml.zip index f1f76a0..73fbcd2 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 b33aadd..94b1e39 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/RemoteSystemsTempFiles/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.markers.snap index c8b1e33..947df51 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.markers.snap and b/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.markers.snap differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.syncinfo.snap index c8b1e33..947df51 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.syncinfo.snap and b/.metadata/.plugins/org.eclipse.core.resources/.projects/RemoteSystemsTempFiles/.syncinfo.snap differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers.snap index bb92572..fd9c25d 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers.snap and b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.markers.snap differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.syncinfo.snap index c8b1e33..947df51 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.syncinfo.snap and b/.metadata/.plugins/org.eclipse.core.resources/.projects/TheButtonAutoFlair/.syncinfo.snap differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap index c8b1e33..947df51 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap and b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap 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 898931d..46f1f55 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.core.resources/.snap b/.metadata/.plugins/org.eclipse.core.resources/.snap index a48e916..8a6d82b 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.snap and b/.metadata/.plugins/org.eclipse.core.resources/.snap differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index b/.metadata/.plugins/org.eclipse.jdt.core/1508644233.index index 8d61371..16293b1 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/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index 9cb2da5..7b9da04 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/Commands.class index a85c012..ebc62fe 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/MaybeOfflinePlayer.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class index 735af11..4290712 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.class differ diff --git a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PlayerListener.class index d1e54ea..1f59703 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/bin/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class index df2e557..d82ffce 100644 Binary files a/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/bin/tk/sznp/thebuttonautoflair/PluginMain.class differ diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index 41562b5..d1dda6d 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -23,12 +23,12 @@ public class Commands implements CommandExecutor { return false; MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08. //if(!PluginMain.PlayerFlairs.containsKey(player.getName())) - if(p.Flair==null) + if(!p.CommentedOnReddit && !args[0].toLowerCase().equals("admin")) { player.sendMessage("§cError: You need to write your username to the reddit thread at /r/TheButtonMinecraft§r"); return true; } - if(!p.FlairRecognised) + if(!p.FlairRecognised && !args[0].toLowerCase().equals("admin")) { //2015.08.10. player.sendMessage("Sorry, but your flair isn't recorded. Please ask a mod to set it for you."); return true; @@ -83,8 +83,7 @@ public class Commands implements CommandExecutor { player.sendMessage("§cYou have already set the flair type.§r"); break; } - //p.Flair="§7(non-pr.)§r"; - SetPlayerFlair(player, p, "§7(non-pr.)§r"); + SetPlayerFlair(player, p, "§7(--s)§r"); break; case "cantpress": //2015.08.09. if(!p.AcceptedFlair) @@ -97,8 +96,7 @@ public class Commands implements CommandExecutor { player.sendMessage("§cYou have already set the flair type or your flair type is known.§r"); break; } - //p.Flair="§r(can't press)§r"; - SetPlayerFlair(player, p, "§r(can't pr.)§r"); + SetPlayerFlair(player, p, "§r(??s)§r"); break; case "opme": //2015.08.10. player.sendMessage("It would be nice, isn't it?"); //Sometimes I'm bored too @@ -130,18 +128,14 @@ public class Commands implements CommandExecutor { for(Player p : PluginMain.GetPlayers()) { MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); - if(mp.Flair!=null) + //if(mp.Flair!=null) + if(mp.CommentedOnReddit) { - //String flair=mp.Flair; - //PluginMain.RemovePlayerDisplayFlairFinal(p, flair); - //PluginMain.AppendPlayerDisplayFlairFinal(p, flair); PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. } String msg="§6Note: The auto-flair plugin has been reloaded. You might need to wait 10s to have your flair.§r"; //2015.08.09. p.sendMessage(msg); //2015.08.09. } - //String msg="§6Reloaded config file.§r"; - //SendMessage(player, msg); //2015.08.09. } } catch(Exception e) @@ -158,7 +152,7 @@ public class Commands implements CommandExecutor { private static Player ReloadPlayer; //2015.08.09. private static void DoAdmin(Player player, String[] args) { //2015.08.09. - if(player==null || player.isOp() || player.getName()=="NorbiPeti") + if(player==null || player.isOp() || player.getName().equals("NorbiPeti")) { //System.out.println("Args length: " + args.length); if(args.length==1) @@ -227,6 +221,8 @@ public class Commands implements CommandExecutor { SendMessage(player, "Flair accepted: "+p.AcceptedFlair); SendMessage(player, "Flair ignored: "+p.IgnoredFlair); SendMessage(player, "Flair decided: "+p.FlairDecided); + SendMessage(player, "Flair recognised: "+p.FlairRecognised); + SendMessage(player, "Commented on Reddit: "+p.CommentedOnReddit); } private static void SendMessage(Player player, String message) { //2015.08.09. @@ -251,6 +247,7 @@ public class Commands implements CommandExecutor { { //2015.08.09. flair=flair.replace('&', '§'); targetplayer.Flair=flair; + targetplayer.CommentedOnReddit=true; //Or at least has a flair in some way if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName)) { SendMessage(player, "§cError removing previous custom flair!§r"); @@ -260,7 +257,7 @@ public class Commands implements CommandExecutor { try { BufferedWriter bw; bw = new BufferedWriter(new FileWriter(file, true)); - bw.write(targetplayer.PlayerName+"\n"); + bw.write(targetplayer.PlayerName+targetplayer.Flair+"\n"); bw.close(); } catch (IOException e) { System.out.println("Error!\n"+e); diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java index 6437f02..1a8bafb 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/MaybeOfflinePlayer.java @@ -11,6 +11,7 @@ public class MaybeOfflinePlayer public boolean IgnoredFlair; public boolean FlairDecided; //2015.08.09. public boolean FlairRecognised; //2015.08.10. + public boolean CommentedOnReddit; //2015.08.10. public static HashMap AllPlayers=new HashMap<>(); //2015.08.08. public static MaybeOfflinePlayer AddPlayerIfNeeded(String playername) { @@ -18,6 +19,7 @@ public class MaybeOfflinePlayer { MaybeOfflinePlayer player=new MaybeOfflinePlayer(); player.PlayerName=playername; + player.Flair=""; //2015.08.10. AllPlayers.put(playername, player); return player; } diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 655e1ec..7324aa9 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -17,7 +17,7 @@ public class PlayerListener implements Listener Player p=event.getPlayer(); MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.08. MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p.getName()); //2015.08.08. - if(mp.Flair!=null) + if(mp.CommentedOnReddit) PluginMain.AppendPlayerDisplayFlair(mp, p); //2015.08.09. else { //2015.07.20. @@ -36,8 +36,8 @@ public class PlayerListener implements Listener { MaybeOfflinePlayer player = MaybeOfflinePlayer.AllPlayers.get(event.getPlayer().getName()); String flair=player.Flair; //2015.08.08. - if(flair==null || !player.AcceptedFlair) - flair=""; //2015.08.08. + if(player.IgnoredFlair) + flair=""; String message=event.getMessage(); //2015.08.08. /*for(Player p : PluginMain.GetPlayers()) { //2015.08.08. diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index 216c466..e68eaa6 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -133,7 +133,8 @@ public class PluginMain extends JavaPlugin public Boolean HasIGFlair(String playername) { MaybeOfflinePlayer p=MaybeOfflinePlayer.AddPlayerIfNeeded(playername); //2015.08.08. - return p.Flair!=null; //2015.08.08. + //return p.Flair!=null; //2015.08.08. + return p.CommentedOnReddit; //2015.08.10. } public void SetFlair(String playername, String text, String flairclass, String username) @@ -163,13 +164,13 @@ public class PluginMain extends JavaPlugin finalflair="§5("+text+")§r"; break; case "no-press": - finalflair="§7(non-pr.)§r"; + finalflair="§7(--s)§r"; break; case "cheater": finalflair="§5("+text+")§r"; break; case "cant-press": //2015.08.08. - finalflair="§r(can't press)§r"; + finalflair="§r(??s)§r"; break; case "unknown": if(text.equals("-1")) //If true, only non-presser/can't press; if false, any flair @@ -186,6 +187,7 @@ public class PluginMain extends JavaPlugin /*if(finalflair.length()==0) //<-- 2015.07.20. return;*/ p.Flair=finalflair; //2015.08.08. + p.CommentedOnReddit=true; //2015.08.10. p.UserName=username; //2015.08.08. if(finalflair.length()==0) //Just for the message finalflair="undecided"; @@ -204,7 +206,8 @@ public class PluginMain extends JavaPlugin public static String GetFlair(Player player) { //2015.07.16. String flair=MaybeOfflinePlayer.AllPlayers.get(player.getName()).Flair; //2015.08.08. - return flair==null ? "" : flair; + //return flair==null ? "" : flair; + return flair; //2015.08.10. } //public static void AppendPlayerDisplayFlair(Player player, String username, String flair) @@ -215,7 +218,7 @@ public class PluginMain extends JavaPlugin return; if(MaybeOfflinePlayer.AllPlayers.get(p.getName()).AcceptedFlair) { - AppendPlayerDisplayFlairFinal(p, player.Flair); //2015.07.20. + //AppendPlayerDisplayFlairFinal(p, player.Flair); //2015.07.20. if(!player.FlairDecided) p.sendMessage("§9Your flair type is unknown. Are you a non-presser or a can't press? (/u nonpresser or /u cantpress)§r"); //2015.08.09. } @@ -223,9 +226,9 @@ public class PluginMain extends JavaPlugin p.sendMessage("§9Are you Reddit user "+player.UserName+"?§r §6Type /u accept or /u ignore§r"); } - private static void AppendPlayerDisplayFlairFinal(Player player, String flair) + /*private static void AppendPlayerDisplayFlairFinal(Player player, String flair) { //2015.07.20. - /*String color = GetColorForTown(GetPlayerTown(player)); //TO!DO: Multiple colors put on first capital letters + *String color = GetColorForTown(GetPlayerTown(player)); //TO!DO: Multiple colors put on first capital letters String[] colors = color.substring(1).split("§"); String displayname=player.getName(); //2015.08.08. ArrayList Positions=new ArrayList<>(); @@ -266,9 +269,8 @@ public class PluginMain extends JavaPlugin String substr="§"+colors[x++]+displayname.substring(pos, nextpos)+"§r"; finalname+=substr; } - }*/ - MaybeOfflinePlayer.AllPlayers.get(player.getName()).Flair=flair; //2015.08.08. - } + }* + }*/ public static String GetColorForTown(String townname) { //2015.07.20. @@ -354,7 +356,11 @@ public class PluginMain extends JavaPlugin { String[] s=line.split(" "); if(s.length>=2) //2015.08.10. - MaybeOfflinePlayer.AddPlayerIfNeeded(s[0]).Flair=s[1]; //2015.08.09. + { + MaybeOfflinePlayer p=MaybeOfflinePlayer.AddPlayerIfNeeded(s[0]); + p.Flair=s[1]; //2015.08.09. + p.CommentedOnReddit=true; //Kind of + } } br.close(); } @@ -396,9 +402,9 @@ public class PluginMain extends JavaPlugin { if(!player.IgnoredFlair) continue; //2015.08.08. - bw.write(player.PlayerName+" "+player.Flair+"\n"); + bw.write(player.PlayerName+"\n"); } - bw.close(); + bw.close(); } catch (IOException e) { System.out.println("Error!\n"+e); LastException=e; //2015.08.09. @@ -428,7 +434,13 @@ public class PluginMain extends JavaPlugin } writer.close(); reader.close(); - return tempFile.renameTo(inputFile); + if(!tempFile.renameTo(inputFile)) + { + inputFile.delete(); + return tempFile.renameTo(inputFile); + } + else + return true; } catch (IOException e) { System.out.println("Error!\n"+e); LastException=e; //2015.08.09.