mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3f4c275d64
@ -9,6 +9,11 @@ public class AbstractFlag {
|
|||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AbstractFlag is a parameter used in creating a new Flag
|
||||||
|
* @param key
|
||||||
|
* The key must be alphabetical characters and <= 16 characters in length
|
||||||
|
*/
|
||||||
public AbstractFlag(String key) {
|
public AbstractFlag(String key) {
|
||||||
if (!StringUtils.isAlpha(key)) {
|
if (!StringUtils.isAlpha(key)) {
|
||||||
throw new IllegalArgumentException("Flag must be alphabetic characters");
|
throw new IllegalArgumentException("Flag must be alphabetic characters");
|
||||||
@ -18,9 +23,17 @@ public class AbstractFlag {
|
|||||||
}
|
}
|
||||||
this.key = key.toLowerCase();
|
this.key = key.toLowerCase();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* AbstractFlag key
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return this.key;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,17 @@ public class Flag {
|
|||||||
private AbstractFlag key;
|
private AbstractFlag key;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag object used to store basic information for a Plot.
|
||||||
|
* Flags are a key/value pair.
|
||||||
|
* For a flag to be usable by a player, you need to register it with PlotSquared.
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* AbstractFlag
|
||||||
|
* @param value
|
||||||
|
* Value must be alphanumerical (can have spaces) and be <= 48 characters
|
||||||
|
* @throws IllegalArgumentException if you provide inadequate inputs
|
||||||
|
*/
|
||||||
public Flag(AbstractFlag key, String value) {
|
public Flag(AbstractFlag key, String value) {
|
||||||
if (!StringUtils.isAlphanumericSpace(ChatColor.stripColor(value))) {
|
if (!StringUtils.isAlphanumericSpace(ChatColor.stripColor(value))) {
|
||||||
throw new IllegalArgumentException("Flag must be alphanumerical");
|
throw new IllegalArgumentException("Flag must be alphanumerical");
|
||||||
@ -18,14 +29,26 @@ public class Flag {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AbstractFlag used in creating the flag
|
||||||
|
* @return AbstractFlag
|
||||||
|
*/
|
||||||
public AbstractFlag getAbstractFlag() {
|
public AbstractFlag getAbstractFlag() {
|
||||||
return this.key;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the key for the AbstractFlag
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return this.key.getKey();
|
return this.key.getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,11 @@ public class FlagManager {
|
|||||||
|
|
||||||
private static ArrayList<AbstractFlag> flags;
|
private static ArrayList<AbstractFlag> flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an AbstractFlag with PlotSquared
|
||||||
|
* @param flag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static boolean addFlag(AbstractFlag flag) {
|
public static boolean addFlag(AbstractFlag flag) {
|
||||||
if (getFlag(flag.getKey()) != null) {
|
if (getFlag(flag.getKey()) != null) {
|
||||||
return false;
|
return false;
|
||||||
@ -15,10 +20,20 @@ public class FlagManager {
|
|||||||
return flags.add(flag);
|
return flags.add(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of registered AbstractFlag objects
|
||||||
|
* @return List (AbstractFlag)
|
||||||
|
*/
|
||||||
public static List<AbstractFlag> getFlags() {
|
public static List<AbstractFlag> getFlags() {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an AbstractFlag by a string
|
||||||
|
* Returns null if flag does not exist
|
||||||
|
* @param string
|
||||||
|
* @return AbstractFkag
|
||||||
|
*/
|
||||||
public static AbstractFlag getFlag(String string) {
|
public static AbstractFlag getFlag(String string) {
|
||||||
for (AbstractFlag flag : flags) {
|
for (AbstractFlag flag : flags) {
|
||||||
if (flag.getKey().equalsIgnoreCase(string)) {
|
if (flag.getKey().equalsIgnoreCase(string)) {
|
||||||
@ -28,6 +43,14 @@ public class FlagManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an AbstractFlag by a string
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @param create
|
||||||
|
* If to create the flag if it does not exist
|
||||||
|
* @return AbstractFlag
|
||||||
|
*/
|
||||||
public static AbstractFlag getFlag(String string, boolean create) {
|
public static AbstractFlag getFlag(String string, boolean create) {
|
||||||
if ((getFlag(string) == null) && create) {
|
if ((getFlag(string) == null) && create) {
|
||||||
AbstractFlag flag = new AbstractFlag(string);
|
AbstractFlag flag = new AbstractFlag(string);
|
||||||
@ -36,6 +59,21 @@ public class FlagManager {
|
|||||||
return getFlag(string);
|
return getFlag(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a registered AbstractFlag
|
||||||
|
* @param flag
|
||||||
|
* @return boolean
|
||||||
|
* Result of operation
|
||||||
|
*/
|
||||||
|
public static boolean removeFlag(AbstractFlag flag) {
|
||||||
|
return flags.remove(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the flags for a plot
|
||||||
|
* @param plot
|
||||||
|
* @return List (AbstractFlag)
|
||||||
|
*/
|
||||||
public static List<AbstractFlag> getPlotFlags(Plot plot) {
|
public static List<AbstractFlag> getPlotFlags(Plot plot) {
|
||||||
Set<Flag> plotFlags = plot.settings.getFlags();
|
Set<Flag> plotFlags = plot.settings.getFlags();
|
||||||
List<AbstractFlag> flags = new ArrayList<>();
|
List<AbstractFlag> flags = new ArrayList<>();
|
||||||
|
@ -136,7 +136,6 @@ public class PlayerFunctions {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
HashMap<PlotId, Plot> plots = PlotMain.getPlots(world);
|
HashMap<PlotId, Plot> plots = PlotMain.getPlots(world);
|
||||||
|
|
||||||
if (plots != null) {
|
if (plots != null) {
|
||||||
if (plots.containsKey(id)) {
|
if (plots.containsKey(id)) {
|
||||||
return plots.get(id);
|
return plots.get(id);
|
||||||
@ -196,15 +195,12 @@ public class PlayerFunctions {
|
|||||||
if (p.hasPermission("plots.admin")) {
|
if (p.hasPermission("plots.admin")) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
int y = 0;
|
for (int x = 0; x <= 100; x++) {
|
||||||
for (int x = 1; x <= 100; x++) {
|
if (p.hasPermission("plots.plot." + (100-x))) {
|
||||||
if (p.hasPermission("plots.plot." + x)) {
|
return 100-x;
|
||||||
y = x;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return y;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,9 +457,14 @@ public class PlotHelper {
|
|||||||
return new Short[] { Short.parseShort(block), 0 };
|
return new Short[] { Short.parseShort(block), 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear a plot
|
||||||
|
* @param requester
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public static void clear(final Player requester, final Plot plot) {
|
public static void clear(final Player requester, final Plot plot) {
|
||||||
final PlotWorld plotworld = PlotMain.getWorldSettings(Bukkit.getWorld(plot.world));
|
|
||||||
final long start = System.nanoTime();
|
final long start = System.nanoTime();
|
||||||
|
final PlotWorld plotworld = PlotMain.getWorldSettings(Bukkit.getWorld(plot.world));
|
||||||
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
||||||
PlotHelper.removeSign(requester, plot);
|
PlotHelper.removeSign(requester, plot);
|
||||||
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
||||||
|
@ -1,9 +1,22 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
public class PlotId {
|
public class PlotId {
|
||||||
|
/**
|
||||||
|
* x value
|
||||||
|
*/
|
||||||
public int x;
|
public int x;
|
||||||
|
/**
|
||||||
|
* y value
|
||||||
|
*/
|
||||||
public int y;
|
public int y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
||||||
|
* @param x
|
||||||
|
* The plot x coordinate
|
||||||
|
* @param y
|
||||||
|
* The plot y coordinate
|
||||||
|
*/
|
||||||
public PlotId(int x, int y) {
|
public PlotId(int x, int y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@ -24,6 +37,11 @@ public class PlotId {
|
|||||||
return ((this.x == other.x) && (this.y == other.y));
|
return ((this.x == other.x) && (this.y == other.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.x+";"+this.y;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import ca.mera.CameraAPI;
|
import ca.mera.CameraAPI;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||||
import com.intellectualcrafters.plot.Settings.Web;
|
import com.intellectualcrafters.plot.Settings.Web;
|
||||||
import com.intellectualcrafters.plot.commands.Camera;
|
import com.intellectualcrafters.plot.commands.Camera;
|
||||||
@ -25,7 +26,9 @@ import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
|||||||
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
|
||||||
import me.confuser.barapi.BarAPI;
|
import me.confuser.barapi.BarAPI;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
@ -67,10 +70,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
public static File translationsFile;
|
public static File translationsFile;
|
||||||
public static YamlConfiguration translations;
|
public static YamlConfiguration translations;
|
||||||
public static int translations_ver = 1;
|
public static int translations_ver = 1;
|
||||||
/**
|
|
||||||
* list of usable flags
|
|
||||||
*/
|
|
||||||
public static Set<Flag> registeredFlags = new HashSet<Flag>();
|
|
||||||
/**
|
/**
|
||||||
* MySQL Object
|
* MySQL Object
|
||||||
*/
|
*/
|
||||||
@ -126,28 +125,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* All loaded plot worlds
|
* All loaded plot worlds
|
||||||
*/
|
*/
|
||||||
private static HashMap<String, PlotWorld> worlds = new HashMap<String, PlotWorld>();
|
private static HashMap<String, PlotWorld> worlds = new HashMap<String, PlotWorld>();
|
||||||
|
|
||||||
public static Set<Flag> getFlags() {
|
|
||||||
return registeredFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isRegisteredFlag(String arg) {
|
|
||||||
for (Flag flag : registeredFlags) {
|
|
||||||
if (flag.getKey().equalsIgnoreCase(arg)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean registerFlag(Flag flag) {
|
|
||||||
return registeredFlags.add(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean unRegisterFlag(Flag flag) {
|
|
||||||
return registeredFlags.remove(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plots
|
* Get all plots
|
||||||
*
|
*
|
||||||
@ -269,12 +246,14 @@ public class PlotMain extends JavaPlugin {
|
|||||||
return (plots.get(world.getName()).values().toArray(new Plot[0]));
|
return (plots.get(world.getName()).values().toArray(new Plot[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean removePlot(String world, PlotId id) {
|
public static boolean removePlot(String world, PlotId id, boolean callEvent) {
|
||||||
PlotDeleteEvent event = new PlotDeleteEvent(world, id);
|
if (callEvent) {
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
PlotDeleteEvent event = new PlotDeleteEvent(world, id);
|
||||||
if (event.isCancelled()) {
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
event.setCancelled(true);
|
if (event.isCancelled()) {
|
||||||
return false;
|
event.setCancelled(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
plots.get(world).remove(id);
|
plots.get(world).remove(id);
|
||||||
return true;
|
return true;
|
||||||
@ -493,6 +472,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
|
||||||
getServer().getPluginManager().registerEvents(new WorldEditListener(), this);
|
getServer().getPluginManager().registerEvents(new WorldEditListener(), this);
|
||||||
}
|
}
|
||||||
|
if (Settings.WORLDGUARD)
|
||||||
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||||
worldGuard = (WorldGuardPlugin) getServer().getPluginManager().getPlugin("WorldGuard");
|
worldGuard = (WorldGuardPlugin) getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
getServer().getPluginManager().registerEvents(new WorldGuardListener(this), this);
|
getServer().getPluginManager().registerEvents(new WorldGuardListener(this), this);
|
||||||
@ -823,7 +803,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
private static void setupConfig() {
|
private static void setupConfig() {
|
||||||
config.set("version", config_ver);
|
config.set("version", config_ver);
|
||||||
Map<String, Object> options = new HashMap<String, Object>();
|
Map<String, Object> options = new HashMap<String, Object>();
|
||||||
// options.put("auto_update", false);
|
options.put("auto_update", false);
|
||||||
|
options.put("worldguard.enabled", Settings.WORLDGUARD);
|
||||||
options.put("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT);
|
options.put("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT);
|
||||||
options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT);
|
options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT);
|
||||||
options.put("web.enabled", Web.ENABLED);
|
options.put("web.enabled", Web.ENABLED);
|
||||||
@ -845,6 +826,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
Web.ENABLED = config.getBoolean("web.enabled");
|
Web.ENABLED = config.getBoolean("web.enabled");
|
||||||
Web.PORT = config.getInt("web.port");
|
Web.PORT = config.getInt("web.port");
|
||||||
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
|
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
|
||||||
|
Settings.WORLDGUARD = config.getBoolean("worldguard.enabled");
|
||||||
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding");
|
Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding");
|
||||||
Settings.METRICS = config.getBoolean("metrics");
|
Settings.METRICS = config.getBoolean("metrics");
|
||||||
|
|
||||||
|
@ -4,26 +4,27 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the PlotWorld class (obviously)
|
||||||
|
* <br> - All existing PlotWorld instances should be kept in PlotMain (worlds variable)
|
||||||
|
* <br> - The accessors and mutators are:
|
||||||
|
* <br> PlotMain.isPlotWorld(world)
|
||||||
|
* <br> PlotMain.getPlotWorlds() or PlotMain.getPlotWorldsString() <- use this if you don't need to get world objects
|
||||||
|
* <br> PlotMain.getWorldSettings(World) - get the PlotWorld class for a world
|
||||||
|
* <br>
|
||||||
|
* <br> Also added is getWorldPlots(World) as the plots are now sorted per world
|
||||||
|
* <br>
|
||||||
|
* <br> To get the world of a plot, you can use plot.world - (string) or plot.getWorld() (world object)
|
||||||
|
* <br>
|
||||||
|
* <br> All PlotWorld settings are per world in the settings.yml (these settings are automatically added when a world is loaded, either at startup or if a new world is created):
|
||||||
|
* <br> - You can find this in the WorldGenerator class (yeah, it's possibly not the best place, but it makes sure worlds are added to the settings.yml)
|
||||||
|
* <br>
|
||||||
|
* <br> All new DEFAULT CONSTANTS should be static and be given a value
|
||||||
|
* <br> All new variables should not be static and should not be given any values here, but rather in the WorldGenerator class
|
||||||
|
*
|
||||||
|
**/
|
||||||
public class PlotWorld {
|
public class PlotWorld {
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the PlotWorld class (obviously) - All existing PlotWorld
|
|
||||||
* instances should be kept in PlotMain (worlds variable) - The accessors
|
|
||||||
* and mutators are: PlotMain.isPlotWorld(world) PlotMain.getPlotWorlds() or
|
|
||||||
* PlotMain.getPlotWorldsString() <- use this if you don't need to get world
|
|
||||||
* objects PlotMain.getWorldSettings(World) - get the PlotWorld class for a
|
|
||||||
* world Also added is getWorldPlots(World) as the plots are now sorted per
|
|
||||||
* world To get the world of a plot, you can use plot.world - (string) or
|
|
||||||
* plot.getWorld() (world object) All PlotWorld settings are per world in
|
|
||||||
* the settings.yml (these settings are automatically added when a world is
|
|
||||||
* loaded, either at startup or if a new world is created): - You can find
|
|
||||||
* this in the WorldGenerator class (yeah, it's possibly not the best place,
|
|
||||||
* but it makes sure worlds are added to the settings.yml) All new DEFAULT
|
|
||||||
* CONSTANTS should be static and be given a value All new variables should
|
|
||||||
* not be static and should not be given any values here, but rather in the
|
|
||||||
* WorldGenerator class
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Road Height
|
* Road Height
|
||||||
*/
|
*/
|
||||||
|
@ -5,6 +5,12 @@ import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass;
|
|||||||
import com.intellectualcrafters.plot.ReflectionUtils.RefClass;
|
import com.intellectualcrafters.plot.ReflectionUtils.RefClass;
|
||||||
import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* SetBlockFast class<br>
|
||||||
|
* Used to do fast world editing
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class SetBlockFast {
|
public class SetBlockFast {
|
||||||
|
|
||||||
private static final RefClass classBlock = getRefClass("{nms}.Block");
|
private static final RefClass classBlock = getRefClass("{nms}.Block");
|
||||||
|
@ -17,6 +17,13 @@ package com.intellectualcrafters.plot;
|
|||||||
* @author Empire92
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class Settings {
|
public class Settings {
|
||||||
|
/**
|
||||||
|
* WorldGuard region on claimed plots
|
||||||
|
*/
|
||||||
|
public static boolean WORLDGUARD = false;
|
||||||
|
/**
|
||||||
|
* metrics
|
||||||
|
*/
|
||||||
public static boolean METRICS = true;
|
public static boolean METRICS = true;
|
||||||
/**
|
/**
|
||||||
* plot specific resource pack
|
* plot specific resource pack
|
||||||
|
@ -18,8 +18,10 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.AbstractFlag;
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
import com.intellectualcrafters.plot.Flag;
|
import com.intellectualcrafters.plot.Flag;
|
||||||
|
import com.intellectualcrafters.plot.FlagManager;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
@ -96,8 +98,8 @@ public class PlotAPI {
|
|||||||
*
|
*
|
||||||
* @param flag
|
* @param flag
|
||||||
*/
|
*/
|
||||||
public void registerFlag(Flag flag) {
|
public void addFlag(AbstractFlag flag) {
|
||||||
PlotMain.registerFlag(flag);
|
FlagManager.addFlag(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,8 +107,8 @@ public class PlotAPI {
|
|||||||
*
|
*
|
||||||
* @return array of Flag[]
|
* @return array of Flag[]
|
||||||
*/
|
*/
|
||||||
public Flag[] getRegisteredFlags() {
|
public AbstractFlag[] getFlags() {
|
||||||
return PlotMain.getFlags().toArray(new Flag[0]);
|
return FlagManager.getFlags().toArray(new AbstractFlag[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,10 +32,10 @@ public class Clear extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id);
|
boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true);
|
||||||
if (result) {
|
if (result) {
|
||||||
DBFunc.delete(plr.getWorld().getName(), plot);
|
|
||||||
plot.clear(plr);
|
plot.clear(plr);
|
||||||
|
DBFunc.delete(plr.getWorld().getName(), plot);
|
||||||
} else {
|
} else {
|
||||||
PlayerFunctions.sendMessage(plr, "Plot clearing has been denied.");
|
PlayerFunctions.sendMessage(plr, "Plot clearing has been denied.");
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.AbstractFlag;
|
import com.intellectualcrafters.plot.AbstractFlag;
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
import com.intellectualcrafters.plot.Flag;
|
import com.intellectualcrafters.plot.Flag;
|
||||||
|
import com.intellectualcrafters.plot.FlagManager;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
@ -87,10 +88,10 @@ public class Set extends SubCommand {
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("flag")) {
|
if (args[0].equalsIgnoreCase("flag")) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", StringUtils.join(PlotMain.getFlags(), "&c, &6")));
|
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", StringUtils.join(FlagManager.getFlags(), "&c, &6")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!PlotMain.isRegisteredFlag(args[1])) {
|
if (FlagManager.getFlag(args[1])==null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,12 @@ public abstract class SubCommand {
|
|||||||
this.execute(null, args);
|
this.execute(null, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message
|
||||||
|
* @param plr
|
||||||
|
* @param c
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
public void sendMessage(Player plr, C c, String... args) {
|
public void sendMessage(Player plr, C c, String... args) {
|
||||||
PlayerFunctions.sendMessage(plr, c, args);
|
PlayerFunctions.sendMessage(plr, c, args);
|
||||||
}
|
}
|
||||||
|
@ -149,33 +149,31 @@ public class DBFunc {
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
public static void delete(final String world, final Plot plot) {
|
public static void delete(final String world, final Plot plot) {
|
||||||
boolean result = PlotMain.removePlot(world, plot.id);
|
boolean result = PlotMain.removePlot(world, plot.id, false);
|
||||||
if (result) {
|
runTask(new Runnable() {
|
||||||
runTask(new Runnable() {
|
@Override
|
||||||
@Override
|
public void run() {
|
||||||
public void run() {
|
PreparedStatement stmt = null;
|
||||||
PreparedStatement stmt = null;
|
int id = getId(world, plot.id);
|
||||||
int id = getId(world, plot.id);
|
try {
|
||||||
try {
|
stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = ?");
|
||||||
stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = ?");
|
stmt.setInt(1, id);
|
||||||
stmt.setInt(1, id);
|
stmt.executeUpdate();
|
||||||
stmt.executeUpdate();
|
stmt.close();
|
||||||
stmt.close();
|
stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = ?");
|
||||||
stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = ?");
|
stmt.setInt(1, id);
|
||||||
stmt.setInt(1, id);
|
stmt.executeUpdate();
|
||||||
stmt.executeUpdate();
|
stmt.close();
|
||||||
stmt.close();
|
stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `id` = ?");
|
||||||
stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `id` = ?");
|
stmt.setInt(1, id);
|
||||||
stmt.setInt(1, id);
|
stmt.executeUpdate();
|
||||||
stmt.executeUpdate();
|
stmt.close();
|
||||||
stmt.close();
|
} catch (SQLException e) {
|
||||||
} catch (SQLException e) {
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
Logger.add(LogLevel.DANGER, "Failed to delete plot " + plot.id);
|
||||||
Logger.add(LogLevel.DANGER, "Failed to delete plot " + plot.id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +25,20 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
private Plot plot;
|
private Plot plot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayerClaimPlotEvent: Called when a plot is claimed
|
||||||
|
* @param player
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlayerClaimPlotEvent(Player player, Plot plot) {
|
public PlayerClaimPlotEvent(Player player, Plot plot) {
|
||||||
super(player);
|
super(player);
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,20 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
|||||||
|
|
||||||
private Plot plot;
|
private Plot plot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayerEnterPlotEvent: Called when a player leaves a plot
|
||||||
|
* @param player
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlayerEnterPlotEvent(Player player, Plot plot) {
|
public PlayerEnterPlotEvent(Player player, Plot plot) {
|
||||||
super(player);
|
super(player);
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,19 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
|
|||||||
private static HandlerList handlers = new HandlerList();
|
private static HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private Plot plot;
|
private Plot plot;
|
||||||
|
/**
|
||||||
|
* PlayerLeavePlotEvent: Called when a player leaves a plot
|
||||||
|
* @param player
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlayerLeavePlotEvent(Player player, Plot plot) {
|
public PlayerLeavePlotEvent(Player player, Plot plot) {
|
||||||
super(player);
|
super(player);
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,13 @@ public class PlayerPlotDeniedEvent extends Event {
|
|||||||
private Player initiator;
|
private Player initiator;
|
||||||
private boolean added;
|
private boolean added;
|
||||||
private UUID player;
|
private UUID player;
|
||||||
|
/**
|
||||||
|
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a plot
|
||||||
|
* @param initiator
|
||||||
|
* @param plot
|
||||||
|
* @param player
|
||||||
|
* @param added
|
||||||
|
*/
|
||||||
public PlayerPlotDeniedEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
public PlayerPlotDeniedEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
||||||
this.initiator = initiator;
|
this.initiator = initiator;
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
@ -26,18 +32,31 @@ public class PlayerPlotDeniedEvent extends Event {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a user was added
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public boolean wasAdded() {
|
public boolean wasAdded() {
|
||||||
return this.added;
|
return this.added;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The player added/removed
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
public UUID getPlayer() {
|
public UUID getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The player initiating the action
|
||||||
|
* @return Player
|
||||||
|
*/
|
||||||
public Player getInitiator() {
|
public Player getInitiator() {
|
||||||
return this.initiator;
|
return this.initiator;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,13 @@ public class PlayerPlotHelperEvent extends Event {
|
|||||||
private Player initiator;
|
private Player initiator;
|
||||||
private boolean added;
|
private boolean added;
|
||||||
private UUID player;
|
private UUID player;
|
||||||
|
/**
|
||||||
|
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
|
||||||
|
* @param initiator
|
||||||
|
* @param plot
|
||||||
|
* @param player
|
||||||
|
* @param added
|
||||||
|
*/
|
||||||
public PlayerPlotHelperEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
public PlayerPlotHelperEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
||||||
this.initiator = initiator;
|
this.initiator = initiator;
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
@ -26,18 +32,31 @@ public class PlayerPlotHelperEvent extends Event {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a player was added
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public boolean wasAdded() {
|
public boolean wasAdded() {
|
||||||
return this.added;
|
return this.added;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The UUID added/removed
|
||||||
|
* @return UUID
|
||||||
|
*/
|
||||||
public UUID getPlayer() {
|
public UUID getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The player initiating the action
|
||||||
|
* @return Player
|
||||||
|
*/
|
||||||
public Player getInitiator() {
|
public Player getInitiator() {
|
||||||
return this.initiator;
|
return this.initiator;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
/**
|
||||||
|
* Called when a player teleports to a plot
|
||||||
|
*/
|
||||||
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
|
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
@ -24,7 +26,12 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
|||||||
private Plot plot;
|
private Plot plot;
|
||||||
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
/**
|
||||||
|
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
|
||||||
|
* @param player
|
||||||
|
* @param from
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlayerTeleportToPlotEvent(Player player, Location from, Plot plot) {
|
public PlayerTeleportToPlotEvent(Player player, Location from, Plot plot) {
|
||||||
super(player);
|
super(player);
|
||||||
this.from = from;
|
this.from = from;
|
||||||
@ -36,10 +43,18 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
|||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the from location
|
||||||
|
* @return Location
|
||||||
|
*/
|
||||||
public Location getFrom() {
|
public Location getFrom() {
|
||||||
return this.from;
|
return this.from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-09.
|
* Called when a plot is deleted
|
||||||
*/
|
*/
|
||||||
public class PlotDeleteEvent extends Event implements Cancellable {
|
public class PlotDeleteEvent extends Event implements Cancellable {
|
||||||
private static HandlerList handlers = new HandlerList();
|
private static HandlerList handlers = new HandlerList();
|
||||||
@ -24,16 +24,28 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
private PlotId id;
|
private PlotId id;
|
||||||
private String world;
|
private String world;
|
||||||
|
/**
|
||||||
|
* PlotDeleteEvent: Called when a plot is deleted
|
||||||
|
* @param world
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
public PlotDeleteEvent(String world, PlotId id) {
|
public PlotDeleteEvent(String world, PlotId id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PlotId
|
||||||
|
* @return PlotId
|
||||||
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the world name
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.Flag;
|
|||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-09.
|
* Called when a Flag is added to a plot
|
||||||
*/
|
*/
|
||||||
public class PlotFlagAddEvent extends Event implements Cancellable {
|
public class PlotFlagAddEvent extends Event implements Cancellable {
|
||||||
private static HandlerList handlers = new HandlerList();
|
private static HandlerList handlers = new HandlerList();
|
||||||
@ -26,15 +26,28 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
|||||||
private Plot plot;
|
private Plot plot;
|
||||||
private Flag flag;
|
private Flag flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotFlagAddEvent: Called when a Flag is added to a plot
|
||||||
|
* @param flag
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlotFlagAddEvent(Flag flag, Plot plot) {
|
public PlotFlagAddEvent(Flag flag, Plot plot) {
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the flag involved
|
||||||
|
* @return Flag
|
||||||
|
*/
|
||||||
public Flag getFlag() {
|
public Flag getFlag() {
|
||||||
return this.flag;
|
return this.flag;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.Flag;
|
|||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-09.
|
* Called when a flag is removed from a plot
|
||||||
*/
|
*/
|
||||||
public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
||||||
private static HandlerList handlers = new HandlerList();
|
private static HandlerList handlers = new HandlerList();
|
||||||
@ -26,15 +26,26 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
|||||||
private Plot plot;
|
private Plot plot;
|
||||||
private Flag flag;
|
private Flag flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
||||||
|
* @param flag
|
||||||
|
* @param plot
|
||||||
|
*/
|
||||||
public PlotFlagRemoveEvent(Flag flag, Plot plot) {
|
public PlotFlagRemoveEvent(Flag flag, Plot plot) {
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the plot involved
|
||||||
|
* @return Plot
|
||||||
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the flag involved
|
||||||
|
* @return Flag
|
||||||
|
*/
|
||||||
public Flag getFlag() {
|
public Flag getFlag() {
|
||||||
return this.flag;
|
return this.flag;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
||||||
BlockVector vector2 = new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ());
|
BlockVector vector2 = new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ());
|
||||||
|
|
||||||
ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + ";" + plot.getId().y, vector1, vector2);
|
ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2);
|
||||||
|
|
||||||
DefaultDomain owner = new DefaultDomain();
|
DefaultDomain owner = new DefaultDomain();
|
||||||
owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player));
|
owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player));
|
||||||
@ -57,6 +57,6 @@ public class WorldGuardListener implements Listener {
|
|||||||
World world = Bukkit.getWorld(event.getWorld());
|
World world = Bukkit.getWorld(event.getWorld());
|
||||||
|
|
||||||
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
manager.removeRegion(plot.x + ";" + plot.y);
|
manager.removeRegion(plot.x + "-" + plot.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user