Reorganize classes into different packages.

This commit is contained in:
sk89q 2014-08-11 17:51:00 -07:00
parent 4a501a49db
commit 05369b69b6
34 changed files with 2971 additions and 2989 deletions

View File

@ -33,10 +33,19 @@
import com.sk89q.worldguard.bukkit.commands.GeneralCommands; import com.sk89q.worldguard.bukkit.commands.GeneralCommands;
import com.sk89q.worldguard.bukkit.commands.ProtectionCommands; import com.sk89q.worldguard.bukkit.commands.ProtectionCommands;
import com.sk89q.worldguard.bukkit.commands.ToggleCommands; import com.sk89q.worldguard.bukkit.commands.ToggleCommands;
import com.sk89q.worldguard.internal.listener.BlacklistListener; import com.sk89q.worldguard.bukkit.listener.WorldGuardBlockListener;
import com.sk89q.worldguard.internal.listener.BlockedPotionsListener; import com.sk89q.worldguard.bukkit.listener.WorldGuardCommandBookListener;
import com.sk89q.worldguard.internal.listener.ChestProtectionListener; import com.sk89q.worldguard.bukkit.listener.WorldGuardEntityListener;
import com.sk89q.worldguard.internal.listener.RegionProtectionListener; import com.sk89q.worldguard.bukkit.listener.WorldGuardHangingListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardPlayerListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardServerListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardVehicleListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardWeatherListener;
import com.sk89q.worldguard.bukkit.listener.WorldGuardWorldListener;
import com.sk89q.worldguard.bukkit.listener.BlacklistListener;
import com.sk89q.worldguard.bukkit.listener.BlockedPotionsListener;
import com.sk89q.worldguard.bukkit.listener.ChestProtectionListener;
import com.sk89q.worldguard.bukkit.listener.RegionProtectionListener;
import com.sk89q.worldguard.protection.GlobalRegionManager; import com.sk89q.worldguard.protection.GlobalRegionManager;
import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.util.FatalConfigurationLoadingException; import com.sk89q.worldguard.util.FatalConfigurationLoadingException;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event; package com.sk89q.worldguard.bukkit.event;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;

View File

@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.block; package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import com.sk89q.worldguard.internal.event.AbstractInteractEvent; import com.sk89q.worldguard.bukkit.event.AbstractInteractEvent;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.block; package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.block; package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.block; package com.sk89q.worldguard.bukkit.event.block;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.entity; package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import com.sk89q.worldguard.internal.event.AbstractInteractEvent; import com.sk89q.worldguard.bukkit.event.AbstractInteractEvent;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Event; import org.bukkit.event.Event;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.entity; package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.entity; package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;

View File

@ -17,9 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.entity; package com.sk89q.worldguard.bukkit.event.entity;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.event.inventory; package com.sk89q.worldguard.bukkit.event.inventory;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import com.sk89q.worldguard.internal.event.AbstractInteractEvent; import com.sk89q.worldguard.bukkit.event.AbstractInteractEvent;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.listener; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.bukkit.WorldConfiguration; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.listener; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.blacklist.event.BlockBreakBlacklistEvent; import com.sk89q.worldguard.blacklist.event.BlockBreakBlacklistEvent;
@ -32,13 +32,13 @@
import com.sk89q.worldguard.bukkit.WorldConfiguration; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.bukkit.util.Materials; import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.internal.cause.Causes; import com.sk89q.worldguard.util.cause.Causes;
import com.sk89q.worldguard.internal.event.block.BreakBlockEvent; import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.internal.event.block.PlaceBlockEvent; import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.internal.event.block.UseBlockEvent; import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import com.sk89q.worldguard.internal.event.entity.DestroyEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.DestroyEntityEvent;
import com.sk89q.worldguard.internal.event.entity.SpawnEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.internal.event.inventory.UseItemEvent; import com.sk89q.worldguard.bukkit.event.inventory.UseItemEvent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;

View File

