Merge branch 'master' into release

This commit is contained in:
KHobbits 2012-01-21 17:19:12 +00:00
commit efda9beece
78 changed files with 1307 additions and 690 deletions

View File

@ -71,11 +71,12 @@ file.reference.craftbukkit.jar=../lib/craftbukkit.jar
file.reference.iCo4.jar=../lib/iCo4.jar
file.reference.iCo5.jar=../lib/iCo5.jar
file.reference.iCo6.jar=../lib/iCo6.jar
file.reference.lombok-0.10.1.jar=../lib/lombok-0.10.1.jar
file.reference.lombok.jar=../lib/lombok-0.10.8.jar
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
file.reference.Permissions3.jar=../lib/Permissions3.jar
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
file.reference.Vault.jar=../lib/Vault.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
@ -90,10 +91,11 @@ javac.classpath=\
${file.reference.PermissionsEx.jar}:\
${file.reference.bPermissions.jar}:\
${file.reference.PermissionsBukkit-1.2.jar}:\
${file.reference.lombok-0.10.1.jar}:\
${file.reference.lombok.jar}:\
${reference.EssentialsGroupManager.jar}:\
${file.reference.bukkit.jar}:\
${file.reference.craftbukkit.jar}
${file.reference.craftbukkit.jar}:\
${file.reference.Vault.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -57,7 +57,9 @@ public class Enchantments
ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE);
ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE);
ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK);
ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE);
ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE);
}
public static Enchantment getByName(String name) {

View File

@ -24,7 +24,6 @@ import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import com.earth2me.essentials.craftbukkit.ItemDupeFix;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import com.earth2me.essentials.signs.SignBlockListener;
@ -45,11 +44,10 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.world.WorldListener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.InvalidDescriptionException;
@ -63,7 +61,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final int BUKKIT_VERSION = 1713;
public static final int BUKKIT_VERSION = 1791;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@ -181,14 +179,14 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.SEVERE, _("essentialsHelp1"));
}
LOGGER.log(Level.SEVERE, exception.toString());
pm.registerEvent(Type.PLAYER_JOIN, new PlayerListener()
pm.registerEvents(new Listener()
{
@Override
public void onPlayerJoin(PlayerJoinEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(final PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
}
}, Priority.Low, this);
}, this);
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials failed to load, read the log file.");
@ -200,67 +198,40 @@ public class Essentials extends JavaPlugin implements IEssentials
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
pm.registerEvents(serverListener, this);
confList.add(serverListener);
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
pm.registerEvent(Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this);
pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this);
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Low, this);
pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this);
pm.registerEvents(playerListener, this);
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
pm.registerEvents(blockListener, this);
final SignBlockListener signBlockListener = new SignBlockListener(this);
pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_PLACE, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_PISTON_EXTEND, signBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_PISTON_RETRACT, signBlockListener, Priority.Low, this);
pm.registerEvents(signBlockListener, this);
final SignPlayerListener signPlayerListener = new SignPlayerListener(this);
pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this);
pm.registerEvents(signPlayerListener, this);
final SignEntityListener signEntityListener = new SignEntityListener(this);
pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this);
pm.registerEvent(Type.ENDERMAN_PICKUP, signEntityListener, Priority.Low, this);
pm.registerEvents(signEntityListener, this);
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_COMBUST, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_DEATH, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Lowest, this);
pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this);
pm.registerEvents(entityListener, this);
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
pm.registerEvent(Type.WORLD_LOAD, worldListener, Priority.Monitor, this);
pm.registerEvent(Type.WORLD_UNLOAD, worldListener, Priority.Monitor, this);
pm.registerEvents(worldListener, this);
//TODO: Check if this should be here, and not above before reload()
jails = new Jails(this);
confList.add(jails);
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
pm.registerEvents(tntListener, this);
final EssentialsTimer timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
Economy.setEss(this);
execTimer.mark("RegListeners");
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
final String timeroutput = execTimer.end();
if (getSettings().isDebug())
{
@ -602,17 +573,17 @@ public class Essentials extends JavaPlugin implements IEssentials
return i18n;
}
private static class EssentialsWorldListener extends WorldListener implements Runnable {
private static class EssentialsWorldListener implements Listener, Runnable {
private transient final IEssentials ess;
public EssentialsWorldListener(IEssentials ess)
public EssentialsWorldListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
public void onWorldLoad(WorldLoadEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onWorldLoad(final WorldLoadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();
@ -624,8 +595,8 @@ public class Essentials extends JavaPlugin implements IEssentials
}
}
@Override
public void onWorldUnload(WorldUnloadEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onWorldUnload(final WorldUnloadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();

View File

@ -1,25 +1,24 @@
package com.earth2me.essentials;
import java.util.logging.Logger;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
public class EssentialsBlockListener extends BlockListener
public class EssentialsBlockListener implements Listener
{
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private final transient IEssentials ess;
public EssentialsBlockListener(IEssentials ess)
public EssentialsBlockListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
public void onBlockPlace(BlockPlaceEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
{

View File

@ -2,19 +2,20 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.*;
import org.bukkit.inventory.ItemStack;
public class EssentialsEntityListener extends EntityListener
public class EssentialsEntityListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final IEssentials ess;
public EssentialsEntityListener(IEssentials ess)
@ -22,7 +23,7 @@ public class EssentialsEntityListener extends EntityListener
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
@ -55,7 +56,8 @@ public class EssentialsEntityListener extends EntityListener
{
User player = ess.getUser(eAttack);
ItemStack hand = player.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET) {
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
@ -73,7 +75,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityCombust(EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@ -82,7 +84,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDeath(final EntityDeathEvent event)
{
if (event instanceof PlayerDeathEvent)
@ -101,7 +103,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onFoodLevelChange(FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@ -110,7 +112,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityRegainHealth(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player

View File

@ -1,7 +1,6 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.craftbukkit.SetBed;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
@ -17,15 +16,17 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener extends PlayerListener
public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient Server server;
@ -37,7 +38,7 @@ public class EssentialsPlayerListener extends PlayerListener
this.server = parent.getServer();
}
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -48,7 +49,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -74,7 +75,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerMove(final PlayerMoveEvent event)
{
if (event.isCancelled())
@ -108,7 +109,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -125,7 +126,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.dispose();
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
ess.getBackup().onPlayerJoin();
@ -178,12 +179,11 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerLogin(final PlayerLoginEvent event)
{
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
{
LOGGER.log(Level.INFO, "Disconnecting user " + event.getPlayer().toString() + " due to " + event.getResult().toString());
return;
}
User user = ess.getUser(event.getPlayer());
@ -225,8 +225,8 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
public void onPlayerTeleport(PlayerTeleportEvent event)
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
@ -247,19 +247,19 @@ public class EssentialsPlayerListener extends PlayerListener
updateCompass(user);
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
{
final User user = ess.getUser(event.getPlayer());
final ItemStack is = new ItemStack(Material.EGG, 1);
if (user.hasUnlimited(is))
final ItemStack stack = new ItemStack(Material.EGG, 1);
if (user.hasUnlimited(stack))
{
user.getInventory().addItem(is);
user.getInventory().addItem(stack);
user.updateInventory();
}
}
@Override
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -277,7 +277,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerAnimation(final PlayerAnimationEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -322,7 +322,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
{
if (event.isCancelled())
@ -349,7 +349,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
{
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
@ -362,7 +362,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled())
@ -376,11 +376,11 @@ public class EssentialsPlayerListener extends PlayerListener
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
SetBed.setBed(event.getPlayer(), event.getClickedBlock());
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())

View File

@ -1,34 +1,34 @@
package com.earth2me.essentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
public class EssentialsPluginListener extends ServerListener implements IConf
public class EssentialsPluginListener implements Listener, IConf
{
private final transient IEssentials ess;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
public EssentialsPluginListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(final PluginEnableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
{
LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
}
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(final PluginDisableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
@ -37,7 +37,7 @@ public class EssentialsPluginListener extends ServerListener implements IConf
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
{
ess.getPaymentMethod().reset();
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
ess.getLogger().log(Level.INFO, "Payment method was disabled. No longer accepting payments.");
}
}

View File

@ -1,11 +1,12 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.EventPriority;
public interface ISettings extends IConf
@ -22,7 +23,7 @@ public interface ISettings extends IConf
long getBackupInterval();
String getChatFormat(String group);
MessageFormat getChatFormat(String group);
int getChatRadius();
@ -148,9 +149,9 @@ public interface ISettings extends IConf
boolean registerBackInListener();
public boolean getDisableItemPickupWhileAfk();
boolean getDisableItemPickupWhileAfk();
public Priority getRespawnPriority();
EventPriority getRespawnPriority();
long getTpaAcceptCancellation();
}

View File

@ -3,10 +3,7 @@ package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
@ -739,12 +736,6 @@ public class OfflinePlayer implements Player
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getBedSpawnLocation()
{
return OfflineBedLocation.getBedLocation(base.getName(), ess);
}
@Override
public boolean isSprinting()
{
@ -825,8 +816,45 @@ public class OfflinePlayer implements Player
void setName(final String name)
{
if (!this.base.getName().equalsIgnoreCase(name)) {
if (!this.base.getName().equalsIgnoreCase(name))
{
this.base = ess.getServer().getOfflinePlayer(name);
}
}
@Override
public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> getListeningPluginChannels()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setAllowFlight(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean getAllowFlight()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setBedSpawnLocation(Location lctn)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void playEffect(EntityEffect ee)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -3,11 +3,12 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.io.File;
import java.text.MessageFormat;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
@ -291,12 +292,27 @@ public class Settings implements ISettings
{
return config.getString("backup.command", null);
}
private Map<String, MessageFormat> chatFormats = new HashMap<String, MessageFormat>();
@Override
public String getChatFormat(String group)
public MessageFormat getChatFormat(String group)
{
return config.getString("chat.group-formats." + (group == null ? "Default" : group),
MessageFormat mFormat = chatFormats.get(group);
if (mFormat == null)
{
String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
format = Util.replaceColor(format);
format = format.replace("{DISPLAYNAME}", "%1$s");
format = format.replace("{GROUP}", "{0}");
format = format.replace("{MESSAGE}", "%2$s");
format = format.replace("{WORLDNAME}", "{1}");
format = format.replace("{SHORTWORLDNAME}", "{2}");
format = format.replaceAll("\\{(\\D*)\\}", "\\[$1\\]");
mFormat = new MessageFormat(format);
chatFormats.put(group, mFormat);
}
return mFormat;
}
@Override
@ -340,6 +356,7 @@ public class Settings implements ISettings
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
chatFormats.clear();
}
@Override
@ -581,30 +598,30 @@ public class Settings implements ISettings
}
@Override
public Priority getRespawnPriority()
public EventPriority getRespawnPriority()
{
String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH);
if ("lowest".equals(priority))
{
return Priority.Lowest;
return EventPriority.LOWEST;
}
if ("low".equals(priority))
{
return Priority.Low;
return EventPriority.LOW;
}
if ("normal".equals(priority))
{
return Priority.Normal;
return EventPriority.NORMAL;
}
if ("high".equals(priority))
{
return Priority.High;
return EventPriority.HIGH;
}
if ("highest".equals(priority))
{
return Priority.Highest;
return EventPriority.HIGHEST;
}
return Priority.Normal;
return EventPriority.NORMAL;
}
@Override

View File

@ -2,11 +2,13 @@ package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.FakeExplosion;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
public class TNTExplodeListener extends EntityListener implements Runnable
public class TNTExplodeListener implements Listener, Runnable
{
private final transient IEssentials ess;
private transient boolean enabled = false;
@ -33,7 +35,7 @@ public class TNTExplodeListener extends EntityListener implements Runnable
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
if (!enabled)

View File

@ -478,7 +478,8 @@ public class Util
}
return buf.toString();
}
private static transient final Pattern COLOR_PATTERN = Pattern.compile("(?i)\u00A7[0-9A-F]");
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-FKa-fk]");
private static transient final Pattern EASY_COLOR_PATTERN = Pattern.compile("&([0-9a-fk])");
public static String stripColor(final String input)
{
@ -487,6 +488,16 @@ public class Util
return null;
}
return COLOR_PATTERN.matcher(input).replaceAll("");
return VANILLA_COLOR_PATTERN.matcher(input).replaceAll("");
}
public static String replaceColor(final String input)
{
if (input == null)
{
return null;
}
return EASY_COLOR_PATTERN.matcher(input).replaceAll("\u00a7$1");
}
}

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@ -22,7 +23,7 @@ public class Commandhelpop extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String message = _("helpOp", user.getDisplayName(), getFinalArg(args, 0));
final String message = _("helpOp", user.getDisplayName(), Util.stripColor(getFinalArg(args, 0)));
logger.log(Level.INFO, message);
for (Player onlinePlayer : server.getOnlinePlayers())
{

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Server;
@ -58,7 +59,7 @@ public class Commandmail extends EssentialsCommand
}
if (!u.isIgnoredPlayer(user.getName()))
{
u.addMail(user.getName() + ": " + getFinalArg(args, 2));
u.addMail(user.getName() + ": " + Util.stripColor(getFinalArg(args, 2)));
}
user.sendMessage(_("mailSent"));
return;
@ -69,7 +70,7 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(_("noPerm","essentials.mail.sendall"));
}
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + getFinalArg(args, 1)));
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
user.sendMessage(_("mailSent"));
return;
}

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
@ -28,8 +29,12 @@ public class Commandme extends EssentialsCommand
String message = getFinalArg(args, 0);
if (user.isAuthorized("essentials.chat.color"))
{
message = message.replaceAll("&([0-9a-f])", "§$1");
message = Util.replaceColor(message);
}
else {
message = Util.stripColor(message);
}
ess.broadcastMessage(user, _("action", user.getDisplayName(), message));
}

View File

@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -25,6 +26,7 @@ public class Commandmsg extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
String message = getFinalArg(args, 1);
if (sender instanceof Player)
{
User user = ess.getUser(sender);
@ -32,13 +34,24 @@ public class Commandmsg extends EssentialsCommand
{
throw new Exception(_("voiceSilenced"));
}
if (user.isAuthorized("essentials.msg.color"))
{
message = Util.replaceColor(message);
}
else
{
message = Util.stripColor(message);
}
}
else
{
message = Util.replaceColor(message);
}
String message = getFinalArg(args, 1);
String translatedMe = _("me");
final String translatedMe = _("me");
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
{
@ -50,38 +63,38 @@ public class Commandmsg extends EssentialsCommand
return;
}
List<Player> matches = server.matchPlayer(args[0]);
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
if (matches.isEmpty())
if (matchedPlayers.isEmpty())
{
throw new Exception(_("playerNotFound"));
}
int i = 0;
for (Player p : matches)
for (Player matchedPlayer : matchedPlayers)
{
final User u = ess.getUser(p);
final User u = ess.getUser(matchedPlayer);
if (u.isHidden())
{
i++;
}
}
if (i == matches.size())
if (i == matchedPlayers.size())
{
throw new Exception(_("playerNotFound"));
}
for (Player p : matches)
for (Player matchedPlayer : matchedPlayers)
{
sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
final User u = ess.getUser(p);
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
final User matchedUser = ess.getUser(matchedPlayer);
if (sender instanceof Player && (matchedUser.isIgnoredPlayer(((Player)sender).getName()) || matchedUser.isHidden()))
{
continue;
}
p.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(p));
ess.getUser(p).setReplyTo(sender);
matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(matchedPlayer));
ess.getUser(matchedPlayer).setReplyTo(sender);
}
}
}

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -65,9 +66,10 @@ public class Commandnick extends EssentialsCommand
{
if (user == null || user.isAuthorized("essentials.nick.color"))
{
return nick.replace('&', '\u00a7').replace("\u00a7\u00a7", "&");
return nick.replace('&', '\u00a7').replaceAll("\u00a7+k", "");
} else {
return Util.stripColor(nick);
}
return nick;
}
private void resetAllNicknames(final Server server)
@ -86,7 +88,7 @@ public class Commandnick extends EssentialsCommand
private void setNickname(final Server server, final User target, final String nick) throws Exception
{
if (nick.matches("[^a-zA-Z_0-9]"))
if (!nick.matches("^[a-zA-Z_0-9\u00a7]+$"))
{
throw new Exception(_("nickNamesAlpha"));
}

View File

@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -24,9 +25,31 @@ public class Commandr extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String message = getFinalArg(args, 0);
final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
String message = getFinalArg(args, 0);
IReplyTo replyTo;
String senderName;
if (sender instanceof Player)
{
User user = ess.getUser(sender);
if (user.isAuthorized("essentials.msg.color"))
{
message = Util.replaceColor(message);
}
else
{
message = Util.stripColor(message);
}
replyTo = user;
senderName = user.getDisplayName();
}
else
{
message = Util.replaceColor(message);
replyTo = Console.getConsoleReplyTo();
senderName = Console.NAME;
}
final CommandSender target = replyTo.getReplyTo();
final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME;

View File

@ -1,7 +1,9 @@
package com.earth2me.essentials.craftbukkit;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.*;
import org.bukkit.block.Biome;
@ -10,6 +12,7 @@ import org.bukkit.entity.*;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
@ -521,4 +524,28 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... types)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public WorldType getWorldType()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> getListeningPluginChannels()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,25 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import net.minecraft.server.EntityPlayer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerTeleportEvent;
public class ItemDupeFix extends PlayerListener
{
@Override
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
return;
}
final CraftPlayer player = (CraftPlayer)event.getPlayer();
final EntityPlayer entity = player.getHandle();
if (entity.activeContainer != entity.defaultContainer)
{
entity.closeInventory();
}
}
}

View File

@ -1,25 +0,0 @@
package com.earth2me.essentials.craftbukkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.ChunkCoordinates;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class SetBed
{
public static void setBed(final Player player, final Block block)
{
try
{
final CraftPlayer cplayer = (CraftPlayer)player;
cplayer.getHandle().a(new ChunkCoordinates(block.getX(), block.getY(), block.getZ()));
}
catch (Throwable ex)
{
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
}

View File

@ -7,23 +7,23 @@ import org.bukkit.plugin.PluginManager;
/**
* The <code>Methods</code> initializes Methods that utilize the Method interface
* based on a "first come, first served" basis.
* The
* <code>Methods</code> initializes Methods that utilize the Method interface based on a "first come, first served"
* basis.
*
* Allowing you to check whether a payment method exists or not.
*
* Methods also allows you to set a preferred method of payment before it captures
* payment plugins in the initialization process.
* Methods also allows you to set a preferred method of payment before it captures payment plugins in the initialization
* process.
*
* in <code>bukkit.yml</code>:
* <blockquote><pre>
* in
* <code>bukkit.yml</code>: <blockquote><pre>
* economy:
* preferred: "iConomy"
* </pre></blockquote>
*
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
* @copyright: Copyright (C) 2011
* @license: AOL license <http://aol.nexua.org>
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license
* <http://aol.nexua.org>
*/
public class Methods
{
@ -52,6 +52,7 @@ public class Methods
addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
addMethod("Currency", new com.earth2me.essentials.register.payment.methods.MCUR());
Dependencies.add("MultiCurrency");
addMethod("Vault", new com.earth2me.essentials.register.payment.methods.VaultEco());
}
/**
@ -78,6 +79,7 @@ public class Methods
/**
* Use to get version of Register plugin
*
* @return version
*/
public static String getVersion()
@ -86,10 +88,11 @@ public class Methods
}
/**
* Returns an array of payment method names that have been loaded
* through the <code>_init</code> method.
* Returns an array of payment method names that have been loaded through the
* <code>_init</code> method.
*
* @return <code>Set<String></code> - Array of payment methods that are loaded.
* @return
* <code>Set<String></code> - Array of payment methods that are loaded.
* @see #setMethod(org.bukkit.plugin.Plugin)
*/
public static Set<String> getDependencies()
@ -98,8 +101,8 @@ public class Methods
}
/**
* Interprets Plugin class data to verify whether it is compatible with an existing payment
* method to use for payments and other various economic activity.
* Interprets Plugin class data to verify whether it is compatible with an existing payment method to use for
* payments and other various economic activity.
*
* @param plugin Plugin data from bukkit, Internal Class file.
* @return Method <em>or</em> Null
@ -127,7 +130,8 @@ public class Methods
/**
* Verifies if Register has set a payment method for usage yet.
*
* @return <code>boolean</code>
* @return
* <code>boolean</code>
* @see #setMethod(org.bukkit.plugin.Plugin)
* @see #checkDisabled(org.bukkit.plugin.Plugin)
*/
@ -137,11 +141,11 @@ public class Methods
}
/**
* Checks Plugin Class against a multitude of checks to verify it's usability
* as a payment method.
* Checks Plugin Class against a multitude of checks to verify it's usability as a payment method.
*
* @param <code>PluginManager</code> the plugin manager for the server
* @return <code>boolean</code> True on success, False on failure.
* @return
* <code>boolean</code> True on success, False on failure.
*/
public static boolean setMethod(PluginManager manager)
{
@ -242,7 +246,8 @@ public class Methods
/**
* Sets the preferred economy
*
* @return <code>boolean</code>
* @return
* <code>boolean</code>
*/
public static boolean setPreferred(String check)
{
@ -258,7 +263,9 @@ public class Methods
/**
* Grab the existing and initialized (hopefully) Method Class.
*
* @return <code>Method</code> <em>or</em> <code>Null</code>
* @return
* <code>Method</code> <em>or</em>
* <code>Null</code>
*/
public static Method getMethod()
{
@ -266,11 +273,11 @@ public class Methods
}
/**
* Verify is a plugin is disabled, only does this if we there is an existing payment
* method initialized in Register.
* Verify is a plugin is disabled, only does this if we there is an existing payment method initialized in Register.
*
* @param method Plugin data from bukkit, Internal Class file.
* @return <code>boolean</code>
* @return
* <code>boolean</code>
*/
public static boolean checkDisabled(Plugin method)
{

View File

@ -0,0 +1,339 @@
package com.earth2me.essentials.register.payment.methods;
import net.milkbowl.vault.Vault;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.earth2me.essentials.register.payment.Method;
public class VaultEco implements Method
{
private Vault vault;
private Economy economy;
@Override
public Vault getPlugin()
{
return this.vault;
}
@Override
public boolean createAccount(String name, Double amount)
{
if (hasAccount(name))
{
return false;
}
return false;
}
@Override
public String getName()
{
return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName());
}
@Override
public String getVersion()
{
return this.vault.getDescription().getVersion();
}
@Override
public int fractionalDigits()
{
return 0;
}
@Override
public String format(double amount)
{
return this.economy.format(amount);
}
@Override
public boolean hasBanks()
{
return this.economy.hasBankSupport();
}
@Override
public boolean hasBank(String bank)
{
return this.economy.getBanks().contains(bank);
}
@Override
public boolean hasAccount(String name)
{
return this.economy.hasAccount(name);
}
@Override
public boolean hasBankAccount(String bank, String name)
{
return this.economy.isBankOwner(bank, name).transactionSuccess()
|| this.economy.isBankMember(bank, name).transactionSuccess();
}
@Override
public boolean createAccount(String name)
{
return this.economy.createBank(name, "").transactionSuccess();
}
public boolean createAccount(String name, double balance)
{
if (!this.economy.createBank(name, "").transactionSuccess())
{
return false;
}
return this.economy.bankDeposit(name, balance).transactionSuccess();
}
@Override
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))
{
return null;
}
return new VaultAccount(name, this.economy);
}
@Override
public MethodBankAccount getBankAccount(String bank, String name)
{
if (!hasBankAccount(bank, name))
{
return null;
}
return new VaultBankAccount(bank, economy);
}
@Override
public boolean isCompatible(Plugin plugin)
{
try
{
RegisteredServiceProvider<Economy> ecoPlugin = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
return plugin instanceof Vault && ecoPlugin != null && !ecoPlugin.getProvider().getName().equals("Essentials Economy");
}
catch (LinkageError e)
{
return false;
}
catch (Exception e)
{
return false;
}
}
@Override
public void setPlugin(Plugin plugin)
{
this.vault = (Vault)plugin;
RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null)
{
this.economy = economyProvider.getProvider();
}
}
public class VaultAccount implements MethodAccount
{
private final String name;
private final Economy economy;
public VaultAccount(String name, Economy economy)
{
this.name = name;
this.economy = economy;
}
@Override
public double balance()
{
return this.economy.getBalance(this.name);
}
@Override
public boolean set(double amount)
{
if (!this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess())
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.depositPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean add(double amount)
{
return this.economy.depositPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean subtract(double amount)
{
return this.economy.withdrawPlayer(this.name, amount).transactionSuccess();
}
@Override
public boolean multiply(double amount)
{
double balance = this.balance();
return this.set(balance * amount);
}
@Override
public boolean divide(double amount)
{
double balance = this.balance();
return this.set(balance / amount);
}
@Override
public boolean hasEnough(double amount)
{
return (this.balance() >= amount);
}
@Override
public boolean hasOver(double amount)
{
return (this.balance() > amount);
}
@Override
public boolean hasUnder(double amount)
{
return (this.balance() < amount);
}
@Override
public boolean isNegative()
{
return (this.balance() < 0);
}
@Override
public boolean remove()
{
return this.set(0.0);
}
}
public class VaultBankAccount implements MethodBankAccount
{
private final String bank;
private final Economy economy;
public VaultBankAccount(String bank, Economy economy)
{
this.bank = bank;
this.economy = economy;
}
@Override
public String getBankName()
{
return this.bank;
}
@Override
public int getBankId()
{
return -1;
}
@Override
public double balance()
{
return this.economy.bankBalance(this.bank).balance;
}
@Override
public boolean set(double amount)
{
if (!this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess())
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
}
@Override
public boolean add(double amount)
{
return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
}
@Override
public boolean subtract(double amount)
{
return this.economy.bankWithdraw(this.bank, amount).transactionSuccess();
}
@Override
public boolean multiply(double amount)
{
double balance = this.balance();
return this.set(balance * amount);
}
@Override
public boolean divide(double amount)
{
double balance = this.balance();
return this.set(balance / amount);
}
@Override
public boolean hasEnough(double amount)
{
return (this.balance() >= amount);
}
@Override
public boolean hasOver(double amount)
{
return (this.balance() > amount);
}
@Override
public boolean hasUnder(double amount)
{
return (this.balance() < amount);
}
@Override
public boolean isNegative()
{
return (this.balance() < 0);
}
@Override
public boolean remove()
{
return this.set(0.0);
}
}
}

View File

@ -8,10 +8,13 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
public class SignBlockListener extends BlockListener
public class SignBlockListener implements Listener
{
private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
@ -21,7 +24,7 @@ public class SignBlockListener extends BlockListener
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@ -73,7 +76,7 @@ public class SignBlockListener extends BlockListener
return false;
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onSignChange(final SignChangeEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@ -105,7 +108,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@ -139,7 +142,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockBurn(final BlockBurnEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@ -168,7 +171,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockIgnite(final BlockIgniteEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@ -197,7 +200,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPistonExtend(final BlockPistonExtendEvent event)
{
for (Block block : event.getBlocks())
@ -223,7 +226,7 @@ public class SignBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onBlockPistonRetract(final BlockPistonRetractEvent event)
{
if (event.isSticky())

View File

@ -3,12 +3,14 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EndermanPickupEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
public class SignEntityListener extends EntityListener
public class SignEntityListener implements Listener
{
private final transient IEssentials ess;
@ -17,7 +19,7 @@ public class SignEntityListener extends EntityListener
this.ess = ess;
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
for (Block block : event.blockList())
@ -42,8 +44,8 @@ public class SignEntityListener extends EntityListener
}
}
@Override
public void onEndermanPickup(EndermanPickupEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onEndermanPickup(final EndermanPickupEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{

View File

@ -4,22 +4,24 @@ import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
public class SignPlayerListener extends PlayerListener
public class SignPlayerListener implements Listener
{
private final transient IEssentials ess;
public SignPlayerListener(IEssentials ess)
public SignPlayerListener(final IEssentials ess)
{
this.ess = ess;
}
@Override
public void onPlayerInteract(PlayerInteractEvent event)
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77You can talk again
cantFindGeoIpDB=Can''t find GeoIP database!
cantReadGeoIpDB=Failed to read GeoIP database!
cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Command {0} failed:
commandHelpFailedForPlugin=Error getting help for: {0}
commandNotLoaded=\u00a7cCommand {0} is improperly loaded.
@ -169,7 +171,6 @@ listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Failed to load warp {0}
loadinfo=Loaded {0} build {1} by: {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cTo mark your mail as read, type /mail clear
mailCleared=\u00a77Mail Cleared!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request.
requestDenied=\u00a77Teleport request denied.
requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error occurred when trying to return player to jail.
second=second
@ -322,6 +324,7 @@ teleportDisabled={0} has teleportation disabled.
teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them.
teleportNewPlayerError=Failed to teleport new player
teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleporting to top.
teleportationCommencing=\u00a77Teleportation commencing...
teleportationDisabled=\u00a77Teleportation disabled.
@ -402,5 +405,3 @@ year=year
years=years
youAreHealed=\u00a77You have been healed.
youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77Du kan nu snakke igen.
cantFindGeoIpDB=Kan ikke finde GeoIP database!
cantReadGeoIpDB=Fejl ved afl\u00e6sning af GeoIP database!
cantSpawnItem=\u00a7cDu har ikke tilladelse til at skabe tingen.{0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Kommandoen {0} fejlede:
commandHelpFailedForPlugin=Fejl ved hentning af hj\u00e6lp til: {0}
commandNotLoaded=\u00a7cKommando {0} er ikke indl\u00e6st korrekt.
@ -169,7 +171,6 @@ listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spi
listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online.
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0}
loadinfo=Loadede {0} build {1} af {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cFor at markere din flaskepost som l\u00e6st, skriv /mail clear
mailCleared=\u00a77Flaskepot ryddet!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} accepterede din anmodning om teleport.
requestDenied=\u00a77Anmodning om teleport afvist.
requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport.
requestSent=\u00a77Anmodning sendt til {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel.
second=sekund
@ -322,6 +324,7 @@ teleportDisabled={0} har ikke teleportation aktiveret.
teleportHereRequest=\u00a7c{0}\u00a7c har anmodet om, at du teleporterer dig til ham/hende.
teleportNewPlayerError=Fejlede ved teleportering af ny spiller
teleportRequest=\u00a7c{0}\u00a7c har anmodet om at teleportere til dig.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleporterer til toppen.
teleportationCommencing=\u00a77Teleport begynder...
teleportationDisabled=\u00a77Teleport deaktiveret.
@ -402,5 +405,3 @@ year=\u00e5r
years=\u00e5r
youAreHealed=\u00a77Du er blevet healed. Halleluja!
youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77Du kannst wieder sprechen.
cantFindGeoIpDB=Kann GeoIP-Datenbank nicht finden!
cantReadGeoIpDB=Fehler beim Einlesen der GeoIP-Datenbank!
cantSpawnItem=\u00a7cDu darfst {0} nicht erzeugen.
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Befehl {0} scheiterte:
commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0}
commandNotLoaded=\u00a7cBefehl {0} ist nicht richtig geladen.
@ -169,7 +171,6 @@ listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spie
listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online.
listHiddenTag = \u00a77[Versteckt]\u00a7f
loadWarpError=Fehler beim Laden von Warp-Punkt {0}
loadinfo=Plugin {0} Version {1} geladen, erstellt von {2}, \u00fcbersetzt von snowleo
localFormat=Lokal: <{0}> {1}
mailClear=\u00a7cUm deine Nachrichten zu l\u00f6schen, schreibe /mail clear
mailCleared=\u00a77Nachrichten gel\u00f6scht!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} hat deine Teleportierungsanfrage angenommen.
requestDenied=\u00a77Teleportierungsanfrage verweigert.
requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt.
requestSent=\u00a77Anfrage gesendet an {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren.
second=Sekunde
@ -322,6 +324,7 @@ teleportDisabled={0} verweigert die Teleportierung.
teleportHereRequest=\u00a7c{0}\u00a7c fragt, ob du dich zu ihm teleportierst.
teleportNewPlayerError=Fehler beim Teleportieren eines neuen Spielers
teleportRequest=\u00a7c{0}\u00a7c fragt, ob er sich zu dir teleportieren darf.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleportiere nach oben.
teleportationCommencing=\u00a77Teleportierung gestartet...
teleportationDisabled=\u00a77Teleportierung deaktiviert.
@ -402,5 +405,3 @@ year=Jahr
years=Jahre
youAreHealed=\u00a77Du wurdest geheilt.
youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77You can talk again
cantFindGeoIpDB=Can''t find GeoIP database!
cantReadGeoIpDB=Failed to read GeoIP database!
cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Command {0} failed:
commandHelpFailedForPlugin=Error getting help for: {0}
commandNotLoaded=\u00a7cCommand {0} is improperly loaded.
@ -169,7 +171,6 @@ listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Failed to load warp {0}
loadinfo=Loaded {0} build {1} by: {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cTo mark your mail as read, type /mail clear
mailCleared=\u00a77Mail Cleared!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request.
requestDenied=\u00a77Teleport request denied.
requestDeniedFrom=\u00a77{0} denied your teleport request
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error occurred when trying to return player to jail.
second=second
@ -322,6 +324,7 @@ teleportDisabled={0} has teleportation disabled.
teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them.
teleportNewPlayerError=Failed to teleport new player
teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teleporting to top.
teleportationCommencing=\u00a77Teleportation commencing...
teleportationDisabled=\u00a77Teleportation disabled.
@ -402,5 +405,3 @@ year=year
years=years
youAreHealed=\u00a77You have been healed.
youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77Ya puedes hablar de nuevo
cantFindGeoIpDB=No se puede encontrar la bases de datos del Geo IP
cantReadGeoIpDB=Error al intentar leer la base de datos del Geo IP
cantSpawnItem=\u00a7cNo tienes acceso para producir este objeto {0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Command {0} fallado:
commandHelpFailedForPlugin=Error obteniendo ayuda para: {0}
commandNotLoaded=\u00a7cCommand {0} esta cargado incorrectamente.
@ -169,7 +171,6 @@ listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Error al cargar el tenetransporte {0}
loadinfo=Cargado {0}, construido {1} por: {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cPara marcar tu email como leido, escribe /mail clear
mailCleared=\u00a77Email limpiado!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} acepto tu peticion de teletransporte.
requestDenied=\u00a77Peticion de teletransporte denegada.
requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte.
requestSent=\u00a77Peticion enviada a {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Error al intentar quitar al jugador de la carcel.
second=segundo
@ -322,6 +324,7 @@ teleportDisabled={0} tiene desactivado los teletransportes.
teleportHereRequest=\u00a7c{0}\u00a7c ha pedido que te teletransportes con el.
teleportNewPlayerError=Error al teletransportar al nuevo jugador
teleportRequest=\u00a7c{0}\u00a7c te ha pedido teletransportarse contigo.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Teletransportandote a la cima.
teleportationCommencing=\u00a77Comenzando teletransporte...
teleportationDisabled=\u00a77Teletransporte desactivado.
@ -402,5 +405,3 @@ year=a&ntilde;o
years=a&ntilde;os
youAreHealed=\u00a77Has sido curado.
youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77Vous pouvez de nouveau parler.
cantFindGeoIpDB=N''arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP!
cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP!
cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00c3\u00aetre {0}
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=\u00c9chec de la commande {0} :
commandHelpFailedForPlugin=Erreur d''obtention d''aide pour : {0}
commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e.
@ -169,7 +171,6 @@ listAmount = \u00a79Il y a \u00a7c{0}\u00a79 joueurs en ligne sur \u00a7c{1}\u00
listAmountHidden = \u00a79Il y a \u00a7c{0}\u00a77/{1}\u00a79 sur un maximum de \u00a7c{2}\u00a79 joueurs en ligne.
listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f
loadWarpError=\u00c9chec du chargement du raccourci {0}
loadinfo={0} version {1} par {2} a \u00e9t\u00e9 charg\u00e9
localFormat=Locale :<{0}> {1}
mailClear=\u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear
mailCleared=\u00a77Courrier supprim\u00e9 !
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} a accept\u00e9 votre demande de t\u00e9l\u00e9por
requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e.
requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation.
requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur.
second=seconde
@ -322,6 +324,7 @@ teleportDisabled={0} a la t\u00e9l\u00e9portation d\u00e9sactiv\u00e9.
teleportHereRequest=\u00a7c{0}\u00a7c Vous a demand\u00e9 de vous t\u00e9l\u00e9porter \u00e0 lui/elle.
teleportNewPlayerError=\u00c9chec de la t\u00e9l\u00e9portation du nouveau joueur.
teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter vers vous.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77T\u00e9l\u00e9portation vers le haut.
teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation...
teleportationDisabled=\u00a77T\u00e9l\u00e9poration d\u00e9sactiv\u00e9.
@ -402,5 +405,3 @@ year=ann\u00e9e
years=ann\u00e9es
youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9.
youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -33,6 +33,8 @@ canTalkAgain=\u00a77Je kan weer praten.
cantFindGeoIpDB=De GeoIP database kon niet gevonden worden!
cantReadGeoIpDB=Fout bij het lezen van de GeoIP database!
cantSpawnItem=\u00a7cJe bent niet bevoegd om {0} te spawnen.
chatTypeLocal=[L]
chatTypeSpy=[Spy]
commandFailed=Opdracht {0} mislukt:
commandHelpFailedForPlugin=Fout bij het \u200b\u200bkrijgen van hulp voor: {0}
commandNotLoaded=\u00a7cOpdracht {0} is fout geladen.
@ -169,7 +171,6 @@ listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
listHiddenTag = \u00a77[HIDDEN]\u00a7f
loadWarpError=Fout bij het laden van warp {0}
loadinfo=Build {1} geladen {0} van {2}
localFormat=Local: <{0}> {1}
mailClear=\u00a7cType /mail clear, om ej berichten als gelezen te markeren.
mailCleared=\u00a77Bericht geklaard!
@ -291,6 +292,7 @@ requestAcceptedFrom=\u00a77{0} accepted your teleport request.
requestDenied=\u00a77Teleporteer aanvraag geweigerd.
requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis.
second=seconde
@ -322,6 +324,7 @@ teleportDisabled={0} heeft teleporteren uit gezet.
teleportHereRequest=\u00a7c{0}\u00a7c Heeft gevraagd of hij/zij naar jou mag teleporteren.
teleportNewPlayerError=Fout bij het teleporteren van nieuwe speler.
teleportRequest=\u00a7c{0}\u00a7c vraagt of hij jou kan teleporteren.
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.
teleportTop=\u00a77Bezig met teleporteren naar de top.
teleportationCommencing=\u00a77Aan het beginnen met teleporteren...
teleportationDisabled=\u00a77Teleportatie uitgeschakeld.
@ -402,5 +405,3 @@ year=jaar
years=jaren
youAreHealed=\u00a77Je bent genezen.
youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken.
requestTimedOut=\u00a7cTeleport request has timed out
teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds.

View File

@ -19,6 +19,7 @@ import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scheduler.BukkitWorker;
@ -549,6 +550,12 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getBedSpawnLocation()
{
throw new UnsupportedOperationException("Not supported yet.");
}
};
}
@ -623,4 +630,22 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Messenger getMessenger()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<String> getListeningPluginChannels()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,51 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
public class ChatStore
{
private final User user;
private final String type;
private final Trade charge;
private long radius;
ChatStore(final IEssentials ess, final User user, final String type)
{
this.user = user;
this.type = type;
this.charge = new Trade(getLongType(), ess);
}
public User getUser()
{
return user;
}
public Trade getCharge()
{
return charge;
}
public String getType()
{
return type;
}
public String getLongType()
{
return type.length() > 0 ? "chat" : "chat-" + type;
}
public long getRadius()
{
return radius;
}
public void setRadius(long radius)
{
this.radius = radius;
}
}

View File

@ -19,7 +19,6 @@ public class EssentialsChat extends JavaPlugin
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient Map<String, IEssentialsChatListener> chatListener;
@Override
public void onEnable()
{
@ -36,17 +35,16 @@ public class EssentialsChat extends JavaPlugin
}
chatListener = new ConcurrentSkipListMap<String, IEssentialsChatListener>();
final Map<PlayerChatEvent, String> charges = new HashMap<PlayerChatEvent, String>();
final Map<PlayerChatEvent, ChatStore> chatStore = new HashMap<PlayerChatEvent, ChatStore>();
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener);
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, charges);
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, charges);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this);
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener, chatStore);
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, chatStore);
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, chatStore);
pluginManager.registerEvents(playerListenerLowest, this);
pluginManager.registerEvents(playerListenerNormal, this);
pluginManager.registerEvents(playerListenerHighest, this);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@Override

View File

@ -10,24 +10,28 @@ import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerListener;
//TODO: Translate the local/spy tags
public abstract class EssentialsChatPlayer extends PlayerListener
public abstract class EssentialsChatPlayer implements Listener
{
protected transient IEssentials ess;
protected final static Logger logger = Logger.getLogger("Minecraft");
protected final transient Map<String, IEssentialsChatListener> listeners;
protected final transient Server server;
protected final transient Map<PlayerChatEvent, ChatStore> chatStorage;
public EssentialsChatPlayer(Server server, IEssentials ess, Map<String, IEssentialsChatListener> listeners)
public EssentialsChatPlayer(final Server server,
final IEssentials ess,
final Map<String, IEssentialsChatListener> listeners,
final Map<PlayerChatEvent, ChatStore> chatStorage)
{
this.ess = ess;
this.listeners = listeners;
this.server = server;
this.chatStorage = chatStorage;
}
public void onPlayerChat(final PlayerChatEvent event)
@ -35,11 +39,6 @@ public abstract class EssentialsChatPlayer extends PlayerListener
}
public boolean isAborted(final PlayerChatEvent event)
{
return isAborted(event, "chat");
}
public boolean isAborted(final PlayerChatEvent event, final String command)
{
if (event.isCancelled())
{
@ -52,13 +51,6 @@ public abstract class EssentialsChatPlayer extends PlayerListener
return true;
}
}
final User user = ess.getUser(event.getPlayer());
if (!isAffordableFor(user, command))
{
event.setCancelled(true);
return true;
}
return false;
}
@ -75,64 +67,77 @@ public abstract class EssentialsChatPlayer extends PlayerListener
}
}
protected void charge(final CommandSender sender, final String command) throws ChargeException
public ChatStore getChatStore(final PlayerChatEvent event)
{
if (sender instanceof Player)
{
final Trade charge = new Trade(command, ess);
charge.charge(ess.getUser((Player)sender));
}
return chatStorage.get(event);
}
protected boolean isAffordableFor(final CommandSender sender, final String command)
public void setChatStore(final PlayerChatEvent event, final ChatStore chatStore)
{
if (sender instanceof Player)
chatStorage.put(event, chatStore);
}
public ChatStore delChatStore(final PlayerChatEvent event)
{
return chatStorage.remove(event);
}
protected void charge(final User user, final Trade charge) throws ChargeException
{
charge.charge(user);
}
protected boolean charge(final PlayerChatEvent event, final ChatStore chatStore)
{
try
{
final Trade charge = new Trade(command, ess);
charge.isAffordableFor(ess.getUser((Player)sender));
charge(chatStore.getUser(), chatStore.getCharge());
}
catch (ChargeException e)
{
ess.showError(chatStore.getUser(), e, chatStore.getLongType());
event.setCancelled(true);
return false;
}
}
else
{
return false;
}
return true;
}
protected void sendLocalChat(final User sender, final long radius, final PlayerChatEvent event)
protected void sendLocalChat(final PlayerChatEvent event, final ChatStore chatStore)
{
event.setCancelled(true);
final User sender = chatStore.getUser();
logger.info(_("localFormat", sender.getName(), event.getMessage()));
final Location loc = sender.getLocation();
final World world = loc.getWorld();
if (charge(event, chatStore) == false)
{
return;
}
for (Player onlinePlayer : server.getOnlinePlayers())
{
String type = "[L]";
final User user = ess.getUser(onlinePlayer);
String type = _("chatTypeLocal");
final User onlineUser = ess.getUser(onlinePlayer);
//TODO: remove reference to op
if (user.isIgnoredPlayer(sender.getName()) && !sender.isOp())
if (onlineUser.isIgnoredPlayer(sender.getName()) && !sender.isOp())
{
continue;
}
if (!user.equals(sender))
if (!onlineUser.equals(sender))
{
final Location playerLoc = user.getLocation();
if (playerLoc.getWorld() != world) { continue; }
final Location playerLoc = onlineUser.getLocation();
if (playerLoc.getWorld() != world)
{
continue;
}
final double delta = playerLoc.distanceSquared(loc);
if (delta > radius)
if (delta > chatStore.getRadius())
{
if (user.isAuthorized("essentials.chat.spy"))
if (onlineUser.isAuthorized("essentials.chat.spy"))
{
type = type.concat("[Spy]");
type = type.concat(_("chatTypeSpy"));
}
else
{
@ -146,7 +151,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
{
message = listener.modifyMessage(event, onlinePlayer, message);
}
user.sendMessage(message);
onlineUser.sendMessage(message);
}
}
}

View File

@ -1,34 +1,28 @@
package com.earth2me.essentials.chat;
import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
{
private final transient Map<PlayerChatEvent, String> charges;
public EssentialsChatPlayerListenerHighest(final Server server,
final IEssentials ess,
final Map<String, IEssentialsChatListener> listeners,
final Map<PlayerChatEvent, String> charges)
final Map<PlayerChatEvent, ChatStore> chatStorage)
{
super(server, ess, listeners);
this.charges = charges;
super(server, ess, listeners, chatStorage);
}
@EventHandler(priority = EventPriority.HIGHEST)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
String charge = charges.remove(event);
if (charge == null)
{
charge = "chat";
}
final ChatStore chatStore = delChatStore(event);
if (isAborted(event))
{
return;
@ -37,17 +31,6 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
/**
* This file should handle charging the user for the action before returning control back
*/
final User user = ess.getUser(event.getPlayer());
try
{
charge(user, charge);
}
catch (ChargeException e)
{
ess.showError(user, e, charge);
event.setCancelled(true);
return;
}
charge(event, chatStore);
}
}

View File

@ -2,9 +2,12 @@ package com.earth2me.essentials.chat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
@ -12,11 +15,13 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
{
public EssentialsChatPlayerListenerLowest(final Server server,
final IEssentials ess,
final Map<String, IEssentialsChatListener> listeners)
final Map<String, IEssentialsChatListener> listeners,
final Map<PlayerChatEvent, ChatStore> chatStorage)
{
super(server, ess, listeners);
super(server, ess, listeners, chatStorage);
}
@EventHandler(priority = EventPriority.LOWEST)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
@ -25,14 +30,23 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
return;
}
final User user = ess.getUser(event.getPlayer());
final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage()));
setChatStore(event, chatStore);
/**
* This listener should apply the general chat formatting only...then return control back the event handler
*/
final User user = ess.getUser(event.getPlayer());
if (user.isAuthorized("essentials.chat.color"))
{
event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));
event.setMessage(Util.replaceColor(event.getMessage()));
}
event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase(Locale.ENGLISH)));
else
{
event.setMessage(Util.stripColor(event.getMessage()));
}
String group = user.getGroup();
String world = user.getWorld().getName();
event.setFormat(ess.getSettings().getChatFormat(group).format(new Object[] {group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH)}));
}
}

