mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
.
This commit is contained in:
parent
202ec71bb2
commit
0dc0b29ea7
@ -147,8 +147,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final StringWrapper name = new StringWrapper(username);
|
final StringWrapper name = new StringWrapper(username);
|
||||||
final UUID uuid = UUIDHandler.getUUID(player);
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
UUIDHandler.add(name, uuid);
|
UUIDHandler.add(name, uuid);
|
||||||
Location loc = BukkitUtil.getLocation(player.getLocation());
|
final Location loc = BukkitUtil.getLocation(player.getLocation());
|
||||||
Plot plot = PlotHelper.getPlot(loc);
|
final Plot plot = PlotHelper.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,14 +161,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public static void PlayerMove(final PlayerMoveEvent event) {
|
public static void PlayerMove(final PlayerMoveEvent event) {
|
||||||
Location f = BukkitUtil.getLocation(event.getFrom());
|
final Location f = BukkitUtil.getLocation(event.getFrom());
|
||||||
Location t = BukkitUtil.getLocation(event.getTo());
|
final Location t = BukkitUtil.getLocation(event.getTo());
|
||||||
if ((f.getX() != t.getX()) || (f.getZ() != t.getZ())) {
|
if ((f.getX() != t.getX()) || (f.getZ() != t.getZ())) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (Settings.TELEPORT_DELAY != 0) {
|
if (Settings.TELEPORT_DELAY != 0) {
|
||||||
TaskManager.TELEPORT_QUEUE.remove(player.getName());
|
TaskManager.TELEPORT_QUEUE.remove(player.getName());
|
||||||
}
|
}
|
||||||
String worldname = t.getWorld();
|
final String worldname = t.getWorld();
|
||||||
if (!isPlotWorld(worldname)) {
|
if (!isPlotWorld(worldname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,8 +183,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
event.getTo().setZ(border);
|
event.getTo().setZ(border);
|
||||||
} else if (t.getZ() < -border) {
|
} else if (t.getZ() < -border) {
|
||||||
event.getTo().setZ(-border);
|
event.getTo().setZ(-border);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
if (passed) {
|
if (passed) {
|
||||||
@ -195,7 +194,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
Plot plot = getCurrentPlot(t);
|
Plot plot = getCurrentPlot(t);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (plot.denied.size() > 0) {
|
if (plot.denied.size() > 0) {
|
||||||
UUID uuid = UUIDHandler.getUUID(player);
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
if (plot.isDenied(uuid)) {
|
if (plot.isDenied(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
||||||
PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "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)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public static void onChat(final AsyncPlayerChatEvent event) {
|
public static void onChat(final AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final String world = player.getWorld().getName();
|
final String world = player.getWorld().getName();
|
||||||
if (!isPlotWorld(world)) {
|
if (!isPlotWorld(world)) {
|
||||||
return;
|
return;
|
||||||
@ -225,19 +224,19 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (!plotworld.PLOT_CHAT) {
|
if (!plotworld.PLOT_CHAT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location loc = BukkitUtil.getLocation(player);
|
final Location loc = BukkitUtil.getLocation(player);
|
||||||
if (getCurrentPlot(loc) == null) {
|
final Plot plot = getCurrentPlot(loc);
|
||||||
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String message = event.getMessage();
|
final String message = event.getMessage();
|
||||||
String format = C.PLOT_CHAT_FORMAT.s();
|
String format = C.PLOT_CHAT_FORMAT.s();
|
||||||
final String sender = event.getPlayer().getDisplayName();
|
final String sender = event.getPlayer().getDisplayName();
|
||||||
final Plot plot = getCurrentPlot(loc);
|
|
||||||
final PlotId id = plot.id;
|
final PlotId id = plot.id;
|
||||||
final Set<Player> recipients = event.getRecipients();
|
final Set<Player> recipients = event.getRecipients();
|
||||||
recipients.clear();
|
recipients.clear();
|
||||||
for (final Player p : Bukkit.getOnlinePlayers()) {
|
for (final Player p : Bukkit.getOnlinePlayers()) {
|
||||||
if (getCurrentPlot(p.getLocation()) == plot) {
|
if (getCurrentPlot(BukkitUtil.getLocation(p)) == plot) {
|
||||||
recipients.add(p);
|
recipients.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,11 +247,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public static void BlockDestroy(final BlockBreakEvent event) {
|
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)) {
|
if (!isPlotWorld(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
|
final Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||||
final Plot plot = getCurrentPlot(loc);
|
final Plot plot = getCurrentPlot(loc);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
@ -268,7 +267,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(event.getPlayer())) {
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
|
if (!plot.isAdded(uuid)) {
|
||||||
final Flag destroy = FlagManager.getPlotFlag(plot, "break");
|
final Flag destroy = FlagManager.getPlotFlag(plot, "break");
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
if ((destroy != null) && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
if ((destroy != null) && ((HashSet<PlotBlock>) destroy.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||||
@ -356,7 +356,9 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(p)) {
|
} else {
|
||||||
|
final UUID uuid = UUIDHandler.getUUID(p);
|
||||||
|
if (!plot.isAdded(uuid)) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) {
|
||||||
if (isPlotArea(loc)) {
|
if (isPlotArea(loc)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other");
|
||||||
@ -368,6 +370,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public static void onEntityBlockForm(final EntityBlockFormEvent e) {
|
public static void onEntityBlockForm(final EntityBlockFormEvent e) {
|
||||||
@ -512,7 +515,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (block == null) {
|
if (block == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final World world = event.getPlayer().getWorld();
|
final Player player = event.getPlayer();
|
||||||
|
final String world = player.getWorld().getName();
|
||||||
if (!isPlotWorld(world)) {
|
if (!isPlotWorld(world)) {
|
||||||
return;
|
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()))) {
|
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player)) {
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
|
if (!plot.isAdded(uuid)) {
|
||||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1035,7 +1040,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void BlockCreate(final BlockPlaceEvent event) {
|
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)) {
|
if (!isPlotWorld(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user