@ -17,14 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.listener; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.bukkit.BukkitUtil; import com.sk89q.worldguard.bukkit.BukkitUtil;
import com.sk89q.worldguard.bukkit.ConfigurationManager; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import com.sk89q.worldguard.bukkit.WorldConfiguration; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.internal.cause.Causes; import com.sk89q.worldguard.util.cause.Causes;
import com.sk89q.worldguard.internal.event.inventory.UseItemEvent; import com.sk89q.worldguard.bukkit.event.inventory.UseItemEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -17,15 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.listener; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldguard.bukkit.WorldConfiguration; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.internal.cause.Causes; import com.sk89q.worldguard.util.cause.Causes;
import com.sk89q.worldguard.internal.event.block.BreakBlockEvent; import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.internal.event.block.PlaceBlockEvent; import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.internal.event.block.UseBlockEvent; import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -22,16 +22,16 @@
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.bukkit.util.Blocks; import com.sk89q.worldguard.bukkit.util.Blocks;
import com.sk89q.worldguard.bukkit.util.Materials; import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.internal.Events; import com.sk89q.worldguard.bukkit.util.Events;
import com.sk89q.worldguard.internal.cause.Cause; import com.sk89q.worldguard.util.cause.Cause;
import com.sk89q.worldguard.internal.cause.Causes; import com.sk89q.worldguard.util.cause.Causes;
import com.sk89q.worldguard.internal.event.block.BreakBlockEvent; import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.internal.event.block.PlaceBlockEvent; import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.internal.event.block.UseBlockEvent; import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import com.sk89q.worldguard.internal.event.entity.DestroyEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.DestroyEntityEvent;
import com.sk89q.worldguard.internal.event.entity.SpawnEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.internal.event.entity.UseEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
import com.sk89q.worldguard.internal.event.inventory.UseItemEvent; import com.sk89q.worldguard.bukkit.event.inventory.UseItemEvent;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -87,13 +87,13 @@
import static com.sk89q.worldguard.bukkit.util.Materials.isBlockModifiedOnClick; import static com.sk89q.worldguard.bukkit.util.Materials.isBlockModifiedOnClick;
import static com.sk89q.worldguard.bukkit.util.Materials.isItemAppliedToBlock; import static com.sk89q.worldguard.bukkit.util.Materials.isItemAppliedToBlock;
import static com.sk89q.worldguard.internal.cause.Causes.create; import static com.sk89q.worldguard.util.cause.Causes.create;
public class CauseListener implements Listener { public class EventAbstractionListener implements Listener {
private final WorldGuardPlugin plugin; private final WorldGuardPlugin plugin;
public CauseListener(WorldGuardPlugin plugin) { public EventAbstractionListener(WorldGuardPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
} }

View File

@ -17,19 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.listener; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.bukkit.util.Entities; import com.sk89q.worldguard.bukkit.util.Entities;
import com.sk89q.worldguard.bukkit.util.Materials; import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.bukkit.util.RegionQuery; import com.sk89q.worldguard.bukkit.util.RegionQuery;
import com.sk89q.worldguard.internal.cause.Causes; import com.sk89q.worldguard.util.cause.Causes;
import com.sk89q.worldguard.internal.event.block.BreakBlockEvent; import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.internal.event.block.PlaceBlockEvent; import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.internal.event.block.UseBlockEvent; import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import com.sk89q.worldguard.internal.event.entity.DestroyEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.DestroyEntityEvent;
import com.sk89q.worldguard.internal.event.entity.SpawnEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.internal.event.entity.UseEntityEvent; import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
import com.sk89q.worldguard.protection.flags.DefaultFlag; import com.sk89q.worldguard.protection.flags.DefaultFlag;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;

View File

@ -17,10 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.commandbook.InfoComponent; import com.sk89q.commandbook.InfoComponent;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,119 +1,122 @@
/* /*
* WorldGuard, a suite of tools for Minecraft * WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com> * Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors * Copyright (C) WorldGuard team and contributors
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or * Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.protection.flags.DefaultFlag; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import org.bukkit.World; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import org.bukkit.entity.Creeper; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.entity.Entity; import com.sk89q.worldguard.protection.flags.DefaultFlag;
import org.bukkit.entity.Hanging; import org.bukkit.World;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Painting; import org.bukkit.entity.Hanging;
import org.bukkit.entity.Player; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Projectile; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler; import org.bukkit.entity.Painting;
import org.bukkit.event.EventPriority; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.entity.Projectile;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.EventHandler;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.EventPriority;
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause; import org.bukkit.event.Listener;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
/** import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
* Listener for painting related events. import org.bukkit.projectiles.ProjectileSource;
*
* @author BangL <henno.rickowski@gmail.com> /**
*/ * Listener for painting related events.
public class WorldGuardHangingListener implements Listener { *
* @author BangL <henno.rickowski@gmail.com>
private WorldGuardPlugin plugin; */
public class WorldGuardHangingListener implements Listener {
/**
* Construct the object; private WorldGuardPlugin plugin;
*
* @param plugin The plugin instance /**
*/ * Construct the object;
public WorldGuardHangingListener(WorldGuardPlugin plugin) { *
this.plugin = plugin; * @param plugin The plugin instance
} */
public WorldGuardHangingListener(WorldGuardPlugin plugin) {
/** this.plugin = plugin;
* Register events. }
*/
public void registerEvents() { /**
plugin.getServer().getPluginManager().registerEvents(this, plugin); * Register events.
} */
public void registerEvents() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) plugin.getServer().getPluginManager().registerEvents(this, plugin);
public void onHangingBreak(HangingBreakEvent event) { }
Hanging hanging = event.getEntity();
World world = hanging.getWorld(); @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
ConfigurationManager cfg = plugin.getGlobalStateManager(); public void onHangingBreak(HangingBreakEvent event) {
WorldConfiguration wcfg = cfg.get(world); Hanging hanging = event.getEntity();
World world = hanging.getWorld();
if (event instanceof HangingBreakByEntityEvent) { ConfigurationManager cfg = plugin.getGlobalStateManager();
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event; WorldConfiguration wcfg = cfg.get(world);
Entity removerEntity = entityEvent.getRemover();
if (removerEntity instanceof Projectile) { if (event instanceof HangingBreakByEntityEvent) {
Projectile projectile = (Projectile) removerEntity; HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
ProjectileSource remover = projectile.getShooter(); Entity removerEntity = entityEvent.getRemover();
removerEntity = (remover instanceof LivingEntity ? (LivingEntity) remover : null); if (removerEntity instanceof Projectile) {
} Projectile projectile = (Projectile) removerEntity;
ProjectileSource remover = projectile.getShooter();
if (!(removerEntity instanceof Player)) { removerEntity = (remover instanceof LivingEntity ? (LivingEntity) remover : null);
if (removerEntity instanceof Creeper) { }
if (wcfg.blockCreeperBlockDamage || wcfg.blockCreeperExplosions) {
event.setCancelled(true); if (!(removerEntity instanceof Player)) {
return; if (removerEntity instanceof Creeper) {
} if (wcfg.blockCreeperBlockDamage || wcfg.blockCreeperExplosions) {
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(DefaultFlag.CREEPER_EXPLOSION, hanging.getLocation())) { event.setCancelled(true);
event.setCancelled(true); return;
return; }
} if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(DefaultFlag.CREEPER_EXPLOSION, hanging.getLocation())) {
} event.setCancelled(true);
return;
// this now covers dispensers as well, if removerEntity is null above, }
// due to a non-LivingEntity ProjectileSource }
if (hanging instanceof Painting
&& (wcfg.blockEntityPaintingDestroy // this now covers dispensers as well, if removerEntity is null above,
|| (wcfg.useRegions // due to a non-LivingEntity ProjectileSource
&& !plugin.getGlobalRegionManager().allows(DefaultFlag.ENTITY_PAINTING_DESTROY, hanging.getLocation())))) { if (hanging instanceof Painting
event.setCancelled(true); && (wcfg.blockEntityPaintingDestroy
} else if (hanging instanceof ItemFrame || (wcfg.useRegions
&& (wcfg.blockEntityItemFrameDestroy && !plugin.getGlobalRegionManager().allows(DefaultFlag.ENTITY_PAINTING_DESTROY, hanging.getLocation())))) {
|| (wcfg.useRegions event.setCancelled(true);
&& !plugin.getGlobalRegionManager().allows(DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, hanging.getLocation())))) { } else if (hanging instanceof ItemFrame
event.setCancelled(true); && (wcfg.blockEntityItemFrameDestroy
} || (wcfg.useRegions
} && !plugin.getGlobalRegionManager().allows(DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, hanging.getLocation())))) {
} else { event.setCancelled(true);
// Explosions from mobs are not covered by HangingBreakByEntity }
if (hanging instanceof Painting && wcfg.blockEntityPaintingDestroy }
&& event.getCause() == RemoveCause.EXPLOSION) { } else {
event.setCancelled(true); // Explosions from mobs are not covered by HangingBreakByEntity
} else if (hanging instanceof ItemFrame && wcfg.blockEntityItemFrameDestroy if (hanging instanceof Painting && wcfg.blockEntityPaintingDestroy
&& event.getCause() == RemoveCause.EXPLOSION) { && event.getCause() == RemoveCause.EXPLOSION) {
event.setCancelled(true); event.setCancelled(true);
} } else if (hanging instanceof ItemFrame && wcfg.blockEntityItemFrameDestroy
} && event.getCause() == RemoveCause.EXPLOSION) {
} event.setCancelled(true);
}
} }
}
}

View File

@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginDisableEvent;

View File

@ -1,72 +1,75 @@
/* /*
* WorldGuard, a suite of tools for Minecraft * WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com> * Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors * Copyright (C) WorldGuard team and contributors
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or * Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import org.bukkit.World; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import org.bukkit.entity.Player; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import org.bukkit.entity.Vehicle; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.event.EventHandler; import org.bukkit.World;
import org.bukkit.event.Listener; import org.bukkit.entity.Player;
import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
public class WorldGuardVehicleListener implements Listener { import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.VehicleMoveEvent;
private WorldGuardPlugin plugin;
public class WorldGuardVehicleListener implements Listener {
/**
* Construct the object; private WorldGuardPlugin plugin;
*
* @param plugin /**
*/ * Construct the object;
public WorldGuardVehicleListener(WorldGuardPlugin plugin) { *
this.plugin = plugin; * @param plugin
} */
public WorldGuardVehicleListener(WorldGuardPlugin plugin) {
/** this.plugin = plugin;
* Register events. }
*/
public void registerEvents() { /**
plugin.getServer().getPluginManager().registerEvents(this, plugin); * Register events.
} */
public void registerEvents() {
@EventHandler plugin.getServer().getPluginManager().registerEvents(this, plugin);
public void onVehicleMove(VehicleMoveEvent event) { }
Vehicle vehicle = event.getVehicle();
if (vehicle.getPassenger() == null @EventHandler
|| !(vehicle.getPassenger() instanceof Player)) return; public void onVehicleMove(VehicleMoveEvent event) {
Player player = (Player) vehicle.getPassenger(); Vehicle vehicle = event.getVehicle();
World world = vehicle.getWorld(); if (vehicle.getPassenger() == null
ConfigurationManager cfg = plugin.getGlobalStateManager(); || !(vehicle.getPassenger() instanceof Player)) return;
WorldConfiguration wcfg = cfg.get(world); Player player = (Player) vehicle.getPassenger();
World world = vehicle.getWorld();
if (wcfg.useRegions) { ConfigurationManager cfg = plugin.getGlobalStateManager();
// Did we move a block? WorldConfiguration wcfg = cfg.get(world);
if (event.getFrom().getBlockX() != event.getTo().getBlockX()
|| event.getFrom().getBlockY() != event.getTo().getBlockY() if (wcfg.useRegions) {
|| event.getFrom().getBlockZ() != event.getTo().getBlockZ()) { // Did we move a block?
boolean result = WorldGuardPlayerListener.checkMove(plugin, player, event.getFrom(), event.getTo()); if (event.getFrom().getBlockX() != event.getTo().getBlockX()
if (result) { || event.getFrom().getBlockY() != event.getTo().getBlockY()
vehicle.setVelocity(new org.bukkit.util.Vector(0,0,0)); || event.getFrom().getBlockZ() != event.getTo().getBlockZ()) {
vehicle.teleport(event.getFrom()); boolean result = WorldGuardPlayerListener.checkMove(plugin, player, event.getFrom(), event.getTo());
} if (result) {
} vehicle.setVelocity(new org.bukkit.util.Vector(0,0,0));
} vehicle.teleport(event.getFrom());
} }
} }
}
}
}

View File

@ -1,111 +1,114 @@
/* /*
* WorldGuard, a suite of tools for Minecraft * WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com> * Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors * Copyright (C) WorldGuard team and contributors
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or * Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
import org.bukkit.Location; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import org.bukkit.event.EventHandler; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import org.bukkit.event.EventPriority; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.event.Listener; import org.bukkit.Location;
import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.EventHandler;
import org.bukkit.event.weather.ThunderChangeEvent; import org.bukkit.event.EventPriority;
import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.Listener;
import com.sk89q.worldedit.Vector; import org.bukkit.event.weather.LightningStrikeEvent;
import com.sk89q.worldguard.protection.ApplicableRegionSet; import org.bukkit.event.weather.ThunderChangeEvent;
import com.sk89q.worldguard.protection.flags.DefaultFlag; import org.bukkit.event.weather.WeatherChangeEvent;
import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
public class WorldGuardWeatherListener implements Listener { import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
/**
* Plugin. public class WorldGuardWeatherListener implements Listener {
*/
private WorldGuardPlugin plugin; /**
* Plugin.
/** */
* Construct the object; private WorldGuardPlugin plugin;
*
* @param plugin The plugin instance /**
*/ * Construct the object;
public WorldGuardWeatherListener(WorldGuardPlugin plugin) { *
this.plugin = plugin; * @param plugin The plugin instance
} */
public WorldGuardWeatherListener(WorldGuardPlugin plugin) {
public void registerEvents() { this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin); }
}
public void registerEvents() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) plugin.getServer().getPluginManager().registerEvents(this, plugin);
public void onWeatherChange(WeatherChangeEvent event) { }
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(event.getWorld()); @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {
if (event.toWeatherState()) { ConfigurationManager cfg = plugin.getGlobalStateManager();
if (wcfg.disableWeather) { WorldConfiguration wcfg = cfg.get(event.getWorld());
event.setCancelled(true);
} if (event.toWeatherState()) {
} else { if (wcfg.disableWeather) {
if (!wcfg.disableWeather && wcfg.alwaysRaining) { event.setCancelled(true);
event.setCancelled(true); }
} } else {
} if (!wcfg.disableWeather && wcfg.alwaysRaining) {
} event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) }
public void onThunderChange(ThunderChangeEvent event) { }
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(event.getWorld()); @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onThunderChange(ThunderChangeEvent event) {
if (event.toThunderState()) { ConfigurationManager cfg = plugin.getGlobalStateManager();
if (wcfg.disableThunder) { WorldConfiguration wcfg = cfg.get(event.getWorld());
event.setCancelled(true);
} if (event.toThunderState()) {
} else { if (wcfg.disableThunder) {
if (!wcfg.disableWeather && wcfg.alwaysThundering) { event.setCancelled(true);
event.setCancelled(true); }
} } else {
} if (!wcfg.disableWeather && wcfg.alwaysThundering) {
} event.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) }
public void onLightningStrike(LightningStrikeEvent event) { }
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(event.getWorld()); @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onLightningStrike(LightningStrikeEvent event) {
if (wcfg.disallowedLightningBlocks.size() > 0) { ConfigurationManager cfg = plugin.getGlobalStateManager();
int targetId = event.getLightning().getLocation().getBlock().getTypeId(); WorldConfiguration wcfg = cfg.get(event.getWorld());
if (wcfg.disallowedLightningBlocks.contains(targetId)) {
event.setCancelled(true); if (wcfg.disallowedLightningBlocks.size() > 0) {
} int targetId = event.getLightning().getLocation().getBlock().getTypeId();
} if (wcfg.disallowedLightningBlocks.contains(targetId)) {
event.setCancelled(true);
Location loc = event.getLightning().getLocation(); }
if (wcfg.useRegions) { }
Vector pt = toVector(loc);
RegionManager mgr = plugin.getGlobalRegionManager().get(loc.getWorld()); Location loc = event.getLightning().getLocation();
ApplicableRegionSet set = mgr.getApplicableRegions(pt); if (wcfg.useRegions) {
Vector pt = toVector(loc);
if (!set.allows(DefaultFlag.LIGHTNING)) { RegionManager mgr = plugin.getGlobalRegionManager().get(loc.getWorld());
event.setCancelled(true); ApplicableRegionSet set = mgr.getApplicableRegions(pt);
}
} if (!set.allows(DefaultFlag.LIGHTNING)) {
} event.setCancelled(true);
} }
}
}
}