View File

@ -6,22 +6,22 @@ import com.earth2me.essentials.User;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
{
private final transient Map<PlayerChatEvent, String> charges;
public EssentialsChatPlayerListenerNormal(final Server server,
final IEssentials ess,
final Map<String, IEssentialsChatListener> listeners,
final Map<PlayerChatEvent, String> charges)
final Map<PlayerChatEvent, ChatStore> chatStorage)
{
super(server, ess, listeners);
this.charges = charges;
super(server, ess, listeners, chatStorage);
}
@EventHandler(priority = EventPriority.NORMAL)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
@ -34,46 +34,39 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
* This file should handle detection of the local chat features... if local chat is enabled, we need to handle
* it here
*/
final String chatType = getChatType(event.getMessage());
final StringBuilder command = new StringBuilder();
command.append("chat");
if (chatType.length() > 0)
{
command.append("-").append(chatType);
}
long radius = ess.getSettings().getChatRadius();
if (radius < 1)
{
return;
}
radius *= radius;
final User user = ess.getUser(event.getPlayer());
if (event.getMessage().length() > 0 && chatType.length() > 0)
final ChatStore chatStore = getChatStore(event);
final User user = chatStore.getUser();
chatStore.setRadius(radius);
if (event.getMessage().length() > 1 && chatStore.getType().length() > 0)
{
final StringBuilder permission = new StringBuilder();
permission.append("essentials.chat.").append(chatType);
final StringBuilder format = new StringBuilder();
format.append(chatType).append("Format");
final StringBuilder errorMsg = new StringBuilder();
errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1));
permission.append("essentials.chat.").append(chatStore.getType());
if (user.isAuthorized(permission.toString()))
{
final StringBuilder format = new StringBuilder();
format.append(chatStore.getType()).append("Format");
event.setMessage(event.getMessage().substring(1));
event.setFormat(_(format.toString(), event.getFormat()));
charges.put(event, command.toString());
return;
}
final StringBuilder errorMsg = new StringBuilder();
errorMsg.append("notAllowedTo").append(chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatStore.getType().substring(1));
user.sendMessage(_(errorMsg.toString()));
event.setCancelled(true);
return;
}
sendLocalChat(user, radius, event);
sendLocalChat(event, chatStore);
}
}

