This commit is contained in:
ZeroEpoch1969 2018-07-30 23:36:03 -07:00
parent b97fd70b83
commit 8bd8efc665
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
2 changed files with 43 additions and 18 deletions

View File

@ -1,5 +1,13 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />

View File

@ -1,22 +1,22 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <set <tag..> | off | clear <player> | clearall>")
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> [-s[ave]] <set <tag..> | off | clear <player> | clearall>")
public class Command_tag extends FreedomCommand
{
@ -26,8 +26,16 @@ public class Command_tag extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean save = false;
if (args[0].equals("-s") || args[0].equals("-save"))
{
save = true;
args = ArrayUtils.remove(args, 0);
}
if (args.length == 1)
{
if ("list".equalsIgnoreCase(args[0]))
{
msg("Tags for all online players:");
@ -77,8 +85,11 @@ public class Command_tag extends FreedomCommand
else
{
plugin.pl.getPlayer(playerSender).setTag(null);
if (save)
{
save(playerSender, null);
msg("Your tag has been removed.");
}
msg("Your tag has been removed." + (save ? " (Saved)" : ""));
}
return true;
@ -107,8 +118,11 @@ public class Command_tag extends FreedomCommand
}
plugin.pl.getPlayer(player).setTag(null);
if (save)
{
save(player, null);
msg("Removed " + player.getName() + "'s tag.");
}
msg("Removed " + player.getName() + "'s tag." + (save ? " (Saved)" : ""));
return true;
}
@ -147,8 +161,11 @@ public class Command_tag extends FreedomCommand
}
plugin.pl.getPlayer(playerSender).setTag(outputTag);
save(playerSender, strippedTag);
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'.");
if (save)
{
save(playerSender, null);
}
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));
return true;
}