View File

@ -1,97 +1,101 @@
/* /*
* WorldGuard, a suite of tools for Minecraft * WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com> * Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors * Copyright (C) WorldGuard team and contributors
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or * Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit.listener;
import org.bukkit.World; import com.sk89q.worldguard.bukkit.BukkitUtil;
import org.bukkit.entity.Entity; import com.sk89q.worldguard.bukkit.ConfigurationManager;
import org.bukkit.event.EventHandler; import com.sk89q.worldguard.bukkit.WorldConfiguration;
import org.bukkit.event.Listener; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.World;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
public class WorldGuardWorldListener implements Listener { import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
private WorldGuardPlugin plugin; import org.bukkit.event.world.WorldLoadEvent;
/** public class WorldGuardWorldListener implements Listener {
* Construct the object;
* private WorldGuardPlugin plugin;
* @param plugin The plugin instance
*/ /**
public WorldGuardWorldListener(WorldGuardPlugin plugin) { * Construct the object;
this.plugin = plugin; *
} * @param plugin The plugin instance
*/
/** public WorldGuardWorldListener(WorldGuardPlugin plugin) {
* Register events. this.plugin = plugin;
*/ }
public void registerEvents() {
plugin.getServer().getPluginManager().registerEvents(this, plugin); /**
} * Register events.
*/
@EventHandler public void registerEvents() {
public void onChunkLoad(ChunkLoadEvent event) { plugin.getServer().getPluginManager().registerEvents(this, plugin);
ConfigurationManager cfg = plugin.getGlobalStateManager(); }
if (cfg.activityHaltToggle) { @EventHandler
int removed = 0; public void onChunkLoad(ChunkLoadEvent event) {
ConfigurationManager cfg = plugin.getGlobalStateManager();
for (Entity entity : event.getChunk().getEntities()) {
if (BukkitUtil.isIntensiveEntity(entity)) { if (cfg.activityHaltToggle) {
entity.remove(); int removed = 0;
removed++;
} for (Entity entity : event.getChunk().getEntities()) {
} if (BukkitUtil.isIntensiveEntity(entity)) {
entity.remove();
if (removed > 50) { removed++;
plugin.getLogger().info("Halt-Act: " + removed + " entities (>50) auto-removed from " }
+ event.getChunk().toString()); }
}
} if (removed > 50) {
} plugin.getLogger().info("Halt-Act: " + removed + " entities (>50) auto-removed from "
+ event.getChunk().toString());
@EventHandler }
public void onWorldLoad(WorldLoadEvent event) { }
initWorld(event.getWorld()); }
}
@EventHandler
/** public void onWorldLoad(WorldLoadEvent event) {
* Initialize the settings for the specified world initWorld(event.getWorld());
* @see WorldConfiguration#alwaysRaining }
* @see WorldConfiguration#disableWeather
* @see WorldConfiguration#alwaysThundering /**
* @see WorldConfiguration#disableThunder * Initialize the settings for the specified world
* @param world The specified world * @see WorldConfiguration#alwaysRaining
*/ * @see WorldConfiguration#disableWeather
public void initWorld(World world) { * @see WorldConfiguration#alwaysThundering
ConfigurationManager cfg = plugin.getGlobalStateManager(); * @see WorldConfiguration#disableThunder
WorldConfiguration wcfg = cfg.get(world); * @param world The specified world
if (wcfg.alwaysRaining && !wcfg.disableWeather) { */
world.setStorm(true); public void initWorld(World world) {
} else if (wcfg.disableWeather && !wcfg.alwaysRaining) { ConfigurationManager cfg = plugin.getGlobalStateManager();
world.setStorm(false); WorldConfiguration wcfg = cfg.get(world);
} if (wcfg.alwaysRaining && !wcfg.disableWeather) {
if (wcfg.alwaysThundering && !wcfg.disableThunder) { world.setStorm(true);
world.setThundering(true); } else if (wcfg.disableWeather && !wcfg.alwaysRaining) {
} else if (wcfg.disableThunder && !wcfg.alwaysThundering) { world.setStorm(false);
world.setStorm(false); }
} if (wcfg.alwaysThundering && !wcfg.disableThunder) {
} world.setThundering(true);
} } else if (wcfg.disableThunder && !wcfg.alwaysThundering) {
world.setStorm(false);
}
}
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal; package com.sk89q.worldguard.bukkit.util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;

View File

@ -1,55 +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.internal;
import org.bukkit.block.Block;
import org.bukkit.block.Hopper;
import org.bukkit.material.Attachable;
import org.bukkit.material.MaterialData;
import javax.annotation.Nullable;
/**
* Block related utility methods.
*/
public final class Blocks {
private Blocks() {
}
/**
* Get the block that this block attaches to.
*
* @param block the block to check
* @return the block attached to or null
*/
@Nullable
public static Block getAttachesTo(Block block) {
MaterialData data = block.getState().getData();
if (data instanceof Attachable) {
Attachable attachable = (Attachable) data;
return block.getRelative(attachable.getAttachedFace());
}
return null;
}
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
/** /**
* Represents a possible cause of an event. * Represents a possible cause of an event.

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldguard.internal.cause; package com.sk89q.worldguard.util.cause;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;