Time for our weekly code cleanup!

Please tell me if doing this annoys you.
This commit is contained in:
boy0001 2014-10-03 12:36:30 +10:00
parent 58ed037fad
commit 980499a193
55 changed files with 1366 additions and 1186 deletions

View File

@ -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() {

View File

@ -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
*/ */

View File

@ -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() {

View File

@ -17,6 +17,7 @@ public class FlagManager {
/** /**
* 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
*/ */
@ -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)
*/ */

View File

@ -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;
@ -32,7 +34,7 @@ public class PWE {
Plot plot = PlotMain.getPlots(l.getWorld()).get(id); Plot plot = PlotMain.getPlots(l.getWorld()).get(id);
if (plot != null) { if (plot != null) {
boolean r; boolean r;
r = plot.getOwner() != null && plot.getOwner().equals(p.getUniqueId()); r = (plot.getOwner() != null) && plot.getOwner().equals(p.getUniqueId());
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,7 +64,6 @@ 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);
@ -78,8 +78,7 @@ public class PWE {
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);

View File

@ -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;
@ -77,6 +76,7 @@ public class PlayerFunctions {
} }
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)));
@ -86,6 +86,7 @@ public class PlayerFunctions {
} }
return plot; return plot;
} }
/** /**
* *
* @param loc * @param loc
@ -101,8 +102,7 @@ public class PlayerFunctions {
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);
} }
@ -122,8 +122,8 @@ public class PlayerFunctions {
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;
@ -144,8 +144,7 @@ public class PlayerFunctions {
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);
} }
@ -166,8 +165,8 @@ public class PlayerFunctions {
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
@ -182,7 +181,8 @@ 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) {

View File

@ -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)
* *

View File

@ -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,6 +48,7 @@ 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
@ -58,12 +69,14 @@ public class PlotHelper {
/** /**
* 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
* arguments)</b><br>
* - Misuse of this method can result in unusable plots<br> * - Misuse of this method can result in unusable plots<br>
* - the set of plots must belong to one owner and be rectangular<br> * - the set of plots must belong to one owner and be rectangular<br>
* - the plot array must be sorted in ascending order<br> * - the plot array must be sorted in ascending order<br>
* - Road will be removed where required<br> * - Road will be removed where required<br>
* - changes will be saved to DB<br> * - changes will be saved to DB<br>
*
* @param world * @param world
* @param plotIds * @param plotIds
* @return boolean (success) * @return boolean (success)
@ -112,9 +125,9 @@ public class PlotHelper {
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);
@ -150,7 +163,7 @@ public class PlotHelper {
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,12 +173,12 @@ 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
@ -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);
@ -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;
} }
} }
@ -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,15 +755,16 @@ 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();
} }
} }
@ -765,6 +779,7 @@ public class PlotHelper {
/** /**
* Clear a plot * Clear a plot
*
* @param requester * @param requester
* @param plot * @param plot
*/ */
@ -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) {
} }
} }

View File

@ -12,6 +12,7 @@ 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

View File

@ -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
@ -148,6 +244,7 @@ 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
@ -160,11 +257,10 @@ public class PlotMain extends JavaPlugin {
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;
@ -172,9 +268,10 @@ public class PlotMain extends JavaPlugin {
} }
} }
} }
if (!hasperm) if (!hasperm) {
return false; return false;
} }
}
return true; return true;
} }
@ -183,6 +280,7 @@ 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,7 +294,7 @@ 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,7 +495,9 @@ public class PlotMain extends JavaPlugin {
continue; continue;
} }
long lastPlayed = getLastPlayed(plot.owner); long lastPlayed = getLastPlayed(plot.owner);
if(lastPlayed == 0) continue; if (lastPlayed == 0) {
continue;
}
int days = (int) (lastPlayed / (1000 * 60 * 60 * 24)); 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);
@ -502,8 +603,7 @@ public class PlotMain extends JavaPlugin {
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,12 +679,13 @@ 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();
@ -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
*/ */
@ -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) {

View File

@ -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
* *
@ -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

View File

@ -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;
} }

View File

@ -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 {

View File

@ -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";

View File

@ -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;

View File

@ -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);
} }
} }

View File

@ -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;

View File

@ -7,20 +7,24 @@
* >> 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);
} }
} }
@ -118,6 +119,7 @@ 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++) {

View File

@ -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

View 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;
} }

View File

