mirror of
https://github.com/essentials/Essentials.git
synced 2025-01-18 13:56:29 +01:00
Cleanup
This commit is contained in:
parent
bf03c6c8a1
commit
aaf5c334b7
@ -70,15 +70,17 @@ public class Commandmail extends EssentialsCommand
|
||||
}
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
@Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception {
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel+" read"));
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " read"));
|
||||
}
|
||||
else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel+" clear"));
|
||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " clear"));
|
||||
}
|
||||
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
@ -99,9 +101,10 @@ public class Commandmail extends EssentialsCommand
|
||||
u.addMail("Server: " + getFinalArg(args, 2));
|
||||
sender.sendMessage(Util.i18n("mailSent"));
|
||||
return;
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{ //allow sending from console without "send" argument, since it's the only thing the console can do
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
//allow sending from console without "send" argument, since it's the only thing the console can do
|
||||
Player player = server.getPlayer(args[0]);
|
||||
User u;
|
||||
if (player != null)
|
||||
|
@ -14,9 +14,10 @@ public class Commandrealname extends EssentialsCommand
|
||||
{
|
||||
super("realname");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception {
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
|
@ -43,35 +43,37 @@ public class Commandweather extends EssentialsCommand
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception {
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2) //running from console means inserting a world arg before other args
|
||||
{
|
||||
throw new Exception("When running from console, usage is: /"+commandLabel+" <world> <storm/sun> [duration]");
|
||||
throw new Exception("When running from console, usage is: /" + commandLabel + " <world> <storm/sun> [duration]");
|
||||
}
|
||||
|
||||
boolean isStorm = args[1].equalsIgnoreCase("storm");
|
||||
World world = server.getWorld(args[0]);
|
||||
if (world == null)
|
||||
{
|
||||
throw new Exception("World named "+args[0]+" not found!");
|
||||
throw new Exception("World named " + args[0] + " not found!");
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
||||
world.setStorm(isStorm ? true : false);
|
||||
world.setWeatherDuration(Integer.parseInt(args[1]) * 20);
|
||||
world.setWeatherDuration(Integer.parseInt(args[2]) * 20);
|
||||
sender.sendMessage(isStorm
|
||||
? Util.format("weatherStormFor", world.getName(), args[1])
|
||||
: Util.format("weatherSunFor", world.getName(), args[1]));
|
||||
? Util.format("weatherStormFor", world.getName(), args[2])
|
||||
: Util.format("weatherSunFor", world.getName(), args[2]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
world.setStorm(isStorm ? true : false);
|
||||
sender.sendMessage(isStorm
|
||||
? Util.format("weatherStorm", world.getName())
|
||||
: Util.format("weatherSun", world.getName()));
|
||||
? Util.format("weatherStorm", world.getName())
|
||||
: Util.format("weatherSun", world.getName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class Commandworth extends EssentialsCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
amount = 64;
|
||||
amount = is.getType().getMaxStackSize();
|
||||
}
|
||||
|
||||
is.setAmount(amount);
|
||||
@ -58,14 +58,16 @@ public class Commandworth extends EssentialsCommand
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
}
|
||||
|
||||
@Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception {
|
||||
|
||||
@Override
|
||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ItemStack is = ess.getItemDb().get(args[0]);// = user.getInventory().getItemInHand();
|
||||
|
||||
ItemStack is = ess.getItemDb().get(args[0]);
|
||||
int amount = is.getAmount();
|
||||
|
||||
try
|
||||
@ -77,7 +79,7 @@ public class Commandworth extends EssentialsCommand
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
amount = 64;
|
||||
amount = is.getType().getMaxStackSize();
|
||||
}
|
||||
|
||||
is.setAmount(amount);
|
||||
@ -88,17 +90,17 @@ public class Commandworth extends EssentialsCommand
|
||||
}
|
||||
|
||||
sender.sendMessage(is.getDurability() != 0
|
||||
? Util.format("worthMeta",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
is.getDurability(),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess))
|
||||
: Util.format("worth",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
? Util.format("worthMeta",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
is.getDurability(),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess))
|
||||
: Util.format("worth",
|
||||
is.getType().toString().toLowerCase().replace("_", ""),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user