mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fixes #125
This commit is contained in:
parent
bf49ff20d0
commit
239fcc9b2d
@ -45,6 +45,10 @@
|
|||||||
<id>bukkit-repo</id>
|
<id>bukkit-repo</id>
|
||||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>confuser-repo</id>
|
<id>confuser-repo</id>
|
||||||
<url>http://ci.frostcast.net/plugin/repository/everything</url>
|
<url>http://ci.frostcast.net/plugin/repository/everything</url>
|
||||||
@ -67,8 +71,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.7.9-R0.2</version>
|
<version>1.8-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>Vault</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
|
@ -88,6 +88,7 @@ import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
|||||||
import com.intellectualcrafters.plot.listeners.ForceFieldListener;
|
import com.intellectualcrafters.plot.listeners.ForceFieldListener;
|
||||||
import com.intellectualcrafters.plot.listeners.InventoryListener;
|
import com.intellectualcrafters.plot.listeners.InventoryListener;
|
||||||
import com.intellectualcrafters.plot.listeners.PlayerEvents;
|
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.PlotListener;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||||
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
||||||
@ -1483,6 +1484,9 @@ public class PlotMain extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
// Main event handler
|
// Main event handler
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
||||||
|
if (checkVersion(1, 8, 0)) {
|
||||||
|
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
||||||
|
}
|
||||||
// World load events
|
// World load events
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
// Info Inventory
|
// Info Inventory
|
||||||
@ -1558,7 +1562,7 @@ public class PlotMain extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
// Handle UUIDS
|
// Handle UUIDS
|
||||||
{
|
{
|
||||||
boolean checkVersion = checkVersion();
|
boolean checkVersion = checkVersion(1, 7, 5);
|
||||||
if (!checkVersion) {
|
if (!checkVersion) {
|
||||||
sendConsoleSenderMessage(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
sendConsoleSenderMessage(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||||
Settings.TITLES = false;
|
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 {
|
try {
|
||||||
String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
|
String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
|
||||||
int a = Integer.parseInt(version[0]);
|
int a = Integer.parseInt(version[0]);
|
||||||
@ -1601,18 +1605,10 @@ public class PlotMain extends JavaPlugin implements Listener {
|
|||||||
if (version.length == 3) {
|
if (version.length == 3) {
|
||||||
c = Integer.parseInt(version[2]);
|
c = Integer.parseInt(version[2]);
|
||||||
}
|
}
|
||||||
if (a < 2) {
|
if (a > major || (a == major && b > minor) || (a == major && b == minor && c >= minor2)) {
|
||||||
if (a < 1) {
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (b < 7) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (b == 7 && c < 5) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -471,6 +471,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public static void onInteract(final PlayerInteractEvent event) {
|
public static void onInteract(final PlayerInteractEvent event) {
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
@ -536,7 +537,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!(reason == CreatureSpawnEvent.SpawnReason.BREEDING) && pW.SPAWN_BREEDING) {
|
} else if (!(reason == CreatureSpawnEvent.SpawnReason.BREEDING) && pW.SPAWN_BREEDING) {
|
||||||
event.setCancelled(true);
|
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -884,7 +885,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
final Player p = (Player) d;
|
final Player p = (Player) d;
|
||||||
final boolean aPlr = a instanceof Player;
|
final boolean aPlr = a instanceof Player;
|
||||||
final PlotWorld pW = getPlotWorld(l.getWorld());
|
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;
|
return;
|
||||||
} else if (aPlr && pW.PVP) {
|
} else if (aPlr && pW.PVP) {
|
||||||
return;
|
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 worldname = Bukkit.getWorlds().get(0).getName();
|
||||||
String foldername;
|
String foldername;
|
||||||
String filename = null;
|
String filename = null;
|
||||||
if (PlotMain.checkVersion()) {
|
if (PlotMain.checkVersion(1, 7, 5)) {
|
||||||
foldername = "playerdata";
|
foldername = "playerdata";
|
||||||
try {
|
try {
|
||||||
filename = op.getUniqueId() +".dat";
|
filename = op.getUniqueId() +".dat";
|
||||||
|
Loading…
Reference in New Issue
Block a user