mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-10 21:10:16 +01:00
Further compat work.
This commit is contained in:
parent
6c5319f355
commit
89db0d9fee
@ -26,6 +26,9 @@
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.util.logging.LoggerToChatHandler;
|
||||
@ -95,13 +98,13 @@ public void reload(CommandContext args, CommandSender sender) throws CommandExce
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigurationManager config = plugin.getGlobalStateManager();
|
||||
ConfigurationManager config = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
config.unload();
|
||||
config.load();
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
config.get(world);
|
||||
config.get(BukkitAdapter.adapt(world));
|
||||
}
|
||||
plugin.getRegionContainer().reload();
|
||||
WorldGuard.getInstance().getPlatform().getRegionContainer().reload();
|
||||
// WGBukkit.cleanCache();
|
||||
sender.sendMessage("WorldGuard configuration reloaded.");
|
||||
} catch (Throwable t) {
|
||||
@ -250,12 +253,13 @@ public void stopProfile(CommandContext args, final CommandSender sender) throws
|
||||
@CommandPermissions("worldguard.flushstates")
|
||||
public void flushStates(CommandContext args, CommandSender sender) throws CommandException {
|
||||
if (args.argsLength() == 0) {
|
||||
plugin.getSessionManager().resetAllStates();
|
||||
WorldGuard.getInstance().getPlatform().getSessionManager().resetAllStates();
|
||||
sender.sendMessage("Cleared all states.");
|
||||
} else {
|
||||
Player player = plugin.getServer().getPlayer(args.getString(0));
|
||||
if (player != null) {
|
||||
plugin.getSessionManager().resetState(player);
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
WorldGuard.getInstance().getPlatform().getSessionManager().resetState(localPlayer);
|
||||
sender.sendMessage("Cleared states for player \"" + player.getName() + "\".");
|
||||
}
|
||||
}
|
||||
|
@ -19,22 +19,23 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.event.block;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldguard.bukkit.cause.Cause;
|
||||
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.BulkEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This event is an internal event. We do not recommend handling or throwing
|
||||
@ -65,7 +66,7 @@ protected AbstractBlockEvent(@Nullable Event originalEvent, Cause cause, Locatio
|
||||
}
|
||||
|
||||
private static List<Block> createList(Block block) {
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
blocks.add(block);
|
||||
return blocks;
|
||||
}
|
||||
@ -102,7 +103,7 @@ public boolean filter(Predicate<Location> predicate, boolean cancelEventOnFalse)
|
||||
|
||||
Iterator<Block> it = blocks.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (!predicate.apply(it.next().getLocation())) {
|
||||
if (!predicate.test(it.next().getLocation())) {
|
||||
hasRemoval = true;
|
||||
|
||||
if (cancelEventOnFalse) {
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
|
||||
@ -28,7 +28,7 @@
|
||||
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
@ -58,23 +58,21 @@ public void onPlaceBlock(final PlaceBlockEvent event) {
|
||||
final Player player = event.getCause().getFirstPlayer();
|
||||
|
||||
if (player != null) {
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(player);
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(WorldGuardPlugin.inst().wrapPlayer(player));
|
||||
|
||||
// Early guard
|
||||
if (!wcfg.signChestProtection) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
if (wcfg.getChestProtection().isChest(event.getEffectiveMaterial().getId()) && wcfg.isChestProtected(target.getBlock(), player)) {
|
||||
event.filter(target -> {
|
||||
if (wcfg.getChestProtection().isChest(BukkitAdapter.adapt(event.getEffectiveMaterial())) && wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation()),
|
||||
WorldGuardPlugin.inst().wrapPlayer(player))) {
|
||||
sendMessage(event, player, ChatColor.DARK_RED + "This spot is for a chest that you don't have permission for.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
@ -82,8 +80,9 @@ public boolean apply(Location target) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBreakBlock(final BreakBlockEvent event) {
|
||||
final Player player = event.getCause().getFirstPlayer();
|
||||
final LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(event.getWorld());
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(localPlayer);
|
||||
|
||||
// Early guard
|
||||
if (!wcfg.signChestProtection) {
|
||||
@ -91,33 +90,25 @@ public void onBreakBlock(final BreakBlockEvent event) {
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
if (wcfg.isChestProtected(target.getBlock(), player)) {
|
||||
event.filter(target -> {
|
||||
if (wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation()), localPlayer)) {
|
||||
sendMessage(event, player, ChatColor.DARK_RED + "This chest is protected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, true);
|
||||
} else {
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
return !wcfg.isChestProtected(target.getBlock());
|
||||
|
||||
}
|
||||
});
|
||||
event.filter(target -> !wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation())));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onUseBlock(final UseBlockEvent event) {
|
||||
final Player player = event.getCause().getFirstPlayer();
|
||||
final LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(event.getWorld());
|
||||
final BukkitWorldConfiguration wcfg = getWorldConfig(localPlayer);
|
||||
|
||||
// Early guard
|
||||
if (!wcfg.signChestProtection) {
|
||||
@ -125,43 +116,34 @@ public void onUseBlock(final UseBlockEvent event) {
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
if (wcfg.isChestProtected(target.getBlock(), player)) {
|
||||
event.filter(target -> {
|
||||
if (wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation()), localPlayer)) {
|
||||
sendMessage(event, player, ChatColor.DARK_RED + "This chest is protected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, true);
|
||||
} else {
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
return !wcfg.isChestProtected(target.getBlock());
|
||||
|
||||
}
|
||||
});
|
||||
event.filter(target -> !wcfg.isChestProtected(BukkitAdapter.adapt(target.getBlock().getLocation())));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(player);
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(WorldGuardPlugin.inst().wrapPlayer(player));
|
||||
|
||||
if (wcfg.signChestProtection) {
|
||||
if (event.getLine(0).equalsIgnoreCase("[Lock]")) {
|
||||
if (wcfg.isChestProtectedPlacement(event.getBlock(), player)) {
|
||||
if (wcfg.isChestProtectedPlacement(BukkitAdapter.adapt(event.getBlock().getLocation()), WorldGuardPlugin.inst().wrapPlayer(player))) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You do not own the adjacent chest.");
|
||||
event.getBlock().breakNaturally();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getBlock().getTypeId() != BlockID.SIGN_POST) {
|
||||
if (event.getBlock().getType() != Material.SIGN) {
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "The [Lock] sign must be a sign post, not a wall sign.");
|
||||
|
||||
@ -179,10 +161,10 @@ public void onSignChange(SignChangeEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
int below = event.getBlock().getRelative(0, -1, 0).getTypeId();
|
||||
Material below = event.getBlock().getRelative(0, -1, 0).getType();
|
||||
|
||||
if (below == BlockID.TNT || below == BlockID.SAND
|
||||
|| below == BlockID.GRAVEL || below == BlockID.SIGN_POST) {
|
||||
if (below == Material.TNT || below == Material.SAND
|
||||
|| below == Material.GRAVEL || below == Material.SIGN) {
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "That is not a safe block that you're putting this sign on.");
|
||||
|
||||
|
@ -130,7 +130,7 @@ public void onBlockBreak(BlockBreakEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
||||
List<Block> blocks = new ArrayList<Block>();
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
for (BlockState bs : event.getReplacedBlockStates()) {
|
||||
blocks.add(bs.getBlock());
|
||||
}
|
||||
@ -219,7 +219,7 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
Material to = event.getTo();
|
||||
|
||||
// Forget about Redstone ore, especially since we handle it in INTERACT
|
||||
if (Materials.isRedstoneOre(block.getType()) && Materials.isRedstoneOre(to)) {
|
||||
if (block.getType() == Material.REDSTONE_ORE && to == Material.REDSTONE_ORE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
|
||||
ArrayList<Block> blocks;
|
||||
try {
|
||||
blocks = new ArrayList<Block>(event.getBlocks());
|
||||
blocks = new ArrayList<>(event.getBlocks());
|
||||
} catch (NoSuchMethodError e) {
|
||||
blocks = Lists.newArrayList(event.getRetractLocation().getBlock());
|
||||
if (piston.getType() == Material.PISTON_MOVING_PIECE) {
|
||||
@ -308,7 +308,7 @@ public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
EventDebounce.Entry entry = pistonExtendDebounce.getIfNotPresent(new BlockPistonExtendKey(event), event);
|
||||
if (entry != null) {
|
||||
List<Block> blocks = new ArrayList<Block>(event.getBlocks());
|
||||
List<Block> blocks = new ArrayList<>(event.getBlocks());
|
||||
int originalLength = blocks.size();
|
||||
BlockFace dir = event.getDirection();
|
||||
for (int i = 0; i < blocks.size(); i++) {
|
||||
@ -336,7 +336,7 @@ public void onBlockDamage(BlockDamageEvent event) {
|
||||
|
||||
// Previously, and perhaps still, the only way to catch cake eating
|
||||
// events was through here
|
||||
if (target.getType() == Material.CAKE_BLOCK) {
|
||||
if (target.getType() == Material.CAKE) {
|
||||
Events.fireToCancel(event, new UseBlockEvent(event, create(event.getPlayer()), target));
|
||||
}
|
||||
}
|
||||
@ -354,7 +354,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case PHYSICAL:
|
||||
// Forget about Redstone ore
|
||||
if (Materials.isRedstoneOre(clicked.getType()) || clicked.getType() == Material.SOIL) {
|
||||
if (clicked.getType() == Material.REDSTONE_ORE || clicked.getType() == Material.FARMLAND) {
|
||||
silent = true;
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ private static <T extends Event & Cancellable> void handleBlockRightClick(T even
|
||||
}
|
||||
|
||||
// Handle cocoa beans
|
||||
if (item != null && item.getType() == Material.INK_SACK && Materials.isDyeColor(item.getData(), DyeColor.BROWN)) {
|
||||
if (item != null && item.getType() == Material.COCOA_BEANS) {
|
||||
// CraftBukkit doesn't or didn't throw a clicked place for this
|
||||
if (!(faceClicked == BlockFace.DOWN || faceClicked == BlockFace.UP)) {
|
||||
Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), Material.COCOA));
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -48,19 +51,22 @@ public InvincibilityListener(WorldGuardPlugin plugin) {
|
||||
* @param player The player
|
||||
* @return True if invincible
|
||||
*/
|
||||
private boolean isInvincible(Player player) {
|
||||
return getPlugin().getSessionManager().get(player).isInvincible(player);
|
||||
private boolean isInvincible(LocalPlayer player) {
|
||||
return WorldGuard.getInstance().getPlatform().getSessionManager().get(player).isInvincible(player);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity victim = event.getEntity();
|
||||
BukkitWorldConfiguration worldConfig = getPlugin().getGlobalStateManager().get(victim.getWorld());
|
||||
|
||||
if (victim instanceof Player) {
|
||||
Player player = (Player) victim;
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (isInvincible(player)) {
|
||||
BukkitWorldConfiguration worldConfig =
|
||||
(BukkitWorldConfiguration) WorldGuard.getInstance().getPlatform().getGlobalStateManager().get((World) localPlayer.getExtent());
|
||||
|
||||
if (isInvincible(localPlayer)) {
|
||||
player.setFireTicks(0);
|
||||
event.setCancelled(true);
|
||||
|
||||
@ -84,8 +90,9 @@ public void onEntityCombust(EntityCombustEvent event) {
|
||||
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (isInvincible(player)) {
|
||||
if (isInvincible(localPlayer)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -95,8 +102,9 @@ public void onEntityCombust(EntityCombustEvent event) {
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (event.getFoodLevel() < player.getFoodLevel() && isInvincible(player)) {
|
||||
if (event.getFoodLevel() < player.getFoodLevel() && isInvincible(localPlayer)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.player.ProcessPlayerEvent;
|
||||
@ -62,18 +64,18 @@ private boolean hasAmphibiousGroup(Player player) {
|
||||
|
||||
@EventHandler
|
||||
public void onProcessPlayer(ProcessPlayerEvent event) {
|
||||
ConfigurationManager config = getConfig();
|
||||
Player player = event.getPlayer();
|
||||
Session session = getPlugin().getSessionManager().get(player);
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(localPlayer);
|
||||
|
||||
if (hasGodModeGroup(player) || hasGodModePermission(player)) {
|
||||
if (GodMode.set(player, session, true)) {
|
||||
if (GodMode.set(localPlayer, session, true)) {
|
||||
log.log(Level.INFO, "Enabled auto-god mode for " + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAmphibiousGroup(player)) {
|
||||
if (WaterBreathing.set(player, session, true)) {
|
||||
if (WaterBreathing.set(localPlayer, session, true)) {
|
||||
log.log(Level.INFO, "Enabled water breathing mode for " + player.getName() + " (player is in group 'wg-amphibious')");
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public PlayerMoveListener(WorldGuardPlugin plugin) {
|
||||
}
|
||||
|
||||
public void registerEvents() {
|
||||
if (plugin.getGlobalStateManager().usePlayerMove) {
|
||||
if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().usePlayerMove) {
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
pm.registerEvents(this, plugin);
|
||||
}
|
||||
|
@ -19,8 +19,9 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
|
||||
@ -30,6 +31,7 @@
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
@ -38,11 +40,11 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class RegionFlagsListener extends AbstractListener {
|
||||
|
||||
@ -57,9 +59,10 @@ public RegionFlagsListener(WorldGuardPlugin plugin) {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlaceBlock(final PlaceBlockEvent event) {
|
||||
if (!isRegionSupportEnabled(event.getWorld())) return; // Region support disabled
|
||||
com.sk89q.worldedit.world.World weWorld = BukkitAdapter.adapt(event.getWorld());
|
||||
if (!isRegionSupportEnabled(weWorld)) return; // Region support disabled
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
||||
Block block;
|
||||
if ((block = event.getCause().getFirstBlock()) != null) {
|
||||
@ -71,10 +74,11 @@ public void onPlaceBlock(final PlaceBlockEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onBreakBlock(final BreakBlockEvent event) {
|
||||
if (!isRegionSupportEnabled(event.getWorld())) return; // Region support disabled
|
||||
com.sk89q.worldedit.world.World weWorld = BukkitAdapter.adapt(event.getWorld());
|
||||
if (!isRegionSupportEnabled(weWorld)) return; // Region support disabled
|
||||
|
||||
BukkitWorldConfiguration config = getWorldConfig(event.getWorld());
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
BukkitWorldConfiguration config = getWorldConfig(weWorld);
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
||||
Block block;
|
||||
if ((block = event.getCause().getFirstBlock()) != null) {
|
||||
@ -101,18 +105,20 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
World world = entity.getWorld();
|
||||
|
||||
if (!isRegionSupportEnabled(world)) return; // Region support disabled
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
if (!isRegionSupportEnabled(BukkitAdapter.adapt(world))) return; // Region support disabled
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
||||
if (entity instanceof Player && event.getCause() == DamageCause.FALL) {
|
||||
if (!query.testState(entity.getLocation(), (Player) entity, Flags.FALL_DAMAGE)) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer((Player) entity);
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), localPlayer, Flags.FALL_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (entity instanceof Player && event.getCause() == DamageCause.FLY_INTO_WALL) {
|
||||
if (!query.testState(entity.getLocation(), (Player) entity, Flags.FALL_DAMAGE)) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer((Player) entity);
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), localPlayer, Flags.FALL_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -124,7 +130,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
Entity damager = (((EntityDamageByEntityEvent) event)).getDamager();
|
||||
if (damager != null && damager.getType() == EntityType.FIREWORK) {
|
||||
if (!query.testState(entity.getLocation(), (RegionAssociable) null, Flags.FIREWORK_DAMAGE)) {
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), (RegionAssociable) null, Flags.FIREWORK_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -140,12 +146,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
* @return a predicate
|
||||
*/
|
||||
private Predicate<Location> testState(final RegionQuery query, final StateFlag flag) {
|
||||
return new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(@Nullable Location location) {
|
||||
return query.testState(location, (RegionAssociable) null, flag);
|
||||
}
|
||||
};
|
||||
return location -> query.testState(BukkitAdapter.adapt(location), (RegionAssociable) null, flag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,8 +20,10 @@
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.cause.Cause;
|
||||
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
|
||||
@ -33,19 +35,20 @@
|
||||
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
|
||||
import com.sk89q.worldguard.bukkit.internal.WGMetadata;
|
||||
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
|
||||
import com.sk89q.worldguard.bukkit.protection.DelayedRegionOverlapAssociation;
|
||||
import com.sk89q.worldguard.bukkit.protection.events.DisallowedPVPEvent;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.bukkit.util.Events;
|
||||
import com.sk89q.worldguard.bukkit.util.InteropUtils;
|
||||
import com.sk89q.worldguard.bukkit.util.Materials;
|
||||
import com.sk89q.worldguard.domains.Association;
|
||||
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
|
||||
import com.sk89q.worldguard.protection.association.Associables;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.bukkit.protection.events.DisallowedPVPEvent;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag.State;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -105,7 +108,7 @@ private void tellErrorMessage(DelegateEvent event, Cause cause, Location locatio
|
||||
long now = System.currentTimeMillis();
|
||||
Long lastTime = WGMetadata.getIfPresent(player, DENY_MESSAGE_KEY, Long.class);
|
||||
if (lastTime == null || now - lastTime >= LAST_MESSAGE_DELAY) {
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
String message = query.queryValue(location, player, Flags.DENY_MESSAGE);
|
||||
if (message != null && !message.isEmpty()) {
|
||||
player.sendMessage(message.replace("%what%", what));
|
||||
@ -131,13 +134,14 @@ private boolean isWhitelisted(Cause cause, World world, boolean pvp) {
|
||||
return type == Material.HOPPER || type == Material.DROPPER;
|
||||
} else if (rootCause instanceof Player) {
|
||||
Player player = (Player) rootCause;
|
||||
BukkitWorldConfiguration config = getWorldConfig(world);
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
BukkitWorldConfiguration config = getWorldConfig(BukkitAdapter.adapt(world));
|
||||
|
||||
if (config.fakePlayerBuildOverride && InteropUtils.isFakePlayer(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !pvp && new RegionPermissionModel(getPlugin(), player).mayIgnoreRegionProtection(world);
|
||||
return !pvp && new RegionPermissionModel(localPlayer).mayIgnoreRegionProtection(BukkitAdapter.adapt(world));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -153,10 +157,10 @@ private RegionAssociable createRegionAssociable(Cause cause) {
|
||||
} else if (rootCause instanceof OfflinePlayer) {
|
||||
return getPlugin().wrapOfflinePlayer((OfflinePlayer) rootCause);
|
||||
} else if (rootCause instanceof Entity) {
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
return new DelayedRegionOverlapAssociation(query, ((Entity) rootCause).getLocation());
|
||||
} else if (rootCause instanceof Block) {
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
return new DelayedRegionOverlapAssociation(query, ((Block) rootCause).getLocation());
|
||||
} else {
|
||||
return Associables.constant(Association.NON_MEMBER);
|
||||
@ -170,7 +174,7 @@ public void onPlaceBlock(final PlaceBlockEvent event) {
|
||||
if (isWhitelisted(event.getCause(), event.getWorld(), false)) return; // Whitelisted cause
|
||||
|
||||
final Material type = event.getEffectiveMaterial();
|
||||
final RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
final RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
final RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
// Don't check liquid flow unless it's enabled
|
||||
@ -224,7 +228,7 @@ public void onBreakBlock(final BreakBlockEvent event) {
|
||||
if (!isRegionSupportEnabled(event.getWorld())) return; // Region support disabled
|
||||
if (isWhitelisted(event.getCause(), event.getWorld(), false)) return; // Whitelisted cause
|
||||
|
||||
final RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
final RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
final RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
@ -264,7 +268,7 @@ public void onUseBlock(final UseBlockEvent event) {
|
||||
if (isWhitelisted(event.getCause(), event.getWorld(), false)) return; // Whitelisted cause
|
||||
|
||||
final Material type = event.getEffectiveMaterial();
|
||||
final RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
final RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
final RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
event.filter(new Predicate<Location>() {
|
||||
@ -323,7 +327,7 @@ public void onSpawnEntity(SpawnEntityEvent event) {
|
||||
Location target = event.getTarget();
|
||||
EntityType type = event.getEffectiveType();
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
boolean canSpawn;
|
||||
@ -375,7 +379,7 @@ public void onDestroyEntity(DestroyEntityEvent event) {
|
||||
EntityType type = event.getEntity().getType();
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
boolean canDestroy;
|
||||
String what;
|
||||
|
||||
@ -410,7 +414,7 @@ public void onUseEntity(UseEntityEvent event) {
|
||||
Location target = event.getTarget();
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
boolean canUse;
|
||||
String what;
|
||||
|
||||
@ -448,11 +452,12 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
if (!isRegionSupportEnabled(event.getWorld())) return; // Region support disabled
|
||||
// Whitelist check is below
|
||||
|
||||
Location target = event.getTarget();
|
||||
com.sk89q.worldedit.util.Location target = BukkitAdapter.adapt(event.getTarget());
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
Player playerAttacker = event.getCause().getFirstPlayer();
|
||||
LocalPlayer localAttacker = WorldGuardPlugin.inst().wrapPlayer(playerAttacker);
|
||||
boolean canDamage;
|
||||
String what;
|
||||
|
||||
@ -484,9 +489,9 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
canDamage = query.testBuild(target, associable, combine(event, DefaultFlag.PVP))
|
||||
&& query.queryState(playerAttacker.getLocation(), playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY
|
||||
&& query.queryState(target, playerAttacker, combine(event, DefaultFlag.PVP)) != State.DENY;
|
||||
canDamage = query.testBuild(target, associable, combine(event, Flags.PVP))
|
||||
&& query.queryState(localAttacker.getLocation(), localAttacker, combine(event, Flags.PVP)) != State.DENY
|
||||
&& query.queryState(target, localAttacker, combine(event, Flags.PVP)) != State.DENY;
|
||||
|
||||
// Fire the disallow PVP event
|
||||
if (!canDamage && Events.fireAndTestCancel(new DisallowedPVPEvent(playerAttacker, defender, event.getOriginalEvent()))) {
|
||||
@ -512,7 +517,7 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
}
|
||||
|
||||
if (!canDamage) {
|
||||
tellErrorMessage(event, event.getCause(), target, what);
|
||||
tellErrorMessage(event, event.getCause(), event.getTarget(), what);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -520,15 +525,16 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleExit(VehicleExitEvent event) {
|
||||
Entity vehicle = event.getVehicle();
|
||||
if (!isRegionSupportEnabled(vehicle.getWorld())) return; // Region support disabled
|
||||
if (!isRegionSupportEnabled(BukkitAdapter.adapt(vehicle.getWorld()))) return; // Region support disabled
|
||||
Entity exited = event.getExited();
|
||||
|
||||
if (vehicle instanceof Tameable && exited instanceof Player) {
|
||||
Player player = (Player) exited;
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
if (!isWhitelisted(Cause.create(player), vehicle.getWorld(), false)) {
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
Location location = vehicle.getLocation();
|
||||
if (!query.testBuild(location, player, Flags.RIDE, Flags.INTERACT)) {
|
||||
if (!query.testBuild(BukkitAdapter.adapt(location), localPlayer, Flags.RIDE, Flags.INTERACT)) {
|
||||
long now = System.currentTimeMillis();
|
||||
Long lastTime = WGMetadata.getIfPresent(player, DISEMBARK_MESSAGE_KEY, Long.class);
|
||||
if (lastTime == null || now - lastTime >= LAST_MESSAGE_DELAY) {
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.isBlockWater;
|
||||
@ -42,14 +45,14 @@ private SpongeUtil() {
|
||||
* @param oz The z coordinate of the 'sponge' block
|
||||
*/
|
||||
public static void clearSpongeWater(WorldGuardPlugin plugin, World world, int ox, int oy, int oz) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
|
||||
for (int cx = -wcfg.spongeRadius; cx <= wcfg.spongeRadius; cx++) {
|
||||
for (int cy = -wcfg.spongeRadius; cy <= wcfg.spongeRadius; cy++) {
|
||||
for (int cz = -wcfg.spongeRadius; cz <= wcfg.spongeRadius; cz++) {
|
||||
if (isBlockWater(world, ox + cx, oy + cy, oz + cz)) {
|
||||
world.getBlockAt(ox + cx, oy + cy, oz + cz).setTypeId(0);
|
||||
world.getBlockAt(ox + cx, oy + cy, oz + cz).setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,8 +69,8 @@ public static void clearSpongeWater(WorldGuardPlugin plugin, World world, int ox
|
||||
* @param oz The z coordinate of the 'sponge' block
|
||||
*/
|
||||
public static void addSpongeWater(WorldGuardPlugin plugin, World world, int ox, int oy, int oz) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
|
||||
// The negative x edge
|
||||
int cx = ox - wcfg.spongeRadius - 1;
|
||||
|
@ -21,15 +21,19 @@
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.util.Materials;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -84,7 +88,7 @@ public void registerEvents() {
|
||||
* @return The configuration for {@code world}
|
||||
*/
|
||||
protected BukkitWorldConfiguration getWorldConfig(World world) {
|
||||
return plugin.getGlobalStateManager().get(world);
|
||||
return (BukkitWorldConfiguration) WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(BukkitAdapter.adapt(world));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,12 +128,12 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
|
||||
boolean isAir = blockFrom.getTypeId() == 0;
|
||||
boolean isWater = blockFrom.getType() == Material.WATER;
|
||||
boolean isLava = blockFrom.getType() == Material.LAVA;
|
||||
boolean isAir = blockFrom.getType() == Material.AIR;
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
@ -145,7 +149,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
for (int cy = -wcfg.spongeRadius; cy <= wcfg.spongeRadius; cy++) {
|
||||
for (int cz = -wcfg.spongeRadius; cz <= wcfg.spongeRadius; cz++) {
|
||||
Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
if (sponge.getTypeId() == 19
|
||||
if (sponge.getType() == Material.SPONGE
|
||||
&& (!wcfg.redstoneSponges || !sponge.isBlockIndirectlyPowered())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -169,7 +173,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
// Check the fluid block (from) whether it is air.
|
||||
// If so and the target block is protected, cancel the event
|
||||
if (wcfg.preventWaterDamage.size() > 0) {
|
||||
int targetId = blockTo.getTypeId();
|
||||
Material targetId = blockTo.getType();
|
||||
|
||||
if ((isAir || isWater) &&
|
||||
wcfg.preventWaterDamage.contains(targetId)) {
|
||||
@ -179,7 +183,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.allowedLavaSpreadOver.size() > 0 && isLava) {
|
||||
int targetId = blockTo.getRelative(0, -1, 0).getTypeId();
|
||||
Material targetId = blockTo.getRelative(0, -1, 0).getType();
|
||||
|
||||
if (!wcfg.allowedLavaSpreadOver.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
@ -188,22 +192,22 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.highFreqFlags && isWater
|
||||
&& plugin.getRegionContainer().createQuery().queryState(blockFrom.getLocation(), (RegionAssociable) null, Flags.WATER_FLOW) == StateFlag.State.DENY) {
|
||||
&& WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(blockFrom.getLocation()), (RegionAssociable) null, Flags.WATER_FLOW) == StateFlag.State.DENY) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.highFreqFlags && isLava
|
||||
&& !plugin.getGlobalRegionManager().allows(Flags.LAVA_FLOW,
|
||||
blockFrom.getLocation())) {
|
||||
BukkitAdapter.adapt(blockFrom.getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.disableObsidianGenerators && (isAir || isLava)
|
||||
&& (blockTo.getTypeId() == BlockID.REDSTONE_WIRE
|
||||
|| blockTo.getTypeId() == BlockID.TRIPWIRE)) {
|
||||
blockTo.setTypeId(BlockID.AIR);
|
||||
&& (blockTo.getType() == Material.REDSTONE_WIRE
|
||||
|| blockTo.getType() == Material.TRIPWIRE)) {
|
||||
blockTo.setType(Material.AIR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -217,8 +221,8 @@ public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
Block block = event.getBlock();
|
||||
World world = block.getWorld();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(world);
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
@ -258,18 +262,19 @@ public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
|
||||
if (wcfg.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y - 1, z))
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x + 1, y, z))
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x - 1, y, z))
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z - 1))
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z + 1))) {
|
||||
if (wcfg.disableFireSpreadBlocks.contains(world.getBlockAt(x, y - 1, z).getType())
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockAt(x + 1, y, z).getType())
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockAt(x - 1, y, z).getType())
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockAt(x, y, z - 1).getType())
|
||||
|| wcfg.disableFireSpreadBlocks.contains(world.getBlockAt(x, y, z + 1).getType())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
|
||||
ApplicableRegionSet set =
|
||||
WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(BukkitAdapter.adapt(block.getLocation()));
|
||||
|
||||
if (wcfg.highFreqFlags && isFireSpread
|
||||
&& !set.allows(Flags.FIRE_SPREAD)) {
|
||||
@ -303,8 +308,8 @@ public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
@ -319,21 +324,21 @@ public void onBlockBurn(BlockBurnEvent event) {
|
||||
if (wcfg.fireSpreadDisableToggle) {
|
||||
Block block = event.getBlock();
|
||||
event.setCancelled(true);
|
||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), BlockID.FIRE);
|
||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), Material.FIRE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.disableFireSpreadBlocks.size() > 0) {
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (wcfg.disableFireSpreadBlocks.contains(block.getTypeId())) {
|
||||
if (wcfg.disableFireSpreadBlocks.contains(block.getType())) {
|
||||
event.setCancelled(true);
|
||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), BlockID.FIRE);
|
||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), Material.FIRE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (wcfg.isChestProtected(event.getBlock())) {
|
||||
if (wcfg.isChestProtected(BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -343,17 +348,18 @@ public void onBlockBurn(BlockBurnEvent event) {
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
|
||||
ApplicableRegionSet set =
|
||||
WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(BukkitAdapter.adapt(block.getLocation()));
|
||||
|
||||
if (!set.allows(Flags.FIRE_SPREAD)) {
|
||||
checkAndDestroyAround(block.getWorld(), x, y, z, BlockID.FIRE);
|
||||
checkAndDestroyAround(block.getWorld(), x, y, z, Material.FIRE);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndDestroyAround(World world, int x, int y, int z, int required) {
|
||||
private void checkAndDestroyAround(World world, int x, int y, int z, Material required) {
|
||||
checkAndDestroy(world, x, y, z + 1, required);
|
||||
checkAndDestroy(world, x, y, z - 1, required);
|
||||
checkAndDestroy(world, x, y + 1, z, required);
|
||||
@ -362,9 +368,9 @@ private void checkAndDestroyAround(World world, int x, int y, int z, int require
|
||||
checkAndDestroy(world, x - 1, y, z, required);
|
||||
}
|
||||
|
||||
private void checkAndDestroy(World world, int x, int y, int z, int required) {
|
||||
if (world.getBlockTypeIdAt(x, y, z) == required) {
|
||||
world.getBlockAt(x, y, z).setTypeId(BlockID.AIR);
|
||||
private void checkAndDestroy(World world, int x, int y, int z, Material required) {
|
||||
if (world.getBlockAt(x, y, z).getType() == required) {
|
||||
world.getBlockAt(x, y, z).setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,27 +379,27 @@ private void checkAndDestroy(World world, int x, int y, int z, int required) {
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
int id = event.getBlock().getTypeId();
|
||||
Material id = event.getBlock().getType();
|
||||
|
||||
if (id == 13 && wcfg.noPhysicsGravel) {
|
||||
if (id == Material.GRAVEL && wcfg.noPhysicsGravel) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == 12 && wcfg.noPhysicsSand) {
|
||||
if (id == Material.SAND && wcfg.noPhysicsSand) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == 90 && wcfg.allowPortalAnywhere) {
|
||||
if (id == Material.NETHER_PORTAL && wcfg.allowPortalAnywhere) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -414,8 +420,7 @@ public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block target = event.getBlock();
|
||||
World world = target.getWorld();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(world);
|
||||
|
||||
if (wcfg.simulateSponge && target.getType() == Material.SPONGE) {
|
||||
if (wcfg.redstoneSponges && target.isBlockIndirectlyPowered()) {
|
||||
@ -438,8 +443,7 @@ public void onBlockRedstoneChange(BlockRedstoneEvent event) {
|
||||
Block blockTo = event.getBlock();
|
||||
World world = blockTo.getWorld();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(world);
|
||||
|
||||
if (wcfg.simulateSponge && wcfg.redstoneSponges) {
|
||||
int ox = blockTo.getX();
|
||||
@ -450,10 +454,10 @@ public void onBlockRedstoneChange(BlockRedstoneEvent event) {
|
||||
for (int cy = -1; cy <= 1; cy++) {
|
||||
for (int cz = -1; cz <= 1; cz++) {
|
||||
Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
if (sponge.getTypeId() == 19
|
||||
if (sponge.getType() == Material.SPONGE
|
||||
&& sponge.isBlockIndirectlyPowered()) {
|
||||
SpongeUtil.clearSpongeWater(plugin, world, ox + cx, oy + cy, oz + cz);
|
||||
} else if (sponge.getTypeId() == 19
|
||||
} else if (sponge.getType() == Material.SPONGE
|
||||
&& !sponge.isBlockIndirectlyPowered()) {
|
||||
SpongeUtil.addSpongeWater(plugin, world, ox + cx, oy + cy, oz + cz);
|
||||
}
|
||||
@ -467,8 +471,8 @@ public void onBlockRedstoneChange(BlockRedstoneEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
@ -482,7 +486,7 @@ public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
if (!plugin.getGlobalRegionManager().allows(Flags.LEAF_DECAY,
|
||||
event.getBlock().getLocation())) {
|
||||
BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -493,15 +497,15 @@ public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockForm(BlockFormEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
int type = event.getNewState().getTypeId();
|
||||
Material type = event.getNewState().getType();
|
||||
|
||||
if (event instanceof EntityBlockFormEvent) {
|
||||
if (((EntityBlockFormEvent) event).getEntity() instanceof Snowman) {
|
||||
@ -513,25 +517,25 @@ public void onBlockForm(BlockFormEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == BlockID.ICE) {
|
||||
if (Tag.ICE.isTagged(type)) {
|
||||
if (wcfg.disableIceFormation) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.ICE_FORM, event.getBlock().getLocation())) {
|
||||
Flags.ICE_FORM, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == BlockID.SNOW) {
|
||||
if (type == Material.SNOW) {
|
||||
if (wcfg.disableSnowFormation) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.allowedSnowFallOver.size() > 0) {
|
||||
int targetId = event.getBlock().getRelative(0, -1, 0).getTypeId();
|
||||
Material targetId = event.getBlock().getRelative(0, -1, 0).getType();
|
||||
|
||||
if (!wcfg.allowedSnowFallOver.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
@ -539,7 +543,7 @@ public void onBlockForm(BlockFormEvent event) {
|
||||
}
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.SNOW_FALL, event.getBlock().getLocation())) {
|
||||
Flags.SNOW_FALL, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -551,41 +555,41 @@ public void onBlockForm(BlockFormEvent event) {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockSpread(BlockSpreadEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
int fromType = event.getSource().getTypeId();
|
||||
Material fromType = event.getSource().getType();
|
||||
|
||||
if (fromType == BlockID.RED_MUSHROOM || fromType == BlockID.BROWN_MUSHROOM) {
|
||||
if (Materials.isMushroom(fromType)) {
|
||||
if (wcfg.disableMushroomSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.MUSHROOMS, event.getBlock().getLocation())) {
|
||||
Flags.MUSHROOMS, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fromType == BlockID.GRASS) {
|
||||
if (fromType == Material.GRASS_BLOCK) {
|
||||
if (wcfg.disableGrassGrowth) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.GRASS_SPREAD, event.getBlock().getLocation())) {
|
||||
Flags.GRASS_SPREAD, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fromType == BlockID.MYCELIUM) {
|
||||
if (fromType == Material.MYCELIUM) {
|
||||
if (wcfg.disableMyceliumSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -593,13 +597,13 @@ public void onBlockSpread(BlockSpreadEvent event) {
|
||||
|
||||
if (wcfg.useRegions
|
||||
&& !plugin.getGlobalRegionManager().allows(
|
||||
Flags.MYCELIUM_SPREAD, event.getBlock().getLocation())) {
|
||||
Flags.MYCELIUM_SPREAD, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fromType == BlockID.VINE) {
|
||||
if (fromType == Material.VINE) {
|
||||
if (wcfg.disableVineGrowth) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -607,7 +611,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
|
||||
|
||||
if (wcfg.useRegions
|
||||
&& !plugin.getGlobalRegionManager().allows(
|
||||
Flags.VINE_GROWTH, event.getBlock().getLocation())) {
|
||||
Flags.VINE_GROWTH, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -620,49 +624,41 @@ public void onBlockSpread(BlockSpreadEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||
BukkitWorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
switch (event.getBlock().getTypeId()) {
|
||||
case BlockID.ICE:
|
||||
if (Tag.ICE.isTagged(event.getBlock().getType())) {
|
||||
if (wcfg.disableIceMelting) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.ICE_MELT, event.getBlock().getLocation())) {
|
||||
Flags.ICE_MELT, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.SNOW:
|
||||
} else if (event.getBlock().getType() == Material.SNOW) {
|
||||
if (wcfg.disableSnowMelting) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.SNOW_MELT, event.getBlock().getLocation())) {
|
||||
Flags.SNOW_MELT, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.SOIL:
|
||||
} else if (event.getBlock().getType() == Material.FARMLAND) {
|
||||
if (wcfg.disableSoilDehydration) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
|
||||
Flags.SOIL_DRY, event.getBlock().getLocation())) {
|
||||
Flags.SOIL_DRY, BukkitAdapter.adapt(event.getBlock().getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
import com.sk89q.commandbook.InfoComponent;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
@ -43,8 +44,9 @@ public void onPlayerWhois(InfoComponent.PlayerWhoisEvent event) {
|
||||
if (event.getPlayer() instanceof Player) {
|
||||
Player player = (Player) event.getPlayer();
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
if (plugin.getGlobalStateManager().get(player.getWorld()).useRegions) {
|
||||
ApplicableRegionSet regions = plugin.getRegionContainer().createQuery().getApplicableRegions(player.getLocation());
|
||||
if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(localPlayer.getWorld()).useRegions) {
|
||||
ApplicableRegionSet regions =
|
||||
WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(localPlayer.getLocation());
|
||||
|
||||
// Current regions
|
||||
StringBuilder regionStr = new StringBuilder();
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.bukkit.*;
|
||||
@ -29,6 +30,7 @@
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
@ -74,10 +76,10 @@ public void onEntityInteract(EntityInteractEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
Block block = event.getBlock();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(entity.getWorld());
|
||||
|
||||
if (block.getTypeId() == BlockID.SOIL) {
|
||||
if (block.getType() == Material.FARMLAND) {
|
||||
if (/* entity instanceof Creature && // catch for any entity (not thrown for players) */
|
||||
wcfg.disableCreatureCropTrampling) {
|
||||
event.setCancelled(true);
|
||||
@ -87,7 +89,7 @@ public void onEntityInteract(EntityInteractEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
BukkitWorldConfiguration wcfg = plugin.getGlobalStateManager().get(event.getEntity().getWorld());
|
||||
BukkitWorldConfiguration wcfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(event.getEntity().getWorld());
|
||||
|
||||
if (event instanceof PlayerDeathEvent && wcfg.disableDeathMessages) {
|
||||
((PlayerDeathEvent) event).setDeathMessage("");
|
||||
@ -98,7 +100,7 @@ private void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(defender.getWorld());
|
||||
|
||||
if (defender instanceof Wolf && ((Wolf) defender).isTamed()) {
|
||||
@ -163,7 +165,7 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
BukkitWorldConfiguration wcfg = plugin.getGlobalStateManager().get(defender.getWorld());
|
||||
BukkitWorldConfiguration wcfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(defender.getWorld());
|
||||
|
||||
if (defender instanceof ItemFrame) {
|
||||
if (checkItemFrameProtection(attacker, (ItemFrame) defender)) {
|
||||
@ -181,7 +183,7 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
// this isn't handled elsewhere because ender crystal explosions don't carry a player cause
|
||||
// in the same way that creepers or tnt can
|
||||
if (wcfg.useRegions && wcfg.explosionFlagCancellation) {
|
||||
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(defender.getLocation())
|
||||
if (!WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(defender.getLocation())
|
||||
.testState(null, Flags.OTHER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -228,7 +230,7 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(defender.getLocation());
|
||||
ApplicableRegionSet set = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(defender.getLocation());
|
||||
|
||||
if (!set.allows(Flags.MOB_DAMAGE, localPlayer) && !(attacker instanceof Tameable)) {
|
||||
event.setCancelled(true);
|
||||
@ -257,7 +259,7 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(defender.getWorld());
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player) defender;
|
||||
@ -271,7 +273,7 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions) {
|
||||
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(defender.getLocation()).allows(Flags.MOB_DAMAGE, localPlayer)) {
|
||||
if (!WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(defender.getLocation()).allows(Flags.MOB_DAMAGE, localPlayer)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -290,7 +292,7 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
}
|
||||
if (wcfg.useRegions) {
|
||||
RegionQuery query = plugin.getRegionContainer().createQuery();
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
if (!query.testState(defender.getLocation(), (Player) defender, Flags.GHAST_FIREBALL) && wcfg.explosionFlagCancellation) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -326,7 +328,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(defender.getWorld());
|
||||
|
||||
if (defender instanceof Wolf && ((Wolf) defender).isTamed()) {
|
||||
@ -346,7 +348,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
}
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(defender.getLocation());
|
||||
ApplicableRegionSet set = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(defender.getLocation());
|
||||
|
||||
if (!set.allows(Flags.MOB_DAMAGE, plugin.wrapPlayer(player))) {
|
||||
event.setCancelled(true);
|
||||
@ -365,8 +367,8 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
|
||||
if (type == DamageCause.DROWNING && wcfg.pumpkinScuba
|
||||
&& helmet != null
|
||||
&& (helmet.getTypeId() == BlockID.PUMPKIN
|
||||
|| helmet.getTypeId() == BlockID.JACKOLANTERN)) {
|
||||
&& (helmet.getType() == Material.CARVED_PUMPKIN
|
||||
|| helmet.getType() == Material.JACK_O_LANTERN)) {
|
||||
player.setRemainingAir(player.getMaximumAir());
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -407,7 +409,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
Location l = event.getLocation();
|
||||
World world = l.getWorld();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
@ -467,7 +469,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
// allow wither skull blocking since there is no dedicated flag atm
|
||||
if (wcfg.useRegions) {
|
||||
for (Block block : event.blockList()) {
|
||||
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(block.getLocation()).allows(Flags.GHAST_FIREBALL)) {
|
||||
if (!WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(block.getLocation()).allows(Flags.GHAST_FIREBALL)) {
|
||||
event.blockList().clear();
|
||||
if (wcfg.explosionFlagCancellation) event.setCancelled(true);
|
||||
return;
|
||||
@ -501,7 +503,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (wcfg.useRegions) {
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
|
||||
for (Block block : event.blockList()) {
|
||||
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(block.getLocation()).allows(Flags.OTHER_EXPLOSION)) {
|
||||
if (!WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(block.getLocation()).allows(Flags.OTHER_EXPLOSION)) {
|
||||
event.blockList().clear();
|
||||
if (wcfg.explosionFlagCancellation) event.setCancelled(true);
|
||||
return;
|
||||
@ -527,7 +529,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||
Entity ent = event.getEntity();
|
||||
|
||||
@ -568,7 +570,7 @@ public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
event.setCancelled(true);
|
||||
@ -603,7 +605,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
Location eventLoc = event.getLocation();
|
||||
|
||||
if (wcfg.useRegions && cfg.useRegionsCreatureSpawnEvent) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(eventLoc);
|
||||
ApplicableRegionSet set = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(eventLoc);
|
||||
|
||||
if (!set.allows(Flags.MOB_SPAWNING)) {
|
||||
event.setCancelled(true);
|
||||
@ -627,7 +629,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onCreatePortal(EntityCreatePortalEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||
|
||||
switch (event.getEntityType()) {
|
||||
@ -639,7 +641,7 @@ public void onCreatePortal(EntityCreatePortalEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPigZap(PigZapEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||
|
||||
if (wcfg.disablePigZap) {
|
||||
@ -649,7 +651,7 @@ public void onPigZap(PigZapEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onCreeperPower(CreeperPowerEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||
|
||||
if (wcfg.disableCreeperPower) {
|
||||
@ -663,7 +665,7 @@ public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||
Entity ent = event.getEntity();
|
||||
World world = ent.getWorld();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
|
||||
if (wcfg.disableHealthRegain) {
|
||||
@ -683,7 +685,7 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
Block block = event.getBlock();
|
||||
Location location = block.getLocation();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(ent.getWorld());
|
||||
if (ent instanceof Enderman) {
|
||||
if (wcfg.disableEndermanGriefing) {
|
||||
@ -725,7 +727,7 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
*/
|
||||
private boolean checkItemFrameProtection(Entity attacker, ItemFrame defender) {
|
||||
World world = attacker.getWorld();
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
if (wcfg.useRegions) {
|
||||
// bukkit throws this event when a player attempts to remove an item from a frame
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
@ -69,8 +71,8 @@ public void registerEvents() {
|
||||
public void onHangingBreak(HangingBreakEvent event) {
|
||||
Hanging hanging = event.getEntity();
|
||||
World world = hanging.getWorld();
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
|
||||
if (event instanceof HangingBreakByEntityEvent) {
|
||||
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
|
||||
@ -87,7 +89,8 @@ public void onHangingBreak(HangingBreakEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(Flags.CREEPER_EXPLOSION, hanging.getLocation())) {
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(Flags.CREEPER_EXPLOSION,
|
||||
BukkitAdapter.adapt(hanging.getLocation()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -98,12 +101,12 @@ public void onHangingBreak(HangingBreakEvent event) {
|
||||
if (hanging instanceof Painting
|
||||
&& (wcfg.blockEntityPaintingDestroy
|
||||
|| (wcfg.useRegions
|
||||
&& !plugin.getGlobalRegionManager().allows(Flags.ENTITY_PAINTING_DESTROY, hanging.getLocation())))) {
|
||||
&& !plugin.getGlobalRegionManager().allows(Flags.ENTITY_PAINTING_DESTROY, BukkitAdapter.adapt(hanging.getLocation()))))) {
|
||||
event.setCancelled(true);
|
||||
} else if (hanging instanceof ItemFrame
|
||||
&& (wcfg.blockEntityItemFrameDestroy
|
||||
|| (wcfg.useRegions
|
||||
&& !plugin.getGlobalRegionManager().allows(Flags.ENTITY_ITEM_FRAME_DESTROY, hanging.getLocation())))) {
|
||||
&& !plugin.getGlobalRegionManager().allows(Flags.ENTITY_ITEM_FRAME_DESTROY, BukkitAdapter.adapt(hanging.getLocation()))))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,9 @@
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
@ -97,8 +99,8 @@ public void registerEvents() {
|
||||
@EventHandler
|
||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
BukkitWorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
|
||||
Session session = plugin.getSessionManager().getIfPresent(player);
|
||||
BukkitWorldConfiguration wcfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(player.getWorld());
|
||||
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().getIfPresent(player);
|
||||
if (session != null) {
|
||||
GameModeFlag handler = session.getHandler(GameModeFlag.class);
|
||||
if (handler != null && wcfg.useRegions && !plugin.getGlobalRegionManager().hasBypass(player, player.getWorld())) {
|
||||
@ -116,7 +118,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
World world = player.getWorld();
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
@ -145,16 +147,17 @@ public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
|
||||
Events.fire(new ProcessPlayerEvent(player));
|
||||
|
||||
plugin.getSessionManager().get(player); // Initializes a session
|
||||
WorldGuard.getInstance().getPlatform().getSessionManager().get(player); // Initializes a session
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
BukkitWorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
|
||||
if (wcfg.useRegions) {
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
if (!plugin.getGlobalRegionManager().allows(Flags.SEND_CHAT, player.getLocation(), localPlayer)) {
|
||||
BukkitWorldConfiguration wcfg =
|
||||
(BukkitWorldConfiguration) WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(localPlayer.getWorld());
|
||||
if (wcfg.useRegions) {
|
||||
if (!plugin.getGlobalRegionManager().allows(Flags.SEND_CHAT, localPlayer.getLocation(), localPlayer)) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to chat in this region!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -162,7 +165,8 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
|
||||
for (Iterator<Player> i = event.getRecipients().iterator(); i.hasNext();) {
|
||||
Player rPlayer = i.next();
|
||||
if (!plugin.getGlobalRegionManager().allows(Flags.RECEIVE_CHAT, rPlayer.getLocation(), plugin.wrapPlayer(rPlayer))) {
|
||||
LocalPlayer rLocal = plugin.wrapPlayer(rPlayer);
|
||||
if (!plugin.getGlobalRegionManager().allows(Flags.RECEIVE_CHAT, rLocal.getLocation(), rLocal)) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
@ -175,7 +179,7 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
|
||||
String hostKey = cfg.hostKeys.get(player.getUniqueId().toString());
|
||||
if (hostKey == null) {
|
||||
@ -216,8 +220,8 @@ public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
handlePhysicalInteract(event);
|
||||
}
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
|
||||
if (wcfg.removeInfiniteStacks
|
||||
&& !plugin.hasPermission(player, "worldguard.override.infinite-stack")) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -45,14 +46,14 @@ public void registerEvents() {
|
||||
@EventHandler
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
plugin.getGlobalStateManager().updateCommandBookGodMode();
|
||||
WorldGuard.getInstance().getPlatform().getGlobalStateManager().updateCommandBookGodMode();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
|
||||
plugin.getGlobalStateManager().updateCommandBookGodMode();
|
||||
WorldGuard.getInstance().getPlatform().getGlobalStateManager().updateCommandBookGodMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
@ -58,13 +60,13 @@ public void onVehicleMove(VehicleMoveEvent event) {
|
||||
if (vehicle.getPassenger() == null || !(vehicle.getPassenger() instanceof Player)) return;
|
||||
Player player = (Player) vehicle.getPassenger();
|
||||
World world = vehicle.getWorld();
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
// Did we move a block?
|
||||
if (Locations.isDifferentBlock(event.getFrom(), event.getTo())) {
|
||||
if (null != plugin.getSessionManager().get(player).testMoveTo(player, event.getTo(), MoveType.RIDE)) {
|
||||
if (null != WorldGuard.getInstance().getPlatform().getSessionManager().get(player).testMoveTo(player, event.getTo(), MoveType.RIDE)) {
|
||||
vehicle.setVelocity(new Vector(0,0,0));
|
||||
vehicle.teleport(event.getFrom());
|
||||
}
|
||||
|
@ -19,12 +19,15 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -54,8 +57,8 @@ public void registerEvents() {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onWeatherChange(WeatherChangeEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
if (event.toWeatherState()) {
|
||||
if (wcfg.disableWeather) {
|
||||
@ -70,8 +73,8 @@ public void onWeatherChange(WeatherChangeEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onThunderChange(ThunderChangeEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
if (event.toThunderState()) {
|
||||
if (wcfg.disableThunder) {
|
||||
@ -86,11 +89,11 @@ public void onThunderChange(ThunderChangeEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onLightningStrike(LightningStrikeEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(event.getWorld());
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
if (wcfg.disallowedLightningBlocks.size() > 0) {
|
||||
int targetId = event.getLightning().getLocation().getBlock().getTypeId();
|
||||
Material targetId = event.getLightning().getLocation().getBlock().getType();
|
||||
if (wcfg.disallowedLightningBlocks.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -98,7 +101,8 @@ public void onLightningStrike(LightningStrikeEvent event) {
|
||||
|
||||
Location loc = event.getLightning().getLocation();
|
||||
if (wcfg.useRegions) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().createQuery().getApplicableRegions(loc);
|
||||
ApplicableRegionSet set =
|
||||
WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(BukkitAdapter.adapt(loc));
|
||||
|
||||
if (!set.allows(Flags.LIGHTNING)) {
|
||||
event.setCancelled(true);
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.config.ConfigurationManager;
|
||||
@ -55,7 +57,7 @@ public void registerEvents() {
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
|
||||
if (cfg.activityHaltToggle) {
|
||||
int removed = 0;
|
||||
@ -87,8 +89,8 @@ public void onWorldLoad(WorldLoadEvent event) {
|
||||
* @param world The specified world
|
||||
*/
|
||||
public void initWorld(World world) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = cfg.get(world);
|
||||
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
|
||||
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(world));
|
||||
if (wcfg.alwaysRaining && !wcfg.disableWeather) {
|
||||
world.setStorm(true);
|
||||
} else if (wcfg.disableWeather && !wcfg.alwaysRaining) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
|
||||
@ -39,7 +40,7 @@ public WorldRulesListener(WorldGuardPlugin plugin) {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSpawnEntity(final SpawnEntityEvent event) {
|
||||
BukkitWorldConfiguration config = getWorldConfig(event.getWorld());
|
||||
BukkitWorldConfiguration config = getWorldConfig(BukkitAdapter.adapt(event.getWorld()));
|
||||
|
||||
// ================================================================
|
||||
// EXP_DROPS flag
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener.debounce;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
public class BlockBlockPair {
|
||||
|
||||
private final BlockMaterialPair block1;
|
||||
private final BlockMaterialPair block2;
|
||||
|
||||
public BlockBlockPair(Block block1, Block block2) {
|
||||
this.block1 = new BlockMaterialPair(block1);
|
||||
this.block2 = new BlockMaterialPair(block2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
BlockBlockPair that = (BlockBlockPair) o;
|
||||
|
||||
if (!block1.equals(that.block1)) return false;
|
||||
if (!block2.equals(that.block2)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = block1.hashCode();
|
||||
result = 31 * result + block2.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit.listener.debounce;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BlockMaterialPair {
|
||||
|
||||
private final Block block;
|
||||
private final Material material;
|
||||
|
||||
public BlockMaterialPair(Block block) {
|
||||
checkNotNull(block);
|
||||
this.block = block;
|
||||
this.material = block.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
BlockMaterialPair blockKey = (BlockMaterialPair) o;
|
||||
|
||||
if (!block.equals(blockKey.block)) return false;
|
||||
if (material != blockKey.material) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = block.hashCode();
|
||||
result = 31 * result + material.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -27,7 +27,6 @@
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -53,13 +52,13 @@ public static List<Block> getConnected(Block block) {
|
||||
if (data instanceof Bed) {
|
||||
Bed bed = (Bed) data;
|
||||
if (bed.isHeadOfBed()) {
|
||||
return Arrays.asList(block.getRelative(bed.getFacing().getOppositeFace()));
|
||||
return Collections.singletonList(block.getRelative(bed.getFacing().getOppositeFace()));
|
||||
} else {
|
||||
return Arrays.asList(block.getRelative(bed.getFacing()));
|
||||
return Collections.singletonList(block.getRelative(bed.getFacing()));
|
||||
}
|
||||
} else if (data instanceof Chest) {
|
||||
BlockFace facing = ((Chest) data).getFacing();
|
||||
ArrayList<Block> chests = new ArrayList<Block>();
|
||||
ArrayList<Block> chests = new ArrayList<>();
|
||||
if (facing == BlockFace.NORTH || facing == BlockFace.SOUTH) {
|
||||
if (block.getRelative(BlockFace.EAST).getState().getData() instanceof Chest) {
|
||||
chests.add(block.getRelative(BlockFace.EAST));
|
||||
|
@ -23,11 +23,10 @@
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class InteropUtils {
|
||||
|
||||
|
@ -22,16 +22,19 @@
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.material.Dye;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Material utility class.
|
||||
@ -43,8 +46,8 @@ public final class Materials {
|
||||
private static final int MODIFIES_BLOCKS = 4;
|
||||
|
||||
private static final BiMap<EntityType, Material> ENTITY_ITEMS = HashBiMap.create();
|
||||
private static final Map<Material, Integer> MATERIAL_FLAGS = new HashMap<Material, Integer>();
|
||||
private static final Set<PotionEffectType> DAMAGE_EFFECTS = new HashSet<PotionEffectType>();
|
||||
private static final Map<Material, Integer> MATERIAL_FLAGS = new HashMap<>();
|
||||
private static final Set<PotionEffectType> DAMAGE_EFFECTS = new HashSet<>();
|
||||
|
||||
|
||||
private static Set<Material> shulkerBoxes = new HashSet<>();
|
||||
@ -58,7 +61,7 @@ public final class Materials {
|
||||
shulkerBoxes.add(Material.LIME_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.PINK_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.GRAY_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.SILVER_SHULKER_BOX); // who called this silver?
|
||||
shulkerBoxes.add(Material.LIGHT_GRAY_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.CYAN_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.PURPLE_SHULKER_BOX);
|
||||
shulkerBoxes.add(Material.BLUE_SHULKER_BOX);
|
||||
@ -69,20 +72,19 @@ public final class Materials {
|
||||
|
||||
ENTITY_ITEMS.put(EntityType.PAINTING, Material.PAINTING);
|
||||
ENTITY_ITEMS.put(EntityType.ARROW, Material.ARROW);
|
||||
ENTITY_ITEMS.put(EntityType.SNOWBALL, Material.SNOW_BALL);
|
||||
ENTITY_ITEMS.put(EntityType.FIREBALL, Material.FIREBALL);
|
||||
ENTITY_ITEMS.put(EntityType.SMALL_FIREBALL, Material.FIREWORK_CHARGE);
|
||||
ENTITY_ITEMS.put(EntityType.SNOWBALL, Material.SNOWBALL);
|
||||
ENTITY_ITEMS.put(EntityType.FIREBALL, Material.FIRE_CHARGE);
|
||||
ENTITY_ITEMS.put(EntityType.ENDER_PEARL, Material.ENDER_PEARL);
|
||||
ENTITY_ITEMS.put(EntityType.THROWN_EXP_BOTTLE, Material.EXP_BOTTLE);
|
||||
ENTITY_ITEMS.put(EntityType.THROWN_EXP_BOTTLE, Material.EXPERIENCE_BOTTLE);
|
||||
ENTITY_ITEMS.put(EntityType.ITEM_FRAME, Material.ITEM_FRAME);
|
||||
ENTITY_ITEMS.put(EntityType.PRIMED_TNT, Material.TNT);
|
||||
ENTITY_ITEMS.put(EntityType.FIREWORK, Material.FIREWORK);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_COMMAND, Material.COMMAND_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.BOAT, Material.BOAT);
|
||||
ENTITY_ITEMS.put(EntityType.FIREWORK, Material.FIREWORK_ROCKET);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_COMMAND, Material.COMMAND_BLOCK_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.BOAT, Material.OAK_BOAT);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART, Material.MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_CHEST, Material.STORAGE_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_FURNACE, Material.POWERED_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_TNT, Material.EXPLOSIVE_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_CHEST, Material.CHEST_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_FURNACE, Material.FURNACE_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_TNT, Material.TNT_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.MINECART_HOPPER, Material.HOPPER_MINECART);
|
||||
ENTITY_ITEMS.put(EntityType.SPLASH_POTION, Material.POTION);
|
||||
ENTITY_ITEMS.put(EntityType.EGG, Material.EGG);
|
||||
@ -90,23 +92,17 @@ public final class Materials {
|
||||
|
||||
MATERIAL_FLAGS.put(Material.AIR, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRASS_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIRT, 0);
|
||||
MATERIAL_FLAGS.put(Material.COBBLESTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD, 0);
|
||||
MATERIAL_FLAGS.put(Material.SAPLING, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEDROCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.WATER, 0);
|
||||
MATERIAL_FLAGS.put(Material.STATIONARY_WATER, 0);
|
||||
MATERIAL_FLAGS.put(Material.LAVA, 0);
|
||||
MATERIAL_FLAGS.put(Material.STATIONARY_LAVA, 0);
|
||||
MATERIAL_FLAGS.put(Material.SAND, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRAVEL, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.COAL_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.LOG, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEAVES, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPONGE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.LAPIS_ORE, 0);
|
||||
@ -114,25 +110,21 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.DISPENSER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.SANDSTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.NOTE_BLOCK, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BED_BLOCK, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.POWERED_RAIL, 0);
|
||||
MATERIAL_FLAGS.put(Material.DETECTOR_RAIL, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON_STICKY_BASE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WEB, 0);
|
||||
MATERIAL_FLAGS.put(Material.LONG_GRASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.STICKY_PISTON, 0);
|
||||
MATERIAL_FLAGS.put(Material.COBWEB, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.DEAD_BUSH, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON_BASE, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON_EXTENSION, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOL, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON_MOVING_PIECE, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON, 0);
|
||||
MATERIAL_FLAGS.put(Material.PISTON_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.MOVING_PISTON, 0);
|
||||
MATERIAL_FLAGS.put(Material.YELLOW_FLOWER, 0);
|
||||
MATERIAL_FLAGS.put(Material.RED_ROSE, 0);
|
||||
MATERIAL_FLAGS.put(Material.BROWN_MUSHROOM, 0);
|
||||
MATERIAL_FLAGS.put(Material.RED_MUSHROOM, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.DOUBLE_STEP, 0);
|
||||
MATERIAL_FLAGS.put(Material.STEP, 0);
|
||||
MATERIAL_FLAGS.put(Material.BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.TNT, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BOOKSHELF, 0);
|
||||
@ -141,48 +133,45 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.TORCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIRE, 0);
|
||||
MATERIAL_FLAGS.put(Material.MOB_SPAWNER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHEST, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_WIRE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.WORKBENCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.CROPS, 0);
|
||||
MATERIAL_FLAGS.put(Material.SOIL, 0);
|
||||
MATERIAL_FLAGS.put(Material.CRAFTING_TABLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WHEAT, 0);
|
||||
MATERIAL_FLAGS.put(Material.FARMLAND, 0);
|
||||
MATERIAL_FLAGS.put(Material.FURNACE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BURNING_FURNACE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.SIGN_POST, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_DOOR, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.LADDER, 0);
|
||||
MATERIAL_FLAGS.put(Material.RAILS, 0);
|
||||
MATERIAL_FLAGS.put(Material.RAIL, 0);
|
||||
MATERIAL_FLAGS.put(Material.COBBLESTONE_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.WALL_SIGN, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEVER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.STONE_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_PRESSURE_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_DOOR_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLOWING_REDSTONE_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_TORCH_OFF, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_TORCH_ON, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_WALL_TORCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_TORCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_BUTTON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.SNOW, 0);
|
||||
MATERIAL_FLAGS.put(Material.ICE, 0);
|
||||
MATERIAL_FLAGS.put(Material.SNOW_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.CACTUS, 0);
|
||||
MATERIAL_FLAGS.put(Material.CLAY, 0);
|
||||
MATERIAL_FLAGS.put(Material.SUGAR_CANE_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.SUGAR_CANE, 0);
|
||||
MATERIAL_FLAGS.put(Material.JUKEBOX, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.FENCE, 0);
|
||||
MATERIAL_FLAGS.put(Material.PUMPKIN, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHERRACK, 0);
|
||||
MATERIAL_FLAGS.put(Material.SOUL_SAND, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLOWSTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.PORTAL, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_PORTAL, 0);
|
||||
MATERIAL_FLAGS.put(Material.JACK_O_LANTERN, 0);
|
||||
MATERIAL_FLAGS.put(Material.CAKE_BLOCK, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.DIODE_BLOCK_OFF, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.DIODE_BLOCK_ON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.CAKE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REPEATER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.STAINED_GLASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.TRAP_DOOR, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.MONSTER_EGGS, 0);
|
||||
@ -197,24 +186,20 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.VINE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FENCE_GATE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BRICK_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.SMOOTH_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.MYCEL, 0);
|
||||
MATERIAL_FLAGS.put(Material.WATER_LILY, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_FENCE, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_BRICK_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_WARTS, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENCHANTMENT_TABLE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.ENCHANTING_TABLE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BREWING_STAND, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.CAULDRON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.ENDER_PORTAL, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENDER_PORTAL_FRAME, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENDER_STONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_PORTAL, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_PORTAL_FRAME, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_STONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DRAGON_EGG, MODIFIED_ON_LEFT | MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_LAMP_OFF, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_LAMP_ON, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_DOUBLE_STEP, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_STEP, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_LAMP, 0);
|
||||
MATERIAL_FLAGS.put(Material.COCOA, 0);
|
||||
MATERIAL_FLAGS.put(Material.SANDSTONE_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.EMERALD_ORE, 0);
|
||||
@ -222,26 +207,21 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.TRIPWIRE_HOOK, 0);
|
||||
MATERIAL_FLAGS.put(Material.TRIPWIRE, 0);
|
||||
MATERIAL_FLAGS.put(Material.EMERALD_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPRUCE_WOOD_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.BIRCH_WOOD_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.JUNGLE_WOOD_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND_BLOCK, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BEACON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.COBBLE_WALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.COBBLESTONE_WALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.FLOWER_POT, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.CARROT, 0);
|
||||
MATERIAL_FLAGS.put(Material.POTATO, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_BUTTON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.SKULL, 0);
|
||||
MATERIAL_FLAGS.put(Material.ANVIL, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.TRAPPED_CHEST, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_COMPARATOR_OFF, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_COMPARATOR_ON, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.HEAVY_WEIGHTED_PRESSURE_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_WEIGHTED_PRESSURE_PLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMPARATOR, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.DAYLIGHT_DETECTOR, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.QUARTZ_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_QUARTZ_ORE, 0);
|
||||
MATERIAL_FLAGS.put(Material.HOPPER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.QUARTZ_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.QUARTZ_STAIRS, 0);
|
||||
@ -249,12 +229,9 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.DROPPER, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.STAINED_CLAY, 0);
|
||||
MATERIAL_FLAGS.put(Material.STAINED_GLASS_PANE, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEAVES_2, 0);
|
||||
MATERIAL_FLAGS.put(Material.LOG_2, 0);
|
||||
MATERIAL_FLAGS.put(Material.ACACIA_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.DARK_OAK_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.HAY_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.CARPET, 0);
|
||||
MATERIAL_FLAGS.put(Material.HARD_CLAY, 0);
|
||||
MATERIAL_FLAGS.put(Material.COAL_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.PACKED_ICE, 0);
|
||||
@ -264,13 +241,8 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.SEA_LANTERN, 0);
|
||||
MATERIAL_FLAGS.put(Material.SLIME_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_TRAPDOOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.STANDING_BANNER, 0);
|
||||
MATERIAL_FLAGS.put(Material.WALL_BANNER, 0);
|
||||
MATERIAL_FLAGS.put(Material.DAYLIGHT_DETECTOR_INVERTED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.RED_SANDSTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.RED_SANDSTONE_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.DOUBLE_STONE_SLAB2, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_SLAB2, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPRUCE_FENCE_GATE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BIRCH_FENCE_GATE, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.JUNGLE_FENCE_GATE, MODIFIED_ON_RIGHT);
|
||||
@ -290,23 +262,22 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.GRASS_PATH, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHORUS_PLANT, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHORUS_FLOWER, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEETROOT_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEETROOTS, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_ROD, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_BRICKS, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_STONE_BRICKS, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_GATEWAY, 0);
|
||||
MATERIAL_FLAGS.put(Material.FROSTED_ICE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRASS_PATH, 0);
|
||||
MATERIAL_FLAGS.put(Material.PURPUR_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.PURPUR_STAIRS, 0);
|
||||
MATERIAL_FLAGS.put(Material.PURPUR_PILLAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.PURPUR_SLAB, 0);
|
||||
MATERIAL_FLAGS.put(Material.STRUCTURE_BLOCK, MODIFIED_ON_LEFT | MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND_REPEATING, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND_CHAIN , MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REPEATING_COMMAND_BLOCK, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.CHAIN_COMMAND_BLOCK , MODIFIED_ON_RIGHT);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.MAGMA, 0);
|
||||
MATERIAL_FLAGS.put(Material.MAGMA_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_WART_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.RED_NETHER_BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.RED_NETHER_BRICKS, 0);
|
||||
MATERIAL_FLAGS.put(Material.BONE_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.STRUCTURE_VOID, 0);
|
||||
for (Material m : shulkerBoxes) {
|
||||
@ -324,7 +295,7 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.LIME_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.PINK_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRAY_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.SILVER_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_GRAY_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.CYAN_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.PURPLE_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.BLUE_GLAZED_TERRACOTTA, 0);
|
||||
@ -333,7 +304,7 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.RED_GLAZED_TERRACOTTA, 0);
|
||||
MATERIAL_FLAGS.put(Material.BLACK_GLAZED_TERRACOTTA, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.IRON_SPADE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.IRON_SHOVEL, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.IRON_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FLINT_AND_STEEL, 0);
|
||||
@ -345,34 +316,34 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.IRON_INGOT, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_INGOT, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_SPADE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_SHOVEL, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_SPADE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.STONE_SHOVEL, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.STONE_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.STONE_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_SPADE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_SHOVEL, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.STICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOWL, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSHROOM_SOUP, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_SPADE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSHROOM_STEW, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_SWORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_SHOVEL, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_PICKAXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_AXE, 0);
|
||||
MATERIAL_FLAGS.put(Material.STRING, 0);
|
||||
MATERIAL_FLAGS.put(Material.FEATHER, 0);
|
||||
MATERIAL_FLAGS.put(Material.SULPHUR, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GUNPOWDER, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOODEN_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.STONE_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.IRON_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.SEEDS, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_HOE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.WHEAT_SEEDS, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.WHEAT, 0);
|
||||
MATERIAL_FLAGS.put(Material.BREAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEATHER_HELMET, 0);
|
||||
@ -391,17 +362,16 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_CHESTPLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_LEGGINGS, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_BOOTS, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_HELMET, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_CHESTPLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_LEGGINGS, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_BOOTS, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_HELMET, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_CHESTPLATE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_LEGGINGS, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_BOOTS, 0);
|
||||
MATERIAL_FLAGS.put(Material.FLINT, 0);
|
||||
MATERIAL_FLAGS.put(Material.PORK, 0);
|
||||
MATERIAL_FLAGS.put(Material.GRILLED_PORK, 0);
|
||||
MATERIAL_FLAGS.put(Material.PORKCHOP, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_PORKCHOP, 0);
|
||||
MATERIAL_FLAGS.put(Material.PAINTING, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_APPLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.SIGN, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOOD_DOOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.BUCKET, 0);
|
||||
MATERIAL_FLAGS.put(Material.WATER_BUCKET, 0);
|
||||
MATERIAL_FLAGS.put(Material.LAVA_BUCKET, 0);
|
||||
@ -409,89 +379,122 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.SADDLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_DOOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.SNOW_BALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOAT, 0);
|
||||
MATERIAL_FLAGS.put(Material.SNOWBALL, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.LEATHER, 0);
|
||||
MATERIAL_FLAGS.put(Material.MILK_BUCKET, 0);
|
||||
MATERIAL_FLAGS.put(Material.CLAY_BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.CLAY_BALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.SUGAR_CANE, 0);
|
||||
MATERIAL_FLAGS.put(Material.PAPER, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOOK, 0);
|
||||
MATERIAL_FLAGS.put(Material.SLIME_BALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.STORAGE_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.POWERED_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHEST_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.FURNACE_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.EGG, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMPASS, 0);
|
||||
MATERIAL_FLAGS.put(Material.FISHING_ROD, 0);
|
||||
MATERIAL_FLAGS.put(Material.WATCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.CLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLOWSTONE_DUST, 0);
|
||||
MATERIAL_FLAGS.put(Material.RAW_FISH, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_FISH, 0);
|
||||
MATERIAL_FLAGS.put(Material.INK_SACK, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.COD, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_COD, 0);
|
||||
MATERIAL_FLAGS.put(Material.INK_SAC, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.DANDELION_YELLOW, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.CYAN_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.GRAY_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_BLUE_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_GRAY_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.LIME_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.MAGENTA_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.ORANGE_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.PINK_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.PURPLE_DYE, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.COCOA_BEANS, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.BONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.SUGAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.CAKE, 0);
|
||||
MATERIAL_FLAGS.put(Material.BED, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIODE, 0);
|
||||
MATERIAL_FLAGS.put(Material.BLACK_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BLUE_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BROWN_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.CYAN_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.GRAY_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.GREEN_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_BLUE_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.LIGHT_GRAY_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.LIME_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.MAGENTA_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.ORANGE_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.PINK_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.PURPLE_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.RED_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.WHITE_BED, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.REPEATER, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKIE, 0);
|
||||
MATERIAL_FLAGS.put(Material.MAP, 0);
|
||||
MATERIAL_FLAGS.put(Material.SHEARS, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.MELON, 0);
|
||||
MATERIAL_FLAGS.put(Material.PUMPKIN_SEEDS, 0);
|
||||
MATERIAL_FLAGS.put(Material.MELON_SEEDS, 0);
|
||||
MATERIAL_FLAGS.put(Material.RAW_BEEF, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEEF, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_BEEF, 0);
|
||||
MATERIAL_FLAGS.put(Material.RAW_CHICKEN, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHICKEN, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_CHICKEN, 0);
|
||||
MATERIAL_FLAGS.put(Material.ROTTEN_FLESH, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENDER_PEARL, 0);
|
||||
MATERIAL_FLAGS.put(Material.BLAZE_ROD, 0);
|
||||
MATERIAL_FLAGS.put(Material.GHAST_TEAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_NUGGET, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_STALK, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_WART_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.POTION, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLASS_BOTTLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPIDER_EYE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FERMENTED_SPIDER_EYE, 0);
|
||||
MATERIAL_FLAGS.put(Material.BLAZE_POWDER, 0);
|
||||
MATERIAL_FLAGS.put(Material.MAGMA_CREAM, 0);
|
||||
MATERIAL_FLAGS.put(Material.BREWING_STAND_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.CAULDRON_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.EYE_OF_ENDER, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPECKLED_MELON, 0);
|
||||
MATERIAL_FLAGS.put(Material.BREWING_STAND, 0);
|
||||
MATERIAL_FLAGS.put(Material.CAULDRON, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENDER_EYE, 0);
|
||||
MATERIAL_FLAGS.put(Material.GLISTERING_MELON_SLICE, 0);
|
||||
MATERIAL_FLAGS.put(Material.MONSTER_EGG, 0);
|
||||
MATERIAL_FLAGS.put(Material.EXP_BOTTLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIREBALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOOK_AND_QUILL, 0);
|
||||
MATERIAL_FLAGS.put(Material.EXPERIENCE_BOTTLE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIRE_CHARGE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WRITABLE_BOOK, 0);
|
||||
MATERIAL_FLAGS.put(Material.WRITTEN_BOOK, 0);
|
||||
MATERIAL_FLAGS.put(Material.EMERALD, 0);
|
||||
MATERIAL_FLAGS.put(Material.ITEM_FRAME, 0);
|
||||
MATERIAL_FLAGS.put(Material.FLOWER_POT_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.CARROT_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.POTATO_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.FLOWER_POT, 0);
|
||||
MATERIAL_FLAGS.put(Material.CARROT, 0);
|
||||
MATERIAL_FLAGS.put(Material.POTATO, 0);
|
||||
MATERIAL_FLAGS.put(Material.BAKED_POTATO, 0);
|
||||
MATERIAL_FLAGS.put(Material.POISONOUS_POTATO, 0);
|
||||
MATERIAL_FLAGS.put(Material.EMPTY_MAP, 0);
|
||||
MATERIAL_FLAGS.put(Material.FILLED_MAP, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_CARROT, 0);
|
||||
MATERIAL_FLAGS.put(Material.SKULL_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.CARROT_STICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.CREEPER_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.CREEPER_WALL_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.DRAGON_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.DRAGON_WALL_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.PLAYER_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.PLAYER_WALL_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.ZOMBIE_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.ZOMBIE_WALL_HEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.SKELETON_SKULL, 0);
|
||||
MATERIAL_FLAGS.put(Material.SKELETON_WALL_SKULL, 0);
|
||||
MATERIAL_FLAGS.put(Material.WITHER_SKELETON_SKULL, 0);
|
||||
MATERIAL_FLAGS.put(Material.WITHER_SKELETON_WALL_SKULL, 0);
|
||||
MATERIAL_FLAGS.put(Material.CARROT_ON_A_STICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_STAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.PUMPKIN_PIE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIREWORK, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIREWORK_CHARGE, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIREWORK_ROCKET, 0);
|
||||
MATERIAL_FLAGS.put(Material.FIREWORK_STAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.ENCHANTED_BOOK, 0);
|
||||
MATERIAL_FLAGS.put(Material.REDSTONE_COMPARATOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_BRICK_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMPARATOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.NETHER_BRICKS, 0);
|
||||
MATERIAL_FLAGS.put(Material.QUARTZ, 0);
|
||||
MATERIAL_FLAGS.put(Material.EXPLOSIVE_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.TNT_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.HOPPER_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_BARDING, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_BARDING, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_BARDING, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEASH, 0);
|
||||
MATERIAL_FLAGS.put(Material.LEAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.NAME_TAG, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND_MINECART, 0);
|
||||
MATERIAL_FLAGS.put(Material.COMMAND_BLOCK_MINECART, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.PRISMARINE_SHARD, 0);
|
||||
MATERIAL_FLAGS.put(Material.PRISMARINE_CRYSTALS, 0);
|
||||
@ -501,51 +504,76 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.RABBIT_FOOT, 0);
|
||||
MATERIAL_FLAGS.put(Material.RABBIT_HIDE, 0);
|
||||
MATERIAL_FLAGS.put(Material.ARMOR_STAND, 0);
|
||||
MATERIAL_FLAGS.put(Material.IRON_BARDING, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLD_BARDING, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_BARDING, 0);;
|
||||
MATERIAL_FLAGS.put(Material.IRON_HORSE_ARMOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.GOLDEN_HORSE_ARMOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.DIAMOND_HORSE_ARMOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUTTON, 0);
|
||||
MATERIAL_FLAGS.put(Material.COOKED_MUTTON, 0);
|
||||
MATERIAL_FLAGS.put(Material.BANNER, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPRUCE_DOOR_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.BIRCH_DOOR_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.JUNGLE_DOOR_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.ACACIA_DOOR_ITEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.DARK_OAK_DOOR_ITEM, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.BOAT_SPRUCE, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOAT_BIRCH, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOAT_ACACIA, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOAT_DARK_OAK, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEETROOT, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEETROOT_SOUP, 0);
|
||||
MATERIAL_FLAGS.put(Material.BEETROOT_SEEDS, MODIFIES_BLOCKS);
|
||||
MATERIAL_FLAGS.put(Material.CHORUS_FRUIT, 0);
|
||||
MATERIAL_FLAGS.put(Material.CHORUS_FRUIT_POPPED, 0);
|
||||
MATERIAL_FLAGS.put(Material.POPPED_CHORUS_FRUIT, 0);
|
||||
MATERIAL_FLAGS.put(Material.SHIELD, 0);
|
||||
MATERIAL_FLAGS.put(Material.SPECTRAL_ARROW, 0);
|
||||
MATERIAL_FLAGS.put(Material.TIPPED_ARROW, 0);
|
||||
MATERIAL_FLAGS.put(Material.DRAGONS_BREATH, 0);
|
||||
MATERIAL_FLAGS.put(Material.DRAGON_BREATH, 0);
|
||||
MATERIAL_FLAGS.put(Material.LINGERING_POTION, 0);
|
||||
MATERIAL_FLAGS.put(Material.ELYTRA, 0);
|
||||
MATERIAL_FLAGS.put(Material.END_CRYSTAL, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.TOTEM, 0);
|
||||
MATERIAL_FLAGS.put(Material.TOTEM_OF_UNDYING, 0);
|
||||
MATERIAL_FLAGS.put(Material.SHULKER_SHELL, 0);
|
||||
MATERIAL_FLAGS.put(Material.KNOWLEDGE_BOOK, 0);
|
||||
|
||||
MATERIAL_FLAGS.put(Material.GOLD_RECORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.GREEN_RECORD, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_3, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_4, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_5, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_6, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_7, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_8, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_9, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_10, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_11, 0);
|
||||
MATERIAL_FLAGS.put(Material.RECORD_12, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_11, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_13, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_BLOCKS, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_CAT, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_CHIRP, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_FAR, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_MALL, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_MELLOHI, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_STAL, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_STRAD, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_WAIT, 0);
|
||||
MATERIAL_FLAGS.put(Material.MUSIC_DISC_WARD, 0);
|
||||
|
||||
// Generated via tag
|
||||
for (Material door : Tag.DOORS.getValues()) {
|
||||
MATERIAL_FLAGS.put(door, 0);
|
||||
}
|
||||
for (Material boat : Tag.ITEMS_BOATS.getValues()) {
|
||||
MATERIAL_FLAGS.put(boat, 0);
|
||||
}
|
||||
for (Material banner : Tag.BANNERS.getValues()) {
|
||||
MATERIAL_FLAGS.put(banner, 0);
|
||||
}
|
||||
for (Material slab : Tag.SLABS.getValues()) {
|
||||
MATERIAL_FLAGS.put(slab, 0);
|
||||
}
|
||||
for (Material plank : Tag.PLANKS.getValues()) {
|
||||
MATERIAL_FLAGS.put(plank, 0);
|
||||
}
|
||||
for (Material carpet : Tag.CARPETS.getValues()) {
|
||||
MATERIAL_FLAGS.put(carpet, 0);
|
||||
}
|
||||
for (Material sapling : Tag.SAPLINGS.getValues()) {
|
||||
MATERIAL_FLAGS.put(sapling, 0);
|
||||
}
|
||||
for (Material log : Tag.LOGS.getValues()) {
|
||||
MATERIAL_FLAGS.put(log, 0);
|
||||
}
|
||||
for (Material leaves : Tag.LEAVES.getValues()) {
|
||||
MATERIAL_FLAGS.put(leaves, 0);
|
||||
}
|
||||
for (Material stair : Tag.STAIRS.getValues()) {
|
||||
MATERIAL_FLAGS.put(stair, 0);
|
||||
}
|
||||
for (Material wool : Tag.WOOL.getValues()) {
|
||||
MATERIAL_FLAGS.put(wool, 0);
|
||||
}
|
||||
|
||||
//DAMAGE_EFFECTS.add(PotionEffectType.ABSORPTION);
|
||||
DAMAGE_EFFECTS.add(PotionEffectType.BLINDNESS);
|
||||
@ -607,7 +635,7 @@ public static Material getBucketBlockMaterial(Material type) {
|
||||
switch (type) {
|
||||
case LAVA_BUCKET:
|
||||
return Material.LAVA;
|
||||
case MILK_BUCKET:
|
||||
case WATER_BUCKET:
|
||||
return Material.WATER;
|
||||
default:
|
||||
return Material.WATER;
|
||||
@ -631,7 +659,7 @@ public static boolean isMushroom(Material material) {
|
||||
* @return true if a leaf block
|
||||
*/
|
||||
public static boolean isLeaf(Material material) {
|
||||
return material == Material.LEAVES || material == Material.LEAVES_2;
|
||||
return Tag.LEAVES.getValues().contains(material);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -651,7 +679,7 @@ public static boolean isLiquid(Material material) {
|
||||
* @return true if a water block
|
||||
*/
|
||||
public static boolean isWater(Material material) {
|
||||
return material == Material.WATER || material == Material.STATIONARY_WATER;
|
||||
return material == Material.WATER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -661,7 +689,7 @@ public static boolean isWater(Material material) {
|
||||
* @return true if a lava block
|
||||
*/
|
||||
public static boolean isLava(Material material) {
|
||||
return material == Material.LAVA || material == Material.STATIONARY_LAVA;
|
||||
return material == Material.LAVA;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -671,19 +699,7 @@ public static boolean isLava(Material material) {
|
||||
* @return true if a portal block
|
||||
*/
|
||||
public static boolean isPortal(Material material) {
|
||||
return material == Material.PORTAL || material == Material.ENDER_PORTAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether the given material data is of the given dye color.
|
||||
*
|
||||
* <p>Returns false for non-dyed items.</p>
|
||||
*
|
||||
* @param data the data
|
||||
* @return true if it is the provided dye color
|
||||
*/
|
||||
public static boolean isDyeColor(MaterialData data, DyeColor color) {
|
||||
return data instanceof Dye && ((Dye) data).getColor() == color;
|
||||
return material == Material.NETHER_PORTAL || material == Material.END_PORTAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -693,10 +709,7 @@ public static boolean isDyeColor(MaterialData data, DyeColor color) {
|
||||
* @return true if a rail block
|
||||
*/
|
||||
public static boolean isRailBlock(Material material) {
|
||||
return material == Material.RAILS
|
||||
|| material == Material.ACTIVATOR_RAIL
|
||||
|| material == Material.DETECTOR_RAIL
|
||||
|| material == Material.POWERED_RAIL;
|
||||
return Tag.RAILS.getValues().contains(material);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -707,8 +720,8 @@ public static boolean isRailBlock(Material material) {
|
||||
* @return true if a piston block
|
||||
*/
|
||||
public static boolean isPistonBlock(Material material) {
|
||||
return material == Material.PISTON_BASE
|
||||
|| material == Material.PISTON_STICKY_BASE;
|
||||
return material == Material.PISTON
|
||||
|| material == Material.STICKY_PISTON;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -719,11 +732,11 @@ public static boolean isPistonBlock(Material material) {
|
||||
*/
|
||||
public static boolean isMinecart(Material material) {
|
||||
return material == Material.MINECART
|
||||
|| material == Material.COMMAND_MINECART
|
||||
|| material == Material.EXPLOSIVE_MINECART
|
||||
|| material == Material.COMMAND_BLOCK_MINECART
|
||||
|| material == Material.TNT_MINECART
|
||||
|| material == Material.HOPPER_MINECART
|
||||
|| material == Material.POWERED_MINECART
|
||||
|| material == Material.STORAGE_MINECART;
|
||||
|| material == Material.FURNACE_MINECART
|
||||
|| material == Material.CHEST_MINECART;
|
||||
}
|
||||
/**
|
||||
* Test whether the given material is a Boat.
|
||||
@ -732,12 +745,7 @@ public static boolean isMinecart(Material material) {
|
||||
* @return true if a Boat item
|
||||
*/
|
||||
public static boolean isBoat(Material material) {
|
||||
return material == Material.BOAT
|
||||
|| material == Material.BOAT_ACACIA
|
||||
|| material == Material.BOAT_SPRUCE
|
||||
|| material == Material.BOAT_DARK_OAK
|
||||
|| material == Material.BOAT_JUNGLE
|
||||
|| material == Material.BOAT_BIRCH;
|
||||
return Tag.ITEMS_BOATS.getValues().contains(material);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -751,7 +759,6 @@ public static boolean isInventoryBlock(Material material) {
|
||||
|| material == Material.JUKEBOX
|
||||
|| material == Material.DISPENSER
|
||||
|| material == Material.FURNACE
|
||||
|| material == Material.BURNING_FURNACE
|
||||
|| material == Material.BREWING_STAND
|
||||
|| material == Material.TRAPPED_CHEST
|
||||
|| material == Material.HOPPER
|
||||
@ -770,47 +777,38 @@ public static boolean isInventoryBlock(Material material) {
|
||||
* @return true if covered by the use flag
|
||||
*/
|
||||
public static boolean isUseFlagApplicable(Material material) {
|
||||
if (Tag.BUTTONS.getValues().contains(material)
|
||||
|| Tag.DOORS.getValues().contains(material)
|
||||
|| Tag.WOODEN_PRESSURE_PLATES.getValues().contains(material)) {
|
||||
return true;
|
||||
}
|
||||
switch (material) {
|
||||
case LEVER: return true;
|
||||
case STONE_BUTTON: return true;
|
||||
case WOOD_BUTTON: return true;
|
||||
case TRIPWIRE: return true;
|
||||
case WOODEN_DOOR: return true;
|
||||
case TRAP_DOOR: return true;
|
||||
case FENCE_GATE: return true;
|
||||
case WORKBENCH: return true;
|
||||
case ENCHANTMENT_TABLE: return true;
|
||||
case OAK_TRAPDOOR: return true;
|
||||
case ACACIA_TRAPDOOR: return true;
|
||||
case BIRCH_TRAPDOOR: return true;
|
||||
case DARK_OAK_TRAPDOOR: return true;
|
||||
case IRON_TRAPDOOR: return true;
|
||||
case JUNGLE_TRAPDOOR: return true;
|
||||
case SPRUCE_TRAPDOOR: return true;
|
||||
case ENCHANTING_TABLE: return true;
|
||||
case ENDER_CHEST: return true;
|
||||
case BEACON: return true;
|
||||
case ANVIL: return true;
|
||||
case WOOD_PLATE: return true;
|
||||
case STONE_PLATE: return true;
|
||||
case IRON_PLATE: return true;
|
||||
case GOLD_PLATE: return true;
|
||||
case STONE_PRESSURE_PLATE: return true;
|
||||
case HEAVY_WEIGHTED_PRESSURE_PLATE: return true;
|
||||
case LIGHT_WEIGHTED_PRESSURE_PLATE: return true;
|
||||
case OAK_FENCE_GATE: return true;
|
||||
case SPRUCE_FENCE_GATE: return true;
|
||||
case BIRCH_FENCE_GATE: return true;
|
||||
case JUNGLE_FENCE_GATE: return true;
|
||||
case DARK_OAK_FENCE_GATE: return true;
|
||||
case ACACIA_FENCE_GATE: return true;
|
||||
case SPRUCE_DOOR: return true;
|
||||
case BIRCH_DOOR: return true;
|
||||
case JUNGLE_DOOR: return true;
|
||||
case ACACIA_DOOR: return true;
|
||||
case DARK_OAK_DOOR: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether the given type is Redstone ore.
|
||||
*
|
||||
* @param type the material
|
||||
* @return true if Redstone ore
|
||||
*/
|
||||
public static boolean isRedstoneOre(Material type) {
|
||||
return type == Material.GLOWING_REDSTONE_ORE || type == Material.REDSTONE_ORE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether the given material is a block that is modified when it is
|
||||
* left or right clicked.
|
||||
@ -852,10 +850,8 @@ public static boolean isItemAppliedToBlock(Material item, Material block) {
|
||||
* @return true to be considered as used
|
||||
*/
|
||||
public static boolean isConsideredBuildingIfUsed(Material type) {
|
||||
return type == Material.DIODE_BLOCK_OFF
|
||||
|| type == Material.DIODE_BLOCK_ON
|
||||
|| type == Material.REDSTONE_COMPARATOR_OFF
|
||||
|| type == Material.REDSTONE_COMPARATOR_ON
|
||||
return type == Material.REPEATER
|
||||
|| type == Material.COMPARATOR
|
||||
|| type == Material.FLOWER_POT;
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,11 @@
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.bukkit.BukkitRegionContainer;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.internal.platform.WorldGuardPlatform;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
@ -41,7 +40,7 @@
|
||||
/**
|
||||
* This is the legacy class for accessing region data.
|
||||
*
|
||||
* @deprecated use {@link WorldGuardPlugin#getRegionContainer()}
|
||||
* @deprecated use {@link WorldGuardPlatform#getRegionContainer()}
|
||||
*/
|
||||
@Deprecated
|
||||
public class GlobalRegionManager {
|
||||
@ -70,7 +69,7 @@ public GlobalRegionManager(BukkitRegionContainer container) {
|
||||
*/
|
||||
@Nullable
|
||||
public RegionManager get(World world) {
|
||||
return container.get(BukkitAdapter.adapt(world));
|
||||
return container.get(world);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user