Update to new Bukkit Event system
Also remove leftover TNT exploit prevention code which I missed earlier
This commit is contained in:
parent
84e137049e
commit
fc04e0a446
@ -11,7 +11,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -104,41 +103,14 @@ public class P extends MPlugin
|
|||||||
{
|
{
|
||||||
Worldguard.init(this);
|
Worldguard.init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player Events
|
// Register Event Handlers
|
||||||
this.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest);
|
getServer().getPluginManager().registerEvents(playerListener, this);
|
||||||
this.registerEvent(Event.Type.PLAYER_CHAT, this.chatEarlyListener, Event.Priority.Lowest);
|
getServer().getPluginManager().registerEvents(chatEarlyListener, this);
|
||||||
this.registerEvent(Event.Type.PLAYER_INTERACT, this.playerListener, Event.Priority.Normal);
|
getServer().getPluginManager().registerEvents(entityListener, this);
|
||||||
this.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal);
|
getServer().getPluginManager().registerEvents(blockListener, this);
|
||||||
this.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Event.Priority.Normal);
|
getServer().getPluginManager().registerEvents(serverListener, this);
|
||||||
this.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Event.Priority.High);
|
|
||||||
this.registerEvent(Event.Type.PLAYER_BUCKET_EMPTY, this.playerListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.PLAYER_BUCKET_FILL, this.playerListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Event.Priority.Normal);
|
|
||||||
|
|
||||||
// Entity Events
|
|
||||||
this.registerEvent(Event.Type.ENDERMAN_PICKUP, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.ENDERMAN_PLACE, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.ENTITY_DEATH, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.ENTITY_EXPLODE, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.ENTITY_TARGET, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.PAINTING_BREAK, this.entityListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.PAINTING_PLACE, this.entityListener, Event.Priority.Normal);
|
|
||||||
|
|
||||||
// Block Events
|
|
||||||
this.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.BLOCK_DAMAGE, this.blockListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Event.Priority.Normal);
|
|
||||||
this.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Event.Priority.Normal);
|
|
||||||
|
|
||||||
// Server Events
|
|
||||||
this.registerEvent(Event.Type.PLUGIN_ENABLE, this.serverListener, Event.Priority.Monitor);
|
|
||||||
this.registerEvent(Event.Type.PLUGIN_DISABLE, this.serverListener, Event.Priority.Monitor);
|
|
||||||
|
|
||||||
postEnable();
|
postEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
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.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
@ -22,7 +24,7 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
|
||||||
|
|
||||||
public class FactionsBlockListener extends BlockListener
|
public class FactionsBlockListener implements Listener
|
||||||
{
|
{
|
||||||
public P p;
|
public P p;
|
||||||
public FactionsBlockListener(P p)
|
public FactionsBlockListener(P p)
|
||||||
@ -30,7 +32,7 @@ public class FactionsBlockListener extends BlockListener
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -45,17 +47,10 @@ public class FactionsBlockListener extends BlockListener
|
|||||||
if ( ! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false))
|
if ( ! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Material handItem = event.getPlayer().getItemInHand().getType();
|
|
||||||
if (handItem == Material.TNT || handItem == Material.REDSTONE_TORCH_ON)
|
|
||||||
{
|
|
||||||
Faction targetFaction = Board.getFactionAt(new FLocation(event.getBlock()));
|
|
||||||
FactionsEntityListener.trackPotentialExplosionExploit(event.getPlayer().getName(), targetFaction, handItem, event.getBlock().getLocation());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -66,7 +61,7 @@ public class FactionsBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockDamage(BlockDamageEvent event)
|
public void onBlockDamage(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -77,7 +72,7 @@ public class FactionsBlockListener extends BlockListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -102,7 +97,7 @@ public class FactionsBlockListener extends BlockListener
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
||||||
{
|
{
|
||||||
// if not a sticky piston, retraction should be fine
|
// if not a sticky piston, retraction should be fine
|
||||||
|
@ -4,8 +4,10 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
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.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
@ -17,7 +19,7 @@ import com.massivecraft.factions.struct.Relation;
|
|||||||
|
|
||||||
|
|
||||||
// this is an addtional PlayerListener for handling slashless command usage and faction chat, to be set at low priority so Factions gets to them first
|
// this is an addtional PlayerListener for handling slashless command usage and faction chat, to be set at low priority so Factions gets to them first
|
||||||
public class FactionsChatEarlyListener extends PlayerListener
|
public class FactionsChatEarlyListener implements Listener
|
||||||
{
|
{
|
||||||
public P p;
|
public P p;
|
||||||
public FactionsChatEarlyListener(P p)
|
public FactionsChatEarlyListener(P p)
|
||||||
@ -25,7 +27,7 @@ public class FactionsChatEarlyListener extends PlayerListener
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EndermanPickupEvent;
|
import org.bukkit.event.entity.EndermanPickupEvent;
|
||||||
import org.bukkit.event.entity.EndermanPlaceEvent;
|
import org.bukkit.event.entity.EndermanPlaceEvent;
|
||||||
@ -19,9 +18,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
||||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||||
import org.bukkit.event.painting.PaintingBreakEvent;
|
import org.bukkit.event.painting.PaintingBreakEvent;
|
||||||
import org.bukkit.event.painting.PaintingPlaceEvent;
|
import org.bukkit.event.painting.PaintingPlaceEvent;
|
||||||
@ -37,7 +34,7 @@ import com.massivecraft.factions.struct.Relation;
|
|||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
|
|
||||||
|
|
||||||
public class FactionsEntityListener extends EntityListener
|
public class FactionsEntityListener implements Listener
|
||||||
{
|
{
|
||||||
public P p;
|
public P p;
|
||||||
public FactionsEntityListener(P p)
|
public FactionsEntityListener(P p)
|
||||||
@ -45,9 +42,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<PotentialExplosionExploit> exploitExplosions = new ArrayList<PotentialExplosionExploit>();
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEntityDeath(EntityDeathEvent event)
|
public void onEntityDeath(EntityDeathEvent event)
|
||||||
{
|
{
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -97,7 +92,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
* I can always hurt enemies.
|
* I can always hurt enemies.
|
||||||
* I can hurt neutrals as long as they are outside their own territory.
|
* I can hurt neutrals as long as they are outside their own territory.
|
||||||
*/
|
*/
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if ( event.isCancelled()) return;
|
if ( event.isCancelled()) return;
|
||||||
@ -117,7 +112,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEntityExplode(EntityExplodeEvent event)
|
public void onEntityExplode(EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if ( event.isCancelled()) return;
|
if ( event.isCancelled()) return;
|
||||||
@ -361,7 +356,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled() || event.getLocation() == null)
|
if (event.isCancelled() || event.getLocation() == null)
|
||||||
@ -375,7 +370,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEntityTarget(EntityTargetEvent event)
|
public void onEntityTarget(EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -400,7 +395,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPaintingBreak(PaintingBreakEvent event)
|
public void onPaintingBreak(PaintingBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -422,7 +417,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPaintingPlace(PaintingPlaceEvent event)
|
public void onPaintingPlace(PaintingPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -433,7 +428,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEndermanPickup(EndermanPickupEvent event)
|
public void onEndermanPickup(EndermanPickupEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -444,7 +439,7 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEndermanPlace(EndermanPlaceEvent event)
|
public void onEndermanPlace(EndermanPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -500,38 +495,4 @@ public class FactionsEntityListener extends EntityListener
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Since the Bukkit team still don't seem to be in any hurry to fix the problem after at least half a year,
|
|
||||||
* we'll track potential explosion exploits ourselves and try to prevent them
|
|
||||||
* For reference, canceled TNT placement next to redstone power is bugged and triggers a free explosion
|
|
||||||
* Same thing happens for canceled redstone torch placement next to existing TNT
|
|
||||||
* https://bukkit.atlassian.net/browse/BUKKIT-89
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static void trackPotentialExplosionExploit(String playerName, Faction faction, Material item, Location location)
|
|
||||||
{
|
|
||||||
exploitExplosions.add(new PotentialExplosionExploit(playerName, faction, item, location));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PotentialExplosionExploit
|
|
||||||
{
|
|
||||||
public String playerName;
|
|
||||||
public Faction faction;
|
|
||||||
public Material item;
|
|
||||||
public long timeMillis;
|
|
||||||
public int X;
|
|
||||||
public int Z;
|
|
||||||
|
|
||||||
public PotentialExplosionExploit(String playerName, Faction faction, Material item, Location location)
|
|
||||||
{
|
|
||||||
this.playerName = playerName;
|
|
||||||
this.faction = faction;
|
|
||||||
this.item = item;
|
|
||||||
this.timeMillis = System.currentTimeMillis();
|
|
||||||
this.X = location.getBlockX();
|
|
||||||
this.Z = location.getBlockZ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,9 @@ 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.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.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
@ -17,7 +20,6 @@ import org.bukkit.event.player.PlayerChatEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
@ -40,7 +42,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class FactionsPlayerListener extends PlayerListener
|
public class FactionsPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
public P p;
|
public P p;
|
||||||
public FactionsPlayerListener(P p)
|
public FactionsPlayerListener(P p)
|
||||||
@ -48,7 +50,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -143,7 +145,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
// Make sure that all online players do have a fplayer.
|
// Make sure that all online players do have a fplayer.
|
||||||
@ -159,7 +161,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
SpoutFeatures.updateAppearancesShortly(event.getPlayer());
|
SpoutFeatures.updateAppearancesShortly(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event)
|
public void onPlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
// Make sure player's power is up to date when they log off.
|
// Make sure player's power is up to date when they log off.
|
||||||
@ -173,7 +175,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
SpoutFeatures.playerDisconnect(me);
|
SpoutFeatures.playerDisconnect(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerMove(PlayerMoveEvent event)
|
public void onPlayerMove(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -302,7 +304,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -477,7 +479,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event)
|
public void onPlayerRespawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
FPlayer me = FPlayers.i.get(event.getPlayer());
|
FPlayer me = FPlayers.i.get(event.getPlayer());
|
||||||
@ -503,7 +505,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
|
|
||||||
// For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected),
|
// For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected),
|
||||||
// but these separate bucket events below always fire without fail
|
// but these separate bucket events below always fire without fail
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
|
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -517,7 +519,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerBucketFill(PlayerBucketFillEvent event)
|
public void onPlayerBucketFill(PlayerBucketFillEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -628,7 +630,7 @@ public class FactionsPlayerListener extends PlayerListener
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerKick(PlayerKickEvent event)
|
public void onPlayerKick(PlayerKickEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.event.server.ServerListener;
|
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;
|
||||||
|
|
||||||
@ -9,7 +11,7 @@ import com.massivecraft.factions.P;
|
|||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
|
|
||||||
|
|
||||||
public class FactionsServerListener extends ServerListener
|
public class FactionsServerListener implements Listener
|
||||||
{
|
{
|
||||||
public P p;
|
public P p;
|
||||||
public FactionsServerListener(P p)
|
public FactionsServerListener(P p)
|
||||||
@ -17,7 +19,7 @@ public class FactionsServerListener extends ServerListener
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginDisable(PluginDisableEvent event)
|
public void onPluginDisable(PluginDisableEvent event)
|
||||||
{
|
{
|
||||||
String name = event.getPlugin().getDescription().getName();
|
String name = event.getPlugin().getDescription().getName();
|
||||||
@ -27,7 +29,7 @@ public class FactionsServerListener extends ServerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginEnable(PluginEnableEvent event)
|
public void onPluginEnable(PluginEnableEvent event)
|
||||||
{
|
{
|
||||||
Plugin plug = event.getPlugin();
|
Plugin plug = event.getPlugin();
|
||||||
|
Loading…
Reference in New Issue
Block a user