mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-21 07:32:07 +01:00
Merge branch 'master' into release
This commit is contained in:
commit
4595c15bee
@ -21,6 +21,7 @@ public final class Economy
|
||||
}
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private static IEssentials ess;
|
||||
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
|
||||
|
||||
/**
|
||||
* @param aEss the ess to set
|
||||
@ -66,6 +67,10 @@ public final class Economy
|
||||
|
||||
private static User getUserByName(String name)
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
User user;
|
||||
Player player = ess.getServer().getPlayer(name);
|
||||
if (player != null)
|
||||
@ -176,6 +181,10 @@ public final class Economy
|
||||
*/
|
||||
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
setMoney(name, ess.getSettings().getStartingBalance());
|
||||
}
|
||||
|
||||
@ -231,6 +240,10 @@ public final class Economy
|
||||
*/
|
||||
public static String format(double amount)
|
||||
{
|
||||
if (ess == null)
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
return Util.formatCurrency(amount, ess);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -13,14 +14,24 @@ public class Commandbanip extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ess.getServer().banIP(args[0]);
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
final User u = ess.getUser(args[0]);
|
||||
|
||||
if (u == null)
|
||||
{
|
||||
ess.getServer().banIP(args[0]);
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ess.getServer().banIP(u.getAddress().getAddress().getHostAddress());
|
||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
|
||||
public class Commandkill extends EssentialsCommand
|
||||
@ -23,6 +24,13 @@ public class Commandkill extends EssentialsCommand
|
||||
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(p, sender instanceof Player && ((Player)sender).getName().equals(p.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
p.setHealth(0);
|
||||
sender.sendMessage(Util.format("kill", p.getDisplayName()));
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SignTrade extends EssentialsSign
|
||||
{
|
||||
|
||||
public SignTrade()
|
||||
{
|
||||
super("Trade");
|
||||
@ -40,11 +39,11 @@ public class SignTrade extends EssentialsSign
|
||||
substractAmount(sign, 1, stored, ess);
|
||||
stored.pay(player);
|
||||
Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
throw new SignException(Util.i18n("tradeSignEmptyOwner"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -67,11 +66,22 @@ public class SignTrade extends EssentialsSign
|
||||
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|
||||
|| player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
try
|
||||
{
|
||||
final Trade stored1 = getTrade(sign, 1, true, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, true, false, ess);
|
||||
stored1.pay(player);
|
||||
stored2.pay(player);
|
||||
Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
catch (SignException e)
|
||||
{
|
||||
if (player.isAuthorized("essentials.signs.trade.override"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ public class EssentialsChat extends JavaPlugin
|
||||
chatListener = new HashMap<String, IEssentialsChatListener>();
|
||||
|
||||
final EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer(), ess, chatListener);
|
||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
|
||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.High, this);
|
||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
|
||||
|
Loading…
Reference in New Issue
Block a user