@ -17,15 +17,18 @@ 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
// size)
// - /plot copy // - /plot copy
// - /plot paste // - /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
// ratings)
// - /plot rate <number out of 10> // - /plot rate <number out of 10>
// - /plot list <some parameter to list the most popular, and highest rated plots> // - /plot list <some parameter to list the most popular, and highest rated
// plots>
TRUSTED("trusted", "trust"), TRUSTED("trusted", "trust"),
/** /**
* *

View 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 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;
} }

View File

@ -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,7 +86,8 @@ 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",
// PlotHelper.getWorldFolderSize() + "MB"));
for (String world : PlotMain.getPlotWorlds()) { 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))));
} }

View File

@ -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;
} }

View File

@ -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)) {

View File

@ -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;
/** /**
* *
@ -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();

View File

@ -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,7 +32,7 @@ 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;
} }
@ -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;
} }

View File

@ -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;
/** /**
* *
@ -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;
} }
@ -109,7 +118,7 @@ public class Merge extends SubCommand {
} }
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;
} }

View File

@ -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() {
@ -49,7 +51,7 @@ public class Rate extends SubCommand {
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;
} }

View File

@ -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,9 +21,18 @@ 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;
/** /**
* *
@ -79,15 +87,16 @@ public class Set extends SubCommand{
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;
} }
@ -116,8 +125,9 @@ public class Set extends SubCommand{
} }
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);
@ -125,7 +135,7 @@ public class Set extends SubCommand{
} }
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;
} }
@ -141,8 +151,7 @@ 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;
} }
@ -162,8 +171,11 @@ public class Set extends SubCommand{
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;
@ -176,7 +188,9 @@ public class Set extends SubCommand{
} }
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);
@ -238,14 +252,14 @@ public class Set extends SubCommand{
return true; return true;
} }
Material material = null; Material material = null;
for(Material m : plotworld.BLOCKS) { for (Material m : PlotWorld.BLOCKS) {
if (m.toString().equalsIgnoreCase(args[1])) { if (m.toString().equalsIgnoreCase(args[1])) {
material = m; material = m;
break; break;
} }
} }
if (material == null) { if (material == null) {
PlayerFunctions.sendMessage(plr, getBlockList(plotworld.BLOCKS)); PlayerFunctions.sendMessage(plr, getBlockList(PlotWorld.BLOCKS));
return true; return true;
} }
byte data = 0; byte data = 0;
@ -274,7 +288,7 @@ public class Set extends SubCommand{
} }
// //
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ArrayList<Material> materials = (ArrayList<Material>) plotworld.BLOCKS.clone(); ArrayList<Material> materials = (ArrayList<Material>) PlotWorld.BLOCKS.clone();
materials.add(Material.AIR); materials.add(Material.AIR);
// //
String[] strings = args[1].split(","); String[] strings = args[1].split(",");
@ -329,14 +343,14 @@ public class Set extends SubCommand{
return true; return true;
} }
Material material = null; Material material = null;
for(Material m : plotworld.BLOCKS) { for (Material m : PlotWorld.BLOCKS) {
if (m.toString().equalsIgnoreCase(args[1])) { if (m.toString().equalsIgnoreCase(args[1])) {
material = m; material = m;
break; break;
} }
} }
if (material == null) { if (material == null) {
PlayerFunctions.sendMessage(plr, getBlockList(plotworld.BLOCKS)); PlayerFunctions.sendMessage(plr, getBlockList(PlotWorld.BLOCKS));
return true; return true;
} }
byte data = 0; byte data = 0;
@ -397,5 +411,4 @@ public class Set extends SubCommand{
return builder.toString().substring(1, builder.toString().length() - 1); return builder.toString().substring(1, builder.toString().length() - 1);
} }
} }

View File

@ -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() {
@ -80,32 +46,33 @@ public class Setup extends SubCommand implements Listener {
} }
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,8 +100,7 @@ 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;
@ -145,8 +111,7 @@ public class Setup extends SubCommand implements Listener {
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;
} }
@ -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;
} }
@ -245,7 +190,8 @@ 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
// WorldGenerator(world)).createWorld();
// plr.teleport(newWorld.getSpawnLocation()); // plr.teleport(newWorld.getSpawnLocation());
setupMap.remove(plr.getName()); setupMap.remove(plr.getName());
@ -268,8 +214,7 @@ public class Setup extends SubCommand implements Listener {
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;
} }

View File

@ -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

View File

@ -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,7 +69,7 @@ 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];

View File

@ -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;
} }
@ -79,10 +78,12 @@ public class Unlink extends SubCommand {
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,8 +109,7 @@ 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;
@ -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
*/ */
@ -153,22 +154,24 @@ public class Unlink extends SubCommand {
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
*/ */
@ -178,22 +181,24 @@ public class Unlink extends SubCommand {
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
*/ */
@ -201,12 +206,12 @@ public class Unlink extends SubCommand {
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 });
} }
} }

View File

@ -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() {

View File

@ -104,7 +104,7 @@ public class DBFunc {
// 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("(?)");
@ -138,8 +138,8 @@ public class DBFunc {
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++;
} }
@ -163,7 +163,7 @@ public class DBFunc {
} }
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("(?, ?, ?, ?)");
@ -173,10 +173,10 @@ public class DBFunc {
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();

View File

@ -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");
@ -45,7 +45,8 @@ public class PlotMeConverter {
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())) {
@ -94,13 +97,12 @@ 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;
@ -120,34 +122,28 @@ public class PlotMeConverter {
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;
@ -158,7 +154,8 @@ public class PlotMeConverter {
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);
} }

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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.
} }
} }

View File

@ -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;
} }
} }

View File

@ -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,30 +34,28 @@ 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);
} }
} }
@ -72,17 +65,15 @@ public class WorldGuardListener implements Listener {
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);
} }
} }
@ -94,9 +85,10 @@ public class WorldGuardListener implements Listener {
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();
Map<Flag<?>, Object> flags = region.getFlags(); Map<Flag<?>, Object> flags = region.getFlags();