mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 13:05:41 +01:00
Cleanup
This commit is contained in:
parent
c09c5b048e
commit
ec80151cd9
@ -30,11 +30,13 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
|||||||
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.listeners.ChunkListener;
|
import com.intellectualcrafters.plot.listeners.ChunkListener;
|
||||||
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.PlayerEvents_1_8;
|
||||||
|
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||||
import com.intellectualcrafters.plot.listeners.TNTListener;
|
import com.intellectualcrafters.plot.listeners.TNTListener;
|
||||||
import com.intellectualcrafters.plot.listeners.WorldEvents;
|
import com.intellectualcrafters.plot.listeners.WorldEvents;
|
||||||
@ -107,13 +109,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
} else {
|
} else {
|
||||||
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
||||||
}
|
}
|
||||||
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
|
||||||
|
|
||||||
// Experimental
|
|
||||||
if (Settings.CHUNK_PROCESSOR) {
|
|
||||||
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<World> worlds = Bukkit.getWorlds();
|
List<World> worlds = Bukkit.getWorlds();
|
||||||
if (worlds.size() > 0) {
|
if (worlds.size() > 0) {
|
||||||
UUIDHandler.cacheAll(worlds.get(0).getName());
|
UUIDHandler.cacheAll(worlds.get(0).getName());
|
||||||
@ -398,4 +393,19 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
public void unregister(PlotPlayer player) {
|
public void unregister(PlotPlayer player) {
|
||||||
BukkitUtil.removePlayer(player.getName());
|
BukkitUtil.removePlayer(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public APlotListener initPlotListener() {
|
||||||
|
return new PlotListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerChunkProcessor() {
|
||||||
|
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerWorldEvents() {
|
||||||
|
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.milkbowl.vault.economy.Economy;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -61,4 +62,10 @@ public interface IPlotMain {
|
|||||||
public void unregister(PlotPlayer player);
|
public void unregister(PlotPlayer player);
|
||||||
|
|
||||||
public ChunkGenerator getGenerator(String world, String name);
|
public ChunkGenerator getGenerator(String world, String name);
|
||||||
|
|
||||||
|
public APlotListener initPlotListener();
|
||||||
|
|
||||||
|
public void registerChunkProcessor();
|
||||||
|
|
||||||
|
public void registerWorldEvents();
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
|||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
@ -528,6 +529,10 @@ public class PlotSquared {
|
|||||||
IMP.registerPlotPlusEvents();
|
IMP.registerPlotPlusEvents();
|
||||||
IMP.registerForceFieldEvents();
|
IMP.registerForceFieldEvents();
|
||||||
IMP.registerWorldEditEvents();
|
IMP.registerWorldEditEvents();
|
||||||
|
IMP.registerWorldEvents();
|
||||||
|
if (Settings.CHUNK_PROCESSOR) {
|
||||||
|
IMP.registerChunkProcessor();
|
||||||
|
}
|
||||||
// create UUIDWrapper
|
// create UUIDWrapper
|
||||||
UUIDHandler.uuidWrapper = IMP.initUUIDHandler();
|
UUIDHandler.uuidWrapper = IMP.initUUIDHandler();
|
||||||
// create event util class
|
// create event util class
|
||||||
@ -540,6 +545,9 @@ public class PlotSquared {
|
|||||||
BlockManager.manager = IMP.initBlockManager();
|
BlockManager.manager = IMP.initBlockManager();
|
||||||
// Set chunk
|
// Set chunk
|
||||||
ChunkManager.manager = IMP.initChunkManager();
|
ChunkManager.manager = IMP.initChunkManager();
|
||||||
|
// Plot listener
|
||||||
|
APlotListener.manager = IMP.initPlotListener();
|
||||||
|
|
||||||
// PlotMe
|
// PlotMe
|
||||||
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) {
|
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) {
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
|
@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.flag.AbstractFlag;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.flag.FlagValue;
|
import com.intellectualcrafters.plot.flag.FlagValue;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
@ -125,7 +125,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(player, plot);
|
APlotListener.manager.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "remove": {
|
case "remove": {
|
||||||
@ -163,7 +163,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
MainUtil.sendMessage(player, C.FLAG_REMOVED);
|
||||||
PlotListener.plotEntry(player, plot);
|
APlotListener.manager.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add": {
|
case "add": {
|
||||||
@ -203,7 +203,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
||||||
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
MainUtil.sendMessage(player, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(player, plot);
|
APlotListener.manager.plotEntry(player, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "list": {
|
case "list": {
|
||||||
|
@ -23,12 +23,9 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
@ -42,7 +39,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|
||||||
|
|
||||||
public class SchematicCmd extends SubCommand {
|
public class SchematicCmd extends SubCommand {
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
|
@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -90,8 +90,6 @@ public class Set extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO: Implement option */
|
|
||||||
// final boolean advanced_permissions = true;
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
|
if (!Permissions.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
|
||||||
return false;
|
return false;
|
||||||
@ -127,7 +125,7 @@ public class Set extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.FLAG_REMOVED);
|
MainUtil.sendMessage(plr, C.FLAG_REMOVED);
|
||||||
PlotListener.plotEntry(plr, plot);
|
APlotListener.manager.plotEntry(plr, plot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -144,7 +142,7 @@ public class Set extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.FLAG_ADDED);
|
MainUtil.sendMessage(plr, C.FLAG_ADDED);
|
||||||
PlotListener.plotEntry(plr, plot);
|
APlotListener.manager.plotEntry(plr, plot);
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
MainUtil.sendMessage(plr, "&c" + e.getMessage());
|
MainUtil.sendMessage(plr, "&c" + e.getMessage());
|
||||||
|
@ -22,9 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.listeners.worldedit.WEListener;
|
|
||||||
import com.intellectualcrafters.plot.listeners.worldedit.WEManager;
|
import com.intellectualcrafters.plot.listeners.worldedit.WEManager;
|
||||||
import com.intellectualcrafters.plot.listeners.worldedit.WESubscriber;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
@ -97,13 +97,19 @@ public class SQLManager implements AbstractDB {
|
|||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
SQLManager.this.connection = PlotSquared.getMySQL().forceConnection();
|
@Override
|
||||||
} catch (final Exception e) {
|
public void run() {
|
||||||
e.printStackTrace();
|
try {
|
||||||
}
|
System.out.print("CONNECTIN");
|
||||||
|
SQLManager.this.connection = PlotSquared.getMySQL().forceConnection();
|
||||||
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, 11000);
|
}, 1);
|
||||||
}
|
}
|
||||||
updateTables();
|
updateTables();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,18 @@ public class FlagManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBooleanFlag(final Plot plot, final String key, final boolean defaultValue) {
|
||||||
|
final Flag flag = FlagManager.getPlotFlag(plot, key);
|
||||||
|
if (flag == null) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
final Object value = flag.getValue();
|
||||||
|
if (value instanceof Boolean) {
|
||||||
|
return (boolean) value;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a flag for a plot (respects flag defaults)
|
* Get the value of a flag for a plot (respects flag defaults)
|
||||||
* @param plot
|
* @param plot
|
||||||
|
@ -2,8 +2,8 @@ package com.intellectualcrafters.plot.generator;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.intellectualcrafters.plot.listeners;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
|
||||||
|
public abstract class APlotListener {
|
||||||
|
|
||||||
|
public static APlotListener manager;
|
||||||
|
|
||||||
|
public abstract void plotExit(final PlotPlayer player, final Plot plot);
|
||||||
|
|
||||||
|
public abstract void plotEntry(final PlotPlayer player, final Plot plot);
|
||||||
|
}
|
@ -3,14 +3,11 @@ package com.intellectualcrafters.plot.listeners;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
|
@ -105,7 +105,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
|
if ((FlagManager.getPlotFlag(plot, "forcefield") != null) && FlagManager.getPlotFlag(plot, "forcefield").getValue().equals("true")) {
|
||||||
if (!PlotListener.booleanFlag(plot, "forcefield", false)) {
|
if (!FlagManager.isBooleanFlag(plot, "forcefield", false)) {
|
||||||
final UUID uuid = pp.getUUID();
|
final UUID uuid = pp.getUUID();
|
||||||
if (plot.isAdded(uuid)) {
|
if (plot.isAdded(uuid)) {
|
||||||
final Set<Player> players = getNearbyPlayers(player, plot);
|
final Set<Player> players = getNearbyPlayers(player, plot);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -25,34 +26,35 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
|
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
|
||||||
if (isPlotWorld(l)) {
|
String world = l.getWorld();
|
||||||
e.getPlayer();
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
return;
|
||||||
if (!isInPlot(l)) {
|
}
|
||||||
if (!isPlotArea(l)) {
|
Plot plot = MainUtil.getPlot(l);
|
||||||
return;
|
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
||||||
}
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
if (!MainUtil.isPlotArea(l)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
return;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!plot.hasOwner()) {
|
||||||
|
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
final Plot plot = MainUtil.getPlot(l);
|
else {
|
||||||
if ((plot == null) || !plot.hasOwner()) {
|
final UUID uuid = pp.getUUID();
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
if (!plot.isAdded(uuid)) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
|
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
final UUID uuid = pp.getUUID();
|
|
||||||
if (!plot.isAdded(uuid)) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
|
||||||
if (isPlotArea(l)) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,56 +37,23 @@ import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.BukkitPlayer;
|
import com.intellectualcrafters.plot.object.BukkitPlayer;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.titles.AbstractTitle;
|
import com.intellectualcrafters.plot.titles.AbstractTitle;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
* @author Empire92
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class PlotListener {
|
public class PlotListener extends APlotListener {
|
||||||
public static void textures(final Player p) {
|
public void textures(final Player p) {
|
||||||
if ((Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) && isPlotWorld(p.getWorld().getName())) {
|
if ((Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) && PlotSquared.isPlotWorld(p.getWorld().getName())) {
|
||||||
p.setResourcePack(Settings.PLOT_SPECIFIC_RESOURCE_PACK);
|
p.setResourcePack(Settings.PLOT_SPECIFIC_RESOURCE_PACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean booleanFlag(final Plot plot, final String key, final boolean defaultValue) {
|
private String getName(final UUID id) {
|
||||||
final Flag flag = FlagManager.getPlotFlag(plot, key);
|
|
||||||
if (flag == null) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
final Object value = flag.getValue();
|
|
||||||
if (value instanceof Boolean) {
|
|
||||||
return (boolean) value;
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInPlot(final String world, final int x, final int y, final int z) {
|
|
||||||
return (MainUtil.getPlot(new Location(world, x, y, z)) != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPlotWorld(final String world) {
|
|
||||||
return PlotSquared.isPlotWorld(world);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPlotArea(final Location location) {
|
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
|
||||||
if (plotworld.TYPE == 2) {
|
|
||||||
return ClusterManager.getCluster(location) != null;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getName(final UUID id) {
|
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
@ -97,39 +64,7 @@ public class PlotListener {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getUUID(final String name) {
|
private WeatherType getWeatherType(String str) {
|
||||||
return UUIDHandler.getUUID(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean enteredPlot(final Location l1, final Location l2) {
|
|
||||||
final PlotId p1 = MainUtil.getPlotId(l1);
|
|
||||||
final PlotId p2 = MainUtil.getPlotId(l2);
|
|
||||||
return (p2 != null) && ((p1 == null) || !p1.equals(p2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean leftPlot(final Location l1, final Location l2) {
|
|
||||||
final PlotId p1 = MainUtil.getPlotId(l1);
|
|
||||||
final PlotId p2 = MainUtil.getPlotId(l2);
|
|
||||||
return (p1 != null) && ((p2 == null) || !p1.equals(p2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPlotWorld(final Location l) {
|
|
||||||
return PlotSquared.isPlotWorld(l.getWorld());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInPlot(final Location loc) {
|
|
||||||
return getCurrentPlot(loc) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Plot getCurrentPlot(final Location loc) {
|
|
||||||
final PlotId id = MainUtil.getPlotId(loc);
|
|
||||||
if (id == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return MainUtil.getPlot(loc.getWorld(), id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static WeatherType getWeatherType(String str) {
|
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
if (str.equals("rain")) {
|
if (str.equals("rain")) {
|
||||||
return WeatherType.DOWNFALL;
|
return WeatherType.DOWNFALL;
|
||||||
@ -138,7 +73,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GameMode getGameMode(final String str) {
|
private GameMode getGameMode(final String str) {
|
||||||
switch (str) {
|
switch (str) {
|
||||||
case "creative":
|
case "creative":
|
||||||
return GameMode.CREATIVE;
|
return GameMode.CREATIVE;
|
||||||
@ -151,11 +86,12 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void plotEntry(final PlotPlayer player, final Plot plot) {
|
public void plotEntry(final PlotPlayer player, final Plot plot) {
|
||||||
plotEntry(((BukkitPlayer) player).player, plot);
|
plotEntry(((BukkitPlayer) player).player, plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void plotEntry(final Player player, final Plot plot) {
|
public void plotEntry(final Player pp, final Plot plot) {
|
||||||
|
Player player = ((BukkitPlayer) pp).player;
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
final Flag gamemodeFlag = FlagManager.getPlotFlag(plot, "gamemode");
|
final Flag gamemodeFlag = FlagManager.getPlotFlag(plot, "gamemode");
|
||||||
if (gamemodeFlag != null) {
|
if (gamemodeFlag != null) {
|
||||||
@ -178,7 +114,7 @@ public class PlotListener {
|
|||||||
if (weatherFlag != null) {
|
if (weatherFlag != null) {
|
||||||
player.setPlayerWeather(getWeatherType(weatherFlag.getValueString()));
|
player.setPlayerWeather(getWeatherType(weatherFlag.getValueString()));
|
||||||
}
|
}
|
||||||
if ((booleanFlag(plot, "titles", Settings.TITLES)) && (C.TITLE_ENTERED_PLOT.s().length() > 2)) {
|
if ((FlagManager.isBooleanFlag(plot, "titles", Settings.TITLES)) && (C.TITLE_ENTERED_PLOT.s().length() > 2)) {
|
||||||
final String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceAll("%x%", plot.id.x + "").replaceAll("%z%", plot.id.y + "").replaceAll("%world%", plot.world + "");
|
final String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceAll("%x%", plot.id.x + "").replaceAll("%z%", plot.id.y + "").replaceAll("%world%", plot.world + "");
|
||||||
final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
|
final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
|
||||||
if (AbstractTitle.TITLE_CLASS != null) {
|
if (AbstractTitle.TITLE_CLASS != null) {
|
||||||
@ -192,11 +128,10 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void plotExit(final Player player, final Plot plot) {
|
public void plotExit(final PlotPlayer pp, final Plot plot) {
|
||||||
{
|
Player player = ((BukkitPlayer) pp).player;
|
||||||
final PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
final PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
||||||
Bukkit.getPluginManager().callEvent(callEvent);
|
Bukkit.getPluginManager().callEvent(callEvent);
|
||||||
}
|
|
||||||
if (FlagManager.getPlotFlag(plot, "fly") != null) {
|
if (FlagManager.getPlotFlag(plot, "fly") != null) {
|
||||||
player.setAllowFlight(Bukkit.getAllowFlight());
|
player.setAllowFlight(Bukkit.getAllowFlight());
|
||||||
}
|
}
|
||||||
@ -211,7 +146,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getFlagValue(final String value) {
|
public boolean getFlagValue(final String value) {
|
||||||
return Arrays.asList("true", "on", "enabled", "yes").contains(value.toLowerCase());
|
return Arrays.asList("true", "on", "enabled", "yes").contains(value.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (booleanFlag(plot, "instabreak", false)) {
|
if (FlagManager.isBooleanFlag(plot, "instabreak", false)) {
|
||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (booleanFlag(plot, "invincible", false)) {
|
if (FlagManager.isBooleanFlag(plot, "invincible", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final UUID uuid = pp.getUUID();
|
final UUID uuid = pp.getUUID();
|
||||||
if (plot.isAdded(uuid) && booleanFlag(plot, "drop-protection", false)) {
|
if (plot.isAdded(uuid) && FlagManager.isBooleanFlag(plot, "drop-protection", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final UUID uuid = pp.getUUID();
|
final UUID uuid = pp.getUUID();
|
||||||
if (plot.isAdded(uuid) && booleanFlag(plot, "item-drop", false)) {
|
if (plot.isAdded(uuid) && FlagManager.isBooleanFlag(plot, "item-drop", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
if (FlagManager.getPlotFlag(plot, "greeting") != null) {
|
if (FlagManager.getPlotFlag(plot, "greeting") != null) {
|
||||||
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "greeting").getValueString()));
|
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + FlagManager.getPlotFlag(plot, "greeting").getValueString()));
|
||||||
}
|
}
|
||||||
if (booleanFlag(plot, "notify-enter", false)) {
|
if (FlagManager.isBooleanFlag(plot, "notify-enter", false)) {
|
||||||
final Player trespasser = event.getPlayer();
|
final Player trespasser = event.getPlayer();
|
||||||
final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
|
final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
|
||||||
if (Permissions.hasPermission(pt, "plots.flag.notify-enter.bypass")) {
|
if (Permissions.hasPermission(pt, "plots.flag.notify-enter.bypass")) {
|
||||||
@ -265,7 +265,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
if (healRunnable.containsKey(leaver)) {
|
if (healRunnable.containsKey(leaver)) {
|
||||||
healRunnable.remove(leaver);
|
healRunnable.remove(leaver);
|
||||||
}
|
}
|
||||||
if (booleanFlag(plot, "notify-leave", false)) {
|
if (FlagManager.isBooleanFlag(plot, "notify-leave", false)) {
|
||||||
if (Permissions.hasPermission(pl, "plots.flag.notify-leave.bypass")) {
|
if (Permissions.hasPermission(pl, "plots.flag.notify-leave.bypass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@ package com.intellectualcrafters.plot.listeners.worldedit;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
@ -16,26 +14,14 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
|
||||||
import com.sk89q.worldedit.extent.NullExtent;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
|
||||||
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
|
||||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
|
||||||
|
|
||||||
public class WEListener implements Listener {
|
public class WEListener implements Listener {
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ public class ClusterManager {
|
|||||||
return getCluster(plot.world, plot.id);
|
return getCluster(plot.world, plot.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotCluster getCluster(final Location loc) {
|
public static PlotCluster getClusterAbs(final Location loc) {
|
||||||
final String world = loc.getWorld();
|
String world = loc.getWorld();
|
||||||
if ((last != null) && last.world.equals(world)) {
|
if ((last != null) && last.world.equals(world)) {
|
||||||
if (contains(last, loc)) {
|
if (contains(last, loc)) {
|
||||||
return last;
|
return last;
|
||||||
@ -165,6 +165,16 @@ public class ClusterManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlotCluster getCluster(final Location loc) {
|
||||||
|
final String world = loc.getWorld();
|
||||||
|
PlotManager manager = PlotSquared.getPlotManager(world);
|
||||||
|
PlotId id = manager.getPlotIdAbs(PlotSquared.getPlotWorld(world), loc.getX(), loc.getY(), loc.getZ());
|
||||||
|
if (id != null) {
|
||||||
|
return getCluster(world, id);
|
||||||
|
}
|
||||||
|
return getClusterAbs(loc);
|
||||||
|
}
|
||||||
|
|
||||||
public static PlotCluster getCluster(final String world, final PlotId id) {
|
public static PlotCluster getCluster(final String world, final PlotId id) {
|
||||||
if ((last != null) && last.world.equals(world)) {
|
if ((last != null) && last.world.equals(world)) {
|
||||||
if (contains(last, id)) {
|
if (contains(last, id)) {
|
||||||
|
@ -58,6 +58,54 @@ public class MainUtil {
|
|||||||
public static HashMap<String, Integer> worldBorder = new HashMap<>();
|
public static HashMap<String, Integer> worldBorder = new HashMap<>();
|
||||||
static PseudoRandom random = new PseudoRandom();
|
static PseudoRandom random = new PseudoRandom();
|
||||||
|
|
||||||
|
public static boolean isPlotArea(final Location location) {
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
||||||
|
if (plotworld.TYPE == 2) {
|
||||||
|
return ClusterManager.getCluster(location) != null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPlotAreaAbs(final Location location) {
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
||||||
|
if (plotworld.TYPE == 2) {
|
||||||
|
return ClusterManager.getClusterAbs(location) != null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPlotRoad(final Location location) {
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(location.getWorld());
|
||||||
|
if (plotworld.TYPE == 2) {
|
||||||
|
PlotCluster cluster = ClusterManager.getCluster(location);
|
||||||
|
if (cluster == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlotManager manager = PlotSquared.getPlotManager(location.getWorld());
|
||||||
|
return manager.getPlotId(plotworld, location.getX(), location.getY(), location.getZ()) == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPlotArea(final Plot plot) {
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(plot.world);
|
||||||
|
if (plotworld.TYPE == 2) {
|
||||||
|
return ClusterManager.getCluster(plot) != null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean enteredPlot(final Location l1, final Location l2) {
|
||||||
|
final PlotId p1 = MainUtil.getPlotId(l1);
|
||||||
|
final PlotId p2 = MainUtil.getPlotId(l2);
|
||||||
|
return (p2 != null) && ((p1 == null) || !p1.equals(p2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean leftPlot(final Location l1, final Location l2) {
|
||||||
|
final PlotId p1 = MainUtil.getPlotId(l1);
|
||||||
|
final PlotId p2 = MainUtil.getPlotId(l2);
|
||||||
|
return (p1 != null) && ((p2 == null) || !p1.equals(p2));
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
|
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
|
||||||
|
|
||||||
final Plot plot1 = PlotSquared.getPlots(world).get(pos1);
|
final Plot plot1 = PlotSquared.getPlots(world).get(pos1);
|
||||||
|
@ -25,7 +25,6 @@ import com.intellectualcrafters.jnbt.NBTOutputStream;
|
|||||||
import com.intellectualcrafters.jnbt.ShortTag;
|
import com.intellectualcrafters.jnbt.ShortTag;
|
||||||
import com.intellectualcrafters.jnbt.Tag;
|
import com.intellectualcrafters.jnbt.Tag;
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.commands.SchematicCmd;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
@ -7,7 +7,6 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
|
|
||||||
public class SetBlockQueue {
|
public class SetBlockQueue {
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
|
|
||||||
|
@ -46,13 +46,14 @@ import org.bukkit.plugin.Plugin;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.BukkitMain;
|
import com.intellectualcrafters.plot.BukkitMain;
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotLoc;
|
import com.intellectualcrafters.plot.object.PlotLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.entity.EntityWrapper;
|
import com.intellectualcrafters.plot.object.entity.EntityWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -771,8 +772,9 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
if (plot.id.equals(id)) {
|
if (plot.id.equals(id)) {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
final Player player = (Player) entity;
|
final Player player = (Player) entity;
|
||||||
BukkitUtil.getPlayer(player).teleport(MainUtil.getDefaultHome(plot));
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
PlotListener.plotExit(player, plot);
|
pp.teleport(MainUtil.getDefaultHome(plot));
|
||||||
|
APlotListener.manager.plotExit(pp, plot);
|
||||||
} else {
|
} else {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
|
Loading…
Reference in New Issue
Block a user