View File

@ -3,17 +3,12 @@ package com.earth2me.essentials.geoip;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsGeoIP extends JavaPlugin
{
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsGeoIP()
{
}
@ -30,17 +25,16 @@ public class EssentialsGeoIP extends JavaPlugin
final IEssentials ess = (IEssentials)pm.getPlugin("Essentials");
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
logger.log(Level.WARNING, _("versionMismatchAll"));
getLogger().log(Level.WARNING, _("versionMismatchAll"));
}
if (!ess.isEnabled()) {
this.setEnabled(false);
return;
}
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pm.registerEvents(playerListener, this);
logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
logger.log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.");
getLogger().log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.");
}
}

View File

@ -17,11 +17,13 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf
public class EssentialsGeoIPPlayerListener implements Listener, IConf
{
LookupService ls = null;
private static final Logger logger = Logger.getLogger("Minecraft");
@ -39,7 +41,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
reloadConfig();
}
@Override
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
User u = ess.getUser(event.getPlayer());

View File

@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="../lib/bukkit.jar"/>
<classpathentry kind="lib" path="../lib/craftbukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/EssentialsGroupManager"/>
<classpathentry kind="lib" path="../lib/Permissions3.jar"/>
<classpathentry kind="output" path="bin"/>

View File

@ -0,0 +1,25 @@
package com.nijikokun.bukkit.Permissions;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.Listener;
public class OverrideListener implements Listener {
Permissions permClass;
OverrideListener(Permissions instance) {
this.permClass = instance;
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
permClass.setGM(event.getPlugin());
}
}
}

