Removed some debug code, added colors by flair color to name mentioning, etc.

- Removed some debug code
- Added name coloring by flair color when using name mentioning
- Fixed custom flair saving
- Added a check for /u admin setflair to only allow flairs starting with
a color code
- Updated version number (2.0)
- Updated plugin name
This commit is contained in:
Norbi Peti 2015-08-17 10:27:44 +02:00
parent 06797105bb
commit 22c8638b19
20 changed files with 248 additions and 347 deletions

View file

@ -977,3 +977,179 @@ user global configuration and to define the default location to store repositori
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options. EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!SESSION 2015-08-17 10:02:15.483 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.8.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=hu_HU
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
!ENTRY org.eclipse.egit.ui 2 0 2015-08-17 10:02:46.235
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!ENTRY org.eclipse.egit.ui 2 0 2015-08-17 10:02:46.268
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Norbi'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!ENTRY org.eclipse.jdt.core 4 4 2015-08-17 10:16:13.602
!MESSAGE JavaBuilder handling CoreException
!STACK 1
org.eclipse.core.runtime.CoreException: Could not write file: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class.
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:397)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:1101)
at org.eclipse.core.internal.resources.File.internalSetContents(File.java:321)
at org.eclipse.core.internal.resources.File.setContents(File.java:360)
at org.eclipse.core.internal.resources.File.setContents(File.java:464)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileContents(IncrementalImageBuilder.java:835)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:857)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:188)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:510)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:365)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:302)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.io.FileNotFoundException: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class (A folyamat nem fér hozzá a fájlhoz, mert azt egy másik folyamat használja)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:388)
... 26 more
!SUBENTRY 1 org.eclipse.core.filesystem 4 272 2015-08-17 10:16:13.654
!MESSAGE Could not write file: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class.
!STACK 0
java.io.FileNotFoundException: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class (A folyamat nem fér hozzá a fájlhoz, mert azt egy másik folyamat használja)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:388)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:1101)
at org.eclipse.core.internal.resources.File.internalSetContents(File.java:321)
at org.eclipse.core.internal.resources.File.setContents(File.java:360)
at org.eclipse.core.internal.resources.File.setContents(File.java:464)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileContents(IncrementalImageBuilder.java:835)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:857)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:188)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:510)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:365)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:302)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
!ENTRY org.eclipse.jdt.core 4 4 2015-08-17 10:16:13.690
!MESSAGE JavaBuilder handling ImageBuilderInternalException while building: TheButtonAutoFlair
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Problems encountered while deleting resources.
at org.eclipse.core.internal.resources.Resource.delete(Resource.java:816)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeClassFile(IncrementalImageBuilder.java:757)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeSecondaryTypes(IncrementalImageBuilder.java:770)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:135)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Contains: Could not delete 'D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class'.
org.eclipse.core.runtime.CoreException: Problems encountered while deleting files.
at org.eclipse.core.internal.filesystem.local.LocalFile.delete(LocalFile.java:131)
at org.eclipse.core.internal.resources.ResourceTree.internalDeleteFile(ResourceTree.java:304)
at org.eclipse.core.internal.resources.ResourceTree.standardDeleteFile(ResourceTree.java:785)
at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1973)
at org.eclipse.core.internal.resources.Resource.delete(Resource.java:803)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeClassFile(IncrementalImageBuilder.java:757)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeSecondaryTypes(IncrementalImageBuilder.java:770)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:135)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Contains: Could not delete: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class.
!SUBENTRY 1 org.eclipse.core.resources 4 273 2015-08-17 10:16:13.691
!MESSAGE Problems encountered while deleting resources.
!SUBENTRY 2 org.eclipse.core.resources 4 273 2015-08-17 10:16:13.691
!MESSAGE Could not delete 'D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class'.
!STACK 1
org.eclipse.core.runtime.CoreException: Problems encountered while deleting files.
at org.eclipse.core.internal.filesystem.local.LocalFile.delete(LocalFile.java:131)
at org.eclipse.core.internal.resources.ResourceTree.internalDeleteFile(ResourceTree.java:304)
at org.eclipse.core.internal.resources.ResourceTree.standardDeleteFile(ResourceTree.java:785)
at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1973)
at org.eclipse.core.internal.resources.Resource.delete(Resource.java:803)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeClassFile(IncrementalImageBuilder.java:757)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.removeSecondaryTypes(IncrementalImageBuilder.java:770)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:135)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Contains: Could not delete: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class.
!SUBENTRY 3 org.eclipse.core.filesystem 4 273 2015-08-17 10:16:13.691
!MESSAGE Problems encountered while deleting files.
!SUBENTRY 4 org.eclipse.core.filesystem 4 273 2015-08-17 10:16:13.691
!MESSAGE Could not delete: D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\TheButtonAutoFlair\bin\tk\sznp\thebuttonautoflair\Commands.class.

Binary file not shown.

Binary file not shown.

View file

