mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Time for our weekly code cleanup!
Please tell me if doing this annoys you.
This commit is contained in:
parent
58ed037fad
commit
980499a193
@ -11,8 +11,10 @@ public class AbstractFlag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractFlag is a parameter used in creating a new Flag
|
* AbstractFlag is a parameter used in creating a new Flag
|
||||||
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* The key must be alphabetical characters and <= 16 characters in length
|
* 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)) {
|
||||||
@ -23,8 +25,10 @@ public class AbstractFlag {
|
|||||||
}
|
}
|
||||||
this.key = key.toLowerCase();
|
this.key = key.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractFlag key
|
* AbstractFlag key
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
|
@ -21,27 +21,15 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Ratings
|
* Ratings
|
||||||
*/
|
*/
|
||||||
RATING_NOT_VALID("&cYou need to specify a number between 1 and 10"),
|
RATING_NOT_VALID("&cYou need to specify a number between 1 and 10"), RATING_ALREADY_EXISTS("&cYou have already rated plot &c%s"), RATING_APPLIED("&cYou successfully rated plot &6%s"), RATING_NOT_YOUR_OWN("&cYou cannot rate your own plot"), RATING_NOT_OWNED("&cYou cannot rate a plot that is not claimed by anyone"),
|
||||||
RATING_ALREADY_EXISTS("&cYou have already rated plot &c%s"),
|
|
||||||
RATING_APPLIED("&cYou successfully rated plot &6%s"),
|
|
||||||
RATING_NOT_YOUR_OWN("&cYou cannot rate your own plot"),
|
|
||||||
RATING_NOT_OWNED("&cYou cannot rate a plot that is not claimed by anyone"),
|
|
||||||
/*
|
/*
|
||||||
* Economy Stuff
|
* Economy Stuff
|
||||||
*/
|
*/
|
||||||
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"),
|
CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), REMOVED_BALANCE("&6%s &chas been taken from your balance"),
|
||||||
CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"),
|
|
||||||
REMOVED_BALANCE("&6%s &chas been taken from your balance"),
|
|
||||||
/*
|
/*
|
||||||
* Setup Stuff
|
* Setup Stuff
|
||||||
*/
|
*/
|
||||||
SETUP_INIT("&6PlotSquared Setup -> Setup a new plotworld"),
|
SETUP_INIT("&6PlotSquared Setup -> Setup a new plotworld"), SETUP_STEP("&cStep &6%s&c: %s &c<Expecting: &6%s&c, Default: &6%s&c>"), SETUP_INVALID_ARG("&c%s is not a valid argument for step %s. To cancel setup use: /plot setup cancel"), SETUP_VALID_ARG("&cValue &6%s &cset for step %s"), SETUP_FINISHED("&cFinished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD you will need to import this world. Otherwise you will need to add this world to the 'bukkit.yml' file (See installation tutorial for more info)"), SETUP_WORLD_TAKEN("&c%s is already a registered plotworld"), SETUP_MISSING_WORLD("&cYou need to specify a world name (&6/p setup {world}&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"),
|
||||||
SETUP_STEP("&cStep &6%s&c: %s &c<Expecting: &6%s&c, Default: &6%s&c>"),
|
|
||||||
SETUP_INVALID_ARG("&c%s is not a valid argument for step %s. To cancel setup use: /plot setup cancel"),
|
|
||||||
SETUP_VALID_ARG("&cValue &6%s &cset for step %s"),
|
|
||||||
SETUP_FINISHED("&cFinished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD you will need to import this world. Otherwise you will need to add this world to the 'bukkit.yml' file (See installation tutorial for more info)"),
|
|
||||||
SETUP_WORLD_TAKEN("&c%s is already a registered plotworld"),
|
|
||||||
SETUP_MISSING_WORLD("&cYou need to specify a world name (&6/p setup {world}&c)\n&6Additional commands:\n&c - &6/p setup <value>\n&c - &6/p setup back\n&c - &6/p setup cancel"),
|
|
||||||
/*
|
/*
|
||||||
* Schematic Stuff
|
* Schematic Stuff
|
||||||
*/
|
*/
|
||||||
@ -77,11 +65,9 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Permission
|
* Permission
|
||||||
*/
|
*/
|
||||||
NO_SCHEMATIC_PERMISSION("&cYou don't have the permission required to use schematic &6%s"),
|
NO_SCHEMATIC_PERMISSION("&cYou don't have the permission required to use schematic &6%s"), NO_PERMISSION("&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS("&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS("&cYou can't claim more plots."), YOU_BE_DENIED("&cYou are not allowed to enter this plot"),
|
||||||
NO_PERMISSION("&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS("&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS("&cYou can't claim more plots."), YOU_BE_DENIED("&cYou are not allowed to enter this plot"),
|
|
||||||
|
|
||||||
NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED("&cAn unlink is required to do this."), UNLINK_IMPOSSIBLE("&cYou can only unlink a mega-plot"),
|
NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED("&cAn unlink is required to do this."), UNLINK_IMPOSSIBLE("&cYou can only unlink a mega-plot"), NO_MERGE_TO_MEGA("&cMega plots cannot be merged into. Please merge from the desired mega plot."),
|
||||||
NO_MERGE_TO_MEGA("&cMega plots cannot be merged into. Please merge from the desired mega plot."),
|
|
||||||
/*
|
/*
|
||||||
* Commands
|
* Commands
|
||||||
*/
|
*/
|
||||||
@ -229,7 +215,7 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
C(String d) {
|
C(String d) {
|
||||||
this.d = d;
|
this.d = d;
|
||||||
if(PlotMain.translations == null) {
|
if (PlotMain.translations == null) {
|
||||||
this.s = d;
|
this.s = d;
|
||||||
} else {
|
} else {
|
||||||
this.s = PlotMain.translations.getString(this.toString());
|
this.s = PlotMain.translations.getString(this.toString());
|
||||||
|
@ -8,15 +8,17 @@ public class Flag {
|
|||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag object used to store basic information for a Plot.
|
* Flag object used to store basic information for a Plot. Flags are a
|
||||||
* Flags are a key/value pair.
|
* key/value pair. For a flag to be usable by a player, you need to register
|
||||||
* For a flag to be usable by a player, you need to register it with PlotSquared.
|
* it with PlotSquared.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* AbstractFlag
|
* AbstractFlag
|
||||||
* @param value
|
* @param value
|
||||||
* Value must be alphanumerical (can have spaces) and be <= 48 characters
|
* Value must be alphanumerical (can have spaces) and be <= 48
|
||||||
* @throws IllegalArgumentException if you provide inadequate inputs
|
* 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))) {
|
||||||
@ -31,6 +33,7 @@ public class Flag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the AbstractFlag used in creating the flag
|
* Get the AbstractFlag used in creating the flag
|
||||||
|
*
|
||||||
* @return AbstractFlag
|
* @return AbstractFlag
|
||||||
*/
|
*/
|
||||||
public AbstractFlag getAbstractFlag() {
|
public AbstractFlag getAbstractFlag() {
|
||||||
@ -39,6 +42,7 @@ public class Flag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the key for the AbstractFlag
|
* Get the key for the AbstractFlag
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
@ -47,6 +51,7 @@ public class Flag {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value
|
* Get the value
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
|
@ -7,16 +7,17 @@ import java.util.Set;
|
|||||||
public class FlagManager {
|
public class FlagManager {
|
||||||
|
|
||||||
// TODO add some flags
|
// TODO add some flags
|
||||||
// - Plot clear interval
|
// - Plot clear interval
|
||||||
// - Mob cap
|
// - Mob cap
|
||||||
// - customized plot composition
|
// - customized plot composition
|
||||||
// - greeting / leaving message
|
// - greeting / leaving message
|
||||||
// OR in the flag command, allow users to set worldguard flags.
|
// OR in the flag command, allow users to set worldguard flags.
|
||||||
|
|
||||||
private static ArrayList<AbstractFlag> flags = new ArrayList<AbstractFlag>();
|
private static ArrayList<AbstractFlag> flags = new ArrayList<AbstractFlag>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an AbstractFlag with PlotSquared
|
* Register an AbstractFlag with PlotSquared
|
||||||
|
*
|
||||||
* @param flag
|
* @param flag
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -29,6 +30,7 @@ public class FlagManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of registered AbstractFlag objects
|
* Get a list of registered AbstractFlag objects
|
||||||
|
*
|
||||||
* @return List (AbstractFlag)
|
* @return List (AbstractFlag)
|
||||||
*/
|
*/
|
||||||
public static List<AbstractFlag> getFlags() {
|
public static List<AbstractFlag> getFlags() {
|
||||||
@ -36,8 +38,8 @@ public class FlagManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an AbstractFlag by a string
|
* Get an AbstractFlag by a string Returns null if flag does not exist
|
||||||
* Returns null if flag does not exist
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @return AbstractFlag
|
* @return AbstractFlag
|
||||||
*/
|
*/
|
||||||
@ -55,7 +57,7 @@ public class FlagManager {
|
|||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
* @param create
|
* @param create
|
||||||
* If to create the flag if it does not exist
|
* If to create the flag if it does not exist
|
||||||
* @return AbstractFlag
|
* @return AbstractFlag
|
||||||
*/
|
*/
|
||||||
public static AbstractFlag getFlag(String string, boolean create) {
|
public static AbstractFlag getFlag(String string, boolean create) {
|
||||||
@ -69,9 +71,9 @@ public class FlagManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a registered AbstractFlag
|
* Remove a registered AbstractFlag
|
||||||
|
*
|
||||||
* @param flag
|
* @param flag
|
||||||
* @return boolean
|
* @return boolean Result of operation
|
||||||
* Result of operation
|
|
||||||
*/
|
*/
|
||||||
public static boolean removeFlag(AbstractFlag flag) {
|
public static boolean removeFlag(AbstractFlag flag) {
|
||||||
return flags.remove(flag);
|
return flags.remove(flag);
|
||||||
@ -79,6 +81,7 @@ public class FlagManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flags for a plot
|
* Get the flags for a plot
|
||||||
|
*
|
||||||
* @param plot
|
* @param plot
|
||||||
* @return List (AbstractFlag)
|
* @return List (AbstractFlag)
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.LocalWorld;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
|
|
||||||
@ -30,9 +32,9 @@ public class PWE {
|
|||||||
PlotId id = PlayerFunctions.getPlot(l);
|
PlotId id = PlayerFunctions.getPlot(l);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
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());
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (p.hasPermission("plots.worldedit.member") && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
if (p.hasPermission("plots.worldedit.member") && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
||||||
@ -41,8 +43,7 @@ public class PWE {
|
|||||||
removeMask(p, s);
|
removeMask(p, s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
World w = p.getWorld();
|
World w = p.getWorld();
|
||||||
|
|
||||||
@ -63,13 +64,12 @@ public class PWE {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noMask(s)) {
|
if (noMask(s)) {
|
||||||
System.out.print("NONE");
|
|
||||||
BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p);
|
BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p);
|
||||||
Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
|
Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
|
||||||
|
|
||||||
s.setMask(new com.sk89q.worldedit.masks.RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
|
s.setMask(new com.sk89q.worldedit.masks.RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,9 +77,8 @@ public class PWE {
|
|||||||
public static boolean noMask(LocalSession s) {
|
public static boolean noMask(LocalSession s) {
|
||||||
try {
|
try {
|
||||||
com.sk89q.worldedit.masks.Mask mask = s.getMask();
|
com.sk89q.worldedit.masks.Mask mask = s.getMask();
|
||||||
return mask==null;
|
return mask == null;
|
||||||
}
|
} catch (Throwable e) {
|
||||||
catch (Throwable e) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,8 +89,7 @@ public class PWE {
|
|||||||
System.out.print(1);
|
System.out.print(1);
|
||||||
s.setMask(null);
|
s.setMask(null);
|
||||||
System.out.print(2);
|
System.out.print(2);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
catch (Throwable e) {
|
|
||||||
System.out.print(3);
|
System.out.print(3);
|
||||||
com.sk89q.worldedit.masks.Mask mask = null;
|
com.sk89q.worldedit.masks.Mask mask = null;
|
||||||
s.setMask(mask);
|
s.setMask(mask);
|
||||||
@ -103,13 +101,13 @@ public class PWE {
|
|||||||
public static void removeMask(Player p) {
|
public static void removeMask(Player p) {
|
||||||
try {
|
try {
|
||||||
LocalSession s;
|
LocalSession s;
|
||||||
if(PlotMain.worldEdit == null) {
|
if (PlotMain.worldEdit == null) {
|
||||||
s = WorldEdit.getInstance().getSession(p.getName());
|
s = WorldEdit.getInstance().getSession(p.getName());
|
||||||
} else {
|
} else {
|
||||||
s = PlotMain.worldEdit.getSession(p);
|
s = PlotMain.worldEdit.getSession(p);
|
||||||
}
|
}
|
||||||
removeMask(p, s);
|
removeMask(p, s);
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
throw new PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY, "WorldEdit == Null?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -61,7 +60,7 @@ public class PlayerFunctions {
|
|||||||
ArrayList<PlotId> myplots = new ArrayList<PlotId>();
|
ArrayList<PlotId> myplots = new ArrayList<PlotId>();
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
myplots.add(new PlotId(x,y));
|
myplots.add(new PlotId(x, y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,22 +69,24 @@ public class PlayerFunctions {
|
|||||||
|
|
||||||
public static Plot getBottomPlot(World world, Plot plot) {
|
public static Plot getBottomPlot(World world, Plot plot) {
|
||||||
if (plot.settings.getMerged(0)) {
|
if (plot.settings.getMerged(0)) {
|
||||||
return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y-1)));
|
return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1)));
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(3)) {
|
if (plot.settings.getMerged(3)) {
|
||||||
return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x-1, plot.id.y)));
|
return getBottomPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x - 1, plot.id.y)));
|
||||||
}
|
}
|
||||||
return plot;
|
return plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plot getTopPlot(World world, Plot plot) {
|
public static Plot getTopPlot(World world, Plot plot) {
|
||||||
if (plot.settings.getMerged(2)) {
|
if (plot.settings.getMerged(2)) {
|
||||||
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y+1)));
|
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1)));
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(1)) {
|
if (plot.settings.getMerged(1)) {
|
||||||
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x+1, plot.id.y)));
|
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x + 1, plot.id.y)));
|
||||||
}
|
}
|
||||||
return plot;
|
return plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param loc
|
* @param loc
|
||||||
@ -100,35 +101,34 @@ public class PlayerFunctions {
|
|||||||
int size = plotworld.PLOT_WIDTH + plotworld.ROAD_WIDTH;
|
int size = plotworld.PLOT_WIDTH + plotworld.ROAD_WIDTH;
|
||||||
int pathWidthLower;
|
int pathWidthLower;
|
||||||
if ((plotworld.ROAD_WIDTH % 2) == 0) {
|
if ((plotworld.ROAD_WIDTH % 2) == 0) {
|
||||||
pathWidthLower = (int) (Math.floor(plotworld.ROAD_WIDTH / 2)-1);
|
pathWidthLower = (int) (Math.floor(plotworld.ROAD_WIDTH / 2) - 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pathWidthLower = (int) Math.floor(plotworld.ROAD_WIDTH / 2);
|
pathWidthLower = (int) Math.floor(plotworld.ROAD_WIDTH / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dx = x/size;
|
int dx = x / size;
|
||||||
int dz = z/size;
|
int dz = z / size;
|
||||||
|
|
||||||
if (x<0) {
|
if (x < 0) {
|
||||||
dx--;
|
dx--;
|
||||||
x+=((-dx) * size);
|
x += ((-dx) * size);
|
||||||
}
|
}
|
||||||
if (z<0) {
|
if (z < 0) {
|
||||||
dz--;
|
dz--;
|
||||||
z+=((-dz) * size);
|
z += ((-dz) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rx = (x)%size;
|
int rx = (x) % size;
|
||||||
int rz = (z)%size;
|
int rz = (z) % size;
|
||||||
|
|
||||||
int end = pathWidthLower+plotworld.PLOT_WIDTH;
|
int end = pathWidthLower + plotworld.PLOT_WIDTH;
|
||||||
boolean northSouth = rz<=pathWidthLower || rz>pathWidthLower+plotworld.PLOT_WIDTH;
|
boolean northSouth = (rz <= pathWidthLower) || (rz > (pathWidthLower + plotworld.PLOT_WIDTH));
|
||||||
boolean eastWest = rx<=pathWidthLower || rx>end;
|
boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||||
|
|
||||||
if (northSouth || eastWest) {
|
if (northSouth || eastWest) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new PlotId(dx+1,dz+1);
|
return new PlotId(dx + 1, dz + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotId getPlot(Location loc) {
|
public static PlotId getPlot(Location loc) {
|
||||||
@ -137,43 +137,42 @@ public class PlayerFunctions {
|
|||||||
|
|
||||||
String world = loc.getWorld().getName();
|
String world = loc.getWorld().getName();
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
if (plotworld==null) {
|
if (plotworld == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int size = plotworld.PLOT_WIDTH + plotworld.ROAD_WIDTH;
|
int size = plotworld.PLOT_WIDTH + plotworld.ROAD_WIDTH;
|
||||||
int pathWidthLower;
|
int pathWidthLower;
|
||||||
if ((plotworld.ROAD_WIDTH % 2) == 0) {
|
if ((plotworld.ROAD_WIDTH % 2) == 0) {
|
||||||
pathWidthLower = (int) (Math.floor(plotworld.ROAD_WIDTH / 2)-1);
|
pathWidthLower = (int) (Math.floor(plotworld.ROAD_WIDTH / 2) - 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pathWidthLower = (int) Math.floor(plotworld.ROAD_WIDTH / 2);
|
pathWidthLower = (int) Math.floor(plotworld.ROAD_WIDTH / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dx = x/size;
|
int dx = x / size;
|
||||||
int dz = z/size;
|
int dz = z / size;
|
||||||
|
|
||||||
if (x<0) {
|
if (x < 0) {
|
||||||
dx--;
|
dx--;
|
||||||
x+=((-dx) * size);
|
x += ((-dx) * size);
|
||||||
}
|
}
|
||||||
if (z<0) {
|
if (z < 0) {
|
||||||
dz--;
|
dz--;
|
||||||
z+=((-dz) * size);
|
z += ((-dz) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rx = (x)%size;
|
int rx = (x) % size;
|
||||||
int rz = (z)%size;
|
int rz = (z) % size;
|
||||||
|
|
||||||
int end = pathWidthLower+plotworld.PLOT_WIDTH;
|
int end = pathWidthLower + plotworld.PLOT_WIDTH;
|
||||||
|
|
||||||
boolean northSouth = rz<=pathWidthLower || rz>pathWidthLower+plotworld.PLOT_WIDTH;
|
boolean northSouth = (rz <= pathWidthLower) || (rz > (pathWidthLower + plotworld.PLOT_WIDTH));
|
||||||
boolean eastWest = rx<=pathWidthLower || rx>end;
|
boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||||
|
|
||||||
if (northSouth && eastWest) {
|
if (northSouth && eastWest) {
|
||||||
// This means you are in the intersection
|
// This means you are in the intersection
|
||||||
PlotId id = getPlotAbs(loc.add(plotworld.ROAD_WIDTH, 0, plotworld.ROAD_WIDTH));
|
PlotId id = getPlotAbs(loc.add(plotworld.ROAD_WIDTH, 0, plotworld.ROAD_WIDTH));
|
||||||
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot==null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((plot.settings.getMerged(0) && plot.settings.getMerged(3))) {
|
if ((plot.settings.getMerged(0) && plot.settings.getMerged(3))) {
|
||||||
@ -182,10 +181,11 @@ public class PlayerFunctions {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (northSouth) {
|
if (northSouth) {
|
||||||
// You are on a road running West to East (yeah, I named the var poorly)
|
// You are on a road running West to East (yeah, I named the var
|
||||||
|
// poorly)
|
||||||
PlotId id = getPlotAbs(loc.add(0, 0, plotworld.ROAD_WIDTH));
|
PlotId id = getPlotAbs(loc.add(0, 0, plotworld.ROAD_WIDTH));
|
||||||
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot==null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(0)) {
|
if (plot.settings.getMerged(0)) {
|
||||||
@ -197,7 +197,7 @@ public class PlayerFunctions {
|
|||||||
// This is the road separating an Eastern and Western plot
|
// This is the road separating an Eastern and Western plot
|
||||||
PlotId id = getPlotAbs(loc.add(plotworld.ROAD_WIDTH, 0, 0));
|
PlotId id = getPlotAbs(loc.add(plotworld.ROAD_WIDTH, 0, 0));
|
||||||
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot==null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (plot.settings.getMerged(3)) {
|
if (plot.settings.getMerged(3)) {
|
||||||
@ -205,9 +205,9 @@ public class PlayerFunctions {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PlotId id = new PlotId(dx+1,dz+1);
|
PlotId id = new PlotId(dx + 1, dz + 1);
|
||||||
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
if (plot==null) {
|
if (plot == null) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
return getBottomPlot(loc.getWorld(), plot).id;
|
return getBottomPlot(loc.getWorld(), plot).id;
|
||||||
|
@ -157,7 +157,7 @@ public class Plot implements Cloneable {
|
|||||||
* @return true if the player is added as a helper or is the owner
|
* @return true if the player is added as a helper or is the owner
|
||||||
*/
|
*/
|
||||||
public boolean hasRights(Player player) {
|
public boolean hasRights(Player player) {
|
||||||
return player.hasPermission("plots.admin") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(player.getUniqueId())) || ((this.owner != null) && this.owner.equals(player.getUniqueId())) || (this.owner != null && this.trusted != null && Bukkit.getPlayer(this.owner) != null && (this.trusted.contains(player.getUniqueId()) || this.trusted.contains(DBFunc.everyone)));
|
return player.hasPermission("plots.admin") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(player.getUniqueId())) || ((this.owner != null) && this.owner.equals(player.getUniqueId())) || ((this.owner != null) && (this.trusted != null) && (Bukkit.getPlayer(this.owner) != null) && (this.trusted.contains(player.getUniqueId()) || this.trusted.contains(DBFunc.everyone)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +226,6 @@ public class Plot implements Cloneable {
|
|||||||
this.helpers.add(uuid);
|
this.helpers.add(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add someone as a trusted user (use DBFunc as well)
|
* Add someone as a trusted user (use DBFunc as well)
|
||||||
*
|
*
|
||||||
|
@ -9,8 +9,19 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import java.io.File;
|
||||||
import org.bukkit.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
@ -19,8 +30,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot functions
|
* plot functions
|
||||||
@ -38,42 +48,45 @@ public class PlotHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* direction 0 = north, 1 = south, etc:
|
* direction 0 = north, 1 = south, etc:
|
||||||
|
*
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param direction
|
* @param direction
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static PlotId getPlotIdRelative(PlotId id, int direction) {
|
public static PlotId getPlotIdRelative(PlotId id, int direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0:
|
case 0:
|
||||||
return new PlotId(id.x,id.y-1);
|
return new PlotId(id.x, id.y - 1);
|
||||||
case 1:
|
case 1:
|
||||||
return new PlotId(id.x+1,id.y);
|
return new PlotId(id.x + 1, id.y);
|
||||||
case 2:
|
case 2:
|
||||||
return new PlotId(id.x,id.y+1);
|
return new PlotId(id.x, id.y + 1);
|
||||||
case 3:
|
case 3:
|
||||||
return new PlotId(id.x-1,id.y);
|
return new PlotId(id.x - 1, id.y);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completely merges a set of plots<br>
|
* Completely merges a set of plots<br>
|
||||||
* <b>(There are no checks to make sure you supply the correct arguments)</b><br>
|
* <b>(There are no checks to make sure you supply the correct
|
||||||
* - Misuse of this method can result in unusable plots<br>
|
* arguments)</b><br>
|
||||||
* - the set of plots must belong to one owner and be rectangular<br>
|
* - Misuse of this method can result in unusable plots<br>
|
||||||
* - the plot array must be sorted in ascending order<br>
|
* - the set of plots must belong to one owner and be rectangular<br>
|
||||||
* - Road will be removed where required<br>
|
* - the plot array must be sorted in ascending order<br>
|
||||||
* - changes will be saved to DB<br>
|
* - Road will be removed where required<br>
|
||||||
|
* - changes will be saved to DB<br>
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param plotIds
|
* @param plotIds
|
||||||
* @return boolean (success)
|
* @return boolean (success)
|
||||||
*/
|
*/
|
||||||
public static boolean mergePlots(World world, ArrayList<PlotId> plotIds) {
|
public static boolean mergePlots(World world, ArrayList<PlotId> plotIds) {
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
int pathsize = plotworld.ROAD_WIDTH;
|
int pathsize = plotworld.ROAD_WIDTH;
|
||||||
int plotheight = plotworld.PLOT_HEIGHT;
|
int plotheight = plotworld.PLOT_HEIGHT;
|
||||||
|
|
||||||
if (plotIds.size()<2) {
|
if (plotIds.size() < 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +108,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlotId pos1 = plotIds.get(0);
|
PlotId pos1 = plotIds.get(0);
|
||||||
PlotId pos2 = plotIds.get(plotIds.size()-1);
|
PlotId pos2 = plotIds.get(plotIds.size() - 1);
|
||||||
|
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
@ -103,7 +116,7 @@ public class PlotHelper {
|
|||||||
boolean lx = x < pos2.x;
|
boolean lx = x < pos2.x;
|
||||||
boolean ly = y < pos2.y;
|
boolean ly = y < pos2.y;
|
||||||
|
|
||||||
PlotId id = new PlotId(x,y);
|
PlotId id = new PlotId(x, y);
|
||||||
Plot plot = PlotMain.getPlots(world).get(id);
|
Plot plot = PlotMain.getPlots(world).get(id);
|
||||||
|
|
||||||
if (lx) {
|
if (lx) {
|
||||||
@ -111,19 +124,19 @@ public class PlotHelper {
|
|||||||
if (!plot.settings.getMerged(1) || !plot.settings.getMerged(2)) {
|
if (!plot.settings.getMerged(1) || !plot.settings.getMerged(2)) {
|
||||||
Location loc = getPlotTopLocAbs(world, id);
|
Location loc = getPlotTopLocAbs(world, id);
|
||||||
|
|
||||||
int sx = loc.getBlockX()+1;
|
int sx = loc.getBlockX() + 1;
|
||||||
int ex = sx + pathsize - 1;
|
int ex = (sx + pathsize) - 1;
|
||||||
int sz = loc.getBlockZ()+1;
|
int sz = loc.getBlockZ() + 1;
|
||||||
int ez = sz + pathsize - 1;
|
int ez = (sz + pathsize) - 1;
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world,sx,plotheight+1,sz), new Location(world,ex+1,257+1,ez+1), (short) 0);
|
PlotHelper.setSimpleCuboid(world, new Location(world, sx, plotheight + 1, sz), new Location(world, ex + 1, 257 + 1, ez + 1), (short) 0);
|
||||||
|
|
||||||
PlotHelper.setCuboid(world, new Location(world,sx+1,1,sz+1), new Location(world,ex,plotheight,ez), filling,filling_data);
|
PlotHelper.setCuboid(world, new Location(world, sx + 1, 1, sz + 1), new Location(world, ex, plotheight, ez), filling, filling_data);
|
||||||
PlotHelper.setCuboid(world, new Location(world,sx+1,plotheight,sz+1), new Location(world,ex,plotheight+1,ez), plotfloors,plotfloors_data);
|
PlotHelper.setCuboid(world, new Location(world, sx + 1, plotheight, sz + 1), new Location(world, ex, plotheight + 1, ez), plotfloors, plotfloors_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.settings.getMerged(1)) {
|
if (!plot.settings.getMerged(1)) {
|
||||||
Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x+1,y));
|
Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x + 1, y));
|
||||||
mergePlot(world, plot, plot2);
|
mergePlot(world, plot, plot2);
|
||||||
plot.settings.setMerged(1, true);
|
plot.settings.setMerged(1, true);
|
||||||
plot2.settings.setMerged(3, true);
|
plot2.settings.setMerged(3, true);
|
||||||
@ -131,7 +144,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
if (ly) {
|
if (ly) {
|
||||||
if (!plot.settings.getMerged(2)) {
|
if (!plot.settings.getMerged(2)) {
|
||||||
Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x,y+1));
|
Plot plot2 = PlotMain.getPlots(world).get(new PlotId(x, y + 1));
|
||||||
mergePlot(world, plot, plot2);
|
mergePlot(world, plot, plot2);
|
||||||
plot.settings.setMerged(2, true);
|
plot.settings.setMerged(2, true);
|
||||||
plot2.settings.setMerged(0, true);
|
plot2.settings.setMerged(0, true);
|
||||||
@ -142,16 +155,16 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Location megaPlotBot = getPlotBottomLoc(world, pos1);
|
Location megaPlotBot = getPlotBottomLoc(world, pos1);
|
||||||
Location megaPlotTop = getPlotTopLoc(world, pos2).add(1,0,1);
|
Location megaPlotTop = getPlotTopLoc(world, pos2).add(1, 0, 1);
|
||||||
|
|
||||||
short[] result_w = PlotHelper.getBlock(plotworld.WALL_BLOCK);
|
short[] result_w = PlotHelper.getBlock(plotworld.WALL_BLOCK);
|
||||||
short w_id = result_w[0];
|
short w_id = result_w[0];
|
||||||
byte w_v = (byte) result_w[1];
|
byte w_v = (byte) result_w[1];
|
||||||
|
|
||||||
for (int x = megaPlotBot.getBlockX(); x<=megaPlotTop.getBlockX(); x++) {
|
for (int x = megaPlotBot.getBlockX(); x <= megaPlotTop.getBlockX(); x++) {
|
||||||
for (int z = megaPlotBot.getBlockZ(); z<=megaPlotTop.getBlockZ(); z++) {
|
for (int z = megaPlotBot.getBlockZ(); z <= megaPlotTop.getBlockZ(); z++) {
|
||||||
if (z == megaPlotBot.getBlockZ() || z==megaPlotTop.getBlockZ() || x==megaPlotBot.getBlockX() || x==megaPlotTop.getBlockX()) {
|
if ((z == megaPlotBot.getBlockZ()) || (z == megaPlotTop.getBlockZ()) || (x == megaPlotBot.getBlockX()) || (x == megaPlotTop.getBlockX())) {
|
||||||
world.getBlockAt(x, plotworld.WALL_HEIGHT+1, z).setTypeIdAndData(w_id, w_v, false);
|
world.getBlockAt(x, plotworld.WALL_HEIGHT + 1, z).setTypeIdAndData(w_id, w_v, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,32 +173,32 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges 2 plots
|
* Merges 2 plots Removes the road inbetween <br>
|
||||||
* Removes the road inbetween
|
* - Assumes the first plot parameter is lower <br>
|
||||||
* <br> - Assumes the first plot parameter is lower
|
* - Assumes neither are a Mega-plot <br>
|
||||||
* <br> - Assumes neither are a Mega-plot
|
* - Assumes plots are directly next to each other <br>
|
||||||
* <br> - Assumes plots are directly next to each other
|
* - Saves to DB
|
||||||
* <br> - Saves to DB
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param lesserPlot
|
* @param lesserPlot
|
||||||
* @param greaterPlot
|
* @param greaterPlot
|
||||||
*/
|
*/
|
||||||
public static void mergePlot(World world, Plot lesserPlot, Plot greaterPlot) {
|
public static void mergePlot(World world, Plot lesserPlot, Plot greaterPlot) {
|
||||||
Location pos1 = getPlotBottomLocAbs(world, lesserPlot.id).add(1,0,1);
|
Location pos1 = getPlotBottomLocAbs(world, lesserPlot.id).add(1, 0, 1);
|
||||||
Location pos2 = getPlotTopLocAbs(world, lesserPlot.id);
|
Location pos2 = getPlotTopLocAbs(world, lesserPlot.id);
|
||||||
|
|
||||||
Location pos3 = getPlotBottomLocAbs(world, greaterPlot.id).add(1,0,1);
|
Location pos3 = getPlotBottomLocAbs(world, greaterPlot.id).add(1, 0, 1);
|
||||||
Location pos4 = getPlotTopLocAbs(world, greaterPlot.id);
|
Location pos4 = getPlotTopLocAbs(world, greaterPlot.id);
|
||||||
|
|
||||||
int sx = Math.max(pos1.getBlockX(),pos2.getBlockX());
|
int sx = Math.max(pos1.getBlockX(), pos2.getBlockX());
|
||||||
int ex = Math.min(pos3.getBlockX(),pos4.getBlockX());
|
int ex = Math.min(pos3.getBlockX(), pos4.getBlockX());
|
||||||
int sz = Math.max(pos1.getBlockZ(),pos2.getBlockZ());
|
int sz = Math.max(pos1.getBlockZ(), pos2.getBlockZ());
|
||||||
int ez = Math.min(pos3.getBlockZ(),pos4.getBlockZ());
|
int ez = Math.min(pos3.getBlockZ(), pos4.getBlockZ());
|
||||||
|
|
||||||
int startx = Math.min(sx,ex);
|
int startx = Math.min(sx, ex);
|
||||||
int startz = Math.min(sz,ez);
|
int startz = Math.min(sz, ez);
|
||||||
int endx = Math.max(sx,ex)+1;
|
int endx = Math.max(sx, ex) + 1;
|
||||||
int endz = Math.max(sz,ez)+1;
|
int endz = Math.max(sz, ez) + 1;
|
||||||
|
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
|
|
||||||
@ -216,8 +229,7 @@ public class PlotHelper {
|
|||||||
greaterPlot.settings.setMerged(0, true);
|
greaterPlot.settings.setMerged(0, true);
|
||||||
startx--;
|
startx--;
|
||||||
endx++;
|
endx++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
noMerge = lesserPlot.settings.getMerged(1);
|
noMerge = lesserPlot.settings.getMerged(1);
|
||||||
|
|
||||||
@ -343,10 +355,10 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void autoMerge(World world, Plot plot, Player player) {
|
public static void autoMerge(World world, Plot plot, Player player) {
|
||||||
if (plot==null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(plot.owner==null) {
|
if (plot.owner == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.owner.equals(player.getUniqueId())) {
|
if (!plot.owner.equals(player.getUniqueId())) {
|
||||||
@ -359,26 +371,26 @@ public class PlotHelper {
|
|||||||
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
||||||
merge = false;
|
merge = false;
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y-1), new PlotId(top.x,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
||||||
if (ownsPlots(world,plots,player, 0)) {
|
if (ownsPlots(world, plots, player, 0)) {
|
||||||
merge = true;
|
merge = true;
|
||||||
mergePlots(world, plots);
|
mergePlots(world, plots);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y), new PlotId(top.x+1,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
||||||
if (ownsPlots(world,plots,player, 1)) {
|
if (ownsPlots(world, plots, player, 1)) {
|
||||||
merge = true;
|
merge = true;
|
||||||
mergePlots(world, plots);
|
mergePlots(world, plots);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x,bot.y), new PlotId(top.x,top.y+1));
|
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
||||||
if (ownsPlots(world,plots,player, 2)) {
|
if (ownsPlots(world, plots, player, 2)) {
|
||||||
merge = true;
|
merge = true;
|
||||||
mergePlots(world, plots);
|
mergePlots(world, plots);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x-1,bot.y), new PlotId(top.x,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
||||||
if (ownsPlots(world,plots,player, 3)) {
|
if (ownsPlots(world, plots, player, 3)) {
|
||||||
merge = true;
|
merge = true;
|
||||||
mergePlots(world, plots);
|
mergePlots(world, plots);
|
||||||
continue;
|
continue;
|
||||||
@ -388,20 +400,21 @@ public class PlotHelper {
|
|||||||
SetBlockFast.update(player);
|
SetBlockFast.update(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean ownsPlots(World world, ArrayList<PlotId> plots, Player player, int dir) {
|
private static boolean ownsPlots(World world, ArrayList<PlotId> plots, Player player, int dir) {
|
||||||
PlotId id_min = plots.get(0);
|
PlotId id_min = plots.get(0);
|
||||||
PlotId id_max = plots.get(plots.size()-1);
|
PlotId id_max = plots.get(plots.size() - 1);
|
||||||
for (PlotId myid:plots) {
|
for (PlotId myid : plots) {
|
||||||
Plot myplot = PlotMain.getPlots(world).get(myid);
|
Plot myplot = PlotMain.getPlots(world).get(myid);
|
||||||
if (myplot==null || !myplot.hasOwner() || !(myplot.getOwner().equals(player.getUniqueId()))) {
|
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(player.getUniqueId()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotId top = PlayerFunctions.getTopPlot(world, myplot).id;
|
PlotId top = PlayerFunctions.getTopPlot(world, myplot).id;
|
||||||
if ((top.x > id_max.x && dir != 1) || (top.y > id_max.y && dir != 2)) {
|
if (((top.x > id_max.x) && (dir != 1)) || ((top.y > id_max.y) && (dir != 2))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotId bot = PlayerFunctions.getBottomPlot(world, myplot).id;
|
PlotId bot = PlayerFunctions.getBottomPlot(world, myplot).id;
|
||||||
if ((bot.x < id_min.x && dir != 3) || (bot.y < id_min.y && dir != 0)) {
|
if (((bot.x < id_min.x) && (dir != 3)) || ((bot.y < id_min.y) && (dir != 0))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +454,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getWorldFolderSize(World world) {
|
public static double getWorldFolderSize(World world) {
|
||||||
//long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
|
// long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
|
||||||
File folder = world.getWorldFolder();
|
File folder = world.getWorldFolder();
|
||||||
long size = folder.length();
|
long size = folder.length();
|
||||||
return (((size) / 1024) / 1024);
|
return (((size) / 1024) / 1024);
|
||||||
@ -729,12 +742,12 @@ public class PlotHelper {
|
|||||||
public static void teleportPlayers(World world, Plot plot, boolean tile) {
|
public static void teleportPlayers(World world, Plot plot, boolean tile) {
|
||||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||||
for (int i = (pos2.getBlockX() / 16) * 16; i < 16 + (pos2. getBlockX() / 16) * 16; i= 16) {
|
for (int i = (pos2.getBlockX() / 16) * 16; i < (16 + ((pos2.getBlockX() / 16) * 16)); i = 16) {
|
||||||
for (int j = (pos1. getBlockZ() / 16) * 16; j < 16 + (pos2.getBlockZ() / 16) * 16; j += 16) {
|
for (int j = (pos1.getBlockZ() / 16) * 16; j < (16 + ((pos2.getBlockZ() / 16) * 16)); j += 16) {
|
||||||
Chunk chunk = world.getChunkAt(i, j);
|
Chunk chunk = world.getChunkAt(i, j);
|
||||||
for (Entity entity : chunk.getEntities()) {
|
for (Entity entity : chunk.getEntities()) {
|
||||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||||
if(id != null && id.equals(plot.id) && entity.getType() == EntityType.PLAYER) {
|
if ((id != null) && id.equals(plot.id) && (entity.getType() == EntityType.PLAYER)) {
|
||||||
entity.teleport(world.getSpawnLocation());
|
entity.teleport(world.getSpawnLocation());
|
||||||
// Should this teleport them to floor instead?
|
// Should this teleport them to floor instead?
|
||||||
}
|
}
|
||||||
@ -742,20 +755,21 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void clearAllEntities(World world, Plot plot, boolean tile) {
|
|
||||||
|
public static void clearAllEntities(World world, Plot plot, boolean tile) {
|
||||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||||
for (int i = (pos1.getBlockX() / 16) * 16; i < 16+(pos2.getBlockX() / 16) * 16; i += 16) {
|
for (int i = (pos1.getBlockX() / 16) * 16; i < (16 + ((pos2.getBlockX() / 16) * 16)); i += 16) {
|
||||||
for (int j = (pos1.getBlockZ() / 16) * 16; j < 16+(pos2.getBlockZ() / 16) * 16; j += 16) {
|
for (int j = (pos1.getBlockZ() / 16) * 16; j < (16 + ((pos2.getBlockZ() / 16) * 16)); j += 16) {
|
||||||
Chunk chunk = world.getChunkAt(i, j);
|
Chunk chunk = world.getChunkAt(i, j);
|
||||||
for (Entity entity:chunk.getEntities()) {
|
for (Entity entity : chunk.getEntities()) {
|
||||||
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||||
if (id!=null && id.equals(plot.id)) {
|
if ((id != null) && id.equals(plot.id)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tile) {
|
if (tile) {
|
||||||
for (BlockState entity:chunk.getTileEntities()) {
|
for (BlockState entity : chunk.getTileEntities()) {
|
||||||
entity.setRawData((byte) 0);
|
entity.setRawData((byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -765,6 +779,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear a plot
|
* Clear a plot
|
||||||
|
*
|
||||||
* @param requester
|
* @param requester
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -775,7 +790,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
// clear entities:
|
// clear entities:
|
||||||
clearAllEntities(world, plot, false);
|
clearAllEntities(world, plot, false);
|
||||||
//teleport players
|
// teleport players
|
||||||
teleportPlayers(world, plot, false);
|
teleportPlayers(world, plot, false);
|
||||||
|
|
||||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
@ -925,8 +940,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
@ -941,8 +955,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -959,8 +972,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
@ -972,8 +984,7 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1088,7 +1099,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
public static Location getPlotTopLoc(World world, PlotId id) {
|
public static Location getPlotTopLoc(World world, PlotId id) {
|
||||||
Plot plot = PlotMain.getPlots(world).get(id);
|
Plot plot = PlotMain.getPlots(world).get(id);
|
||||||
if (plot!=null) {
|
if (plot != null) {
|
||||||
id = PlayerFunctions.getTopPlot(world, plot).id;
|
id = PlayerFunctions.getTopPlot(world, plot).id;
|
||||||
}
|
}
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
@ -1103,7 +1114,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
public static Location getPlotBottomLoc(World world, PlotId id) {
|
public static Location getPlotBottomLoc(World world, PlotId id) {
|
||||||
Plot plot = PlotMain.getPlots(world).get(id);
|
Plot plot = PlotMain.getPlots(world).get(id);
|
||||||
if (plot!=null) {
|
if (plot != null) {
|
||||||
id = PlayerFunctions.getBottomPlot(world, plot).id;
|
id = PlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
}
|
}
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
|
@ -12,10 +12,11 @@ public class PlotId {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
||||||
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* The plot x coordinate
|
* The plot x coordinate
|
||||||
* @param y
|
* @param y
|
||||||
* The plot y coordinate
|
* The plot y coordinate
|
||||||
*/
|
*/
|
||||||
public PlotId(int x, int y) {
|
public PlotId(int x, int y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -39,7 +40,7 @@ public class PlotId {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.x+";"+this.y;
|
return this.x + ";" + this.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,126 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import static org.bukkit.Material.ACACIA_STAIRS;
|
||||||
|
import static org.bukkit.Material.BEACON;
|
||||||
|
import static org.bukkit.Material.BEDROCK;
|
||||||
|
import static org.bukkit.Material.BIRCH_WOOD_STAIRS;
|
||||||
|
import static org.bukkit.Material.BOOKSHELF;
|
||||||
|
import static org.bukkit.Material.BREWING_STAND;
|
||||||
|
import static org.bukkit.Material.BRICK;
|
||||||
|
import static org.bukkit.Material.BRICK_STAIRS;
|
||||||
|
import static org.bukkit.Material.BURNING_FURNACE;
|
||||||
|
import static org.bukkit.Material.CAKE_BLOCK;
|
||||||
|
import static org.bukkit.Material.CAULDRON;
|
||||||
|
import static org.bukkit.Material.CLAY;
|
||||||
|
import static org.bukkit.Material.CLAY_BRICK;
|
||||||
|
import static org.bukkit.Material.COAL_BLOCK;
|
||||||
|
import static org.bukkit.Material.COAL_ORE;
|
||||||
|
import static org.bukkit.Material.COBBLESTONE;
|
||||||
|
import static org.bukkit.Material.COBBLESTONE_STAIRS;
|
||||||
|
import static org.bukkit.Material.COBBLE_WALL;
|
||||||
|
import static org.bukkit.Material.COMMAND;
|
||||||
|
import static org.bukkit.Material.DARK_OAK_STAIRS;
|
||||||
|
import static org.bukkit.Material.DAYLIGHT_DETECTOR;
|
||||||
|
import static org.bukkit.Material.DIAMOND_BLOCK;
|
||||||
|
import static org.bukkit.Material.DIAMOND_ORE;
|
||||||
|
import static org.bukkit.Material.DIRT;
|
||||||
|
import static org.bukkit.Material.DISPENSER;
|
||||||
|
import static org.bukkit.Material.DROPPER;
|
||||||
|
import static org.bukkit.Material.EMERALD_BLOCK;
|
||||||
|
import static org.bukkit.Material.EMERALD_ORE;
|
||||||
|
import static org.bukkit.Material.ENCHANTMENT_TABLE;
|
||||||
|
import static org.bukkit.Material.ENDER_PORTAL_FRAME;
|
||||||
|
import static org.bukkit.Material.ENDER_STONE;
|
||||||
|
import static org.bukkit.Material.FURNACE;
|
||||||
|
import static org.bukkit.Material.GLASS;
|
||||||
|
import static org.bukkit.Material.GLOWSTONE;
|
||||||
|
import static org.bukkit.Material.GOLD_BLOCK;
|
||||||
|
import static org.bukkit.Material.GOLD_ORE;
|
||||||
|
import static org.bukkit.Material.GRASS;
|
||||||
|
import static org.bukkit.Material.GRAVEL;
|
||||||
|
import static org.bukkit.Material.HARD_CLAY;
|
||||||
|
import static org.bukkit.Material.HAY_BLOCK;
|
||||||
|
import static org.bukkit.Material.HUGE_MUSHROOM_1;
|
||||||
|
import static org.bukkit.Material.HUGE_MUSHROOM_2;
|
||||||
|
import static org.bukkit.Material.IRON_BLOCK;
|
||||||
|
import static org.bukkit.Material.IRON_ORE;
|
||||||
|
import static org.bukkit.Material.JACK_O_LANTERN;
|
||||||
|
import static org.bukkit.Material.JUKEBOX;
|
||||||
|
import static org.bukkit.Material.JUNGLE_WOOD_STAIRS;
|
||||||
|
import static org.bukkit.Material.LAPIS_BLOCK;
|
||||||
|
import static org.bukkit.Material.LAPIS_ORE;
|
||||||
|
import static org.bukkit.Material.LEAVES;
|
||||||
|
import static org.bukkit.Material.LEAVES_2;
|
||||||
|
import static org.bukkit.Material.LOG;
|
||||||
|
import static org.bukkit.Material.LOG_2;
|
||||||
|
import static org.bukkit.Material.MELON_BLOCK;
|
||||||
|
import static org.bukkit.Material.MOB_SPAWNER;
|
||||||
|
import static org.bukkit.Material.MOSSY_COBBLESTONE;
|
||||||
|
import static org.bukkit.Material.MYCEL;
|
||||||
|
import static org.bukkit.Material.NETHERRACK;
|
||||||
|
import static org.bukkit.Material.NETHER_BRICK;
|
||||||
|
import static org.bukkit.Material.NETHER_BRICK_STAIRS;
|
||||||
|
import static org.bukkit.Material.NOTE_BLOCK;
|
||||||
|
import static org.bukkit.Material.OBSIDIAN;
|
||||||
|
import static org.bukkit.Material.PACKED_ICE;
|
||||||
|
import static org.bukkit.Material.PUMPKIN;
|
||||||
|
import static org.bukkit.Material.QUARTZ_BLOCK;
|
||||||
|
import static org.bukkit.Material.QUARTZ_ORE;
|
||||||
|
import static org.bukkit.Material.QUARTZ_STAIRS;
|
||||||
|
import static org.bukkit.Material.REDSTONE_BLOCK;
|
||||||
|
import static org.bukkit.Material.SAND;
|
||||||
|
import static org.bukkit.Material.SANDSTONE;
|
||||||
|
import static org.bukkit.Material.SANDSTONE_STAIRS;
|
||||||
|
import static org.bukkit.Material.SMOOTH_BRICK;
|
||||||
|
import static org.bukkit.Material.SMOOTH_STAIRS;
|
||||||
|
import static org.bukkit.Material.SNOW_BLOCK;
|
||||||
|
import static org.bukkit.Material.SOUL_SAND;
|
||||||
|
import static org.bukkit.Material.SPONGE;
|
||||||
|
import static org.bukkit.Material.SPRUCE_WOOD_STAIRS;
|
||||||
|
import static org.bukkit.Material.STONE;
|
||||||
|
import static org.bukkit.Material.WOOD;
|
||||||
|
import static org.bukkit.Material.WOOD_STAIRS;
|
||||||
|
import static org.bukkit.Material.WOOL;
|
||||||
|
import static org.bukkit.Material.WORKBENCH;
|
||||||
|
import static org.bukkit.Material.getMaterial;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import me.confuser.barapi.BarAPI;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Tameable;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import ca.mera.CameraAPI;
|
import ca.mera.CameraAPI;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Logger.LogLevel;
|
import com.intellectualcrafters.plot.Logger.LogLevel;
|
||||||
@ -27,31 +147,6 @@ 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 net.milkbowl.vault.economy.Economy;
|
|
||||||
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Tameable;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DatabaseMetaData;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import static org.bukkit.Material.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @awesome @author Citymonstret, Empire92 PlotMain class.
|
* @awesome @author Citymonstret, Empire92 PlotMain class.
|
||||||
*/
|
*/
|
||||||
@ -124,6 +219,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Check a range of permissions e.g. 'plots.plot.<0-100>'<br>
|
* Check a range of permissions e.g. 'plots.plot.<0-100>'<br>
|
||||||
* Returns highest integer in range.
|
* Returns highest integer in range.
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param stub
|
* @param stub
|
||||||
* @param range
|
* @param range
|
||||||
@ -133,11 +229,11 @@ public class PlotMain extends JavaPlugin {
|
|||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
if (player.hasPermission(stub+".*")) {
|
if (player.hasPermission(stub + ".*")) {
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
for (int i = range; i>0; i--) {
|
for (int i = range; i > 0; i--) {
|
||||||
if (player.hasPermission(stub+"."+i)) {
|
if (player.hasPermission(stub + "." + i)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,8 +242,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a player for a permission<br>
|
* Check a player for a permission<br>
|
||||||
* - Op has all permissions <br>
|
* - Op has all permissions <br>
|
||||||
* - checks for '*' nodes
|
* - checks for '*' nodes
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param perm
|
* @param perm
|
||||||
* @return
|
* @return
|
||||||
@ -156,24 +253,24 @@ public class PlotMain extends JavaPlugin {
|
|||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (String perm:perms) {
|
for (String perm : perms) {
|
||||||
boolean hasperm = false;
|
boolean hasperm = false;
|
||||||
if (player.hasPermission(perm)) {
|
if (player.hasPermission(perm)) {
|
||||||
hasperm = true;
|
hasperm = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
String[] nodes = perm.split("\\.");
|
String[] nodes = perm.split("\\.");
|
||||||
StringBuilder n = new StringBuilder();
|
StringBuilder n = new StringBuilder();
|
||||||
for(int i = 0; i < nodes.length-1; i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
n.append(nodes[i]+".");
|
n.append(nodes[i] + ".");
|
||||||
if (player.hasPermission(n+"*")) {
|
if (player.hasPermission(n + "*")) {
|
||||||
hasperm = true;
|
hasperm = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasperm)
|
if (!hasperm) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -181,8 +278,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a player for a permission<br>
|
* Check a player for a permission<br>
|
||||||
* - Op has all permissions <br>
|
* - Op has all permissions <br>
|
||||||
* - checks for '*' nodes
|
* - checks for '*' nodes
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param perm
|
* @param perm
|
||||||
* @return
|
* @return
|
||||||
@ -196,9 +294,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
String[] nodes = perm.split("\\.");
|
String[] nodes = perm.split("\\.");
|
||||||
StringBuilder n = new StringBuilder();
|
StringBuilder n = new StringBuilder();
|
||||||
for(int i = 0; i < nodes.length-1; i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
n.append(nodes[i]+".");
|
n.append(nodes[i] + ".");
|
||||||
if (player.hasPermission(n+"*")) {
|
if (player.hasPermission(n + "*")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,6 +312,7 @@ 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>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plots
|
* Get all plots
|
||||||
*
|
*
|
||||||
@ -277,6 +376,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
return new HashMap<PlotId, Plot>();
|
return new HashMap<PlotId, Plot>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all plot worlds
|
* get all plot worlds
|
||||||
*/
|
*/
|
||||||
@ -363,21 +463,20 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Implement better system
|
* TODO: Implement better system The whole point of this system is to
|
||||||
* The whole point of this system is to recycle old plots
|
* recycle old plots So why not just allow users to claim old plots, and try
|
||||||
* So why not just allow users to claim old plots, and try to hide the fact that the are owned.
|
* to hide the fact that the are owned. Reduce amount of expired plots: - On
|
||||||
* Reduce amount of expired plots:
|
* /plot auto - allow claiming of old plot, clear it so the user doesn't
|
||||||
* - On /plot auto - allow claiming of old plot, clear it so the user doesn't know
|
* know - On /plot info, - show that the plot is expired and allowed to be
|
||||||
* - On /plot info, - show that the plot is expired and allowed to be claimed
|
* claimed
|
||||||
*
|
*
|
||||||
* Have the task run less often:
|
* Have the task run less often: - Run the task when there are very little,
|
||||||
* - Run the task when there are very little, or no players online (great for small servers)
|
* or no players online (great for small servers) - Run the task at startup
|
||||||
* - Run the task at startup (also only useful for small servers)
|
* (also only useful for small servers)
|
||||||
*
|
*
|
||||||
* Also, in terms of faster code:
|
* Also, in terms of faster code: - Have an array of plots, sorted by expiry
|
||||||
* - Have an array of plots, sorted by expiry time.
|
* time. - Add new plots to the end. - The task then only needs to go
|
||||||
* - Add new plots to the end.
|
* through the first few plots
|
||||||
* - The task then only needs to go through the first few plots
|
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin
|
||||||
* Plugin
|
* Plugin
|
||||||
@ -396,8 +495,10 @@ public class PlotMain extends JavaPlugin {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
long lastPlayed = getLastPlayed(plot.owner);
|
long lastPlayed = getLastPlayed(plot.owner);
|
||||||
if(lastPlayed == 0) continue;
|
if (lastPlayed == 0) {
|
||||||
int days = (int) (lastPlayed / (1000*60*60*24));
|
continue;
|
||||||
|
}
|
||||||
|
int days = (int) (lastPlayed / (1000 * 60 * 60 * 24));
|
||||||
if (days >= Settings.AUTO_CLEAR_DAYS) {
|
if (days >= Settings.AUTO_CLEAR_DAYS) {
|
||||||
PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id);
|
PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
@ -501,12 +602,11 @@ public class PlotMain extends JavaPlugin {
|
|||||||
DatabaseMetaData meta = connection.getMetaData();
|
DatabaseMetaData meta = connection.getMetaData();
|
||||||
ResultSet res = meta.getTables(null, null, "plot", null);
|
ResultSet res = meta.getTables(null, null, "plot", null);
|
||||||
if (!res.next()) {
|
if (!res.next()) {
|
||||||
DBFunc.createTables("mysql",true);
|
DBFunc.createTables("mysql", true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
res = meta.getTables(null, null, "plot_trusted", null);
|
res = meta.getTables(null, null, "plot_trusted", null);
|
||||||
if (!res.next()) {
|
if (!res.next()) {
|
||||||
DBFunc.createTables("mysql",false);
|
DBFunc.createTables("mysql", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,19 +679,20 @@ 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 (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");
|
||||||
worldGuardListener = new WorldGuardListener(this);
|
worldGuardListener = new WorldGuardListener(this);
|
||||||
getServer().getPluginManager().registerEvents(worldGuardListener, this);
|
getServer().getPluginManager().registerEvents(worldGuardListener, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(Settings.AUTO_CLEAR) {
|
if (Settings.AUTO_CLEAR) {
|
||||||
checkExpired(PlotMain.getMain(), true);
|
checkExpired(PlotMain.getMain(), true);
|
||||||
checkForExpiredPlots();
|
checkForExpiredPlots();
|
||||||
}
|
}
|
||||||
if(getServer().getPluginManager().getPlugin("Vault") != null) {
|
if (getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||||
if(economyProvider != null) {
|
if (economyProvider != null) {
|
||||||
economy = economyProvider.getProvider();
|
economy = economyProvider.getProvider();
|
||||||
}
|
}
|
||||||
useEconomy = (economy != null);
|
useEconomy = (economy != null);
|
||||||
@ -720,13 +821,16 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getLastPlayed(UUID uuid) {
|
public static long getLastPlayed(UUID uuid) {
|
||||||
if(uuid == null) return 0;
|
if (uuid == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
OfflinePlayer player;
|
OfflinePlayer player;
|
||||||
if((player = Bukkit.getOfflinePlayer(uuid)) == null || !player.hasPlayedBefore()) {
|
if (((player = Bukkit.getOfflinePlayer(uuid)) == null) || !player.hasPlayedBefore()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return player.getLastPlayed();
|
return player.getLastPlayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load configuration files
|
* Load configuration files
|
||||||
*/
|
*/
|
||||||
@ -797,10 +901,10 @@ public class PlotMain extends JavaPlugin {
|
|||||||
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
||||||
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||||
}
|
}
|
||||||
if(Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, String> settings = new HashMap<>();
|
Map<String, String> settings = new HashMap<>();
|
||||||
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
|
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
|
||||||
settings.put("Use Metrics", "" + Settings.METRICS);
|
settings.put("Use Metrics", "" + Settings.METRICS);
|
||||||
settings.put("Mob Pathfinding", "" + Settings.MOB_PATHFINDING);
|
settings.put("Mob Pathfinding", "" + Settings.MOB_PATHFINDING);
|
||||||
settings.put("Web Enabled", "" + Web.ENABLED);
|
settings.put("Web Enabled", "" + Web.ENABLED);
|
||||||
settings.put("Web Port", "" + Web.PORT);
|
settings.put("Web Port", "" + Web.PORT);
|
||||||
@ -808,7 +912,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
settings.put("DB SQLite Enabled", "" + Settings.DB.USE_SQLITE);
|
settings.put("DB SQLite Enabled", "" + Settings.DB.USE_SQLITE);
|
||||||
settings.put("Auto Clear Enabled", "" + Settings.AUTO_CLEAR);
|
settings.put("Auto Clear Enabled", "" + Settings.AUTO_CLEAR);
|
||||||
settings.put("Auto Clear Days", "" + Settings.AUTO_CLEAR_DAYS);
|
settings.put("Auto Clear Days", "" + Settings.AUTO_CLEAR_DAYS);
|
||||||
for(Entry<String, String> setting : settings.entrySet()) {
|
for (Entry<String, String> setting : settings.entrySet()) {
|
||||||
sendConsoleSenderMessage(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
|
sendConsoleSenderMessage(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,8 +1003,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Welp! how did this entity get here?
|
// Welp! how did this entity get
|
||||||
entity.teleport(location.subtract(location.getDirection().normalize().multiply(2)));
|
// here?
|
||||||
|
entity.teleport(this.location.subtract(this.location.getDirection().normalize().multiply(2)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tamed) {
|
if (!tamed) {
|
||||||
@ -944,7 +1049,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Settings.DEBUG = config.getBoolean("debug");
|
Settings.DEBUG = config.getBoolean("debug");
|
||||||
if(Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
|
sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
|
||||||
}
|
}
|
||||||
Web.ENABLED = config.getBoolean("web.enabled");
|
Web.ENABLED = config.getBoolean("web.enabled");
|
||||||
|
@ -15,8 +15,6 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.RUtils.Direction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot settings
|
* plot settings
|
||||||
*
|
*
|
||||||
@ -27,7 +25,7 @@ public class PlotSettings {
|
|||||||
/**
|
/**
|
||||||
* merged plots
|
* merged plots
|
||||||
*/
|
*/
|
||||||
private boolean[] merged = new boolean[] {false,false,false,false};
|
private boolean[] merged = new boolean[] { false, false, false, false };
|
||||||
/**
|
/**
|
||||||
* plot alias
|
* plot alias
|
||||||
*/
|
*/
|
||||||
@ -69,15 +67,16 @@ public class PlotSettings {
|
|||||||
* 1 = East<br>
|
* 1 = East<br>
|
||||||
* 2 = South<br>
|
* 2 = South<br>
|
||||||
* 3 = West<br>
|
* 3 = West<br>
|
||||||
|
*
|
||||||
* @param direction
|
* @param direction
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean getMerged(int direction) {
|
public boolean getMerged(int direction) {
|
||||||
return merged[direction];
|
return this.merged[direction];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMerged() {
|
public boolean isMerged() {
|
||||||
return (merged[0] || merged[1] || merged[2] || merged[3]);
|
return (this.merged[0] || this.merged[1] || this.merged[2] || this.merged[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean[] getMerged() {
|
public boolean[] getMerged() {
|
||||||
@ -91,6 +90,7 @@ public class PlotSettings {
|
|||||||
public void setMerged(int direction, boolean merged) {
|
public void setMerged(int direction, boolean merged) {
|
||||||
this.merged[direction] = merged;
|
this.merged[direction] = merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b
|
||||||
|
@ -11,9 +11,9 @@ public class PlotSquaredException extends RuntimeException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static enum PlotError {
|
public static enum PlotError {
|
||||||
MISSING_DEPENDENCY("Missing Dependency")
|
MISSING_DEPENDENCY("Missing Dependency");
|
||||||
;
|
|
||||||
private String errorHeader;
|
private String errorHeader;
|
||||||
|
|
||||||
PlotError(String errorHeader) {
|
PlotError(String errorHeader) {
|
||||||
this.errorHeader = errorHeader;
|
this.errorHeader = errorHeader;
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,34 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the PlotWorld class (obviously)
|
* This is the PlotWorld class (obviously) <br>
|
||||||
* <br> - All existing PlotWorld instances should be kept in PlotMain (worlds variable)
|
* - All existing PlotWorld instances should be kept in PlotMain (worlds
|
||||||
* <br> - The accessors and mutators are:
|
* variable) <br>
|
||||||
* <br> PlotMain.isPlotWorld(world)
|
* - The accessors and mutators are: <br>
|
||||||
* <br> PlotMain.getPlotWorlds() or PlotMain.getPlotWorldsString() <- use this if you don't need to get world objects
|
* PlotMain.isPlotWorld(world) <br>
|
||||||
* <br> PlotMain.getWorldSettings(World) - get the PlotWorld class for a world
|
* 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>
|
* <br>
|
||||||
* <br> Also added is getWorldPlots(World) as the plots are now sorted per world
|
* Also added is getWorldPlots(World) as the plots are now sorted per world <br>
|
||||||
* <br>
|
* <br>
|
||||||
* <br> To get the world of a plot, you can use plot.world - (string) or plot.getWorld() (world object)
|
* To get the world of a plot, you can use plot.world - (string) or
|
||||||
|
* plot.getWorld() (world object) <br>
|
||||||
* <br>
|
* <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):
|
* All PlotWorld settings are per world in the settings.yml (these settings are
|
||||||
* <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)
|
* 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>
|
* <br>
|
||||||
* <br> All new DEFAULT CONSTANTS should be static and be given a value
|
* All new DEFAULT CONSTANTS should be static and be given a value <br>
|
||||||
* <br> All new variables should not be static and should not be given any values here, but rather in the WorldGenerator class
|
* 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 {
|
||||||
|
@ -42,7 +42,7 @@ public class SetBlockFast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void update(org.bukkit.entity.Player player) {
|
public static void update(org.bukkit.entity.Player player) {
|
||||||
int distance = Bukkit.getViewDistance()+1;
|
int distance = Bukkit.getViewDistance() + 1;
|
||||||
for (int cx = -distance; cx < distance; cx++) {
|
for (int cx = -distance; cx < distance; cx++) {
|
||||||
for (int cz = -distance; cz < distance; cz++) {
|
for (int cz = -distance; cz < distance; cz++) {
|
||||||
player.getWorld().refreshChunk(player.getLocation().getChunk().getX() + cx, player.getLocation().getChunk().getZ() + cz);
|
player.getWorld().refreshChunk(player.getLocation().getChunk().getX() + cx, player.getLocation().getChunk().getZ() + cz);
|
||||||
|
@ -81,7 +81,10 @@ public class Settings {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class DB {
|
public static class DB {
|
||||||
public static boolean USE_MONGO = false; /* TODO: Implement Mongo @Brandon */;
|
public static boolean USE_MONGO = false; /*
|
||||||
|
* TODO: Implement Mongo
|
||||||
|
* @Brandon
|
||||||
|
*/;
|
||||||
public static boolean USE_SQLITE = false;
|
public static boolean USE_SQLITE = false;
|
||||||
public static boolean USE_MYSQL = true; /* NOTE: Fixed connector */
|
public static boolean USE_MYSQL = true; /* NOTE: Fixed connector */
|
||||||
public static String SQLITE_DB = "storage";
|
public static String SQLITE_DB = "storage";
|
||||||
|
@ -1,5 +1,32 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.AUTO_MERGE_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.DEFAULT_FLAGS_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.MAIN_BLOCK_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.PLOT_BIOME_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.PLOT_CHAT_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.PLOT_HEIGHT_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.PLOT_WIDTH_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.ROAD_BLOCK_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.ROAD_HEIGHT_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.ROAD_WIDTH_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_FILE_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT;
|
||||||
|
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_FILLING_DEFAULT;
|
||||||
|
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -8,12 +35,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @auther Empire92
|
* @auther Empire92
|
||||||
@ -91,11 +112,20 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
||||||
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
||||||
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
||||||
options.put("worlds." + world + ".schematic.schematics", plotworld.SCHEMATICS);
|
options.put("worlds." + world + ".schematic.schematics", this.plotworld.SCHEMATICS);
|
||||||
options.put("worlds." + world + ".schematic.specify_on_claim", plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
options.put("worlds." + world + ".schematic.specify_on_claim", this.plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
||||||
options.put("worlds." + world + ".economy.use", plotworld.USE_ECONOMY); // Access should be static
|
options.put("worlds." + world + ".economy.use", this.plotworld.USE_ECONOMY); // Access
|
||||||
options.put("worlds." + world + ".economy.prices.claim", plotworld.PLOT_PRICE); // Access should be static
|
// should
|
||||||
options.put("worlds." + world + ".economy.prices.merge", plotworld.MERGE_PRICE); // Access should be static
|
// be
|
||||||
|
// static
|
||||||
|
options.put("worlds." + world + ".economy.prices.claim", this.plotworld.PLOT_PRICE); // Access
|
||||||
|
// should
|
||||||
|
// be
|
||||||
|
// static
|
||||||
|
options.put("worlds." + world + ".economy.prices.merge", this.plotworld.MERGE_PRICE); // Access
|
||||||
|
// should
|
||||||
|
// be
|
||||||
|
// static
|
||||||
options.put("worlds." + world + ".chat.enabled", PLOT_CHAT_DEFAULT);
|
options.put("worlds." + world + ".chat.enabled", PLOT_CHAT_DEFAULT);
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
@ -222,10 +252,9 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
|
|
||||||
this.result = new short[maxY / 16][];
|
this.result = new short[maxY / 16][];
|
||||||
double pathWidthLower;
|
double pathWidthLower;
|
||||||
if ((pathsize % 2) == 0) {
|
if ((this.pathsize % 2) == 0) {
|
||||||
pathWidthLower = Math.floor(this.pathsize / 2)-1;
|
pathWidthLower = Math.floor(this.pathsize / 2) - 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pathWidthLower = Math.floor(this.pathsize / 2);
|
pathWidthLower = Math.floor(this.pathsize / 2);
|
||||||
}
|
}
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -124,10 +124,9 @@ public class XPopulator extends BlockPopulator {
|
|||||||
this.f_id[i] = result[0];
|
this.f_id[i] = result[0];
|
||||||
this.f_v[i] = result[1];
|
this.f_v[i] = result[1];
|
||||||
}
|
}
|
||||||
if ((pathsize % 2) == 0) {
|
if ((this.pathsize % 2) == 0) {
|
||||||
pathWidthLower = Math.floor(this.pathsize / 2)-1;
|
this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.pathWidthLower = Math.floor(this.pathsize / 2);
|
this.pathWidthLower = Math.floor(this.pathsize / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
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.FlagManager;
|
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;
|
||||||
|
@ -1,26 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) IntellectualCrafters - 2014.
|
* Copyright (c) IntellectualCrafters - 2014.
|
||||||
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
||||||
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||||
*
|
*
|
||||||
* >> File = Auto.java
|
* >> File = Auto.java
|
||||||
* >> Generated by: Citymonstret at 2014-08-09 01:40
|
* >> Generated by: Citymonstret at 2014-08-09 01:40
|
||||||
*/
|
*/
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
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;
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
public Auto() {
|
public Auto() {
|
||||||
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING);
|
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO auto claim a mega plot!!!!!!!!!!!!
|
// TODO auto claim a mega plot!!!!!!!!!!!!
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
@ -43,19 +47,17 @@ public class Auto extends SubCommand {
|
|||||||
String[] split = args[0].split(",");
|
String[] split = args[0].split(",");
|
||||||
size_x = Integer.parseInt(split[0]);
|
size_x = Integer.parseInt(split[0]);
|
||||||
size_z = Integer.parseInt(split[1]);
|
size_z = Integer.parseInt(split[1]);
|
||||||
if (size_x < 1 || size_z < 1) {
|
if ((size_x < 1) || (size_z < 1)) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cError: size<=0");
|
PlayerFunctions.sendMessage(plr, "&cError: size<=0");
|
||||||
}
|
}
|
||||||
if (size_x > 4 || size_z > 4) {
|
if ((size_x > 4) || (size_z > 4)) {
|
||||||
PlayerFunctions.sendMessage(plr, "&cError: size>4");
|
PlayerFunctions.sendMessage(plr, "&cError: size>4");
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
PlayerFunctions.sendMessage(plr, "&cError: Invalid size (X,Y)");
|
PlayerFunctions.sendMessage(plr, "&cError: Invalid size (X,Y)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -67,7 +69,7 @@ public class Auto extends SubCommand {
|
|||||||
boolean br = false;
|
boolean br = false;
|
||||||
int x = 0, z = 0, q = 100;
|
int x = 0, z = 0, q = 100;
|
||||||
PlotId id;
|
PlotId id;
|
||||||
if (size_x == 1 && size_z == 1) {
|
if ((size_x == 1) && (size_z == 1)) {
|
||||||
while (!br) {
|
while (!br) {
|
||||||
id = new PlotId(x, z);
|
id = new PlotId(x, z);
|
||||||
if (PlotHelper.getPlot(world, id).owner == null) {
|
if (PlotHelper.getPlot(world, id).owner == null) {
|
||||||
@ -86,18 +88,17 @@ public class Auto extends SubCommand {
|
|||||||
z = q;
|
z = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
while (!br) {
|
while (!br) {
|
||||||
PlotId start = new PlotId(x, z);
|
PlotId start = new PlotId(x, z);
|
||||||
PlotId end = new PlotId(x+size_x-1, z+size_z-1);
|
PlotId end = new PlotId((x + size_x) - 1, (z + size_z) - 1);
|
||||||
if (isUnowned(world, start, end)) {
|
if (isUnowned(world, start, end)) {
|
||||||
// TODO claim event
|
// TODO claim event
|
||||||
// Claim.claimPlot calls that event...
|
// Claim.claimPlot calls that event...
|
||||||
for (int i = start.x; i <= end.x; i++) {
|
for (int i = start.x; i <= end.x; i++) {
|
||||||
for (int j = start.y; j <= end.y; j++) {
|
for (int j = start.y; j <= end.y; j++) {
|
||||||
Plot plot = PlotHelper.getPlot(world, new PlotId(i,j));
|
Plot plot = PlotHelper.getPlot(world, new PlotId(i, j));
|
||||||
boolean teleport = (i == end.x && j == end.y) ? true : false;
|
boolean teleport = ((i == end.x) && (j == end.y)) ? true : false;
|
||||||
Claim.claimPlot(plr, plot, teleport);
|
Claim.claimPlot(plr, plot, teleport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,9 +106,9 @@ public class Auto extends SubCommand {
|
|||||||
br = true;
|
br = true;
|
||||||
}
|
}
|
||||||
if ((z < q) && ((z - x) < q)) {
|
if ((z < q) && ((z - x) < q)) {
|
||||||
z+=size_z;
|
z += size_z;
|
||||||
} else if (x < q) {
|
} else if (x < q) {
|
||||||
x+=size_x;
|
x += size_x;
|
||||||
z = q - 100;
|
z = q - 100;
|
||||||
} else {
|
} else {
|
||||||
q += 100;
|
q += 100;
|
||||||
@ -118,11 +119,12 @@ public class Auto extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnowned(World world, PlotId pos1, PlotId pos2) {
|
public boolean isUnowned(World world, PlotId pos1, PlotId pos2) {
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
PlotId id = new PlotId(x,y);
|
PlotId id = new PlotId(x, y);
|
||||||
if (PlotMain.getPlots(world).get(id)!=null) {
|
if (PlotMain.getPlots(world).get(id) != null) {
|
||||||
if (PlotMain.getPlots(world).get(id).owner != null) {
|
if (PlotMain.getPlots(world).get(id).owner != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,20 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.*;
|
|
||||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.C;
|
||||||
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.SchematicHandler;
|
||||||
|
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -29,7 +37,7 @@ public class Claim extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
String schematic = "";
|
String schematic = "";
|
||||||
if(args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
}
|
}
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
if (!PlayerFunctions.isInPlot(plr)) {
|
||||||
@ -46,11 +54,11 @@ public class Claim extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||||
if(PlotMain.useEconomy && world.USE_ECONOMY) {
|
if (PlotMain.useEconomy && world.USE_ECONOMY) {
|
||||||
double cost = world.PLOT_PRICE;
|
double cost = world.PLOT_PRICE;
|
||||||
if(cost > 0d) {
|
if (cost > 0d) {
|
||||||
Economy economy = PlotMain.economy;
|
Economy economy = PlotMain.economy;
|
||||||
if(economy.getBalance(plr) < cost) {
|
if (economy.getBalance(plr) < cost) {
|
||||||
sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,13 +66,13 @@ public class Claim extends SubCommand {
|
|||||||
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!schematic.equals("")) {
|
if (!schematic.equals("")) {
|
||||||
if(world.SCHEMATIC_CLAIM_SPECIFY) {
|
if (world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
if(!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
if (!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -97,11 +105,11 @@ public class Claim extends SubCommand {
|
|||||||
if (world.SCHEMATIC_ON_CLAIM) {
|
if (world.SCHEMATIC_ON_CLAIM) {
|
||||||
SchematicHandler handler = new SchematicHandler();
|
SchematicHandler handler = new SchematicHandler();
|
||||||
SchematicHandler.Schematic sch;
|
SchematicHandler.Schematic sch;
|
||||||
if(schematic.equals("")) {
|
if (schematic.equals("")) {
|
||||||
sch = handler.getSchematic(world.SCHEMATIC_FILE);
|
sch = handler.getSchematic(world.SCHEMATIC_FILE);
|
||||||
} else {
|
} else {
|
||||||
sch = handler.getSchematic(schematic);
|
sch = handler.getSchematic(schematic);
|
||||||
if(sch == null) {
|
if (sch == null) {
|
||||||
sch = handler.getSchematic(world.SCHEMATIC_FILE);
|
sch = handler.getSchematic(world.SCHEMATIC_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,6 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
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.PlotMain;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-01.
|
* Created by Citymonstret on 2014-08-01.
|
||||||
@ -34,7 +31,7 @@ public class Clear extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,19 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
public enum Command {
|
public enum Command {
|
||||||
|
|
||||||
// TODO new commands
|
// TODO new commands
|
||||||
// (allow a plot to be transferred from one plot to another of the same size)
|
// (allow a plot to be transferred from one plot to another of the same
|
||||||
// - /plot copy
|
// size)
|
||||||
// - /plot paste
|
// - /plot copy
|
||||||
|
// - /plot paste
|
||||||
// (economy)
|
// (economy)
|
||||||
// - /plot buy
|
// - /plot buy
|
||||||
// - /plot sell <value>
|
// - /plot sell <value>
|
||||||
// (Rating system) (ratings can be stored as the average, and number of ratings)
|
// (Rating system) (ratings can be stored as the average, and number of
|
||||||
// - /plot rate <number out of 10>
|
// ratings)
|
||||||
// - /plot list <some parameter to list the most popular, and highest rated plots>
|
// - /plot rate <number out of 10>
|
||||||
TRUSTED("trusted","trust"),
|
// - /plot list <some parameter to list the most popular, and highest rated
|
||||||
|
// plots>
|
||||||
|
TRUSTED("trusted", "trust"),
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -34,7 +37,7 @@ public enum Command {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
KICK("kick","k"),
|
KICK("kick", "k"),
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -14,9 +14,6 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
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.PlotMain;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-01.
|
* Created by Citymonstret on 2014-08-01.
|
||||||
@ -34,7 +31,7 @@ public class Copy extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,16 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.*;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.C;
|
||||||
|
import com.intellectualcrafters.plot.Lag;
|
||||||
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.RUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret \\SuperCharged Compiler made by Citymonstret\\
|
* @author Citymonstret \\SuperCharged Compiler made by Citymonstret\\
|
||||||
* ||#Compiler:ALPHA-1.0#########################
|
* ||#Compiler:ALPHA-1.0#########################
|
||||||
@ -80,8 +86,9 @@ public class Debug extends SubCommand {
|
|||||||
information.append(getSection(section, "PlotWorld"));
|
information.append(getSection(section, "PlotWorld"));
|
||||||
information.append(getLine(line, "Plot Worlds", worlds));
|
information.append(getLine(line, "Plot Worlds", worlds));
|
||||||
information.append(getLine(line, "Owned Plots", PlotMain.getPlots().size()));
|
information.append(getLine(line, "Owned Plots", PlotMain.getPlots().size()));
|
||||||
//information.append(getLine(line, "PlotWorld Size", PlotHelper.getWorldFolderSize() + "MB"));
|
// information.append(getLine(line, "PlotWorld Size",
|
||||||
for(String world : PlotMain.getPlotWorlds()) {
|
// PlotHelper.getWorldFolderSize() + "MB"));
|
||||||
|
for (String world : PlotMain.getPlotWorlds()) {
|
||||||
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(Bukkit.getWorld(world))));
|
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(Bukkit.getWorld(world))));
|
||||||
}
|
}
|
||||||
information.append(getLine(line, "Entities", PlotHelper.getEntities(plr.getWorld())));
|
information.append(getLine(line, "Entities", PlotHelper.getEntities(plr.getWorld())));
|
||||||
|
@ -38,7 +38,7 @@ public class Delete extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class Home extends SubCommand {
|
|||||||
public Home() {
|
public Home() {
|
||||||
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT);
|
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plot isAlias(String a) {
|
private Plot isAlias(String a) {
|
||||||
for (Plot p : PlotMain.getPlots()) {
|
for (Plot p : PlotMain.getPlots()) {
|
||||||
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
|
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
|
||||||
|
@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import java.util.UUID;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -22,8 +20,11 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.C;
|
||||||
import java.util.UUID;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -76,7 +77,7 @@ public class Info extends SubCommand {
|
|||||||
if (plot.owner != null) {
|
if (plot.owner != null) {
|
||||||
owner = Bukkit.getOfflinePlayer(plot.owner).getName();
|
owner = Bukkit.getOfflinePlayer(plot.owner).getName();
|
||||||
}
|
}
|
||||||
if (owner==null) {
|
if (owner == null) {
|
||||||
owner = plot.owner.toString();
|
owner = plot.owner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,14 +93,17 @@ public class Info extends SubCommand {
|
|||||||
info = info.replaceAll("%denied%", getPlayerList(plot.denied));
|
info = info.replaceAll("%denied%", getPlayerList(plot.denied));
|
||||||
info = info.replaceAll("%rating%", "" + DBFunc.getRatings(plot));
|
info = info.replaceAll("%rating%", "" + DBFunc.getRatings(plot));
|
||||||
info = info.replaceAll("%flags%", StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), ",") : "none");
|
info = info.replaceAll("%flags%", StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), ",") : "none");
|
||||||
//PlayerFunctions.sendMessage(player, PlayerFunctions.getTopPlot(player.getWorld(), plot).id.toString());
|
// PlayerFunctions.sendMessage(player,
|
||||||
//PlayerFunctions.sendMessage(player, PlayerFunctions.getBottomPlot(player.getWorld(), plot).id.toString());
|
// PlayerFunctions.getTopPlot(player.getWorld(), plot).id.toString());
|
||||||
|
// PlayerFunctions.sendMessage(player,
|
||||||
|
// PlayerFunctions.getBottomPlot(player.getWorld(),
|
||||||
|
// plot).id.toString());
|
||||||
PlayerFunctions.sendMessage(player, info);
|
PlayerFunctions.sendMessage(player, info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPlayerList(ArrayList<UUID> l) {
|
private String getPlayerList(ArrayList<UUID> l) {
|
||||||
if (l == null || l.size() < 1) {
|
if ((l == null) || (l.size() < 1)) {
|
||||||
return " none";
|
return " none";
|
||||||
}
|
}
|
||||||
String c = C.PLOT_USER_LIST.s();
|
String c = C.PLOT_USER_LIST.s();
|
||||||
|
@ -15,9 +15,6 @@ import org.bukkit.entity.Player;
|
|||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
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.PlotMain;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-01.
|
* Created by Citymonstret on 2014-08-01.
|
||||||
@ -35,11 +32,11 @@ public class Kick extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length!=1) {
|
if (args.length != 1) {
|
||||||
PlayerFunctions.sendMessage(plr, "&c/plot kick <player>");
|
PlayerFunctions.sendMessage(plr, "&c/plot kick <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -48,7 +45,7 @@ public class Kick extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getPlayer(args[0]);
|
Player player = Bukkit.getPlayer(args[0]);
|
||||||
if (!player.getWorld().equals(plr.getWorld()) || !PlayerFunctions.isInPlot(player) || PlayerFunctions.getCurrentPlot(player)==null || !PlayerFunctions.getCurrentPlot(player).equals(plot)) {
|
if (!player.getWorld().equals(plr.getWorld()) || !PlayerFunctions.isInPlot(player) || (PlayerFunctions.getCurrentPlot(player) == null) || !PlayerFunctions.getCurrentPlot(player).equals(plot)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0]));
|
PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,24 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.*;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.C;
|
||||||
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.SetBlockFast;
|
||||||
|
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -27,7 +36,7 @@ import java.util.ArrayList;
|
|||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
|
|
||||||
public static String[] values = new String[] { "north", "east", "south", "west" };
|
public static String[] values = new String[] { "north", "east", "south", "west" };
|
||||||
public static String[] aliases = new String[] { "n", "e", "s", "w"};
|
public static String[] aliases = new String[] { "n", "e", "s", "w" };
|
||||||
|
|
||||||
public Merge() {
|
public Merge() {
|
||||||
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS);
|
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS);
|
||||||
@ -36,22 +45,22 @@ public class Merge extends SubCommand {
|
|||||||
public static String direction(float yaw) {
|
public static String direction(float yaw) {
|
||||||
yaw = yaw / 90;
|
yaw = yaw / 90;
|
||||||
int i = Math.round(yaw);
|
int i = Math.round(yaw);
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case -4:
|
case -4:
|
||||||
case 0:
|
case 0:
|
||||||
case 4:
|
case 4:
|
||||||
return "SOUTH";
|
return "SOUTH";
|
||||||
case -1:
|
case -1:
|
||||||
case 3:
|
case 3:
|
||||||
return "EAST";
|
return "EAST";
|
||||||
case -2:
|
case -2:
|
||||||
case 2:
|
case 2:
|
||||||
return "NORTH";
|
return "NORTH";
|
||||||
case -3:
|
case -3:
|
||||||
case 1:
|
case 1:
|
||||||
return "WEST";
|
return "WEST";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +71,7 @@ public class Merge extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if (plot==null || !plot.hasOwner()) {
|
if ((plot == null) || !plot.hasOwner()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -70,20 +79,20 @@ public class Merge extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length<1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values,C.BLOCK_LIST_SEPARATER.s()));
|
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
||||||
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int direction = -1;
|
int direction = -1;
|
||||||
for (int i = 0; i<values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
|
if (args[0].equalsIgnoreCase(values[i]) || args[0].equalsIgnoreCase(aliases[i])) {
|
||||||
direction = i;
|
direction = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction==-1) {
|
if (direction == -1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values,C.BLOCK_LIST_SEPARATER.s()));
|
PlayerFunctions.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
|
||||||
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
PlayerFunctions.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(plr.getLocation().getYaw())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -92,35 +101,35 @@ public class Merge extends SubCommand {
|
|||||||
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
||||||
ArrayList<PlotId> plots;
|
ArrayList<PlotId> plots;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0: // north = -y
|
case 0: // north = -y
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y-1), new PlotId(top.x,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
case 1: // east = +x
|
case 1: // east = +x
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y), new PlotId(top.x+1,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
||||||
break;
|
break;
|
||||||
case 2: // south = +y
|
case 2: // south = +y
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x,bot.y), new PlotId(top.x,top.y+1));
|
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
||||||
break;
|
break;
|
||||||
case 3: // west = -x
|
case 3: // west = -x
|
||||||
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x-1,bot.y), new PlotId(top.x,top.y));
|
plots = PlayerFunctions.getPlotSelectionIds(plr.getWorld(), new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotId myid : plots) {
|
for (PlotId myid : plots) {
|
||||||
Plot myplot = PlotMain.getPlots(world).get(myid);
|
Plot myplot = PlotMain.getPlots(world).get(myid);
|
||||||
if (myplot==null || !myplot.hasOwner() || !(myplot.getOwner().equals(plr.getUniqueId()))) {
|
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(plr.getUniqueId()))) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
|
PlotWorld plotWorld = PlotMain.getWorldSettings(world);
|
||||||
if(PlotMain.useEconomy && plotWorld.USE_ECONOMY) {
|
if (PlotMain.useEconomy && plotWorld.USE_ECONOMY) {
|
||||||
double cost = plotWorld.MERGE_PRICE;
|
double cost = plotWorld.MERGE_PRICE;
|
||||||
if(cost > 0d) {
|
if (cost > 0d) {
|
||||||
Economy economy = PlotMain.economy;
|
Economy economy = PlotMain.economy;
|
||||||
if(economy.getBalance(plr) < cost) {
|
if (economy.getBalance(plr) < cost) {
|
||||||
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-02.
|
* Created by Citymonstret on 2014-10-02.
|
||||||
@ -11,7 +12,8 @@ import org.bukkit.entity.Player;
|
|||||||
public class Rate extends SubCommand {
|
public class Rate extends SubCommand {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
String cmd, String permission, String description, String usage, String alias, CommandCategory category
|
* String cmd, String permission, String description, String usage, String
|
||||||
|
* alias, CommandCategory category
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Rate() {
|
public Rate() {
|
||||||
@ -20,47 +22,47 @@ public class Rate extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
if(args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(plr, C.RATING_NOT_VALID);
|
sendMessage(plr, C.RATING_NOT_VALID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(!PlayerFunctions.isInPlot(plr)) {
|
if (!PlayerFunctions.isInPlot(plr)) {
|
||||||
sendMessage(plr, C.NOT_IN_PLOT);
|
sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if(!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
sendMessage(plr, C.RATING_NOT_OWNED);
|
sendMessage(plr, C.RATING_NOT_OWNED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(plot.getOwner().equals(plr.getUniqueId())) {
|
if (plot.getOwner().equals(plr.getUniqueId())) {
|
||||||
sendMessage(plr, C.RATING_NOT_YOUR_OWN);
|
sendMessage(plr, C.RATING_NOT_YOUR_OWN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String arg = args[0];
|
String arg = args[0];
|
||||||
boolean o = false;
|
boolean o = false;
|
||||||
for(char c : arg.toCharArray()) {
|
for (char c : arg.toCharArray()) {
|
||||||
if(!Character.isDigit(c)) {
|
if (!Character.isDigit(c)) {
|
||||||
o = true;
|
o = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int rating = 0;
|
int rating = 0;
|
||||||
if(!o) {
|
if (!o) {
|
||||||
rating = Integer.parseInt(arg);
|
rating = Integer.parseInt(arg);
|
||||||
}
|
}
|
||||||
if(o || (rating < 0 || rating > 10)) {
|
if (o || ((rating < 0) || (rating > 10))) {
|
||||||
sendMessage(plr, C.RATING_NOT_VALID);
|
sendMessage(plr, C.RATING_NOT_VALID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//TODO implement check for already rated
|
// TODO implement check for already rated
|
||||||
boolean rated = false;
|
boolean rated = false;
|
||||||
if(rated) {
|
if (rated) {
|
||||||
sendMessage(plr, C.RATING_ALREADY_EXISTS, plot.getId().toString());
|
sendMessage(plr, C.RATING_ALREADY_EXISTS, plot.getId().toString());
|
||||||
}
|
}
|
||||||
//TODO actually do something...
|
// TODO actually do something...
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
if(success) {
|
if (success) {
|
||||||
sendMessage(plr, C.RATING_APPLIED, plot.getId().toString());
|
sendMessage(plr, C.RATING_APPLIED, plot.getId().toString());
|
||||||
} else {
|
} else {
|
||||||
sendMessage(plr, C.COMMAND_WENT_WRONG);
|
sendMessage(plr, C.COMMAND_WENT_WRONG);
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.*;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import java.util.Arrays;
|
||||||
import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
|
import java.util.List;
|
||||||
import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -22,16 +21,25 @@ import org.bukkit.WeatherType;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.intellectualcrafters.plot.C;
|
||||||
import java.util.Arrays;
|
import com.intellectualcrafters.plot.Flag;
|
||||||
import java.util.List;
|
import com.intellectualcrafters.plot.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
|
||||||
|
import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Set extends SubCommand{
|
public class Set extends SubCommand {
|
||||||
|
|
||||||
public Set() {
|
public Set() {
|
||||||
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS);
|
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS);
|
||||||
@ -53,41 +61,42 @@ public class Set extends SubCommand{
|
|||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(args.length < 1) {
|
if (args.length < 1) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
||||||
builder.append(getArgumentList(values));
|
builder.append(getArgumentList(values));
|
||||||
PlayerFunctions.sendMessage(plr, builder.toString());
|
PlayerFunctions.sendMessage(plr, builder.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < aliases.length; i++) {
|
for (int i = 0; i < aliases.length; i++) {
|
||||||
if(aliases[i].equalsIgnoreCase(args[0])) {
|
if (aliases[i].equalsIgnoreCase(args[0])) {
|
||||||
args[0] = values[i];
|
args[0] = values[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO: Implement option */
|
/* TODO: Implement option */
|
||||||
boolean advanced_permissions = false;
|
boolean advanced_permissions = false;
|
||||||
if(advanced_permissions) {
|
if (advanced_permissions) {
|
||||||
if(!plr.hasPermission("plots.set." + args[0].toLowerCase())) {
|
if (!plr.hasPermission("plots.set." + args[0].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("flag")) {
|
if (args[0].equalsIgnoreCase("flag")) {
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
String message = StringUtils.join(FlagManager.getFlags(),"&c, &6");
|
String message = StringUtils.join(FlagManager.getFlags(), "&c, &6");
|
||||||
if (PlotMain.worldGuardListener != null) {
|
if (PlotMain.worldGuardListener != null) {
|
||||||
if (message.equals(""))
|
if (message.equals("")) {
|
||||||
message = StringUtils.join(PlotMain.worldGuardListener.str_flags,"&c, &6");
|
message = StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6");
|
||||||
else
|
} else {
|
||||||
message += ","+StringUtils.join(PlotMain.worldGuardListener.str_flags,"&c, &6");
|
message += "," + StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
PlayerFunctions.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!FlagManager.getFlags().contains(args[1].toLowerCase()) && PlotMain.worldGuardListener != null && !PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
if (!FlagManager.getFlags().contains(args[1].toLowerCase()) && (PlotMain.worldGuardListener != null) && !PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -95,8 +104,8 @@ public class Set extends SubCommand{
|
|||||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length==2) {
|
if (args.length == 2) {
|
||||||
if (plot.settings.getFlag(args[1].toLowerCase())==null) {
|
if (plot.settings.getFlag(args[1].toLowerCase()) == null) {
|
||||||
if (PlotMain.worldGuardListener != null) {
|
if (PlotMain.worldGuardListener != null) {
|
||||||
if (PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
if (PlotMain.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
||||||
PlotMain.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]);
|
PlotMain.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]);
|
||||||
@ -107,32 +116,33 @@ public class Set extends SubCommand{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Flag flag = plot.settings.getFlag(args[1].toLowerCase());
|
Flag flag = plot.settings.getFlag(args[1].toLowerCase());
|
||||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag,plot);
|
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_REMOVED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
java.util.Set<Flag> newflags = plot.settings.getFlags();
|
java.util.Set<Flag> newflags = plot.settings.getFlags();
|
||||||
Flag oldFlag = plot.settings.getFlag(args[1].toLowerCase());
|
Flag oldFlag = plot.settings.getFlag(args[1].toLowerCase());
|
||||||
if (oldFlag!=null)
|
if (oldFlag != null) {
|
||||||
newflags.remove(oldFlag);
|
newflags.remove(oldFlag);
|
||||||
|
}
|
||||||
plot.settings.setFlags(newflags.toArray(new Flag[0]));
|
plot.settings.setFlags(newflags.toArray(new Flag[0]));
|
||||||
DBFunc.setFlags(plr.getWorld().getName(), plot, newflags.toArray(new Flag[0]));
|
DBFunc.setFlags(plr.getWorld().getName(), plot, newflags.toArray(new Flag[0]));
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.FLAG_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length)," ");
|
String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||||
if (FlagManager.getFlag(args[1].toLowerCase())==null && PlotMain.worldGuardListener != null) {
|
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotMain.worldGuardListener != null)) {
|
||||||
PlotMain.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], value);
|
PlotMain.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), value);
|
Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), value);
|
||||||
PlotFlagAddEvent event = new PlotFlagAddEvent(flag,plot);
|
PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED);
|
PlayerFunctions.sendMessage(plr, C.FLAG_NOT_ADDED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return false;
|
return false;
|
||||||
@ -141,44 +151,48 @@ public class Set extends SubCommand{
|
|||||||
DBFunc.setFlags(plr.getWorld().getName(), plot, plot.settings.getFlags().toArray(new Flag[0]));
|
DBFunc.setFlags(plr.getWorld().getName(), plot, plot.settings.getFlags().toArray(new Flag[0]));
|
||||||
PlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
|
PlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
PlayerFunctions.sendMessage(plr, "&c" + e.getMessage());
|
||||||
PlayerFunctions.sendMessage(plr, "&c"+e.getMessage());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("rain")) {
|
if (args[0].equalsIgnoreCase("rain")) {
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_ON_OFF);
|
PlayerFunctions.sendMessage(plr, C.NEED_ON_OFF);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String word = args[1];
|
String word = args[1];
|
||||||
if(!word.equalsIgnoreCase("on") && !word.equalsIgnoreCase("off")) {
|
if (!word.equalsIgnoreCase("on") && !word.equalsIgnoreCase("off")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_ON_OFF);
|
PlayerFunctions.sendMessage(plr, C.NEED_ON_OFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean b = word.equalsIgnoreCase("on");
|
boolean b = word.equalsIgnoreCase("on");
|
||||||
DBFunc.setWeather(plr.getWorld().getName(), plot, b);
|
DBFunc.setWeather(plr.getWorld().getName(), plot, b);
|
||||||
PlayerFunctions.sendMessage(plr, C.SETTING_UPDATED);
|
PlayerFunctions.sendMessage(plr, C.SETTING_UPDATED);
|
||||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
if(PlayerFunctions.getCurrentPlot(plr).id == plot.id) {
|
if (PlayerFunctions.getCurrentPlot(plr).id == plot.id) {
|
||||||
if(b) p.setPlayerWeather(WeatherType.DOWNFALL);
|
if (b) {
|
||||||
else p.resetPlayerWeather();
|
p.setPlayerWeather(WeatherType.DOWNFALL);
|
||||||
|
} else {
|
||||||
|
p.resetPlayerWeather();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("home")) {
|
if (args[0].equalsIgnoreCase("home")) {
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.MISSING_POSITION);
|
PlayerFunctions.sendMessage(plr, C.MISSING_POSITION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotHomePosition position = null;
|
PlotHomePosition position = null;
|
||||||
for(PlotHomePosition p : PlotHomePosition.values()) {
|
for (PlotHomePosition p : PlotHomePosition.values()) {
|
||||||
if(p.isMatching(args[1])) position = p;
|
if (p.isMatching(args[1])) {
|
||||||
|
position = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(position == null) {
|
if (position == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.INVALID_POSITION);
|
PlayerFunctions.sendMessage(plr, C.INVALID_POSITION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -187,14 +201,14 @@ public class Set extends SubCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("alias")) {
|
if (args[0].equalsIgnoreCase("alias")) {
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.MISSING_ALIAS);
|
PlayerFunctions.sendMessage(plr, C.MISSING_ALIAS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String alias = args[1];
|
String alias = args[1];
|
||||||
for(Plot p : PlotMain.getPlots(plr.getWorld()).values()) {
|
for (Plot p : PlotMain.getPlots(plr.getWorld()).values()) {
|
||||||
if(p.settings.getAlias().equalsIgnoreCase(alias)) {
|
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -207,165 +221,165 @@ public class Set extends SubCommand{
|
|||||||
PlayerFunctions.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
PlayerFunctions.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("biome")) {
|
if (args[0].equalsIgnoreCase("biome")) {
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BIOME);
|
PlayerFunctions.sendMessage(plr, C.NEED_BIOME);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Biome biome = null;
|
Biome biome = null;
|
||||||
for(Biome b : Biome.values()) {
|
for (Biome b : Biome.values()) {
|
||||||
if(b.toString().equalsIgnoreCase(args[1])) {
|
if (b.toString().equalsIgnoreCase(args[1])) {
|
||||||
biome = b;
|
biome = b;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(biome == null) {
|
if (biome == null) {
|
||||||
PlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
PlayerFunctions.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotHelper.setBiome(plr.getWorld(), plot, biome);
|
PlotHelper.setBiome(plr.getWorld(), plot, biome);
|
||||||
PlayerFunctions.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
PlayerFunctions.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("wall")) {
|
if (args[0].equalsIgnoreCase("wall")) {
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
||||||
if (plotworld==null) {
|
if (plotworld == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(args.length < 2) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Material material = null;
|
|
||||||
for(Material m : plotworld.BLOCKS) {
|
|
||||||
if(m.toString().equalsIgnoreCase(args[1])) {
|
|
||||||
material = m;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(material == null) {
|
|
||||||
PlayerFunctions.sendMessage(plr, getBlockList(plotworld.BLOCKS));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
byte data = 0;
|
|
||||||
|
|
||||||
if(args.length > 2) {
|
|
||||||
try {
|
|
||||||
data = (byte) Integer.parseInt(args[2]);
|
|
||||||
} catch(Exception e) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlayerFunctions.sendMessage(plr, C.GENERATING_WALL);
|
|
||||||
PlotHelper.adjustWall(plr.getWorld(), plot, (short)material.getId(), data);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(args[0].equalsIgnoreCase("floor")) {
|
|
||||||
if(args.length < 2) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
|
||||||
if (plotworld==null) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//
|
if (args.length < 2) {
|
||||||
@SuppressWarnings("unchecked")
|
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
||||||
ArrayList<Material> materials = (ArrayList<Material>) plotworld.BLOCKS.clone();
|
return true;
|
||||||
materials.add(Material.AIR);
|
}
|
||||||
//
|
Material material = null;
|
||||||
String[] strings = args[1].split(",");
|
for (Material m : PlotWorld.BLOCKS) {
|
||||||
//
|
if (m.toString().equalsIgnoreCase(args[1])) {
|
||||||
Material[] material = new Material[strings.length];
|
material = m;
|
||||||
byte[] data = new byte[strings.length];
|
break;
|
||||||
//
|
}
|
||||||
int index = 0;
|
}
|
||||||
//
|
if (material == null) {
|
||||||
byte b = (byte) 0;
|
PlayerFunctions.sendMessage(plr, getBlockList(PlotWorld.BLOCKS));
|
||||||
Material m = null;
|
return true;
|
||||||
//
|
}
|
||||||
for(String s : strings) {
|
byte data = 0;
|
||||||
s = s.replaceAll(",", "");
|
|
||||||
String[] ss = s.split(";");
|
if (args.length > 2) {
|
||||||
ss[0] = ss[0].replaceAll(";", "");
|
try {
|
||||||
for(Material ma : materials) {
|
data = (byte) Integer.parseInt(args[2]);
|
||||||
if(ma.toString().equalsIgnoreCase(ss[0])) {
|
} catch (Exception e) {
|
||||||
m = ma;
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
if(m == null) {
|
}
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK);
|
PlayerFunctions.sendMessage(plr, C.GENERATING_WALL);
|
||||||
return true;
|
PlotHelper.adjustWall(plr.getWorld(), plot, (short) material.getId(), data);
|
||||||
}
|
return true;
|
||||||
if(ss.length == 1) {
|
}
|
||||||
data[index] = (byte) 0;
|
if (args[0].equalsIgnoreCase("floor")) {
|
||||||
material[index] = m;
|
if (args.length < 2) {
|
||||||
} else {
|
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
||||||
try {
|
return true;
|
||||||
b = (byte) Integer.parseInt(ss[1]);
|
}
|
||||||
} catch(Exception e) {
|
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
if (plotworld == null) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
data[index] = b;
|
|
||||||
material[index] = m;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
PlotHelper.setFloor(plr, plot, material, data);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(args[0].equalsIgnoreCase("wall_filling")) {
|
|
||||||
if(args.length < 2) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
|
||||||
if (plotworld==null) {
|
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Material material = null;
|
//
|
||||||
for(Material m : plotworld.BLOCKS) {
|
@SuppressWarnings("unchecked")
|
||||||
if(m.toString().equalsIgnoreCase(args[1])) {
|
ArrayList<Material> materials = (ArrayList<Material>) PlotWorld.BLOCKS.clone();
|
||||||
material = m;
|
materials.add(Material.AIR);
|
||||||
break;
|
//
|
||||||
}
|
String[] strings = args[1].split(",");
|
||||||
}
|
//
|
||||||
if(material == null) {
|
Material[] material = new Material[strings.length];
|
||||||
PlayerFunctions.sendMessage(plr, getBlockList(plotworld.BLOCKS));
|
byte[] data = new byte[strings.length];
|
||||||
return true;
|
//
|
||||||
}
|
int index = 0;
|
||||||
byte data = 0;
|
//
|
||||||
|
byte b = (byte) 0;
|
||||||
|
Material m = null;
|
||||||
|
//
|
||||||
|
for (String s : strings) {
|
||||||
|
s = s.replaceAll(",", "");
|
||||||
|
String[] ss = s.split(";");
|
||||||
|
ss[0] = ss[0].replaceAll(";", "");
|
||||||
|
for (Material ma : materials) {
|
||||||
|
if (ma.toString().equalsIgnoreCase(ss[0])) {
|
||||||
|
m = ma;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (ss.length == 1) {
|
||||||
|
data[index] = (byte) 0;
|
||||||
|
material[index] = m;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
b = (byte) Integer.parseInt(ss[1]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
data[index] = b;
|
||||||
|
material[index] = m;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
PlotHelper.setFloor(plr, plot, material, data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("wall_filling")) {
|
||||||
|
if (args.length < 2) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NEED_BLOCK);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
PlotWorld plotworld = PlotMain.getWorldSettings(plr.getWorld());
|
||||||
|
if (plotworld == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Material material = null;
|
||||||
|
for (Material m : PlotWorld.BLOCKS) {
|
||||||
|
if (m.toString().equalsIgnoreCase(args[1])) {
|
||||||
|
material = m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (material == null) {
|
||||||
|
PlayerFunctions.sendMessage(plr, getBlockList(PlotWorld.BLOCKS));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
byte data = 0;
|
||||||
|
|
||||||
if(args.length > 2) {
|
if (args.length > 2) {
|
||||||
try {
|
try {
|
||||||
data = (byte) Integer.parseInt(args[2]);
|
data = (byte) Integer.parseInt(args[2]);
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotHelper.adjustWallFilling(plr, plr.getWorld(), plot, (short)material.getId(), data);
|
PlotHelper.adjustWallFilling(plr, plr.getWorld(), plot, (short) material.getId(), data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
|
||||||
builder.append(getArgumentList(values));
|
builder.append(getArgumentList(values));
|
||||||
PlayerFunctions.sendMessage(plr, builder.toString());
|
PlayerFunctions.sendMessage(plr, builder.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMaterial(Material m) {
|
private String getMaterial(Material m) {
|
||||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", m.toString().toLowerCase()));
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", m.toString().toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getBiome(Biome b) {
|
private String getBiome(Biome b) {
|
||||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", b.toString().toLowerCase()));
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", b.toString().toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(String s) {
|
private String getString(String s) {
|
||||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
||||||
@ -373,29 +387,28 @@ public class Set extends SubCommand{
|
|||||||
|
|
||||||
private String getArgumentList(String[] strings) {
|
private String getArgumentList(String[] strings) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for(String s : strings) {
|
for (String s : strings) {
|
||||||
builder.append(getString(s));
|
builder.append(getString(s));
|
||||||
}
|
}
|
||||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getBiomeList(List<Biome> biomes) {
|
private String getBiomeList(List<Biome> biomes) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(ChatColor.translateAlternateColorCodes('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
builder.append(ChatColor.translateAlternateColorCodes('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
||||||
for(Biome b : biomes) {
|
for (Biome b : biomes) {
|
||||||
builder.append(getBiome(b));
|
builder.append(getBiome(b));
|
||||||
}
|
}
|
||||||
return builder.toString().substring(1,builder.toString().length() - 1);
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getBlockList(List<Material> blocks) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(ChatColor.translateAlternateColorCodes('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
|
||||||
for(Material b : blocks) {
|
|
||||||
builder.append(getMaterial(b));
|
|
||||||
}
|
|
||||||
return builder.toString().substring(1,builder.toString().length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private String getBlockList(List<Material> blocks) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(ChatColor.translateAlternateColorCodes('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
||||||
|
for (Material b : blocks) {
|
||||||
|
builder.append(getMaterial(b));
|
||||||
|
}
|
||||||
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,49 +1,19 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.AUTO_MERGE_DEFAULT;
|
import java.io.IOException;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.DEFAULT_FLAGS_DEFAULT;
|
import java.util.Arrays;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.MAIN_BLOCK_DEFAULT;
|
import java.util.HashMap;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_BIOME_DEFAULT;
|
import java.util.Map;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_HEIGHT_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_WIDTH_DEFAULT;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_BLOCK_DEFAULT;
|
import org.bukkit.block.Biome;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_HEIGHT_DEFAULT;
|
import org.bukkit.entity.Player;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_DEFAULT;
|
import org.bukkit.event.Listener;
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_WIDTH_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_FILE_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT;
|
|
||||||
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_FILLING_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import com.intellectualcrafters.plot.PlotWorld;
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.WorldGenerator;
|
|
||||||
import com.intellectualcrafters.plot.listeners.PlayerEvents;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
|
|
||||||
import sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-09-26.
|
* Created by Citymonstret on 2014-09-26.
|
||||||
@ -58,16 +28,12 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
private String description;
|
private String description;
|
||||||
private Object value = 0;
|
private Object value = 0;
|
||||||
private String type;
|
private String type;
|
||||||
private boolean require_previous;
|
|
||||||
public SetupStep(String constant, Object default_value, String description, String type, boolean require_previous) {
|
public SetupStep(String constant, Object default_value, String description, String type, boolean require_previous) {
|
||||||
this.constant = constant;
|
this.constant = constant;
|
||||||
this.default_value = default_value;
|
this.default_value = default_value;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.require_previous = require_previous;
|
|
||||||
}
|
|
||||||
public boolean getRequire() {
|
|
||||||
return this.require_previous;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
@ -79,33 +45,34 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case "integer":
|
case "integer":
|
||||||
value = Integer.parseInt(string);
|
this.value = Integer.parseInt(string);
|
||||||
break;
|
break;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
value = Boolean.parseBoolean(string);
|
this.value = Boolean.parseBoolean(string);
|
||||||
break;
|
break;
|
||||||
case "double":
|
case "double":
|
||||||
value = Double.parseDouble(string);
|
this.value = Double.parseDouble(string);
|
||||||
break;
|
break;
|
||||||
case "float":
|
case "float":
|
||||||
value = Float.parseFloat(string);
|
this.value = Float.parseFloat(string);
|
||||||
break;
|
break;
|
||||||
case "biome":
|
case "biome":
|
||||||
value = (string.toUpperCase());
|
this.value = (string.toUpperCase());
|
||||||
break;
|
break;
|
||||||
case "block":
|
case "block":
|
||||||
value = string;
|
this.value = string;
|
||||||
break;
|
break;
|
||||||
case "blocklist":
|
case "blocklist":
|
||||||
value = string.split(",");
|
this.value = string.split(",");
|
||||||
break;
|
break;
|
||||||
case "string":
|
case "string":
|
||||||
value = string;
|
this.value = string;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validValue(String string) {
|
public boolean validValue(String string) {
|
||||||
try {
|
try {
|
||||||
if (this.type.equals("integer")) {
|
if (this.type.equals("integer")) {
|
||||||
@ -133,20 +100,18 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
String[] split = string.split(":");
|
String[] split = string.split(":");
|
||||||
Short.parseShort(split[0]);
|
Short.parseShort(split[0]);
|
||||||
Short.parseShort(split[1]);
|
Short.parseShort(split[1]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Short.parseShort(string);
|
Short.parseShort(string);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.type.equals("blocklist")) {
|
if (this.type.equals("blocklist")) {
|
||||||
for (String block:string.split(",")) {
|
for (String block : string.split(",")) {
|
||||||
if (block.contains(":")) {
|
if (block.contains(":")) {
|
||||||
String[] split = block.split(":");
|
String[] split = block.split(":");
|
||||||
Short.parseShort(split[0]);
|
Short.parseShort(split[0]);
|
||||||
Short.parseShort(split[1]);
|
Short.parseShort(split[1]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Short.parseShort(block);
|
Short.parseShort(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,14 +120,14 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
if (this.type.equals("string")) {
|
if (this.type.equals("string")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
catch (Exception e) {}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
if (this.value instanceof String[]) {
|
if (this.value instanceof String[]) {
|
||||||
return (List<String>)(List<?>) Arrays.asList((String[]) this.value);
|
return Arrays.asList((String[]) this.value);
|
||||||
}
|
}
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
@ -173,7 +138,7 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
|
|
||||||
public Object getDefaultValue() {
|
public Object getDefaultValue() {
|
||||||
if (this.default_value instanceof String[]) {
|
if (this.default_value instanceof String[]) {
|
||||||
return StringUtils.join((String[]) this.default_value,",");
|
return StringUtils.join((String[]) this.default_value, ",");
|
||||||
}
|
}
|
||||||
return this.default_value;
|
return this.default_value;
|
||||||
}
|
}
|
||||||
@ -187,37 +152,17 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
String world;
|
String world;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
SetupStep[] step = new SetupStep[] {
|
SetupStep[] step = new SetupStep[] { new SetupStep("road.height", PlotWorld.ROAD_HEIGHT_DEFAULT, "Height of road", "integer", false), new SetupStep("plot.height", PlotWorld.PLOT_HEIGHT_DEFAULT, "Height of plot", "integer", false), new SetupStep("wall.height", PlotWorld.WALL_HEIGHT_DEFAULT, "Height of wall", "integer", false), new SetupStep("plot.size", PlotWorld.PLOT_WIDTH_DEFAULT, "Size of plot", "integer", false), new SetupStep("road.width", PlotWorld.ROAD_WIDTH_DEFAULT, "Width of road", "integer", false), new SetupStep("plot.biome", PlotWorld.PLOT_BIOME_DEFAULT, "Plot biome", "biome", false), new SetupStep("plot.filling", PlotWorld.MAIN_BLOCK_DEFAULT, "Plot filling", "blocklist", false), new SetupStep("plot.floor", PlotWorld.TOP_BLOCK_DEFAULT, "Plot floor", "blocklist", false), new SetupStep("wall.block", PlotWorld.WALL_BLOCK_DEFAULT, "Wall block", "block", false), new SetupStep("wall.filling", PlotWorld.WALL_FILLING_DEFAULT, "Wall filling", "block", false),
|
||||||
new SetupStep("road.height", PlotWorld.ROAD_HEIGHT_DEFAULT, "Height of road", "integer", false),
|
new SetupStep("road.enable_stripes", PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT, "Enable road stripes", "boolean", false), new SetupStep("road.stripes", PlotWorld.ROAD_STRIPES_DEFAULT, "Road stripes block", "block", true), new SetupStep("road.block", PlotWorld.ROAD_BLOCK_DEFAULT, "Road block", "block", false), };
|
||||||
new SetupStep("plot.height", PlotWorld.PLOT_HEIGHT_DEFAULT, "Height of plot", "integer", false),
|
|
||||||
new SetupStep("wall.height", PlotWorld.WALL_HEIGHT_DEFAULT, "Height of wall", "integer", false),
|
|
||||||
new SetupStep("plot.size", PlotWorld.PLOT_WIDTH_DEFAULT, "Size of plot", "integer", false),
|
|
||||||
new SetupStep("road.width", PlotWorld.ROAD_WIDTH_DEFAULT, "Width of road", "integer", false),
|
|
||||||
new SetupStep("plot.biome", PlotWorld.PLOT_BIOME_DEFAULT, "Plot biome", "biome", false),
|
|
||||||
new SetupStep("plot.filling", PlotWorld.MAIN_BLOCK_DEFAULT, "Plot filling", "blocklist", false),
|
|
||||||
new SetupStep("plot.floor", PlotWorld.TOP_BLOCK_DEFAULT, "Plot floor", "blocklist", false),
|
|
||||||
new SetupStep("wall.block", PlotWorld.WALL_BLOCK_DEFAULT, "Wall block", "block", false),
|
|
||||||
new SetupStep("wall.filling", PlotWorld.WALL_FILLING_DEFAULT, "Wall filling", "block", false),
|
|
||||||
new SetupStep("road.enable_stripes", PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT, "Enable road stripes", "boolean", false),
|
|
||||||
new SetupStep("road.stripes", PlotWorld.ROAD_STRIPES_DEFAULT, "Road stripes block", "block", true),
|
|
||||||
new SetupStep("road.block", PlotWorld.ROAD_BLOCK_DEFAULT, "Road block", "block", false),
|
|
||||||
};
|
|
||||||
public SetupObject(String world) {
|
public SetupObject(String world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SetupStep getNextStep() {
|
|
||||||
return this.step[current++];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrent() {
|
public int getCurrent() {
|
||||||
return this.current;
|
return this.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrent(String string) {
|
|
||||||
this.step[current].setValue(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMax() {
|
public int getMax() {
|
||||||
return this.step.length;
|
return this.step.length;
|
||||||
}
|
}
|
||||||
@ -229,15 +174,15 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(Player plr, String... args) {
|
public boolean execute(Player plr, String... args) {
|
||||||
if(setupMap.containsKey(plr.getName())) {
|
if (setupMap.containsKey(plr.getName())) {
|
||||||
SetupObject object = setupMap.get(plr.getName());
|
SetupObject object = setupMap.get(plr.getName());
|
||||||
if(object.getCurrent() == object.getMax()) {
|
if (object.getCurrent() == object.getMax()) {
|
||||||
sendMessage(plr, C.SETUP_FINISHED, object.world);
|
sendMessage(plr, C.SETUP_FINISHED, object.world);
|
||||||
|
|
||||||
SetupStep[] steps = object.step;
|
SetupStep[] steps = object.step;
|
||||||
String world = object.world;
|
String world = object.world;
|
||||||
for (SetupStep step:steps) {
|
for (SetupStep step : steps) {
|
||||||
PlotMain.config.set("worlds."+world+"."+step.constant, step.getValue());
|
PlotMain.config.set("worlds." + world + "." + step.constant, step.getValue());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PlotMain.config.save(PlotMain.configFile);
|
PlotMain.config.save(PlotMain.configFile);
|
||||||
@ -245,15 +190,16 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// World newWorld = WorldCreator.name(world).generator(new WorldGenerator(world)).createWorld();
|
// World newWorld = WorldCreator.name(world).generator(new
|
||||||
// plr.teleport(newWorld.getSpawnLocation());
|
// WorldGenerator(world)).createWorld();
|
||||||
|
// plr.teleport(newWorld.getSpawnLocation());
|
||||||
|
|
||||||
setupMap.remove(plr.getName());
|
setupMap.remove(plr.getName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
SetupStep step = object.step[object.current];
|
SetupStep step = object.step[object.current];
|
||||||
if(args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -263,23 +209,22 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("back")) {
|
if (args[0].equalsIgnoreCase("back")) {
|
||||||
if (object.current>0) {
|
if (object.current > 0) {
|
||||||
object.current--;
|
object.current--;
|
||||||
step = object.step[object.current];
|
step = object.step[object.current];
|
||||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType(), step.getDefaultValue() + "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean valid = step.validValue(args[0]);
|
boolean valid = step.validValue(args[0]);
|
||||||
if(valid) {
|
if (valid) {
|
||||||
sendMessage(plr, C.SETUP_VALID_ARG, step.getConstant(), args[0]);
|
sendMessage(plr, C.SETUP_VALID_ARG, step.getConstant(), args[0]);
|
||||||
step.setValue(args[0]);
|
step.setValue(args[0]);
|
||||||
object.current++;
|
object.current++;
|
||||||
if(object.getCurrent() == object.getMax()) {
|
if (object.getCurrent() == object.getMax()) {
|
||||||
execute(plr, args);
|
execute(plr, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -302,7 +247,7 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
|
sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (PlotMain.getWorldSettings(world)!=null) {
|
if (PlotMain.getWorldSettings(world) != null) {
|
||||||
sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
|
sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,6 @@ public abstract class SubCommand {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute.
|
* Execute.
|
||||||
*
|
*
|
||||||
@ -109,6 +107,7 @@ public abstract class SubCommand {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message
|
* Send a message
|
||||||
|
*
|
||||||
* @param plr
|
* @param plr
|
||||||
* @param c
|
* @param c
|
||||||
* @param args
|
* @param args
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -71,13 +69,13 @@ public class TP extends SubCommand {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
if (a.contains(";")) {
|
if (a.contains(";")) {
|
||||||
String[] split = a.split(";");
|
String[] split = a.split(";");
|
||||||
if (split[1].length()>0 && StringUtils.isNumeric(split[1])) {
|
if ((split[1].length() > 0) && StringUtils.isNumeric(split[1])) {
|
||||||
index = Integer.parseInt(split[1]);
|
index = Integer.parseInt(split[1]);
|
||||||
}
|
}
|
||||||
a = split[0];
|
a = split[0];
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getPlayer(a);
|
Player player = Bukkit.getPlayer(a);
|
||||||
if (player!=null) {
|
if (player != null) {
|
||||||
Plot[] plots = PlotMain.getPlots(world, player).toArray(new Plot[0]);
|
Plot[] plots = PlotMain.getPlots(world, player).toArray(new Plot[0]);
|
||||||
if (plots.length > index) {
|
if (plots.length > index) {
|
||||||
return plots[index];
|
return plots[index];
|
||||||
|
@ -22,11 +22,9 @@ import com.intellectualcrafters.plot.Plot;
|
|||||||
import com.intellectualcrafters.plot.PlotHelper;
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import com.intellectualcrafters.plot.PlotSettings;
|
|
||||||
import com.intellectualcrafters.plot.PlotWorld;
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.SetBlockFast;
|
import com.intellectualcrafters.plot.SetBlockFast;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
|
||||||
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,6 +41,7 @@ public class Unlink extends SubCommand {
|
|||||||
private int pathsize;
|
private int pathsize;
|
||||||
private int wallheight;
|
private int wallheight;
|
||||||
private int roadheight;
|
private int roadheight;
|
||||||
|
|
||||||
public Unlink() {
|
public Unlink() {
|
||||||
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS);
|
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS);
|
||||||
}
|
}
|
||||||
@ -54,7 +53,7 @@ public class Unlink extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -76,15 +75,17 @@ public class Unlink extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PlotId id:ids) {
|
for (PlotId id : ids) {
|
||||||
Plot myplot = PlotMain.getPlots(world).get(id);
|
Plot myplot = PlotMain.getPlots(world).get(id);
|
||||||
|
|
||||||
if (plot.helpers!=null)
|
if (plot.helpers != null) {
|
||||||
myplot.helpers = plot.helpers;
|
myplot.helpers = plot.helpers;
|
||||||
if (plot.denied!=null)
|
}
|
||||||
|
if (plot.denied != null) {
|
||||||
myplot.denied = plot.denied;
|
myplot.denied = plot.denied;
|
||||||
|
}
|
||||||
myplot.deny_entry = plot.deny_entry;
|
myplot.deny_entry = plot.deny_entry;
|
||||||
myplot.settings.setMerged(new boolean[] {false, false, false, false} );
|
myplot.settings.setMerged(new boolean[] { false, false, false, false });
|
||||||
DBFunc.setMerged(world.getName(), myplot, myplot.settings.getMerged());
|
DBFunc.setMerged(world.getName(), myplot, myplot.settings.getMerged());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,14 +109,13 @@ public class Unlink extends SubCommand {
|
|||||||
this.f1_v = (byte) result_f1[1];
|
this.f1_v = (byte) result_f1[1];
|
||||||
//
|
//
|
||||||
|
|
||||||
// Floor 2
|
PlotHelper.getBlock(plotworld.ROAD_STRIPES);
|
||||||
short[] result_f2 = PlotHelper.getBlock(plotworld.ROAD_STRIPES);
|
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
boolean lx = x < pos2.x;
|
boolean lx = x < pos2.x;
|
||||||
boolean ly = y < pos2.y;
|
boolean ly = y < pos2.y;
|
||||||
|
|
||||||
PlotId id = new PlotId(x,y);
|
PlotId id = new PlotId(x, y);
|
||||||
|
|
||||||
if (lx) {
|
if (lx) {
|
||||||
setRoadX(world, id);
|
setRoadX(world, id);
|
||||||
@ -135,16 +135,17 @@ public class Unlink extends SubCommand {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
SetBlockFast.update(plr);
|
SetBlockFast.update(plr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
|
PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the road with the greatest X value
|
* Setting the road with the greatest X value
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -152,23 +153,25 @@ public class Unlink extends SubCommand {
|
|||||||
Location pos1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
Location pos1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
||||||
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
||||||
|
|
||||||
int sx = pos2.getBlockX()+1;
|
int sx = pos2.getBlockX() + 1;
|
||||||
int ex = sx + pathsize - 1;
|
int ex = (sx + this.pathsize) - 1;
|
||||||
int sz = pos1.getBlockZ()-1;
|
int sz = pos1.getBlockZ() - 1;
|
||||||
int ez = pos2.getBlockZ()+2;
|
int ez = pos2.getBlockZ() + 2;
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(w, new Location(w,sx,Math.min(wallheight, roadheight)+1,sz+1), new Location(w,ex+1,257+1,ez), (short) 0);
|
PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(this.wallheight, this.roadheight) + 1, sz + 1), new Location(w, ex + 1, 257 + 1, ez), (short) 0);
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx,1,sz+1), new Location(w,sx+1,wallheight+1,ez), new short[] {wf_id}, new short[] {wf_v});
|
PlotHelper.setCuboid(w, new Location(w, sx, 1, sz + 1), new Location(w, sx + 1, this.wallheight + 1, ez), new short[] { this.wf_id }, new short[] { this.wf_v });
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx,wallheight+1,sz+1), new Location(w,sx+1,wallheight+2,ez), new short[] {w_id}, new short[] {w_v});
|
PlotHelper.setCuboid(w, new Location(w, sx, this.wallheight + 1, sz + 1), new Location(w, sx + 1, this.wallheight + 2, ez), new short[] { this.w_id }, new short[] { this.w_v });
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,ex,1,sz+1), new Location(w,ex+1,wallheight+1,ez), new short[] {wf_id}, new short[] {wf_v});
|
PlotHelper.setCuboid(w, new Location(w, ex, 1, sz + 1), new Location(w, ex + 1, this.wallheight + 1, ez), new short[] { this.wf_id }, new short[] { this.wf_v });
|
||||||
PlotHelper.setCuboid(w, new Location(w,ex,wallheight+1,sz+1), new Location(w,ex+1,wallheight+2,ez), new short[] {w_id}, new short[] {w_v});
|
PlotHelper.setCuboid(w, new Location(w, ex, this.wallheight + 1, sz + 1), new Location(w, ex + 1, this.wallheight + 2, ez), new short[] { this.w_id }, new short[] { this.w_v });
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,1,sz+1), new Location(w,ex,roadheight+1,ez), new short[] {f1_id}, new short[] {f1_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, this.roadheight + 1, ez), new short[] { this.f1_id }, new short[] { this.f1_v });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the road with the greatest Y value
|
* Setting the road with the greatest Y value
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -177,36 +180,38 @@ public class Unlink extends SubCommand {
|
|||||||
Location pos1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
Location pos1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
||||||
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
||||||
|
|
||||||
int sz = pos2.getBlockZ()+1;
|
int sz = pos2.getBlockZ() + 1;
|
||||||
int ez = sz + pathsize - 1;
|
int ez = (sz + this.pathsize) - 1;
|
||||||
int sx = pos1.getBlockX()-1;
|
int sx = pos1.getBlockX() - 1;
|
||||||
int ex = pos2.getBlockX()+2;
|
int ex = pos2.getBlockX() + 2;
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(w, new Location(w,sx,Math.min(wallheight, roadheight)+1,sz+1), new Location(w,ex+1,257+1,ez), (short) 0);
|
PlotHelper.setSimpleCuboid(w, new Location(w, sx, Math.min(this.wallheight, this.roadheight) + 1, sz + 1), new Location(w, ex + 1, 257 + 1, ez), (short) 0);
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,1,sz), new Location(w,ex,wallheight+1,sz+1), new short[] {wf_id}, new short[] {wf_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz), new Location(w, ex, this.wallheight + 1, sz + 1), new short[] { this.wf_id }, new short[] { this.wf_v });
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,wallheight+1,sz), new Location(w,ex,wallheight+2,sz+1), new short[] {w_id}, new short[] {w_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, this.wallheight + 1, sz), new Location(w, ex, this.wallheight + 2, sz + 1), new short[] { this.w_id }, new short[] { this.w_v });
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,1,sz), new Location(w,ex,wallheight+1,sz+1), new short[] {wf_id}, new short[] {wf_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz), new Location(w, ex, this.wallheight + 1, sz + 1), new short[] { this.wf_id }, new short[] { this.wf_v });
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,wallheight+1,ez), new Location(w,ex,wallheight+2,ez+1), new short[] {w_id}, new short[] {w_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, this.wallheight + 1, ez), new Location(w, ex, this.wallheight + 2, ez + 1), new short[] { this.w_id }, new short[] { this.w_v });
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,1,sz+1), new Location(w,ex,roadheight+1,ez), new short[] {f1_id}, new short[] {f1_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, this.roadheight + 1, ez), new short[] { this.f1_id }, new short[] { this.f1_v });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the intersection with the greatest X and Y value
|
* Setting the intersection with the greatest X and Y value
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
public void setRoadXY(World w, PlotId id) {
|
public void setRoadXY(World w, PlotId id) {
|
||||||
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
Location pos2 = PlotHelper.getPlotTopLocAbs(w, id);
|
||||||
|
|
||||||
int sx = pos2.getBlockX()+1;
|
int sx = pos2.getBlockX() + 1;
|
||||||
int ex = sx + pathsize - 1;
|
int ex = (sx + this.pathsize) - 1;
|
||||||
int sz = pos2.getBlockZ()+1;
|
int sz = pos2.getBlockZ() + 1;
|
||||||
int ez = sz + pathsize - 1;
|
int ez = (sz + this.pathsize) - 1;
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(w, new Location(w,sx,roadheight+1,sz+1), new Location(w,ex+1,257+1,ez), (short) 0);
|
PlotHelper.setSimpleCuboid(w, new Location(w, sx, this.roadheight + 1, sz + 1), new Location(w, ex + 1, 257 + 1, ez), (short) 0);
|
||||||
|
|
||||||
PlotHelper.setCuboid(w, new Location(w,sx+1,1,sz+1), new Location(w,ex,roadheight+1,ez), new short[] {f1_id}, new short[] {f1_v});
|
PlotHelper.setCuboid(w, new Location(w, sx + 1, 1, sz + 1), new Location(w, ex, this.roadheight + 1, ez), new short[] { this.f1_id }, new short[] { this.f1_v });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,17 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Visit extends SubCommand {
|
public class Visit extends SubCommand {
|
||||||
public Visit() {
|
public Visit() {
|
||||||
|
@ -67,7 +67,7 @@ public class DBFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void createAllSettingsAndHelpers(ArrayList<Plot> plots) {
|
public static void createAllSettingsAndHelpers(ArrayList<Plot> plots) {
|
||||||
HashMap<String, HashMap<PlotId, Integer>> stored = new HashMap< String, HashMap<PlotId, Integer>>();
|
HashMap<String, HashMap<PlotId, Integer>> stored = new HashMap<String, HashMap<PlotId, Integer>>();
|
||||||
HashMap<Integer, ArrayList<UUID>> helpers = new HashMap<Integer, ArrayList<UUID>>();
|
HashMap<Integer, ArrayList<UUID>> helpers = new HashMap<Integer, ArrayList<UUID>>();
|
||||||
try {
|
try {
|
||||||
PreparedStatement stmt = connection.prepareStatement("SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `plot`");
|
PreparedStatement stmt = connection.prepareStatement("SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `plot`");
|
||||||
@ -79,40 +79,40 @@ public class DBFunc {
|
|||||||
String world = result.getString("world");
|
String world = result.getString("world");
|
||||||
|
|
||||||
if (!stored.containsKey(world)) {
|
if (!stored.containsKey(world)) {
|
||||||
stored.put(world,new HashMap<PlotId, Integer>());
|
stored.put(world, new HashMap<PlotId, Integer>());
|
||||||
}
|
}
|
||||||
stored.get(world).put(new PlotId(idx,idz), id);
|
stored.get(world).put(new PlotId(idx, idz), id);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Plot plot:plots) {
|
for (Plot plot : plots) {
|
||||||
String world = Bukkit.getWorld(plot.world).getName();
|
String world = Bukkit.getWorld(plot.world).getName();
|
||||||
if (stored.containsKey(world)) {
|
if (stored.containsKey(world)) {
|
||||||
Integer id = stored.get(world).get(plot.id);
|
Integer id = stored.get(world).get(plot.id);
|
||||||
if (id!=null) {
|
if (id != null) {
|
||||||
helpers.put(id,plot.helpers);
|
helpers.put(id, plot.helpers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (helpers.size()==0) {
|
if (helpers.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add plot settings
|
// add plot settings
|
||||||
Integer[] ids = helpers.keySet().toArray(new Integer[0]);
|
Integer[] ids = helpers.keySet().toArray(new Integer[0]);
|
||||||
StringBuilder statement = new StringBuilder("INSERT INTO `plot_settings` (`plot_plot_id`) values ");
|
StringBuilder statement = new StringBuilder("INSERT INTO `plot_settings` (`plot_plot_id`) values ");
|
||||||
for (int i = 0; i<ids.length-1; i++) {
|
for (int i = 0; i < (ids.length - 1); i++) {
|
||||||
statement.append("(?),");
|
statement.append("(?),");
|
||||||
}
|
}
|
||||||
statement.append("(?)");
|
statement.append("(?)");
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
try {
|
try {
|
||||||
stmt = connection.prepareStatement(statement.toString());
|
stmt = connection.prepareStatement(statement.toString());
|
||||||
for (int i = 0; i<ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
stmt.setInt(i+1, ids[i]);
|
stmt.setInt(i + 1, ids[i]);
|
||||||
}
|
}
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
@ -123,9 +123,9 @@ public class DBFunc {
|
|||||||
// add plot helpers
|
// add plot helpers
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
statement = new StringBuilder("INSERT INTO `plot_helpers` (`plot_plot_id`, `user_uuid`) values ");
|
statement = new StringBuilder("INSERT INTO `plot_helpers` (`plot_plot_id`, `user_uuid`) values ");
|
||||||
for (Integer id:helpers.keySet()) {
|
for (Integer id : helpers.keySet()) {
|
||||||
for (UUID helper:helpers.get(id)) {
|
for (UUID helper : helpers.get(id)) {
|
||||||
statement.append(prefix+"(?, ?)");
|
statement.append(prefix + "(?, ?)");
|
||||||
prefix = ",";
|
prefix = ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,11 +135,11 @@ public class DBFunc {
|
|||||||
try {
|
try {
|
||||||
stmt = connection.prepareStatement(statement.toString());
|
stmt = connection.prepareStatement(statement.toString());
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Integer id:helpers.keySet()) {
|
for (Integer id : helpers.keySet()) {
|
||||||
for (UUID helper:helpers.get(id)) {
|
for (UUID helper : helpers.get(id)) {
|
||||||
|
|
||||||
stmt.setInt(counter*2+1, id);
|
stmt.setInt((counter * 2) + 1, id);
|
||||||
stmt.setString(counter*2+2, helper.toString());
|
stmt.setString((counter * 2) + 2, helper.toString());
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
@ -158,12 +158,12 @@ public class DBFunc {
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
public static void createPlots(ArrayList<Plot> plots) {
|
public static void createPlots(ArrayList<Plot> plots) {
|
||||||
if (plots.size()==0) {
|
if (plots.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StringBuilder statement = new StringBuilder("INSERT INTO `plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ");
|
StringBuilder statement = new StringBuilder("INSERT INTO `plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ");
|
||||||
|
|
||||||
for (int i = 0; i<plots.size()-1; i++) {
|
for (int i = 0; i < (plots.size() - 1); i++) {
|
||||||
statement.append("(?, ?, ?, ?),");
|
statement.append("(?, ?, ?, ?),");
|
||||||
}
|
}
|
||||||
statement.append("(?, ?, ?, ?)");
|
statement.append("(?, ?, ?, ?)");
|
||||||
@ -171,12 +171,12 @@ public class DBFunc {
|
|||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
try {
|
try {
|
||||||
stmt = connection.prepareStatement(statement.toString());
|
stmt = connection.prepareStatement(statement.toString());
|
||||||
for (int i = 0; i<plots.size(); i++) {
|
for (int i = 0; i < plots.size(); i++) {
|
||||||
Plot plot = plots.get(i);
|
Plot plot = plots.get(i);
|
||||||
stmt.setInt(i*4+1, plot.id.x);
|
stmt.setInt((i * 4) + 1, plot.id.x);
|
||||||
stmt.setInt(i*4+2, plot.id.y);
|
stmt.setInt((i * 4) + 2, plot.id.y);
|
||||||
stmt.setString(i*4+3, plot.owner.toString());
|
stmt.setString((i * 4) + 3, plot.owner.toString());
|
||||||
stmt.setString(i*4+4, plot.world);
|
stmt.setString((i * 4) + 4, plot.world);
|
||||||
}
|
}
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
@ -415,7 +415,7 @@ public class DBFunc {
|
|||||||
boolean rain;
|
boolean rain;
|
||||||
try {
|
try {
|
||||||
rain = (int) settings.get("rain") == 1 ? true : false;
|
rain = (int) settings.get("rain") == 1 ? true : false;
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
rain = false;
|
rain = false;
|
||||||
}
|
}
|
||||||
String alias = (String) settings.get("alias");
|
String alias = (String) settings.get("alias");
|
||||||
@ -439,7 +439,7 @@ public class DBFunc {
|
|||||||
|
|
||||||
boolean[] merged = new boolean[4];
|
boolean[] merged = new boolean[4];
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
merged[3-i] = (merged_int & (1 << i)) != 0;
|
merged[3 - i] = (merged_int & (1 << i)) != 0;
|
||||||
}
|
}
|
||||||
p = new Plot(plot_id, owner, plotBiome, helpers, trusted, denied, /* changeTime */false, time, rain, alias, position, flags, worldname, merged);
|
p = new Plot(plot_id, owner, plotBiome, helpers, trusted, denied, /* changeTime */false, time, rain, alias, position, flags, worldname, merged);
|
||||||
if (plots.containsKey(worldname)) {
|
if (plots.containsKey(worldname)) {
|
||||||
@ -849,18 +849,18 @@ public class DBFunc {
|
|||||||
|
|
||||||
public static double getRatings(final Plot plot) {
|
public static double getRatings(final Plot plot) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT AVG(`rating`) AS `rating` FROM `plot_ratings` WHERE `plot_plot_id` = ? ");
|
PreparedStatement statement = connection.prepareStatement("SELECT AVG(`rating`) AS `rating` FROM `plot_ratings` WHERE `plot_plot_id` = ? ");
|
||||||
statement.setInt(1, getId(plot.getWorld().getName(), plot.id));
|
statement.setInt(1, getId(plot.getWorld().getName(), plot.id));
|
||||||
ResultSet set = statement.executeQuery();
|
ResultSet set = statement.executeQuery();
|
||||||
double rating = 0;
|
double rating = 0;
|
||||||
while(set.next()) {
|
while (set.next()) {
|
||||||
rating = set.getDouble("rating");
|
rating = set.getDouble("rating");
|
||||||
}
|
}
|
||||||
statement.close();
|
statement.close();
|
||||||
return rating;
|
return rating;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.add(LogLevel.WARNING, "Failed to fetch rating for plot " + plot.getId().toString());
|
Logger.add(LogLevel.WARNING, "Failed to fetch rating for plot " + plot.getId().toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 0.0d;
|
return 0.0d;
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
|
||||||
import com.worldcretornica.plotme.PlayerList;
|
|
||||||
import com.worldcretornica.plotme.Plot;
|
|
||||||
import com.worldcretornica.plotme.PlotManager;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -16,6 +7,16 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||||
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.worldcretornica.plotme.PlayerList;
|
||||||
|
import com.worldcretornica.plotme.Plot;
|
||||||
|
import com.worldcretornica.plotme.PlotManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-17.
|
* Created by Citymonstret on 2014-08-17.
|
||||||
*/
|
*/
|
||||||
@ -29,8 +30,7 @@ public class PlotMeConverter {
|
|||||||
|
|
||||||
public void runAsync() throws Exception {
|
public void runAsync() throws Exception {
|
||||||
|
|
||||||
/* TODO Fix this... */
|
Bukkit.getOnlineMode();
|
||||||
boolean offlineMode = Bukkit.getOnlineMode();
|
|
||||||
|
|
||||||
final PrintStream stream = new PrintStream("converter_log.txt");
|
final PrintStream stream = new PrintStream("converter_log.txt");
|
||||||
|
|
||||||
@ -42,10 +42,11 @@ public class PlotMeConverter {
|
|||||||
HashMap<String, UUID> uuidMap = new HashMap<String, UUID>();
|
HashMap<String, UUID> uuidMap = new HashMap<String, 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) {
|
||||||
|
|
||||||
// TODO generate configuration based on PlotMe config
|
// TODO generate configuration based on PlotMe config
|
||||||
// - Plugin doesn't display a message if database is not setup at all
|
// - Plugin doesn't display a message if database is not
|
||||||
|
// setup at all
|
||||||
|
|
||||||
PlotMain.sendConsoleSenderMessage("Converting " + plots.size() + " plots for '" + world.toString() + "'...");
|
PlotMain.sendConsoleSenderMessage("Converting " + plots.size() + " plots for '" + world.toString() + "'...");
|
||||||
for (Plot plot : plots.values()) {
|
for (Plot plot : plots.values()) {
|
||||||
@ -60,7 +61,9 @@ public class PlotMeConverter {
|
|||||||
long eR3040bl230 = 22392948l;
|
long eR3040bl230 = 22392948l;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// TODO It just comes up with a NoSuchFieldException. Y U NO WORK!!! (I didn't change anything here btw)
|
// TODO It just comes up with a
|
||||||
|
// NoSuchFieldException. Y U NO WORK!!! (I
|
||||||
|
// didn't change anything here btw)
|
||||||
Field fAdded = plot.getClass().getDeclaredField("allowed");
|
Field fAdded = plot.getClass().getDeclaredField("allowed");
|
||||||
Field fDenied = plot.getClass().getDeclaredField("denied");
|
Field fDenied = plot.getClass().getDeclaredField("denied");
|
||||||
fAdded.setAccessible(true);
|
fAdded.setAccessible(true);
|
||||||
@ -68,16 +71,16 @@ public class PlotMeConverter {
|
|||||||
added = (PlayerList) fAdded.get(plot);
|
added = (PlayerList) fAdded.get(plot);
|
||||||
denied = (PlayerList) fDenied.get(plot);
|
denied = (PlayerList) fDenied.get(plot);
|
||||||
for (Map.Entry<String, UUID> set : added.getAllPlayers().entrySet()) {
|
for (Map.Entry<String, UUID> set : added.getAllPlayers().entrySet()) {
|
||||||
if (set.getValue() != null || set.getKey().equals("*")) {
|
if ((set.getValue() != null) || set.getKey().equals("*")) {
|
||||||
if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equals("*")) {
|
if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equals("*")) {
|
||||||
psAdded.add(DBFunc.everyone);
|
psAdded.add(DBFunc.everyone);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Does this work for offline mode servers?
|
* Does this work for offline mode
|
||||||
|
* servers?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (uuidMap.containsKey(set.getKey())) {
|
if (uuidMap.containsKey(set.getKey())) {
|
||||||
@ -85,7 +88,7 @@ public class PlotMeConverter {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
||||||
if (value!=null) {
|
if (value != null) {
|
||||||
uuidMap.put(set.getKey(), value);
|
uuidMap.put(set.getKey(), value);
|
||||||
psAdded.add(value);
|
psAdded.add(value);
|
||||||
continue;
|
continue;
|
||||||
@ -94,19 +97,18 @@ public class PlotMeConverter {
|
|||||||
psAdded.add(set.getValue());
|
psAdded.add(set.getValue());
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, UUID> set : denied.getAllPlayers().entrySet()) {
|
for (Map.Entry<String, UUID> set : denied.getAllPlayers().entrySet()) {
|
||||||
if (set.getValue() != null || set.getKey().equals("*")) {
|
if ((set.getValue() != null) || set.getKey().equals("*")) {
|
||||||
if (set.getKey().equals("*") || set.getValue().toString().equals("*")) {
|
if (set.getKey().equals("*") || set.getValue().toString().equals("*")) {
|
||||||
psDenied.add(DBFunc.everyone);
|
psDenied.add(DBFunc.everyone);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (uuidMap.containsKey(set.getKey())) {
|
if (uuidMap.containsKey(set.getKey())) {
|
||||||
psDenied.add(uuidMap.get(set.getKey()));
|
psDenied.add(uuidMap.get(set.getKey()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
||||||
if (value!=null) {
|
if (value != null) {
|
||||||
uuidMap.put(set.getKey(), value);
|
uuidMap.put(set.getKey(), value);
|
||||||
psDenied.add(value);
|
psDenied.add(value);
|
||||||
continue;
|
continue;
|
||||||
@ -116,38 +118,32 @@ public class PlotMeConverter {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Doing it the slow way like a n00b.
|
// Doing it the slow way like a n00b.
|
||||||
for (String user:plot.getAllowed().split(",")) {
|
for (String user : plot.getAllowed().split(",")) {
|
||||||
try {
|
try {
|
||||||
if (user.equals("*")) {
|
if (user.equals("*")) {
|
||||||
psAdded.add(DBFunc.everyone);
|
psAdded.add(DBFunc.everyone);
|
||||||
}
|
} else if (uuidMap.containsKey(user)) {
|
||||||
else if (uuidMap.containsKey(user)) {
|
|
||||||
psAdded.add(uuidMap.get(user));
|
psAdded.add(uuidMap.get(user));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
UUID uuid = Bukkit.getOfflinePlayer(user).getUniqueId();
|
UUID uuid = Bukkit.getOfflinePlayer(user).getUniqueId();
|
||||||
uuidMap.put(user, uuid);
|
uuidMap.put(user, uuid);
|
||||||
psAdded.add(uuid);
|
psAdded.add(uuid);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e2) {
|
||||||
catch (Exception e2) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String user:plot.getDenied().split(",")) {
|
for (String user : plot.getDenied().split(",")) {
|
||||||
try {
|
try {
|
||||||
if (user.equals("*")) {
|
if (user.equals("*")) {
|
||||||
psDenied.add(DBFunc.everyone);
|
psDenied.add(DBFunc.everyone);
|
||||||
}
|
} else if (uuidMap.containsKey(user)) {
|
||||||
else if (uuidMap.containsKey(user)) {
|
|
||||||
psDenied.add(uuidMap.get(user));
|
psDenied.add(uuidMap.get(user));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
UUID uuid = Bukkit.getOfflinePlayer(user).getUniqueId();
|
UUID uuid = Bukkit.getOfflinePlayer(user).getUniqueId();
|
||||||
uuidMap.put(user, uuid);
|
uuidMap.put(user, uuid);
|
||||||
psDenied.add(uuid);
|
psDenied.add(uuid);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e2) {
|
||||||
catch (Exception e2) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eR3040bl230 = 232000499888388747l;
|
eR3040bl230 = 232000499888388747l;
|
||||||
@ -156,9 +152,10 @@ public class PlotMeConverter {
|
|||||||
}
|
}
|
||||||
stream.println(eR3040bl230);
|
stream.println(eR3040bl230);
|
||||||
PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
|
PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
|
||||||
com.intellectualcrafters.plot.Plot pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] {false, false, false, false} );
|
com.intellectualcrafters.plot.Plot pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] { false, false, false, false });
|
||||||
|
|
||||||
// TODO createPlot doesn't add helpers / denied users
|
// TODO createPlot doesn't add helpers / denied
|
||||||
|
// users
|
||||||
|
|
||||||
createdPlots.add(pl);
|
createdPlots.add(pl);
|
||||||
}
|
}
|
||||||
@ -172,9 +169,12 @@ public class PlotMeConverter {
|
|||||||
stream.close();
|
stream.close();
|
||||||
PlotMain.sendConsoleSenderMessage("PlotMe->PlotSquared Conversion has finished");
|
PlotMain.sendConsoleSenderMessage("PlotMe->PlotSquared Conversion has finished");
|
||||||
|
|
||||||
// TODO disable PlotMe -> Unload all plot worlds, change the generator, restart the server automatically
|
// TODO disable PlotMe -> Unload all plot worlds, change the
|
||||||
// Possibly use multiverse / multiworld if it's to difficult modifying a world's generator while the server is running
|
// generator, restart the server automatically
|
||||||
// Should really do that? Would seem pretty bad from our side + bukkit wouldn't approve
|
// Possibly use multiverse / multiworld if it's to difficult
|
||||||
|
// modifying a world's generator while the server is running
|
||||||
|
// Should really do that? Would seem pretty bad from our side +
|
||||||
|
// bukkit wouldn't approve
|
||||||
|
|
||||||
Bukkit.getPluginManager().disablePlugin(PlotMeConverter.this.plugin);
|
Bukkit.getPluginManager().disablePlugin(PlotMeConverter.this.plugin);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerClaimPlotEvent: Called when a plot is claimed
|
* PlayerClaimPlotEvent: Called when a plot is claimed
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -37,6 +38,7 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
|
@ -17,6 +17,7 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerEnterPlotEvent: Called when a player leaves a plot
|
* PlayerEnterPlotEvent: Called when a player leaves a plot
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -27,6 +28,7 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
|
@ -13,8 +13,10 @@ 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
|
* PlayerLeavePlotEvent: Called when a player leaves a plot
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -22,8 +24,10 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
|
|||||||
super(player);
|
super(player);
|
||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
|
@ -18,8 +18,11 @@ 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
|
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a
|
||||||
|
* plot
|
||||||
|
*
|
||||||
* @param initiator
|
* @param initiator
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -34,27 +37,34 @@ public class PlayerPlotDeniedEvent extends Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If a user was added
|
* If a user was added
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean wasAdded() {
|
public boolean wasAdded() {
|
||||||
return this.added;
|
return this.added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player added/removed
|
* The player added/removed
|
||||||
|
*
|
||||||
* @return UUID
|
* @return UUID
|
||||||
*/
|
*/
|
||||||
public UUID getPlayer() {
|
public UUID getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot involved
|
* The plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player initiating the action
|
* The player initiating the action
|
||||||
|
*
|
||||||
* @return Player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public Player getInitiator() {
|
public Player getInitiator() {
|
||||||
|
@ -18,8 +18,10 @@ 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
|
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
|
||||||
|
*
|
||||||
* @param initiator
|
* @param initiator
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -34,27 +36,34 @@ public class PlayerPlotHelperEvent extends Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If a player was added
|
* If a player was added
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean wasAdded() {
|
public boolean wasAdded() {
|
||||||
return this.added;
|
return this.added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UUID added/removed
|
* The UUID added/removed
|
||||||
|
*
|
||||||
* @return UUID
|
* @return UUID
|
||||||
*/
|
*/
|
||||||
public UUID getPlayer() {
|
public UUID getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot involved
|
* The plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player initiating the action
|
* The player initiating the action
|
||||||
|
*
|
||||||
* @return Player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public Player getInitiator() {
|
public Player getInitiator() {
|
||||||
|
@ -18,8 +18,10 @@ public class PlayerPlotTrustedEvent extends Event {
|
|||||||
private Player initiator;
|
private Player initiator;
|
||||||
private boolean added;
|
private boolean added;
|
||||||
private UUID player;
|
private UUID player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
|
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
|
||||||
|
*
|
||||||
* @param initiator
|
* @param initiator
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -34,27 +36,34 @@ public class PlayerPlotTrustedEvent extends Event {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If a player was added
|
* If a player was added
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean wasAdded() {
|
public boolean wasAdded() {
|
||||||
return this.added;
|
return this.added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UUID added/removed
|
* The UUID added/removed
|
||||||
|
*
|
||||||
* @return UUID
|
* @return UUID
|
||||||
*/
|
*/
|
||||||
public UUID getPlayer() {
|
public UUID getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plot involved
|
* The plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player initiating the action
|
* The player initiating the action
|
||||||
|
*
|
||||||
* @return Player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public Player getInitiator() {
|
public Player getInitiator() {
|
||||||
|
@ -16,6 +16,7 @@ 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
|
* Called when a player teleports to a plot
|
||||||
*/
|
*/
|
||||||
@ -26,8 +27,10 @@ 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
|
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param from
|
* @param from
|
||||||
* @param plot
|
* @param plot
|
||||||
@ -45,6 +48,7 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the from location
|
* Get the from location
|
||||||
|
*
|
||||||
* @return Location
|
* @return Location
|
||||||
*/
|
*/
|
||||||
public Location getFrom() {
|
public Location getFrom() {
|
||||||
@ -53,6 +57,7 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
|
@ -24,8 +24,10 @@ public class PlotClearEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
private PlotId id;
|
private PlotId id;
|
||||||
private String world;
|
private String world;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotDeleteEvent: Called when a plot is cleared
|
* PlotDeleteEvent: Called when a plot is cleared
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -36,6 +38,7 @@ public class PlotClearEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotId
|
* Get the PlotId
|
||||||
|
*
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
@ -44,6 +47,7 @@ public class PlotClearEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world name
|
* Get the world name
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
|
@ -24,8 +24,10 @@ 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
|
* PlotDeleteEvent: Called when a plot is deleted
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@ -36,6 +38,7 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotId
|
* Get the PlotId
|
||||||
|
*
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
@ -44,6 +47,7 @@ public class PlotDeleteEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world name
|
* Get the world name
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
|
@ -28,6 +28,7 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotFlagAddEvent: Called when a Flag is added to a plot
|
* PlotFlagAddEvent: Called when a Flag is added to a plot
|
||||||
|
*
|
||||||
* @param flag
|
* @param flag
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -38,6 +39,7 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
@ -46,6 +48,7 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flag involved
|
* Get the flag involved
|
||||||
|
*
|
||||||
* @return Flag
|
* @return Flag
|
||||||
*/
|
*/
|
||||||
public Flag getFlag() {
|
public Flag getFlag() {
|
||||||
|
@ -28,6 +28,7 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
||||||
|
*
|
||||||
* @param flag
|
* @param flag
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -35,15 +36,19 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
|
|||||||
this.plot = plot;
|
this.plot = plot;
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot involved
|
* Get the plot involved
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
return this.plot;
|
return this.plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flag involved
|
* Get the flag involved
|
||||||
|
*
|
||||||
* @return Flag
|
* @return Flag
|
||||||
*/
|
*/
|
||||||
public Flag getFlag() {
|
public Flag getFlag() {
|
||||||
|
@ -10,14 +10,11 @@
|
|||||||
package com.intellectualcrafters.plot.events;
|
package com.intellectualcrafters.plot.events;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
@ -35,6 +32,7 @@ public class PlotMergeEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotMergeEvent: Called when plots are merged
|
* PlotMergeEvent: Called when plots are merged
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@ -44,13 +42,16 @@ public class PlotMergeEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plots being added;
|
* Get the plots being added;
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public ArrayList<PlotId> getPlots() {
|
public ArrayList<PlotId> getPlots() {
|
||||||
return this.plots;
|
return this.plots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main plot
|
* Get the main plot
|
||||||
|
*
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getPlot() {
|
public Plot getPlot() {
|
||||||
|
@ -10,16 +10,12 @@
|
|||||||
package com.intellectualcrafters.plot.events;
|
package com.intellectualcrafters.plot.events;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
|
||||||
import com.intellectualcrafters.plot.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,6 +30,7 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a mega-plot is unlinked.
|
* Called when a mega-plot is unlinked.
|
||||||
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param plots
|
* @param plots
|
||||||
*/
|
*/
|
||||||
@ -44,6 +41,7 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plots involved
|
* Get the plots involved
|
||||||
|
*
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public ArrayList<PlotId> getPlots() {
|
public ArrayList<PlotId> getPlots() {
|
||||||
|
@ -19,7 +19,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -65,7 +64,6 @@ import org.bukkit.event.world.StructureGrowEvent;
|
|||||||
import com.intellectualcrafters.plot.C;
|
import com.intellectualcrafters.plot.C;
|
||||||
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.PlotId;
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import com.intellectualcrafters.plot.PlotWorld;
|
import com.intellectualcrafters.plot.PlotWorld;
|
||||||
@ -138,7 +136,7 @@ public class PlayerEvents implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChangeWorld(PlayerChangedWorldEvent event) {
|
public void onChangeWorld(PlayerChangedWorldEvent event) {
|
||||||
if (isPlotWorld(event.getFrom()) && Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) {
|
if (isPlotWorld(event.getFrom()) && (Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1)) {
|
||||||
event.getPlayer().setResourcePack("");
|
event.getPlayer().setResourcePack("");
|
||||||
} else {
|
} else {
|
||||||
textures(event.getPlayer());
|
textures(event.getPlayer());
|
||||||
@ -198,8 +196,7 @@ public class PlayerEvents implements Listener {
|
|||||||
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
// Gotta catch 'em all.
|
// Gotta catch 'em all.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,7 +248,7 @@ public class PlayerEvents implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getPlot(event.getBlock().getLocation())==null) {
|
if (PlayerFunctions.getPlot(event.getBlock().getLocation()) == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,7 +268,7 @@ public class PlayerEvents implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getPlot(event.getBlockPlaced().getLocation())==null) {
|
if (PlayerFunctions.getPlot(event.getBlockPlaced().getLocation()) == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,7 +485,7 @@ public class PlayerEvents implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlayerFunctions.getPlot(event.getClickedBlock().getLocation())==null) {
|
if (PlayerFunctions.getPlot(event.getClickedBlock().getLocation()) == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((plot != null) && plot.hasOwner() && plot.helpers!=null && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
if ((plot != null) && plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
||||||
PWE.setMask(p, l);
|
PWE.setMask(p, l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public class WorldEditListener implements Listener {
|
|||||||
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (idT!=null && !(idF == idT)) {
|
if ((idT != null) && !(idF == idT)) {
|
||||||
PWE.setMask(p, t);
|
PWE.setMask(p, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +130,7 @@ public class WorldEditListener implements Listener {
|
|||||||
if (!isPlotWorld(t)) {
|
if (!isPlotWorld(t)) {
|
||||||
if (isPlotWorld(f)) {
|
if (isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,8 +148,7 @@ public class WorldEditListener implements Listener {
|
|||||||
if (!isPlotWorld(t)) {
|
if (!isPlotWorld(t)) {
|
||||||
if (isPlotWorld(f)) {
|
if (isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package com.intellectualcrafters.plot.listeners;
|
package com.intellectualcrafters.plot.listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotHelper;
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
@ -15,8 +20,6 @@ import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
|||||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||||
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldguard.LocalPlayer;
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|
||||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
@ -24,14 +27,6 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
|
|||||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-09-24.
|
* Created by Citymonstret on 2014-09-24.
|
||||||
*/
|
*/
|
||||||
@ -39,63 +34,60 @@ public class WorldGuardListener implements Listener {
|
|||||||
public ArrayList<String> str_flags = new ArrayList<String>();
|
public ArrayList<String> str_flags = new ArrayList<String>();
|
||||||
public ArrayList<Flag<?>> flags = new ArrayList<Flag<?>>();
|
public ArrayList<Flag<?>> flags = new ArrayList<Flag<?>>();
|
||||||
|
|
||||||
|
|
||||||
public WorldGuardListener(PlotMain plugin) {
|
public WorldGuardListener(PlotMain plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
for (Flag<?> flag:DefaultFlag.getFlags()) {
|
for (Flag<?> flag : DefaultFlag.getFlags()) {
|
||||||
str_flags.add(flag.getName());
|
this.str_flags.add(flag.getName());
|
||||||
flags.add(flag);
|
this.flags.add(flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void removeFlag(Player requester, World world, Plot plot,String key) {
|
|
||||||
|
public void removeFlag(Player requester, World world, Plot plot, String key) {
|
||||||
boolean op = requester.isOp();
|
boolean op = requester.isOp();
|
||||||
requester.setOp(true);
|
requester.setOp(true);
|
||||||
try {
|
try {
|
||||||
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y);
|
manager.getRegion(plot.id.x + "-" + plot.id.y);
|
||||||
for (Flag flag:flags) {
|
for (Flag flag : this.flags) {
|
||||||
if (flag.getName().equalsIgnoreCase(key)) {
|
if (flag.getName().equalsIgnoreCase(key)) {
|
||||||
requester.performCommand("region flag "+(plot.id.x + "-" + plot.id.y)+" "+key);
|
requester.performCommand("region flag " + (plot.id.x + "-" + plot.id.y) + " " + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
requester.setOp(op);
|
requester.setOp(op);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
requester.setOp(op);
|
requester.setOp(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFlag(Player requester, World world, Plot plot,String key, String value) {
|
public void addFlag(Player requester, World world, Plot plot, String key, String value) {
|
||||||
boolean op = requester.isOp();
|
boolean op = requester.isOp();
|
||||||
requester.setOp(true);
|
requester.setOp(true);
|
||||||
try {
|
try {
|
||||||
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
ProtectedRegion region = manager.getRegion(plot.id.x + "-" + plot.id.y);
|
manager.getRegion(plot.id.x + "-" + plot.id.y);
|
||||||
for (Flag flag:flags) {
|
for (Flag flag : this.flags) {
|
||||||
if (flag.getName().equalsIgnoreCase(key)) {
|
if (flag.getName().equalsIgnoreCase(key)) {
|
||||||
requester.performCommand("region flag "+(plot.id.x + "-" + plot.id.y)+" "+key+" "+value);
|
requester.performCommand("region flag " + (plot.id.x + "-" + plot.id.y) + " " + key + " " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
requester.setOp(op);
|
requester.setOp(op);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
requester.setOp(op);
|
requester.setOp(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onMerge(PlotMergeEvent event) {
|
public void onMerge(PlotMergeEvent event) {
|
||||||
Plot main = event.getPlot();
|
Plot main = event.getPlot();
|
||||||
ArrayList<PlotId> plots = event.getPlots();
|
ArrayList<PlotId> plots = event.getPlots();
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
for (PlotId plot:plots) {
|
for (PlotId plot : plots) {
|
||||||
if (!plot.equals(main))
|
if (!plot.equals(main)) {
|
||||||
manager.removeRegion(plot.x + "-" + plot.y);
|
manager.removeRegion(plot.x + "-" + plot.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y);
|
ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y);
|
||||||
DefaultDomain owner = region.getOwners();
|
DefaultDomain owner = region.getOwners();
|
||||||
@ -104,7 +96,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
manager.removeRegion(main.id.x + "-" + main.id.y);
|
manager.removeRegion(main.id.x + "-" + main.id.y);
|
||||||
|
|
||||||
Location location1 = PlotHelper.getPlotBottomLocAbs(world, plots.get(0));
|
Location location1 = PlotHelper.getPlotBottomLocAbs(world, plots.get(0));
|
||||||
Location location2 = PlotHelper.getPlotTopLocAbs(world, plots.get(plots.size()-1));
|
Location location2 = PlotHelper.getPlotTopLocAbs(world, plots.get(plots.size() - 1));
|
||||||
|
|
||||||
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
||||||
BlockVector vector2 = new BlockVector(location2.getBlockX(), world.getMaxHeight(), location2.getBlockZ());
|
BlockVector vector2 = new BlockVector(location2.getBlockX(), world.getMaxHeight(), location2.getBlockZ());
|
||||||
@ -119,8 +111,8 @@ public class WorldGuardListener implements Listener {
|
|||||||
manager.addRegion(rg);
|
manager.addRegion(rg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onUnlink(PlotUnlinkEvent event) {
|
public void onUnlink(PlotUnlinkEvent event) {
|
||||||
World w = event.getWorld();
|
World w = event.getWorld();
|
||||||
ArrayList<PlotId> plots = event.getPlots();
|
ArrayList<PlotId> plots = event.getPlots();
|
||||||
Plot main = PlotMain.getPlots(w).get(plots.get(0));
|
Plot main = PlotMain.getPlots(w).get(plots.get(0));
|
||||||
@ -133,7 +125,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
DefaultDomain members = region.getMembers();
|
DefaultDomain members = region.getMembers();
|
||||||
|
|
||||||
manager.removeRegion(main.id.x + "-" + main.id.y);
|
manager.removeRegion(main.id.x + "-" + main.id.y);
|
||||||
for (int i = 1;i<plots.size();i++) {
|
for (int i = 1; i < plots.size(); i++) {
|
||||||
PlotId id = plots.get(i);
|
PlotId id = plots.get(i);
|
||||||
Location location1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
Location location1 = PlotHelper.getPlotBottomLocAbs(w, id);
|
||||||
Location location2 = PlotHelper.getPlotTopLocAbs(w, id);
|
Location location2 = PlotHelper.getPlotTopLocAbs(w, id);
|
||||||
|
Loading…
Reference in New Issue
Block a user