View File

@ -4,10 +4,6 @@ import com.nijiko.permissions.PermissionHandler;
import java.util.logging.Logger;
//import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
@ -41,15 +37,7 @@ public class Permissions extends JavaPlugin {
setGM(p);
} else {
if (this.getServer() != null) {
this.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, new ServerListener() {
@Override
public void onPluginEnable(PluginEnableEvent event) {
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
Permissions.this.setGM(event.getPlugin());
}
}
}, Priority.Normal, this);
this.getServer().getPluginManager().registerEvents(new OverrideListener(this), this);
}
}
} else {
@ -62,7 +50,7 @@ public class Permissions extends JavaPlugin {
}
}
private void setGM(final Plugin p) {
public void setGM(final Plugin p) {
//GroupManager groupManager = (GroupManager) p;
((NijikoPermissionsProxy) Security).setGM(p);
}
@ -79,4 +67,9 @@ public class Permissions extends JavaPlugin {
Security = new NijikoPermissionsProxy(null);
}
}
}

View File

@ -101,3 +101,11 @@ v 1.8:
- Major, MAJOR changes to support partial/full world mirroring.
You can now mirror groups.yml, users.yml or both files between different worlds.
- Catch NullPointerErrors generated by blank permission nodes.
- Removed '- bukkit.command' form the globalgroups permission nodes.
v 1.9:
- Optimize populating Bukkit perms so we no longer calculate the child nodes (Bukkit already does this).
- Added a tidy error message for invalid permission entries in GlobalGroups.
- Better optimize assembling of a players permissions and allow the * node to populate all registered superperms.
- Fixed text when adding a subgroup to not say the player was moved.
- Update to new Bukkit Event system.
- Update GroupManagerBridge for new event system.

