Added support for stats with spaces in them for GiveStat.
This commit is contained in:
parent
d6ade5a15b
commit
108421164c
@ -1,10 +1,13 @@
|
||||
package mineplex.core.stats.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
@ -27,12 +30,28 @@ public class GiveStatCommand extends CommandBase<StatsManager>
|
||||
try
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(caller, args[0], true);
|
||||
|
||||
String statName = args[1];
|
||||
|
||||
for (int i = 2; i < args.length - 1; i++)
|
||||
{
|
||||
statName += " " + args[i];
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
{
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
if (uuid != null)
|
||||
{
|
||||
Plugin.incrementStat(uuid.toString(), statName, Integer.parseInt(args[args.length - 1]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.incrementStat(player, statName, Integer.parseInt(args[args.length - 1]));
|
||||
}
|
||||
|
||||
Plugin.incrementStat(player, args[1], Integer.parseInt(args[2]));
|
||||
|
||||
UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[2]) + " " + args[1]) + " to " + F.elem(player.getName()) + "."));
|
||||
UtilPlayer.message(caller, F.main("Stats", "Applied " + F.elem(Integer.parseInt(args[args.length - 1]) + " " + statName) + " to " + F.elem(player.getName()) + "."));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user