mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-10-31 07:39:54 +01:00
Compatibility with upcoming CB 1.1-R5 and above: updated Enderman block monitors to use EntityChangeBlockEvent, removed register event convenience methods from MPlugin (no longer working or needed)
Updated Bukkit lib to newest dev version
This commit is contained in:
parent
c208658cab
commit
e918bc0d91
BIN
lib/bukkit.jar
BIN
lib/bukkit.jar
Binary file not shown.
@ -7,6 +7,7 @@ import java.util.logging.Level;
|
|||||||
import org.bukkit.Location;
|
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.Enderman;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
@ -15,8 +16,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
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.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EndermanPlaceEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
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;
|
||||||
@ -297,10 +297,13 @@ public class FactionsEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEndermanPickup(EndermanPickupEvent event)
|
public void onEntityChangeBlock(EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
// for now, only interested in Enderman tomfoolery
|
||||||
|
if (!(event.getEntity() instanceof Enderman)) return;
|
||||||
|
|
||||||
FLocation floc = new FLocation(event.getBlock());
|
FLocation floc = new FLocation(event.getBlock());
|
||||||
Faction faction = Board.getFactionAt(floc);
|
Faction faction = Board.getFactionAt(floc);
|
||||||
|
|
||||||
@ -309,19 +312,6 @@ public class FactionsEntityListener implements Listener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
|
||||||
public void onEndermanPlace(EndermanPlaceEvent event)
|
|
||||||
{
|
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
FLocation floc = new FLocation(event.getLocation());
|
|
||||||
Faction faction = Board.getFactionAt(floc);
|
|
||||||
|
|
||||||
if (faction.getFlag(FFlag.ENDERGRIEF)) return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,20 +110,6 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
|
||||||
// Register Event convenience method
|
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public void registerEvent(Event.Type type, Listener listener, Event.Priority priority)
|
|
||||||
{
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvent(type, listener, priority, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerEvent(Event.Type type, Listener listener)
|
|
||||||
{
|
|
||||||
registerEvent(type, listener, Event.Priority.Normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Some inits...
|
// Some inits...
|
||||||
// You are supposed to override these in the plugin if you aren't satisfied with the defaults
|
// You are supposed to override these in the plugin if you aren't satisfied with the defaults
|
||||||
|
Loading…
Reference in New Issue
Block a user