@ -1,277 +0,0 @@
package tk.sznp.thebuttonautoflair;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commands implements CommandExecutor {
// This method is called, when somebody uses our command
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(args.length<1)
return false;
MaybeOfflinePlayer p=MaybeOfflinePlayer.AllPlayers.get(player.getName()); //2015.08.08.
//if(!PluginMain.PlayerFlairs.containsKey(player.getName()))
if(p.Flair==null)
{
player.sendMessage("Error: You need to write your username to the reddit thread at /r/TheButtonMinecraft");
return true;
}
switch(args[0].toLowerCase()) //toLowerCase: 2015.08.09.
{
case "accept":
{
if(p.IgnoredFlair)
p.IgnoredFlair=false; //2015.08.08.
if(!p.AcceptedFlair)
{
String flair=p.Flair; //2015.08.08.
//PluginMain.AppendPlayerDisplayFlairFinal(player, flair); //2015.07.20.
p.AcceptedFlair=true; //2015.08.08.
PluginMain.AppendPlayerDisplayFlair(p, player);
player.sendMessage("§6Your flair has been set:§r "+flair);
}
else
player.sendMessage("§cYou already have this user's flair.§r");
break;
}
case "ignore":
{
if(p.AcceptedFlair)
p.AcceptedFlair=false; //2015.08.08.
if(!p.IgnoredFlair)
{
p.IgnoredFlair=true;
//String flair=p.Flair; //2015.08.08.
//PluginMain.RemovePlayerDisplayFlairFinal(player, flair); //2015.07.20.
player.sendMessage("§6You have ignored this request. You can still use /u accept though.§r");
}
else
player.sendMessage("§cYou already ignored this request.§r");
break;
}
/*case "reload": //2015.07.20.
DoReload(player);
break;*/
case "admin": //2015.08.09.
DoAdmin(player, args);
break;
case "nonpresser": //2015.08.09.
if(!p.AcceptedFlair)
{
player.sendMessage("§cYou need to accept the flair first.§r");
break;
}
if(p.FlairDecided)
{
player.sendMessage("§cYou have already set the flair type.§r");
break;
}
//p.Flair="§7(non-pr.)§r";
SetPlayerFlair(player, p, "§7(non-pr.)§r");
break;
case "cantpress": //2015.08.09.
if(!p.AcceptedFlair)
{
player.sendMessage("§cYou need to accept the flair first.§r");
break;
}
if(p.FlairDecided)
{
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");
break;
default:
return false;
}
return true;
}
/*if(args[0].toLowerCase()=="reload")
DoReload(null); //2015.07.20.*/
else if(args.length>0 && args[0].toLowerCase().equals("admin")) //2015.08.09.
{
DoAdmin(null, args); //2015.08.09.
return true; //2015.08.09.
}
return false;
}
private static void DoReload(Player player)
{ //2015.07.20.
//if(player==null || player.isOp() || player.getName()=="NorbiPeti")
//{
try
{
File file=new File("autoflairconfig.txt");
if(file.exists())
{
PluginMain.LoadFiles(true); //2015.08.09.
for(Player p : PluginMain.GetPlayers())
{
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName());
if(mp.Flair!=null)
{
//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)
{
System.out.println("Error!\n"+e);
if(player!=null)
player.sendMessage("§cAn error occured. See console for details.§r");
PluginMain.LastException=e; //2015.08.09.
}
//}
//else
//player.sendMessage("§cYou need to be OP to use this command.§r");
}
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")
{
//System.out.println("Args length: " + args.length);
if(args.length==1)
{
String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r";
SendMessage(player, message);
return;
}
//args[0] is "admin"
switch(args[1].toLowerCase())
{
case "reload":
ReloadPlayer=player; //2015.08.09.
SendMessage(player, "§6Make sure to save the current settings before you modify and reload them! Type /u admin confirm when done.§r");
break;
case "playerinfo":
DoPlayerInfo(player, args);
break;
case "getlasterror":
DoGetLastError(player, args);
break; //<-- 2015.08.10.
case "confirm":
if(ReloadPlayer==player)
DoReload(player); //2015.08.09.
else
SendMessage(player, "§cYou need to do /u admin reload first.§r");
break;
case "save":
PluginMain.SaveFiles(); //2015.08.09.
SendMessage(player, "§6Saved files. Now you can edit them and reload if you want.§r");
break;
case "setflair":
DoSetFlair(player, args);
break;
case "updateplugin": //2015.08.10.
DoUpdatePlugin(player);
break;
default:
String message="§cUsage: /u admin reload|playerinfo|getlasterror|save|setflair|updateplugin§r";
SendMessage(player, message);
return;
}
}
else
player.sendMessage("§cYou need to be OP to use this command.§r");
}
private static void DoPlayerInfo(Player player, String[] args)
{ //2015.08.09.
//args[0] is "admin" - args[1] is "playerinfo"
if(args.length==2)
{
String message="§cUsage: /u admin playerinfo <player>§r";
SendMessage(player, message);
return;
}
if(!MaybeOfflinePlayer.AllPlayers.containsKey(args[2]))
{
String message="§cPlayer not found: "+args[2]+"§r";
SendMessage(player, message);
return;
}
MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(args[2]);
SendMessage(player, "Player name: "+p.PlayerName);
SendMessage(player, "User flair: "+p.Flair);
SendMessage(player, "Username: "+p.UserName);
SendMessage(player, "Flair accepted: "+p.AcceptedFlair);
SendMessage(player, "Flair ignored: "+p.IgnoredFlair);
}
private static void SendMessage(Player player, String message)
{ //2015.08.09.
if(player==null)
System.out.println(message);
else
player.sendMessage(message);
}
private static void DoGetLastError(Player player, String[] args)
{ //2015.08.09.
//args[0] is "admin" - args[1] is "getlasterror"
if(PluginMain.LastException!=null)
{
SendMessage(player, "Last error:");
SendMessage(player, PluginMain.LastException.toString());
PluginMain.LastException=null;
}
else
SendMessage(player, "There were no exceptions.");
}
private static void SetPlayerFlair(Player player, MaybeOfflinePlayer targetplayer, String flair)
{ //2015.08.09.
flair=flair.replace('&', '§');
targetplayer.Flair=flair;
if(!PluginMain.RemoveLineFromFile("customflairs.txt", targetplayer.PlayerName))
{
SendMessage(player, "§cError removing previous custom flair!§r");
return;
}
File file=new File("customflairs.txt");
try {
BufferedWriter bw;
bw = new BufferedWriter(new FileWriter(file, true));
bw.write(targetplayer.PlayerName+"\n");
bw.close();
} catch (IOException e) {
System.out.println("Error!\n"+e);
PluginMain.LastException=e; //2015.08.09.
}
SendMessage(player, "§6The flair has been set. Player: "+targetplayer.PlayerName+" Flair: "+flair+"§r");
}
private static void DoSetFlair(Player player, String[] args)
{
//args[0] is "admin" - args[1] is "setflair"
if(args.length<4)
{
SendMessage(player, "§cUsage: /u admin setflair <playername> <flair>");
return;
}
SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]);
}
private static void DoUpdatePlugin(Player player)
{ //2015.08.10.
SendMessage(player, "Updating Auto-Flair plugin...");
System.out.println("Forced updating of Auto-Flair plugin...");
String URL="https://github.com/NorbiPeti/thebuttonautoflairmc/raw/master/TheButtonAutoFlair.jar";
FileUtils.copyURLToFile(URL, File)
}
}

