mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-05 07:57:59 +01:00
Update for new CraftBukkit Event Code
EssentialsSpawn can't be updated yet, because the new event system lacks dynamic priorities.
This commit is contained in:
parent
46298ae858
commit
792f70efa5
@ -24,7 +24,6 @@ import com.earth2me.essentials.commands.EssentialsCommand;
|
|||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.NoChargeException;
|
import com.earth2me.essentials.commands.NoChargeException;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import com.earth2me.essentials.craftbukkit.ItemDupeFix;
|
|
||||||
import com.earth2me.essentials.perm.PermissionsHandler;
|
import com.earth2me.essentials.perm.PermissionsHandler;
|
||||||
import com.earth2me.essentials.register.payment.Methods;
|
import com.earth2me.essentials.register.payment.Methods;
|
||||||
import com.earth2me.essentials.signs.SignBlockListener;
|
import com.earth2me.essentials.signs.SignBlockListener;
|
||||||
@ -45,11 +44,10 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
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.WorldLoadEvent;
|
||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
import org.bukkit.plugin.InvalidDescriptionException;
|
import org.bukkit.plugin.InvalidDescriptionException;
|
||||||
@ -63,7 +61,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
|||||||
|
|
||||||
public class Essentials extends JavaPlugin implements IEssentials
|
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 static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
private transient ISettings settings;
|
private transient ISettings settings;
|
||||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
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, _("essentialsHelp1"));
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.SEVERE, exception.toString());
|
LOGGER.log(Level.SEVERE, exception.toString());
|
||||||
pm.registerEvent(Type.PLAYER_JOIN, new PlayerListener()
|
pm.registerEvents(new Listener()
|
||||||
{
|
{
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
|
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
|
||||||
}
|
}
|
||||||
}, Priority.Low, this);
|
}, this);
|
||||||
for (Player player : getServer().getOnlinePlayers())
|
for (Player player : getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player.sendMessage("Essentials failed to load, read the log file.");
|
player.sendMessage("Essentials failed to load, read the log file.");
|
||||||
@ -200,61 +198,35 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
|
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
|
||||||
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
|
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
|
||||||
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
|
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
|
||||||
pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
|
pm.registerEvents(serverListener, this);
|
||||||
pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
|
|
||||||
confList.add(serverListener);
|
confList.add(serverListener);
|
||||||
|
|
||||||
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
|
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
|
||||||
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
|
pm.registerEvents(playerListener, 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);
|
|
||||||
|
|
||||||
final EssentialsBlockListener blockListener = new EssentialsBlockListener(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);
|
final SignBlockListener signBlockListener = new SignBlockListener(this);
|
||||||
pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Highest, this);
|
pm.registerEvents(signBlockListener, 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);
|
|
||||||
|
|
||||||
final SignPlayerListener signPlayerListener = new SignPlayerListener(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);
|
final SignEntityListener signEntityListener = new SignEntityListener(this);
|
||||||
pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this);
|
pm.registerEvents(signEntityListener, this);
|
||||||
pm.registerEvent(Type.ENDERMAN_PICKUP, signEntityListener, Priority.Low, this);
|
|
||||||
|
|
||||||
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
|
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
|
||||||
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
|
pm.registerEvents(entityListener, 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);
|
|
||||||
|
|
||||||
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
|
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
|
||||||
pm.registerEvent(Type.WORLD_LOAD, worldListener, Priority.Monitor, this);
|
pm.registerEvents(worldListener, this);
|
||||||
pm.registerEvent(Type.WORLD_UNLOAD, worldListener, Priority.Monitor, this);
|
|
||||||
|
|
||||||
//TODO: Check if this should be here, and not above before reload()
|
//TODO: Check if this should be here, and not above before reload()
|
||||||
jails = new Jails(this);
|
jails = new Jails(this);
|
||||||
confList.add(jails);
|
confList.add(jails);
|
||||||
|
|
||||||
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
|
pm.registerEvents(tntListener, this);
|
||||||
|
|
||||||
final EssentialsTimer timer = new EssentialsTimer(this);
|
final EssentialsTimer timer = new EssentialsTimer(this);
|
||||||
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
|
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
|
||||||
@ -602,17 +574,17 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
return i18n;
|
return i18n;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EssentialsWorldListener extends WorldListener implements Runnable {
|
private static class EssentialsWorldListener implements Listener, Runnable {
|
||||||
private transient final IEssentials ess;
|
private transient final IEssentials ess;
|
||||||
|
|
||||||
public EssentialsWorldListener(IEssentials ess)
|
public EssentialsWorldListener(final IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onWorldLoad(WorldLoadEvent event)
|
public void onWorldLoad(final WorldLoadEvent event)
|
||||||
{
|
{
|
||||||
ess.getJails().onReload();
|
ess.getJails().onReload();
|
||||||
ess.getWarps().reloadConfig();
|
ess.getWarps().reloadConfig();
|
||||||
@ -624,8 +596,8 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onWorldUnload(WorldUnloadEvent event)
|
public void onWorldUnload(final WorldUnloadEvent event)
|
||||||
{
|
{
|
||||||
ess.getJails().onReload();
|
ess.getJails().onReload();
|
||||||
ess.getWarps().reloadConfig();
|
ess.getWarps().reloadConfig();
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsBlockListener extends BlockListener
|
public class EssentialsBlockListener implements Listener
|
||||||
{
|
{
|
||||||
private final IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
public EssentialsBlockListener(IEssentials ess)
|
public EssentialsBlockListener(final IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
|
@ -2,19 +2,20 @@ package com.earth2me.essentials;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
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.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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;
|
private final IEssentials ess;
|
||||||
|
|
||||||
public EssentialsEntityListener(IEssentials ess)
|
public EssentialsEntityListener(IEssentials ess)
|
||||||
@ -22,7 +23,7 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event instanceof EntityDamageByEntityEvent)
|
if (event instanceof EntityDamageByEntityEvent)
|
||||||
@ -55,7 +56,8 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
{
|
{
|
||||||
User player = ess.getUser(eAttack);
|
User player = ess.getUser(eAttack);
|
||||||
ItemStack hand = player.getItemInHand();
|
ItemStack hand = player.getItemInHand();
|
||||||
if (hand != null && hand.getType() == Material.MILK_BUCKET) {
|
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||||
|
{
|
||||||
((Animals)eDefend).setAge(-24000);
|
((Animals)eDefend).setAge(-24000);
|
||||||
hand.setType(Material.BUCKET);
|
hand.setType(Material.BUCKET);
|
||||||
player.setItemInHand(hand);
|
player.setItemInHand(hand);
|
||||||
@ -73,7 +75,7 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityCombust(EntityCombustEvent event)
|
public void onEntityCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
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)
|
public void onEntityDeath(final EntityDeathEvent event)
|
||||||
{
|
{
|
||||||
if (event instanceof PlayerDeathEvent)
|
if (event instanceof PlayerDeathEvent)
|
||||||
@ -101,7 +103,7 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
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)
|
public void onEntityRegainHealth(EntityRegainHealthEvent event)
|
||||||
{
|
{
|
||||||
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
|
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.craftbukkit.SetBed;
|
|
||||||
import com.earth2me.essentials.textreader.IText;
|
import com.earth2me.essentials.textreader.IText;
|
||||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
import com.earth2me.essentials.textreader.TextInput;
|
import com.earth2me.essentials.textreader.TextInput;
|
||||||
@ -17,15 +16,17 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
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.block.Action;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsPlayerListener extends PlayerListener
|
public class EssentialsPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
private final transient Server server;
|
private final transient Server server;
|
||||||
@ -37,7 +38,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
this.server = parent.getServer();
|
this.server = parent.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
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)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
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)
|
public void onPlayerMove(final PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -108,7 +109,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
@ -125,7 +126,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
user.dispose();
|
user.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
ess.getBackup().onPlayerJoin();
|
ess.getBackup().onPlayerJoin();
|
||||||
@ -178,7 +179,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerLogin(final PlayerLoginEvent event)
|
public void onPlayerLogin(final PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
|
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
|
||||||
@ -224,8 +225,8 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
@ -246,19 +247,19 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
updateCompass(user);
|
updateCompass(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
|
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
final ItemStack is = new ItemStack(Material.EGG, 1);
|
final ItemStack stack = new ItemStack(Material.EGG, 1);
|
||||||
if (user.hasUnlimited(is))
|
if (user.hasUnlimited(stack))
|
||||||
{
|
{
|
||||||
user.getInventory().addItem(is);
|
user.getInventory().addItem(stack);
|
||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
|
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
@ -276,7 +277,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerAnimation(final PlayerAnimationEvent event)
|
public void onPlayerAnimation(final PlayerAnimationEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
@ -321,7 +322,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -348,7 +349,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
|
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
|
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
|
||||||
@ -361,7 +362,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -375,11 +376,11 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
|
|
||||||
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
|
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)
|
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
|
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
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.PluginDisableEvent;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
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 final transient IEssentials ess;
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
public EssentialsPluginListener(final IEssentials ess)
|
public EssentialsPluginListener(final IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginEnable(final PluginEnableEvent event)
|
public void onPluginEnable(final PluginEnableEvent event)
|
||||||
{
|
{
|
||||||
ess.getPermissionsHandler().checkPermissions();
|
ess.getPermissionsHandler().checkPermissions();
|
||||||
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
|
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
|
||||||
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
|
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)
|
public void onPluginDisable(final PluginDisableEvent event)
|
||||||
{
|
{
|
||||||
ess.getPermissionsHandler().checkPermissions();
|
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()))
|
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
|
||||||
{
|
{
|
||||||
ess.getPaymentMethod().reset();
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,9 +149,9 @@ public interface ISettings extends IConf
|
|||||||
|
|
||||||
boolean registerBackInListener();
|
boolean registerBackInListener();
|
||||||
|
|
||||||
public boolean getDisableItemPickupWhileAfk();
|
boolean getDisableItemPickupWhileAfk();
|
||||||
|
|
||||||
public Priority getRespawnPriority();
|
Priority getRespawnPriority();
|
||||||
|
|
||||||
long getTpaAcceptCancellation();
|
long getTpaAcceptCancellation();
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,7 @@ package com.earth2me.essentials;
|
|||||||
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
|
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.Delegate;
|
import lombok.Delegate;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -739,12 +736,6 @@ public class OfflinePlayer implements Player
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getBedSpawnLocation()
|
|
||||||
{
|
|
||||||
return OfflineBedLocation.getBedLocation(base.getName(), ess);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSprinting()
|
public boolean isSprinting()
|
||||||
{
|
{
|
||||||
@ -825,8 +816,45 @@ public class OfflinePlayer implements Player
|
|||||||
|
|
||||||
void setName(final String name)
|
void setName(final String name)
|
||||||
{
|
{
|
||||||
if (!this.base.getName().equalsIgnoreCase(name)) {
|
if (!this.base.getName().equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
this.base = ess.getServer().getOfflinePlayer(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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,13 @@ package com.earth2me.essentials;
|
|||||||
|
|
||||||
import com.earth2me.essentials.craftbukkit.FakeExplosion;
|
import com.earth2me.essentials.craftbukkit.FakeExplosion;
|
||||||
import org.bukkit.entity.LivingEntity;
|
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.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 final transient IEssentials ess;
|
||||||
private transient boolean enabled = false;
|
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)
|
public void onEntityExplode(final EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.earth2me.essentials.craftbukkit;
|
package com.earth2me.essentials.craftbukkit;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
@ -10,6 +12,7 @@ import org.bukkit.entity.*;
|
|||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
@ -521,4 +524,28 @@ public class FakeWorld implements World
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,10 +8,13 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
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.*;
|
import org.bukkit.event.block.*;
|
||||||
|
|
||||||
|
|
||||||
public class SignBlockListener extends BlockListener
|
public class SignBlockListener implements Listener
|
||||||
{
|
{
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final static Logger LOGGER = Logger.getLogger("Minecraft");
|
private final static Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
@ -21,7 +24,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
||||||
@ -73,7 +76,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onSignChange(final SignChangeEvent event)
|
public void onSignChange(final SignChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
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)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
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)
|
public void onBlockBurn(final BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
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)
|
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
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)
|
public void onBlockPistonExtend(final BlockPistonExtendEvent event)
|
||||||
{
|
{
|
||||||
for (Block block : event.getBlocks())
|
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)
|
public void onBlockPistonRetract(final BlockPistonRetractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isSticky())
|
if (event.isSticky())
|
||||||
|
@ -3,12 +3,14 @@ package com.earth2me.essentials.signs;
|
|||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
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.EndermanPickupEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
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;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ public class SignEntityListener extends EntityListener
|
|||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onEntityExplode(final EntityExplodeEvent event)
|
public void onEntityExplode(final EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
for (Block block : event.blockList())
|
for (Block block : event.blockList())
|
||||||
@ -42,8 +44,8 @@ public class SignEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onEndermanPickup(EndermanPickupEvent event)
|
public void onEndermanPickup(final EndermanPickupEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
|
@ -4,22 +4,24 @@ import com.earth2me.essentials.IEssentials;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
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.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
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;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
public SignPlayerListener(IEssentials ess)
|
public SignPlayerListener(final IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@ import org.bukkit.map.MapView;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.ServicesManager;
|
import org.bukkit.plugin.ServicesManager;
|
||||||
|
import org.bukkit.plugin.messaging.Messenger;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.scheduler.BukkitWorker;
|
import org.bukkit.scheduler.BukkitWorker;
|
||||||
@ -549,6 +550,12 @@ public class FakeServer implements Server
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
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.");
|
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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ public class EssentialsChat extends JavaPlugin
|
|||||||
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener, chatStore);
|
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener, chatStore);
|
||||||
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, chatStore);
|
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, chatStore);
|
||||||
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, chatStore);
|
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, chatStore);
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this);
|
pluginManager.registerEvents(playerListenerLowest, this);
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this);
|
pluginManager.registerEvents(playerListenerNormal, this);
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this);
|
pluginManager.registerEvents(playerListenerHighest, this);
|
||||||
|
|
||||||
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,12 @@ import java.util.logging.Logger;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
|
|
||||||
//TODO: Translate the local/spy tags
|
//TODO: Translate the local/spy tags
|
||||||
public abstract class EssentialsChatPlayer extends PlayerListener
|
public abstract class EssentialsChatPlayer implements Listener
|
||||||
{
|
{
|
||||||
protected transient IEssentials ess;
|
protected transient IEssentials ess;
|
||||||
protected final static Logger logger = Logger.getLogger("Minecraft");
|
protected final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.earth2me.essentials.chat;
|
package com.earth2me.essentials.chat;
|
||||||
|
|
||||||
import com.earth2me.essentials.ChargeException;
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
|
|||||||
super(server, ess, listeners, chatStorage);
|
super(server, ess, listeners, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@ import com.earth2me.essentials.Util;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
|
||||||
|
|
||||||
@ -19,6 +21,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
|
|||||||
super(server, ess, listeners, chatStorage);
|
super(server, ess, listeners, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@ import com.earth2me.essentials.User;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
|
||||||
|
|
||||||
@ -19,6 +21,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
|
|||||||
super(server, ess, listeners, chatStorage);
|
super(server, ess, listeners, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ public class EssentialsGeoIP extends JavaPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
|
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.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||||
|
|
||||||
|
@ -17,11 +17,13 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
import org.bukkit.entity.Player;
|
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.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf
|
public class EssentialsGeoIPPlayerListener implements Listener, IConf
|
||||||
{
|
{
|
||||||
LookupService ls = null;
|
LookupService ls = null;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
@ -39,7 +41,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
|
|||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
User u = ess.getUser(event.getPlayer());
|
User u = ess.getUser(event.getPlayer());
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -78,16 +78,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
|
|||||||
|
|
||||||
private void enableEmergencyMode(final PluginManager pm)
|
private void enableEmergencyMode(final PluginManager pm)
|
||||||
{
|
{
|
||||||
final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
|
final EmergencyListener emListener = new EmergencyListener();
|
||||||
final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
|
pm.registerEvents(emListener, this);
|
||||||
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);
|
|
||||||
for (Player player : getServer().getOnlinePlayers())
|
for (Player player : getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
|
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
|
||||||
|
@ -9,10 +9,13 @@ import java.util.List;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
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.*;
|
import org.bukkit.event.block.*;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsProtectBlockListener extends BlockListener
|
public class EssentialsProtectBlockListener implements Listener
|
||||||
{
|
{
|
||||||
final private transient IProtect prot;
|
final private transient IProtect prot;
|
||||||
final private transient IEssentials ess;
|
final private transient IEssentials ess;
|
||||||
@ -23,7 +26,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -93,7 +96,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockIgnite(BlockIgniteEvent event)
|
public void onBlockIgnite(BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -144,7 +147,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockFromTo(final BlockFromToEvent event)
|
public void onBlockFromTo(final BlockFromToEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -185,7 +188,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockBurn(final BlockBurnEvent event)
|
public void onBlockBurn(final BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -221,7 +224,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
BlockFace.SELF
|
BlockFace.SELF
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -319,7 +322,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -372,7 +375,7 @@ public class EssentialsProtectBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || !event.isSticky())
|
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)
|
if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
|
||||||
{
|
{
|
||||||
return prot.getStorage().isProtected(block, user.getName());
|
return prot.getStorage().isProtected(block, user.getName());
|
||||||
|
@ -8,12 +8,15 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.*;
|
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.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsProtectEntityListener extends EntityListener
|
public class EssentialsProtectEntityListener implements Listener
|
||||||
{
|
{
|
||||||
private final transient IProtect prot;
|
private final transient IProtect prot;
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
@ -24,7 +27,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityDamage(final EntityDamageEvent event)
|
public void onEntityDamage(final EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -189,7 +192,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onEntityExplode(final EntityExplodeEvent event)
|
public void onEntityExplode(final EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -261,7 +264,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onCreatureSpawn(final CreatureSpawnEvent event)
|
public void onCreatureSpawn(final CreatureSpawnEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player)
|
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)
|
public void onEntityTarget(final EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
@ -314,7 +317,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onExplosionPrime(ExplosionPrimeEvent event)
|
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||||
{
|
{
|
||||||
if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball)
|
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)
|
public void onEndermanPickup(EndermanPickupEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
|
@ -5,13 +5,15 @@ import com.earth2me.essentials.IEssentials;
|
|||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
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.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsProtectPlayerListener extends PlayerListener
|
public class EssentialsProtectPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private final transient IProtect prot;
|
private final transient IProtect prot;
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
@ -22,7 +24,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
|
|||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
// Do not return if cancelled, because the interact event has 2 cancelled states.
|
// Do not return if cancelled, because the interact event has 2 cancelled states.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.earth2me.essentials.protect;
|
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.LightningStrikeEvent;
|
||||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
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;
|
private final transient IProtect prot;
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
|
|||||||
this.prot = prot;
|
this.prot = prot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onWeatherChange(final WeatherChangeEvent event)
|
public void onWeatherChange(final WeatherChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!event.isCancelled()
|
if (!event.isCancelled()
|
||||||
@ -27,7 +29,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onLightningStrike(final LightningStrikeEvent event)
|
public void onLightningStrike(final LightningStrikeEvent event)
|
||||||
{
|
{
|
||||||
if (!event.isCancelled()
|
if (!event.isCancelled()
|
||||||
@ -37,7 +39,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onThunderChange(final ThunderChangeEvent event)
|
public void onThunderChange(final ThunderChangeEvent event)
|
||||||
{
|
{
|
||||||
if (!event.isCancelled()
|
if (!event.isCancelled()
|
||||||
|
@ -47,9 +47,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
|||||||
}
|
}
|
||||||
|
|
||||||
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
|
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
|
||||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
|
pluginManager.registerEvents(playerListener, this);
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
|
||||||
pluginManager.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
|
|
||||||
|
|
||||||
users = new UserManager(this.getDataFolder());
|
users = new UserManager(this.getDataFolder());
|
||||||
xmpp = new XMPPManager(this);
|
xmpp = new XMPPManager(this);
|
||||||
|
@ -2,13 +2,15 @@ package com.earth2me.essentials.xmpp;
|
|||||||
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
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.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
|
||||||
class EssentialsXMPPPlayerListener extends PlayerListener
|
class EssentialsXMPPPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
@ -18,21 +20,21 @@ class EssentialsXMPPPlayerListener extends PlayerListener
|
|||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority= EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
|
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority= EventPriority.MONITOR)
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
|
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority= EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
Loading…
Reference in New Issue
Block a user