mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
PE1_8
This commit is contained in:
parent
a9ef50b6bc
commit
c0cf2f85cc
@ -1,6 +1,7 @@
|
|||||||
package com.intellectualcrafters.plot.listeners;
|
package com.intellectualcrafters.plot.listeners;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -9,13 +10,17 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.BukkitMain;
|
import com.intellectualcrafters.plot.BukkitMain;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public static void onInteract(final PlayerInteractAtEntityEvent e) {
|
public static void onInteract(final PlayerInteractAtEntityEvent e) {
|
||||||
final Location l = e.getRightClicked().getLocation();
|
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
|
||||||
if (isPlotWorld(l)) {
|
if (isPlotWorld(l)) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!isInPlot(l)) {
|
if (!isInPlot(l)) {
|
||||||
@ -24,17 +29,20 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final Plot plot = getCurrentPlot(l);
|
final Plot plot = PlotHelper.getPlot(l);
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasRights(p)) {
|
} else {
|
||||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
UUID uuid = UUIDHandler.getUUID(p);
|
||||||
if (isPlotArea(l)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
||||||
e.setCancelled(true);
|
if (isPlotArea(l)) {
|
||||||
|
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user