View file

@ -240,14 +240,14 @@
<tags>org.eclipse.e4.primaryDataStack</tags> <tags>org.eclipse.e4.primaryDataStack</tags>
<tags>EditorStack</tags> <tags>EditorStack</tags>
<children xsi:type="basic:Part" xmi:id="__kGwMD-LEeWprK50eVwiGQ" elementId="org.eclipse.e4.ui.compatibility.editor" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor" label="PluginMain.java" iconURI="platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/jcu_obj.gif" tooltip="TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java" closeable="true"> <children xsi:type="basic:Part" xmi:id="__kGwMD-LEeWprK50eVwiGQ" elementId="org.eclipse.e4.ui.compatibility.editor" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor" label="PluginMain.java" iconURI="platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/jcu_obj.gif" tooltip="TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java" closeable="true">
<persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.jdt.ui.CompilationUnitEditor&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;12375&quot; selectionTopPixel=&quot;5250&quot;/>&#xD;&#xA;&lt;/editor>"/> <persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.jdt.ui.CompilationUnitEditor&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;2735&quot; selectionTopPixel=&quot;795&quot;/>&#xD;&#xA;&lt;/editor>"/>
<tags>Editor</tags> <tags>Editor</tags>
<tags>org.eclipse.jdt.ui.CompilationUnitEditor</tags> <tags>org.eclipse.jdt.ui.CompilationUnitEditor</tags>
<tags>removeOnHide</tags> <tags>removeOnHide</tags>
<tags>activeOnClose</tags> <tags>activeOnClose</tags>
</children> </children>
<children xsi:type="basic:Part" xmi:id="_h4cFECuhEeWsptewEJl0pA" elementId="org.eclipse.e4.ui.compatibility.editor" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor" label="Commands.java" iconURI="platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/jcu_obj.gif" tooltip="TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java" closeable="true"> <children xsi:type="basic:Part" xmi:id="_h4cFECuhEeWsptewEJl0pA" elementId="org.eclipse.e4.ui.compatibility.editor" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor" label="Commands.java" iconURI="platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/jcu_obj.gif" tooltip="TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java" closeable="true">
<persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.jdt.ui.CompilationUnitEditor&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;9113&quot; selectionTopPixel=&quot;3290&quot;/>&#xD;&#xA;&lt;/editor>"/> <persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.jdt.ui.CompilationUnitEditor&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;5018&quot; selectionTopPixel=&quot;1550&quot;/>&#xD;&#xA;&lt;/editor>"/>
<tags>Editor</tags> <tags>Editor</tags>
<tags>org.eclipse.jdt.ui.CompilationUnitEditor</tags> <tags>org.eclipse.jdt.ui.CompilationUnitEditor</tags>
<tags>removeOnHide</tags> <tags>removeOnHide</tags>
@ -324,7 +324,7 @@
<tags>categoryTag:General</tags> <tags>categoryTag:General</tags>
</sharedElements> </sharedElements>
<sharedElements xsi:type="basic:Part" xmi:id="_77aAUCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.views.ProblemView" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" label="Problems" iconURI="platform:/plugin/org.eclipse.ui.ide/icons/full/eview16/problems_view.gif" tooltip="0 errors, 1 warning, 0 others" closeable="true"> <sharedElements xsi:type="basic:Part" xmi:id="_77aAUCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.views.ProblemView" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" label="Problems" iconURI="platform:/plugin/org.eclipse.ui.ide/icons/full/eview16/problems_view.gif" tooltip="0 errors, 1 warning, 0 others" closeable="true">
<persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;view PRIMARY_SORT_FIELD=&quot;org.eclipse.ui.ide.severityAndDescriptionField&quot; categoryGroup=&quot;org.eclipse.ui.ide.severity&quot; markerContentGenerator=&quot;org.eclipse.ui.ide.problemsGenerator&quot; partName=&quot;Problems&quot;>&#xD;&#xA;&lt;expanded>&#xD;&#xA;&lt;category IMemento.internal.id=&quot;Errors&quot;/>&#xD;&#xA;&lt;category IMemento.internal.id=&quot;Warnings&quot;/>&#xD;&#xA;&lt;category IMemento.internal.id=&quot;Warnings (2 items)&quot;/>&#xD;&#xA;&lt;/expanded>&#xD;&#xA;&lt;columnWidths org.eclipse.ui.ide.locationField=&quot;90&quot; org.eclipse.ui.ide.markerType=&quot;90&quot; org.eclipse.ui.ide.pathField=&quot;120&quot; org.eclipse.ui.ide.resourceField=&quot;90&quot; org.eclipse.ui.ide.severityAndDescriptionField=&quot;300&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.severityAndDescriptionField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.resourceField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.pathField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.locationField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.markerType&quot;/>&#xD;&#xA;&lt;/view>"/> <persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;view PRIMARY_SORT_FIELD=&quot;org.eclipse.ui.ide.severityAndDescriptionField&quot; categoryGroup=&quot;org.eclipse.ui.ide.severity&quot; markerContentGenerator=&quot;org.eclipse.ui.ide.problemsGenerator&quot; partName=&quot;Problems&quot;>&#xD;&#xA;&lt;expanded>&#xD;&#xA;&lt;category IMemento.internal.id=&quot;Warnings (1 item)&quot;/>&#xD;&#xA;&lt;/expanded>&#xD;&#xA;&lt;columnWidths org.eclipse.ui.ide.locationField=&quot;90&quot; org.eclipse.ui.ide.markerType=&quot;90&quot; org.eclipse.ui.ide.pathField=&quot;120&quot; org.eclipse.ui.ide.resourceField=&quot;90&quot; org.eclipse.ui.ide.severityAndDescriptionField=&quot;300&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.severityAndDescriptionField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.resourceField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.pathField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.locationField&quot;/>&#xD;&#xA;&lt;visible IMemento.internal.id=&quot;org.eclipse.ui.ide.markerType&quot;/>&#xD;&#xA;&lt;/view>"/>
<tags>View</tags> <tags>View</tags>
<tags>categoryTag:General</tags> <tags>categoryTag:General</tags>
<menus xmi:id="_dGEOYCr1EeWsptewEJl0pA" elementId="org.eclipse.ui.views.ProblemView"> <menus xmi:id="_dGEOYCr1EeWsptewEJl0pA" elementId="org.eclipse.ui.views.ProblemView">
@ -426,18 +426,18 @@
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_6K2osCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.file"> <children xsi:type="menu:ToolBar" xmi:id="_6K2osCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.file">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq8lwEJtEeWE1OT9z6GGpw" elementId="new.group"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WII8YEKCEeWF1ofaHUCi8Q" elementId="new.group"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9M0EJtEeWE1OT9z6GGpw" elementId="newWizardDropDown"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIJjcEKCEeWF1ofaHUCi8Q" elementId="newWizardDropDown"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9M0UJtEeWE1OT9z6GGpw" elementId="new.ext" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIJjcUKCEeWF1ofaHUCi8Q" elementId="new.ext" visible="false"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9M0kJtEeWE1OT9z6GGpw" elementId="save.group" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIJjckKCEeWF1ofaHUCi8Q" elementId="save.group" visible="false"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9z4EJtEeWE1OT9z6GGpw" elementId="save"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIKKgEKCEeWF1ofaHUCi8Q" elementId="save"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9z4UJtEeWE1OT9z6GGpw" elementId="saveAll"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIKKgUKCEeWF1ofaHUCi8Q" elementId="saveAll"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_aq9z4kJtEeWE1OT9z6GGpw" elementId="save.ext" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIKKgkKCEeWF1ofaHUCi8Q" elementId="save.ext" visible="false"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_aq-a8EJtEeWE1OT9z6GGpw" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/print_edit.gif" tooltip="Print" command="_3_hZmSr0EeWsptewEJl0pA"/> <children xsi:type="menu:HandledToolItem" xmi:id="_WIKxkEKCEeWF1ofaHUCi8Q" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/print_edit.gif" tooltip="Print" command="_3_hZmSr0EeWsptewEJl0pA"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFIoEJtEeWE1OT9z6GGpw" elementId="print.ext" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIPDAEKCEeWF1ofaHUCi8Q" elementId="print.ext" visible="false"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFIoUJtEeWE1OT9z6GGpw" elementId="build.group"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIPqEEKCEeWF1ofaHUCi8Q" elementId="build.group"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFIokJtEeWE1OT9z6GGpw" elementId="build.ext" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIPqEUKCEeWF1ofaHUCi8Q" elementId="build.ext" visible="false"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFvsEJtEeWE1OT9z6GGpw" elementId="additions"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIPqEkKCEeWF1ofaHUCi8Q" elementId="additions"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_6K2osSr0EeWsptewEJl0pA" elementId="additions" toBeRendered="false"> <children xsi:type="menu:ToolBar" xmi:id="_6K2osSr0EeWsptewEJl0pA" elementId="additions" toBeRendered="false">
<tags>toolbarSeparator</tags> <tags>toolbarSeparator</tags>
@ -445,38 +445,38 @@
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_dIOxkCr1EeWsptewEJl0pA" elementId="adt.actionSet.avdManager"> <children xsi:type="menu:ToolBar" xmi:id="_dIOxkCr1EeWsptewEJl0pA" elementId="adt.actionSet.avdManager">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awQjkEJtEeWE1OT9z6GGpw" elementId="android_project"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRJHYEKCEeWF1ofaHUCi8Q" elementId="android_project"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awQjkUJtEeWE1OT9z6GGpw" elementId="com.android.ide.eclipse.adt.ui.sdkmanager"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRJucEKCEeWF1ofaHUCi8Q" elementId="com.android.ide.eclipse.adt.ui.sdkmanager"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awQjkkJtEeWE1OT9z6GGpw" elementId="com.android.ide.eclipse.adt.ui.avdmanager"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRJucUKCEeWF1ofaHUCi8Q" elementId="com.android.ide.eclipse.adt.ui.avdmanager"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_Mv4F0C3kEeWvSKv3oe_gqg" elementId="org.eclipse.debug.ui.breakpointActionSet"> <children xsi:type="menu:ToolBar" xmi:id="_Mv4F0C3kEeWvSKv3oe_gqg" elementId="org.eclipse.debug.ui.breakpointActionSet">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awRxsEJtEeWE1OT9z6GGpw" elementId="breakpointGroup"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVgEKCEeWF1ofaHUCi8Q" elementId="breakpointGroup"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awSYwEJtEeWE1OT9z6GGpw" elementId="org.eclipse.debug.ui.actions.SkipAllBreakpoints"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVgUKCEeWF1ofaHUCi8Q" elementId="org.eclipse.debug.ui.actions.SkipAllBreakpoints"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_dI4R0Cr1EeWsptewEJl0pA" elementId="adt.actionSet.lint"> <children xsi:type="menu:ToolBar" xmi:id="_dI4R0Cr1EeWsptewEJl0pA" elementId="adt.actionSet.lint">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awSYwUJtEeWE1OT9z6GGpw" elementId="android_project"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVgkKCEeWF1ofaHUCi8Q" elementId="android_project"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awSYwkJtEeWE1OT9z6GGpw" elementId="com.android.ide.eclipse.adt.ui.lintrunner"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVg0KCEeWF1ofaHUCi8Q" elementId="com.android.ide.eclipse.adt.ui.lintrunner"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_dIyyQCr1EeWsptewEJl0pA" elementId="adt.actionSet.wizards"> <children xsi:type="menu:ToolBar" xmi:id="_dIyyQCr1EeWsptewEJl0pA" elementId="adt.actionSet.wizards">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awS_0EJtEeWE1OT9z6GGpw" elementId="android_project"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVhEKCEeWF1ofaHUCi8Q" elementId="android_project"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awS_0UJtEeWE1OT9z6GGpw" elementId="com.android.ide.eclipse.adt.wizards.actions.NewXmlFileAction"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRKVhUKCEeWF1ofaHUCi8Q" elementId="com.android.ide.eclipse.adt.wizards.actions.NewXmlFileAction"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_8zAWsCr0EeWsptewEJl0pA" elementId="org.eclipse.debug.ui.launchActionSet"> <children xsi:type="menu:ToolBar" xmi:id="_8zAWsCr0EeWsptewEJl0pA" elementId="org.eclipse.debug.ui.launchActionSet">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awS_0kJtEeWE1OT9z6GGpw" elementId="debug"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRK8kEKCEeWF1ofaHUCi8Q" elementId="debug"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awUN8EJtEeWE1OT9z6GGpw" elementId="org.eclipse.debug.internal.ui.actions.DebugDropDownAction"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRK8kUKCEeWF1ofaHUCi8Q" elementId="org.eclipse.debug.internal.ui.actions.DebugDropDownAction"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awYfYEJtEeWE1OT9z6GGpw" elementId="org.eclipse.debug.internal.ui.actions.RunDropDownAction"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRK8kkKCEeWF1ofaHUCi8Q" elementId="org.eclipse.debug.internal.ui.actions.RunDropDownAction"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awYfYUJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.externaltools.ExternalToolMenuDelegateToolbar"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRLjoEKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.externaltools.ExternalToolMenuDelegateToolbar"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_dG7xECr1EeWsptewEJl0pA" elementId="org.eclipse.jdt.ui.JavaElementCreationActionSet"> <children xsi:type="menu:ToolBar" xmi:id="_dG7xECr1EeWsptewEJl0pA" elementId="org.eclipse.jdt.ui.JavaElementCreationActionSet">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awZGcEJtEeWE1OT9z6GGpw" elementId="JavaWizards"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRLjoUKCEeWF1ofaHUCi8Q" elementId="JavaWizards"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awZtgEJtEeWE1OT9z6GGpw" elementId="org.eclipse.jdt.ui.actions.OpenProjectWizard"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRLjokKCEeWF1ofaHUCi8Q" elementId="org.eclipse.jdt.ui.actions.OpenProjectWizard"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awZtgUJtEeWE1OT9z6GGpw" elementId="org.eclipse.jdt.ui.actions.OpenPackageWizard"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRLjo0KCEeWF1ofaHUCi8Q" elementId="org.eclipse.jdt.ui.actions.OpenPackageWizard"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awZtgkJtEeWE1OT9z6GGpw" elementId="org.eclipse.jdt.ui.actions.NewTypeDropDown"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMKsEKCEeWF1ofaHUCi8Q" elementId="org.eclipse.jdt.ui.actions.NewTypeDropDown"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_8voSkCr0EeWsptewEJl0pA" elementId="org.eclipse.jst.j2ee.J2eeMainActionSet" visible="false"> <children xsi:type="menu:ToolBar" xmi:id="_8voSkCr0EeWsptewEJl0pA" elementId="org.eclipse.jst.j2ee.J2eeMainActionSet" visible="false">
<tags>Draggable</tags> <tags>Draggable</tags>
@ -486,20 +486,20 @@
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_8xJVgCr0EeWsptewEJl0pA" elementId="org.eclipse.search.searchActionSet"> <children xsi:type="menu:ToolBar" xmi:id="_8xJVgCr0EeWsptewEJl0pA" elementId="org.eclipse.search.searchActionSet">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUkEJtEeWE1OT9z6GGpw" elementId="Search"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMKsUKCEeWF1ofaHUCi8Q" elementId="Search"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUkUJtEeWE1OT9z6GGpw" elementId="openType"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMKskKCEeWF1ofaHUCi8Q" elementId="openType"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUkkJtEeWE1OT9z6GGpw" elementId="org.eclipse.mylyn.tasks.ui.openTask"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMKs0KCEeWF1ofaHUCi8Q" elementId="org.eclipse.mylyn.tasks.ui.openTask"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUk0JtEeWE1OT9z6GGpw" elementId="org.eclipse.search.OpenSearchDialogPage"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMKtEKCEeWF1ofaHUCi8Q" elementId="org.eclipse.search.OpenSearchDialogPage"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_Slo_UC3kEeWvSKv3oe_gqg" elementId="org.eclipse.ui.edit.text.actionSet.presentation"> <children xsi:type="menu:ToolBar" xmi:id="_Slo_UC3kEeWvSKv3oe_gqg" elementId="org.eclipse.ui.edit.text.actionSet.presentation">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR0l0EJtEeWE1OT9z6GGpw" elementId="Presentation"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4iE0EKCEeWF1ofaHUCi8Q" elementId="Presentation"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR1M4EJtEeWE1OT9z6GGpw" elementId="org.eclipse.jdt.ui.edit.text.java.toggleBreadcrumb"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4ir4EKCEeWF1ofaHUCi8Q" elementId="org.eclipse.jdt.ui.edit.text.java.toggleBreadcrumb"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR2bAEJtEeWE1OT9z6GGpw" elementId="org.eclipse.jdt.ui.edit.text.java.toggleMarkOccurrences"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4ir4UKCEeWF1ofaHUCi8Q" elementId="org.eclipse.jdt.ui.edit.text.java.toggleMarkOccurrences"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR3CEEJtEeWE1OT9z6GGpw" elementId="org.eclipse.mylyn.java.ui.editor.folding.auto"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4jS8EKCEeWF1ofaHUCi8Q" elementId="org.eclipse.mylyn.java.ui.editor.folding.auto"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR3CEUJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.toggleBlockSelectionMode"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4jS8UKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.toggleBlockSelectionMode"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR3CEkJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4jS8kKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_eR3CE0JtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_Z4jS80KCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_8wdZACr0EeWsptewEJl0pA" elementId="org.eclipse.wst.server.ui.internal.webbrowser.actionSet" visible="false"> <children xsi:type="menu:ToolBar" xmi:id="_8wdZACr0EeWsptewEJl0pA" elementId="org.eclipse.wst.server.ui.internal.webbrowser.actionSet" visible="false">
<tags>Draggable</tags> <tags>Draggable</tags>
@ -517,15 +517,15 @@
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_6LTUoCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.navigate"> <children xsi:type="menu:ToolBar" xmi:id="_6LTUoCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.navigate">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFvsUJtEeWE1OT9z6GGpw" elementId="history.group"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIQRIEKCEeWF1ofaHUCi8Q" elementId="history.group"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFvskJtEeWE1OT9z6GGpw" elementId="group.application" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIQRIUKCEeWF1ofaHUCi8Q" elementId="group.application" visible="false"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arFvs0JtEeWE1OT9z6GGpw" elementId="backardHistory"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIQRIkKCEeWF1ofaHUCi8Q" elementId="backardHistory"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arGWwEJtEeWE1OT9z6GGpw" elementId="forwardHistory"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIQ4MEKCEeWF1ofaHUCi8Q" elementId="forwardHistory"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arGWwUJtEeWE1OT9z6GGpw" elementId="pin.group"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIQ4MUKCEeWF1ofaHUCi8Q" elementId="pin.group"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_arG90EJtEeWE1OT9z6GGpw" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/pin_editor.gif" tooltip="Pin the current editor" enabled="false" command="_3_eWRCr0EeWsptewEJl0pA"/> <children xsi:type="menu:HandledToolItem" xmi:id="_WIRfQEKCEeWF1ofaHUCi8Q" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/pin_editor.gif" tooltip="Pin the current editor" enabled="false" command="_3_eWRCr0EeWsptewEJl0pA"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUlEJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.gotoNextAnnotation"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMxwEKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.gotoNextAnnotation"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awaUlUJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.gotoPreviousAnnotation"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMxwUKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.gotoPreviousAnnotation"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_awa7oEJtEeWE1OT9z6GGpw" elementId="org.eclipse.ui.edit.text.gotoLastEditPosition"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WRMxwkKCEeWF1ofaHUCi8Q" elementId="org.eclipse.ui.edit.text.gotoLastEditPosition"/>
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_6LTUoSr0EeWsptewEJl0pA" elementId="group.editor" toBeRendered="false"> <children xsi:type="menu:ToolBar" xmi:id="_6LTUoSr0EeWsptewEJl0pA" elementId="group.editor" toBeRendered="false">
<tags>toolbarSeparator</tags> <tags>toolbarSeparator</tags>
@ -537,8 +537,8 @@
</children> </children>
<children xsi:type="menu:ToolBar" xmi:id="_6LT7sCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.help" visible="false"> <children xsi:type="menu:ToolBar" xmi:id="_6LT7sCr0EeWsptewEJl0pA" elementId="org.eclipse.ui.workbench.help" visible="false">
<tags>Draggable</tags> <tags>Draggable</tags>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arHk4EJtEeWE1OT9z6GGpw" elementId="group.help"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WISGUEKCEeWF1ofaHUCi8Q" elementId="group.help"/>
<children xsi:type="menu:OpaqueToolItem" xmi:id="_arHk4UJtEeWE1OT9z6GGpw" elementId="group.application" visible="false"/> <children xsi:type="menu:OpaqueToolItem" xmi:id="_WIStYEKCEeWF1ofaHUCi8Q" elementId="group.application" visible="false"/>
</children> </children>
<children xsi:type="menu:ToolControl" xmi:id="_61nc8Cr0EeWsptewEJl0pA" elementId="PerspectiveSpacer" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl"> <children xsi:type="menu:ToolControl" xmi:id="_61nc8Cr0EeWsptewEJl0pA" elementId="PerspectiveSpacer" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl">
<tags>stretch</tags> <tags>stretch</tags>

