mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Minor fixes :D
This commit is contained in:
parent
d257ddb90d
commit
07895be660
@ -24,7 +24,10 @@ package com.intellectualcrafters.plot;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-09-23.
|
* Created 2014-09-23 for PlotSquared
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class AbstractFlag {
|
public class AbstractFlag {
|
||||||
|
|
||||||
|
@ -21,15 +21,34 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class for blocks, using
|
||||||
|
* pure data rather than the object.
|
||||||
|
* <p/>
|
||||||
|
* Useful for NMS
|
||||||
|
*
|
||||||
|
* @author Empire92
|
||||||
|
*/
|
||||||
public class BlockWrapper {
|
public class BlockWrapper {
|
||||||
public int x;
|
|
||||||
public int y;
|
|
||||||
public int z;
|
|
||||||
public int id;
|
|
||||||
public byte data;
|
|
||||||
|
|
||||||
public BlockWrapper(final int x, final int y, final int z, final short id, final byte data) {
|
// Public Final //////////////////////////
|
||||||
|
public final int x; //
|
||||||
|
public final int y; //
|
||||||
|
public final int z; //
|
||||||
|
public final int id; //
|
||||||
|
public final byte data; //
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param x X Loc Value
|
||||||
|
* @param y Y Loc Value
|
||||||
|
* @param z Z Loc Value
|
||||||
|
* @param id Material ID
|
||||||
|
* @param data Data Value
|
||||||
|
*/
|
||||||
|
public BlockWrapper(int x, int y, int z, short id, byte data) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
|
@ -26,7 +26,14 @@ import org.bukkit.block.Biome;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main Configuration Utility
|
||||||
|
*
|
||||||
|
* @author Empire92
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
|
|
||||||
public static final SettingValue STRING = new SettingValue("STRING") {
|
public static final SettingValue STRING = new SettingValue("STRING") {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
@ -55,7 +62,7 @@ public class Configuration {
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(string);
|
int x = Integer.parseInt(string);
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
@ -72,7 +79,7 @@ public class Configuration {
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
try {
|
try {
|
||||||
Boolean.parseBoolean(string);
|
boolean b = Boolean.parseBoolean(string);
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
@ -89,7 +96,7 @@ public class Configuration {
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(string);
|
double d = Double.parseDouble(string);
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
@ -125,7 +132,7 @@ public class Configuration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
return ((Biome) object).toString();
|
return (((Biome) object)).toString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,10 +142,12 @@ public class Configuration {
|
|||||||
try {
|
try {
|
||||||
if (string.contains(":")) {
|
if (string.contains(":")) {
|
||||||
final String[] split = string.split(":");
|
final String[] split = string.split(":");
|
||||||
|
short s =
|
||||||
Short.parseShort(split[0]);
|
Short.parseShort(split[0]);
|
||||||
|
short z =
|
||||||
Short.parseShort(split[1]);
|
Short.parseShort(split[1]);
|
||||||
} else {
|
} else {
|
||||||
Short.parseShort(string);
|
short s = Short.parseShort(string);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -161,22 +170,6 @@ public class Configuration {
|
|||||||
return ((PlotBlock) object).id + ":" + ((PlotBlock) object).data;
|
return ((PlotBlock) object).id + ":" + ((PlotBlock) object).data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static int gcd(final int a, final int b) {
|
|
||||||
if (b == 0) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
return gcd(b, a % b);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int gcd(final int[] a) {
|
|
||||||
int result = a[0];
|
|
||||||
for (int i = 1; i < a.length; i++) {
|
|
||||||
result = gcd(result, a[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SettingValue BLOCKLIST = new SettingValue("BLOCKLIST") {
|
public static final SettingValue BLOCKLIST = new SettingValue("BLOCKLIST") {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
@ -184,15 +177,15 @@ public class Configuration {
|
|||||||
for (String block : string.split(",")) {
|
for (String block : string.split(",")) {
|
||||||
if (block.contains("%")) {
|
if (block.contains("%")) {
|
||||||
final String[] split = block.split("%");
|
final String[] split = block.split("%");
|
||||||
Integer.parseInt(split[0]);
|
int i = Integer.parseInt(split[0]);
|
||||||
block = split[1];
|
block = split[1];
|
||||||
}
|
}
|
||||||
if (block.contains(":")) {
|
if (block.contains(":")) {
|
||||||
final String[] split = block.split(":");
|
final String[] split = block.split(":");
|
||||||
Short.parseShort(split[0]);
|
short s = Short.parseShort(split[0]);
|
||||||
Short.parseShort(split[1]);
|
short z = Short.parseShort(split[1]);
|
||||||
} else {
|
} else {
|
||||||
Short.parseShort(block);
|
short s = Short.parseShort(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -204,7 +197,7 @@ public class Configuration {
|
|||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
final String[] blocks = string.split(",");
|
final String[] blocks = string.split(",");
|
||||||
final ArrayList<PlotBlock> parsedvalues = new ArrayList<PlotBlock>();
|
final ArrayList<PlotBlock> parsedvalues = new ArrayList<>();
|
||||||
|
|
||||||
final PlotBlock[] values = new PlotBlock[blocks.length];
|
final PlotBlock[] values = new PlotBlock[blocks.length];
|
||||||
final int[] counts = new int[blocks.length];
|
final int[] counts = new int[blocks.length];
|
||||||
@ -239,12 +232,12 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedvalues.toArray(new PlotBlock[0]);
|
return parsedvalues.toArray(new PlotBlock[parsedvalues.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
final List<String> list = new ArrayList<String>();
|
final List<String> list = new ArrayList<>();
|
||||||
for (final PlotBlock block : (PlotBlock[]) object) {
|
for (final PlotBlock block : (PlotBlock[]) object) {
|
||||||
list.add((block.id + ":" + (block.data)));
|
list.add((block.id + ":" + (block.data)));
|
||||||
}
|
}
|
||||||
@ -252,6 +245,21 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static int gcd(final int a, final int b) {
|
||||||
|
if (b == 0) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return gcd(b, a % b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int gcd(final int[] a) {
|
||||||
|
int result = a[0];
|
||||||
|
for (int i = 1; i < a.length; i++) {
|
||||||
|
result = gcd(result, a[i]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create your own SettingValue object to make the management of plotworld
|
* Create your own SettingValue object to make the management of plotworld
|
||||||
* configuration easier
|
* configuration easier
|
||||||
|
@ -30,10 +30,10 @@ public class ConfigurationNode {
|
|||||||
private final String constant;
|
private final String constant;
|
||||||
private final Object default_value;
|
private final Object default_value;
|
||||||
private final String description;
|
private final String description;
|
||||||
private Object value;
|
|
||||||
private final SettingValue type;
|
private final SettingValue type;
|
||||||
|
private Object value;
|
||||||
|
|
||||||
public ConfigurationNode(final String constant, final Object default_value, final String description, final SettingValue type, final boolean required) {
|
public ConfigurationNode(final String constant, final Object default_value, final String description, final SettingValue type, @SuppressWarnings("unused") final boolean required) {
|
||||||
this.constant = constant;
|
this.constant = constant;
|
||||||
this.default_value = default_value;
|
this.default_value = default_value;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@ -48,10 +48,7 @@ public class ConfigurationNode {
|
|||||||
public boolean isValid(final String string) {
|
public boolean isValid(final String string) {
|
||||||
try {
|
try {
|
||||||
final Object result = this.type.parseString(string);
|
final Object result = this.type.parseString(string);
|
||||||
if (result == null) {
|
return result != null;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -23,40 +23,12 @@ package com.intellectualcrafters.plot;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-09-22.
|
|
||||||
*/
|
|
||||||
public class ConsoleColors {
|
public class ConsoleColors {
|
||||||
|
|
||||||
static enum ConsoleColor {
|
public static String fromString(String input) {
|
||||||
RESET("\u001B[0m"),
|
input = input.replaceAll("&0", fromChatColor(ChatColor.BLACK)).replaceAll("&1", fromChatColor(ChatColor.DARK_BLUE)).replaceAll("&2", fromChatColor(ChatColor.DARK_GREEN)).replaceAll("&3", fromChatColor(ChatColor.DARK_AQUA)).replaceAll("&4", fromChatColor(ChatColor.DARK_RED)).replaceAll("&5", fromChatColor(ChatColor.DARK_PURPLE)).replaceAll("&6", fromChatColor(ChatColor.GOLD)).replaceAll("&7", fromChatColor(ChatColor.GRAY)).replaceAll("&8", fromChatColor(ChatColor.DARK_GRAY)).replaceAll("&9", fromChatColor(ChatColor.BLUE)).replaceAll("&a", fromChatColor(ChatColor.GREEN)).replaceAll("&b", fromChatColor(ChatColor.AQUA)).replaceAll("&c", fromChatColor(ChatColor.RED)).replaceAll("&d", fromChatColor(ChatColor.LIGHT_PURPLE)).replaceAll("&e", fromChatColor(ChatColor.YELLOW)).replaceAll("&f", fromChatColor(ChatColor.WHITE)).replaceAll("&k", fromChatColor(ChatColor.MAGIC)).replaceAll("&l", fromChatColor(ChatColor.BOLD)).replaceAll("&m", fromChatColor(ChatColor.STRIKETHROUGH))
|
||||||
BLACK("\u001B[30m"),
|
.replaceAll("&n", fromChatColor(ChatColor.UNDERLINE)).replaceAll("&o", fromChatColor(ChatColor.ITALIC)).replaceAll("&r", fromChatColor(ChatColor.RESET));
|
||||||
RED("\u001B[31m"),
|
return input + "\u001B[0m";
|
||||||
GREEN("\u001B[32m"),
|
|
||||||
YELLOW("\u001B[33m"),
|
|
||||||
BLUE("\u001B[34m"),
|
|
||||||
PURPLE("\u001B[35m"),
|
|
||||||
CYAN("\u001B[36m"),
|
|
||||||
WHITE("\u001B[37m"),
|
|
||||||
BOLD("\033[1m"),
|
|
||||||
UNDERLINE("\033[0m"),
|
|
||||||
ITALIC("\033[3m");
|
|
||||||
|
|
||||||
private final String win;
|
|
||||||
private final String lin;
|
|
||||||
|
|
||||||
ConsoleColor(final String lin) {
|
|
||||||
this.lin = lin;
|
|
||||||
this.win = this.win;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWin() {
|
|
||||||
return this.win;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLin() {
|
|
||||||
return this.lin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -72,12 +44,6 @@ public class ConsoleColors {
|
|||||||
* = "\033[3m]";
|
* = "\033[3m]";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static String fromString(String input) {
|
|
||||||
input = input.replaceAll("&0", fromChatColor(ChatColor.BLACK)).replaceAll("&1", fromChatColor(ChatColor.DARK_BLUE)).replaceAll("&2", fromChatColor(ChatColor.DARK_GREEN)).replaceAll("&3", fromChatColor(ChatColor.DARK_AQUA)).replaceAll("&4", fromChatColor(ChatColor.DARK_RED)).replaceAll("&5", fromChatColor(ChatColor.DARK_PURPLE)).replaceAll("&6", fromChatColor(ChatColor.GOLD)).replaceAll("&7", fromChatColor(ChatColor.GRAY)).replaceAll("&8", fromChatColor(ChatColor.DARK_GRAY)).replaceAll("&9", fromChatColor(ChatColor.BLUE)).replaceAll("&a", fromChatColor(ChatColor.GREEN)).replaceAll("&b", fromChatColor(ChatColor.AQUA)).replaceAll("&c", fromChatColor(ChatColor.RED)).replaceAll("&d", fromChatColor(ChatColor.LIGHT_PURPLE)).replaceAll("&e", fromChatColor(ChatColor.YELLOW)).replaceAll("&f", fromChatColor(ChatColor.WHITE)).replaceAll("&k", fromChatColor(ChatColor.MAGIC)).replaceAll("&l", fromChatColor(ChatColor.BOLD)).replaceAll("&m", fromChatColor(ChatColor.STRIKETHROUGH))
|
|
||||||
.replaceAll("&n", fromChatColor(ChatColor.UNDERLINE)).replaceAll("&o", fromChatColor(ChatColor.ITALIC)).replaceAll("&r", fromChatColor(ChatColor.RESET));
|
|
||||||
return input + "\u001B[0m";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String fromChatColor(final ChatColor color) {
|
public static String fromChatColor(final ChatColor color) {
|
||||||
return chatColor(color).getLin();
|
return chatColor(color).getLin();
|
||||||
}
|
}
|
||||||
@ -119,4 +85,36 @@ public class ConsoleColors {
|
|||||||
return ConsoleColor.RESET;
|
return ConsoleColor.RESET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum ConsoleColor {
|
||||||
|
RESET("\u001B[0m"),
|
||||||
|
BLACK("\u001B[30m"),
|
||||||
|
RED("\u001B[31m"),
|
||||||
|
GREEN("\u001B[32m"),
|
||||||
|
YELLOW("\u001B[33m"),
|
||||||
|
BLUE("\u001B[34m"),
|
||||||
|
PURPLE("\u001B[35m"),
|
||||||
|
CYAN("\u001B[36m"),
|
||||||
|
WHITE("\u001B[37m"),
|
||||||
|
BOLD("\033[1m"),
|
||||||
|
UNDERLINE("\033[0m"),
|
||||||
|
ITALIC("\033[3m");
|
||||||
|
|
||||||
|
private final String win;
|
||||||
|
private final String lin;
|
||||||
|
|
||||||
|
ConsoleColor(final String lin) {
|
||||||
|
this.lin = lin;
|
||||||
|
this.win = lin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public String getWin() {
|
||||||
|
return this.win;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLin() {
|
||||||
|
return this.lin;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,28 +27,30 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag Manager Utility
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class FlagManager {
|
public class FlagManager {
|
||||||
|
|
||||||
// TODO add some flags
|
// TODO add some flags
|
||||||
// - Plot clear interval
|
// - Plot clear interval
|
||||||
// - Mob cap
|
// - Mob cap
|
||||||
// - customized plot composition
|
// - customized plot composition
|
||||||
// - greeting / leaving message
|
|
||||||
// OR in the flag command, allow users to set worldguard flags.
|
|
||||||
|
|
||||||
private static ArrayList<AbstractFlag> flags = new ArrayList<AbstractFlag>();
|
private static ArrayList<AbstractFlag> flags = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an AbstractFlag with PlotSquared
|
* Register an AbstractFlag with PlotSquared
|
||||||
*
|
*
|
||||||
* @param flag
|
* @param flag Flag to register
|
||||||
* @return
|
* @return success?
|
||||||
*/
|
*/
|
||||||
public static boolean addFlag(final AbstractFlag flag) {
|
public static boolean addFlag(final AbstractFlag flag) {
|
||||||
if (getFlag(flag.getKey()) != null) {
|
return getFlag(flag.getKey()) == null && flags.add(flag);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return flags.add(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Flag[] removeFlag(final Flag[] flags, final String r) {
|
public static Flag[] removeFlag(final Flag[] flags, final String r) {
|
||||||
@ -101,7 +103,7 @@ public class FlagManager {
|
|||||||
/**
|
/**
|
||||||
* Get an AbstractFlag by a string Returns null if flag does not exist
|
* Get an AbstractFlag by a string Returns null if flag does not exist
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string Flag Key
|
||||||
* @return AbstractFlag
|
* @return AbstractFlag
|
||||||
*/
|
*/
|
||||||
public static AbstractFlag getFlag(final String string) {
|
public static AbstractFlag getFlag(final String string) {
|
||||||
@ -116,7 +118,7 @@ public class FlagManager {
|
|||||||
/**
|
/**
|
||||||
* Get an AbstractFlag by a string
|
* Get an AbstractFlag by a string
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string Flag Key
|
||||||
* @param create If to create the flag if it does not exist
|
* @param create If to create the flag if it does not exist
|
||||||
* @return AbstractFlag
|
* @return AbstractFlag
|
||||||
*/
|
*/
|
||||||
@ -132,7 +134,7 @@ public class FlagManager {
|
|||||||
/**
|
/**
|
||||||
* Remove a registered AbstractFlag
|
* Remove a registered AbstractFlag
|
||||||
*
|
*
|
||||||
* @param flag
|
* @param flag Flag Key
|
||||||
* @return boolean Result of operation
|
* @return boolean Result of operation
|
||||||
*/
|
*/
|
||||||
public static boolean removeFlag(final AbstractFlag flag) {
|
public static boolean removeFlag(final AbstractFlag flag) {
|
||||||
@ -155,7 +157,7 @@ public class FlagManager {
|
|||||||
/**
|
/**
|
||||||
* Get the flags for a plot
|
* Get the flags for a plot
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot Plot to search in
|
||||||
* @return List (AbstractFlag)
|
* @return List (AbstractFlag)
|
||||||
*/
|
*/
|
||||||
public static List<AbstractFlag> getPlotFlags(final Plot plot) {
|
public static List<AbstractFlag> getPlotFlags(final Plot plot) {
|
||||||
|
@ -55,8 +55,8 @@ public class PlayerFunctions {
|
|||||||
return (lp - cu) > 30l;
|
return (lp - cu) > 30l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<PlotId> getPlotSelectionIds(final World world, final PlotId pos1, final PlotId pos2) {
|
public static ArrayList<PlotId> getPlotSelectionIds(@SuppressWarnings("unused") final World world, final PlotId pos1, final PlotId pos2) {
|
||||||
final ArrayList<PlotId> myplots = new ArrayList<PlotId>();
|
final ArrayList<PlotId> myplots = new ArrayList<>();
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
myplots.add(new PlotId(x, y));
|
myplots.add(new PlotId(x, y));
|
||||||
@ -78,7 +78,7 @@ public class PlayerFunctions {
|
|||||||
pos2 = getTopPlot(world, plot2).id;
|
pos2 = getTopPlot(world, plot2).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<PlotId> myplots = new ArrayList<PlotId>();
|
final ArrayList<PlotId> myplots = new ArrayList<>();
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
myplots.add(new PlotId(x, y));
|
myplots.add(new PlotId(x, y));
|
||||||
@ -193,7 +193,7 @@ public class PlayerFunctions {
|
|||||||
public static Set<Plot> getPlayerPlots(final World world, final Player plr) {
|
public static Set<Plot> getPlayerPlots(final World world, final Player plr) {
|
||||||
final Set<Plot> p = PlotMain.getPlots(world, plr);
|
final Set<Plot> p = PlotMain.getPlots(world, plr);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
return new HashSet<Plot>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class Plot implements Cloneable {
|
|||||||
this.deny_entry = this.owner == null;
|
this.deny_entry = this.owner == null;
|
||||||
this.helpers = helpers;
|
this.helpers = helpers;
|
||||||
this.denied = denied;
|
this.denied = denied;
|
||||||
this.trusted = new ArrayList<UUID>();
|
this.trusted = new ArrayList<>();
|
||||||
this.settings.setAlias("");
|
this.settings.setAlias("");
|
||||||
this.settings.setPosition(PlotHomePosition.DEFAULT);
|
this.settings.setPosition(PlotHomePosition.DEFAULT);
|
||||||
this.delete = false;
|
this.delete = false;
|
||||||
|
@ -29,8 +29,11 @@ import org.bukkit.block.Block;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-12.
|
* Created 2014-10-12 for PlotSquared
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class PlotSelection {
|
public class PlotSelection {
|
||||||
|
|
||||||
public static HashMap<String, PlotSelection> currentSelection = new HashMap<>();
|
public static HashMap<String, PlotSelection> currentSelection = new HashMap<>();
|
||||||
@ -68,18 +71,6 @@ public class PlotSelection {
|
|||||||
// Yay :D
|
// Yay :D
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotBlock[] getBlocks() {
|
|
||||||
return this.plotBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return this.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean swap(final World world, final PlotId id1, final PlotId id2) {
|
public static boolean swap(final World world, final PlotId id1, final PlotId id2) {
|
||||||
|
|
||||||
final Location bot2 = PlotHelper.getPlotBottomLocAbs(world, id2).add(1, 0, 1);
|
final Location bot2 = PlotHelper.getPlotBottomLocAbs(world, id2).add(1, 0, 1);
|
||||||
@ -133,6 +124,18 @@ public class PlotSelection {
|
|||||||
return new BlockWrapper(block.getX(), block.getY(), block.getZ(), (short) block.getTypeId(), block.getData());
|
return new BlockWrapper(block.getX(), block.getY(), block.getZ(), (short) block.getTypeId(), block.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlotBlock[] getBlocks() {
|
||||||
|
return this.plotBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return this.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plot getPlot() {
|
||||||
|
return this.plot;
|
||||||
|
}
|
||||||
|
|
||||||
public void paste(final World world, final Plot plot) {
|
public void paste(final World world, final Plot plot) {
|
||||||
|
|
||||||
final Location bot = PlotHelper.getPlotBottomLocAbs(world, plot.getId()), top = PlotHelper.getPlotTopLocAbs(world, plot.getId());
|
final Location bot = PlotHelper.getPlotBottomLocAbs(world, plot.getId()), top = PlotHelper.getPlotTopLocAbs(world, plot.getId());
|
||||||
|
Loading…
Reference in New Issue
Block a user