View File

@ -145,7 +145,6 @@ groups:
permissions:
- bukkit.broadcast
- bukkit.broadcast.admin
- bukkit.command
- bukkit.command.give
- bukkit.command.help
- bukkit.command.kill

View File

@ -125,9 +125,13 @@ public class GlobalGroups {
if (element != null)
if (element instanceof List) {
try {
for (String node : (List<String>) element) {
newGroup.addPermission(node);
}
} catch (ClassCastException e) {
throw new IllegalArgumentException("Invalid permission node for global group: " + groupName);
}
} else if (element instanceof String) {
newGroup.addPermission((String) element);
} else

View File

@ -38,8 +38,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.world.WorldListener;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
@ -82,7 +80,7 @@ public class GroupManager extends JavaPlugin {
private GMLoggerHandler ch;
public static BukkitPermissions BukkitPermissions;
private static WorldListener WorldEvents;
private static GMWorldListener WorldEvents;
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
// PERMISSIONS FOR COMMAND BEING LOADED
@ -493,7 +491,7 @@ public class GroupManager extends JavaPlugin {
}
// PARECE OK
auxUser.addSubGroup(auxGroup);
sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'.");
sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'.");
targetPlayer = this.getServer().getPlayer(auxUser.getName());
if (targetPlayer != null)

View File

@ -18,7 +18,7 @@ public class BukkitPermsUpdateTask implements Runnable {
public void run() {
// Signal loaded and update BukkitPermissions.
GroupManager.setLoaded(true);
//GroupManager.BukkitPermissions.collectPermissions();
GroupManager.BukkitPermissions.collectPermissions();
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManager.logger.info("Bukkit Permissions Updated!");

View File

@ -113,7 +113,7 @@ public class User extends DataUnit implements Cloneable {
this.group = group;
flagAsChanged();
if (GroupManager.isLoaded())
if (GroupManager.BukkitPermissions.player_join = false)
if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updateAllPlayers();
}
@ -130,7 +130,7 @@ public class User extends DataUnit implements Cloneable {
this.group = group.getName();
flagAsChanged();
if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updateAllPlayers();
// Do we notify of the group change?
@ -159,7 +159,7 @@ public class User extends DataUnit implements Cloneable {
subGroups.add(subGroup.getName());
flagAsChanged();
if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
}
@ -182,7 +182,7 @@ public class User extends DataUnit implements Cloneable {
if (subGroups.remove(subGroup.getName())) {
flagAsChanged();
if (GroupManager.isLoaded())
if (GroupManager.BukkitPermissions.player_join = false)
if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
return true;
@ -229,7 +229,7 @@ public class User extends DataUnit implements Cloneable {
}
flagAsChanged();
if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updateAllPlayers();
GroupManagerEventHandler.callEvent(this, Action.USER_INFO_CHANGED);
}

View File

@ -1,6 +1,7 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.data.Group;
import org.bukkit.event.HandlerList;
/**
@ -13,6 +14,18 @@ public class GMGroupEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -5294917600434510451L;
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
//////////////////////////////
protected Group group;

View File

@ -1,5 +1,7 @@
package org.anjocaido.groupmanager.events;
import org.bukkit.event.HandlerList;
/**
* @author ElgarL
@ -11,6 +13,19 @@ public class GMSystemEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -8786811924448821548L;
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
//////////////////////////////
protected Action action;
public GMSystemEvent(Action action) {

View File

@ -1,6 +1,7 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.data.User;
import org.bukkit.event.HandlerList;
/**
@ -13,6 +14,18 @@ public class GMUserEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -5294917600434510451L;
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
//////////////////////////////
protected User user;

View File

@ -1,9 +1,10 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.GroupManager;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldListener;
/**
@ -12,7 +13,7 @@ import org.bukkit.event.world.WorldListener;
* Handle new world creation from other plugins
*
*/
public class GMWorldListener extends WorldListener {
public class GMWorldListener implements Listener {
private final GroupManager plugin;
@ -22,10 +23,10 @@ public class GMWorldListener extends WorldListener {
}
private void registerEvents() {
plugin.getServer().getPluginManager().registerEvent(Event.Type.WORLD_INIT, this, Event.Priority.Lowest, plugin);
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
String worldName = event.getWorld().getName();

View File

@ -5,9 +5,11 @@
package org.anjocaido.groupmanager.permissions;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.Group;
@ -90,65 +92,53 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
/**
* Returns All permissions (including inheritance and sub groups) for the
* player.
* player, including child nodes from Bukkit.
*
* @param userName
* @return List<String> of all players permissions.
*/
@Override
public List<String> getAllPlayersPermissions(String userName) {
List<String> perms = new ArrayList<String>();
List<String> playerPermArray = new ArrayList<String>();
perms.addAll(getAllPlayersPermissions(userName, true));
for (String perm : ph.getUser(userName).getPermissionList()) {
if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) {
playerPermArray.add(perm);
return perms;
}
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray);
/**
* Returns All permissions (including inheritance and sub groups) for the
* player. With or without Bukkit child nodes.
*
* @param userName
* @return Set<String> of all players permissions.
*/
@Override
public Set<String> getAllPlayersPermissions(String userName, Boolean includeChildren) {
if (children != null) {
for (String child : children.keySet()) {
if (children.get(child))
if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) {
playerPermArray.add(child);
}
}
}
}
}
Set<String> playerPermArray = new HashSet<String>();
// Add the players own permissions.
playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren));
// fetch all group permissions
for (String group : getGroups(userName)) {
Set<String> groupPermArray = new HashSet<String>();
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
for (String perm : GroupManager.getGlobalGroups().getGroupsPermissions(group)) {
if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) {
playerPermArray.add(perm);
// GlobalGroups
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray);
if (children != null) {
for (String child : children.keySet()) {
if (children.get(child))
if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child)))
playerPermArray.add(child);
}
}
}
}
} else {
for (String perm : ph.getGroup(group).getPermissionList()) {
if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm))) {
// World Groups
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
}
// Add all group permissions, unless negated by direct player perms.
for (String perm : groupPermArray)
if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-" + perm)))
playerPermArray.add(perm);
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren(perm, playerPermArray);
if (children != null) {
for (String child : children.keySet()) {
if (children.get(child))
if ((!playerPermArray.contains(child)) && (!playerPermArray.contains("-" + child))) {
playerPermArray.add(child);
}
}
}
}
}
}
}
// Collections.sort(playerPermArray,
// StringPermissionComparator.getInstance());
@ -156,6 +146,55 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
return playerPermArray;
}
private Set<String> populatePerms (List<String> perms, boolean includeChildren) {
Set<String> permArray = new HashSet<String>();
for (String perm : perms) {
// Allow * node to populate ALL perms in Bukkit.
if (perm.equalsIgnoreCase("*"))
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
boolean negated = false;
if (perm.startsWith("-"))
negated = true;
if (!permArray.contains(perm)) {
permArray.add(perm);
if ((negated) && (permArray.contains(perm.substring(1))))
permArray.remove(perm.substring(1));
if (includeChildren) {
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>());
if (children != null) {
if (negated) {
// Remove children of negated nodes
for (String child : children.keySet())
if (children.get(child))
if (permArray.contains(child))
permArray.remove(child);
} else {
// Add child nodes
for (String child : children.keySet())
if (children.get(child))
if ((!permArray.contains(child)) && (!permArray.contains("-" + child)))
permArray.add(child);
}
}
}
}
}
return permArray;
}
/**
* Verify if player is in such group. It will check it's groups inheritance.
*

View File

@ -19,9 +19,11 @@ package org.anjocaido.groupmanager.permissions;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
//import org.anjocaido.groupmanager.data.User;
@ -30,17 +32,17 @@ import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
@ -61,7 +63,21 @@ public class BukkitPermissions {
protected GroupManager plugin;
protected boolean dumpAllPermissions = true;
protected boolean dumpMatchedPermissions = true;
public boolean player_join = false;
private boolean player_join = false;
/**
* @return the player_join
*/
public boolean isPlayer_join() {
return player_join;
}
/**
* @param player_join the player_join to set
*/
public void setPlayer_join(boolean player_join) {
this.player_join = player_join;
}
private static Field permissions;
@ -79,7 +95,7 @@ public class BukkitPermissions {
public BukkitPermissions(GroupManager plugin) {
this.plugin = plugin;
//this.collectPermissions();
this.collectPermissions();
this.registerEvents();
this.updateAllPlayers();
@ -89,32 +105,25 @@ public class BukkitPermissions {
private void registerEvents() {
PluginManager manager = plugin.getServer().getPluginManager();
PlayerEvents playerEventListener = new PlayerEvents();
manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin);
manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin);
manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin);
manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin);
manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin);
manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin);
ServerListener serverListener = new BukkitEvents();
manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
manager.registerEvents(new PlayerEvents(), plugin);
manager.registerEvents(new BukkitEvents(), plugin);
}
/*
public void collectPermissions() {
registeredPermissions.clear();
/*
for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) {
for (Permission permission : bukkitPlugin.getDescription().getPermissions())
registeredPermissions.push(permission);
}
}
*/
registeredPermissions = new LinkedList<Permission>(Bukkit.getPluginManager().getPermissions());
}
public void updatePermissions(Player player) {
this.updatePermissions(player, null);
}
@ -194,22 +203,24 @@ public class BukkitPermissions {
// Add all permissions for this player (GM only)
// child nodes will be calculated by Bukkit.
List<String> playerPermArray = worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName());
Set<String> playerPermArray = worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName(), false);
Map<String, Boolean> newPerms = new HashMap<String, Boolean>();
//Set<String> hash = new HashSet<String>();
//for (String permission : playerPermArray)
// hash.add(permission);
for (String permission : playerPermArray) {
value = true;
if (permission.startsWith("-")) {
permission = permission.substring(1); // cut off -
value = false;
}
value = (!permission.startsWith("-"));
/*
if (!attachment.getPermissions().containsKey(permission)) {
attachment.setPermission(permission, value);
}
*/
newPerms.put(permission, value);
newPerms.put((value? permission : permission.substring(1)), value);
}
//player.recalculatePermissions();
/**
@ -232,14 +243,46 @@ public class BukkitPermissions {
}
}
/**
* Returns a map of the ALL child permissions as defined by the supplying plugin
* Fetch all permissions which are registered with superperms.
* {can include child nodes)
*
* @param includeChildren
* @return List of all permission nodes
*/
public List<String> getAllRegisteredPermissions(boolean includeChildren) {
List<String> perms = new ArrayList<String>();
for (Permission permission : registeredPermissions) {
String name = permission.getName();
if (!perms.contains(name)) {
perms.add(name);
if (includeChildren) {
Map<String, Boolean> children = getAllChildren(name, new HashSet<String>());
if (children != null) {
for (String node : children.keySet())
if (!perms.contains(node))
perms.add(node);
}
}
}
}
return perms;
}
/**
* Returns a map of ALL child permissions registered with bukkit
* null is empty
*
* @param node
* @param playerPermArray current list of perms to check against for negations
* @return Map of child permissions
*/
public Map<String, Boolean> getAllChildren(String node, List<String> playerPermArray) {
public Map<String, Boolean> getAllChildren(String node, Set<String> playerPermArray) {
LinkedList<String> stack = new LinkedList<String>();
Map<String, Boolean> alreadyVisited = new HashMap<String, Boolean>();
@ -267,7 +310,7 @@ public class BukkitPermissions {
}
/**
* Returns a map of the child permissions (1 node deep) as defined by the supplying plugin
* Returns a map of the child permissions (1 node deep) as registered with Bukkit.
* null is empty
*
* @param node
@ -319,40 +362,40 @@ public class BukkitPermissions {
}
}
protected class PlayerEvents extends PlayerListener {
protected class PlayerEvents implements Listener {
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
player_join = true;
setPlayer_join(true);
Player player = event.getPlayer();
// force GM to create the player if they are not already listed.
if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
player_join = false;
//setPlayer_join(false);
updatePermissions(event.getPlayer());
} else
player_join = false;
}
setPlayer_join(false);
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event) {
if (!GroupManager.isLoaded())
return;
@ -360,26 +403,26 @@ public class BukkitPermissions {
attachments.remove(event.getPlayer());
}
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerKick(PlayerKickEvent event) {
attachments.remove(event.getPlayer());
}
}
protected class BukkitEvents extends ServerListener {
protected class BukkitEvents implements Listener {
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
if (!GroupManager.isLoaded())
return;
//collectPermissions();
collectPermissions();
updateAllPlayers();
}
@Override
@EventHandler(priority = EventPriority.NORMAL)
public void onPluginDisable(PluginDisableEvent event) {
// collectPermissions();
collectPermissions();
// updateAllPlayers();
}
}

View File

@ -4,6 +4,7 @@ package org.anjocaido.groupmanager.permissions;
//import java.util.Map;
//import java.util.Set;
import java.util.List;
import java.util.Set;
import org.anjocaido.groupmanager.data.Group;
//import org.anjocaido.groupmanager.data.User;
@ -234,4 +235,6 @@ public abstract class PermissionsReaderInterface {
//////////////////////////////
public abstract List<String> getAllPlayersPermissions(String userName);
public abstract Set<String> getAllPlayersPermissions(String userName, Boolean includeChildren);
}

View File

@ -1,11 +1,12 @@
name: GroupManager
version: "1.8 (Phoenix)"
version: GMBuildVer (Phoenix)
main: org.anjocaido.groupmanager.GroupManager
website: http://www.anjocaido.info/
description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule.
authors:
- AnjoCaido
- Gabriel Couto
- ElgarL
commands:
manuadd:
description: Move a player to desired group.(Adds to the file if not exists)

View File

@ -1,36 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockListener;
public class EmergencyBlockListener extends BlockListener
{
@Override
public void onBlockBurn(final BlockBurnEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockIgnite(final BlockIgniteEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockFromTo(final BlockFromToEvent event)
{
event.setCancelled(true);
}
@Override
public void onBlockBreak(final BlockBreakEvent event)
{
event.setCancelled(true);
}
}

View File

@ -1,22 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
public class EmergencyEntityListener extends EntityListener
{
@Override
public void onEntityExplode(final EntityExplodeEvent event)
{
event.setCancelled(true);
}
@Override
public void onEntityDamage(final EntityDamageEvent event)
{
event.setCancelled(true);
}
}

View File

@ -0,0 +1,58 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
public class EmergencyListener implements Listener
{
@EventHandler(priority = EventPriority.LOW)
public void onBlockBurn(final BlockBurnEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void onBlockIgnite(final BlockIgniteEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void onBlockFromTo(final BlockFromToEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void onBlockBreak(final BlockBreakEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(final PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
}
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void onEntityDamage(final EntityDamageEvent event)
{
event.setCancelled(true);
}
}

View File

@ -1,16 +0,0 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
public class EmergencyPlayerListener extends PlayerListener
{
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
}
}

View File

@ -32,8 +32,6 @@ public class EssentialsConnect
ProtectReloader pr = new ProtectReloader();
pr.reloadConfig();
ess.addReloadListener(pr);
LOGGER.info(_("loadinfo", essProtect.getDescription().getName(), essProtect.getDescription().getVersion(), "essentials team"));
}
public void onDisable()

View File

@ -9,8 +9,6 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -51,43 +49,22 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
ess = new EssentialsConnect(essPlugin, this);
final EssentialsProtectPlayerListener playerListener = new EssentialsProtectPlayerListener(this);
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, this);
pm.registerEvents(playerListener, this);
final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_FROMTO, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_PISTON_EXTEND, blockListener, Priority.Highest, this);
pm.registerEvent(Type.BLOCK_PISTON_RETRACT, blockListener, Priority.Highest, this);
pm.registerEvents(blockListener, this);
final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this);
pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this);
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
pm.registerEvent(Type.CREATURE_SPAWN, entityListener, Priority.Highest, this);
pm.registerEvent(Type.ENTITY_TARGET, entityListener, Priority.Highest, this);
pm.registerEvent(Type.EXPLOSION_PRIME, entityListener, Priority.Highest, this);
pm.registerEvent(Type.ENDERMAN_PICKUP, entityListener, Priority.Highest, this);
pm.registerEvents(entityListener, this);
final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this);
pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this);
pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this);
pm.registerEvents(weatherListener, this);
}
private void enableEmergencyMode(final PluginManager pm)
{
final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
final EmergencyListener emListener = new EmergencyListener();
pm.registerEvents(emListener, this);
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");

View File

@ -9,10 +9,13 @@ import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
public class EssentialsProtectBlockListener extends BlockListener
public class EssentialsProtectBlockListener implements Listener
{
final private transient IProtect prot;
final private transient IEssentials ess;
@ -23,7 +26,7 @@ public class EssentialsProtectBlockListener extends BlockListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
@ -93,7 +96,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockIgnite(BlockIgniteEvent event)
{
if (event.isCancelled())
@ -144,7 +147,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockFromTo(final BlockFromToEvent event)
{
if (event.isCancelled())
@ -185,7 +188,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBurn(final BlockBurnEvent event)
{
if (event.isCancelled())
@ -221,7 +224,7 @@ public class EssentialsProtectBlockListener extends BlockListener
BlockFace.SELF
};
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event)
{
if (event.isCancelled())
@ -319,7 +322,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPistonExtend(BlockPistonExtendEvent event)
{
if (event.isCancelled())
@ -372,7 +375,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPistonRetract(BlockPistonRetractEvent event)
{
if (event.isCancelled() || !event.isSticky())
@ -460,7 +463,8 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
}
if (prot.getSettingBool(ProtectConfig.protect_rails)) {
if (prot.getSettingBool(ProtectConfig.protect_rails))
{
if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
{
return prot.getStorage().isProtected(block, user.getName());

View File

@ -8,12 +8,15 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
import org.bukkit.event.entity.*;
public class EssentialsProtectEntityListener extends EntityListener
public class EssentialsProtectEntityListener implements Listener
{
private final transient IProtect prot;
private final transient IEssentials ess;
@ -24,7 +27,7 @@ public class EssentialsProtectEntityListener extends EntityListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.isCancelled())
@ -189,7 +192,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityExplode(final EntityExplodeEvent event)
{
if (event.isCancelled())
@ -261,7 +264,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onCreatureSpawn(final CreatureSpawnEvent event)
{
if (event.getEntity() instanceof Player)
@ -288,7 +291,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityTarget(final EntityTargetEvent event)
{
if (event.isCancelled())
@ -314,7 +317,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onExplosionPrime(ExplosionPrimeEvent event)
{
if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball)
@ -324,7 +327,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onEndermanPickup(EndermanPickupEvent event)
{
if (event.isCancelled())

View File

@ -5,13 +5,15 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
public class EssentialsProtectPlayerListener extends PlayerListener
public class EssentialsProtectPlayerListener implements Listener
{
private final transient IProtect prot;
private final transient IEssentials ess;
@ -22,7 +24,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
// Do not return if cancelled, because the interact event has 2 cancelled states.

View File

@ -1,12 +1,14 @@
package com.earth2me.essentials.protect;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.weather.WeatherListener;
public class EssentialsProtectWeatherListener extends WeatherListener
public class EssentialsProtectWeatherListener implements Listener
{
private final transient IProtect prot;
@ -15,7 +17,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
this.prot = prot;
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onWeatherChange(final WeatherChangeEvent event)
{
if (!event.isCancelled()
@ -27,7 +29,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onLightningStrike(final LightningStrikeEvent event)
{
if (!event.isCancelled()
@ -37,7 +39,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
}
}
@Override
@EventHandler(priority = EventPriority.HIGHEST)
public void onThunderChange(final ThunderChangeEvent event)
{
if (!event.isCancelled()

View File

@ -2,14 +2,17 @@ package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.IEssentialsModule;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.Event;
import org.bukkit.event.EventException;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.EventExecutor;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -38,10 +41,22 @@ public class EssentialsSpawn extends JavaPlugin
ess.addReloadListener(spawns);
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, ess.getSettings().getRespawnPriority(), this);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor()
{
@Override
public void execute(final Listener ll, final Event event) throws EventException
{
((EssentialsSpawnPlayerListener)ll).onPlayerRespawn((PlayerRespawnEvent)event);
}
}, this);
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor()
{
@Override
public void execute(final Listener ll, final Event event) throws EventException
{
((EssentialsSpawnPlayerListener)ll).onPlayerJoin((PlayerJoinEvent)event);
}
}, this);
}
public void onDisable()

View File

@ -7,13 +7,13 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EssentialsSpawnPlayerListener extends PlayerListener
public class EssentialsSpawnPlayerListener implements Listener
{
private final transient IEssentials ess;
private final transient SpawnStorage spawns;
@ -26,7 +26,6 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
this.spawns = spawns;
}
@Override
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@ -51,7 +50,6 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
}
}
@Override
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());

View File

@ -10,8 +10,6 @@ import java.util.logging.Logger;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -47,17 +45,13 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
}
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
pluginManager.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
pluginManager.registerEvents(playerListener, this);
users = new UserManager(this.getDataFolder());
xmpp = new XMPPManager(this);
ess.addReloadListener(users);
ess.addReloadListener(xmpp);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
@Override

View File

@ -2,13 +2,15 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
class EssentialsXMPPPlayerListener extends PlayerListener
class EssentialsXMPPPlayerListener implements Listener
{
private final transient IEssentials ess;
@ -18,21 +20,21 @@ class EssentialsXMPPPlayerListener extends PlayerListener
this.ess = ess;
}
@Override
@EventHandler(priority= EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
}
@Override
@EventHandler(priority= EventPriority.MONITOR)
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
}
@Override
@EventHandler(priority= EventPriority.MONITOR)
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());

View File

@ -2,6 +2,7 @@
<project default="collect">
<target name="setversion">
<replace dir="." includes="**/src/plugin.yml" token="version: TeamCity" value="version: ${build.number}"/>
<replace dir="." includes="**/src/plugin.yml" token="version: GMBuildVer" value="version: ${GMVer} (${build.number})"/>
<replace dir="." includes="**/src/messages*.properties" token="version: TeamCity" value="version: ${build.number}"/>
<replace dir="." includes="**/src/items.csv" token="version: TeamCity" value="version: ${build.number}"/>
</target>

BIN
lib/Vault.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.