mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 21:15:57 +01:00
fixed logical error in playerlistener
This commit is contained in:
parent
9d813290c6
commit
7bedf6bb15
@ -15,8 +15,7 @@
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -124,7 +122,7 @@ public void onPlayerItem(PlayerItemEvent event) {
|
||||
if (!wcfg.itemDurability) {
|
||||
// Hoes
|
||||
if (item.getTypeId() >= 290 && item.getTypeId() <= 294) {
|
||||
item.setDurability((byte)-1);
|
||||
item.setDurability((byte) -1);
|
||||
player.setItemInHand(item);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -185,7 +182,7 @@ public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
}
|
||||
|
||||
if (!checkediConomy) {
|
||||
iConomy iconomy = (iConomy)plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
iConomy iconomy = (iConomy) plugin.getServer().getPluginManager().getPlugin("iConomy");
|
||||
if (iconomy != null) {
|
||||
plugin.getWgConfiguration().setiConomy(iconomy);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -157,8 +157,6 @@ public ApplicableRegionSet getApplicableRegions(Vector pt) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this allows parents not to overlap with their childs
|
||||
return new ApplicableRegionSet(pt, appRegions, global);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user