View file

@ -1,11 +1,11 @@
INDEX VERSION 1.126+D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\.metadata\.plugins\org.eclipse.jdt.core INDEX VERSION 1.126+D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spigot plugin\.metadata\.plugins\org.eclipse.jdt.core
3656756579.index 3045053200.index
3089967703.index 3089967703.index
2674037006.index 2674037006.index
323251068.index 323251068.index
355369697.index 355369697.index
1934142626.index
3716007315.index 3716007315.index
1934142626.index
1045485630.index 1045485630.index
605290374.index 605290374.index
533208796.index 533208796.index
@ -23,4 +23,4 @@ INDEX VERSION 1.126+D:\Z - Norbi cucca\0 Projektek\TheButtonMCAutoFlairProto\Spi
994834796.index 994834796.index
3604769962.index 3604769962.index
1508644233.index 1508644233.index
3045053200.index 3656756579.index

View file

@ -16,4 +16,5 @@
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439375909808_13" label="Window Working Set" name="Aggregate for window 1439375909807"/> <workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439375909808_13" label="Window Working Set" name="Aggregate for window 1439375909807"/>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439547362478_14" label="Window Working Set" name="Aggregate for window 1439547362478"/> <workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439547362478_14" label="Window Working Set" name="Aggregate for window 1439547362478"/>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439556351031_15" label="Window Working Set" name="Aggregate for window 1439556351031"/> <workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439556351031_15" label="Window Working Set" name="Aggregate for window 1439556351031"/>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1439798561527_16" label="Window Working Set" name="Aggregate for window 1439798561526"/>
</workingSetManager> </workingSetManager>

