This commit is contained in:
boy0001 2015-02-20 19:51:34 +11:00
parent 202ec71bb2
commit 0dc0b29ea7

View File

@ -147,8 +147,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final StringWrapper name = new StringWrapper(username);
final UUID uuid = UUIDHandler.getUUID(player);
UUIDHandler.add(name, uuid);
Location loc = BukkitUtil.getLocation(player.getLocation());
Plot plot = PlotHelper.getPlot(loc);
final Location loc = BukkitUtil.getLocation(player.getLocation());
final Plot plot = PlotHelper.getPlot(loc);
if (plot == null) {
return;
}
@ -161,14 +161,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void PlayerMove(final PlayerMoveEvent event) {
Location f = BukkitUtil.getLocation(event.getFrom());
Location t = BukkitUtil.getLocation(event.getTo());
final Location f = BukkitUtil.getLocation(event.getFrom());
final Location t = BukkitUtil.getLocation(event.getTo());
if ((f.getX() != t.getX()) || (f.getZ() != t.getZ())) {
final Player player = event.getPlayer();
if (Settings.TELEPORT_DELAY != 0) {
TaskManager.TELEPORT_QUEUE.remove(player.getName());
}
String worldname = t.getWorld();
final String worldname = t.getWorld();
if (!isPlotWorld(worldname)) {
return;
}
@ -183,8 +183,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.getTo().setZ(border);
} else if (t.getZ() < -border) {
event.getTo().setZ(-border);
}
else {
} else {
passed = false;
}
if (passed) {
@ -195,7 +194,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
Plot plot = getCurrentPlot(t);
if (plot != null) {
if (plot.denied.size() > 0) {
UUID uuid = UUIDHandler.getUUID(player);
final UUID uuid = UUIDHandler.getUUID(player);
if (plot.isDenied(uuid)) {
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied");
@ -216,7 +215,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGHEST)
public static void onChat(final AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!isPlotWorld(world)) {
return;
@ -225,19 +224,19 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!plotworld.PLOT_CHAT) {
return;
}
Location loc = BukkitUtil.getLocation(player);
if (getCurrentPlot(loc) == null) {
final Location loc = BukkitUtil.getLocation(player);
final Plot plot = getCurrentPlot(loc);
if (plot == null) {
return;
}
final String message = event.getMessage();
String format = C.PLOT_CHAT_FORMAT.s();
final String sender = event.getPlayer().getDisplayName();
final Plot plot = getCurrentPlot(loc);
final PlotId id = plot.id;
final Set<Player> recipients = event.getRecipients();
recipients.clear();
for (final Player p : Bukkit.getOnlinePlayers()) {
if (getCurrentPlot(p.getLocation()) == plot) {
if (getCurrentPlot(BukkitUtil.getLocation(p)) == plot) {
recipients.add(p);
}
}
@ -248,11 +247,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH)
public static void BlockDestroy(final BlockBreakEvent event) {
final World world = event.getPlayer().getWorld();
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!isPlotWorld(world)) {
return;
}
final Player player = event.getPlayer();
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
final Plot plot = getCurrentPlot(loc);
if (plot != null) {
@ -268,7 +267,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.setCancelled(true);
return;
}
if (!plot.isAdded(event.getPlayer())) {
final UUID uuid = UUIDHandler.getUUID(player);
if (!plot.isAdded(uuid)) {
final Flag destroy = FlagManager.getPlotFlag(plot, "break");
final Block block = event.getBlock();
if ((destroy != null) && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
@ -356,12 +356,15 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.setCancelled(true);
return;
}
} else if (!plot.isAdded(p)) {
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true);
return;
} else {
final UUID uuid = UUIDHandler.getUUID(p);
if (!plot.isAdded(uuid)) {
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
if (isPlotArea(loc)) {
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true);
return;
}
}
}
}
@ -512,7 +515,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (block == null) {
return;
}
final World world = event.getPlayer().getWorld();
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!isPlotWorld(world)) {
return;
}
@ -532,7 +536,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
return;
}
if (!plot.isAdded(player)) {
final UUID uuid = UUIDHandler.getUUID(player);
if (!plot.isAdded(uuid)) {
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
return;
}
@ -1035,7 +1040,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH)
public void BlockCreate(final BlockPlaceEvent event) {
final World world = event.getPlayer().getWorld();
final Player player = event.getPlayer();
final String world = player.getWorld().getName();
if (!isPlotWorld(world)) {
return;
}