diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml
index 3210ea27d..1534f2716 100644
--- a/PlotSquared/pom.xml
+++ b/PlotSquared/pom.xml
@@ -45,6 +45,10 @@
bukkit-repo
http://repo.bukkit.org/content/groups/public/
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
confuser-repo
http://ci.frostcast.net/plugin/repository/everything
@@ -67,8 +71,8 @@
org.bukkit
bukkit
- 1.7.9-R0.2
-
+ 1.8-R0.1-SNAPSHOT
+
net.milkbowl.vault
Vault
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
index 7b84bf616..66b15c39e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
@@ -88,6 +88,7 @@ import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.listeners.ForceFieldListener;
import com.intellectualcrafters.plot.listeners.InventoryListener;
import com.intellectualcrafters.plot.listeners.PlayerEvents;
+import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
import com.intellectualcrafters.plot.listeners.PlotListener;
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import com.intellectualcrafters.plot.listeners.WorldEditListener;
@@ -1480,9 +1481,12 @@ public class PlotMain extends JavaPlugin implements Listener {
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
plotCommand.setTabCompleter(command);
}
-
+
// Main event handler
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
+ if (checkVersion(1, 8, 0)) {
+ getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
+ }
// World load events
getServer().getPluginManager().registerEvents(this, this);
// Info Inventory
@@ -1558,7 +1562,7 @@ public class PlotMain extends JavaPlugin implements Listener {
}
// Handle UUIDS
{
- boolean checkVersion = checkVersion();
+ boolean checkVersion = checkVersion(1, 7, 5);
if (!checkVersion) {
sendConsoleSenderMessage(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false;
@@ -1592,7 +1596,7 @@ public class PlotMain extends JavaPlugin implements Listener {
}
}
- public static boolean checkVersion() {
+ public static boolean checkVersion(int major, int minor, int minor2) {
try {
String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
int a = Integer.parseInt(version[0]);
@@ -1601,18 +1605,10 @@ public class PlotMain extends JavaPlugin implements Listener {
if (version.length == 3) {
c = Integer.parseInt(version[2]);
}
- if (a < 2) {
- if (a < 1) {
- return false;
- }
- if (b < 7) {
- return false;
- }
- if (b == 7 && c < 5) {
- return false;
- }
+ if (a > major || (a == major && b > minor) || (a == major && b == minor && c >= minor2)) {
+ return true;
}
- return true;
+ return false;
}
catch (Exception e) {
return false;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index 7c22983cd..358341e47 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -470,6 +470,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
}
}
}
+
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onInteract(final PlayerInteractEvent event) {
@@ -536,7 +537,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.setCancelled(true);
} else if (!(reason == CreatureSpawnEvent.SpawnReason.BREEDING) && pW.SPAWN_BREEDING) {
event.setCancelled(true);
- } else if (!(reason == CreatureSpawnEvent.SpawnReason.CUSTOM) && pW.SPAWN_CUSTOM) {
+ } else if (!(reason == CreatureSpawnEvent.SpawnReason.CUSTOM) && pW.SPAWN_CUSTOM && !(event.getEntityType().getTypeId() == 30)) {
event.setCancelled(true);
}
}
@@ -884,7 +885,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Player p = (Player) d;
final boolean aPlr = a instanceof Player;
final PlotWorld pW = getPlotWorld(l.getWorld());
- if (!aPlr && pW.PVE && (!(a instanceof ItemFrame) && !(a.getEntityId() == 416) ) ) {
+ if (!aPlr && pW.PVE && (!(a instanceof ItemFrame) && !(a.getType().getTypeId() == 30) ) ) {
return;
} else if (aPlr && pW.PVP) {
return;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java
new file mode 100644
index 000000000..320602b6a
--- /dev/null
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java
@@ -0,0 +1,46 @@
+package com.intellectualcrafters.plot.listeners;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
+
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+
+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();
+ if (isPlotWorld(l)) {
+ final Player p = e.getPlayer();
+ if (!isInPlot(l)) {
+ if (!PlotMain.hasPermission(p, "plots.admin.interact.road")) {
+ PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.road");
+ e.setCancelled(true);
+ }
+ } else {
+ final Plot plot = getCurrentPlot(l);
+ if (plot == null || !plot.hasOwner()) {
+ if (!PlotMain.hasPermission(p, "plots.admin.interact.unowned")) {
+ PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.unowned");
+ e.setCancelled(true);
+ }
+ } else if (!plot.hasRights(p)) {
+ if (!PlotMain.hasPermission(p, "plots.admin.interact.other")) {
+ if (isPlotArea(l)) {
+ PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.interact.other");
+ e.setCancelled(true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
index 64d47d602..ce0649211 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
@@ -179,7 +179,7 @@ public class ExpireManager {
String worldname = Bukkit.getWorlds().get(0).getName();
String foldername;
String filename = null;
- if (PlotMain.checkVersion()) {
+ if (PlotMain.checkVersion(1, 7, 5)) {
foldername = "playerdata";
try {
filename = op.getUniqueId() +".dat";