View file

@ -1,7 +1,7 @@
name: TheButtonAutoFlair name: TheButtonMCPlugin
main: tk.sznp.thebuttonautoflair.PluginMain main: tk.sznp.thebuttonautoflair.PluginMain
version: 1.0 version: 2.0
commands: commands:
u: u:
description: Auto-flair system. Accept or ignore flair. description: Auto-flair system and others, like name mentioning
usage: "&cUsage: /u accept|ignore|opme&r" usage: "&cUsage: /u accept|ignore|opme&r"

View file

@ -256,7 +256,7 @@ public class Commands implements CommandExecutor {
try { try {
BufferedWriter bw; BufferedWriter bw;
bw = new BufferedWriter(new FileWriter(file, true)); bw = new BufferedWriter(new FileWriter(file, true));
bw.write(targetplayer.PlayerName+targetplayer.Flair+"\n"); bw.write(targetplayer.PlayerName+" "+targetplayer.Flair+"\n");
bw.close(); bw.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Error!\n"+e); System.out.println("Error!\n"+e);
@ -272,6 +272,11 @@ public class Commands implements CommandExecutor {
SendMessage(player, "§cUsage: /u admin setflair <playername> <flair>"); SendMessage(player, "§cUsage: /u admin setflair <playername> <flair>");
return; return;
} }
if(args[3].charAt(0)!='&')
{
SendMessage(player, "§cYou need to start the flair with a color code: &6(19s)&r");
return;
}
SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]); SetPlayerFlair(player, MaybeOfflinePlayer.AddPlayerIfNeeded(args[2]), args[3]);
} }
private static void DoUpdatePlugin(Player player) private static void DoUpdatePlugin(Player player)

