mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
SO MANY!!!! bug fixes
This commit is contained in:
parent
30f1f829cb
commit
2a35ec963c
@ -33,12 +33,9 @@ public class PWE {
|
|||||||
Plot plot = PlotMain.getPlots(l.getWorld()).get(id);
|
Plot plot = PlotMain.getPlots(l.getWorld()).get(id);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
boolean r;
|
boolean r;
|
||||||
r = (plot.getOwner() != null) && plot.getOwner().equals(p.getUniqueId());
|
r = (plot.getOwner() != null) && plot.getOwner().equals(p.getUniqueId()) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId());
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if ((plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
if (p.hasPermission("plots.worldedit.bypass")) {
|
||||||
r = true;
|
|
||||||
} else if (p.hasPermission("plots.worldedit.bypass")) {
|
|
||||||
removeMask(p, s);
|
removeMask(p, s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UUIDHandler.startFetch(this);
|
// UUIDHandler.startFetch(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ import static com.intellectualcrafters.plot.PlotWorld.TOP_BLOCK_DEFAULT;
|
|||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_BLOCK_DEFAULT;
|
import static com.intellectualcrafters.plot.PlotWorld.WALL_BLOCK_DEFAULT;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_FILLING_DEFAULT;
|
import static com.intellectualcrafters.plot.PlotWorld.WALL_FILLING_DEFAULT;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
|
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.MOB_SPAWNING_DEFAULT;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -94,7 +95,7 @@ public class PlotSquaredGen extends ChunkGenerator {
|
|||||||
YamlConfiguration config = PlotMain.config;
|
YamlConfiguration config = PlotMain.config;
|
||||||
this.plotworld = new PlotWorld();
|
this.plotworld = new PlotWorld();
|
||||||
Map<String, Object> options = new HashMap<String, Object>();
|
Map<String, Object> options = new HashMap<String, Object>();
|
||||||
|
options.put("worlds." + world + ".natural_mob_spawning", MOB_SPAWNING_DEFAULT);
|
||||||
options.put("worlds." + world + ".plot.auto_merge", AUTO_MERGE_DEFAULT);
|
options.put("worlds." + world + ".plot.auto_merge", AUTO_MERGE_DEFAULT);
|
||||||
options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
|
options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
|
||||||
options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
|
options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
|
||||||
@ -137,6 +138,7 @@ public class PlotSquaredGen extends ChunkGenerator {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
|
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
|
||||||
}
|
}
|
||||||
|
this.plotworld.MOB_SPAWNING = config.getBoolean("worlds." + world + ".natural_mob_spawning");
|
||||||
this.plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
|
this.plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
|
||||||
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
|
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
|
||||||
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
|
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
|
||||||
@ -210,7 +212,13 @@ public class PlotSquaredGen extends ChunkGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
public List<BlockPopulator> getDefaultPopulators(World world) {
|
||||||
|
if (!this.plotworld.MOB_SPAWNING) {
|
||||||
world.setSpawnFlags(false, false);
|
world.setSpawnFlags(false, false);
|
||||||
|
world.setAmbientSpawnLimit(0);
|
||||||
|
world.setAnimalSpawnLimit(0);
|
||||||
|
world.setMonsterSpawnLimit(0);
|
||||||
|
world.setWaterAnimalSpawnLimit(0);
|
||||||
|
}
|
||||||
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
|
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ public class PlotWorld {
|
|||||||
|
|
||||||
public boolean AUTO_MERGE;
|
public boolean AUTO_MERGE;
|
||||||
public static boolean AUTO_MERGE_DEFAULT = false;
|
public static boolean AUTO_MERGE_DEFAULT = false;
|
||||||
|
public boolean MOB_SPAWNING;
|
||||||
|
public static boolean MOB_SPAWNING_DEFAULT = false;
|
||||||
/**
|
/**
|
||||||
* Road Height
|
* Road Height
|
||||||
*/
|
*/
|
||||||
|
@ -86,6 +86,10 @@ public enum Command {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SET("set", "s"),
|
SET("set", "s"),
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
SETUP("setup"),
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -32,9 +32,9 @@ public class Denied extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBeenOnServer(String name) {
|
private boolean hasBeenOnServer(String name) {
|
||||||
Player plr = Bukkit.getPlayerExact(name);
|
Player plr = Bukkit.getPlayer(name);
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer oplr = Bukkit.getPlayer(name);
|
||||||
if (oplr == null) {
|
if (oplr == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -77,8 +77,8 @@ public class Denied extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if ((Bukkit.getPlayerExact(args[1]) != null)) {
|
if ((Bukkit.getPlayer(args[1]) != null)) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
@ -115,8 +115,8 @@ public class Denied extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (Bukkit.getPlayerExact(args[1])!=null) {
|
if (Bukkit.getPlayer(args[1])!=null) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class Helpers extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBeenOnServer(String name) {
|
private boolean hasBeenOnServer(String name) {
|
||||||
Player plr = Bukkit.getPlayerExact(name);
|
Player plr = Bukkit.getPlayer(name);
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
||||||
if (oplr == null) {
|
if (oplr == null) {
|
||||||
@ -74,8 +74,8 @@ public class Helpers extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if ((Bukkit.getPlayerExact(args[1]) != null)) {
|
if ((Bukkit.getPlayer(args[1]) != null)) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
@ -105,8 +105,8 @@ public class Helpers extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (Bukkit.getPlayerExact(args[1]) != null) {
|
if (Bukkit.getPlayer(args[1]) != null) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public class Info extends SubCommand {
|
|||||||
|
|
||||||
String info = C.PLOT_INFO.s();
|
String info = C.PLOT_INFO.s();
|
||||||
info = info.replaceAll("%alias%", plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none");
|
info = info.replaceAll("%alias%", plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none");
|
||||||
info = info.replaceAll("%id%", plot.id.x + ";" + plot.id.y);
|
info = info.replaceAll("%id%", plot.id.toString());
|
||||||
info = info.replaceAll("%biome%", getBiomeAt(plot).toString());
|
info = info.replaceAll("%biome%", getBiomeAt(plot).toString());
|
||||||
info = info.replaceAll("%owner%", owner);
|
info = info.replaceAll("%owner%", owner);
|
||||||
info = info.replaceAll("%time%", plot.settings.getChangeTime() ? plot.settings.getTime() + "" : "default");
|
info = info.replaceAll("%time%", plot.settings.getChangeTime() ? plot.settings.getTime() + "" : "default");
|
||||||
|
@ -29,7 +29,7 @@ public class Trusted extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasBeenOnServer(String name) {
|
private boolean hasBeenOnServer(String name) {
|
||||||
Player plr = Bukkit.getPlayerExact(name);
|
Player plr = Bukkit.getPlayer(name);
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
|
||||||
if (oplr == null) {
|
if (oplr == null) {
|
||||||
@ -74,8 +74,8 @@ public class Trusted extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if ((Bukkit.getPlayerExact(args[1]) != null)) {
|
if ((Bukkit.getPlayer(args[1]) != null)) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
@ -105,8 +105,8 @@ public class Trusted extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
if (Bukkit.getPlayerExact(args[1]) != null) {
|
if (Bukkit.getPlayer(args[1]) != null) {
|
||||||
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
|
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
|
||||||
} else {
|
} else {
|
||||||
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import java.util.UUID;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
@ -40,31 +41,7 @@ public class PlotMeConverter {
|
|||||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Conversion has started");
|
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Conversion has started");
|
||||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Caching playerdata...");
|
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Caching playerdata...");
|
||||||
ArrayList<com.intellectualcrafters.plot.Plot> createdPlots = new ArrayList<com.intellectualcrafters.plot.Plot>();
|
ArrayList<com.intellectualcrafters.plot.Plot> createdPlots = new ArrayList<com.intellectualcrafters.plot.Plot>();
|
||||||
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
|
|
||||||
boolean online = Bukkit.getServer().getOnlineMode();
|
boolean online = Bukkit.getServer().getOnlineMode();
|
||||||
if (!online) {
|
|
||||||
File playersFolder = new File("world" + File.separator + "playerdata");
|
|
||||||
String[] dat = playersFolder.list(new FilenameFilter() {
|
|
||||||
@Override
|
|
||||||
public boolean accept(File f, String s) {
|
|
||||||
return s.endsWith(".dat");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for (String current : dat) {
|
|
||||||
UUID uuid = null;
|
|
||||||
try {
|
|
||||||
uuid = UUID.fromString(current.replaceAll(".dat$", ""));
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (uuid != null) {
|
|
||||||
String name = Bukkit.getOfflinePlayer(uuid).getName();
|
|
||||||
if (name != null) {
|
|
||||||
uuidMap.put(name, uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
HashMap<String, Plot> plots = PlotManager.getPlots(world);
|
HashMap<String, Plot> plots = PlotManager.getPlots(world);
|
||||||
if (plots != null) {
|
if (plots != null) {
|
||||||
@ -115,7 +92,10 @@ public class PlotMeConverter {
|
|||||||
for (String user : plot.getAllowed().split(",")) {
|
for (String user : plot.getAllowed().split(",")) {
|
||||||
if (user.equals("*")) {
|
if (user.equals("*")) {
|
||||||
psAdded.add(DBFunc.everyone);
|
psAdded.add(DBFunc.everyone);
|
||||||
} else if (uuidMap.containsKey(user)) {
|
} else {
|
||||||
|
|
||||||
|
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + user).getBytes(Charsets.UTF_8));
|
||||||
|
|
||||||
psAdded.add(uuidMap.get(user));
|
psAdded.add(uuidMap.get(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +103,7 @@ public class PlotMeConverter {
|
|||||||
for (String user : plot.getDenied().split(",")) {
|
for (String user : plot.getDenied().split(",")) {
|
||||||
if (user.equals("*")) {
|
if (user.equals("*")) {
|
||||||
psDenied.add(DBFunc.everyone);
|
psDenied.add(DBFunc.everyone);
|
||||||
} else if (uuidMap.containsKey(user)) {
|
} else {
|
||||||
psDenied.add(uuidMap.get(user));
|
psDenied.add(uuidMap.get(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,18 +166,7 @@ public class PlayerEvents implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
public void plotEntry(Player player, Plot plot) {
|
||||||
public void PlayerMove(PlayerMoveEvent event) {
|
|
||||||
try {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
Location from = event.getFrom();
|
|
||||||
Location to = event.getTo();
|
|
||||||
if ((from.getBlockX() != to.getBlockX()) || (from.getBlockZ() != to.getBlockZ())) {
|
|
||||||
if (!isPlotWorld(player.getWorld())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enteredPlot(from,to)) {
|
|
||||||
Plot plot = getCurrentPlot(event.getTo());
|
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
if (C.TITLE_ENTERED_PLOT.s().length() > 2) {
|
if (C.TITLE_ENTERED_PLOT.s().length() > 2) {
|
||||||
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
|
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
|
||||||
@ -194,13 +183,7 @@ public class PlayerEvents implements Listener {
|
|||||||
PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
|
PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
|
||||||
Bukkit.getPluginManager().callEvent(callEvent);
|
Bukkit.getPluginManager().callEvent(callEvent);
|
||||||
}
|
}
|
||||||
boolean admin = player.hasPermission("plots.admin");
|
|
||||||
|
|
||||||
PlayerFunctions.sendMessage(player, plot.settings.getJoinMessage());
|
PlayerFunctions.sendMessage(player, plot.settings.getJoinMessage());
|
||||||
if (plot.deny_entry(player) && !admin) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plot.settings.getRain()) {
|
if (plot.settings.getRain()) {
|
||||||
PlayerFunctions.togglePlotWeather(player, plot);
|
PlayerFunctions.togglePlotWeather(player, plot);
|
||||||
}
|
}
|
||||||
@ -208,16 +191,39 @@ public class PlayerEvents implements Listener {
|
|||||||
PlayerFunctions.togglePlotTime(player, plot);
|
PlayerFunctions.togglePlotTime(player, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (leftPlot(event.getFrom(), event.getTo())) {
|
}
|
||||||
Plot plot = getCurrentPlot(event.getFrom());
|
public void plotExit(Player player, Plot plot) {
|
||||||
{
|
{
|
||||||
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
||||||
Bukkit.getPluginManager().callEvent(callEvent);
|
Bukkit.getPluginManager().callEvent(callEvent);
|
||||||
}
|
}
|
||||||
event.getPlayer().resetPlayerTime();
|
player.resetPlayerTime();
|
||||||
event.getPlayer().resetPlayerWeather();
|
player.resetPlayerWeather();
|
||||||
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void PlayerMove(PlayerMoveEvent event) {
|
||||||
|
try {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location from = event.getFrom();
|
||||||
|
Location to = event.getTo();
|
||||||
|
if ((from.getBlockX() != to.getBlockX()) || (from.getBlockZ() != to.getBlockZ())) {
|
||||||
|
if (!isPlotWorld(player.getWorld())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (enteredPlot(from,to)) {
|
||||||
|
Plot plot = getCurrentPlot(event.getTo());
|
||||||
|
boolean admin = player.hasPermission("plots.admin");
|
||||||
|
if (plot.deny_entry(player) && !admin) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plotEntry(player, plot);
|
||||||
|
} else if (leftPlot(event.getFrom(), event.getTo())) {
|
||||||
|
Plot plot = getCurrentPlot(event.getFrom());
|
||||||
|
plotExit(player, plot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Gotta catch 'em all.
|
// Gotta catch 'em all.
|
||||||
@ -518,6 +524,9 @@ public class PlayerEvents implements Listener {
|
|||||||
if (!isPlotWorld(world)) {
|
if (!isPlotWorld(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.getEntity() instanceof Player) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!isInPlot(event.getLocation())) {
|
if (!isInPlot(event.getLocation())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -557,6 +566,10 @@ public class PlayerEvents implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
|
|
||||||
|
Location f = event.getFrom();
|
||||||
|
Location t = event.getTo();
|
||||||
|
|
||||||
if (isPlotWorld(event.getTo())) {
|
if (isPlotWorld(event.getTo())) {
|
||||||
if (isInPlot(event.getTo())) {
|
if (isInPlot(event.getTo())) {
|
||||||
Plot plot = getCurrentPlot(event.getTo());
|
Plot plot = getCurrentPlot(event.getTo());
|
||||||
@ -564,6 +577,17 @@ public class PlayerEvents implements Listener {
|
|||||||
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (enteredPlot(f, t)) {
|
||||||
|
plotEntry(event.getPlayer(), plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (leftPlot(f, t)) {
|
||||||
|
Plot plot = getCurrentPlot(event.getTo());
|
||||||
|
plotExit(event.getPlayer(), plot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((event.getTo().getBlockX() >= 29999999) || (event.getTo().getBlockX() <= -29999999) || (event.getTo().getBlockZ() >= 29999999) || (event.getTo().getBlockZ() <= -29999999)) {
|
if ((event.getTo().getBlockX() >= 29999999) || (event.getTo().getBlockX() <= -29999999) || (event.getTo().getBlockZ() >= 29999999) || (event.getTo().getBlockZ() <= -29999999)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -127,14 +127,18 @@ public class WorldEditListener implements Listener {
|
|||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
Location t = e.getTo();
|
Location t = e.getTo();
|
||||||
Location f = e.getFrom();
|
Location f = e.getFrom();
|
||||||
if (!isPlotWorld(t)) {
|
if (t==null) {
|
||||||
if (isPlotWorld(f)) {
|
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (isPlotWorld(t)) {
|
||||||
PWE.setMask(p, t);
|
PWE.setMask(p, t);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (f!=null && isPlotWorld(f)) {
|
||||||
|
PWE.removeMask(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user