Spigot 1.8: Armor Stand Support (Somehow. Spigot Implementation is Buggy)
This commit is contained in:
parent
7b72e1d5cf
commit
d010249107
8 changed files with 234 additions and 144 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,11 +1,13 @@
|
|||
/bin
|
||||
|
||||
# Eclipse stuff
|
||||
# IDE stuff
|
||||
/.project
|
||||
/.classpath
|
||||
/.settings
|
||||
/.buildpath
|
||||
/.checkstyle
|
||||
/.idea
|
||||
/LimitedCreative.iml
|
||||
|
||||
# maven
|
||||
/target
|
||||
|
|
|
@ -4,17 +4,16 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import de.jaschastarke.bukkit.lib.CoreModule;
|
||||
|
||||
|
@ -47,10 +46,10 @@ public class FeatureBlockItemSpawn extends CoreModule<LimitedCreative> implement
|
|||
private void scheduleCleanUp() {
|
||||
if (cleanup.maxTime == 0) { // if not scheduled yet
|
||||
cleanup.maxTime = System.currentTimeMillis();
|
||||
cleanup.runTaskLater(plugin, TICK_OFFSET);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, cleanup, TICK_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class BlockItemDrop {
|
||||
public BlockItemDrop(Location l, Material type) {
|
||||
this.l = l;
|
||||
|
@ -96,11 +95,15 @@ public class FeatureBlockItemSpawn extends CoreModule<LimitedCreative> implement
|
|||
list.add(new BlockItemDrop(l, type));
|
||||
scheduleCleanUp();
|
||||
}
|
||||
public void block(Location l, ItemStack item) {
|
||||
if (item != null)
|
||||
block(l, item.getType());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
if (event.getEntity() instanceof Item) {
|
||||
if (this.isBlocked(event.getLocation().getBlock().getLocation(), ((Item) event.getEntity()).getItemStack().getType())) {
|
||||
if (event.getEntity() != null) {
|
||||
if (this.isBlocked(event.getLocation().getBlock().getLocation(), event.getEntity().getItemStack().getType())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -113,8 +116,9 @@ public class FeatureBlockItemSpawn extends CoreModule<LimitedCreative> implement
|
|||
return debug;
|
||||
}
|
||||
|
||||
private class CleanUp extends BukkitRunnable {
|
||||
private class CleanUp implements Runnable {
|
||||
public long maxTime = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin.isDebug())
|
||||
|
|
|
@ -15,10 +15,10 @@ import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockListener;
|
|||
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockStateCommand;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockStateConfig;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.HangingListener;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.HangingStandingListener;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.PlayerListener;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.SyncronizedModel;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.ThreadedModel;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.ThreadedModel;
|
||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit.EditSessionListener;
|
||||
import de.jaschastarke.modularize.IModule;
|
||||
import de.jaschastarke.modularize.ModuleEntry;
|
||||
|
@ -50,7 +50,7 @@ public class ModBlockStates extends CoreModule<LimitedCreative> {
|
|||
this.addModule(new BlockFall(plugin));
|
||||
|
||||
listeners.addListener(new BlockListener(this));
|
||||
listeners.addListener(new HangingListener(this));
|
||||
listeners.addListener(new HangingStandingListener(this));
|
||||
listeners.addListener(new PlayerListener(this));
|
||||
|
||||
command = new BlockStateCommand(this);
|
||||
|
|
|
@ -93,11 +93,11 @@ public class BlockStateConfig extends Configuration implements IConfigurationSub
|
|||
*
|
||||
* Without threading, huge WorldEdits becomes much noticeable slower.
|
||||
*
|
||||
* default: false
|
||||
* default: true
|
||||
*/
|
||||
@IsConfigurationNode(order = 150)
|
||||
public boolean getUseThreading() {
|
||||
return config.getBoolean("useThreading", false);
|
||||
return config.getBoolean("useThreading", true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,117 +1,206 @@
|
|||
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
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.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
|
||||
|
||||
public class HangingListener implements Listener {
|
||||
private ModBlockStates mod;
|
||||
public HangingListener(ModBlockStates mod) {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getRightClicked().getWorld().getName()))
|
||||
return;
|
||||
if (event.getRightClicked() instanceof ItemFrame) {
|
||||
if (mod.getModel().isRestricted(event.getRightClicked().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Modifying hanging: " + event.getRightClicked().getLocation().toString());
|
||||
|
||||
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Modify prevented");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getRightClicked().getLocation().getBlock().getLocation());
|
||||
s.setPlayer(event.getPlayer());
|
||||
s.setDate(new Date());
|
||||
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerLeftInteractEntity(EntityDamageByEntityEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getDamager() instanceof Player && event.getEntity() instanceof ItemFrame) {
|
||||
if (mod.getModel().isRestricted(event.getEntity().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Modifying hanging: " + event.getEntity().getLocation().toString());
|
||||
|
||||
if (((Player) event.getDamager()).getGameMode() != GameMode.CREATIVE) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Modify prevented");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getEntity().getLocation().getBlock().getLocation());
|
||||
s.setPlayer((Player) event.getDamager());
|
||||
s.setDate(new Date());
|
||||
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHangingBreak(HangingBreakEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ItemFrame) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Breaking hanging: " + event.getEntity().getLocation().toString());
|
||||
|
||||
if (mod.getModel().isRestricted(event.getEntity().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Drop prevented");
|
||||
|
||||
mod.getBlockSpawn().block(event.getEntity().getLocation().getBlock().getLocation(), Material.ITEM_FRAME);
|
||||
mod.getBlockSpawn().block(event.getEntity().getLocation().getBlock().getLocation(), ((ItemFrame) event.getEntity()).getItem().getType());
|
||||
}
|
||||
|
||||
mod.getModel().removeState(event.getEntity().getLocation().getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHangingPlace(HangingPlaceEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ItemFrame) {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getEntity().getLocation().getBlock().getLocation());
|
||||
s.setPlayer(event.getPlayer());
|
||||
s.setDate(new Date());
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
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.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
|
||||
|
||||
public class HangingStandingListener implements Listener {
|
||||
private ModBlockStates mod;
|
||||
public HangingStandingListener(ModBlockStates mod) {
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getRightClicked().getWorld().getName()))
|
||||
return;
|
||||
if (event.getRightClicked() instanceof ItemFrame) {
|
||||
if (mod.getModel().isRestricted(event.getRightClicked().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Modifying hanging: " + event.getRightClicked().getLocation().toString());
|
||||
|
||||
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Modify prevented");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getRightClicked().getLocation().getBlock().getLocation());
|
||||
s.setPlayer(event.getPlayer());
|
||||
s.setDate(new Date());
|
||||
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
} else if (event.getRightClicked() instanceof ArmorStand) {
|
||||
if (mod.getModel().isRestricted(event.getRightClicked().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Modifying standing: " + event.getRightClicked().getLocation().toString());
|
||||
|
||||
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Modify prevented");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getRightClicked().getLocation().getBlock().getLocation());
|
||||
s.setPlayer(event.getPlayer());
|
||||
s.setDate(new Date());
|
||||
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
||||
onPlayerInteractEntity(event);
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onArmorStandManipulateEvent(PlayerArmorStandManipulateEvent event) {
|
||||
onPlayerInteractEntity(event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerLeftInteractEntity(EntityDamageByEntityEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getDamager() instanceof Player && event.getEntity() instanceof ItemFrame) {
|
||||
if (mod.getModel().isRestricted(event.getEntity().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Modifying hanging: " + event.getEntity().getLocation().toString());
|
||||
|
||||
if (((Player) event.getDamager()).getGameMode() != GameMode.CREATIVE) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Modify prevented");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getEntity().getLocation().getBlock().getLocation());
|
||||
s.setPlayer((Player) event.getDamager());
|
||||
s.setDate(new Date());
|
||||
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHangingBreak(HangingBreakEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ItemFrame) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Breaking hanging: " + event.getEntity().getLocation().toString());
|
||||
|
||||
if (mod.getModel().isRestricted(event.getEntity().getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Drop prevented");
|
||||
|
||||
mod.getBlockSpawn().block(event.getEntity().getLocation().getBlock().getLocation(), Material.ITEM_FRAME);
|
||||
mod.getBlockSpawn().block(event.getEntity().getLocation().getBlock().getLocation(), ((ItemFrame) event.getEntity()).getItem().getType());
|
||||
}
|
||||
|
||||
mod.getModel().removeState(event.getEntity().getLocation().getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkArmoryDestroy(ArmorStand entity, boolean deRemove) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Breaking standing: " + entity.getLocation().toString());
|
||||
|
||||
if (mod.getModel().isRestricted(entity.getLocation().getBlock())) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("... was placed by creative. Drop prevented");
|
||||
|
||||
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), Material.ARMOR_STAND);
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), Material.ARMOR_STAND);
|
||||
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), entity.getHelmet());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), entity.getChestplate());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), entity.getBoots());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), entity.getItemInHand());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getLocation(), entity.getLeggings());
|
||||
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), entity.getHelmet());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), entity.getChestplate());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), entity.getBoots());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), entity.getItemInHand());
|
||||
mod.getBlockSpawn().block(entity.getLocation().getBlock().getRelative(BlockFace.UP).getLocation(), entity.getLeggings());
|
||||
/*entity.setBoots(null);
|
||||
entity.setChestplate(null);
|
||||
entity.setHelmet(null);
|
||||
entity.setItemInHand(null);
|
||||
entity.setLeggings(null);*/
|
||||
}
|
||||
|
||||
if (deRemove)
|
||||
mod.getModel().removeState(entity.getLocation().getBlock());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onStandingBreak(EntityDeathEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
checkArmoryDestroy((ArmorStand) event.getEntity(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onStandingBreaking(EntityDamageByEntityEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
// TODO: Bug in Spigot, we can not check for destroying yet. so the block state stays in DB :(
|
||||
//if (event.getEntity().isDead() || ((ArmorStand) event.getEntity()).getHealth() <= event.getFinalDamage()) {
|
||||
checkArmoryDestroy((ArmorStand) event.getEntity(), false);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onHangingPlace(HangingPlaceEvent event) {
|
||||
if (mod.getConfig().getIgnoredWorlds().contains(event.getEntity().getWorld().getName()))
|
||||
return;
|
||||
if (event.getEntity() instanceof ItemFrame) {
|
||||
BlockState s = new BlockState();
|
||||
s.setLocation(event.getEntity().getLocation().getBlock().getLocation());
|
||||
s.setPlayer(event.getPlayer());
|
||||
s.setDate(new Date());
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Saving BlockState: " + s.toString());
|
||||
|
||||
mod.getModel().setState(s);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ package de.jaschastarke.minecraft.limitedcreative.limits;
|
|||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -53,7 +52,7 @@ public class EntityListener implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
if (event.getEntity() instanceof LivingEntity && event.getDroppedExp() > 0) {
|
||||
if (event.getEntity() != null && event.getDroppedExp() > 0) {
|
||||
if (mod.getNoDropMobs().isXPPrevented(event.getEntity())) {
|
||||
event.setDroppedExp(0);
|
||||
event.getDrops().clear();
|
||||
|
|
|
@ -125,7 +125,7 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup
|
|||
}
|
||||
|
||||
|
||||
public static enum BlockPickup implements IToGeneric {
|
||||
public enum BlockPickup implements IToGeneric {
|
||||
PREVENT,
|
||||
REMOVE;
|
||||
|
||||
|
@ -289,7 +289,7 @@ public class LimitConfig extends Configuration implements IConfigurationSubGroup
|
|||
public Object getValue(final IConfigurationNode node) {
|
||||
Object val = super.getValue(node);
|
||||
if (node.getName().equals("pickup") && val == null) {
|
||||
return new Boolean(false);
|
||||
return false;
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -35,13 +35,7 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
|||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerExpChangeEvent;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.material.DirectionalContainer;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
@ -185,13 +179,11 @@ public class PlayerListener implements Listener {
|
|||
if (!checkPermission(event, NoLimitPermissions.CHEST)) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(mod.getPlugin().getLocale().trans("blocked.chest"));
|
||||
return;
|
||||
}
|
||||
} else if (mod.getConfig().getBlockInteraction().isListed(block)) {
|
||||
if (!checkPermission(event, NoLimitPermissions.INTERACT(block))) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(mod.getPlugin().getLocale().trans("blocked.interact"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,11 +205,15 @@ public class PlayerListener implements Listener {
|
|||
if (!checkPermission(event, NoLimitPermissions.BASE_INTERACT)) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(mod.getPlugin().getLocale().trans("blocked.entity"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
||||
onPlayerInteractEntity(event);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageEvent rawevent) {
|
||||
|
|
Loading…
Reference in a new issue