View file

@ -44,14 +44,17 @@ public class PlayerListener implements Listener
String message=event.getMessage(); //2015.08.08. String message=event.getMessage(); //2015.08.08.
for(Player p : PluginMain.GetPlayers()) for(Player p : PluginMain.GetPlayers())
{ //2015.08.12. { //2015.08.12.
String color=""; //2015.08.17.
if(message.contains(p.getName())) if(message.contains(p.getName()))
{ {
if(NotificationSound==null) if(NotificationSound==null)
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1.0f, 0.5f); //2015.08.12. p.playSound(p.getLocation(), Sound.ORB_PICKUP, 1.0f, 0.5f); //2015.08.12.
else else
p.playSound(p.getLocation(), NotificationSound, 1.0f, NotificationPitch); //2015.08.14. p.playSound(p.getLocation(), NotificationSound, 1.0f, NotificationPitch); //2015.08.14.
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p.getName()); //2015.08.17.
color=mp.Flair.substring(0, 2);
} }
message = message.replaceAll(p.getName(), "§6"+p.getName()+"§r"); message = message.replaceAll(p.getName(), color+p.getName()+"§r");
} }
event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08. event.setFormat(event.getFormat().substring(0, event.getFormat().indexOf(">"))+flair+"> "+message); //2015.08.08.
} }
@ -61,17 +64,11 @@ public class PlayerListener implements Listener
public static void sendRawMessage(Player player, String message) public static void sendRawMessage(Player player, String message)
{ {
try { try {
System.out.println("1");
Object handle = Reflection.getHandle(player); Object handle = Reflection.getHandle(player);
System.out.println("2");
Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle); Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle);
System.out.println("3");
Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message); Object serialized = Reflection.getMethod(nmsChatSerializer, "a", String.class).invoke(null, message);
System.out.println("4");
Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized); Object packet = nmsPacketPlayOutChat.getConstructor(Reflection.getNMSClass("IChatBaseComponent")).newInstance(serialized);
System.out.println("5");
Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet); Reflection.getMethod(connection.getClass(), "sendPacket").invoke(connection, packet);
System.out.println("6");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
PluginMain.LastException=e; //2015.08.09. PluginMain.LastException=e; //2015.08.09.

View file

@ -440,8 +440,7 @@ public class PluginMain extends JavaPlugin
while((currentLine = reader.readLine()) != null) { while((currentLine = reader.readLine()) != null) {
// trim newline when comparing with lineToRemove // trim newline when comparing with lineToRemove
String trimmedLine = currentLine.trim(); String trimmedLine = currentLine.trim();
//if(trimmedLine.equals(lineToRemove)) continue; if(trimmedLine.split(" ")[0].equals(lineToRemove)) continue; //2015.08.17.
if(trimmedLine.contains(lineToRemove)) continue; //2015.08.09.
writer.write(currentLine + System.getProperty("line.separator")); writer.write(currentLine + System.getProperty("line.separator"));
} }
writer.close(); writer.close();