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;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -9,13 +10,17 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
|
||||
import com.intellectualcrafters.plot.BukkitMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
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.UUIDHandler;
|
||||
|
||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public static void onInteract(final PlayerInteractAtEntityEvent e) {
|
||||
final Location l = e.getRightClicked().getLocation();
|
||||
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
|
||||
if (isPlotWorld(l)) {
|
||||
final Player p = e.getPlayer();
|
||||
if (!isInPlot(l)) {
|
||||
@ -24,13 +29,15 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
final Plot plot = getCurrentPlot(l);
|
||||
final Plot plot = PlotHelper.getPlot(l);
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.unowned")) {
|
||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.hasRights(p)) {
|
||||
} else {
|
||||
UUID uuid = UUIDHandler.getUUID(p);
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (!BukkitMain.hasPermission(p, "plots.admin.interact.other")) {
|
||||
if (isPlotArea(l)) {
|
||||
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
@ -41,4 +48,5 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user