fixed logical error in playerlistener

This commit is contained in:
Redecouverte 2011-02-26 01:08:18 +01:00
parent 9d813290c6
commit 7bedf6bb15
2 changed files with 33 additions and 39 deletions

View File

@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard.bukkit;
import com.nijikokun.bukkit.iConomy.iConomy;
@ -41,11 +40,11 @@
* Handles all events thrown in relation to a Player
*/
public class WorldGuardPlayerListener extends PlayerListener {
/**
* Plugin.
*/
private WorldGuardPlugin plugin;
private boolean checkediConomy = false;
/**
@ -109,8 +108,7 @@ public void onPlayerQuit(PlayerEvent event) {
@Override
public void onPlayerItem(PlayerItemEvent event) {
if(event.isCancelled())
{
if (event.isCancelled()) {
return;
}
@ -154,8 +152,7 @@ public void onPlayerItem(PlayerItemEvent event) {
Vector pt = toVector(block.getRelative(event.getBlockFace()));
RegionManager mgr = plugin.getGlobalRegionManager().getRegionManager(player.getWorld().getName());
if (!mgr.getApplicableRegions(pt)
.allowsFlag(AreaFlags.FLAG_LIGHTER)) {
if (!mgr.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_LIGHTER)) {
event.setCancelled(true);
return;
}
@ -213,9 +210,7 @@ public void onPlayerDropItem(PlayerDropItemEvent event) {
Item ci = event.getItemDrop();
if (!wcfg.getBlacklist().check(
new ItemDropBlacklistEvent(BukkitPlayer.wrapPlayer(cfg, event
.getPlayer()), toVector(ci.getLocation()), ci
.getItemStack().getTypeId()), false, false)) {
new ItemDropBlacklistEvent(BukkitPlayer.wrapPlayer(cfg, event.getPlayer()), toVector(ci.getLocation()), ci.getItemStack().getTypeId()), false, false)) {
event.setCancelled(true);
return;
}
@ -242,9 +237,7 @@ public void onPlayerPickupItem(PlayerPickupItemEvent event) {
Item ci = event.getItem();
if (!wcfg.getBlacklist().check(
new ItemAcquireBlacklistEvent(BukkitPlayer.wrapPlayer(cfg, event
.getPlayer()), toVector(ci.getLocation()), ci
.getItemStack().getTypeId()), false, false)) {
new ItemAcquireBlacklistEvent(BukkitPlayer.wrapPlayer(cfg, event.getPlayer()), toVector(ci.getLocation()), ci.getItemStack().getTypeId()), false, false)) {
event.setCancelled(true);
return;
}
@ -267,14 +260,17 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
String spawnconfig = regions.getAreaFlag("spawn", "settings", true, null);
Location spawn = regions.getLocationAreaFlag("spawn", player.getServer(), true, null);
if(spawnconfig.equals("owner") && regions.isOwner(localPlayer)){
if (spawnconfig.equals("owner")) {
if (regions.isOwner(localPlayer)) {
player.teleportTo(spawn);
} else if (spawnconfig.equals("member") && regions.isMember(localPlayer)) {
}
} else if (spawnconfig.equals("member")) {
if (regions.isMember(localPlayer)) {
player.teleportTo(spawn);
}
} else {
player.teleportTo(spawn);
}
}
}

View File

@ -157,8 +157,6 @@ public ApplicableRegionSet getApplicableRegions(Vector pt) {
}
}
// this allows parents not to overlap with their childs
return new ApplicableRegionSet(pt, appRegions, global);
}