mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Fixes #125
This commit is contained in:
parent
bf49ff20d0
commit
239fcc9b2d
@ -45,6 +45,10 @@
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>confuser-repo</id>
|
||||
<url>http://ci.frostcast.net/plugin/repository/everything</url>
|
||||
@ -67,7 +71,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.7.9-R0.2</version>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
|
@ -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;
|
||||
@ -1483,6 +1484,9 @@ public class PlotMain extends JavaPlugin implements Listener {
|
||||
|
||||
// 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,19 +1605,11 @@ 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 false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -471,6 +471,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public static void onInteract(final PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user