Skip to content

Commit

Permalink
Fix Preventing bed setting of bed respawn in the wilderness without
Browse files Browse the repository at this point in the history
permission.
  • Loading branch information
ElgarL authored and ElgarL committed Apr 19, 2014
1 parent 9d26c7f commit e73a001
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ChangeLog.txt
Expand Up @@ -2026,4 +2026,4 @@ v0.86.0.0:
- Release.
v0.86.0.1:
- Move more Bukkit calls to the BukkitTools class. Code cleaning and organising.

- Fix Preventing bed setting of bed respawn in the wilderness without permission.
Expand Up @@ -500,22 +500,25 @@ public void onPlayerBedEnter(PlayerBedEnterEvent event) {
if (!TownySettings.getBedUse())
return;

WorldCoord worldCoord = new WorldCoord(event.getPlayer().getWorld().getName(), Coord.parseCoord(event.getBed().getLocation()));
boolean isOwner = false;

try {

WorldCoord worldCoord = new WorldCoord(event.getPlayer().getWorld().getName(), Coord.parseCoord(event.getBed().getLocation()));

boolean isOwner = worldCoord.getTownBlock().isOwner(TownyUniverse.getDataSource().getResident(event.getPlayer().getName()));
isOwner = worldCoord.getTownBlock().isOwner(TownyUniverse.getDataSource().getResident(event.getPlayer().getName()));

if (!isOwner) {

event.setCancelled(true);
TownyMessaging.sendErrorMsg(event.getPlayer(), "You do not own the land this bed occupies.");
} catch (NotRegisteredException e) {
// Wilderness as it error'd getting a townblock.
}

if (!isOwner) {

}
event.setCancelled(true);
TownyMessaging.sendErrorMsg(event.getPlayer(), "You do not own the land this bed occupies.");

} catch (NotRegisteredException e) {
e.printStackTrace();
}

}

public boolean onPlayerInteract(Player player, Block block, ItemStack item) {
Expand Down

0 comments on commit e73a001

Please sign in to comment.