entries;
/**
* Create a new instance.
*
- * @param type
- * of tag contained in this list
+ * @param type of tag contained in this list
*/
ListTagBuilder(final Class extends Tag> type) {
checkNotNull(type);
@@ -30,8 +50,7 @@ public class ListTagBuilder {
/**
* Add the given tag.
*
- * @param value
- * the tag
+ * @param value the tag
* @return this object
*/
public ListTagBuilder add(final Tag value) {
@@ -46,8 +65,7 @@ public class ListTagBuilder {
/**
* Add all the tags in the given list.
*
- * @param value
- * a list of tags
+ * @param value a list of tags
* @return this object
*/
public ListTagBuilder addAll(final Collection extends Tag> value) {
@@ -70,8 +88,7 @@ public class ListTagBuilder {
/**
* Build a new list tag with this builder's entries.
*
- * @param name
- * the name of the tag
+ * @param name the name of the tag
* @return the created list tag
*/
public ListTag build(final String name) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/LongTag.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/LongTag.java
index bf48de965..35020c31d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/LongTag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/LongTag.java
@@ -1,8 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
/**
* The {@code TAG_Long} tag.
- *
*/
public final class LongTag extends Tag {
@@ -11,8 +31,7 @@ public final class LongTag extends Tag {
/**
* Creates the tag with an empty name.
*
- * @param value
- * the value of the tag
+ * @param value the value of the tag
*/
public LongTag(final long value) {
super();
@@ -22,10 +41,8 @@ public final class LongTag extends Tag {
/**
* Creates the tag.
*
- * @param name
- * the name of the tag
- * @param value
- * the value of the tag
+ * @param name the name of the tag
+ * @param value the value of the tag
*/
public LongTag(final String name, final long value) {
super(name);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTConstants.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTConstants.java
index ab2e6d557..caca83753 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTConstants.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTConstants.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import java.nio.charset.Charset;
@@ -9,7 +30,7 @@ public final class NBTConstants {
public static final Charset CHARSET = Charset.forName("UTF-8");
- public static final int TYPE_END = 0, TYPE_BYTE = 1, TYPE_SHORT = 2, TYPE_INT = 3, TYPE_LONG = 4, TYPE_FLOAT = 5, TYPE_DOUBLE = 6, TYPE_BYTE_ARRAY = 7, TYPE_STRING = 8, TYPE_LIST = 9, TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11;
+ public static final int TYPE_END = 0, TYPE_BYTE = 1, TYPE_SHORT = 2, TYPE_INT = 3, TYPE_LONG = 4, TYPE_FLOAT = 5, TYPE_DOUBLE = 6, TYPE_BYTE_ARRAY = 7, TYPE_STRING = 8, TYPE_LIST = 9, TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11;
/**
* Default private constructor.
@@ -21,11 +42,9 @@ public final class NBTConstants {
/**
* Convert a type ID to its corresponding {@link Tag} class.
*
- * @param id
- * type ID
+ * @param id type ID
* @return tag class
- * @throws IllegalArgumentException
- * thrown if the tag ID is not valid
+ * @throws IllegalArgumentException thrown if the tag ID is not valid
*/
public static Class extends Tag> getClassFromType(final int id) {
switch (id) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTInputStream.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTInputStream.java
index a6fe45b6c..23f029bb6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTInputStream.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTInputStream.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import java.io.Closeable;
@@ -13,7 +34,7 @@ import java.util.Map;
* This class reads NBT , or Named Binary Tag
* streams, and produces an object graph of subclasses of the {@code Tag}
* object.
- *
+ *
*
* The NBT format was created by Markus Persson, and the specification may be
* found at
@@ -28,10 +49,8 @@ public final class NBTInputStream implements Closeable {
* Creates a new {@code NBTInputStream}, which will source its data
* from the specified input stream.
*
- * @param is
- * the input stream
- * @throws IOException
- * if an I/O error occurs
+ * @param is the input stream
+ * @throws IOException if an I/O error occurs
*/
public NBTInputStream(final InputStream is) throws IOException {
this.is = new DataInputStream(is);
@@ -41,8 +60,7 @@ public final class NBTInputStream implements Closeable {
* Reads an NBT tag from the stream.
*
* @return The tag that was read.
- * @throws IOException
- * if an I/O error occurs.
+ * @throws IOException if an I/O error occurs.
*/
public Tag readTag() throws IOException {
return readTag(0);
@@ -51,11 +69,9 @@ public final class NBTInputStream implements Closeable {
/**
* Reads an NBT from the stream.
*
- * @param depth
- * the depth of this tag
+ * @param depth the depth of this tag
* @return The tag that was read.
- * @throws IOException
- * if an I/O error occurs.
+ * @throws IOException if an I/O error occurs.
*/
private Tag readTag(final int depth) throws IOException {
final int type = this.is.readByte() & 0xFF;
@@ -66,8 +82,7 @@ public final class NBTInputStream implements Closeable {
final byte[] nameBytes = new byte[nameLength];
this.is.readFully(nameBytes);
name = new String(nameBytes, NBTConstants.CHARSET);
- }
- else {
+ } else {
name = "";
}
@@ -77,23 +92,18 @@ public final class NBTInputStream implements Closeable {
/**
* Reads the payload of a tag, given the name and type.
*
- * @param type
- * the type
- * @param name
- * the name
- * @param depth
- * the depth
+ * @param type the type
+ * @param name the name
+ * @param depth the depth
* @return the tag
- * @throws IOException
- * if an I/O error occurs.
+ * @throws IOException if an I/O error occurs.
*/
private Tag readTagPayload(final int type, final String name, final int depth) throws IOException {
switch (type) {
case NBTConstants.TYPE_END:
if (depth == 0) {
throw new IOException("TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
- }
- else {
+ } else {
return new EndTag();
}
case NBTConstants.TYPE_BYTE:
@@ -138,8 +148,7 @@ public final class NBTInputStream implements Closeable {
final Tag tag = readTag(depth + 1);
if (tag instanceof EndTag) {
break;
- }
- else {
+ } else {
tagMap.put(tag.getName(), tag);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java
index acfe18a1c..670dfbb2f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import java.io.Closeable;
@@ -11,7 +32,7 @@ import java.util.List;
* This class writes NBT , or Named Binary Tag
* Tag
objects to an underlying OutputStream
.
*
- *
+ *
*
* The NBT format was created by Markus Persson, and the specification may be
* found at
@@ -19,7 +40,6 @@ import java.util.List;
*
*
* @author Graham Edgecombe
- *
*/
public final class NBTOutputStream implements Closeable {
@@ -32,10 +52,8 @@ public final class NBTOutputStream implements Closeable {
* Creates a new NBTOutputStream
, which will write data to the
* specified underlying output stream.
*
- * @param os
- * The output stream.
- * @throws IOException
- * if an I/O error occurs.
+ * @param os The output stream.
+ * @throws IOException if an I/O error occurs.
*/
public NBTOutputStream(final OutputStream os) throws IOException {
this.os = new DataOutputStream(os);
@@ -44,10 +62,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a tag.
*
- * @param tag
- * The tag to write.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag to write.
+ * @throws IOException if an I/O error occurs.
*/
public void writeTag(final Tag tag) throws IOException {
final int type = NBTUtils.getTypeCode(tag.getClass());
@@ -68,10 +84,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes tag payload.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeTagPayload(final Tag tag) throws IOException {
final int type = NBTUtils.getTypeCode(tag.getClass());
@@ -120,10 +134,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Byte
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeByteTagPayload(final ByteTag tag) throws IOException {
this.os.writeByte(tag.getValue());
@@ -132,10 +144,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Byte_Array
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeByteArrayTagPayload(final ByteArrayTag tag) throws IOException {
final byte[] bytes = tag.getValue();
@@ -146,10 +156,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Compound
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeCompoundTagPayload(final CompoundTag tag) throws IOException {
for (final Tag childTag : tag.getValue().values()) {
@@ -161,10 +169,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_List
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeListTagPayload(final ListTag tag) throws IOException {
final Class extends Tag> clazz = tag.getType();
@@ -181,10 +187,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_String
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeStringTagPayload(final StringTag tag) throws IOException {
final byte[] bytes = tag.getValue().getBytes(NBTConstants.CHARSET);
@@ -195,10 +199,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Double
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeDoubleTagPayload(final DoubleTag tag) throws IOException {
this.os.writeDouble(tag.getValue());
@@ -207,10 +209,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Float
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeFloatTagPayload(final FloatTag tag) throws IOException {
this.os.writeFloat(tag.getValue());
@@ -219,10 +219,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Long
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeLongTagPayload(final LongTag tag) throws IOException {
this.os.writeLong(tag.getValue());
@@ -231,10 +229,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Int
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeIntTagPayload(final IntTag tag) throws IOException {
this.os.writeInt(tag.getValue());
@@ -243,10 +239,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Short
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeShortTagPayload(final ShortTag tag) throws IOException {
this.os.writeShort(tag.getValue());
@@ -255,10 +249,8 @@ public final class NBTOutputStream implements Closeable {
/**
* Writes a TAG_Empty
tag.
*
- * @param tag
- * The tag.
- * @throws IOException
- * if an I/O error occurs.
+ * @param tag The tag.
+ * @throws IOException if an I/O error occurs.
*/
private void writeEndTagPayload(final EndTag tag) {
/* empty */
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTUtils.java
index 06dd71b4f..e35aa5fd7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/NBTUtils.java
@@ -1,10 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import java.util.Map;
/**
* A class which contains NBT-related utility methods.
- *
*/
public final class NBTUtils {
@@ -17,48 +37,35 @@ public final class NBTUtils {
/**
* Gets the type name of a tag.
*
- * @param clazz
- * the tag class
+ * @param clazz the tag class
* @return The type name.
*/
public static String getTypeName(final Class extends Tag> clazz) {
if (clazz.equals(ByteArrayTag.class)) {
return "TAG_Byte_Array";
- }
- else if (clazz.equals(ByteTag.class)) {
+ } else if (clazz.equals(ByteTag.class)) {
return "TAG_Byte";
- }
- else if (clazz.equals(CompoundTag.class)) {
+ } else if (clazz.equals(CompoundTag.class)) {
return "TAG_Compound";
- }
- else if (clazz.equals(DoubleTag.class)) {
+ } else if (clazz.equals(DoubleTag.class)) {
return "TAG_Double";
- }
- else if (clazz.equals(EndTag.class)) {
+ } else if (clazz.equals(EndTag.class)) {
return "TAG_End";
- }
- else if (clazz.equals(FloatTag.class)) {
+ } else if (clazz.equals(FloatTag.class)) {
return "TAG_Float";
- }
- else if (clazz.equals(IntTag.class)) {
+ } else if (clazz.equals(IntTag.class)) {
return "TAG_Int";
- }
- else if (clazz.equals(ListTag.class)) {
+ } else if (clazz.equals(ListTag.class)) {
return "TAG_List";
- }
- else if (clazz.equals(LongTag.class)) {
+ } else if (clazz.equals(LongTag.class)) {
return "TAG_Long";
- }
- else if (clazz.equals(ShortTag.class)) {
+ } else if (clazz.equals(ShortTag.class)) {
return "TAG_Short";
- }
- else if (clazz.equals(StringTag.class)) {
+ } else if (clazz.equals(StringTag.class)) {
return "TAG_String";
- }
- else if (clazz.equals(IntArrayTag.class)) {
+ } else if (clazz.equals(IntArrayTag.class)) {
return "TAG_Int_Array";
- }
- else {
+ } else {
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
}
}
@@ -66,50 +73,36 @@ public final class NBTUtils {
/**
* Gets the type code of a tag class.
*
- * @param clazz
- * the tag class
+ * @param clazz the tag class
* @return The type code.
- * @throws IllegalArgumentException
- * if the tag class is invalid.
+ * @throws IllegalArgumentException if the tag class is invalid.
*/
public static int getTypeCode(final Class extends Tag> clazz) {
if (clazz.equals(ByteArrayTag.class)) {
return NBTConstants.TYPE_BYTE_ARRAY;
- }
- else if (clazz.equals(ByteTag.class)) {
+ } else if (clazz.equals(ByteTag.class)) {
return NBTConstants.TYPE_BYTE;
- }
- else if (clazz.equals(CompoundTag.class)) {
+ } else if (clazz.equals(CompoundTag.class)) {
return NBTConstants.TYPE_COMPOUND;
- }
- else if (clazz.equals(DoubleTag.class)) {
+ } else if (clazz.equals(DoubleTag.class)) {
return NBTConstants.TYPE_DOUBLE;
- }
- else if (clazz.equals(EndTag.class)) {
+ } else if (clazz.equals(EndTag.class)) {
return NBTConstants.TYPE_END;
- }
- else if (clazz.equals(FloatTag.class)) {
+ } else if (clazz.equals(FloatTag.class)) {
return NBTConstants.TYPE_FLOAT;
- }
- else if (clazz.equals(IntTag.class)) {
+ } else if (clazz.equals(IntTag.class)) {
return NBTConstants.TYPE_INT;
- }
- else if (clazz.equals(ListTag.class)) {
+ } else if (clazz.equals(ListTag.class)) {
return NBTConstants.TYPE_LIST;
- }
- else if (clazz.equals(LongTag.class)) {
+ } else if (clazz.equals(LongTag.class)) {
return NBTConstants.TYPE_LONG;
- }
- else if (clazz.equals(ShortTag.class)) {
+ } else if (clazz.equals(ShortTag.class)) {
return NBTConstants.TYPE_SHORT;
- }
- else if (clazz.equals(StringTag.class)) {
+ } else if (clazz.equals(StringTag.class)) {
return NBTConstants.TYPE_STRING;
- }
- else if (clazz.equals(IntArrayTag.class)) {
+ } else if (clazz.equals(IntArrayTag.class)) {
return NBTConstants.TYPE_INT_ARRAY;
- }
- else {
+ } else {
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
}
}
@@ -117,11 +110,9 @@ public final class NBTUtils {
/**
* Gets the class of a type of tag.
*
- * @param type
- * the type
+ * @param type the type
* @return The class.
- * @throws IllegalArgumentException
- * if the tag type is invalid.
+ * @throws IllegalArgumentException if the tag type is invalid.
*/
public static Class extends Tag> getTypeClass(final int type) {
switch (type) {
@@ -157,12 +148,9 @@ public final class NBTUtils {
/**
* Get child tag of a NBT structure.
*
- * @param items
- * the map to read from
- * @param key
- * the key to look for
- * @param expected
- * the expected NBT class type
+ * @param items the map to read from
+ * @param key the key to look for
+ * @param expected the expected NBT class type
* @return child tag
* @throws InvalidFormatException
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/ShortTag.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/ShortTag.java
index 1c4e48c29..b4fb7e2a8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/ShortTag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/ShortTag.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
/**
@@ -10,8 +31,7 @@ public final class ShortTag extends Tag {
/**
* Creates the tag with an empty name.
*
- * @param value
- * the value of the tag
+ * @param value the value of the tag
*/
public ShortTag(final short value) {
super();
@@ -21,10 +41,8 @@ public final class ShortTag extends Tag {
/**
* Creates the tag.
*
- * @param name
- * the name of the tag
- * @param value
- * the value of the tag
+ * @param name the name of the tag
+ * @param value the value of the tag
*/
public ShortTag(final String name, final short value) {
super(name);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/StringTag.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/StringTag.java
index 05069471a..9aa8b9d5e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/StringTag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/StringTag.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -12,8 +33,7 @@ public final class StringTag extends Tag {
/**
* Creates the tag with an empty name.
*
- * @param value
- * the value of the tag
+ * @param value the value of the tag
*/
public StringTag(final String value) {
super();
@@ -24,10 +44,8 @@ public final class StringTag extends Tag {
/**
* Creates the tag.
*
- * @param name
- * the name of the tag
- * @param value
- * the value of the tag
+ * @param name the name of the tag
+ * @param value the value of the tag
*/
public StringTag(final String name, final String value) {
super(name);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/Tag.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/Tag.java
index 26ad12c8b..aa060c18e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/Tag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/Tag.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
/**
@@ -17,8 +38,7 @@ public abstract class Tag {
/**
* Creates the tag with the specified name.
*
- * @param name
- * the name
+ * @param name the name
*/
Tag(String name) {
if (name == null) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/WorldEditUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/WorldEditUtils.java
index 6c393fad5..9b80a5ae9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/WorldEditUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/jnbt/WorldEditUtils.java
@@ -1,14 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.jnbt;
import org.bukkit.World;
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.worldedit.LocalWorld;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.WorldEditException;
-import com.sk89q.worldedit.blocks.BaseBlock;
-import com.sk89q.worldedit.bukkit.BukkitUtil;
-
public class WorldEditUtils {
public static void setNBT(final World world, final short id, final byte data, final int x, final int y, final int z, final com.intellectualcrafters.jnbt.CompoundTag tag) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/CDL.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/CDL.java
index 225df4ad1..421ce851f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/CDL.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/CDL.java
@@ -1,42 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* This provides static methods to convert comma delimited text into a
* JSONArray, and to covert a JSONArray into comma delimited text. Comma
* delimited text is a very popular format for data interchange. It is
* understood by most database, spreadsheet, and organizer programs.
- *
+ *
* Each row of text represents a row in a table or a data record. Each row ends
* with a NEWLINE character. Each row contains one or more values. Values are
* separated by commas. A value can contain any character except for comma,
* unless is is wrapped in single quotes or double quotes.
- *
+ *
* The first row usually contains the names of the columns.
- *
+ *
* A comma delimited list can be converted into a JSONArray of JSONObjects. The
* names for the elements in the JSONObjects can be taken from the names in the
* first row.
@@ -50,11 +47,9 @@ public class CDL {
* Get the next value. The value can be wrapped in quotes. The value can
* be empty.
*
- * @param x
- * A JSONTokener of the source text.
+ * @param x A JSONTokener of the source text.
* @return The value string, or null if empty.
- * @throws JSONException
- * if the quoted string is badly formed.
+ * @throws JSONException if the quoted string is badly formed.
*/
private static String getValue(final JSONTokener x) throws JSONException {
char c;
@@ -71,7 +66,7 @@ public class CDL {
case '\'':
q = c;
sb = new StringBuffer();
- for (;;) {
+ for (; ; ) {
c = x.next();
if (c == q) {
break;
@@ -94,21 +89,20 @@ public class CDL {
/**
* Produce a JSONArray of strings from a row of comma delimited values.
*
- * @param x
- * A JSONTokener of the source text.
+ * @param x A JSONTokener of the source text.
* @return A JSONArray of strings.
* @throws JSONException
*/
public static JSONArray rowToJSONArray(final JSONTokener x) throws JSONException {
final JSONArray ja = new JSONArray();
- for (;;) {
+ for (; ; ) {
final String value = getValue(x);
char c = x.next();
if ((value == null) || ((ja.length() == 0) && (value.length() == 0) && (c != ','))) {
return null;
}
ja.put(value);
- for (;;) {
+ for (; ; ) {
if (c == ',') {
break;
}
@@ -127,13 +121,11 @@ public class CDL {
* Produce a JSONObject from a row of comma delimited text, using a
* parallel JSONArray of strings to provides the names of the elements.
*
- * @param names
- * A JSONArray of names. This is commonly obtained from the
- * first row of a comma delimited text file using the
- * rowToJSONArray
- * method.
- * @param x
- * A JSONTokener of the source text.
+ * @param names A JSONArray of names. This is commonly obtained from the
+ * first row of a comma delimited text file using the
+ * rowToJSONArray
+ * method.
+ * @param x A JSONTokener of the source text.
* @return A JSONObject combining the names and values.
* @throws JSONException
*/
@@ -147,8 +139,7 @@ public class CDL {
* the comma character will be quoted. Troublesome characters may be
* removed.
*
- * @param ja
- * A JSONArray of strings.
+ * @param ja A JSONArray of strings.
* @return A string ending in NEWLINE.
*/
public static String rowToString(final JSONArray ja) {
@@ -170,8 +161,7 @@ public class CDL {
}
}
sb.append('"');
- }
- else {
+ } else {
sb.append(string);
}
}
@@ -184,8 +174,7 @@ public class CDL {
* Produce a JSONArray of JSONObjects from a comma delimited text string,
* using the first row as a source of names.
*
- * @param string
- * The comma delimited text.
+ * @param string The comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
*/
@@ -197,8 +186,7 @@ public class CDL {
* Produce a JSONArray of JSONObjects from a comma delimited text string,
* using the first row as a source of names.
*
- * @param x
- * The JSONTokener containing the comma delimited text.
+ * @param x The JSONTokener containing the comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
*/
@@ -210,10 +198,8 @@ public class CDL {
* Produce a JSONArray of JSONObjects from a comma delimited text string
* using a supplied JSONArray as the source of element names.
*
- * @param names
- * A JSONArray of strings.
- * @param string
- * The comma delimited text.
+ * @param names A JSONArray of strings.
+ * @param string The comma delimited text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
*/
@@ -225,10 +211,8 @@ public class CDL {
* Produce a JSONArray of JSONObjects from a comma delimited text string
* using a supplied JSONArray as the source of element names.
*
- * @param names
- * A JSONArray of strings.
- * @param x
- * A JSONTokener of the source text.
+ * @param names A JSONArray of strings.
+ * @param x A JSONTokener of the source text.
* @return A JSONArray of JSONObjects.
* @throws JSONException
*/
@@ -237,7 +221,7 @@ public class CDL {
return null;
}
final JSONArray ja = new JSONArray();
- for (;;) {
+ for (; ; ) {
final JSONObject jo = rowToJSONObject(names, x);
if (jo == null) {
break;
@@ -255,8 +239,7 @@ public class CDL {
* first row will be a list of names obtained by inspecting the first
* JSONObject.
*
- * @param ja
- * A JSONArray of JSONObjects.
+ * @param ja A JSONArray of JSONObjects.
* @return A comma delimited text.
* @throws JSONException
*/
@@ -276,10 +259,8 @@ public class CDL {
* a provided list of names. The list of names is not included in the
* output.
*
- * @param names
- * A JSONArray of strings.
- * @param ja
- * A JSONArray of JSONObjects.
+ * @param names A JSONArray of strings.
+ * @param ja A JSONArray of JSONObjects.
* @return A comma delimited text.
* @throws JSONException
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/Cookie.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/Cookie.java
index 180997462..efadf91cd 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/Cookie.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/Cookie.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* Convert a web browser cookie specification to a JSONObject and back.
* JSON and Cookies are both notations for name/value pairs.
@@ -43,8 +40,7 @@ public class Cookie {
* encoded values. We encode '=' and ';' because we must. We encode '%' and
* '+' because they are meta characters in URL encoding.
*
- * @param string
- * The source string.
+ * @param string The source string.
* @return The escaped result.
*/
public static String escape(final String string) {
@@ -58,8 +54,7 @@ public class Cookie {
sb.append('%');
sb.append(Character.forDigit((char) ((c >>> 4) & 0x0f), 16));
sb.append(Character.forDigit((char) (c & 0x0f), 16));
- }
- else {
+ } else {
sb.append(c);
}
}
@@ -77,10 +72,9 @@ public class Cookie {
* validation of the parameters. It only converts the cookie string into
* a JSONObject.
*
- * @param string
- * The cookie specification string.
+ * @param string The cookie specification string.
* @return A JSONObject containing "name", "value", and possibly other
- * members.
+ * members.
* @throws JSONException
*/
public static JSONObject toJSONObject(final String string) throws JSONException {
@@ -97,12 +91,10 @@ public class Cookie {
if (x.next() != '=') {
if (name.equals("secure")) {
value = Boolean.TRUE;
- }
- else {
+ } else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
- }
- else {
+ } else {
value = unescape(x.nextTo(';'));
x.next();
}
@@ -118,8 +110,7 @@ public class Cookie {
* members, they will be appended to the cookie specification string.
* All other members are ignored.
*
- * @param jo
- * A JSONObject
+ * @param jo A JSONObject
* @return A cookie specification string
* @throws JSONException
*/
@@ -151,10 +142,9 @@ public class Cookie {
* Convert %
hh sequences to single characters, and
* convert plus to space.
*
- * @param string
- * A string that may contain +
- * (plus) and %
hh
- * sequences.
+ * @param string A string that may contain +
+ * (plus) and %
hh
+ * sequences.
* @return The unescaped string.
*/
public static String unescape(final String string) {
@@ -164,8 +154,7 @@ public class Cookie {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
- }
- else if ((c == '%') && ((i + 2) < length)) {
+ } else if ((c == '%') && ((i + 2) < length)) {
final int d = JSONTokener.dehexchar(string.charAt(i + 1));
final int e = JSONTokener.dehexchar(string.charAt(i + 2));
if ((d >= 0) && (e >= 0)) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/CookieList.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/CookieList.java
index 146cecbaa..265400868 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/CookieList.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/CookieList.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.util.Iterator;
/**
@@ -39,13 +36,12 @@ public class CookieList {
* of name/value pairs. The names are separated from the values by '='.
* The pairs are separated by ';'. The names and the values
* will be unescaped, possibly converting '+' and '%' sequences.
- *
+ *
* To add a cookie to a cooklist,
* cookielistJSONObject.put(cookieJSONObject.getString("name"),
* cookieJSONObject.getString("value"));
*
- * @param string
- * A cookie list string
+ * @param string A cookie list string
* @return A JSONObject
* @throws JSONException
*/
@@ -67,8 +63,7 @@ public class CookieList {
* The pairs are separated by ';'. The characters '%', '+', '=', and ';'
* in the names and values are replaced by "%hh".
*
- * @param jo
- * A JSONObject
+ * @param jo A JSONObject
* @return A cookie list string
* @throws JSONException
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTP.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTP.java
index 7dfac0a04..e3917c281 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTP.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTP.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.util.Iterator;
/**
@@ -34,13 +31,15 @@ import java.util.Iterator;
*/
public class HTTP {
- /** Carriage return/line feed. */
+ /**
+ * Carriage return/line feed.
+ */
public static final String CRLF = "\r\n";
/**
* Convert an HTTP header string into a JSONObject. It can be a request
* header or a response header. A request header will contain
- *
+ *
*
* {
* Method: "POST" (for example),
@@ -48,9 +47,9 @@ public class HTTP {
* "HTTP-Version": "HTTP/1.1" (for example)
* }
*
- *
+ *
* A response header will contain
- *
+ *
*
* {
* "HTTP-Version": "HTTP/1.1" (for example),
@@ -58,18 +57,18 @@ public class HTTP {
* "Reason-Phrase": "OK" (for example)
* }
*
- *
+ *
* In addition, the other parameters in the header will be captured, using
* the HTTP field names as JSON names, so that
- *
+ *
*
* Date: Sun, 26 May 2002 18:06:04 GMT
* Cookie: Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s
* Cache-Control: no-cache
*
- *
+ *
* become
- *
+ *
*
* {...
* Date: "Sun, 26 May 2002 18:06:04 GMT",
@@ -77,14 +76,13 @@ public class HTTP {
* "Cache-Control": "no-cache",
* ...}
*
- *
+ *
* It does no further checking or conversion. It does not parse dates.
* It does not do '%' transforms on URLs.
*
- * @param string
- * An HTTP header string.
+ * @param string An HTTP header string.
* @return A JSONObject containing the elements and attributes
- * of the XML string.
+ * of the XML string.
* @throws JSONException
*/
public static JSONObject toJSONObject(final String string) throws JSONException {
@@ -102,8 +100,7 @@ public class HTTP {
jo.put("Reason-Phrase", x.nextTo('\0'));
x.next();
- }
- else {
+ } else {
// Request
@@ -125,7 +122,7 @@ public class HTTP {
/**
* Convert a JSONObject into an HTTP header. A request header must contain
- *
+ *
*
* {
* Method: "POST" (for example),
@@ -133,9 +130,9 @@ public class HTTP {
* "HTTP-Version": "HTTP/1.1" (for example)
* }
*
- *
+ *
* A response header must contain
- *
+ *
*
* {
* "HTTP-Version": "HTTP/1.1" (for example),
@@ -143,16 +140,14 @@ public class HTTP {
* "Reason-Phrase": "OK" (for example)
* }
*
- *
+ *
* Any other members of the JSONObject will be output as HTTP fields.
* The result will end with two CRLF pairs.
*
- * @param jo
- * A JSONObject
+ * @param jo A JSONObject
* @return An HTTP header string.
- * @throws JSONException
- * if the object does not contain enough
- * information.
+ * @throws JSONException if the object does not contain enough
+ * information.
*/
public static String toString(final JSONObject jo) throws JSONException {
final Iterator keys = jo.keys();
@@ -164,8 +159,7 @@ public class HTTP {
sb.append(jo.getString("Status-Code"));
sb.append(' ');
sb.append(jo.getString("Reason-Phrase"));
- }
- else if (jo.has("Method") && jo.has("Request-URI")) {
+ } else if (jo.has("Method") && jo.has("Request-URI")) {
sb.append(jo.getString("Method"));
sb.append(' ');
sb.append('"');
@@ -173,8 +167,7 @@ public class HTTP {
sb.append('"');
sb.append(' ');
sb.append(jo.getString("HTTP-Version"));
- }
- else {
+ } else {
throw new JSONException("Not enough material for an HTTP header.");
}
sb.append(CRLF);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTPTokener.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTPTokener.java
index b232d404f..3fe795db7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTPTokener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/HTTPTokener.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* The HTTPTokener extends the JSONTokener to provide additional methods
* for the parsing of HTTP headers.
@@ -36,8 +33,7 @@ public class HTTPTokener extends JSONTokener {
/**
* Construct an HTTPTokener from a string.
*
- * @param string
- * A source string.
+ * @param string A source string.
*/
public HTTPTokener(final String string) {
super(string);
@@ -46,8 +42,8 @@ public class HTTPTokener extends JSONTokener {
/**
* Get the next token or string. This is used in parsing HTTP headers.
*
- * @throws JSONException
* @return A String.
+ * @throws JSONException
*/
public String nextToken() throws JSONException {
char c;
@@ -59,7 +55,7 @@ public class HTTPTokener extends JSONTokener {
while (Character.isWhitespace(c));
if ((c == '"') || (c == '\'')) {
q = c;
- for (;;) {
+ for (; ; ) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
@@ -70,7 +66,7 @@ public class HTTPTokener extends JSONTokener {
sb.append(c);
}
}
- for (;;) {
+ for (; ; ) {
if ((c == 0) || Character.isWhitespace(c)) {
return sb.toString();
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONArray.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONArray.java
index 4fc8ef03e..4f0cf19b2 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONArray.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONArray.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
@@ -42,20 +39,20 @@ import java.util.Map;
* Boolean
, JSONArray
, JSONObject
,
* Number
, String
, or the
* JSONObject.NULL object
.
- *
+ *
* The constructor can convert a JSON text into a Java object. The
* toString
method converts to JSON text.
- *
+ *
* A get
method returns a value if one can be found, and throws an
* exception if one cannot be found. An opt
method returns a
* default value instead of throwing an exception, and so is useful for
* obtaining optional values.
- *
+ *
* The generic get()
and opt()
methods return an
* object which you can cast or query for type. There are also typed
* get
and opt
methods that do type checking and type
* coercion for you.
- *
+ *
* The texts produced by the toString
methods strictly conform to
* JSON syntax rules. The constructors are more forgiving in the texts they will
* accept:
@@ -94,10 +91,8 @@ public class JSONArray {
/**
* Construct a JSONArray from a JSONTokener.
*
- * @param x
- * A JSONTokener
- * @throws JSONException
- * If there is a syntax error.
+ * @param x A JSONTokener
+ * @throws JSONException If there is a syntax error.
*/
public JSONArray(final JSONTokener x) throws JSONException {
this();
@@ -106,12 +101,11 @@ public class JSONArray {
}
if (x.nextClean() != ']') {
x.back();
- for (;;) {
+ for (; ; ) {
if (x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
- }
- else {
+ } else {
x.back();
this.myArrayList.add(x.nextValue());
}
@@ -134,12 +128,10 @@ public class JSONArray {
/**
* Construct a JSONArray from a source JSON text.
*
- * @param source
- * A string that begins with [
(left
- * bracket) and ends with ]
- * (right bracket) .
- * @throws JSONException
- * If there is a syntax error.
+ * @param source A string that begins with [
(left
+ * bracket) and ends with ]
+ * (right bracket) .
+ * @throws JSONException If there is a syntax error.
*/
public JSONArray(final String source) throws JSONException {
this(new JSONTokener(source));
@@ -148,8 +140,7 @@ public class JSONArray {
/**
* Construct a JSONArray from a Collection.
*
- * @param collection
- * A Collection.
+ * @param collection A Collection.
*/
public JSONArray(final Collection collection) {
this.myArrayList = new ArrayList();
@@ -164,8 +155,7 @@ public class JSONArray {
/**
* Construct a JSONArray from an array
*
- * @throws JSONException
- * If not an array.
+ * @throws JSONException If not an array.
*/
public JSONArray(final Object array) throws JSONException {
this();
@@ -174,8 +164,7 @@ public class JSONArray {
for (int i = 0; i < length; i += 1) {
this.put(JSONObject.wrap(Array.get(array, i)));
}
- }
- else {
+ } else {
throw new JSONException("JSONArray initial value should be a string or collection or array.");
}
}
@@ -183,11 +172,9 @@ public class JSONArray {
/**
* Get the object value associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return An object value.
- * @throws JSONException
- * If there is no value for the index.
+ * @throws JSONException If there is no value for the index.
*/
public Object get(final int index) throws JSONException {
final Object object = this.opt(index);
@@ -201,19 +188,16 @@ public class JSONArray {
* Get the boolean value associated with an index. The string values "true"
* and "false" are converted to boolean.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The truth.
- * @throws JSONException
- * If there is no value for the index or if the value is not
- * convertible to boolean.
+ * @throws JSONException If there is no value for the index or if the value is not
+ * convertible to boolean.
*/
public boolean getBoolean(final int index) throws JSONException {
final Object object = this.get(index);
if (object.equals(Boolean.FALSE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("false"))) {
return false;
- }
- else if (object.equals(Boolean.TRUE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("true"))) {
+ } else if (object.equals(Boolean.TRUE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
@@ -222,19 +206,16 @@ public class JSONArray {
/**
* Get the double value associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
- * @throws JSONException
- * If the key is not found or if the value cannot be converted
- * to a number.
+ * @throws JSONException If the key is not found or if the value cannot be converted
+ * to a number.
*/
public double getDouble(final int index) throws JSONException {
final Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
@@ -242,18 +223,15 @@ public class JSONArray {
/**
* Get the int value associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
- * @throws JSONException
- * If the key is not found or if the value is not a number.
+ * @throws JSONException If the key is not found or if the value is not a number.
*/
public int getInt(final int index) throws JSONException {
final Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
@@ -261,12 +239,10 @@ public class JSONArray {
/**
* Get the JSONArray associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return A JSONArray value.
- * @throws JSONException
- * If there is no value for the index. or if the value is not a
- * JSONArray
+ * @throws JSONException If there is no value for the index. or if the value is not a
+ * JSONArray
*/
public JSONArray getJSONArray(final int index) throws JSONException {
final Object object = this.get(index);
@@ -279,12 +255,10 @@ public class JSONArray {
/**
* Get the JSONObject associated with an index.
*
- * @param index
- * subscript
+ * @param index subscript
* @return A JSONObject value.
- * @throws JSONException
- * If there is no value for the index or if the value is not a
- * JSONObject
+ * @throws JSONException If there is no value for the index or if the value is not a
+ * JSONObject
*/
public JSONObject getJSONObject(final int index) throws JSONException {
final Object object = this.get(index);
@@ -297,19 +271,16 @@ public class JSONArray {
/**
* Get the long value associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
- * @throws JSONException
- * If the key is not found or if the value cannot be converted
- * to a number.
+ * @throws JSONException If the key is not found or if the value cannot be converted
+ * to a number.
*/
public long getLong(final int index) throws JSONException {
final Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
@@ -317,11 +288,9 @@ public class JSONArray {
/**
* Get the string associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return A string value.
- * @throws JSONException
- * If there is no string value for the index.
+ * @throws JSONException If there is no string value for the index.
*/
public String getString(final int index) throws JSONException {
final Object object = this.get(index);
@@ -334,8 +303,7 @@ public class JSONArray {
/**
* Determine if the value is null.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return true if the value at the index is null, or if there is no value.
*/
public boolean isNull(final int index) {
@@ -347,11 +315,9 @@ public class JSONArray {
* separator
string is inserted between each element. Warning:
* This method assumes that the data structure is acyclical.
*
- * @param separator
- * A string that will be inserted between the elements.
+ * @param separator A string that will be inserted between the elements.
* @return a string.
- * @throws JSONException
- * If the array contains an invalid number.
+ * @throws JSONException If the array contains an invalid number.
*/
public String join(final String separator) throws JSONException {
final int len = this.length();
@@ -378,8 +344,7 @@ public class JSONArray {
/**
* Get the optional object value associated with an index.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return An object value, or null if there is no object at that index.
*/
public Object opt(final int index) {
@@ -391,8 +356,7 @@ public class JSONArray {
* if there is no value at that index, or if the value is not Boolean.TRUE
* or the String "true".
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The truth.
*/
public boolean optBoolean(final int index) {
@@ -404,17 +368,14 @@ public class JSONArray {
* defaultValue if there is no value at that index or if it is not a Boolean
* or the String "true" or "false" (case insensitive).
*
- * @param index
- * The index must be between 0 and length() - 1.
- * @param defaultValue
- * A boolean default.
+ * @param index The index must be between 0 and length() - 1.
+ * @param defaultValue A boolean default.
* @return The truth.
*/
public boolean optBoolean(final int index, final boolean defaultValue) {
try {
return this.getBoolean(index);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -424,8 +385,7 @@ public class JSONArray {
* if there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
*/
public double optDouble(final int index) {
@@ -437,17 +397,14 @@ public class JSONArray {
* is returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
- * @param index
- * subscript
- * @param defaultValue
- * The default value.
+ * @param index subscript
+ * @param defaultValue The default value.
* @return The value.
*/
public double optDouble(final int index, final double defaultValue) {
try {
return this.getDouble(index);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -457,8 +414,7 @@ public class JSONArray {
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
*/
public int optInt(final int index) {
@@ -470,17 +426,14 @@ public class JSONArray {
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
- * @param index
- * The index must be between 0 and length() - 1.
- * @param defaultValue
- * The default value.
+ * @param index The index must be between 0 and length() - 1.
+ * @param defaultValue The default value.
* @return The value.
*/
public int optInt(final int index, final int defaultValue) {
try {
return this.getInt(index);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -488,10 +441,9 @@ public class JSONArray {
/**
* Get the optional JSONArray associated with an index.
*
- * @param index
- * subscript
+ * @param index subscript
* @return A JSONArray value, or null if the index has no value, or if the
- * value is not a JSONArray.
+ * value is not a JSONArray.
*/
public JSONArray optJSONArray(final int index) {
final Object o = this.opt(index);
@@ -503,8 +455,7 @@ public class JSONArray {
* the key is not found, or null if the index has no value, or if the value
* is not a JSONObject.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return A JSONObject value.
*/
public JSONObject optJSONObject(final int index) {
@@ -517,8 +468,7 @@ public class JSONArray {
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return The value.
*/
public long optLong(final int index) {
@@ -530,17 +480,14 @@ public class JSONArray {
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
- * @param index
- * The index must be between 0 and length() - 1.
- * @param defaultValue
- * The default value.
+ * @param index The index must be between 0 and length() - 1.
+ * @param defaultValue The default value.
* @return The value.
*/
public long optLong(final int index, final long defaultValue) {
try {
return this.getLong(index);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -550,8 +497,7 @@ public class JSONArray {
* empty string if there is no value at that index. If the value is not a
* string and is not null, then it is coverted to a string.
*
- * @param index
- * The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @return A String value.
*/
public String optString(final int index) {
@@ -562,10 +508,8 @@ public class JSONArray {
* Get the optional string associated with an index. The defaultValue is
* returned if the key is not found.
*
- * @param index
- * The index must be between 0 and length() - 1.
- * @param defaultValue
- * The default value.
+ * @param index The index must be between 0 and length() - 1.
+ * @param defaultValue The default value.
* @return A String value.
*/
public String optString(final int index, final String defaultValue) {
@@ -576,8 +520,7 @@ public class JSONArray {
/**
* Append a boolean value. This increases the array's length by one.
*
- * @param value
- * A boolean value.
+ * @param value A boolean value.
* @return this.
*/
public JSONArray put(final boolean value) {
@@ -589,8 +532,7 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
- * @param value
- * A Collection value.
+ * @param value A Collection value.
* @return this.
*/
public JSONArray put(final Collection value) {
@@ -601,11 +543,9 @@ public class JSONArray {
/**
* Append a double value. This increases the array's length by one.
*
- * @param value
- * A double value.
- * @throws JSONException
- * if the value is not finite.
+ * @param value A double value.
* @return this.
+ * @throws JSONException if the value is not finite.
*/
public JSONArray put(final double value) throws JSONException {
final Double d = new Double(value);
@@ -617,8 +557,7 @@ public class JSONArray {
/**
* Append an int value. This increases the array's length by one.
*
- * @param value
- * An int value.
+ * @param value An int value.
* @return this.
*/
public JSONArray put(final int value) {
@@ -629,8 +568,7 @@ public class JSONArray {
/**
* Append an long value. This increases the array's length by one.
*
- * @param value
- * A long value.
+ * @param value A long value.
* @return this.
*/
public JSONArray put(final long value) {
@@ -642,8 +580,7 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a JSONObject which
* is produced from a Map.
*
- * @param value
- * A Map value.
+ * @param value A Map value.
* @return this.
*/
public JSONArray put(final Map value) {
@@ -654,10 +591,9 @@ public class JSONArray {
/**
* Append an object value. This increases the array's length by one.
*
- * @param value
- * An object value. The value should be a Boolean, Double,
- * Integer, JSONArray, JSONObject, Long, or String, or the
- * JSONObject.NULL object.
+ * @param value An object value. The value should be a Boolean, Double,
+ * Integer, JSONArray, JSONObject, Long, or String, or the
+ * JSONObject.NULL object.
* @return this.
*/
public JSONArray put(final Object value) {
@@ -670,13 +606,10 @@ public class JSONArray {
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
- * @param index
- * The subscript.
- * @param value
- * A boolean value.
+ * @param index The subscript.
+ * @param value A boolean value.
* @return this.
- * @throws JSONException
- * If the index is negative.
+ * @throws JSONException If the index is negative.
*/
public JSONArray put(final int index, final boolean value) throws JSONException {
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
@@ -687,13 +620,10 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
- * @param index
- * The subscript.
- * @param value
- * A Collection value.
+ * @param index The subscript.
+ * @param value A Collection value.
* @return this.
- * @throws JSONException
- * If the index is negative or if the value is not finite.
+ * @throws JSONException If the index is negative or if the value is not finite.
*/
public JSONArray put(final int index, final Collection value) throws JSONException {
this.put(index, new JSONArray(value));
@@ -705,13 +635,10 @@ public class JSONArray {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
- * @param index
- * The subscript.
- * @param value
- * A double value.
+ * @param index The subscript.
+ * @param value A double value.
* @return this.
- * @throws JSONException
- * If the index is negative or if the value is not finite.
+ * @throws JSONException If the index is negative or if the value is not finite.
*/
public JSONArray put(final int index, final double value) throws JSONException {
this.put(index, new Double(value));
@@ -723,13 +650,10 @@ public class JSONArray {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
- * @param index
- * The subscript.
- * @param value
- * An int value.
+ * @param index The subscript.
+ * @param value An int value.
* @return this.
- * @throws JSONException
- * If the index is negative.
+ * @throws JSONException If the index is negative.
*/
public JSONArray put(final int index, final int value) throws JSONException {
this.put(index, new Integer(value));
@@ -741,13 +665,10 @@ public class JSONArray {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
- * @param index
- * The subscript.
- * @param value
- * A long value.
+ * @param index The subscript.
+ * @param value A long value.
* @return this.
- * @throws JSONException
- * If the index is negative.
+ * @throws JSONException If the index is negative.
*/
public JSONArray put(final int index, final long value) throws JSONException {
this.put(index, new Long(value));
@@ -758,14 +679,11 @@ public class JSONArray {
* Put a value in the JSONArray, where the value will be a JSONObject that
* is produced from a Map.
*
- * @param index
- * The subscript.
- * @param value
- * The Map value.
+ * @param index The subscript.
+ * @param value The Map value.
* @return this.
- * @throws JSONException
- * If the index is negative or if the the value is an invalid
- * number.
+ * @throws JSONException If the index is negative or if the the value is an invalid
+ * number.
*/
public JSONArray put(final int index, final Map value) throws JSONException {
this.put(index, new JSONObject(value));
@@ -777,16 +695,13 @@ public class JSONArray {
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
- * @param index
- * The subscript.
- * @param value
- * The value to put into the array. The value should be a
- * Boolean, Double, Integer, JSONArray, JSONObject, Long, or
- * String, or the JSONObject.NULL object.
+ * @param index The subscript.
+ * @param value The value to put into the array. The value should be a
+ * Boolean, Double, Integer, JSONArray, JSONObject, Long, or
+ * String, or the JSONObject.NULL object.
* @return this.
- * @throws JSONException
- * If the index is negative or if the the value is an invalid
- * number.
+ * @throws JSONException If the index is negative or if the the value is an invalid
+ * number.
*/
public JSONArray put(final int index, final Object value) throws JSONException {
JSONObject.testValidity(value);
@@ -795,8 +710,7 @@ public class JSONArray {
}
if (index < this.length()) {
this.myArrayList.set(index, value);
- }
- else {
+ } else {
while (index != this.length()) {
this.put(JSONObject.NULL);
}
@@ -808,10 +722,9 @@ public class JSONArray {
/**
* Remove an index and close the hole.
*
- * @param index
- * The index of the element to be removed.
+ * @param index The index of the element to be removed.
* @return The value that was associated with the index, or null if there
- * was no value.
+ * was no value.
*/
public Object remove(final int index) {
return (index >= 0) && (index < this.length()) ? this.myArrayList.remove(index) : null;
@@ -821,8 +734,7 @@ public class JSONArray {
* Determine if two JSONArrays are similar.
* They must contain similar sequences.
*
- * @param other
- * The other JSONArray
+ * @param other The other JSONArray
* @return true if they are equal
*/
public boolean similar(final Object other) {
@@ -840,13 +752,11 @@ public class JSONArray {
if (!((JSONObject) valueThis).similar(valueOther)) {
return false;
}
- }
- else if (valueThis instanceof JSONArray) {
+ } else if (valueThis instanceof JSONArray) {
if (!((JSONArray) valueThis).similar(valueOther)) {
return false;
}
- }
- else if (!valueThis.equals(valueOther)) {
+ } else if (!valueThis.equals(valueOther)) {
return false;
}
}
@@ -857,13 +767,11 @@ public class JSONArray {
* Produce a JSONObject by combining a JSONArray of names with the values of
* this JSONArray.
*
- * @param names
- * A JSONArray containing a list of key strings. These will be
- * paired with the values.
+ * @param names A JSONArray containing a list of key strings. These will be
+ * paired with the values.
* @return A JSONObject, or null if there are no names or if this JSONArray
- * has no values.
- * @throws JSONException
- * If any of the names are null.
+ * has no values.
+ * @throws JSONException If any of the names are null.
*/
public JSONObject toJSONObject(final JSONArray names) throws JSONException {
if ((names == null) || (names.length() == 0) || (this.length() == 0)) {
@@ -881,18 +789,17 @@ public class JSONArray {
* whitespace is added. If it is not possible to produce a syntactically
* correct JSON text then null will be returned instead. This could occur if
* the array contains an invalid number.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
* @return a printable, displayable, transmittable representation of the
- * array.
+ * array.
*/
@Override
public String toString() {
try {
return this.toString(0);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return null;
}
}
@@ -901,12 +808,11 @@ public class JSONArray {
* Make a prettyprinted JSON text of this JSONArray. Warning: This method
* assumes that the data structure is acyclical.
*
- * @param indentFactor
- * The number of spaces to add to each level of indentation.
+ * @param indentFactor The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the
- * object, beginning with [
(left
- * bracket) and ending with ]
- * (right bracket) .
+ * object, beginning with [
(left
+ * bracket) and ending with ]
+ * (right bracket) .
* @throws JSONException
*/
public String toString(final int indentFactor) throws JSONException {
@@ -919,7 +825,7 @@ public class JSONArray {
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
@@ -932,13 +838,11 @@ public class JSONArray {
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
- * @param indentFactor
- * The number of spaces to add to each level of indentation.
- * @param indent
- * The indention of the top level.
+ * @param indentFactor The number of spaces to add to each level of indentation.
+ * @param indent The indention of the top level.
* @return The writer.
* @throws JSONException
*/
@@ -950,8 +854,7 @@ public class JSONArray {
if (length == 1) {
JSONObject.writeValue(writer, this.myArrayList.get(0), indentFactor, indent);
- }
- else if (length != 0) {
+ } else if (length != 0) {
final int newindent = indent + indentFactor;
for (int i = 0; i < length; i += 1) {
@@ -972,8 +875,7 @@ public class JSONArray {
}
writer.write(']');
return writer;
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
throw new JSONException(e);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONException.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONException.java
index 17f89893f..a7f733589 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONException.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONException.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
/**
@@ -8,13 +29,12 @@ package com.intellectualcrafters.json;
*/
public class JSONException extends RuntimeException {
private static final long serialVersionUID = 0;
- private Throwable cause;
+ private Throwable cause;
/**
* Constructs a JSONException with an explanatory message.
*
- * @param message
- * Detail about the reason for the exception.
+ * @param message Detail about the reason for the exception.
*/
public JSONException(final String message) {
super(message);
@@ -23,8 +43,7 @@ public class JSONException extends RuntimeException {
/**
* Constructs a new JSONException with the specified cause.
*
- * @param cause
- * The cause.
+ * @param cause The cause.
*/
public JSONException(final Throwable cause) {
super(cause.getMessage());
@@ -36,7 +55,7 @@ public class JSONException extends RuntimeException {
* or unknown.
*
* @return the cause of this exception or null if the cause is nonexistent
- * or unknown.
+ * or unknown.
*/
@Override
public Throwable getCause() {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONML.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONML.java
index 607f2352d..82162790e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONML.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONML.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2008 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.util.Iterator;
/**
@@ -39,13 +36,10 @@ public class JSONML {
/**
* Parse XML values and store them in a JSONArray.
*
- * @param x
- * The XMLTokener containing the source string.
- * @param arrayForm
- * true if array form, false if object form.
- * @param ja
- * The JSONArray that is containing the current tag or null
- * if we are at the outermost level.
+ * @param x The XMLTokener containing the source string.
+ * @param arrayForm true if array form, false if object form.
+ * @param ja The JSONArray that is containing the current tag or null
+ * if we are at the outermost level.
* @return A JSONArray if the value is the outermost tag, otherwise null.
* @throws JSONException
*/
@@ -85,8 +79,7 @@ public class JSONML {
throw x.syntaxError("Misshaped close tag");
}
return token;
- }
- else if (token == XML.BANG) {
+ } else if (token == XML.BANG) {
// ");
- }
- else {
+ } else {
x.back();
}
- }
- else if (c == '[') {
+ } else if (c == '[') {
token = x.nextToken();
if (token.equals("CDATA") && (x.next() == '[')) {
if (ja != null) {
ja.put(x.nextCDATA());
}
- }
- else {
+ } else {
throw x.syntaxError("Expected 'CDATA['");
}
- }
- else {
+ } else {
i = 1;
do {
token = x.nextMeta();
if (token == null) {
throw x.syntaxError("Missing '>' after ' 0);
}
- }
- else if (token == XML.QUEST) {
+ } else if (token == XML.QUEST) {
//
x.skipPast("?>");
- }
- else {
+ } else {
throw x.syntaxError("Misshaped tag");
}
// Open tag <
- }
- else {
+ } else {
if (!(token instanceof String)) {
throw x.syntaxError("Bad tagName '" + token + "'.");
}
@@ -152,15 +136,14 @@ public class JSONML {
if (ja != null) {
ja.put(newja);
}
- }
- else {
+ } else {
newjo.put("tagName", tagName);
if (ja != null) {
ja.put(newjo);
}
}
token = null;
- for (;;) {
+ for (; ; ) {
if (token == null) {
token = x.nextToken();
}
@@ -185,8 +168,7 @@ public class JSONML {
}
newjo.accumulate(attribute, XML.stringToValue((String) token));
token = null;
- }
- else {
+ } else {
newjo.accumulate(attribute, "");
}
}
@@ -203,16 +185,14 @@ public class JSONML {
if (ja == null) {
if (arrayForm) {
return newja;
- }
- else {
+ } else {
return newjo;
}
}
// Content, between <...> and
- }
- else {
+ } else {
if (token != XML.GT) {
throw x.syntaxError("Misshaped tag");
}
@@ -228,16 +208,14 @@ public class JSONML {
if (ja == null) {
if (arrayForm) {
return newja;
- }
- else {
+ } else {
return newjo;
}
}
}
}
}
- }
- else {
+ } else {
if (ja != null) {
ja.put(token instanceof String ? XML.stringToValue((String) token) : token);
}
@@ -254,8 +232,7 @@ public class JSONML {
* JSONArrays will represent the child tags.
* Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
*
- * @param string
- * The source string.
+ * @param string The source string.
* @return A JSONArray containing the structured data from the XML string.
* @throws JSONException
*/
@@ -272,8 +249,7 @@ public class JSONML {
* JSONArrays will represent the child content and tags.
* Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
*
- * @param x
- * An XMLTokener.
+ * @param x An XMLTokener.
* @return A JSONArray containing the structured data from the XML string.
* @throws JSONException
*/
@@ -288,11 +264,10 @@ public class JSONML {
* the attributes will be in the JSONObject as properties. If the tag
* contains children, the object will have a "childNodes" property which
* will be an array of strings and JsonML JSONObjects.
- *
+ *
* Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
*
- * @param x
- * An XMLTokener of the XML source text.
+ * @param x An XMLTokener of the XML source text.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
@@ -307,11 +282,10 @@ public class JSONML {
* the attributes will be in the JSONObject as properties. If the tag
* contains children, the object will have a "childNodes" property which
* will be an array of strings and JsonML JSONObjects.
- *
+ *
* Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
*
- * @param string
- * The XML source text.
+ * @param string The XML source text.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
@@ -322,8 +296,7 @@ public class JSONML {
/**
* Reverse the JSONML transformation, making an XML text from a JSONArray.
*
- * @param ja
- * A JSONArray.
+ * @param ja A JSONArray.
* @return An XML string.
* @throws JSONException
*/
@@ -367,8 +340,7 @@ public class JSONML {
sb.append('"');
}
}
- }
- else {
+ } else {
i = 1;
}
@@ -378,8 +350,7 @@ public class JSONML {
if (i >= length) {
sb.append('/');
sb.append('>');
- }
- else {
+ } else {
sb.append('>');
do {
object = ja.get(i);
@@ -387,11 +358,9 @@ public class JSONML {
if (object != null) {
if (object instanceof String) {
sb.append(XML.escape(object.toString()));
- }
- else if (object instanceof JSONObject) {
+ } else if (object instanceof JSONObject) {
sb.append(toString((JSONObject) object));
- }
- else if (object instanceof JSONArray) {
+ } else if (object instanceof JSONArray) {
sb.append(toString((JSONArray) object));
}
}
@@ -411,8 +380,7 @@ public class JSONML {
* then it must have a "childNodes" property containing an array of objects.
* The other properties are attributes with string values.
*
- * @param jo
- * A JSONObject.
+ * @param jo A JSONObject.
* @return An XML string.
* @throws JSONException
*/
@@ -463,8 +431,7 @@ public class JSONML {
if (ja == null) {
sb.append('/');
sb.append('>');
- }
- else {
+ } else {
sb.append('>');
length = ja.length();
for (i = 0; i < length; i += 1) {
@@ -472,14 +439,11 @@ public class JSONML {
if (object != null) {
if (object instanceof String) {
sb.append(XML.escape(object.toString()));
- }
- else if (object instanceof JSONObject) {
+ } else if (object instanceof JSONObject) {
sb.append(toString((JSONObject) object));
- }
- else if (object instanceof JSONArray) {
+ } else if (object instanceof JSONArray) {
sb.append(toString((JSONArray) object));
- }
- else {
+ } else {
sb.append(object.toString());
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONObject.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONObject.java
index 42e30213a..b683dd303 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONObject.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONObject.java
@@ -1,44 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.ResourceBundle;
-import java.util.Set;
/**
* A JSONObject is an unordered collection of name/value pairs. Its external
@@ -57,21 +47,21 @@ import java.util.Set;
* exception if one cannot be found. An opt
method returns a
* default value instead of throwing an exception, and so is useful for
* obtaining optional values.
- *
+ *
* The generic get()
and opt()
methods return an
* object, which you can cast or query for type. There are also typed
* get
and opt
methods that do type checking and type
* coercion for you. The opt methods differ from the get methods in that they do
* not throw. Instead, they return a specified value, such as null.
- *
+ *
* The put
methods add or replace values in an object. For example,
- *
+ *
*
* myString = new JSONObject().put("JSON", "Hello, World!").toString();
*
- *
+ *
* produces the string {"JSON": "Hello, World"}
.
- *
+ *
* The texts produced by the toString
methods strictly conform to
* the JSON syntax rules. The constructors are more forgiving in the texts they
* will accept:
@@ -113,10 +103,9 @@ public class JSONObject {
/**
* A Null object is equal to the null value and to itself.
*
- * @param object
- * An object to test for nullness.
+ * @param object An object to test for nullness.
* @return true if the object parameter is the JSONObject.NULL object or
- * null.
+ * null.
*/
@Override
public boolean equals(final Object object) {
@@ -145,7 +134,7 @@ public class JSONObject {
* JSONObject.NULL.equals(null)
returns true
.
* JSONObject.NULL.toString()
returns "null"
.
*/
- public static final Object NULL = new Null();
+ public static final Object NULL = new Null();
/**
* Construct an empty JSONObject.
@@ -159,22 +148,18 @@ public class JSONObject {
* strings is used to identify the keys that should be copied. Missing keys
* are ignored.
*
- * @param jo
- * A JSONObject.
- * @param names
- * An array of strings.
+ * @param jo A JSONObject.
+ * @param names An array of strings.
* @throws JSONException
- * @exception JSONException
- * If a value is a non-finite number or if a name is
- * duplicated.
+ * @throws JSONException If a value is a non-finite number or if a name is
+ * duplicated.
*/
public JSONObject(final JSONObject jo, final String[] names) {
this();
for (final String name : names) {
try {
this.putOnce(name, jo.opt(name));
- }
- catch (final Exception ignore) {
+ } catch (final Exception ignore) {
}
}
}
@@ -182,11 +167,9 @@ public class JSONObject {
/**
* Construct a JSONObject from a JSONTokener.
*
- * @param x
- * A JSONTokener object containing the source string.
- * @throws JSONException
- * If there is a syntax error in the source string or a
- * duplicated key.
+ * @param x A JSONTokener object containing the source string.
+ * @throws JSONException If there is a syntax error in the source string or a
+ * duplicated key.
*/
public JSONObject(final JSONTokener x) throws JSONException {
this();
@@ -196,7 +179,7 @@ public class JSONObject {
if (x.nextClean() != '{') {
throw x.syntaxError("A JSONObject text must begin with '{'");
}
- for (;;) {
+ for (; ; ) {
c = x.nextClean();
switch (c) {
case 0:
@@ -237,8 +220,7 @@ public class JSONObject {
/**
* Construct a JSONObject from a Map.
*
- * @param map
- * A map object that can be used to initialize the contents of
+ * @param map A map object that can be used to initialize the contents of
* the JSONObject.
* @throws JSONException
*/
@@ -263,19 +245,18 @@ public class JSONObject {
* "is"
followed by an uppercase letter, the method is invoked,
* and a key and the value returned from the getter method are put into the
* new JSONObject.
- *
+ *
* The key is formed by removing the "get"
or "is"
* prefix. If the second remaining character is not upper case, then the
* first character is converted to lower case.
- *
+ *
* For example, if an object has a method named "getName"
, and
* if the result of calling object.getName()
is
* "Larry Fine"
, then the JSONObject will contain
* "name": "Larry Fine"
.
*
- * @param bean
- * An object that has getter methods that should be used to make
- * a JSONObject.
+ * @param bean An object that has getter methods that should be used to make
+ * a JSONObject.
*/
public JSONObject(final Object bean) {
this();
@@ -289,12 +270,10 @@ public class JSONObject {
* those keys in the object. If a key is not found or not visible, then it
* will not be copied into the new JSONObject.
*
- * @param object
- * An object that has fields that should be used to make a
- * JSONObject.
- * @param names
- * An array of strings, the names of the fields to be obtained
- * from the object.
+ * @param object An object that has fields that should be used to make a
+ * JSONObject.
+ * @param names An array of strings, the names of the fields to be obtained
+ * from the object.
*/
public JSONObject(final Object object, final String names[]) {
this();
@@ -302,8 +281,7 @@ public class JSONObject {
for (final String name : names) {
try {
this.putOpt(name, c.getField(name).get(object));
- }
- catch (final Exception ignore) {
+ } catch (final Exception ignore) {
}
}
}
@@ -312,13 +290,11 @@ public class JSONObject {
* Construct a JSONObject from a source JSON text string. This is the most
* commonly used JSONObject constructor.
*
- * @param source
- * A string beginning with {
(left
- * brace) and ending with }
- * (right brace) .
- * @exception JSONException
- * If there is a syntax error in the source string or a
- * duplicated key.
+ * @param source A string beginning with {
(left
+ * brace) and ending with }
+ * (right brace) .
+ * @throws JSONException If there is a syntax error in the source string or a
+ * duplicated key.
*/
public JSONObject(final String source) throws JSONException {
this(new JSONTokener(source));
@@ -327,12 +303,9 @@ public class JSONObject {
/**
* Construct a JSONObject from a ResourceBundle.
*
- * @param baseName
- * The ResourceBundle base name.
- * @param locale
- * The Locale to load the ResourceBundle for.
- * @throws JSONException
- * If any JSONExceptions are detected.
+ * @param baseName The ResourceBundle base name.
+ * @param locale The Locale to load the ResourceBundle for.
+ * @throws JSONException If any JSONExceptions are detected.
*/
public JSONObject(final String baseName, final Locale locale) throws JSONException {
this();
@@ -374,29 +347,24 @@ public class JSONObject {
* is stored under the key to hold all of the accumulated values. If there
* is already a JSONArray, then the new value is appended to it. In
* contrast, the put method replaces the previous value.
- *
+ *
* If only one value is accumulated that is not a JSONArray, then the result
* will be the same as using put. But if multiple values are accumulated,
* then the result will be like append.
*
- * @param key
- * A key string.
- * @param value
- * An object to be accumulated under the key.
+ * @param key A key string.
+ * @param value An object to be accumulated under the key.
* @return this.
- * @throws JSONException
- * If the value is an invalid number or if the key is null.
+ * @throws JSONException If the value is an invalid number or if the key is null.
*/
public JSONObject accumulate(final String key, final Object value) throws JSONException {
testValidity(value);
final Object object = this.opt(key);
if (object == null) {
this.put(key, value instanceof JSONArray ? new JSONArray().put(value) : value);
- }
- else if (object instanceof JSONArray) {
+ } else if (object instanceof JSONArray) {
((JSONArray) object).put(value);
- }
- else {
+ } else {
this.put(key, new JSONArray().put(object).put(value));
}
return this;
@@ -408,25 +376,20 @@ public class JSONObject {
* JSONArray containing the value parameter. If the key was already
* associated with a JSONArray, then the value parameter is appended to it.
*
- * @param key
- * A key string.
- * @param value
- * An object to be accumulated under the key.
+ * @param key A key string.
+ * @param value An object to be accumulated under the key.
* @return this.
- * @throws JSONException
- * If the key is null or if the current value associated with
- * the key is not a JSONArray.
+ * @throws JSONException If the key is null or if the current value associated with
+ * the key is not a JSONArray.
*/
public JSONObject append(final String key, final Object value) throws JSONException {
testValidity(value);
final Object object = this.opt(key);
if (object == null) {
this.put(key, new JSONArray().put(value));
- }
- else if (object instanceof JSONArray) {
+ } else if (object instanceof JSONArray) {
this.put(key, ((JSONArray) object).put(value));
- }
- else {
+ } else {
throw new JSONException("JSONObject[" + key + "] is not a JSONArray.");
}
return this;
@@ -436,8 +399,7 @@ public class JSONObject {
* Produce a string from a double. The string "null" will be returned if the
* number is not finite.
*
- * @param d
- * A double.
+ * @param d A double.
* @return A String.
*/
public static String doubleToString(final double d) {
@@ -462,11 +424,9 @@ public class JSONObject {
/**
* Get the value object associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The object associated with the key.
- * @throws JSONException
- * if the key is not found.
+ * @throws JSONException if the key is not found.
*/
public Object get(final String key) throws JSONException {
if (key == null) {
@@ -482,19 +442,16 @@ public class JSONObject {
/**
* Get the boolean value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The truth.
- * @throws JSONException
- * if the value is not a Boolean or the String "true" or
- * "false".
+ * @throws JSONException if the value is not a Boolean or the String "true" or
+ * "false".
*/
public boolean getBoolean(final String key) throws JSONException {
final Object object = this.get(key);
if (object.equals(Boolean.FALSE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("false"))) {
return false;
- }
- else if (object.equals(Boolean.TRUE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("true"))) {
+ } else if (object.equals(Boolean.TRUE) || ((object instanceof String) && ((String) object).equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONObject[" + quote(key) + "] is not a Boolean.");
@@ -503,19 +460,16 @@ public class JSONObject {
/**
* Get the double value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The numeric value.
- * @throws JSONException
- * if the key is not found or if the value is not a Number
- * object and cannot be converted to a number.
+ * @throws JSONException if the key is not found or if the value is not a Number
+ * object and cannot be converted to a number.
*/
public double getDouble(final String key) throws JSONException {
final Object object = this.get(key);
try {
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
}
}
@@ -523,19 +477,16 @@ public class JSONObject {
/**
* Get the int value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The integer value.
- * @throws JSONException
- * if the key is not found or if the value cannot be converted
- * to an integer.
+ * @throws JSONException if the key is not found or if the value cannot be converted
+ * to an integer.
*/
public int getInt(final String key) throws JSONException {
final Object object = this.get(key);
try {
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
}
}
@@ -543,11 +494,9 @@ public class JSONObject {
/**
* Get the JSONArray value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A JSONArray which is the value.
- * @throws JSONException
- * if the key is not found or if the value is not a JSONArray.
+ * @throws JSONException if the key is not found or if the value is not a JSONArray.
*/
public JSONArray getJSONArray(final String key) throws JSONException {
final Object object = this.get(key);
@@ -560,11 +509,9 @@ public class JSONObject {
/**
* Get the JSONObject value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A JSONObject which is the value.
- * @throws JSONException
- * if the key is not found or if the value is not a JSONObject.
+ * @throws JSONException if the key is not found or if the value is not a JSONObject.
*/
public JSONObject getJSONObject(final String key) throws JSONException {
final Object object = this.get(key);
@@ -577,19 +524,16 @@ public class JSONObject {
/**
* Get the long value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The long value.
- * @throws JSONException
- * if the key is not found or if the value cannot be converted
- * to a long.
+ * @throws JSONException if the key is not found or if the value cannot be converted
+ * to a long.
*/
public long getLong(final String key) throws JSONException {
final Object object = this.get(key);
try {
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
}
}
@@ -639,11 +583,9 @@ public class JSONObject {
/**
* Get the string associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A string which is the value.
- * @throws JSONException
- * if there is no string value for the key.
+ * @throws JSONException if there is no string value for the key.
*/
public String getString(final String key) throws JSONException {
final Object object = this.get(key);
@@ -656,8 +598,7 @@ public class JSONObject {
/**
* Determine if the JSONObject contains a specific key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return true if the key exists in the JSONObject.
*/
public boolean has(final String key) {
@@ -669,31 +610,24 @@ public class JSONObject {
* create one with a value of 1. If there is such a property, and if it is
* an Integer, Long, Double, or Float, then add one to it.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return this.
- * @throws JSONException
- * If there is already a property with this name that is not an
- * Integer, Long, Double, or Float.
+ * @throws JSONException If there is already a property with this name that is not an
+ * Integer, Long, Double, or Float.
*/
public JSONObject increment(final String key) throws JSONException {
final Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
- }
- else if (value instanceof Integer) {
+ } else if (value instanceof Integer) {
this.put(key, (Integer) value + 1);
- }
- else if (value instanceof Long) {
+ } else if (value instanceof Long) {
this.put(key, (Long) value + 1);
- }
- else if (value instanceof Double) {
+ } else if (value instanceof Double) {
this.put(key, (Double) value + 1);
- }
- else if (value instanceof Float) {
+ } else if (value instanceof Float) {
this.put(key, (Float) value + 1);
- }
- else {
+ } else {
throw new JSONException("Unable to increment [" + quote(key) + "].");
}
return this;
@@ -703,10 +637,9 @@ public class JSONObject {
* Determine if the value associated with the key is null or if there is no
* value.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return true if there is no value associated with the key or if the value
- * is the JSONObject.NULL object.
+ * is the JSONObject.NULL object.
*/
public boolean isNull(final String key) {
return JSONObject.NULL.equals(this.opt(key));
@@ -744,7 +677,7 @@ public class JSONObject {
* JSONObject.
*
* @return A JSONArray containing the key strings, or null if the JSONObject
- * is empty.
+ * is empty.
*/
public JSONArray names() {
final JSONArray ja = new JSONArray();
@@ -758,11 +691,9 @@ public class JSONObject {
/**
* Produce a string from a Number.
*
- * @param number
- * A Number
+ * @param number A Number
* @return A String.
- * @throws JSONException
- * If n is a non-finite number.
+ * @throws JSONException If n is a non-finite number.
*/
public static String numberToString(final Number number) throws JSONException {
if (number == null) {
@@ -787,8 +718,7 @@ public class JSONObject {
/**
* Get an optional value associated with a key.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return An object which is the value, or null if there is no value.
*/
public Object opt(final String key) {
@@ -799,8 +729,7 @@ public class JSONObject {
* Get an optional boolean associated with a key. It returns false if there
* is no such key, or if the value is not Boolean.TRUE or the String "true".
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return The truth.
*/
public boolean optBoolean(final String key) {
@@ -812,17 +741,14 @@ public class JSONObject {
* defaultValue if there is no such key, or if it is not a Boolean or the
* String "true" or "false" (case insensitive).
*
- * @param key
- * A key string.
- * @param defaultValue
- * The default.
+ * @param key A key string.
+ * @param defaultValue The default.
* @return The truth.
*/
public boolean optBoolean(final String key, final boolean defaultValue) {
try {
return this.getBoolean(key);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -832,8 +758,7 @@ public class JSONObject {
* key or if its value is not a number. If the value is a string, an attempt
* will be made to evaluate it as a number.
*
- * @param key
- * A string which is the key.
+ * @param key A string which is the key.
* @return An object which is the value.
*/
public double optDouble(final String key) {
@@ -845,17 +770,14 @@ public class JSONObject {
* there is no such key or if its value is not a number. If the value is a
* string, an attempt will be made to evaluate it as a number.
*
- * @param key
- * A key string.
- * @param defaultValue
- * The default.
+ * @param key A key string.
+ * @param defaultValue The default.
* @return An object which is the value.
*/
public double optDouble(final String key, final double defaultValue) {
try {
return this.getDouble(key);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -865,8 +787,7 @@ public class JSONObject {
* such key or if the value is not a number. If the value is a string, an
* attempt will be made to evaluate it as a number.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return An object which is the value.
*/
public int optInt(final String key) {
@@ -878,17 +799,14 @@ public class JSONObject {
* is no such key or if the value is not a number. If the value is a string,
* an attempt will be made to evaluate it as a number.
*
- * @param key
- * A key string.
- * @param defaultValue
- * The default.
+ * @param key A key string.
+ * @param defaultValue The default.
* @return An object which is the value.
*/
public int optInt(final String key, final int defaultValue) {
try {
return this.getInt(key);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -897,8 +815,7 @@ public class JSONObject {
* Get an optional JSONArray associated with a key. It returns null if there
* is no such key, or if its value is not a JSONArray.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A JSONArray which is the value.
*/
public JSONArray optJSONArray(final String key) {
@@ -910,8 +827,7 @@ public class JSONObject {
* Get an optional JSONObject associated with a key. It returns null if
* there is no such key, or if its value is not a JSONObject.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A JSONObject which is the value.
*/
public JSONObject optJSONObject(final String key) {
@@ -924,8 +840,7 @@ public class JSONObject {
* such key or if the value is not a number. If the value is a string, an
* attempt will be made to evaluate it as a number.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return An object which is the value.
*/
public long optLong(final String key) {
@@ -937,17 +852,14 @@ public class JSONObject {
* is no such key or if the value is not a number. If the value is a string,
* an attempt will be made to evaluate it as a number.
*
- * @param key
- * A key string.
- * @param defaultValue
- * The default.
+ * @param key A key string.
+ * @param defaultValue The default.
* @return An object which is the value.
*/
public long optLong(final String key, final long defaultValue) {
try {
return this.getLong(key);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return defaultValue;
}
}
@@ -957,8 +869,7 @@ public class JSONObject {
* if there is no such key. If the value is not a string and is not null,
* then it is converted to a string.
*
- * @param key
- * A key string.
+ * @param key A key string.
* @return A string which is the value.
*/
public String optString(final String key) {
@@ -969,10 +880,8 @@ public class JSONObject {
* Get an optional string associated with a key. It returns the defaultValue
* if there is no such key.
*
- * @param key
- * A key string.
- * @param defaultValue
- * The default.
+ * @param key A key string.
+ * @param defaultValue The default.
* @return A string which is the value.
*/
public String optString(final String key, final String defaultValue) {
@@ -996,19 +905,16 @@ public class JSONObject {
if (name.startsWith("get")) {
if ("getClass".equals(name) || "getDeclaringClass".equals(name)) {
key = "";
- }
- else {
+ } else {
key = name.substring(3);
}
- }
- else if (name.startsWith("is")) {
+ } else if (name.startsWith("is")) {
key = name.substring(2);
}
if ((key.length() > 0) && Character.isUpperCase(key.charAt(0)) && (method.getParameterTypes().length == 0)) {
if (key.length() == 1) {
key = key.toLowerCase();
- }
- else if (!Character.isUpperCase(key.charAt(1))) {
+ } else if (!Character.isUpperCase(key.charAt(1))) {
key = key.substring(0, 1).toLowerCase() + key.substring(1);
}
@@ -1018,8 +924,7 @@ public class JSONObject {
}
}
}
- }
- catch (final Exception ignore) {
+ } catch (final Exception ignore) {
}
}
}
@@ -1027,13 +932,10 @@ public class JSONObject {
/**
* Put a key/boolean pair in the JSONObject.
*
- * @param key
- * A key string.
- * @param value
- * A boolean which is the value.
+ * @param key A key string.
+ * @param value A boolean which is the value.
* @return this.
- * @throws JSONException
- * If the key is null.
+ * @throws JSONException If the key is null.
*/
public JSONObject put(final String key, final boolean value) throws JSONException {
this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
@@ -1044,10 +946,8 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, where the value will be a
* JSONArray which is produced from a Collection.
*
- * @param key
- * A key string.
- * @param value
- * A Collection value.
+ * @param key A key string.
+ * @param value A Collection value.
* @return this.
* @throws JSONException
*/
@@ -1059,13 +959,10 @@ public class JSONObject {
/**
* Put a key/double pair in the JSONObject.
*
- * @param key
- * A key string.
- * @param value
- * A double which is the value.
+ * @param key A key string.
+ * @param value A double which is the value.
* @return this.
- * @throws JSONException
- * If the key is null or if the number is invalid.
+ * @throws JSONException If the key is null or if the number is invalid.
*/
public JSONObject put(final String key, final double value) throws JSONException {
this.put(key, new Double(value));
@@ -1075,13 +972,10 @@ public class JSONObject {
/**
* Put a key/int pair in the JSONObject.
*
- * @param key
- * A key string.
- * @param value
- * An int which is the value.
+ * @param key A key string.
+ * @param value An int which is the value.
* @return this.
- * @throws JSONException
- * If the key is null.
+ * @throws JSONException If the key is null.
*/
public JSONObject put(final String key, final int value) throws JSONException {
this.put(key, new Integer(value));
@@ -1091,13 +985,10 @@ public class JSONObject {
/**
* Put a key/long pair in the JSONObject.
*
- * @param key
- * A key string.
- * @param value
- * A long which is the value.
+ * @param key A key string.
+ * @param value A long which is the value.
* @return this.
- * @throws JSONException
- * If the key is null.
+ * @throws JSONException If the key is null.
*/
public JSONObject put(final String key, final long value) throws JSONException {
this.put(key, new Long(value));
@@ -1108,10 +999,8 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, where the value will be a
* JSONObject which is produced from a Map.
*
- * @param key
- * A key string.
- * @param value
- * A Map value.
+ * @param key A key string.
+ * @param value A Map value.
* @return this.
* @throws JSONException
*/
@@ -1124,15 +1013,12 @@ public class JSONObject {
* Put a key/value pair in the JSONObject. If the value is null, then the
* key will be removed from the JSONObject if it is present.
*
- * @param key
- * A key string.
- * @param value
- * An object which is the value. It should be of one of these
- * types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
- * String, or the JSONObject.NULL object.
+ * @param key A key string.
+ * @param value An object which is the value. It should be of one of these
+ * types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
+ * String, or the JSONObject.NULL object.
* @return this.
- * @throws JSONException
- * If the value is non-finite number or if the key is null.
+ * @throws JSONException If the value is non-finite number or if the key is null.
*/
public JSONObject put(final String key, final Object value) throws JSONException {
if (key == null) {
@@ -1141,8 +1027,7 @@ public class JSONObject {
if (value != null) {
testValidity(value);
this.map.put(key, value);
- }
- else {
+ } else {
this.remove(key);
}
return this;
@@ -1153,13 +1038,10 @@ public class JSONObject {
* are both non-null, and only if there is not already a member with that
* name.
*
- * @param key
- * string
- * @param value
- * object
+ * @param key string
+ * @param value object
* @return this.
- * @throws JSONException
- * if the key is a duplicate
+ * @throws JSONException if the key is a duplicate
*/
public JSONObject putOnce(final String key, final Object value) throws JSONException {
if ((key != null) && (value != null)) {
@@ -1175,15 +1057,12 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, but only if the key and the value
* are both non-null.
*
- * @param key
- * A key string.
- * @param value
- * An object which is the value. It should be of one of these
- * types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
- * String, or the JSONObject.NULL object.
+ * @param key A key string.
+ * @param value An object which is the value. It should be of one of these
+ * types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
+ * String, or the JSONObject.NULL object.
* @return this.
- * @throws JSONException
- * If the value is a non-finite number.
+ * @throws JSONException If the value is a non-finite number.
*/
public JSONObject putOpt(final String key, final Object value) throws JSONException {
if ((key != null) && (value != null)) {
@@ -1198,8 +1077,7 @@ public class JSONObject {
* allowing JSON text to be delivered in HTML. In JSON text, a string cannot
* contain a control character or an unescaped quote or backslash.
*
- * @param string
- * A String
+ * @param string A String
* @return A String correctly formatted for insertion in a JSON text.
*/
public static String quote(final String string) {
@@ -1207,8 +1085,7 @@ public class JSONObject {
synchronized (sw.getBuffer()) {
try {
return quote(string, sw).toString();
- }
- catch (final IOException ignored) {
+ } catch (final IOException ignored) {
// will never happen - we are writing to a string writer
return "";
}
@@ -1264,8 +1141,7 @@ public class JSONObject {
hhhh = Integer.toHexString(c);
w.write("0000", 0, 4 - hhhh.length());
w.write(hhhh);
- }
- else {
+ } else {
w.write(c);
}
}
@@ -1277,10 +1153,9 @@ public class JSONObject {
/**
* Remove a name and its value, if present.
*
- * @param key
- * The name to be removed.
+ * @param key The name to be removed.
* @return The value that was associated with the name, or null if there was
- * no value.
+ * no value.
*/
public Object remove(final String key) {
return this.map.remove(key);
@@ -1291,8 +1166,7 @@ public class JSONObject {
* They must contain the same set of names which must be associated with
* similar values.
*
- * @param other
- * The other JSONObject
+ * @param other The other JSONObject
* @return true if they are equal
*/
public boolean similar(final Object other) {
@@ -1313,19 +1187,16 @@ public class JSONObject {
if (!((JSONObject) valueThis).similar(valueOther)) {
return false;
}
- }
- else if (valueThis instanceof JSONArray) {
+ } else if (valueThis instanceof JSONArray) {
if (!((JSONArray) valueThis).similar(valueOther)) {
return false;
}
- }
- else if (!valueThis.equals(valueOther)) {
+ } else if (!valueThis.equals(valueOther)) {
return false;
}
}
return true;
- }
- catch (final Throwable exception) {
+ } catch (final Throwable exception) {
return false;
}
}
@@ -1334,8 +1205,7 @@ public class JSONObject {
* Try to convert a string into a number, boolean, or null. If the string
* can't be converted, return the string.
*
- * @param string
- * A String.
+ * @param string A String.
* @return A simple JSON value.
*/
public static Object stringToValue(final String string) {
@@ -1366,20 +1236,17 @@ public class JSONObject {
if (!d.isInfinite() && !d.isNaN()) {
return d;
}
- }
- else {
+ } else {
final Long myLong = new Long(string);
if (string.equals(myLong.toString())) {
if (myLong == myLong.intValue()) {
return myLong.intValue();
- }
- else {
+ } else {
return myLong;
}
}
}
- }
- catch (final Exception ignore) {
+ } catch (final Exception ignore) {
}
}
return string;
@@ -1388,10 +1255,8 @@ public class JSONObject {
/**
* Throw an exception if the object is a NaN or infinite number.
*
- * @param o
- * The object to test.
- * @throws JSONException
- * If o is a non-finite number.
+ * @param o The object to test.
+ * @throws JSONException If o is a non-finite number.
*/
public static void testValidity(final Object o) throws JSONException {
if (o != null) {
@@ -1399,8 +1264,7 @@ public class JSONObject {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException("JSON does not allow non-finite numbers.");
}
- }
- else if (o instanceof Float) {
+ } else if (o instanceof Float) {
if (((Float) o).isInfinite() || ((Float) o).isNaN()) {
throw new JSONException("JSON does not allow non-finite numbers.");
}
@@ -1412,12 +1276,10 @@ public class JSONObject {
* Produce a JSONArray containing the values of the members of this
* JSONObject.
*
- * @param names
- * A JSONArray containing a list of key strings. This determines
- * the sequence of the values in the result.
+ * @param names A JSONArray containing a list of key strings. This determines
+ * the sequence of the values in the result.
* @return A JSONArray of values.
- * @throws JSONException
- * If any of the values are non-finite numbers.
+ * @throws JSONException If any of the values are non-finite numbers.
*/
public JSONArray toJSONArray(final JSONArray names) throws JSONException {
if ((names == null) || (names.length() == 0)) {
@@ -1434,37 +1296,34 @@ public class JSONObject {
* Make a JSON text of this JSONObject. For compactness, no whitespace is
* added. If this would not result in a syntactically correct JSON text,
* then null will be returned instead.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
* @return a printable, displayable, portable, transmittable representation
- * of the object, beginning with {
(left
- * brace) and ending with }
(right
- * brace) .
+ * of the object, beginning with {
(left
+ * brace) and ending with }
(right
+ * brace) .
*/
@Override
public String toString() {
try {
return this.toString(0);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return null;
}
}
/**
* Make a prettyprinted JSON text of this JSONObject.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
- * @param indentFactor
- * The number of spaces to add to each level of indentation.
+ * @param indentFactor The number of spaces to add to each level of indentation.
* @return a printable, displayable, portable, transmittable representation
- * of the object, beginning with {
(left
- * brace) and ending with }
(right
- * brace) .
- * @throws JSONException
- * If the object contains an invalid number.
+ * of the object, beginning with {
(left
+ * brace) and ending with }
(right
+ * brace) .
+ * @throws JSONException If the object contains an invalid number.
*/
public String toString(final int indentFactor) throws JSONException {
final StringWriter w = new StringWriter();
@@ -1484,18 +1343,16 @@ public class JSONObject {
* JSONObject will be made from it and its toJSONString method will be
* called. Otherwise, the value's toString method will be called, and the
* result will be quoted.
- *
- *
+ *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
- * @param value
- * The value to be serialized.
+ * @param value The value to be serialized.
* @return a printable, displayable, transmittable representation of the
- * object, beginning with {
(left
- * brace) and ending with }
(right
- * brace) .
- * @throws JSONException
- * If the value is or contains an invalid number.
+ * object, beginning with {
(left
+ * brace) and ending with }
(right
+ * brace) .
+ * @throws JSONException If the value is or contains an invalid number.
*/
public static String valueToString(final Object value) throws JSONException {
if ((value == null) || value.equals(null)) {
@@ -1505,8 +1362,7 @@ public class JSONObject {
Object object;
try {
object = ((JSONString) value).toJSONString();
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException(e);
}
if (object instanceof String) {
@@ -1540,8 +1396,7 @@ public class JSONObject {
* one of the java packages, turn it into a string. And if it doesn't, try
* to wrap it in a JSONObject. If the wrapping fails, then null is returned.
*
- * @param object
- * The object to wrap
+ * @param object The object to wrap
* @return The wrapped value
*/
public static Object wrap(final Object object) {
@@ -1568,8 +1423,7 @@ public class JSONObject {
return object.toString();
}
return new JSONObject(object);
- }
- catch (final Exception exception) {
+ } catch (final Exception exception) {
return null;
}
}
@@ -1577,7 +1431,7 @@ public class JSONObject {
/**
* Write the contents of the JSONObject as JSON text to a writer. For
* compactness, no whitespace is added.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
@@ -1590,39 +1444,29 @@ public class JSONObject {
static final Writer writeValue(final Writer writer, final Object value, final int indentFactor, final int indent) throws JSONException, IOException {
if ((value == null) || value.equals(null)) {
writer.write("null");
- }
- else if (value instanceof JSONObject) {
+ } else if (value instanceof JSONObject) {
((JSONObject) value).write(writer, indentFactor, indent);
- }
- else if (value instanceof JSONArray) {
+ } else if (value instanceof JSONArray) {
((JSONArray) value).write(writer, indentFactor, indent);
- }
- else if (value instanceof Map) {
+ } else if (value instanceof Map) {
new JSONObject((Map) value).write(writer, indentFactor, indent);
- }
- else if (value instanceof Collection) {
+ } else if (value instanceof Collection) {
new JSONArray((Collection) value).write(writer, indentFactor, indent);
- }
- else if (value.getClass().isArray()) {
+ } else if (value.getClass().isArray()) {
new JSONArray(value).write(writer, indentFactor, indent);
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
writer.write(numberToString((Number) value));
- }
- else if (value instanceof Boolean) {
+ } else if (value instanceof Boolean) {
writer.write(value.toString());
- }
- else if (value instanceof JSONString) {
+ } else if (value instanceof JSONString) {
Object o;
try {
o = ((JSONString) value).toJSONString();
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new JSONException(e);
}
writer.write(o != null ? o.toString() : quote(value.toString()));
- }
- else {
+ } else {
quote(value.toString(), writer);
}
return writer;
@@ -1637,7 +1481,7 @@ public class JSONObject {
/**
* Write the contents of the JSONObject as JSON text to a writer. For
* compactness, no whitespace is added.
- *
+ *
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
@@ -1658,8 +1502,7 @@ public class JSONObject {
writer.write(' ');
}
writeValue(writer, this.map.get(key), indentFactor, indent);
- }
- else if (length != 0) {
+ } else if (length != 0) {
final int newindent = indent + indentFactor;
while (keys.hasNext()) {
final Object key = keys.next();
@@ -1685,8 +1528,7 @@ public class JSONObject {
}
writer.write('}');
return writer;
- }
- catch (final IOException exception) {
+ } catch (final IOException exception) {
throw new JSONException(exception);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONStringer.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONStringer.java
index 4e6160aac..cf11e329d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONStringer.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONStringer.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2006 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.io.StringWriter;
/**
@@ -31,7 +28,7 @@ import java.io.StringWriter;
* The texts produced strictly conform to JSON syntax rules. No whitespace is
* added, so the results are ready for transmission or storage. Each instance of
* JSONStringer can produce one JSON text.
- *
+ *
* A JSONStringer instance provides a value
method for appending
* values to the text, and a key
method for adding keys before
* values in objects. There are array
and endArray
@@ -39,21 +36,21 @@ import java.io.StringWriter;
* endObject
methods which make and bound object values. All of
* these methods return the JSONWriter instance, permitting cascade style. For
* example,
- *
+ *
*
* myString = new JSONStringer().object().key("JSON").value("Hello, World!").endObject().toString();
*
- *
+ *
* which produces the string
- *
+ *
*
* {"JSON":"Hello, World!"}
*
- *
+ *
* The first method called must be array
or object
.
* There are no methods for adding commas or colons. JSONStringer adds them for
* you. Objects and arrays can be nested up to 20 levels deep.
- *
+ *
* This can sometimes be easier than using a JSONObject to build a string.
*
* @author JSON.org
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONTokener.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONTokener.java
index aae93fbf2..74b86dfe5 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONTokener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONTokener.java
@@ -1,35 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
+import java.io.*;
/**
* A JSONTokener takes a source string and extracts characters and tokens from
@@ -41,19 +33,18 @@ import java.io.StringReader;
*/
public class JSONTokener {
- private long character;
- private boolean eof;
- private long index;
- private long line;
- private char previous;
+ private long character;
+ private boolean eof;
+ private long index;
+ private long line;
+ private char previous;
private final Reader reader;
- private boolean usePrevious;
+ private boolean usePrevious;
/**
* Construct a JSONTokener from a Reader.
*
- * @param reader
- * A reader.
+ * @param reader A reader.
*/
public JSONTokener(final Reader reader) {
this.reader = reader.markSupported() ? reader : new BufferedReader(reader);
@@ -68,8 +59,7 @@ public class JSONTokener {
/**
* Construct a JSONTokener from an InputStream.
*
- * @param inputStream
- * The source.
+ * @param inputStream The source.
*/
public JSONTokener(final InputStream inputStream) throws JSONException {
this(new InputStreamReader(inputStream));
@@ -78,8 +68,7 @@ public class JSONTokener {
/**
* Construct a JSONTokener from a string.
*
- * @param s
- * A source string.
+ * @param s A source string.
*/
public JSONTokener(final String s) {
this(new StringReader(s));
@@ -103,9 +92,8 @@ public class JSONTokener {
/**
* Get the hex value of a character (base16).
*
- * @param c
- * A character between '0' and '9' or between 'A' and 'F' or
- * between 'a' and 'f'.
+ * @param c A character between '0' and '9' or between 'A' and 'F' or
+ * between 'a' and 'f'.
* @return An int between 0 and 15, or -1 if c was not a hex digit.
*/
public static int dehexchar(final char c) {
@@ -150,12 +138,10 @@ public class JSONTokener {
if (this.usePrevious) {
this.usePrevious = false;
c = this.previous;
- }
- else {
+ } else {
try {
c = this.reader.read();
- }
- catch (final IOException exception) {
+ } catch (final IOException exception) {
throw new JSONException(exception);
}
@@ -168,12 +154,10 @@ public class JSONTokener {
if (this.previous == '\r') {
this.line += 1;
this.character = c == '\n' ? 0 : 1;
- }
- else if (c == '\n') {
+ } else if (c == '\n') {
this.line += 1;
this.character = 0;
- }
- else {
+ } else {
this.character += 1;
}
this.previous = (char) c;
@@ -184,11 +168,9 @@ public class JSONTokener {
* Consume the next character, and check that it matches a specified
* character.
*
- * @param c
- * The character to match.
+ * @param c The character to match.
* @return The character.
- * @throws JSONException
- * if the character does not match.
+ * @throws JSONException if the character does not match.
*/
public char next(final char c) throws JSONException {
final char n = this.next();
@@ -201,12 +183,10 @@ public class JSONTokener {
/**
* Get the next n characters.
*
- * @param n
- * The number of characters to take.
+ * @param n The number of characters to take.
* @return A string of n characters.
- * @throws JSONException
- * Substring bounds error if there are not
- * n characters remaining in the source string.
+ * @throws JSONException Substring bounds error if there are not
+ * n characters remaining in the source string.
*/
public String next(final int n) throws JSONException {
if (n == 0) {
@@ -229,11 +209,11 @@ public class JSONTokener {
/**
* Get the next char in the string, skipping whitespace.
*
- * @throws JSONException
* @return A character, or 0 if there are no more characters.
+ * @throws JSONException
*/
public char nextClean() throws JSONException {
- for (;;) {
+ for (; ; ) {
final char c = this.next();
if ((c == 0) || (c > ' ')) {
return c;
@@ -247,18 +227,16 @@ public class JSONTokener {
* allow strings in single quotes, but an implementation is allowed to
* accept them.
*
- * @param quote
- * The quoting character, either "
- * (double quote) or '
- * (single quote) .
+ * @param quote The quoting character, either "
+ * (double quote) or '
+ * (single quote) .
* @return A String.
- * @throws JSONException
- * Unterminated string.
+ * @throws JSONException Unterminated string.
*/
public String nextString(final char quote) throws JSONException {
char c;
final StringBuilder sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
c = this.next();
switch (c) {
case 0:
@@ -309,13 +287,12 @@ public class JSONTokener {
* Get the text up but not including the specified character or the
* end of line, whichever comes first.
*
- * @param delimiter
- * A delimiter character.
+ * @param delimiter A delimiter character.
* @return A string.
*/
public String nextTo(final char delimiter) throws JSONException {
final StringBuilder sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
final char c = this.next();
if ((c == delimiter) || (c == 0) || (c == '\n') || (c == '\r')) {
if (c != 0) {
@@ -331,14 +308,13 @@ public class JSONTokener {
* Get the text up but not including one of the specified delimiter
* characters or the end of line, whichever comes first.
*
- * @param delimiters
- * A set of delimiter characters.
+ * @param delimiters A set of delimiter characters.
* @return A string, trimmed.
*/
public String nextTo(final String delimiters) throws JSONException {
char c;
final StringBuilder sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
c = this.next();
if ((delimiters.indexOf(c) >= 0) || (c == 0) || (c == '\n') || (c == '\r')) {
if (c != 0) {
@@ -354,10 +330,8 @@ public class JSONTokener {
* Get the next value. The value can be a Boolean, Double, Integer,
* JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
*
- * @throws JSONException
- * If syntax error.
- *
* @return An object.
+ * @throws JSONException If syntax error.
*/
public Object nextValue() throws JSONException {
char c = this.nextClean();
@@ -401,10 +375,9 @@ public class JSONTokener {
* Skip characters until the next character is the requested character.
* If the requested character is not found, no characters are skipped.
*
- * @param to
- * A character to skip to.
+ * @param to A character to skip to.
* @return The requested character, or zero if the requested character
- * is not found.
+ * is not found.
*/
public char skipTo(final char to) throws JSONException {
char c;
@@ -424,8 +397,7 @@ public class JSONTokener {
}
}
while (c != to);
- }
- catch (final IOException exception) {
+ } catch (final IOException exception) {
throw new JSONException(exception);
}
this.back();
@@ -435,8 +407,7 @@ public class JSONTokener {
/**
* Make a JSONException to signal a syntax error.
*
- * @param message
- * The error message.
+ * @param message The error message.
* @return A JSONException object, suitable for throwing
*/
public JSONException syntaxError(final String message) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONWriter.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONWriter.java
index e08702cce..ce8a44565 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONWriter.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/JSONWriter.java
@@ -1,38 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
import java.io.IOException;
import java.io.Writer;
-/*
- Copyright (c) 2006 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* JSONWriter provides a quick and convenient way of producing JSON text.
* The texts produced strictly conform to JSON syntax rules. No whitespace is
* added, so the results are ready for transmission or storage. Each instance of
* JSONWriter can produce one JSON text.
- *
+ *
* A JSONWriter instance provides a value
method for appending
* values to the text, and a key
method for adding keys before
* values in objects. There are array
and endArray
@@ -40,21 +37,21 @@ import java.io.Writer;
* endObject
methods which make and bound object values. All of
* these methods return the JSONWriter instance, permitting a cascade style. For
* example,
- *
+ *
*
* new JSONWriter(myWriter).object().key("JSON").value("Hello, World!").endObject();
*
- *
+ *
* which writes
- *
+ *
*
* {"JSON":"Hello, World!"}
*
- *
+ *
* The first method called must be array
or object
.
* There are no methods for adding commas or colons. JSONWriter adds them for
* you. Objects and arrays can be nested up to 20 levels deep.
- *
+ *
* This can sometimes be easier than using a JSONObject to build a string.
*
* @author JSON.org
@@ -67,7 +64,7 @@ public class JSONWriter {
* The comma flag determines if a comma should be output before the next
* value.
*/
- private boolean comma;
+ private boolean comma;
/**
* The current mode. Values:
@@ -77,7 +74,7 @@ public class JSONWriter {
* 'k' (key),
* 'o' (object).
*/
- protected char mode;
+ protected char mode;
/**
* The object/array stack.
@@ -87,12 +84,12 @@ public class JSONWriter {
/**
* The stack top index. A value of 0 indicates that the stack is empty.
*/
- private int top;
+ private int top;
/**
* The writer that will receive the output.
*/
- protected Writer writer;
+ protected Writer writer;
/**
* Make a fresh JSONWriter. It can be used to build one JSON text.
@@ -108,11 +105,9 @@ public class JSONWriter {
/**
* Append a value.
*
- * @param string
- * A string value.
+ * @param string A string value.
* @return this
- * @throws JSONException
- * If the value is out of sequence.
+ * @throws JSONException If the value is out of sequence.
*/
private JSONWriter append(final String string) throws JSONException {
if (string == null) {
@@ -124,8 +119,7 @@ public class JSONWriter {
this.writer.write(',');
}
this.writer.write(string);
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
@@ -143,11 +137,10 @@ public class JSONWriter {
* endArray
method must be called to mark the array's end.
*
* @return this
- * @throws JSONException
- * If the nesting is too deep, or if the object is
- * started in the wrong place (for example as a key or after the
- * end of the
- * outermost array or object).
+ * @throws JSONException If the nesting is too deep, or if the object is
+ * started in the wrong place (for example as a key or after the
+ * end of the
+ * outermost array or object).
*/
public JSONWriter array() throws JSONException {
if ((this.mode == 'i') || (this.mode == 'o') || (this.mode == 'a')) {
@@ -162,13 +155,10 @@ public class JSONWriter {
/**
* End something.
*
- * @param mode
- * Mode
- * @param c
- * Closing character
+ * @param mode Mode
+ * @param c Closing character
* @return this
- * @throws JSONException
- * If unbalanced.
+ * @throws JSONException If unbalanced.
*/
private JSONWriter end(final char mode, final char c) throws JSONException {
if (this.mode != mode) {
@@ -177,8 +167,7 @@ public class JSONWriter {
this.pop(mode);
try {
this.writer.write(c);
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
throw new JSONException(e);
}
this.comma = true;
@@ -190,8 +179,7 @@ public class JSONWriter {
* array
.
*
* @return this
- * @throws JSONException
- * If incorrectly nested.
+ * @throws JSONException If incorrectly nested.
*/
public JSONWriter endArray() throws JSONException {
return this.end('a', ']');
@@ -202,8 +190,7 @@ public class JSONWriter {
* object
.
*
* @return this
- * @throws JSONException
- * If incorrectly nested.
+ * @throws JSONException If incorrectly nested.
*/
public JSONWriter endObject() throws JSONException {
return this.end('k', '}');
@@ -213,12 +200,10 @@ public class JSONWriter {
* Append a key. The key will be associated with the next value. In an
* object, every value must be preceded by a key.
*
- * @param string
- * A key string.
+ * @param string A key string.
* @return this
- * @throws JSONException
- * If the key is out of place. For example, keys
- * do not belong in arrays or if the key is null.
+ * @throws JSONException If the key is out of place. For example, keys
+ * do not belong in arrays or if the key is null.
*/
public JSONWriter key(final String string) throws JSONException {
if (string == null) {
@@ -235,8 +220,7 @@ public class JSONWriter {
this.comma = false;
this.mode = 'o';
return this;
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
throw new JSONException(e);
}
}
@@ -249,11 +233,10 @@ public class JSONWriter {
* endObject
method must be called to mark the object's end.
*
* @return this
- * @throws JSONException
- * If the nesting is too deep, or if the object is
- * started in the wrong place (for example as a key or after the
- * end of the
- * outermost array or object).
+ * @throws JSONException If the nesting is too deep, or if the object is
+ * started in the wrong place (for example as a key or after the
+ * end of the
+ * outermost array or object).
*/
public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
@@ -272,10 +255,8 @@ public class JSONWriter {
/**
* Pop an array or object scope.
*
- * @param c
- * The scope to close.
- * @throws JSONException
- * If nesting is wrong.
+ * @param c The scope to close.
+ * @throws JSONException If nesting is wrong.
*/
private void pop(final char c) throws JSONException {
if (this.top <= 0) {
@@ -292,10 +273,8 @@ public class JSONWriter {
/**
* Push an array or object scope.
*
- * @param jo
- * The scope to open.
- * @throws JSONException
- * If nesting is too deep.
+ * @param jo The scope to open.
+ * @throws JSONException If nesting is too deep.
*/
private void push(final JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
@@ -310,8 +289,7 @@ public class JSONWriter {
* Append either the value true
or the value false
* .
*
- * @param b
- * A boolean.
+ * @param b A boolean.
* @return this
* @throws JSONException
*/
@@ -322,11 +300,9 @@ public class JSONWriter {
/**
* Append a double value.
*
- * @param d
- * A double.
+ * @param d A double.
* @return this
- * @throws JSONException
- * If the number is not finite.
+ * @throws JSONException If the number is not finite.
*/
public JSONWriter value(final double d) throws JSONException {
return this.value(new Double(d));
@@ -335,8 +311,7 @@ public class JSONWriter {
/**
* Append a long value.
*
- * @param l
- * A long.
+ * @param l A long.
* @return this
* @throws JSONException
*/
@@ -347,13 +322,11 @@ public class JSONWriter {
/**
* Append an object value.
*
- * @param object
- * The object to append. It can be null, or a Boolean, Number,
- * String, JSONObject, or JSONArray, or an object that implements
- * JSONString.
+ * @param object The object to append. It can be null, or a Boolean, Number,
+ * String, JSONObject, or JSONArray, or an object that implements
+ * JSONString.
* @return this
- * @throws JSONException
- * If the value is out of sequence.
+ * @throws JSONException If the value is out of sequence.
*/
public JSONWriter value(final Object object) throws JSONException {
return this.append(JSONObject.valueToString(object));
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/Kim.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/Kim.java
index 825421f7b..001136dc6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/Kim.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/Kim.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2013 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* Kim makes immutable eight bit Unicode strings. If the MSB of a byte is set,
* then the next byte is a continuation byte. The last byte of a character
@@ -31,16 +28,16 @@ package com.intellectualcrafters.json;
* set. Kim stands for "Keep it minimal". A Unicode character is never longer
* than 3 bytes. Every byte contributes 7 bits to the character. ASCII is
* unmodified.
- *
+ *
* Kim UTF-8
* one byte U+007F U+007F
* two bytes U+3FFF U+07FF
* three bytes U+10FFF U+FFFF
* four bytes U+10FFFF
- *
+ *
* Characters in the ranges U+0800..U+3FFF and U+10000..U+10FFFF will be one
* byte smaller when encoded in Kim compared to UTF-8.
- *
+ *
* Kim is beneficial when using scripts such as Old South Arabian, Aramaic,
* Avestan, Balinese, Batak, Bopomofo, Buginese, Buhid, Carian, Cherokee,
* Coptic, Cyrillic, Deseret, Egyptian Hieroglyphs, Ethiopic, Georgian,
@@ -50,10 +47,10 @@ package com.intellectualcrafters.json;
* Ol Chiki, Old Turkic, Oriya, Osmanya, Pahlavi, Parthian, Phags-Pa,
* Phoenician, Samaritan, Sharada, Sinhala, Sora Sompeng, Tagalog, Tagbanwa,
* Takri, Tai Le, Tai Tham, Tamil, Telugu, Thai, Tibetan, Tifinagh, UCAS.
- *
+ *
* A kim object can be constructed from an ordinary UTF-16 string, or from a
* byte array. A kim object can produce a UTF-16 string.
- *
+ *
* As with UTF-8, it is possible to detect character boundaries within a byte
* sequence. UTF-8 is one of the world's great inventions. While Kim is more
* efficient, it is not clear that it is worth the expense of transition.
@@ -65,33 +62,30 @@ public class Kim {
/**
* The byte array containing the kim's content.
*/
- private byte[] bytes = null;
+ private byte[] bytes = null;
/**
* The kim's hashcode, conforming to Java's hashcode conventions.
*/
- private int hashcode = 0;
+ private int hashcode = 0;
/**
* The number of bytes in the kim. The number of bytes can be as much as
* three times the number of characters.
*/
- public int length = 0;
+ public int length = 0;
/**
* The memoization of toString().
*/
- private String string = null;
+ private String string = null;
/**
* Make a kim from a portion of a byte array.
*
- * @param bytes
- * A byte array.
- * @param from
- * The index of the first byte.
- * @param thru
- * The index of the last byte plus one.
+ * @param bytes A byte array.
+ * @param from The index of the first byte.
+ * @param thru The index of the last byte plus one.
*/
public Kim(final byte[] bytes, final int from, final int thru) {
@@ -118,10 +112,8 @@ public class Kim {
/**
* Make a kim from a byte array.
*
- * @param bytes
- * The byte array.
- * @param length
- * The number of bytes.
+ * @param bytes The byte array.
+ * @param length The number of bytes.
*/
public Kim(final byte[] bytes, final int length) {
this(bytes, 0, length);
@@ -131,12 +123,9 @@ public class Kim {
* Make a new kim from a substring of an existing kim. The coordinates are
* in byte units, not character units.
*
- * @param kim
- * The source of bytes.
- * @param from
- * The point at which to take bytes.
- * @param thru
- * The point at which to stop taking bytes.
+ * @param kim The source of bytes.
+ * @param from The point at which to take bytes.
+ * @param thru The point at which to stop taking bytes.
*/
public Kim(final Kim kim, final int from, final int thru) {
this(kim.bytes, from, thru);
@@ -145,10 +134,8 @@ public class Kim {
/**
* Make a kim from a string.
*
- * @param string
- * The string.
- * @throws JSONException
- * if surrogate pair mismatch.
+ * @param string The string.
+ * @throws JSONException if surrogate pair mismatch.
*/
public Kim(final String string) throws JSONException {
final int stringLength = string.length();
@@ -163,11 +150,9 @@ public class Kim {
final int c = string.charAt(i);
if (c <= 0x7F) {
this.length += 1;
- }
- else if (c <= 0x3FFF) {
+ } else if (c <= 0x3FFF) {
this.length += 2;
- }
- else {
+ } else {
if ((c >= 0xD800) && (c <= 0xDFFF)) {
i += 1;
final int d = string.charAt(i);
@@ -194,8 +179,7 @@ public class Kim {
sum += character;
this.hashcode += sum;
at += 1;
- }
- else if (character <= 0x3FFF) {
+ } else if (character <= 0x3FFF) {
b = 0x80 | (character >>> 7);
this.bytes[at] = (byte) b;
sum += b;
@@ -206,8 +190,7 @@ public class Kim {
sum += b;
this.hashcode += sum;
at += 1;
- }
- else {
+ } else {
if ((character >= 0xD800) && (character <= 0xDBFF)) {
i += 1;
character = (((character & 0x3FF) << 10) | (string.charAt(i) & 0x3FF)) + 65536;
@@ -238,11 +221,9 @@ public class Kim {
* values and ranges from 0 to length - 1. The index of the next character
* is at index + Kim.characterSize(kim.characterAt(index)).
*
- * @param at
- * the index of the char value. The first character is at 0.
+ * @param at the index of the char value. The first character is at 0.
+ * @throws JSONException if at does not point to a valid character.
* @returns a Unicode character between 0 and 0x10FFFF.
- * @throws JSONException
- * if at does not point to a valid character.
*/
public int characterAt(final int at) throws JSONException {
final int c = get(at);
@@ -256,8 +237,7 @@ public class Kim {
if (character > 0x7F) {
return character;
}
- }
- else {
+ } else {
final int c2 = get(at + 2);
character = ((c & 0x7F) << 14) | ((c1 & 0x7F) << 7) | c2;
if (((c2 & 0x80) == 0) && (character > 0x3FFF) && (character <= 0x10FFFF) && ((character < 0xD800) || (character > 0xDFFF))) {
@@ -271,11 +251,9 @@ public class Kim {
* Returns the number of bytes needed to contain the character in Kim
* format.
*
- * @param character
- * a Unicode character between 0 and 0x10FFFF.
+ * @param character a Unicode character between 0 and 0x10FFFF.
* @return 1, 2, or 3
- * @throws JSONException
- * if the character is not representable in a kim.
+ * @throws JSONException if the character is not representable in a kim.
*/
public static int characterSize(final int character) throws JSONException {
if ((character < 0) || (character > 0x10FFFF)) {
@@ -287,10 +265,8 @@ public class Kim {
/**
* Copy the contents of this kim to a byte array.
*
- * @param bytes
- * A byte array of sufficient size.
- * @param at
- * The position within the byte array to take the byes.
+ * @param bytes A byte array of sufficient size.
+ * @param at The position within the byte array to take the byes.
* @return The position immediately after the copy.
*/
public int copy(final byte[] bytes, final int at) {
@@ -302,10 +278,9 @@ public class Kim {
* Two kim objects containing exactly the same bytes in the same order are
* equal to each other.
*
- * @param obj
- * the other kim with which to compare.
+ * @param obj the other kim with which to compare.
* @returns true if this and obj are both kim objects containing identical
- * byte sequences.
+ * byte sequences.
*/
@Override
public boolean equals(final Object obj) {
@@ -325,11 +300,9 @@ public class Kim {
/**
* Get a byte from a kim.
*
- * @param at
- * The position of the byte. The first byte is at 0.
+ * @param at The position of the byte. The first byte is at 0.
* @return The byte.
- * @throws JSONException
- * if there is no byte at that position.
+ * @throws JSONException if there is no byte at that position.
*/
public int get(final int at) throws JSONException {
if ((at < 0) || (at > this.length)) {
@@ -352,8 +325,7 @@ public class Kim {
* it could be less.
*
* @return The string. A kim memoizes its string representation.
- * @throws JSONException
- * if the kim is not valid.
+ * @throws JSONException if the kim is not valid.
*/
@Override
public String toString() throws JSONException {
@@ -366,8 +338,7 @@ public class Kim {
if (c < 0x10000) {
chars[length] = (char) c;
length += 1;
- }
- else {
+ } else {
chars[length] = (char) (0xD800 | ((c - 0x10000) >>> 10));
length += 1;
chars[length] = (char) (0xDC00 | (c & 0x03FF));
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/Property.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/Property.java
index 8b323eec2..d97281ec7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/Property.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/Property.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
@@ -39,8 +36,7 @@ public class Property {
* Converts a property file object into a JSONObject. The property file
* object is a table of name value pairs.
*
- * @param properties
- * java.util.Properties
+ * @param properties java.util.Properties
* @return JSONObject
* @throws JSONException
*/
@@ -59,8 +55,7 @@ public class Property {
/**
* Converts the JSONObject into a property file object.
*
- * @param jo
- * JSONObject
+ * @param jo JSONObject
* @return java.util.Properties
* @throws JSONException
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/XML.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/XML.java
index f74ea5de5..d3b9a7e34 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/XML.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/XML.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
import java.util.Iterator;
/**
@@ -35,36 +32,54 @@ import java.util.Iterator;
*/
public class XML {
- /** The Character '&'. */
- public static final Character AMP = '&';
+ /**
+ * The Character '&'.
+ */
+ public static final Character AMP = '&';
- /** The Character '''. */
- public static final Character APOS = '\'';
+ /**
+ * The Character '''.
+ */
+ public static final Character APOS = '\'';
- /** The Character '!'. */
- public static final Character BANG = '!';
+ /**
+ * The Character '!'.
+ */
+ public static final Character BANG = '!';
- /** The Character '='. */
- public static final Character EQ = '=';
+ /**
+ * The Character '='.
+ */
+ public static final Character EQ = '=';
- /** The Character '>'. */
- public static final Character GT = '>';
+ /**
+ * The Character '>'.
+ */
+ public static final Character GT = '>';
- /** The Character '<'. */
- public static final Character LT = '<';
+ /**
+ * The Character '<'.
+ */
+ public static final Character LT = '<';
- /** The Character '?'. */
+ /**
+ * The Character '?'.
+ */
public static final Character QUEST = '?';
- /** The Character '"'. */
- public static final Character QUOT = '"';
+ /**
+ * The Character '"'.
+ */
+ public static final Character QUOT = '"';
- /** The Character '/'. */
+ /**
+ * The Character '/'.
+ */
public static final Character SLASH = '/';
/**
* Replace special characters with XML escapes:
- *
+ *
*
* & (ampersand) is replaced by &
* < (less than) is replaced by <
@@ -72,8 +87,7 @@ public class XML {
* " (double quote) is replaced by "
*
*
- * @param string
- * The string to be escaped.
+ * @param string The string to be escaped.
* @return The escaped string.
*/
public static String escape(final String string) {
@@ -107,8 +121,7 @@ public class XML {
* Throw an exception if the string contains whitespace.
* Whitespace is not allowed in tagNames and attributes.
*
- * @param string
- * A string.
+ * @param string A string.
* @throws JSONException
*/
public static void noSpace(final String string) throws JSONException {
@@ -127,12 +140,9 @@ public class XML {
/**
* Scan the content following the named tag, attaching it to the context.
*
- * @param x
- * The XMLTokener containing the source string.
- * @param context
- * The JSONObject that will include the new material.
- * @param name
- * The tag name.
+ * @param x The XMLTokener containing the source string.
+ * @param context The JSONObject that will include the new material.
+ * @param name The tag name.
* @return true if the close tag is processed.
* @throws JSONException
*/
@@ -166,8 +176,7 @@ public class XML {
return false;
}
x.back();
- }
- else if (c == '[') {
+ } else if (c == '[') {
token = x.nextToken();
if ("CDATA".equals(token)) {
if (x.next() == '[') {
@@ -185,25 +194,21 @@ public class XML {
token = x.nextMeta();
if (token == null) {
throw x.syntaxError("Missing '>' after ' 0);
return false;
- }
- else if (token == QUEST) {
+ } else if (token == QUEST) {
//
x.skipPast("?>");
return false;
- }
- else if (token == SLASH) {
+ } else if (token == SLASH) {
// Close tag
@@ -219,18 +224,16 @@ public class XML {
}
return true;
- }
- else if (token instanceof Character) {
+ } else if (token instanceof Character) {
throw x.syntaxError("Misshaped tag");
// Open tag <
- }
- else {
+ } else {
tagName = (String) token;
token = null;
jsonobject = new JSONObject();
- for (;;) {
+ for (; ; ) {
if (token == null) {
token = x.nextToken();
}
@@ -247,39 +250,34 @@ public class XML {
}
jsonobject.accumulate(string, XML.stringToValue((String) token));
token = null;
- }
- else {
+ } else {
jsonobject.accumulate(string, "");
}
// Empty tag <.../>
- }
- else if (token == SLASH) {
+ } else if (token == SLASH) {
if (x.nextToken() != GT) {
throw x.syntaxError("Misshaped tag");
}
if (jsonobject.length() > 0) {
context.accumulate(tagName, jsonobject);
- }
- else {
+ } else {
context.accumulate(tagName, "");
}
return false;
// Content, between <...> and
- }
- else if (token == GT) {
- for (;;) {
+ } else if (token == GT) {
+ for (; ; ) {
token = x.nextContent();
if (token == null) {
if (tagName != null) {
throw x.syntaxError("Unclosed tag " + tagName);
}
return false;
- }
- else if (token instanceof String) {
+ } else if (token instanceof String) {
string = (String) token;
if (string.length() > 0) {
jsonobject.accumulate("content", XML.stringToValue(string));
@@ -287,24 +285,20 @@ public class XML {
// Nested element
- }
- else if (token == LT) {
+ } else if (token == LT) {
if (parse(x, jsonobject, tagName)) {
if (jsonobject.length() == 0) {
context.accumulate(tagName, "");
- }
- else if ((jsonobject.length() == 1) && (jsonobject.opt("content") != null)) {
+ } else if ((jsonobject.length() == 1) && (jsonobject.opt("content") != null)) {
context.accumulate(tagName, jsonobject.opt("content"));
- }
- else {
+ } else {
context.accumulate(tagName, jsonobject);
}
return false;
}
}
}
- }
- else {
+ } else {
throw x.syntaxError("Misshaped tag");
}
}
@@ -318,8 +312,7 @@ public class XML {
* convert plus forms, octal forms, hex forms, or E forms lacking decimal
* points.
*
- * @param string
- * A String.
+ * @param string A String.
* @return A simple JSON value.
*/
public static Object stringToValue(final String string) {
@@ -345,15 +338,13 @@ public class XML {
return value;
}
}
- }
- catch (final Exception ignore) {
+ } catch (final Exception ignore) {
try {
final Double value = new Double(string);
if (value.toString().equals(string)) {
return value;
}
- }
- catch (final Exception ignoreAlso) {
+ } catch (final Exception ignoreAlso) {
}
}
return string;
@@ -370,8 +361,7 @@ public class XML {
* text may be placed in a "content" member. Comments, prologs, DTDs, and
* <[ [ ]]>
are ignored.
*
- * @param string
- * The source string.
+ * @param string The source string.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
@@ -387,8 +377,7 @@ public class XML {
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
- * @param object
- * A JSONObject.
+ * @param object A JSONObject.
* @return A string.
* @throws JSONException
*/
@@ -399,10 +388,8 @@ public class XML {
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
- * @param object
- * A JSONObject.
- * @param tagName
- * The optional name of the enclosing tag.
+ * @param object A JSONObject.
+ * @param tagName The optional name of the enclosing tag.
* @return A string.
* @throws JSONException
*/
@@ -450,15 +437,13 @@ public class XML {
}
sb.append(escape(ja.get(i).toString()));
}
- }
- else {
+ } else {
sb.append(escape(value.toString()));
}
// Emit an array of similar keys
- }
- else if (value instanceof JSONArray) {
+ } else if (value instanceof JSONArray) {
ja = (JSONArray) value;
length = ja.length();
for (i = 0; i < length; i += 1) {
@@ -471,21 +456,18 @@ public class XML {
sb.append("");
sb.append(key);
sb.append('>');
- }
- else {
+ } else {
sb.append(toString(value, key));
}
}
- }
- else if ("".equals(value)) {
+ } else if ("".equals(value)) {
sb.append('<');
sb.append(key);
sb.append("/>");
// Emit a new tag
- }
- else {
+ } else {
sb.append(toString(value, key));
}
}
@@ -503,8 +485,7 @@ public class XML {
// a place
// where XML is lacking, synthesize an element.
- }
- else {
+ } else {
if (object.getClass().isArray()) {
object = new JSONArray(object);
}
@@ -515,8 +496,7 @@ public class XML {
sb.append(toString(ja.opt(i), tagName == null ? "array" : tagName));
}
return sb.toString();
- }
- else {
+ } else {
string = (object == null) ? "null" : escape(object.toString());
return (tagName == null) ? "\"" + string + "\"" : (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName + ">" + string + "" + tagName + ">";
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/json/XMLTokener.java b/PlotSquared/src/main/java/com/intellectualcrafters/json/XMLTokener.java
index b1319b473..e8f551a29 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/json/XMLTokener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/json/XMLTokener.java
@@ -1,29 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.json;
-/*
- Copyright (c) 2002 JSON.org
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- */
-
/**
* The XMLTokener extends the JSONTokener to provide additional methods
* for the parsing of XML texts.
@@ -51,8 +48,7 @@ public class XMLTokener extends JSONTokener {
/**
* Construct an XMLTokener from a string.
*
- * @param s
- * A source string.
+ * @param s A source string.
*/
public XMLTokener(final String s) {
super(s);
@@ -62,14 +58,13 @@ public class XMLTokener extends JSONTokener {
* Get the text in the CDATA block.
*
* @return The string up to the ]]>
.
- * @throws JSONException
- * If the ]]>
is not found.
+ * @throws JSONException If the ]]>
is not found.
*/
public String nextCDATA() throws JSONException {
char c;
int i;
final StringBuilder sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
@@ -88,7 +83,7 @@ public class XMLTokener extends JSONTokener {
* of tokens: the '<' character which begins a markup tag, and the content
* text between markup tags.
*
- * @return A string, or a '<' Character, or null if there is no more
+ * @return A string, or a '<' Character, or null if there is no more
* source text.
* @throws JSONException
*/
@@ -106,15 +101,14 @@ public class XMLTokener extends JSONTokener {
return XML.LT;
}
sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
if ((c == '<') || (c == 0)) {
back();
return sb.toString().trim();
}
if (c == '&') {
sb.append(nextEntity(c));
- }
- else {
+ } else {
sb.append(c);
}
c = next();
@@ -125,23 +119,19 @@ public class XMLTokener extends JSONTokener {
* Return the next entity. These entities are translated to Characters:
* & ' > < "
.
*
- * @param ampersand
- * An ampersand character.
+ * @param ampersand An ampersand character.
* @return A Character or an entity String if the entity is not recognized.
- * @throws JSONException
- * If missing ';' in XML entity.
+ * @throws JSONException If missing ';' in XML entity.
*/
public Object nextEntity(final char ampersand) throws JSONException {
final StringBuilder sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
final char c = next();
if (Character.isLetterOrDigit(c) || (c == '#')) {
sb.append(Character.toLowerCase(c));
- }
- else if (c == ';') {
+ } else if (c == ';') {
break;
- }
- else {
+ } else {
throw syntaxError("Missing ';' in XML entity: &" + sb);
}
}
@@ -155,12 +145,11 @@ public class XMLTokener extends JSONTokener {
* and ...?> structures.
*
* @return Syntax characters (< > / = ! ?
) are returned as
- * Character, and strings and names are returned as Boolean. We
- * don't care
- * what the values actually are.
- * @throws JSONException
- * If a string is not properly closed or if the XML
- * is badly structured.
+ * Character, and strings and names are returned as Boolean. We
+ * don't care
+ * what the values actually are.
+ * @throws JSONException If a string is not properly closed or if the XML
+ * is badly structured.
*/
public Object nextMeta() throws JSONException {
char c;
@@ -187,7 +176,7 @@ public class XMLTokener extends JSONTokener {
case '"':
case '\'':
q = c;
- for (;;) {
+ for (; ; ) {
c = next();
if (c == 0) {
throw syntaxError("Unterminated string");
@@ -197,7 +186,7 @@ public class XMLTokener extends JSONTokener {
}
}
default:
- for (;;) {
+ for (; ; ) {
c = next();
if (Character.isWhitespace(c)) {
return Boolean.TRUE;
@@ -226,8 +215,7 @@ public class XMLTokener extends JSONTokener {
* name.
*
* @return a String or a Character.
- * @throws JSONException
- * If the XML is not well formed.
+ * @throws JSONException If the XML is not well formed.
*/
public Object nextToken() throws JSONException {
char c;
@@ -253,13 +241,13 @@ public class XMLTokener extends JSONTokener {
case '?':
return XML.QUEST;
- // Quoted string
+ // Quoted string
case '"':
case '\'':
q = c;
sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
c = next();
if (c == 0) {
throw syntaxError("Unterminated string");
@@ -269,8 +257,7 @@ public class XMLTokener extends JSONTokener {
}
if (c == '&') {
sb.append(nextEntity(c));
- }
- else {
+ } else {
sb.append(c);
}
}
@@ -279,7 +266,7 @@ public class XMLTokener extends JSONTokener {
// Name
sb = new StringBuilder();
- for (;;) {
+ for (; ; ) {
sb.append(c);
c = next();
if (Character.isWhitespace(c)) {
@@ -311,8 +298,7 @@ public class XMLTokener extends JSONTokener {
* If it is not found, we are left at the end of the source with a result of
* false.
*
- * @param to
- * A string to skip past.
+ * @param to A string to skip past.
* @throws JSONException
*/
public boolean skipPast(final String to) throws JSONException {
@@ -339,7 +325,7 @@ public class XMLTokener extends JSONTokener {
/* We will loop, possibly for all of the remaining characters. */
- for (;;) {
+ for (; ; ) {
j = offset;
b = true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java
index 1584e085e..771353508 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
import org.apache.commons.lang.StringUtils;
@@ -12,8 +33,7 @@ public class AbstractFlag {
/**
* AbstractFlag is a parameter used in creating a new Flag
*
- * @param key
- * The key must be alphabetical characters and <= 16 characters
+ * @param key The key must be alphabetical characters and <= 16 characters
* in length
*/
public AbstractFlag(final String key) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java
index f4da88e2c..b06091933 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java
@@ -1,11 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
public class BlockWrapper {
- public int x;
- public int y;
- public int z;
- public int id;
+ 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) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java
index 468131ebe..e0a487f52 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = C.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
@@ -360,15 +373,13 @@ public enum C {
/**
* Constructor
*
- * @param d
- * default
+ * @param d default
*/
C(final String d) {
this.d = d;
if (PlotMain.translations == null) {
this.s = d;
- }
- else {
+ } else {
this.s = PlotMain.translations.getString(this.toString());
}
if (this.s == null) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java
index fd79e967f..95829919d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java
@@ -1,12 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
+import org.bukkit.block.Biome;
+
import java.util.ArrayList;
import java.util.List;
-import org.bukkit.block.Biome;
-
public class Configuration {
- public static final SettingValue STRING = new SettingValue("STRING") {
+ public static final SettingValue STRING = new SettingValue("STRING") {
@Override
public boolean validateValue(final String string) {
return true;
@@ -30,14 +51,13 @@ public class Configuration {
}
};
- public static final SettingValue INTEGER = new SettingValue("INTEGER") {
+ public static final SettingValue INTEGER = new SettingValue("INTEGER") {
@Override
public boolean validateValue(final String string) {
try {
Integer.parseInt(string);
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -48,14 +68,13 @@ public class Configuration {
}
};
- public static final SettingValue BOOLEAN = new SettingValue("BOOLEAN") {
+ public static final SettingValue BOOLEAN = new SettingValue("BOOLEAN") {
@Override
public boolean validateValue(final String string) {
try {
Boolean.parseBoolean(string);
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -66,14 +85,13 @@ public class Configuration {
}
};
- public static final SettingValue DOUBLE = new SettingValue("DOUBLE") {
+ public static final SettingValue DOUBLE = new SettingValue("DOUBLE") {
@Override
public boolean validateValue(final String string) {
try {
Double.parseDouble(string);
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -84,14 +102,13 @@ public class Configuration {
}
};
- public static final SettingValue BIOME = new SettingValue("BIOME") {
+ public static final SettingValue BIOME = new SettingValue("BIOME") {
@Override
public boolean validateValue(final String string) {
try {
Biome.valueOf(string.toUpperCase());
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -112,7 +129,7 @@ public class Configuration {
}
};
- public static final SettingValue BLOCK = new SettingValue("BLOCK") {
+ public static final SettingValue BLOCK = new SettingValue("BLOCK") {
@Override
public boolean validateValue(final String string) {
try {
@@ -120,13 +137,11 @@ public class Configuration {
final String[] split = string.split(":");
Short.parseShort(split[0]);
Short.parseShort(split[1]);
- }
- else {
+ } else {
Short.parseShort(string);
}
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -136,8 +151,7 @@ public class Configuration {
if (string.contains(":")) {
final String[] split = string.split(":");
return new PlotBlock(Short.parseShort(split[0]), Byte.parseByte(split[1]));
- }
- else {
+ } else {
return new PlotBlock(Short.parseShort(string), (byte) 0);
}
}
@@ -177,14 +191,12 @@ public class Configuration {
final String[] split = block.split(":");
Short.parseShort(split[0]);
Short.parseShort(split[1]);
- }
- else {
+ } else {
Short.parseShort(block);
}
}
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -206,8 +218,7 @@ public class Configuration {
if (value < min) {
min = value;
}
- }
- else {
+ } else {
counts[i] = 1;
if (1 < min) {
min = 1;
@@ -216,8 +227,7 @@ public class Configuration {
if (blocks[i].contains(":")) {
final String[] split = blocks[i].split(":");
values[i] = new PlotBlock(Short.parseShort(split[0]), Byte.parseByte(split[1]));
- }
- else {
+ } else {
values[i] = new PlotBlock(Short.parseShort(blocks[i]), (byte) 0);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java
index 92c9ee1e3..7af05b139 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java
@@ -1,16 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
+import com.intellectualcrafters.plot.Configuration.SettingValue;
+import org.apache.commons.lang.StringUtils;
+
import java.util.Arrays;
-import org.apache.commons.lang.StringUtils;
-
-import com.intellectualcrafters.plot.Configuration.SettingValue;
-
public class ConfigurationNode {
- private final String constant;
- private final Object default_value;
- private final String description;
- private Object value;
+ private final String constant;
+ private final Object default_value;
+ private final String description;
+ private Object value;
private final SettingValue type;
public ConfigurationNode(final String constant, final Object default_value, final String description, final SettingValue type, final boolean required) {
@@ -32,8 +52,7 @@ public class ConfigurationNode {
return false;
}
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java
index 8e9645424..ffb5122f9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java
@@ -1,26 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
import org.apache.commons.lang.StringUtils;
public class Flag {
private final AbstractFlag key;
- private final String value;
+ private final String value;
/**
* Flag object used to store basic information for a Plot. Flags are a
* key/value pair. For a flag to be usable by a player, you need to register
* it with PlotSquared.
*
- * @param key
- * AbstractFlag
- * @param value
- * Value must be alphanumerical (can have spaces) and be <= 48
- * characters
- * @throws IllegalArgumentException
- * if you provide inadequate inputs
+ * @param key AbstractFlag
+ * @param value Value must be alphanumerical (can have spaces) and be <= 48
+ * characters
+ * @throws IllegalArgumentException if you provide inadequate inputs
*/
public Flag(final AbstractFlag key, final String value) {
- final char[] allowedCharacters = new char[] { '[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', '§' };
+ final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', '�'};
String tempValue = value;
for (final char c : allowedCharacters) {
tempValue = tempValue.replace(c, 'c');
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java
index a1b2d9350..9fc9bc45d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java
@@ -1,11 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
+import org.bukkit.entity.Player;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import org.bukkit.entity.Player;
-
public class FlagManager {
// TODO add some flags
@@ -64,8 +85,7 @@ public class FlagManager {
/**
* Get a list of registerd AbstragFlag objects based on player permissions
*
- * @param player
- * with permissions
+ * @param player with permissions
* @return List (AbstractFlag)
*/
public static List getFlags(final Player player) {
@@ -97,8 +117,7 @@ public class FlagManager {
* Get an AbstractFlag by a string
*
* @param string
- * @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
*/
public static AbstractFlag getFlag(final String string, final boolean create) {
@@ -126,8 +145,7 @@ public class FlagManager {
final String[] split = flagstrings.get(i).split(";");
if (split.length == 1) {
flags[i] = new Flag(getFlag(split[0], true), "");
- }
- else {
+ } else {
flags[i] = new Flag(getFlag(split[0], true), split[1]);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java
index 4f4bfb537..0a57246bb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = LSetCube.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
@@ -92,7 +105,7 @@ public class LSetCube {
/**
*
*/
- private Location current;
+ private Location current;
/**
* @param cube
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java
index d0494cefa..8046ac0dd 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Lag.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
@@ -18,16 +31,16 @@ public class Lag implements Runnable {
/**
* Tick count
*/
- public static int TC = 0;
+ public static int TC = 0;
/**
* Ticks
*/
- public static long[] T = new long[600];
+ public static long[] T = new long[600];
/**
* something :_:
*/
@SuppressWarnings("unused")
- public static long LT = 0L;
+ public static long LT = 0L;
/**
* Get the server TPS
@@ -41,8 +54,7 @@ public class Lag implements Runnable {
/**
* Return the tick per second (measured in $ticks)
*
- * @param ticks
- * Ticks
+ * @param ticks Ticks
* @return ticks per second
*/
public static double getTPS(final int ticks) {
@@ -57,8 +69,7 @@ public class Lag implements Runnable {
/**
* Get number of ticks since
*
- * @param tI
- * Ticks <
+ * @param tI Ticks <
* @return number of ticks since $tI
*/
@SuppressWarnings("unused")
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java
index 2e7c3c2fe..49fde0d84 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java
@@ -1,18 +1,27 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Logger.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
+import java.io.*;
import java.util.ArrayList;
import java.util.Date;
@@ -24,7 +33,7 @@ import java.util.Date;
public class Logger {
private static ArrayList entries;
- private static File log;
+ private static File log;
public static void setup(final File file) {
log = file;
@@ -36,8 +45,7 @@ public class Logger {
entries.add(line);
}
reader.close();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "File setup error Logger#setup");
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java
index da8da5505..087f782c1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java
@@ -1,56 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
-/*
- * Copyright 2011-2013 Tyler Blair. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and contributors and should not be interpreted as
- * representing official policies, either expressed or implied, of anybody else.
- */
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.Proxy;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.zip.GZIPOutputStream;
-
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -59,31 +29,41 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
+
public class Metrics {
/**
* The current revision number
*/
- private final static int REVISION = 7;
+ private final static int REVISION = 7;
/**
* The base url of the metrics domain
*/
- private static final String BASE_URL = "http://report.mcstats.org";
+ private static final String BASE_URL = "http://report.mcstats.org";
/**
* The url used to report a server's status
*/
- private static final String REPORT_URL = "/plugin/%s";
+ private static final String REPORT_URL = "/plugin/%s";
/**
* Interval of time to ping (in minutes)
*/
- private static final int PING_INTERVAL = 15;
+ private static final int PING_INTERVAL = 15;
/**
* The plugin this metrics submits for
*/
- private final Plugin plugin;
+ private final Plugin plugin;
/**
* All of the custom graphs to submit to metrics
*/
- private final Set graphs = Collections.synchronizedSet(new HashSet());
+ private final Set graphs = Collections.synchronizedSet(new HashSet());
/**
* The plugin configuration file
*/
@@ -91,23 +71,23 @@ public class Metrics {
/**
* The plugin configuration file
*/
- private final File configurationFile;
+ private final File configurationFile;
/**
* Unique server id
*/
- private final String guid;
+ private final String guid;
/**
* Debug mode
*/
- private final boolean debug;
+ private final boolean debug;
/**
* Lock for synchronization
*/
- private final Object optOutLock = new Object();
+ private final Object optOutLock = new Object();
/**
* The scheduled task
*/
- private volatile BukkitTask task = null;
+ private volatile BukkitTask task = null;
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
@@ -136,10 +116,9 @@ public class Metrics {
* plotters to their own graphs on the metrics website. Plotters can be
* added to the graph object returned.
*
- * @param name
- * The name of the graph
+ * @param name The name of the graph
* @return Graph object created. Will never return NULL under normal
- * circumstances unless bad parameters are given
+ * circumstances unless bad parameters are given
*/
public Graph createGraph(final String name) {
if (name == null) {
@@ -157,8 +136,7 @@ public class Metrics {
* Add a Graph object to BukkitMetrics that represents data for the plugin
* that should be sent to the backend
*
- * @param graph
- * The name of the graph
+ * @param graph The name of the graph
*/
public void addGraph(final Graph graph) {
if (graph == null) {
@@ -222,8 +200,7 @@ public class Metrics {
// false
// Each post thereafter will be a ping
this.firstPost = false;
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
if (Metrics.this.debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
}
@@ -244,14 +221,12 @@ public class Metrics {
try {
// Reload the metrics file
this.configuration.load(getConfigFile());
- }
- catch (final IOException ex) {
+ } catch (final IOException ex) {
if (this.debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
- }
- catch (final InvalidConfigurationException ex) {
+ } catch (final InvalidConfigurationException ex) {
if (this.debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
@@ -334,7 +309,7 @@ public class Metrics {
final PluginDescriptionFile description = this.plugin.getDescription();
final String pluginName = description.getName();
final boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE
- // if
+ // if
// online
// mode
// is
@@ -345,12 +320,10 @@ public class Metrics {
try {
if (Bukkit.class.getMethod("getOnlinePlayers", new Class>[0]).getReturnType() == Collection.class) {
playersOnline = ((Collection>) Bukkit.class.getMethod("getOnlinePlayers", new Class>[0]).invoke(null, new Object[0])).size();
- }
- else {
+ } else {
playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class>[0]).invoke(null, new Object[0])).length;
}
- }
- catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
+ } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
}
// END server software specific section -- all code below does not use
@@ -423,8 +396,7 @@ public class Metrics {
// It does not reroute POST requests so we need to go around it
if (isMineshafterPresent()) {
connection = url.openConnection(Proxy.NO_PROXY);
- }
- else {
+ } else {
connection = url.openConnection();
}
final byte[] uncompressed = json.toString().getBytes();
@@ -453,13 +425,11 @@ public class Metrics {
if ((response == null) || response.startsWith("ERR") || response.startsWith("7")) {
if (response == null) {
response = "null";
- }
- else if (response.startsWith("7")) {
+ } else if (response.startsWith("7")) {
response = response.substring(response.startsWith("7,") ? 2 : 1);
}
throw new IOException(response);
- }
- else {
+ } else {
// Is this the first update this hour?
if (response.equals("1") || response.contains("This is your first update this hour")) {
synchronized (this.graphs) {
@@ -487,16 +457,13 @@ public class Metrics {
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
- }
- finally {
+ } finally {
if (gzos != null) {
try {
gzos.close();
- }
- catch (final IOException ignore) {
+ } catch (final IOException ignore) {
}
}
}
@@ -513,8 +480,7 @@ public class Metrics {
try {
Class.forName("mineshafter.MineServer");
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
}
@@ -534,8 +500,7 @@ public class Metrics {
Double.parseDouble(value);
isValueNumeric = true;
}
- }
- catch (final NumberFormatException e) {
+ } catch (final NumberFormatException e) {
isValueNumeric = false;
}
if (json.charAt(json.length() - 1) != '{') {
@@ -545,8 +510,7 @@ public class Metrics {
json.append(':');
if (isValueNumeric) {
json.append(value);
- }
- else {
+ } else {
json.append(escapeJSON(value));
}
}
@@ -584,8 +548,7 @@ public class Metrics {
if (chr < ' ') {
final String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
- }
- else {
+ } else {
builder.append(chr);
}
break;
@@ -598,8 +561,7 @@ public class Metrics {
/**
* Encode text as UTF-8
*
- * @param text
- * the text to encode
+ * @param text the text to encode
* @return the encoded text, as UTF-8
*/
private static String urlEncode(final String text) throws UnsupportedEncodingException {
@@ -614,7 +576,7 @@ public class Metrics {
* The graph's name, alphanumeric and spaces only :) If it does not
* comply to the above when submitted, it is rejected
*/
- private final String name;
+ private final String name;
/**
* The set of plotters that are contained within this graph
*/
@@ -636,8 +598,7 @@ public class Metrics {
/**
* Add a plotter to the graph, which will be used to plot entries
*
- * @param plotter
- * the plotter to add to the graph
+ * @param plotter the plotter to add to the graph
*/
public void addPlotter(final Plotter plotter) {
this.plotters.add(plotter);
@@ -646,8 +607,7 @@ public class Metrics {
/**
* Remove a plotter from the graph
*
- * @param plotter
- * the plotter to remove from the graph
+ * @param plotter the plotter to remove from the graph
*/
public void removePlotter(final Plotter plotter) {
this.plotters.remove(plotter);
@@ -703,9 +663,8 @@ public class Metrics {
/**
* Construct a plotter with a specific plot name
*
- * @param name
- * the name of the plotter to use, which will show up on the
- * website
+ * @param name the name of the plotter to use, which will show up on the
+ * website
*/
public Plotter(final String name) {
this.name = name;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java
index 8c4942c00..2f2e1439f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java
@@ -1,8 +1,25 @@
-package com.intellectualcrafters.plot;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
+package com.intellectualcrafters.plot;
import com.intellectualcrafters.plot.database.DBFunc;
import com.sk89q.worldedit.LocalSession;
@@ -13,6 +30,9 @@ import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.RegionMask;
import com.sk89q.worldedit.regions.CuboidRegion;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
/**
* @author Citymonstret
@@ -25,8 +45,7 @@ public class PWE {
LocalSession s;
if (PlotMain.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName());
- }
- else {
+ } else {
s = PlotMain.worldEdit.getSession(p);
}
@@ -41,8 +60,7 @@ public class PWE {
removeMask(p, s);
return;
}
- }
- else {
+ } else {
final World w = p.getWorld();
@@ -66,8 +84,7 @@ public class PWE {
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
// throw new
// PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY,
// "WorldEdit == Null?");
@@ -83,15 +100,13 @@ public class PWE {
LocalSession s;
if (PlotMain.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName());
- }
- else {
+ } else {
s = PlotMain.worldEdit.getSession(p);
}
final BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p);
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
@@ -106,13 +121,11 @@ public class PWE {
LocalSession s;
if (PlotMain.worldEdit == null) {
s = WorldEdit.getInstance().getSession(p.getName());
- }
- else {
+ } else {
s = PlotMain.worldEdit.getSession(p);
}
removeMask(p, s);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
// throw new
// PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY,
// "WorldEdit == Null?");
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java
index 12386d1d5..68cbae5c7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java
@@ -1,22 +1,34 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Plot.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
-import java.util.ArrayList;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.database.DBFunc;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.ArrayList;
+import java.util.UUID;
/**
* The plot class
@@ -29,19 +41,19 @@ public class Plot implements Cloneable {
/**
* plot ID
*/
- public PlotId id;
+ public PlotId id;
/**
* plot world
*/
- public String world;
+ public String world;
/**
* plot owner
*/
- public UUID owner;
+ public UUID owner;
/**
* Deny Entry
*/
- public boolean deny_entry;
+ public boolean deny_entry;
/**
* List of helpers (with plot permissions)
*/
@@ -57,16 +69,16 @@ public class Plot implements Cloneable {
/**
* External settings class
*/
- public PlotSettings settings;
+ public PlotSettings settings;
/**
* Delete on next save cycle?
*/
- public boolean delete;
+ public boolean delete;
/**
* Has the plot changed since the last save cycle?
*/
- public boolean hasChanged = false;
- public boolean countsTowardsMax = true;
+ public boolean hasChanged = false;
+ public boolean countsTowardsMax = true;
/**
* Primary constructor
@@ -120,8 +132,7 @@ public class Plot implements Cloneable {
this.delete = false;
if (flags != null) {
this.settings.setFlags(flags);
- }
- else {
+ } else {
this.settings.setFlags(new Flag[0]);
}
this.world = world;
@@ -195,8 +206,7 @@ public class Plot implements Cloneable {
public Object clone() throws CloneNotSupportedException {
try {
return super.clone();
- }
- catch (final CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
return null;
}
}
@@ -270,8 +280,7 @@ public class Plot implements Cloneable {
/**
* Clear a plot
*
- * @param plr
- * initiator
+ * @param plr initiator
*/
public void clear(final Player plr) {
PlotHelper.clear(plr, this);
@@ -292,21 +301,18 @@ public class Plot implements Cloneable {
int y = id.y;
if (x >= 0) {
if (y >= 0) {
- return x*x + 3*x + 2*x*y + y + y*y;
- }
- else {
+ return x * x + 3 * x + 2 * x * y + y + y * y;
+ } else {
int y1 = -y;
- return x*x + 3*x + 2*x*y1 + y1 + y1*y1 + 1;
+ return x * x + 3 * x + 2 * x * y1 + y1 + y1 * y1 + 1;
}
- }
- else {
+ } else {
int x1 = -x;
if (y >= 0) {
- return -(x1*x1 + 3*x1 + 2*x1*y + y + y*y);
- }
- else {
+ return -(x1 * x1 + 3 * x1 + 2 * x1 * y + y + y * y);
+ } else {
int y1 = -y;
- return -(x1*x1 + 3*x1 + 2*x1*y1 + y1 + y1*y1 + 1);
+ return -(x1 * x1 + 3 * x1 + 2 * x1 * y1 + y1 + y1 * y1 + 1);
}
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java
index a633fff94..95c473d08 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java
@@ -1,8 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
public class PlotBlock {
public short id;
- public byte data;
+ public byte data;
public PlotBlock(final short id, final byte data) {
this.id = id;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java
index 12c574bb7..905dbb0f7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java
@@ -1,8 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
public class PlotComment {
public final String comment;
- public final int tier;
+ public final int tier;
public final String senderName;
public PlotComment(final String comment, final String senderName, final int tier) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java
index 61597842f..a6ee93cac 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java
@@ -1,26 +1,30 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotHelper.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.listeners.PlotListener;
import net.milkbowl.vault.economy.Economy;
-
-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.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@@ -28,8 +32,10 @@ import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.listeners.PlotListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.UUID;
/**
* plot functions
@@ -38,7 +44,7 @@ import com.intellectualcrafters.plot.listeners.PlotListener;
*/
public class PlotHelper {
public static boolean canSetFast = false;
- static long state = 1;
+ static long state = 1;
/**
* direction 0 = north, 1 = south, etc:
@@ -185,8 +191,7 @@ public class PlotHelper {
greaterPlot.settings.setMerged(0, true);
manager.removeRoadSouth(plotworld, lesserPlot);
}
- }
- else {
+ } else {
if (!lesserPlot.settings.getMerged(1)) {
lesserPlot.settings.setMerged(1, true);
greaterPlot.settings.setMerged(3, true);
@@ -216,7 +221,7 @@ public class PlotHelper {
return 0;
}
final long r = ((nextLong() >>> 32) * n) >> 32;
- return (int) r;
+ return (int) r;
}
/*
@@ -283,8 +288,7 @@ public class PlotHelper {
try {
SetBlockFast.set(block.getWorld(), block.getX(), block.getY(), block.getZ(), plotblock.id, plotblock.data);
return true;
- }
- catch (final Throwable e) {
+ } catch (final Throwable e) {
canSetFast = false;
}
}
@@ -294,12 +298,10 @@ public class PlotHelper {
if (block.getTypeId() != plotblock.id) {
block.setTypeId(plotblock.id);
}
- }
- else {
+ } else {
if (block.getTypeId() == plotblock.id) {
block.setData(plotblock.data);
- }
- else {
+ } else {
block.setTypeIdAndData(plotblock.id, plotblock.data, false);
}
}
@@ -603,8 +605,8 @@ public class PlotHelper {
return x + ";" + z;
}
- public static ArrayList runners_p = new ArrayList();
- public static HashMap runners = new HashMap();
+ public static ArrayList runners_p = new ArrayList();
+ public static HashMap runners = new HashMap();
public static void adjustWallFilling(final Player requester, final Plot plot, final PlotBlock block) {
if (runners.containsKey(plot)) {
@@ -644,9 +646,9 @@ public class PlotHelper {
public static short[] getBlock(final String block) {
if (block.contains(":")) {
final String[] split = block.split(":");
- return new short[] { Short.parseShort(split[0]), Short.parseShort(split[1]) };
+ return new short[]{Short.parseShort(split[0]), Short.parseShort(split[1])};
}
- return new short[] { Short.parseShort(block), 0 };
+ return new short[]{Short.parseShort(block), 0};
}
public static void clearAllEntities(final World world, final Plot plot, final boolean tile) {
@@ -662,8 +664,7 @@ public class PlotHelper {
Player player = (Player) entity;
PlotMain.teleportPlayer(player, entity.getLocation(), plot);
PlotListener.plotExit(player, plot);
- }
- else {
+ } else {
entity.remove();
}
}
@@ -717,8 +718,7 @@ public class PlotHelper {
final World world;
if (requester != null) {
world = requester.getWorld();
- }
- else {
+ } else {
world = Bukkit.getWorld(plot.world);
}
@@ -747,8 +747,7 @@ public class PlotHelper {
}
}
}
- }
- else {
+ } else {
try {
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
@@ -762,8 +761,7 @@ public class PlotHelper {
}
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
}
@@ -780,8 +778,7 @@ public class PlotHelper {
}
}
}
- }
- else {
+ } else {
try {
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
@@ -793,8 +790,7 @@ public class PlotHelper {
}
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
@@ -841,8 +837,7 @@ public class PlotHelper {
final int z = bot.getBlockZ() - 2;
final int y = getHeighestBlock(w, x, z);
return new Location(w, x, y, z);
- }
- else {
+ } else {
final Location bot = getPlotBottomLoc(w, plotid), top = getPlotTopLoc(w, plotid);
final int x = top.getBlockX() - bot.getBlockX();
final int z = top.getBlockZ() - bot.getBlockZ();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java
index d87ad9b5a..9b8d1c695 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java
@@ -1,11 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotHomePosition.java >> Generated by: Citymonstret at 2014-08-09
- * 01:44
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
@@ -17,7 +29,7 @@ public enum PlotHomePosition {
DEFAULT("Default", 'd');
private String string;
- private char ch;
+ private char ch;
PlotHomePosition(final String string, final char ch) {
this.string = string;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java
index 2a8c0b78c..d56a34a3b 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
public class PlotId {
@@ -13,10 +34,8 @@ public class PlotId {
/**
* PlotId class (PlotId x,y values do not correspond to Block locations)
*
- * @param x
- * The plot x coordinate
- * @param y
- * The plot y coordinate
+ * @param x The plot x coordinate
+ * @param y The plot y coordinate
*/
public PlotId(final int x, final int y) {
this.x = x;
@@ -47,21 +66,18 @@ public class PlotId {
public int hashCode() {
if (x >= 0) {
if (y >= 0) {
- return x*x + 3*x + 2*x*y + y + y*y;
- }
- else {
+ return x * x + 3 * x + 2 * x * y + y + y * y;
+ } else {
int y1 = -y;
- return x*x + 3*x + 2*x*y1 + y1 + y1*y1 + 1;
+ return x * x + 3 * x + 2 * x * y1 + y1 + y1 * y1 + 1;
}
- }
- else {
+ } else {
int x1 = -x;
if (y >= 0) {
- return -(x1*x1 + 3*x1 + 2*x1*y + y + y*y);
- }
- else {
+ return -(x1 * x1 + 3 * x1 + 2 * x1 * y + y + y * y);
+ } else {
int y1 = -y;
- return -(x1*x1 + 3*x1 + 2*x1*y1 + y1 + y1*y1 + 1);
+ return -(x1 * x1 + 3 * x1 + 2 * x1 * y1 + y1 + y1 * y1 + 1);
}
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java
index eb96dbc4b..9ff1dc217 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java
@@ -1,11 +1,32 @@
-package com.intellectualcrafters.plot;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
-import java.util.ArrayList;
+package com.intellectualcrafters.plot;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
+import java.util.ArrayList;
+
public abstract class PlotManager {
/*
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java
index 0ad1ca03d..f1acfbe9c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java
@@ -1,12 +1,33 @@
-package com.intellectualcrafters.plot;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
-import java.util.HashMap;
+package com.intellectualcrafters.plot;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
+import java.util.HashMap;
+
/**
* Created by Citymonstret on 2014-10-12.
*/
@@ -14,13 +35,13 @@ public class PlotSelection {
public static HashMap currentSelection = new HashMap<>();
- private final PlotBlock[] plotBlocks;
+ private final PlotBlock[] plotBlocks;
- private final int width;
+ private final int width;
- private final Plot plot;
+ private final Plot plot;
- private final Biome biome;
+ private final Biome biome;
public PlotSelection(final int width, final World world, final Plot plot) {
this.width = width;
@@ -86,21 +107,17 @@ public class PlotSelection {
try {
SetBlockFast.set(world, b1.x, b1.y, b1.z, b2.id, b2.data);
SetBlockFast.set(world, b2.x, b2.y, b2.z, b1.id, b1.data);
- }
- catch (final NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
PlotHelper.canSetFast = false;
}
- }
- else {
+ } else {
if ((b1.id != b2.id) && (b1.data != b2.data)) {
block1.setTypeIdAndData(b2.id, b2.data, false);
block2.setTypeIdAndData(b1.id, b1.data, false);
- }
- else if (b1.id != b2.id) {
+ } else if (b1.id != b2.id) {
block1.setTypeId(b2.id);
block2.setTypeId(b1.id);
- }
- else {
+ } else {
block1.setData(b2.data);
block2.setData(b1.data);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java
index 6ecf6a10a..6fe5b130a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java
@@ -1,20 +1,33 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotSettings.java >> Generated by: Citymonstret at 2014-08-09 01:44
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot;
+import org.bukkit.block.Biome;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import org.bukkit.block.Biome;
-
/**
* plot settings
*
@@ -24,23 +37,23 @@ public class PlotSettings {
/**
* merged plots
*/
- private boolean[] merged = new boolean[] { false, false, false, false };
+ private boolean[] merged = new boolean[]{false, false, false, false};
/**
* plot alias
*/
- private String alias;
+ private String alias;
/**
* plot biome
*/
- private Biome biome;
+ private Biome biome;
private ArrayList comments = null;
/**
*
*/
- private Set flags;
+ private Set flags;
- private PlotHomePosition position;
+ private PlotHomePosition position;
/**
* Constructor
@@ -178,7 +191,7 @@ public class PlotSettings {
public void setComments(final ArrayList comments) {
this.comments = comments;
}
-
+
public void removeComment(PlotComment comment) {
if (this.comments.contains(comment)) {
this.comments.remove(comment);
@@ -190,7 +203,7 @@ public class PlotSettings {
removeComment(comment);
}
}
-
+
public void addComment(final PlotComment comment) {
if (this.comments == null) {
this.comments = new ArrayList();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java
index dcc3d9378..f4d7623e9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java
@@ -1,164 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
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 org.bukkit.Material;
+import org.bukkit.block.Biome;
+import org.bukkit.configuration.ConfigurationSection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
-import org.bukkit.Material;
-import org.bukkit.block.Biome;
-import org.bukkit.configuration.ConfigurationSection;
+import static org.bukkit.Material.*;
/**
- *
* @author Jesse Boyd
- *
*/
public abstract class PlotWorld {
// TODO make this configurable
// make non static and static_default_valu + add config option
@SuppressWarnings("deprecation")
- public static ArrayList BLOCKS = new ArrayList(Arrays.asList(new Material[] { ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
- SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126) }));
+ public static ArrayList BLOCKS = new ArrayList(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
+ SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)}));
- public boolean AUTO_MERGE;
- public static boolean AUTO_MERGE_DEFAULT = false;
+ public boolean AUTO_MERGE;
+ public static boolean AUTO_MERGE_DEFAULT = false;
- public boolean MOB_SPAWNING;
- public static boolean MOB_SPAWNING_DEFAULT = false;
+ public boolean MOB_SPAWNING;
+ public static boolean MOB_SPAWNING_DEFAULT = false;
- public Biome PLOT_BIOME;
- public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
+ public Biome PLOT_BIOME;
+ public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
- public boolean PLOT_CHAT;
- public static boolean PLOT_CHAT_DEFAULT = false;
+ public boolean PLOT_CHAT;
+ public static boolean PLOT_CHAT_DEFAULT = false;
- public boolean SCHEMATIC_CLAIM_SPECIFY = false;
- public static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
+ public boolean SCHEMATIC_CLAIM_SPECIFY = false;
+ public static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
- public boolean SCHEMATIC_ON_CLAIM;
- public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
+ public boolean SCHEMATIC_ON_CLAIM;
+ public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
- public String SCHEMATIC_FILE;
- public static String SCHEMATIC_FILE_DEFAULT = "null";
+ public String SCHEMATIC_FILE;
+ public static String SCHEMATIC_FILE_DEFAULT = "null";
- public List SCHEMATICS;
- public static List SCHEMATICS_DEFAULT = null;
+ public List SCHEMATICS;
+ public static List SCHEMATICS_DEFAULT = null;
- public List DEFAULT_FLAGS;
- public static List DEFAULT_FLAGS_DEFAULT = new ArrayList();
+ public List DEFAULT_FLAGS;
+ public static List DEFAULT_FLAGS_DEFAULT = new ArrayList();
- public boolean USE_ECONOMY;
- public static boolean USE_ECONOMY_DEFAULT = false;
+ public boolean USE_ECONOMY;
+ public static boolean USE_ECONOMY_DEFAULT = false;
- public double PLOT_PRICE;
- public static double PLOT_PRICE_DEFAULT = 100;
+ public double PLOT_PRICE;
+ public static double PLOT_PRICE_DEFAULT = 100;
- public double MERGE_PRICE;
- public static double MERGE_PRICE_DEFAULT = 100;
+ public double MERGE_PRICE;
+ public static double MERGE_PRICE_DEFAULT = 100;
- public double SELL_PRICE;
- public static double SELL_PRICE_DEFAULT = 75;
+ public double SELL_PRICE;
+ public static double SELL_PRICE_DEFAULT = 75;
- public boolean PVP;
- public static boolean PVP_DEFAULT = false;
+ public boolean PVP;
+ public static boolean PVP_DEFAULT = false;
- public boolean PVE;
- public static boolean PVE_DEFAULT = false;
+ public boolean PVE;
+ public static boolean PVE_DEFAULT = false;
- public boolean SPAWN_EGGS;
- public static boolean SPAWN_EGGS_DEFAULT = false;
+ public boolean SPAWN_EGGS;
+ public static boolean SPAWN_EGGS_DEFAULT = false;
- public boolean SPAWN_CUSTOM;
- public static boolean SPAWN_CUSTOM_DEFAULT = true;
+ public boolean SPAWN_CUSTOM;
+ public static boolean SPAWN_CUSTOM_DEFAULT = true;
- public boolean SPAWN_BREEDING;
- public static boolean SPAWN_BREEDING_DEFAULT = false;
+ public boolean SPAWN_BREEDING;
+ public static boolean SPAWN_BREEDING_DEFAULT = false;
public PlotWorld(final String worldname) {
this.worldname = worldname;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java
index a7be3fa64..bc8d7e195 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java
@@ -1,5 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
+import org.bukkit.Bukkit;
+import org.bukkit.Server;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -7,22 +31,25 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.bukkit.Bukkit;
-import org.bukkit.Server;
-
/**
* @author DPOH-VAR
* @version 1.0
*/
-@SuppressWarnings({ "UnusedDeclaration", "rawtypes" })
+@SuppressWarnings({"UnusedDeclaration", "rawtypes"})
public class ReflectionUtils {
- /** prefix of bukkit classes */
- private static String preClassB = "org.bukkit.craftbukkit";
- /** prefix of minecraft classes */
- private static String preClassM = "net.minecraft.server";
- /** boolean value, TRUE if server uses forge or MCPC+ */
- private static boolean forge = false;
+ /**
+ * prefix of bukkit classes
+ */
+ private static String preClassB = "org.bukkit.craftbukkit";
+ /**
+ * prefix of minecraft classes
+ */
+ private static String preClassM = "net.minecraft.server";
+ /**
+ * boolean value, TRUE if server uses forge or MCPC+
+ */
+ private static boolean forge = false;
/** check server version and class names */
static {
@@ -46,8 +73,7 @@ public class ReflectionUtils {
final String verM = pas[3];
preClassM += "." + verM;
}
- }
- catch (final Exception ignored) {
+ } catch (final Exception ignored) {
}
}
}
@@ -63,19 +89,16 @@ public class ReflectionUtils {
* Get class for name. Replace {nms} to net.minecraft.server.V*. Replace
* {cb} to org.bukkit.craftbukkit.V*. Replace {nm} to net.minecraft
*
- * @param classes
- * possible class paths
+ * @param classes possible class paths
* @return RefClass object
- * @throws RuntimeException
- * if no class found
+ * @throws RuntimeException if no class found
*/
public static RefClass getRefClass(final String... classes) {
for (String className : classes) {
try {
className = className.replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft");
return getRefClass(Class.forName(className));
- }
- catch (final ClassNotFoundException ignored) {
+ } catch (final ClassNotFoundException ignored) {
}
}
throw new RuntimeException("no class found");
@@ -84,8 +107,7 @@ public class ReflectionUtils {
/**
* get RefClass object by real class
*
- * @param clazz
- * class
+ * @param clazz class
* @return RefClass based on passed class
*/
public static RefClass getRefClass(final Class clazz) {
@@ -114,8 +136,7 @@ public class ReflectionUtils {
/**
* see {@link Class#isInstance(Object)}
*
- * @param object
- * the object to check
+ * @param object the object to check
* @return true if object is an instance of this class
*/
public boolean isInstance(final Object object) {
@@ -125,13 +146,10 @@ public class ReflectionUtils {
/**
* get existing method by name and types
*
- * @param name
- * name
- * @param types
- * method parameters. can be Class or RefClass
+ * @param name name
+ * @param types method parameters. can be Class or RefClass
* @return RefMethod object
- * @throws RuntimeException
- * if method not found
+ * @throws RuntimeException if method not found
*/
public RefMethod getMethod(final String name, final Object... types) throws NoSuchMethodException {
try {
@@ -140,22 +158,18 @@ public class ReflectionUtils {
for (final Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
- }
- else if (e instanceof RefClass) {
+ } else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
- }
- else {
+ } else {
classes[i++] = e.getClass();
}
}
try {
return new RefMethod(this.clazz.getMethod(name, classes));
- }
- catch (final NoSuchMethodException ignored) {
+ } catch (final NoSuchMethodException ignored) {
return new RefMethod(this.clazz.getDeclaredMethod(name, classes));
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -163,11 +177,9 @@ public class ReflectionUtils {
/**
* get existing constructor by types
*
- * @param types
- * parameters. can be Class or RefClass
+ * @param types parameters. can be Class or RefClass
* @return RefMethod object
- * @throws RuntimeException
- * if constructor not found
+ * @throws RuntimeException if constructor not found
*/
public RefConstructor getConstructor(final Object... types) {
try {
@@ -176,22 +188,18 @@ public class ReflectionUtils {
for (final Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
- }
- else if (e instanceof RefClass) {
+ } else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
- }
- else {
+ } else {
classes[i++] = e.getClass();
}
}
try {
return new RefConstructor(this.clazz.getConstructor(classes));
- }
- catch (final NoSuchMethodException ignored) {
+ } catch (final NoSuchMethodException ignored) {
return new RefConstructor(this.clazz.getDeclaredConstructor(classes));
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -199,11 +207,9 @@ public class ReflectionUtils {
/**
* find method by type parameters
*
- * @param types
- * parameters. can be Class or RefClass
+ * @param types parameters. can be Class or RefClass
* @return RefMethod object
- * @throws RuntimeException
- * if method not found
+ * @throws RuntimeException if method not found
*/
public RefMethod findMethod(final Object... types) {
final Class[] classes = new Class[types.length];
@@ -211,18 +217,17 @@ public class ReflectionUtils {
for (final Object e : types) {
if (e instanceof Class) {
classes[t++] = (Class) e;
- }
- else if (e instanceof RefClass) {
+ } else if (e instanceof RefClass) {
classes[t++] = ((RefClass) e).getRealClass();
- }
- else {
+ } else {
classes[t++] = e.getClass();
}
}
final List methods = new ArrayList<>();
Collections.addAll(methods, this.clazz.getMethods());
Collections.addAll(methods, this.clazz.getDeclaredMethods());
- findMethod: for (final Method m : methods) {
+ findMethod:
+ for (final Method m : methods) {
final Class>[] methodTypes = m.getParameterTypes();
if (methodTypes.length != classes.length) {
continue;
@@ -240,11 +245,9 @@ public class ReflectionUtils {
/**
* find method by name
*
- * @param names
- * possible names of method
+ * @param names possible names of method
* @return RefMethod object
- * @throws RuntimeException
- * if method not found
+ * @throws RuntimeException if method not found
*/
public RefMethod findMethodByName(final String... names) {
final List methods = new ArrayList<>();
@@ -263,11 +266,9 @@ public class ReflectionUtils {
/**
* find method by return value
*
- * @param type
- * type of returned value
- * @throws RuntimeException
- * if method not found
+ * @param type type of returned value
* @return RefMethod
+ * @throws RuntimeException if method not found
*/
public RefMethod findMethodByReturnType(final RefClass type) {
return findMethodByReturnType(type.clazz);
@@ -276,11 +277,9 @@ public class ReflectionUtils {
/**
* find method by return value
*
- * @param type
- * type of returned value
+ * @param type type of returned value
* @return RefMethod
- * @throws RuntimeException
- * if method not found
+ * @throws RuntimeException if method not found
*/
public RefMethod findMethodByReturnType(Class type) {
if (type == null) {
@@ -300,11 +299,9 @@ public class ReflectionUtils {
/**
* find constructor by number of arguments
*
- * @param number
- * number of arguments
+ * @param number number of arguments
* @return RefConstructor
- * @throws RuntimeException
- * if constructor not found
+ * @throws RuntimeException if constructor not found
*/
public RefConstructor findConstructor(final int number) {
final List constructors = new ArrayList<>();
@@ -321,22 +318,18 @@ public class ReflectionUtils {
/**
* get field by name
*
- * @param name
- * field name
+ * @param name field name
* @return RefField
- * @throws RuntimeException
- * if field not found
+ * @throws RuntimeException if field not found
*/
public RefField getField(final String name) {
try {
try {
return new RefField(this.clazz.getField(name));
- }
- catch (final NoSuchFieldException ignored) {
+ } catch (final NoSuchFieldException ignored) {
return new RefField(this.clazz.getDeclaredField(name));
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -344,11 +337,9 @@ public class ReflectionUtils {
/**
* find field by type
*
- * @param type
- * field type
+ * @param type field type
* @return RefField
- * @throws RuntimeException
- * if field not found
+ * @throws RuntimeException if field not found
*/
public RefField findField(final RefClass type) {
return findField(type.clazz);
@@ -357,11 +348,9 @@ public class ReflectionUtils {
/**
* find field by type
*
- * @param type
- * field type
+ * @param type field type
* @return RefField
- * @throws RuntimeException
- * if field not found
+ * @throws RuntimeException if field not found
*/
public RefField findField(Class type) {
if (type == null) {
@@ -414,8 +403,7 @@ public class ReflectionUtils {
/**
* apply method to object
*
- * @param e
- * object to which the method is applied
+ * @param e object to which the method is applied
* @return RefExecutor with method call(...)
*/
public RefExecutor of(final Object e) {
@@ -425,15 +413,13 @@ public class ReflectionUtils {
/**
* call static method
*
- * @param params
- * sent parameters
+ * @param params sent parameters
* @return return value
*/
public Object call(final Object... params) {
try {
return this.method.invoke(null, params);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -448,17 +434,14 @@ public class ReflectionUtils {
/**
* apply method for selected object
*
- * @param params
- * sent parameters
+ * @param params sent parameters
* @return return value
- * @throws RuntimeException
- * if something went wrong
+ * @throws RuntimeException if something went wrong
*/
public Object call(final Object... params) {
try {
return RefMethod.this.method.invoke(this.e, params);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -493,17 +476,14 @@ public class ReflectionUtils {
/**
* create new instance with constructor
*
- * @param params
- * parameters for constructor
+ * @param params parameters for constructor
* @return new object
- * @throws RuntimeException
- * if something went wrong
+ * @throws RuntimeException if something went wrong
*/
public Object create(final Object... params) {
try {
return this.constructor.newInstance(params);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -541,8 +521,7 @@ public class ReflectionUtils {
/**
* apply fiend for object
*
- * @param e
- * applied object
+ * @param e applied object
* @return RefExecutor with getter and setter
*/
public RefExecutor of(final Object e) {
@@ -559,14 +538,12 @@ public class ReflectionUtils {
/**
* set field value for applied object
*
- * @param param
- * value
+ * @param param value
*/
public void set(final Object param) {
try {
RefField.this.field.set(this.e, param);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
@@ -579,8 +556,7 @@ public class ReflectionUtils {
public Object get() {
try {
return RefField.this.field.get(this.e);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java
index efd6c4121..32308d6c8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java
@@ -1,32 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
+import com.intellectualcrafters.jnbt.*;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.plugin.java.JavaPlugin;
-import com.intellectualcrafters.jnbt.ByteArrayTag;
-import com.intellectualcrafters.jnbt.CompoundTag;
-import com.intellectualcrafters.jnbt.IntTag;
-import com.intellectualcrafters.jnbt.ListTag;
-import com.intellectualcrafters.jnbt.NBTInputStream;
-import com.intellectualcrafters.jnbt.NBTOutputStream;
-import com.intellectualcrafters.jnbt.ShortTag;
-import com.intellectualcrafters.jnbt.StringTag;
-import com.intellectualcrafters.jnbt.Tag;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
/**
* Schematic Handler
@@ -34,17 +41,14 @@ import com.intellectualcrafters.jnbt.Tag;
* @author Citymonstret
* @author Empire92
*/
-@SuppressWarnings({ "all" })
+@SuppressWarnings({"all"})
public class SchematicHandler {
/**
* Paste a schematic
*
- * @param location
- * origin
- * @param schematic
- * schematic to paste
- * @param plot
- * plot to paste in
+ * @param location origin
+ * @param schematic schematic to paste
+ * @param plot plot to paste in
* @return true if succeeded
*/
public static boolean paste(final Location location, final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
@@ -72,8 +76,7 @@ public class SchematicHandler {
int y_offset;
if (HEIGHT == location.getWorld().getMaxHeight()) {
y_offset = 0;
- }
- else {
+ } else {
y_offset = l1.getBlockY();
}
@@ -102,8 +105,7 @@ public class SchematicHandler {
}
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return false;
}
return true;
@@ -112,8 +114,7 @@ public class SchematicHandler {
/**
* Get a schematic
*
- * @param name
- * to check
+ * @param name to check
* @return schematic if found, else null
*/
public static Schematic getSchematic(final String name) {
@@ -155,12 +156,10 @@ public class SchematicHandler {
if ((index >> 1) >= addId.length) { // No corresponding
// AddBlocks index
blocks[index] = (short) (b[index] & 0xFF);
- }
- else {
+ } else {
if ((index & 1) == 0) {
blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (b[index] & 0xFF));
- }
- else {
+ } else {
blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (b[index] & 0xFF));
}
}
@@ -208,8 +207,7 @@ public class SchematicHandler {
// }
// }
schematic = new Schematic(collection, dimension, file);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return null;
}
@@ -223,8 +221,8 @@ public class SchematicHandler {
*/
public static class Schematic {
private final DataCollection[] blockCollection;
- private final Dimension schematicDimension;
- private final File file;
+ private final Dimension schematicDimension;
+ private final File file;
public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension, final File file) {
this.blockCollection = blockCollection;
@@ -277,10 +275,8 @@ public class SchematicHandler {
/**
* Saves a schematic to a file path
*
- * @param tag
- * to save
- * @param path
- * to save in
+ * @param tag to save
+ * @param path to save in
* @return true if succeeded
*/
public static boolean save(final CompoundTag tag, final String path) {
@@ -296,8 +292,7 @@ public class SchematicHandler {
output.writeTag(tag);
output.close();
stream.close();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
return false;
}
@@ -307,10 +302,8 @@ public class SchematicHandler {
/**
* Gets the schematic of a plot
*
- * @param world
- * to check
- * @param id
- * plot
+ * @param world to check
+ * @param id plot
* @return tag
*/
public static CompoundTag getCompoundTag(final World world, final PlotId id) {
@@ -338,8 +331,7 @@ public class SchematicHandler {
}
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlotMain.sendConsoleSenderMessage("&7 - Cannot save: corrupt chunk at " + (i / 16) + ", " + (j / 16));
return null;
}
@@ -407,7 +399,7 @@ public class SchematicHandler {
*/
public static class DataCollection {
private final short block;
- private final byte data;
+ private final byte data;
// public CompoundTag tag;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java
index 3a0ec2b0e..14d6a45ac 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java
@@ -1,11 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
-import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass;
-
-import org.bukkit.Bukkit;
-
import com.intellectualcrafters.plot.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
+import org.bukkit.Bukkit;
+
+import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass;
/**
* SetBlockFast class
@@ -13,15 +33,15 @@ import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
*/
public class SetBlockFast {
- private static final RefClass classBlock = getRefClass("{nms}.Block");
- private static final RefClass classChunk = getRefClass("{nms}.Chunk");
- private static final RefClass classWorld = getRefClass("{nms}.World");
+ private static final RefClass classBlock = getRefClass("{nms}.Block");
+ private static final RefClass classChunk = getRefClass("{nms}.Chunk");
+ private static final RefClass classWorld = getRefClass("{nms}.World");
private static final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
- private static RefMethod methodGetHandle;
- private static RefMethod methodGetChunkAt;
- private static RefMethod methodA;
- private static RefMethod methodGetById;
+ private static RefMethod methodGetHandle;
+ private static RefMethod methodGetChunkAt;
+ private static RefMethod methodA;
+ private static RefMethod methodGetById;
public SetBlockFast() throws NoSuchMethodException {
methodGetHandle = classCraftWorld.getMethod("getHandle");
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java
index 5420356b3..1e2844372 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
import java.util.ArrayList;
@@ -28,12 +49,13 @@ public class StringComparsion {
public Object getMatchObject() {
return this.bestMatchObject;
}
+
public String getBestMatch() {
return this.bestMatch;
}
public Object[] getBestMatchAdvanced() {
- return new Object[] { this.match, this.bestMatch };
+ return new Object[]{this.match, this.bestMatch};
}
public static double compare(final String s1, final String s2) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java
index 8a84a0977..c94561ed0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
/**
@@ -9,8 +30,7 @@ public class StringWrapper {
/**
* Constructor
*
- * @param value
- * to wrap
+ * @param value to wrap
*/
public StringWrapper(final String value) {
this.value = value;
@@ -19,8 +39,7 @@ public class StringWrapper {
/**
* Check if a wrapped string equals another one
*
- * @param obj
- * to compare
+ * @param obj to compare
* @return true if obj equals the stored value
*/
@Override
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java
index 9de183261..225b38754 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java
@@ -1,39 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
/**
* Minecraft 1.8 Title
*
- * @version 1.0.3
* @author Maxim Van de Wynckel
+ * @version 1.0.3
*/
@SuppressWarnings("unused")
public class Title {
/* Title packet */
- private Class> packetTitle;
+ private Class> packetTitle;
/* Title packet actions ENUM */
- private Class> packetActions;
+ private Class> packetActions;
/* Chat serializer */
- private Class> nmsChatSerializer;
+ private Class> nmsChatSerializer;
/* Title text and color */
- private String title = "";
- private ChatColor titleColor = ChatColor.WHITE;
+ private String title = "";
+ private ChatColor titleColor = ChatColor.WHITE;
/* Subtitle text and color */
- private String subtitle = "";
- private ChatColor subtitleColor = ChatColor.WHITE;
+ private String subtitle = "";
+ private ChatColor subtitleColor = ChatColor.WHITE;
/* Title timings */
- private int fadeInTime = -1;
- private int stayTime = -1;
- private int fadeOutTime = -1;
- private boolean ticks = false;
+ private int fadeInTime = -1;
+ private int stayTime = -1;
+ private int fadeOutTime = -1;
+ private boolean ticks = false;
private static final Map, Class>> CORRESPONDING_TYPES;
@@ -44,8 +65,7 @@ public class Title {
/**
* Create a new 1.8 title
*
- * @param title
- * Title
+ * @param title Title
*/
public Title(final String title) {
this.title = title;
@@ -55,10 +75,8 @@ public class Title {
/**
* Create a new 1.8 title
*
- * @param title
- * Title text
- * @param subtitle
- * Subtitle text
+ * @param title Title text
+ * @param subtitle Subtitle text
*/
public Title(final String title, final String subtitle) {
this.title = title;
@@ -69,16 +87,11 @@ public class Title {
/**
* Create a new 1.8 title
*
- * @param title
- * Title text
- * @param subtitle
- * Subtitle text
- * @param fadeInTime
- * Fade in time
- * @param stayTime
- * Stay on screen time
- * @param fadeOutTime
- * Fade out time
+ * @param title Title text
+ * @param subtitle Subtitle text
+ * @param fadeInTime Fade in time
+ * @param stayTime Stay on screen time
+ * @param fadeOutTime Fade out time
*/
public Title(final String title, final String subtitle, final int fadeInTime, final int stayTime, final int fadeOutTime) {
this.title = title;
@@ -101,8 +114,7 @@ public class Title {
/**
* Set the title color
*
- * @param color
- * Chat color
+ * @param color Chat color
*/
public void setTitleColor(final ChatColor color) {
this.titleColor = color;
@@ -111,8 +123,7 @@ public class Title {
/**
* Set the subtitle color
*
- * @param color
- * Chat color
+ * @param color Chat color
*/
public void setSubtitleColor(final ChatColor color) {
this.subtitleColor = color;
@@ -121,8 +132,7 @@ public class Title {
/**
* Set title fade in time
*
- * @param time
- * Time
+ * @param time Time
*/
public void setFadeInTime(final int time) {
this.fadeInTime = time;
@@ -131,8 +141,7 @@ public class Title {
/**
* Set title fade out time
*
- * @param time
- * Time
+ * @param time Time
*/
public void setFadeOutTime(final int time) {
this.fadeOutTime = time;
@@ -141,8 +150,7 @@ public class Title {
/**
* Set title stay time
*
- * @param time
- * Time
+ * @param time Time
*/
public void setStayTime(final int time) {
this.stayTime = time;
@@ -165,8 +173,7 @@ public class Title {
/**
* Send the title to a player
*
- * @param player
- * Player
+ * @param player Player
*/
public void send(final Player player) {
if ((getProtocolVersion(player) >= 47) && isSpigot() && (this.packetTitle != null)) {
@@ -194,8 +201,7 @@ public class Title {
packet = this.packetTitle.getConstructor(this.packetActions, getNMSClass("IChatBaseComponent")).newInstance(actions[1], serialized);
sendPacket.invoke(connection, packet);
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -213,8 +219,7 @@ public class Title {
/**
* Clear the title
*
- * @param player
- * Player
+ * @param player Player
*/
public void clearTitle(final Player player) {
if ((getProtocolVersion(player) >= 47) && isSpigot()) {
@@ -226,8 +231,7 @@ public class Title {
final Method sendPacket = getMethod(connection.getClass(), "sendPacket");
final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[3]);
sendPacket.invoke(connection, packet);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -236,8 +240,7 @@ public class Title {
/**
* Reset the title settings
*
- * @param player
- * Player
+ * @param player Player
*/
public void resetTitle(final Player player) {
if ((getProtocolVersion(player) >= 47) && isSpigot()) {
@@ -249,8 +252,7 @@ public class Title {
final Method sendPacket = getMethod(connection.getClass(), "sendPacket");
final Object packet = this.packetTitle.getConstructor(this.packetActions).newInstance(actions[4]);
sendPacket.invoke(connection, packet);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -259,8 +261,7 @@ public class Title {
/**
* Get the protocol version of the player
*
- * @param player
- * Player
+ * @param player Player
* @return Protocol version
*/
private int getProtocolVersion(final Player player) {
@@ -272,8 +273,7 @@ public class Title {
version = (Integer) getMethod("getVersion", networkManager.getClass()).invoke(networkManager);
return version;
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
// ex.printStackTrace(); <-- spammy console
}
return version;
@@ -291,15 +291,13 @@ public class Title {
/**
* Get class by url
*
- * @param namespace
- * Namespace url
+ * @param namespace Namespace url
* @return Class
*/
private Class> getClass(final String namespace) {
try {
return Class.forName(namespace);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
return null;
}
}
@@ -342,8 +340,7 @@ public class Title {
private Object getHandle(final Object obj) {
try {
return getMethod("getHandle", obj.getClass()).invoke(obj);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return null;
}
@@ -370,8 +367,7 @@ public class Title {
Class> clazz = null;
try {
clazz = Class.forName(fullName);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
return clazz;
@@ -382,8 +378,7 @@ public class Title {
final Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
return field;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return null;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java
index 2aaec3dae..c23c50c5f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java
@@ -1,19 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.Player;
-
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.uuid.NameFetcher;
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
import com.intellectualcrafters.plot.uuid.UUIDSaver;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.entity.Player;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.UUID;
/**
* This class can be used to efficiently translate UUIDs and names back and
@@ -24,13 +44,13 @@ import com.intellectualcrafters.plot.uuid.UUIDSaver;
* - Read from (if onlinemode: mojang api) (else: playername hashing)
* All UUIDs/Usernames will be stored in a map (cache) until the server is
* restarted.
- *
+ *
* You can use getUuidMap() to save the uuids/names to a file (SQLite db for
* example).
* Primary methods: getUUID(String name) & getName(UUID uuid) <-- You should
* ONLY use these.
* Call startFetch(JavaPlugin plugin) in your onEnable().
- *
+ *
* Originally created by:
*
* @author Citymonstret
@@ -44,7 +64,7 @@ public class UUIDHandler {
*
* @see org.bukkit.Server#getOnlineMode()
*/
- private static boolean online = Bukkit.getServer().getOnlineMode();
+ private static boolean online = Bukkit.getServer().getOnlineMode();
/**
* Map containing names and UUID's
@@ -63,8 +83,7 @@ public class UUIDHandler {
/**
* Check if a uuid is cached
*
- * @param uuid
- * to check
+ * @param uuid to check
* @return true of the uuid is cached
*/
public static boolean uuidExists(final UUID uuid) {
@@ -74,8 +93,7 @@ public class UUIDHandler {
/**
* Check if a name is cached
*
- * @param name
- * to check
+ * @param name to check
* @return true of the name is cached
*/
public static boolean nameExists(final StringWrapper name) {
@@ -85,10 +103,8 @@ public class UUIDHandler {
/**
* Add a set to the cache
*
- * @param name
- * to cache
- * @param uuid
- * to cache
+ * @param name to cache
+ * @param uuid to cache
*/
public static void add(final StringWrapper name, final UUID uuid) {
if (!uuidMap.containsKey(name) && !uuidMap.inverse().containsKey(uuid)) {
@@ -97,8 +113,7 @@ public class UUIDHandler {
}
/**
- * @param name
- * to use as key
+ * @param name to use as key
* @return uuid
*/
public static UUID getUUID(final String name) {
@@ -121,38 +136,32 @@ public class UUIDHandler {
}
try {
return PlotMain.getUUIDSaver().mojangUUID(name);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
try {
final UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
uuid = fetcher.call().get(name);
add(nameWrap, uuid);
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
ex.printStackTrace();
}
}
- }
- else {
+ } else {
try {
final UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
uuid = fetcher.call().get(name);
add(nameWrap, uuid);
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
ex.printStackTrace();
}
}
- }
- else {
+ } else {
return getUuidOfflineMode(nameWrap);
}
return null;
}
/**
- * @param uuid
- * to use as key
+ * @param uuid to use as key
* @return name (cache)
*/
private static StringWrapper loopSearch(final UUID uuid) {
@@ -160,8 +169,7 @@ public class UUIDHandler {
}
/**
- * @param uuid
- * to use as key
+ * @param uuid to use as key
* @return Name
*/
public static String getName(final UUID uuid) {
@@ -182,51 +190,43 @@ public class UUIDHandler {
name = fetcher.call().get(uuid);
add(new StringWrapper(name), uuid);
return name;
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
ex.printStackTrace();
}
- }
- else {
+ } else {
try {
return PlotMain.getUUIDSaver().mojangName(uuid);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
try {
final NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
name = fetcher.call().get(uuid);
add(new StringWrapper(name), uuid);
return name;
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
e.printStackTrace();
}
}
}
try {
return PlotMain.getUUIDSaver().mojangName(uuid);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
try {
final NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
name = fetcher.call().get(uuid);
add(new StringWrapper(name), uuid);
return name;
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
ex.printStackTrace();
}
}
- }
- else {
+ } else {
return "unknown";
}
return "";
}
/**
- * @param name
- * to use as key
+ * @param name to use as key
* @return UUID (name hash)
*/
private static UUID getUuidOfflineMode(final StringWrapper name) {
@@ -236,8 +236,7 @@ public class UUIDHandler {
}
/**
- * @param uuid
- * to use as key
+ * @param uuid to use as key
* @return String - name
*/
private static String getNameOnlinePlayer(final UUID uuid) {
@@ -251,8 +250,7 @@ public class UUIDHandler {
}
/**
- * @param uuid
- * to use as key
+ * @param uuid to use as key
* @return String - name
*/
private static String getNameOfflinePlayer(final UUID uuid) {
@@ -266,8 +264,7 @@ public class UUIDHandler {
}
/**
- * @param name
- * to use as key
+ * @param name to use as key
* @return UUID
*/
private static UUID getUuidOnlinePlayer(final StringWrapper name) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
index 87597f48b..09f30049e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
@@ -1,16 +1,29 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotAPI.java >> Generated by: Citymonstret at 2014-08-09 01:44
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.api;
-import java.util.ArrayList;
-import java.util.Set;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.commands.MainCommand;
+import com.intellectualcrafters.plot.commands.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -18,33 +31,22 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
-import com.intellectualcrafters.plot.AbstractFlag;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.FlagManager;
-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.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.SchematicHandler;
-import com.intellectualcrafters.plot.commands.MainCommand;
-import com.intellectualcrafters.plot.commands.SubCommand;
+import java.util.ArrayList;
+import java.util.Set;
/**
* The plotMain api class.
*
* @author Citymonstret, Empire92
*/
-@SuppressWarnings({ "unused", "javadoc" })
+@SuppressWarnings({"unused", "javadoc"})
public class PlotAPI {
- private static PlotHelper plotHelper;
- private static PlayerFunctions playerFunctions;
- private static FlagManager flagManager;
+ private static PlotHelper plotHelper;
+ private static PlayerFunctions playerFunctions;
+ private static FlagManager flagManager;
private static SchematicHandler schematicHandler;
- private static C c;
+ private static C c;
// Methods/fields in PlotMain class
@@ -63,13 +65,13 @@ public class PlotAPI {
// PlotMain.updatePlot(plot);
// To access plotMain stuff.
- private final PlotMain plotMain;
+ private final PlotMain plotMain;
// Reference
/**
* Admin Permission
*/
- public static final String ADMIN_PERMISSION = "plots.admin";
+ public static final String ADMIN_PERMISSION = "plots.admin";
/**
* Get all plots
@@ -93,39 +95,36 @@ public class PlotAPI {
/**
* Add a plotoworld
*
+ * @param world World Name
+ * @param plotWorld Plot World Object
+ * @param manager World Manager
* @see com.intellectualcrafters.plot.PlotMain#addPlotWorld(String,
- * com.intellectualcrafters.plot.PlotWorld,
- * com.intellectualcrafters.plot.PlotManager)
- * @param world
- * World Name
- * @param plotWorld
- * Plot World Object
- * @param manager
- * World Manager
+ * com.intellectualcrafters.plot.PlotWorld,
+ * com.intellectualcrafters.plot.PlotManager)
*/
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) {
PlotMain.addPlotWorld(world, plotWorld, manager);
}
/**
- * @see com.intellectualcrafters.plot.PlotMain#config
* @return main configuration
+ * @see com.intellectualcrafters.plot.PlotMain#config
*/
public YamlConfiguration getConfig() {
return PlotMain.config;
}
/**
- * @see com.intellectualcrafters.plot.PlotMain#translations
* @return translation configuration
+ * @see com.intellectualcrafters.plot.PlotMain#translations
*/
public YamlConfiguration getTranslations() {
return PlotMain.translations;
}
/**
- * @see com.intellectualcrafters.plot.PlotMain#storage
* @return storage configuration
+ * @see com.intellectualcrafters.plot.PlotMain#storage
*/
public YamlConfiguration getStorage() {
return PlotMain.storage;
@@ -135,8 +134,7 @@ public class PlotAPI {
* Constructor. Insert any Plugin.
* (Optimally the plugin that is accessing the method)
*
- * @param plugin
- * Plugin used to access this method
+ * @param plugin Plugin used to access this method
*/
public PlotAPI(final JavaPlugin plugin) {
this.plotMain = JavaPlugin.getPlugin(PlotMain.class);
@@ -226,10 +224,9 @@ public class PlotAPI {
* will need to downcast for the specific settings a Generator has. e.g.
* DefaultPlotWorld class implements PlotWorld
*
- * @param world
- * (to get settings of)
+ * @param world (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot
- * world world
+ * world world
*/
public PlotWorld getWorldSettings(final World world) {
return PlotMain.getWorldSettings(world);
@@ -238,10 +235,9 @@ public class PlotAPI {
/**
* Get the settings for a world (settings bundled in PlotWorld class)
*
- * @param world
- * (to get settings of)
+ * @param world (to get settings of)
* @return PlotWorld class for that world ! will return null if not a plot
- * world world
+ * world world
*/
public PlotWorld getWorldSettings(final String world) {
return PlotMain.getWorldSettings(world);
@@ -251,8 +247,7 @@ public class PlotAPI {
* Send a message to a player.
*
* @param player
- * @param c
- * (Caption)
+ * @param c (Caption)
*/
public void sendMessage(final Player player, final C c) {
PlayerFunctions.sendMessage(player, c);
@@ -280,8 +275,7 @@ public class PlotAPI {
/**
* Send a message to the console
*
- * @param c
- * (Caption)
+ * @param c (Caption)
*/
public void sendConsoleMessage(final C c) {
sendConsoleMessage(c.s());
@@ -350,10 +344,8 @@ public class PlotAPI {
/**
* Get all plots for the player
*
- * @param plr
- * to search for
- * @param just_owner
- * should we just search for owner? Or with rights?
+ * @param plr to search for
+ * @param just_owner should we just search for owner? Or with rights?
*/
public Plot[] getPlots(final World world, final Player plr, final boolean just_owner) {
final ArrayList pPlots = new ArrayList<>();
@@ -362,8 +354,7 @@ public class PlotAPI {
if ((plot.owner != null) && (plot.owner == plr.getUniqueId())) {
pPlots.add(plot);
}
- }
- else {
+ } else {
if (plot.hasRights(plr)) {
pPlots.add(plot);
}
@@ -375,8 +366,7 @@ public class PlotAPI {
/**
* Get all plots for the world
*
- * @param world
- * to get plots of
+ * @param world to get plots of
* @return Plot[] - array of plot objects in world
*/
public Plot[] getPlots(final World world) {
@@ -395,8 +385,7 @@ public class PlotAPI {
/**
* Get if plot world
*
- * @param world
- * (to check if plot world)
+ * @param world (to check if plot world)
* @return boolean (if plot world or not)
*/
public boolean isPlotWorld(final World world) {
@@ -411,7 +400,7 @@ public class PlotAPI {
*/
public Location[] getLocations(final Plot p) {
final World world = Bukkit.getWorld(p.world);
- return new Location[] { PlotHelper.getPlotBottomLoc(world, p.id), PlotHelper.getPlotTopLoc(world, p.id), PlotHelper.getPlotHome(world, p.id) };
+ return new Location[]{PlotHelper.getPlotBottomLoc(world, p.id), PlotHelper.getPlotTopLoc(world, p.id), PlotHelper.getPlotHome(world, p.id)};
}
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
index 246312b1e..c5de6c164 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
@@ -1,27 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Auto.java >> Generated by: Citymonstret at 2014-08-09 01:40
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
import net.milkbowl.vault.economy.Economy;
-
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.FlagManager;
-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;
-
@SuppressWarnings("deprecation")
public class Auto extends SubCommand {
public Auto() {
@@ -39,12 +44,10 @@ public class Auto extends SubCommand {
String schematic = "";
if (PlotMain.getPlotWorlds().length == 1) {
world = Bukkit.getWorld(PlotMain.getPlotWorlds()[0]);
- }
- else {
+ } else {
if (PlotMain.isPlotWorld(plr.getWorld())) {
world = plr.getWorld();
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
@@ -64,15 +67,13 @@ public class Auto extends SubCommand {
if (args.length > 1) {
schematic = args[1];
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
schematic = args[0];
// PlayerFunctions.sendMessage(plr,
// "&cError: Invalid size (X,Y)");
// return false;
}
- }
- else {
+ } else {
schematic = args[0];
// PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
// return false;
@@ -124,14 +125,16 @@ public class Auto extends SubCommand {
}
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
}
- }
- else {
- final boolean claimed = true;
+ } else {
+ // FIXME: Not used
+ // TODO: Fix this!
+ // final boolean claimed = true;
while (!br) {
final PlotId start = getNextPlot(Auto.lastPlot, 1);
// FIXME: Wtf is going on here?
- if (claimed) {
+ /*if (claimed) */
+ {
if ((PlotMain.getPlots(world).get(start) == null) || (PlotMain.getPlots(world).get(start).owner == null)) {
Auto.lastPlot = start;
continue;
@@ -168,20 +171,16 @@ public class Auto extends SubCommand {
if (absX > absY) {
if (id.x > 0) {
return new PlotId(id.x, id.y + 1);
- }
- else {
+ } else {
return new PlotId(id.x, id.y - 1);
}
- }
- else if (absY > absX) {
+ } else if (absY > absX) {
if (id.y > 0) {
return new PlotId(id.x - 1, id.y);
- }
- else {
+ } else {
return new PlotId(id.x + 1, id.y);
}
- }
- else {
+ } else {
if (id.x.equals(id.y) && (id.x > 0)) {
return new PlotId(id.x, id.y + step);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
index dd995c330..7124bf4f9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
@@ -1,28 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Claim.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import net.milkbowl.vault.economy.Economy;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.FlagManager;
-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.*;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
+import net.milkbowl.vault.economy.Economy;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
/**
* @author Citymonstret
@@ -40,17 +44,14 @@ public class Claim extends SubCommand {
schematic = args[0];
}
if (!PlayerFunctions.isInPlot(plr)) {
- PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
- return true;
+ return sendMessage(plr, C.NOT_IN_PLOT);
}
if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
- PlayerFunctions.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
- return true;
+ return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
}
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (plot.hasOwner()) {
- PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED);
- return false;
+ return sendMessage(plr, C.PLOT_IS_CLAIMED);
}
final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
if (PlotMain.useEconomy && world.USE_ECONOMY) {
@@ -58,8 +59,7 @@ public class Claim extends SubCommand {
if (cost > 0d) {
final Economy economy = PlotMain.economy;
if (economy.getBalance(plr) < cost) {
- sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
- return true;
+ return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
}
economy.withdrawPlayer(plr, cost);
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
@@ -68,21 +68,15 @@ public class Claim extends SubCommand {
if (!schematic.equals("")) {
if (world.SCHEMATIC_CLAIM_SPECIFY) {
if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
- sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
- return true;
+ return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
}
if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
- PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
- return true;
+ return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
}
}
}
- final boolean result = claimPlot(plr, plot, false, schematic);
- if (result) {
- PlayerFunctions.sendMessage(plr, C.PLOT_NOT_CLAIMED);
- return false;
- }
- return true;
+
+ return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
}
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
@@ -107,8 +101,7 @@ public class Claim extends SubCommand {
SchematicHandler.Schematic sch;
if (schematic.equals("")) {
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
- }
- else {
+ } else {
sch = SchematicHandler.getSchematic(schematic);
if (sch == null) {
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
index 585e961fb..5455be724 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
@@ -1,23 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.entity.Player;
-/**
- * Created by Citymonstret on 2014-08-01.
- */
public class Clear extends SubCommand {
public Clear() {
@@ -30,18 +39,16 @@ public class Clear extends SubCommand {
@Override
public boolean execute(final Player plr, final String... args) {
if (!PlayerFunctions.isInPlot(plr)) {
- PlayerFunctions.sendMessage(plr, "You're not in a plot.");
- return false;
+ return sendMessage(plr, C.NOT_IN_PLOT);
}
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
- PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
- return false;
+ return sendMessage(plr, C.UNLINK_REQUIRED);
}
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !PlotMain.hasPermission(plr, "plots.admin")) {
- PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
- return false;
+ return sendMessage(plr, C.NO_PLOT_PERMS);
}
+ assert plot != null;
plot.clear(plr);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
index f731439f4..35f6381be 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
@@ -1,17 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
-import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
-
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotSelection;
+import org.bukkit.entity.Player;
+
+import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
-/**
- * Created by Citymonstret on 2014-10-13.
- */
public class Clipboard extends SubCommand {
public Clipboard() {
@@ -21,8 +38,7 @@ public class Clipboard extends SubCommand {
@Override
public boolean execute(final Player plr, final String... args) {
if (!currentSelection.containsKey(plr.getName())) {
- sendMessage(plr, C.NO_CLIPBOARD);
- return true;
+ return sendMessage(plr, C.NO_CLIPBOARD);
}
final PlotSelection selection = currentSelection.get(plr.getName());
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java
index be21e5d5a..7006a3e76 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Command.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Command.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
@@ -118,11 +131,11 @@ public enum Command {
/**
*
*/
- private String command;
+ private String command;
/**
*
*/
- private String alias;
+ private String alias;
/**
*
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java
index 5680475b6..aae7d4608 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/CommandPermission.java
@@ -1,17 +1,28 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = CommandPermission.java >> Generated by: Citymonstret at 2014-08-09
- * 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.entity.Player;
/**
* Created by Citymonstret on 2014-08-03.
@@ -26,15 +37,15 @@ public class CommandPermission {
public String permission;
/**
- * @param permission
+ * @param permission Command Permission
*/
public CommandPermission(final String permission) {
this.permission = permission.toLowerCase();
}
/**
- * @param player
- * @return
+ * @param player Does the player have the permission?
+ * @return true of player has the required permission node
*/
public boolean hasPermission(final Player player) {
return PlotMain.hasPermission(player, this.permission) || PlotMain.hasPermission(player, "plots.admin");
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
index dc45307d2..830c7c3bb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
@@ -1,29 +1,34 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import org.apache.commons.lang.StringUtils;
+import org.bukkit.entity.Player;
+
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.entity.Player;
-
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.database.DBFunc;
-
-/**
- * Created by Citymonstret on 2014-08-01.
- */
public class Comment extends SubCommand {
public Comment() {
@@ -33,16 +38,14 @@ public class Comment extends SubCommand {
@Override
public boolean execute(final Player plr, final String... args) {
if (!PlayerFunctions.isInPlot(plr)) {
- PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
- return false;
+ return sendMessage(plr, C.NOT_IN_PLOT);
}
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!plot.hasOwner()) {
- PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
- return false;
+ return sendMessage(plr, C.NOT_IN_PLOT);
}
- final List recipients = Arrays.asList(new String[] { "admin", "owner", "helper", "trusted", "everyone" });
+ final List recipients = Arrays.asList("admin", "owner", "helper", "trusted", "everyone");
if ((args.length == 2) && recipients.contains(args[0].toLowerCase())) {
@@ -54,13 +57,10 @@ public class Comment extends SubCommand {
DBFunc.setComment(plr.getWorld().getName(), plot, comment);
return true;
- }
- else {
- PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());
- return false;
+ } else {
+ return sendMessage(plr, C.NO_PERMISSION, "plots.comment." + args[0].toLowerCase());
}
}
- PlayerFunctions.sendMessage(plr, C.COMMENT_SYNTAX);
- return false;
+ return sendMessage(plr, C.COMMENT_SYNTAX);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
index 4eeeac1d1..2bb55613d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
@@ -1,25 +1,29 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
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.PlotSelection;
-
-/**
- * Created by Citymonstret on 2014-08-01.
- */
public class Copy extends SubCommand {
public Copy() {
@@ -37,11 +41,11 @@ public class Copy extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
+ assert plot != null;
if (plot.settings.isMerged()) {
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
return false;
}
- assert plot != null;
final int size = (PlotHelper.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - PlotHelper.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX());
final PlotSelection selection = new PlotSelection(size, plr.getWorld(), plot);
if (PlotSelection.currentSelection.containsKey(plr.getName())) {
@@ -49,8 +53,6 @@ public class Copy extends SubCommand {
}
PlotSelection.currentSelection.put(plr.getName(), selection);
sendMessage(plr, C.CLIPBOARD_SET);
- // section.paste(plr.getWorld(), PlotHelper.getPlot(plr.getWorld()zs,
- // new PlotId(plot.getId().x + 1, plot.getId().y)));
return true;
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
index b23c19c7f..0d9c23cc2 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
@@ -1,45 +1,35 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Debug.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
import org.bukkit.Bukkit;
import org.bukkit.World;
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\\
- * ||#Compiler:ALPHA-1.0#########################
- * ||#ST:Java(1.7.*)\impl(bukkit)->api(s[])######
- * ||#Section:\Debug\############################
- * ||##Debug->Debug.properties|Debug.txt#########
- * ||############################################ ||#Signed
- * By:Citymonstret@IC##################
- * \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- */
public class Debug extends SubCommand {
- // private extends SubCommand^Implements {Command, Information} from
- // >>\\S.txt6\\
public Debug() {
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.DEBUG, false);
- {
- /**
- * This.
- */
- }
}
@Override
@@ -47,35 +37,23 @@ public class Debug extends SubCommand {
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
final StringBuilder msg = new StringBuilder();
for (final C c : C.values()) {
- msg.append(c.s() + "\n");
+ msg.append(c.s()).append("\n");
}
PlayerFunctions.sendMessage(plr, msg.toString());
return true;
}
StringBuilder information;
String header, line, section;
- /**
- * {$notnull || compile:: \\Debug:Captions\\}
- */
{
information = new StringBuilder();
header = C.DEUBG_HEADER.s();
line = C.DEBUG_LINE.s();
section = C.DEBUG_SECTION.s();
}
- /**
- * {||direct:: load: debug::I>Captions::trsl} \\ if(missing)
- * set(default) -> this->(){} \\ echo line->line(Compiler.cpp ->
- * lineCompiler); when finished: now = this();
- * now(getter)->setter(this())->{ "string" = getter(this);
- * setter(string) = getter(this->setter); } when ^ finished compile;
- * if(^compile failed -> |this->failed.|tests->failed.| ||run test
- * {this->test}|on fail(action(){return FAILED})|
- */
{
final StringBuilder worlds = new StringBuilder("");
for (final String world : PlotMain.getPlotWorlds()) {
- worlds.append(world + " ");
+ worlds.append(world).append(" ");
}
information.append(header);
information.append(getSection(section, "Lag / TPS"));
@@ -85,8 +63,8 @@ public class Debug extends SubCommand {
information.append(getSection(section, "PlotWorld"));
information.append(getLine(line, "Plot Worlds", worlds));
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 (final String worldname : PlotMain.getPlotWorlds()) {
final World world = Bukkit.getWorld(worldname);
information.append(getLine(line, "World: " + world + " size", PlotHelper.getWorldFolderSize(world)));
@@ -101,10 +79,6 @@ public class Debug extends SubCommand {
information.append(getLine(line, "Total Messages", C.values().length));
information.append(getLine(line, "View all captions", "/plot debug msg"));
}
- /**
- * {function:: SEND_MESSAGE |local player -> plr|local string ->
- * information.toString())}
- */
{
PlayerFunctions.sendMessage(plr, information.toString());
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
index 707ab035e..ee6f017ab 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
@@ -1,16 +1,30 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Claim.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.UUID;
-
+import com.google.common.collect.BiMap;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
@@ -19,20 +33,8 @@ import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
-import com.google.common.collect.BiMap;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.FlagManager;
-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.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.StringWrapper;
-import com.intellectualcrafters.plot.UUIDHandler;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
+import java.util.ArrayList;
+import java.util.UUID;
/**
* @author Citymonstret
@@ -47,13 +49,11 @@ public class DebugClaimTest extends SubCommand {
public boolean execute(final Player plr, final String... args) {
if (plr == null) {
if (args.length < 3) {
- PlayerFunctions.sendMessage(plr, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
- return false;
+ return !PlayerFunctions.sendMessage(null, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. \n\n&cMissing world arg /plot debugclaimtest {world} {PlotId min} {PlotId max}");
}
final World world = Bukkit.getWorld(args[0]);
if ((world == null) || !PlotMain.isPlotWorld(world)) {
- PlayerFunctions.sendMessage(plr, "&cInvalid plot world!");
- return false;
+ return !PlayerFunctions.sendMessage(null, "&cInvalid plot world!");
}
PlotId min, max;
@@ -64,24 +64,22 @@ public class DebugClaimTest extends SubCommand {
min = new PlotId(Integer.parseInt(split1[0]), Integer.parseInt(split1[1]));
max = new PlotId(Integer.parseInt(split2[0]), Integer.parseInt(split2[1]));
+ } catch (final Exception e) {
+ return !PlayerFunctions.sendMessage(null, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X,Y are the plot coords\nThe conversion will only check the plots in the selected area.");
}
- catch (final Exception e) {
- PlayerFunctions.sendMessage(plr, "&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X,Y are the plot coords\nThe conversion will only check the plots in the selected area.");
- return false;
- }
- PlayerFunctions.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
- PlayerFunctions.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
+ PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Beginning sign to plot conversion. This may take a while...");
+ PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: Found an excess of 250,000 chunks. Limiting search radius... (~3.8 min)");
final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
- final ArrayList plots = new ArrayList();
+ final ArrayList plots = new ArrayList<>();
for (final PlotId id : PlayerFunctions.getPlotSelectionIds(world, min, max)) {
final Plot plot = PlotHelper.getPlot(world, id);
final boolean contains = PlotMain.getPlots(world).containsKey(plot.id);
if (contains) {
- PlayerFunctions.sendMessage(plr, " - &cDB Already contains: " + plot.id);
+ PlayerFunctions.sendMessage(null, " - &cDB Already contains: " + plot.id);
continue;
}
@@ -100,35 +98,32 @@ public class DebugClaimTest extends SubCommand {
if (block != null) {
if (block.getState() instanceof Sign) {
final Sign sign = (Sign) block.getState();
- if (sign != null) {
- String line = sign.getLine(2);
- if ((line != null) && (line.length() > 2)) {
- line = line.substring(2);
+ String line = sign.getLine(2);
+ if ((line != null) && (line.length() > 2)) {
+ line = line.substring(2);
- final BiMap map = UUIDHandler.getUuidMap();
+ final BiMap map = UUIDHandler.getUuidMap();
- UUID uuid = (map.get(new StringWrapper(line)));
+ UUID uuid = (map.get(new StringWrapper(line)));
- if (uuid == null) {
- for (final StringWrapper string : map.keySet()) {
- if (string.value.toLowerCase().startsWith(line.toLowerCase())) {
- uuid = map.get(string);
- break;
- }
+ if (uuid == null) {
+ for (final StringWrapper string : map.keySet()) {
+ if (string.value.toLowerCase().startsWith(line.toLowerCase())) {
+ uuid = map.get(string);
+ break;
}
}
- if (uuid == null) {
- uuid = UUIDHandler.getUUID(line);
- }
- if (uuid != null) {
- PlayerFunctions.sendMessage(plr, " - &aFound plot: " + plot.id + " : " + line);
- plot.owner = uuid;
- plot.hasChanged = true;
- plots.add(plot);
- }
- else {
- PlayerFunctions.sendMessage(plr, " - &cInvalid playername: " + plot.id + " : " + line);
- }
+ }
+ if (uuid == null) {
+ uuid = UUIDHandler.getUUID(line);
+ }
+ if (uuid != null) {
+ PlayerFunctions.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
+ plot.owner = uuid;
+ plot.hasChanged = true;
+ plots.add(plot);
+ } else {
+ PlayerFunctions.sendMessage(null, " - &cInvalid playername: " + plot.id + " : " + line);
}
}
}
@@ -136,7 +131,7 @@ public class DebugClaimTest extends SubCommand {
}
if (plots.size() > 0) {
- PlayerFunctions.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!");
+ PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Updating '" + plots.size() + "' plots!");
DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots);
@@ -144,25 +139,24 @@ public class DebugClaimTest extends SubCommand {
PlotMain.updatePlot(plot);
}
- PlayerFunctions.sendMessage(plr, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
+ PlayerFunctions.sendMessage(null, "&3Sign Block&8->&3PlotSquared&8: &7Complete!");
- }
- else {
- PlayerFunctions.sendMessage(plr, "No plots were found for the given search.");
+ } else {
+ PlayerFunctions.sendMessage(null, "No plots were found for the given search.");
}
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused.");
}
return true;
}
+ @SuppressWarnings("unused")
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
return claimPlot(player, plot, teleport, "");
}
- public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic) {
+ public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
index b6b69345b..747de576b 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
@@ -1,20 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Claim.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.lang.reflect.Field;
-
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import org.bukkit.entity.Player;
+
+import java.lang.reflect.Field;
/**
* @author Citymonstret
@@ -32,14 +44,12 @@ public class DebugLoadTest extends SubCommand {
final Field fPlots = PlotMain.class.getDeclaredField("plots");
fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots());
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlotMain.sendConsoleSenderMessage("&3===FAILED&3===");
e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&3===END OF STACKTRACE===");
}
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused.");
}
return true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
index d4f1d230d..f51a9957b 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
@@ -1,21 +1,33 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Claim.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
/**
* @author Citymonstret
@@ -33,8 +45,7 @@ public class DebugSaveTest extends SubCommand {
plots.addAll(PlotMain.getPlots());
DBFunc.createPlots(plots);
DBFunc.createAllSettingsAndHelpers(plots);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "This debug command can only be executed by console as it has been deemed unsafe if abused.");
}
return true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
index f47957ef7..9b3e319ad 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
@@ -1,27 +1,31 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Delete.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
import net.milkbowl.vault.economy.Economy;
-
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.database.DBFunc;
-
-/**
- * Created by Citymonstret on 2014-08-01.
- */
public class Delete extends SubCommand {
public Delete() {
@@ -31,18 +35,16 @@ public class Delete extends SubCommand {
@Override
public boolean execute(final Player plr, final String... args) {
if (!PlayerFunctions.isInPlot(plr)) {
- PlayerFunctions.sendMessage(plr, "You're not in a plot.");
- return false;
+ return !sendMessage(plr, C.NOT_IN_PLOT);
}
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
- PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
- return false;
+ return !sendMessage(plr, C.UNLINK_REQUIRED);
}
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId()))) && !PlotMain.hasPermission(plr, "plots.admin")) {
- PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
- return false;
+ return !sendMessage(plr, C.NO_PLOT_PERMS);
}
+ assert plot != null;
final PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld());
if (PlotMain.useEconomy && pWorld.USE_ECONOMY) {
final double c = pWorld.SELL_PRICE;
@@ -59,8 +61,7 @@ public class Delete extends SubCommand {
if ((Math.abs(plot.id.x) <= Math.abs(Auto.lastPlot.x)) && (Math.abs(plot.id.y) <= Math.abs(Auto.lastPlot.y))) {
Auto.lastPlot = plot.id;
}
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "Plot clearing has been denied.");
}
return true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
index 97e0d849f..078f81cdb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
@@ -1,28 +1,38 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Denied.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.UUIDHandler;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
+
-/**
- * Created by Citymonstret on 2014-08-03.
- */
@SuppressWarnings("deprecated")
public class Denied extends SubCommand {
@@ -50,8 +60,7 @@ public class Denied extends SubCommand {
if (args[1].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
- }
- else {
+ } else {
uuid = UUIDHandler.getUUID(args[1]);
}
if (!plot.denied.contains(uuid)) {
@@ -71,8 +80,7 @@ public class Denied extends SubCommand {
DBFunc.setDenied(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
@@ -85,8 +93,7 @@ public class Denied extends SubCommand {
}
PlayerFunctions.sendMessage(plr, C.DENIED_ADDED);
return true;
- }
- else if (args[0].equalsIgnoreCase("remove")) {
+ } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone;
if (!plot.denied.contains(uuid)) {
@@ -116,8 +123,7 @@ public class Denied extends SubCommand {
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
index 5573c4442..4b4e9404e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
@@ -1,24 +1,36 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Helpers.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.UUIDHandler;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class Helpers extends SubCommand {
@@ -46,8 +58,7 @@ public class Helpers extends SubCommand {
UUID uuid;
if (args[1].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
- }
- else {
+ } else {
uuid = UUIDHandler.getUUID(args[1]);
}
if (!plot.helpers.contains(uuid)) {
@@ -67,15 +78,13 @@ public class Helpers extends SubCommand {
DBFunc.setHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
PlayerFunctions.sendMessage(plr, C.HELPER_ADDED);
return true;
- }
- else if (args[0].equalsIgnoreCase("remove")) {
+ } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone;
if (!plot.helpers.contains(uuid)) {
@@ -106,8 +115,7 @@ public class Helpers extends SubCommand {
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
index 4d89c3b5b..f7f465408 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
@@ -1,19 +1,31 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Home.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.entity.Player;
/**
* @author Citymonstret
@@ -39,16 +51,14 @@ public class Home extends SubCommand {
if (plots.length == 1) {
PlotMain.teleportPlayer(plr, plr.getLocation(), plots[0]);
return true;
- }
- else if (plots.length > 1) {
+ } else if (plots.length > 1) {
if (args.length < 1) {
- args = new String[] { "1" };
+ args = new String[]{"1"};
}
int id = 0;
try {
id = Integer.parseInt(args[0]);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
Plot temp;
if ((temp = isAlias(args[0])) != null) {
if (temp.hasOwner()) {
@@ -69,8 +79,7 @@ public class Home extends SubCommand {
}
PlotMain.teleportPlayer(plr, plr.getLocation(), plots[id - 1]);
return true;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PLOTS);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
index 93ebc3a68..39994d3b7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
@@ -1,28 +1,36 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
import java.util.ArrayList;
import java.util.Arrays;
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.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.database.DBFunc;
-
/**
* Created by Citymonstret on 2014-08-01.
*/
@@ -48,17 +56,13 @@ public class Inbox extends SubCommand {
final UUID uuid = plr.getUniqueId();
if (PlotMain.hasPermission(plr, "plots.admin")) {
tier = 0;
- }
- else if (plot.owner == uuid) {
+ } else if (plot.owner == uuid) {
tier = 1;
- }
- else if (plot.helpers.contains(uuid)) {
+ } else if (plot.helpers.contains(uuid)) {
tier = 2;
- }
- else if (plot.trusted.contains(uuid)) {
+ } else if (plot.trusted.contains(uuid)) {
tier = 3;
- }
- else {
+ } else {
tier = 4;
}
@@ -67,8 +71,7 @@ public class Inbox extends SubCommand {
case "admin":
if (tier <= 0) {
tier = 0;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
return false;
}
@@ -76,8 +79,7 @@ public class Inbox extends SubCommand {
case "owner":
if (tier <= 1) {
tier = 1;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
return false;
}
@@ -85,8 +87,7 @@ public class Inbox extends SubCommand {
case "helper":
if (tier <= 2) {
tier = 2;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
return false;
}
@@ -94,8 +95,7 @@ public class Inbox extends SubCommand {
case "trusted":
if (tier <= 3) {
tier = 3;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
return false;
}
@@ -103,14 +103,13 @@ public class Inbox extends SubCommand {
case "everyone":
if (tier <= 4) {
tier = 4;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.NO_PERM_INBOX);
return false;
}
break;
case "default":
- PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[] { "admin", "owner", "helper", "trusted", "everyone" }, tier, 4));
+ PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[]{"admin", "owner", "helper", "trusted", "everyone"}, tier, 4));
return false;
}
}
@@ -138,11 +137,10 @@ public class Inbox extends SubCommand {
final int index = Integer.parseInt(split[1]);
final PlotComment comment = comments.get(index - 1);
DBFunc.removeComment(world, plot, comment);
- plot.settings.removeComment(comment);
+ plot.settings.removeComment(comment);
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
return;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, "&cInvalid index:\n/plot inbox [tier] [clear][:#]");
return;
}
@@ -153,9 +151,8 @@ public class Inbox extends SubCommand {
plot.settings.removeComments(comments);
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
return;
- }
- else {
- final List recipients = Arrays.asList(new String[] { "A", "O", "H", "T", "E" });
+ } else {
+ final List recipients = Arrays.asList(new String[]{"A", "O", "H", "T", "E"});
int count = 1;
final StringBuilder message = new StringBuilder();
String prefix = "";
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
index cc05810a4..4d22738a8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
@@ -1,16 +1,28 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Info.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -18,15 +30,8 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.UUIDHandler;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.ArrayList;
+import java.util.UUID;
/**
* @author Citymonstret
@@ -48,8 +53,7 @@ public class Info extends SubCommand {
return false;
}
plot = PlayerFunctions.getCurrentPlot(player);
- }
- else {
+ } else {
if (args.length < 2) {
PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
return false;
@@ -69,13 +73,11 @@ public class Info extends SubCommand {
}
world = Bukkit.getWorld(args[0]);
if (args.length == 3) {
- args = new String[] { args[2] };
- }
- else {
+ args = new String[]{args[2]};
+ } else {
args = new String[0];
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE);
return false;
}
@@ -89,14 +91,12 @@ public class Info extends SubCommand {
{
if (plot.helpers == null) {
containsEveryone = false;
- }
- else {
+ } else {
containsEveryone = plot.helpers.contains(DBFunc.everyone);
}
if (plot.trusted == null) {
trustedEveryone = false;
- }
- else {
+ } else {
trustedEveryone = plot.trusted.contains(DBFunc.everyone);
}
}
@@ -205,8 +205,7 @@ public class Info extends SubCommand {
for (int x = 0; x < l.size(); x++) {
if ((x + 1) == l.size()) {
list.append(c.replace("%user%", getPlayerName(l.get(x))).replace(",", ""));
- }
- else {
+ } else {
list.append(c.replace("%user%", getPlayerName(l.get(x))));
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inventory.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inventory.java
index e92465612..326ffea40 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inventory.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inventory.java
@@ -1,15 +1,26 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Inventory.java >> Generated by: Citymonstret at 2014-08-10 13:57
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -17,6 +28,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import java.util.ArrayList;
+
public class Inventory extends SubCommand {
public Inventory() {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
index d4f4b1e2b..284c1a49a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
@@ -1,20 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Kick.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
/**
* Created by Citymonstret on 2014-08-01.
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
index 8f0007552..3c5eb4b0c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = MainCommand.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
@@ -34,9 +47,9 @@ public class MainCommand implements CommandExecutor, TabCompleter {
public static final String
MAIN_PERMISSION = "plots.use";
- private static SubCommand[] _subCommands = new SubCommand[] { new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand() };
+ private static SubCommand[] _subCommands = new SubCommand[]{new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new DebugClaimTest(), new Inbox(), new Comment(), new Swap(), new MusicSubcommand()};
- public static ArrayList subCommands = new ArrayList() {
+ public static ArrayList subCommands = new ArrayList() {
{
addAll(Arrays.asList(_subCommands));
}
@@ -83,15 +96,14 @@ public class MainCommand implements CommandExecutor, TabCompleter {
int page = 0;
boolean digit = true;
-
+
String arg2;
- if (args.length>2) {
+ if (args.length > 2) {
arg2 = args[2];
- }
- else {
+ } else {
arg2 = "1";
}
-
+
for (final char c : arg2.toCharArray()) {
if (!Character.isDigit(c)) {
digit = false;
@@ -110,8 +122,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
}
return PlayerFunctions.sendMessage(player, help.toString());
- }
- else {
+ } else {
for (final SubCommand command : subCommands) {
if (command.cmd.equalsIgnoreCase(args[0]) || command.alias.equalsIgnoreCase(args[0])) {
final String[] arguments = new String[args.length - 1];
@@ -119,12 +130,10 @@ public class MainCommand implements CommandExecutor, TabCompleter {
if (command.permission.hasPermission(player)) {
if ((player != null) || !command.isPlayer) {
return command.execute(player, arguments);
- }
- else {
+ } else {
return !PlayerFunctions.sendMessage(null, C.IS_CONSOLE);
}
- }
- else {
+ } else {
return no_permission(player, command.permission.permission.toLowerCase());
}
}
@@ -146,7 +155,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
public static List getCommands(final SubCommand.CommandCategory category, final Player player) {
final List cmds = new ArrayList<>();
for (final SubCommand c : subCommands) {
- if ((c.category == category) && c.permission.hasPermission(player)) {
+ if ((c.category.equals(category)) && c.permission.hasPermission(player)) {
cmds.add(c);
}
}
@@ -224,8 +233,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
if (cmd.permission.hasPermission(player)) {
if (cmd.cmd.startsWith(arg)) {
tabOptions.add(cmd.cmd);
- }
- else if (cmd.alias.startsWith(arg)) {
+ } else if (cmd.alias.startsWith(arg)) {
tabOptions.add(cmd.alias);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
index 73d67ec14..f6f79a331 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
@@ -1,39 +1,43 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Merge.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.events.PlotMergeEvent;
import net.milkbowl.vault.economy.Economy;
-
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.SetBlockFast;
-import com.intellectualcrafters.plot.events.PlotMergeEvent;
+import java.util.ArrayList;
/**
* @author Citymonstret
*/
public class Merge extends SubCommand {
- public static String[] values = new String[] { "north", "east", "south", "west" };
- public static String[] aliases = new String[] { "n", "e", "s", "w" };
+ public static String[] values = new String[]{"north", "east", "south", "west"};
+ public static String[] aliases = new String[]{"n", "e", "s", "w"};
public Merge() {
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
index 5ee4b4d92..a1ae854f5 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
@@ -1,17 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
-import java.util.Arrays;
-
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.listeners.PlotPlusListener;
+import java.util.Arrays;
public class MusicSubcommand extends SubCommand {
public MusicSubcommand() {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
index 9406cd9af..255936707 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
@@ -1,14 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
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.PlotSelection;
-
/**
* Created by Citymonstret on 2014-10-12.
*/
@@ -44,8 +59,7 @@ public class Paste extends SubCommand {
}
selection.paste(plr.getWorld(), plot);
sendMessage(plr, C.PASTED);
- }
- else {
+ } else {
sendMessage(plr, C.NO_CLIPBOARD);
return false;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
index 9b549ba86..49ec9d587 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
@@ -1,21 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Purge.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
import com.intellectualcrafters.plot.database.DBFunc;
+import org.bukkit.entity.Player;
/**
* @Deprecated
@@ -50,8 +61,7 @@ public class Purge extends SubCommand {
DBFunc.purge(world, id);
PlayerFunctions.sendMessage(plr, "&aPurge of '" + args[0] + "' was successful!");
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
}
}
@@ -59,7 +69,7 @@ public class Purge extends SubCommand {
return false;
}
if (args[1].equals("-o")) {
- if (PlotMain.getPlots(args[0])==null) {
+ if (PlotMain.getPlots(args[0]) == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
@@ -67,8 +77,7 @@ public class Purge extends SubCommand {
DBFunc.purge(args[0]);
PlayerFunctions.sendMessage(plr, (C.PURGE_SUCCESS));
return true;
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "This is a dangerous command, if you are sure, use /plot purge {world} -o");
return false;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
index 8f2ac263c..6bb4958c6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
@@ -1,10 +1,30 @@
-package com.intellectualcrafters.plot.commands;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
-import org.bukkit.entity.Player;
+package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
+import org.bukkit.entity.Player;
/**
* Created by Citymonstret on 2014-10-02.
@@ -64,8 +84,7 @@ public class Rate extends SubCommand {
final boolean success = false;
if (success) {
sendMessage(plr, C.RATING_APPLIED, plot.getId().toString());
- }
- else {
+ } else {
sendMessage(plr, C.COMMAND_WENT_WRONG);
}
return true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
index c0953b920..442760bfa 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
@@ -1,19 +1,31 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Reload.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotWorld;
+import org.bukkit.entity.Player;
/**
* @Deprecated
@@ -40,8 +52,7 @@ public class Reload extends SubCommand {
plotworld.loadDefaultConfiguration(PlotMain.config.getConfigurationSection("worlds." + pw));
}
PlotMain.BroadcastWithPerms(C.RELOADED_CONFIGS);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.RELOAD_FAILED);
}
return true;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
index e9a5bb65d..64a3cadbb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
@@ -1,26 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
-import java.util.HashMap;
-
+import com.intellectualcrafters.jnbt.CompoundTag;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.SchematicHandler.DataCollection;
+import com.intellectualcrafters.plot.SchematicHandler.Dimension;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
-import com.intellectualcrafters.jnbt.CompoundTag;
-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.SchematicHandler;
-import com.intellectualcrafters.plot.SchematicHandler.DataCollection;
-import com.intellectualcrafters.plot.SchematicHandler.Dimension;
-import com.intellectualcrafters.plot.SetBlockFast;
-import com.intellectualcrafters.plot.Settings;
-import com.intellectualcrafters.plot.UUIDHandler;
+import java.util.HashMap;
public class Schematic extends SubCommand {
@@ -30,10 +41,10 @@ public class Schematic extends SubCommand {
// TODO command to fetch schematic from worldedit directory
}
- private int counter = 0;
+ private int counter = 0;
private boolean running = false;
- private Plot[] plots;
- private int task;
+ private Plot[] plots;
+ private int task;
@Override
public boolean execute(final Player plr, final String... args) {
@@ -98,8 +109,7 @@ public class Schematic extends SubCommand {
final Location loc = plr.getLocation();
x = Math.min(length2 - dem.getX(), loc.getBlockX() - bot.getBlockX());
z = Math.min(length2 - dem.getZ(), loc.getBlockZ() - bot.getBlockZ());
- }
- else {
+ } else {
x = 0;
z = 0;
}
@@ -215,8 +225,7 @@ public class Schematic extends SubCommand {
final String owner = o == null ? "unknown" : o;
if (sch == null) {
PlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
- }
- else {
+ } else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override
public void run() {
@@ -224,8 +233,7 @@ public class Schematic extends SubCommand {
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
if (!result) {
PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id);
}
}
@@ -259,8 +267,7 @@ public class Schematic extends SubCommand {
}
p2 = myplot;
world = plr.getWorld().getName();
- }
- else {
+ } else {
if (args.length == 3) {
try {
world = args[0];
@@ -271,13 +278,11 @@ public class Schematic extends SubCommand {
return false;
}
p2 = PlotMain.getPlots(world).get(i);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, "&cInvalid world or id. Use &7/plots sch save ");
return false;
}
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "&cInvalid world or id. Use &7/plots sch save ");
return false;
}
@@ -285,7 +290,7 @@ public class Schematic extends SubCommand {
final Plugin plugin2 = Bukkit.getServer().getPluginManager().getPlugin("PlotSquared");
- this.plots = new Plot[] { p2 };
+ this.plots = new Plot[]{p2};
this.running = true;
this.counter = 0;
@@ -304,8 +309,7 @@ public class Schematic extends SubCommand {
final String owner = o == null ? "unknown" : o;
if (sch == null) {
PlayerFunctions.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
- }
- else {
+ } else {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getServer().getPluginManager().getPlugin("PlotSquared"), new Runnable() {
@Override
public void run() {
@@ -313,8 +317,7 @@ public class Schematic extends SubCommand {
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
if (!result) {
PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, "&7 - &aExport success: " + plot.id);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
index 22ed5110d..1726b7299 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
@@ -1,17 +1,31 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Set.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
+import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
+import com.intellectualcrafters.plot.listeners.PlotListener;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -19,22 +33,9 @@ import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.AbstractFlag;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.FlagManager;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.PlotHomePosition;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.StringComparsion;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
-import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
-import com.intellectualcrafters.plot.listeners.PlotListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
/**
* @author Citymonstret
@@ -45,8 +46,8 @@ public class Set extends SubCommand {
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
}
- public static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "flag" };
- public static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
+ public static String[] values = new String[]{"biome", "wall", "wall_filling", "floor", "alias", "home", "flag"};
+ public static String[] aliases = new String[]{"b", "w", "wf", "f", "a", "h", "fl"};
@SuppressWarnings("deprecation")
@Override
@@ -92,8 +93,7 @@ public class Set extends SubCommand {
if (PlotMain.worldGuardListener != null) {
if (message.equals("")) {
message = StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6");
- }
- else {
+ } else {
message += "," + StringUtils.join(PlotMain.worldGuardListener.str_flags, "&c, &6");
}
}
@@ -105,8 +105,7 @@ public class Set extends SubCommand {
try {
af = FlagManager.getFlag(args[1].toLowerCase());
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
af = new AbstractFlag(args[1].toLowerCase());
}
@@ -174,8 +173,7 @@ public class Set extends SubCommand {
PlayerFunctions.sendMessage(plr, C.FLAG_ADDED);
PlotListener.plotEntry(plr, plot);
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, "&c" + e.getMessage());
return false;
}
@@ -265,8 +263,7 @@ public class Set extends SubCommand {
Material material;
try {
material = getMaterial(args[1], PlotWorld.BLOCKS);
- }
- catch (NullPointerException e) {
+ } catch (NullPointerException e) {
material = null;
}
/*
@@ -286,8 +283,7 @@ public class Set extends SubCommand {
if (args.length > 2) {
try {
data = (byte) Integer.parseInt(args[2]);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
return true;
}
@@ -343,12 +339,10 @@ public class Set extends SubCommand {
if (ss.length == 1) {
blocks[index] = new PlotBlock((short) m.getId(), (byte) 0);
- }
- else {
+ } else {
try {
b = (byte) Integer.parseInt(ss[1]);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
return true;
}
@@ -392,8 +386,7 @@ public class Set extends SubCommand {
if (args.length > 2) {
try {
data = (byte) Integer.parseInt(args[2]);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_DATA);
return true;
}
@@ -405,8 +398,7 @@ public class Set extends SubCommand {
AbstractFlag af = new AbstractFlag("");
try {
af = new AbstractFlag(args[0].toLowerCase());
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
if (FlagManager.getFlags().contains(af)) {
final StringBuilder a = new StringBuilder();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
index 24d7b2850..5a729559a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
@@ -1,23 +1,31 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = SetOwner.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.UUIDHandler;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class SetOwner extends SubCommand {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
index e9150f44f..30b3e42b0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
@@ -1,10 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.commands;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
@@ -14,13 +32,10 @@ import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.ConfigurationNode;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotGenerator;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
/**
* Created by Citymonstret on 2014-09-26.
@@ -30,9 +45,9 @@ public class Setup extends SubCommand implements Listener {
public static Map setupMap = new HashMap<>();
private class SetupObject {
- String world;
- String plugin;
- int current = 0;
+ String world;
+ String plugin;
+ int current = 0;
ConfigurationNode[] step;
@@ -61,8 +76,7 @@ public class Setup extends SubCommand implements Listener {
if (plr == null) {
plrname = "";
- }
- else {
+ } else {
plrname = plr.getName();
}
@@ -76,20 +90,17 @@ public class Setup extends SubCommand implements Listener {
}
try {
PlotMain.config.save(PlotMain.configFile);
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
// Creating the worlds
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal -g " + object.plugin);
- }
- else {
+ } else {
if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world + " plugin:" + object.plugin);
- }
- else {
+ } else {
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
if (plugin.isEnabled()) {
if (plugin.getDefaultWorldGenerator("world", "") != null) {
@@ -117,8 +128,7 @@ public class Setup extends SubCommand implements Listener {
if (args.length < 1) {
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
return true;
- }
- else {
+ } else {
if (args[0].equalsIgnoreCase("cancel")) {
setupMap.remove(plrname);
PlayerFunctions.sendMessage(plr, "&cCancelled setup.");
@@ -130,8 +140,7 @@ public class Setup extends SubCommand implements Listener {
step = object.step[object.current];
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
return true;
- }
- else {
+ } else {
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
return true;
}
@@ -148,15 +157,13 @@ public class Setup extends SubCommand implements Listener {
step = object.step[object.current];
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
return true;
- }
- else {
+ } else {
sendMessage(plr, C.SETUP_INVALID_ARG, args[0], step.getConstant());
sendMessage(plr, C.SETUP_STEP, object.current + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
return true;
}
}
- }
- else {
+ } else {
if (args.length < 1) {
sendMessage(plr, C.SETUP_MISSING_WORLD);
return true;
@@ -200,8 +207,7 @@ public class Setup extends SubCommand implements Listener {
PlotWorld plotworld;
if (generator instanceof PlotGenerator) {
plotworld = ((PlotGenerator) generator).getNewPlotWorld(world);
- }
- else {
+ } else {
plotworld = new DefaultPlotWorld(world);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
index afd01bd43..bacb6f222 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
@@ -1,17 +1,29 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = SubCommand.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
+import org.bukkit.entity.Player;
/**
* SubCommand class
@@ -19,11 +31,11 @@ import com.intellectualcrafters.plot.PlayerFunctions;
* @author Citymonstret
*/
public abstract class SubCommand {
- public boolean isPlayer;
+ public boolean isPlayer;
/**
* Command
*/
- public String cmd;
+ public String cmd;
/**
* Permission node
*/
@@ -31,32 +43,26 @@ public abstract class SubCommand {
/**
* Simple description
*/
- public String description;
+ public String description;
/**
* Alias
*/
- public String alias;
+ public String alias;
/**
* Command usage
*/
- public String usage;
+ public String usage;
- public CommandCategory category;
+ public CommandCategory category;
/**
- * @param cmd
- * Command /plot {cmd} <-- That!
- * @param permission
- * Permission Node
- * @param description
- * Simple description
- * @param usage
- * Usage description: /plot command {args...}
- * @param alias
- * Command alias
- * @param category
- * CommandCategory. Pick whichever closests to what you want.
+ * @param cmd Command /plot {cmd} <-- That!
+ * @param permission Permission Node
+ * @param description Simple description
+ * @param usage Usage description: /plot command {args...}
+ * @param alias Command alias
+ * @param category CommandCategory. Pick whichever closests to what you want.
*/
public SubCommand(final String cmd, final String permission, final String description, final String usage, final String alias, final CommandCategory category, final boolean isPlayer) {
this.cmd = cmd;
@@ -69,14 +75,10 @@ public abstract class SubCommand {
}
/**
- * @param command
- * Command /plot {cmd} <-- That!
- * @param description
- * Simple description
- * @param usage
- * Usage description: /plot command {args...}
- * @param category
- * CommandCategory. Pick whichever closests to what you want.
+ * @param command Command /plot {cmd} <-- That!
+ * @param description Simple description
+ * @param usage Usage description: /plot command {args...}
+ * @param category CommandCategory. Pick whichever closests to what you want.
*/
public SubCommand(final Command command, final String description, final String usage, final CommandCategory category, final boolean isPlayer) {
this.cmd = command.getCommand();
@@ -91,10 +93,8 @@ public abstract class SubCommand {
/**
* Execute.
*
- * @param plr
- * executor
- * @param args
- * arguments
+ * @param plr executor
+ * @param args arguments
* @return true on success, false on failure
*/
public abstract boolean execute(final Player plr, final String... args);
@@ -110,8 +110,9 @@ public abstract class SubCommand {
* @param c
* @param args
*/
- public void sendMessage(final Player plr, final C c, final String... args) {
+ public boolean sendMessage(final Player plr, final C c, final String... args) {
PlayerFunctions.sendMessage(plr, c, args);
+ return true;
}
public enum CommandCategory {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
index e8b706cd3..6fef7b53a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
@@ -1,25 +1,30 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Clear.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
import org.bukkit.World;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotSelection;
-import com.intellectualcrafters.plot.SetBlockFast;
-
/**
* Created by Citymonstret on 2014-08-01.
*/
@@ -59,8 +64,7 @@ public class Swap extends SubCommand {
PlayerFunctions.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
return false;
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
return false;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
index 0794e2265..342253ee0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
@@ -1,25 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = TP.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-
/**
* @author Citymonstret
*/
@@ -57,8 +64,7 @@ public class TP extends SubCommand {
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
PlotMain.teleportPlayer(plr, plr.getLocation(), PlotHelper.getPlot(world, plotid));
return true;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
}
return false;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
index 78fdb203d..08d5d023f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
@@ -1,24 +1,36 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Trusted.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.UUIDHandler;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
@SuppressWarnings("deprecation")
public class Trusted extends SubCommand {
@@ -47,8 +59,7 @@ public class Trusted extends SubCommand {
if (args[1].equalsIgnoreCase("*")) {
uuid = DBFunc.everyone;
- }
- else {
+ } else {
uuid = UUIDHandler.getUUID(args[1]);
}
if (!plot.trusted.contains(uuid)) {
@@ -68,15 +79,13 @@ public class Trusted extends SubCommand {
DBFunc.setTrusted(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
Bukkit.getPluginManager().callEvent(event);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.ALREADY_ADDED);
return false;
}
PlayerFunctions.sendMessage(plr, C.TRUSTED_ADDED);
return true;
- }
- else if (args[0].equalsIgnoreCase("remove")) {
+ } else if (args[0].equalsIgnoreCase("remove")) {
if (args[1].equalsIgnoreCase("*")) {
final UUID uuid = DBFunc.everyone;
if (!plot.trusted.contains(uuid)) {
@@ -107,8 +116,7 @@ public class Trusted extends SubCommand {
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
Bukkit.getPluginManager().callEvent(event);
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
- }
- else {
+ } else {
PlayerFunctions.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
index c1da665cd..b294e61f4 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
@@ -1,33 +1,39 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Unlink.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
import org.bukkit.Bukkit;
import org.bukkit.World;
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.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.SetBlockFast;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
+import java.util.ArrayList;
/**
- * Created by Citymonstret on 2014-08-01.
+ * Created 2014-08-01 for PlotSquared
+ *
+ * @author Citymonstret
*/
public class Unlink extends SubCommand {
@@ -72,6 +78,8 @@ public class Unlink extends SubCommand {
for (final PlotId id : ids) {
final Plot myplot = PlotMain.getPlots(world).get(id);
+ if (plot == null) continue;
+
if (plot.helpers != null) {
myplot.helpers = plot.helpers;
}
@@ -79,7 +87,7 @@ public class Unlink extends SubCommand {
myplot.denied = plot.denied;
}
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());
}
@@ -108,8 +116,7 @@ public class Unlink extends SubCommand {
if (PlotHelper.canSetFast) {
SetBlockFast.update(plr);
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
index a7b112b87..a9422ce47 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
@@ -1,25 +1,33 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = Visit.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.*;
+import org.bukkit.entity.Player;
+
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import org.bukkit.entity.Player;
-
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.UUIDHandler;
-
public class Visit extends SubCommand {
public Visit() {
super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT, true);
@@ -60,8 +68,7 @@ public class Visit extends SubCommand {
int i;
try {
i = Integer.parseInt(args[1]);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_NUMBER);
return true;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
index 7f5e79ce5..40adca9c3 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
@@ -1,26 +1,32 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = list.java >> Generated by: Citymonstret at 2014-08-09 01:41
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import java.util.HashMap;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.StringComparsion;
-import com.intellectualcrafters.plot.UUIDHandler;
+import java.util.HashMap;
+import java.util.UUID;
/**
* @author Citymonstret
@@ -37,10 +43,9 @@ public class list extends SubCommand {
final StringBuilder builder = new StringBuilder();
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
if (plr != null) {
- builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all" }));
- }
- else {
- builder.append(getArgumentList(new String[] { "all" }));
+ builder.append(getArgumentList(new String[]{"mine", "shared", "world", "all"}));
+ } else {
+ builder.append(getArgumentList(new String[]{"all"}));
}
PlayerFunctions.sendMessage(plr, builder.toString());
return true;
@@ -60,8 +65,7 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "You have").replaceAll("%num%", idx + "").replaceAll("%plot%", idx == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString());
return true;
- }
- else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
+ } else if (args[0].equalsIgnoreCase("shared") && (plr != null)) {
final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
for (final Plot p : PlotMain.getPlotsSorted()) {
@@ -72,8 +76,7 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotMain.getPlotsSorted().size() + "").replaceAll("%plot%", PlotMain.getPlotsSorted().size() == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString());
return true;
- }
- else if (args[0].equalsIgnoreCase("all")) {
+ } else if (args[0].equalsIgnoreCase("all")) {
// Current page
int page = 0;
@@ -85,8 +88,7 @@ public class list extends SubCommand {
if (page < 0) {
page = 0;
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
page = 0;
}
}
@@ -121,8 +123,7 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotMain.getPlotsSorted().size() + "").replaceAll("%plot%", PlotMain.getPlotsSorted().size() == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString());
return true;
- }
- else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
+ } else if (args[0].equalsIgnoreCase("world") && (plr != null)) {
final StringBuilder string = new StringBuilder();
string.append(C.PLOT_LIST_HEADER.s().replaceAll("%word%", "all") + "\n");
final HashMap plots = PlotMain.getPlots(plr.getWorld());
@@ -132,10 +133,9 @@ public class list extends SubCommand {
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.values().size() + "").replaceAll("%plot%", plots.values().size() == 1 ? "plot" : "plots"));
PlayerFunctions.sendMessage(plr, string.toString());
return true;
- }
- else {
+ } else {
// execute(plr);
- sendMessage(plr, C.DID_YOU_MEAN, new StringComparsion(args[0], new String[] { "mine", "shared", "world", "all" }).getBestMatch());
+ sendMessage(plr, C.DID_YOU_MEAN, new StringComparsion(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch());
return false;
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
index 2719472a5..32684d812 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
@@ -1,26 +1,38 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = plugin.java >> Generated by: Citymonstret at 2014-08-09 01:42
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotMain;
-
public class plugin extends SubCommand {
public plugin() {
@@ -35,8 +47,7 @@ public class plugin extends SubCommand {
public void run() {
try {
downloads = convertToNumericString(getInfo("https://intellectualsites.com/spigot_api.php?method=downloads&url=http://www.spigotmc.org/resources/plotsquared.1177/"), false);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
downloads = "unknown";
}
}
@@ -46,8 +57,7 @@ public class plugin extends SubCommand {
public void run() {
try {
version = convertToNumericString(getInfo("https://intellectualsites.com/spigot_api.php?method=version&resource=1177"), true);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
// Let's just ignore this, most likely error 500...
version = "unknown";
}
@@ -82,8 +92,7 @@ public class plugin extends SubCommand {
for (final char c : str.toCharArray()) {
if (Character.isDigit(c)) {
builder.append(c);
- }
- else if (dividers && ((c == ',') || (c == '.') || (c == '-') || (c == '_'))) {
+ } else if (dividers && ((c == ',') || (c == '.') || (c == '-') || (c == '_'))) {
builder.append(c);
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
index edbd6e09f..18f8a67cd 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
@@ -1,26 +1,38 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = DBFunc.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
+import com.intellectualcrafters.plot.Flag;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.PlotComment;
+import com.intellectualcrafters.plot.PlotId;
+import org.bukkit.OfflinePlayer;
+
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.UUID;
-import org.bukkit.OfflinePlayer;
-
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotId;
-
/**
* @author Citymonstret
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
index 8c71f812a..bdc9f13ea 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
@@ -1,24 +1,36 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = DBFunc.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.UUID;
-
-import org.bukkit.OfflinePlayer;
-
import com.intellectualcrafters.plot.Flag;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotComment;
import com.intellectualcrafters.plot.PlotId;
+import org.bukkit.OfflinePlayer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.UUID;
/**
* @author Citymonstret
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/Database.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/Database.java
index 482974faf..a495783ed 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/Database.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/Database.java
@@ -1,11 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database;
+import org.bukkit.plugin.Plugin;
+
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
-import org.bukkit.plugin.Plugin;
-
/**
* Abstract Database class, serves as a base for any connection method (MySQL,
* SQLite, etc.)
@@ -23,8 +44,7 @@ public abstract class Database {
/**
* Creates a new Database
*
- * @param plugin
- * Plugin instance
+ * @param plugin Plugin instance
*/
protected Database(final Plugin plugin) {
this.plugin = plugin;
@@ -34,10 +54,8 @@ public abstract class Database {
* Opens a connection with the database
*
* @return Opened connection
- * @throws SQLException
- * if the connection can not be opened
- * @throws ClassNotFoundException
- * if the driver cannot be found
+ * @throws SQLException if the connection can not be opened
+ * @throws ClassNotFoundException if the driver cannot be found
*/
public abstract Connection openConnection() throws SQLException, ClassNotFoundException;
@@ -45,8 +63,7 @@ public abstract class Database {
* Checks if a connection is open with the database
*
* @return true if the connection is open
- * @throws SQLException
- * if the connection cannot be checked
+ * @throws SQLException if the connection cannot be checked
*/
public abstract boolean checkConnection() throws SQLException;
@@ -61,8 +78,7 @@ public abstract class Database {
* Closes the connection with the database
*
* @return true if successful
- * @throws SQLException
- * if the connection cannot be closed
+ * @throws SQLException if the connection cannot be closed
*/
public abstract boolean closeConnection() throws SQLException;
@@ -70,13 +86,10 @@ public abstract class Database {
* Executes a SQL Query
* If the connection is closed, it will be opened
*
- * @param query
- * Query to be run
+ * @param query Query to be run
* @return the results of the query
- * @throws SQLException
- * If the query cannot be executed
- * @throws ClassNotFoundException
- * If the driver cannot be found; see {@link #openConnection()}
+ * @throws SQLException If the query cannot be executed
+ * @throws ClassNotFoundException If the driver cannot be found; see {@link #openConnection()}
*/
public abstract ResultSet querySQL(final String query) throws SQLException, ClassNotFoundException;
@@ -85,13 +98,10 @@ public abstract class Database {
* See {@link java.sql.Statement#executeUpdate(String)}
* If the connection is closed, it will be opened
*
- * @param query
- * Query to be run
+ * @param query Query to be run
* @return Result Code, see {@link java.sql.Statement#executeUpdate(String)}
- * @throws SQLException
- * If the query cannot be executed
- * @throws ClassNotFoundException
- * If the driver cannot be found; see {@link #openConnection()}
+ * @throws SQLException If the query cannot be executed
+ * @throws ClassNotFoundException If the driver cannot be found; see {@link #openConnection()}
*/
public abstract int updateSQL(final String query) throws SQLException, ClassNotFoundException;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
index 1baee3e3a..ad8574ab6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
@@ -1,13 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
import org.bukkit.plugin.Plugin;
+import java.sql.*;
+
/**
* Connects to and uses a MySQL database
*
@@ -21,23 +38,17 @@ public class MySQL extends Database {
private final String port;
private final String hostname;
- private Connection connection;
+ private Connection connection;
/**
* Creates a new MySQL instance
*
- * @param plugin
- * Plugin instance
- * @param hostname
- * Name of the host
- * @param port
- * Port number
- * @param database
- * Database name
- * @param username
- * Username
- * @param password
- * Password
+ * @param plugin Plugin instance
+ * @param hostname Name of the host
+ * @param port Port number
+ * @param database Database name
+ * @param username Username
+ * @param password Password
*/
public MySQL(final Plugin plugin, final String hostname, final String port, final String database, final String username, final String password) {
super(plugin);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
index 6fddf7652..fc151c1ea 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database;
import java.io.IOException;
@@ -26,7 +47,9 @@ import com.worldcretornica.plotme.Plot;
import com.worldcretornica.plotme.PlotManager;
/**
- * Created by Citymonstret on 2014-08-17.
+ * Created 2014-08-17 for ${PROJECT_NAME}
+ *
+ * @author Citymonstret
*/
public class PlotMeConverter {
@@ -71,10 +94,10 @@ public class PlotMeConverter {
PlotMain.config.set("worlds." + world.getName() + ".wall.block", wallblock);
final String floor = plotConfig.getString("worlds." + world.getName() + ".PlotFloorBlockId"); //
- PlotMain.config.set("worlds." + world.getName() + ".plot.floor", Arrays.asList(new String[] { floor }));
+ PlotMain.config.set("worlds." + world.getName() + ".plot.floor", Arrays.asList(new String[]{floor}));
final String filling = plotConfig.getString("worlds." + world.getName() + ".PlotFillingBlockId"); //
- PlotMain.config.set("worlds." + world.getName() + ".plot.filling", Arrays.asList(new String[] { filling }));
+ PlotMain.config.set("worlds." + world.getName() + ".plot.filling", Arrays.asList(new String[]{filling}));
final String road = plotConfig.getString("worlds." + world.getName() + ".RoadMainBlockId");
PlotMain.config.set("worlds." + world.getName() + ".road.block", road);
@@ -88,8 +111,7 @@ public class PlotMeConverter {
final Boolean auto_link = plotConfig.getBoolean("worlds." + world.getName() + ".AutoLinkPlots"); //
PlotMain.config.set("worlds." + world.getName() + ".plot.auto_merge", auto_link);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
PlotMain.sendConsoleSenderMessage(" - Failed to save configuration for world '" + world.getName() + "'. This will need to be done using the setup command or manually.");
}
@@ -134,13 +156,11 @@ public class PlotMeConverter {
psDenied.add(set.getValue());
}
}
- }
- else {
+ } else {
for (final String user : plot.getAllowed().split(",")) {
if (user.equals("*")) {
psAdded.add(DBFunc.everyone);
- }
- else {
+ } else {
final UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + user).getBytes(Charsets.UTF_8));
psAdded.add(uuid);
}
@@ -149,42 +169,36 @@ public class PlotMeConverter {
for (final String user : plot.getDenied().split(",")) {
if (user.equals("*")) {
psDenied.add(DBFunc.everyone);
- }
- else {
+ } else {
final UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + user).getBytes(Charsets.UTF_8));
psDenied.add(uuid);
}
}
- }
- catch (final Throwable e) {
+ } catch (final Throwable e) {
}
}
- }
- catch (final Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
- }
- finally {
+ } finally {
}
final PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
com.intellectualcrafters.plot.Plot pl = null;
if (online) {
pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
- "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] { false, false, false, false });
- }
- else {
+ "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
+ } else {
final String owner = plot.getOwner();
pl = new com.intellectualcrafters.plot.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
- "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] { false, false, false, false });
+ "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
}
if (pl != null) {
if (!PlotMain.getPlots(world).containsKey(id)) {
createdPlots.add(pl);
- }
- else {
+ } else {
duplicate++;
}
}
@@ -203,8 +217,7 @@ public class PlotMeConverter {
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8:&7 Saving configuration...");
try {
PlotMain.config.save(PlotMain.configFile);
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
PlotMain.sendConsoleSenderMessage(" - &cFailed to save configuration.");
}
@@ -213,8 +226,7 @@ public class PlotMeConverter {
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
MV = true;
- }
- else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
+ } else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
MW = true;
}
@@ -229,26 +241,22 @@ public class PlotMeConverter {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + worldname);
try {
Thread.sleep(1000);
- }
- catch (final InterruptedException ex) {
+ } catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
// load
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + worldname + " normal -g PlotSquared");
- }
- else if (MW) {
+ } else if (MW) {
// unload
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + worldname);
try {
Thread.sleep(1000);
- }
- catch (final InterruptedException ex) {
+ } catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
// load
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + worldname + " plugin:PlotSquared");
- }
- else {
+ } else {
Bukkit.getServer().unloadWorld(world, true);
final World myworld = WorldCreator.name(worldname).generator(new WorldGenerator(worldname)).createWorld();
myworld.save();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
index 09dc80d71..2bedd36be 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = DBFunc.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
@@ -45,12 +58,12 @@ public class SQLManager extends AbstractDB {
// TODO MongoDB @Brandon
- public static final String SET_OWNER = "UPDATE `" + PREFIX + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ?";
- public static final String GET_ALL_PLOTS = "SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `" + PREFIX + "plot`";
- public static final String CREATE_PLOTS = "INSERT INTO `" + PREFIX + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ";
+ public static final String SET_OWNER = "UPDATE `" + PREFIX + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ?";
+ public static final String GET_ALL_PLOTS = "SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `" + PREFIX + "plot`";
+ public static final String CREATE_PLOTS = "INSERT INTO `" + PREFIX + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ";
public static final String CREATE_SETTINGS = "INSERT INTO `" + PREFIX + "plot_settings` (`plot_plot_id`) values ";
- public static final String CREATE_HELPERS = "INSERT INTO `" + PREFIX + "plot_helpers` (`plot_plot_id`, `user_uuid`) values ";
- public static final String CREATE_PLOT = "INSERT INTO `" + PREFIX + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) VALUES(?, ?, ?, ?)";
+ public static final String CREATE_HELPERS = "INSERT INTO `" + PREFIX + "plot_helpers` (`plot_plot_id`, `user_uuid`) values ";
+ public static final String CREATE_PLOT = "INSERT INTO `" + PREFIX + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) VALUES(?, ?, ?, ?)";
/**
* Set Plot owner
@@ -70,8 +83,7 @@ public class SQLManager extends AbstractDB {
statement.setInt(3, plot.id.y);
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "Could not set owner for plot " + plot.id);
}
@@ -101,8 +113,7 @@ public class SQLManager extends AbstractDB {
}
stored.get(world).put(new PlotId(idx, idz), id);
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
@@ -135,8 +146,7 @@ public class SQLManager extends AbstractDB {
}
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
@@ -165,8 +175,7 @@ public class SQLManager extends AbstractDB {
}
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set helper for plots");
e.printStackTrace();
}
@@ -205,8 +214,7 @@ public class SQLManager extends AbstractDB {
}
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "Failed to save plots!");
}
@@ -228,8 +236,7 @@ public class SQLManager extends AbstractDB {
stmt.setString(4, plot.world);
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "Failed to save plot " + plot.id);
}
@@ -256,8 +263,7 @@ public class SQLManager extends AbstractDB {
stmt.addBatch("ALTER TABLE `" + PREFIX + "plot_settings` ADD CONSTRAINT `" + PREFIX + "plot_settings_ibfk_1` FOREIGN KEY (`plot_plot_id`) REFERENCES `" + PREFIX + "plot` (`id`) ON DELETE CASCADE");
}
- }
- else {
+ } else {
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot` (" + "`id` INTEGER PRIMARY KEY AUTOINCREMENT," + "`plot_id_x` INT(11) NOT NULL," + "`plot_id_z` INT(11) NOT NULL," + "`owner` VARCHAR(45) NOT NULL," + "`world` VARCHAR(45) NOT NULL," + "`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP)");
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_denied` (" + "`plot_plot_id` INT(11) NOT NULL," + "`user_uuid` VARCHAR(40) NOT NULL" + ")");
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + PREFIX + "plot_helpers` (" + "`plot_plot_id` INT(11) NOT NULL," + "`user_uuid` VARCHAR(40) NOT NULL" + ")");
@@ -304,8 +310,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(1, id);
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "Failed to delete plot " + plot.id);
}
@@ -330,8 +335,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(1, id);
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
@@ -354,8 +358,7 @@ public class SQLManager extends AbstractDB {
}
stmt.close();
return id;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
return Integer.MAX_VALUE;
@@ -388,8 +391,7 @@ public class SQLManager extends AbstractDB {
statement.executeBatch();
statement.close();
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
final HashMap plots = new HashMap();
@@ -422,8 +424,7 @@ public class SQLManager extends AbstractDB {
if (!worlds.contains(worldname)) {
if (noExist.containsKey(worldname)) {
noExist.put(worldname, noExist.get(worldname) + 1);
- }
- else {
+ } else {
noExist.put(worldname, 1);
}
}
@@ -433,7 +434,7 @@ public class SQLManager extends AbstractDB {
user = UUID.fromString(o);
uuids.put(o, user);
}
- p = new Plot(plot_id, user, Biome.FOREST, new ArrayList(), new ArrayList(), new ArrayList(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[] { false, false, false, false });
+ p = new Plot(plot_id, user, Biome.FOREST, new ArrayList(), new ArrayList(), new ArrayList(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[]{false, false, false, false});
plots.put(id, p);
}
stmt.close();
@@ -454,8 +455,7 @@ public class SQLManager extends AbstractDB {
final Plot plot = plots.get(id);
if (plot != null) {
plot.addHelper(user);
- }
- else {
+ } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
}
@@ -477,8 +477,7 @@ public class SQLManager extends AbstractDB {
final Plot plot = plots.get(id);
if (plot != null) {
plot.addTrusted(user);
- }
- else {
+ } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
}
}
@@ -500,8 +499,7 @@ public class SQLManager extends AbstractDB {
final Plot plot = plots.get(id);
if (plot != null) {
plot.addDenied(user);
- }
- else {
+ } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
}
}
@@ -552,17 +550,15 @@ public class SQLManager extends AbstractDB {
merged[3 - i] = ((m) & (1 << i)) != 0;
}
plot.settings.setMerged(merged);
- }
- else {
- plot.settings.setMerged(new boolean[] { false, false, false, false });
+ } else {
+ plot.settings.setMerged(new boolean[]{false, false, false, false});
}
String[] flags_string;
final String myflags = r.getString("flags");
if (myflags == null) {
- flags_string = new String[] {};
- }
- else {
+ flags_string = new String[]{};
+ } else {
flags_string = myflags.split(",");
}
final ArrayList flags = new ArrayList();
@@ -571,13 +567,11 @@ public class SQLManager extends AbstractDB {
if (element.contains(":")) {
final String[] split = element.split(":");
try {
- flags.add(new Flag(FlagManager.getFlag(split[0], true), split[1].replace("´", ",").replace("¯", ":")));
- }
- catch (final Exception e) {
+ flags.add(new Flag(FlagManager.getFlag(split[0], true), split[1].replace("�", ",").replace("�", ":")));
+ } catch (final Exception e) {
exception = true;
}
- }
- else {
+ } else {
flags.add(new Flag(FlagManager.getFlag(element, true), ""));
}
}
@@ -586,8 +580,7 @@ public class SQLManager extends AbstractDB {
setFlags(id, flags.toArray(new Flag[0]));
}
plot.settings.setFlags(flags.toArray(new Flag[0]));
- }
- else {
+ } else {
PlotMain.sendConsoleSenderMessage("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
}
}
@@ -607,8 +600,7 @@ public class SQLManager extends AbstractDB {
if (invalidPlot) {
PlotMain.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to load plots.");
e.printStackTrace();
}
@@ -631,8 +623,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(2, getId(world, plot.id));
stmt.execute();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Could not set merged for plot " + plot.id);
}
@@ -649,7 +640,7 @@ public class SQLManager extends AbstractDB {
if (i != 0) {
flag_string.append(",");
}
- flag_string.append(flag.getKey() + ":" + flag.getValue().replace(",", "´").replace(":", "¯"));
+ flag_string.append(flag.getKey() + ":" + flag.getValue());
i++;
}
runTask(new Runnable() {
@@ -661,8 +652,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(2, getId(world, plot.id));
stmt.execute();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Could not set flag for plot " + plot.id);
}
@@ -687,8 +677,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(2, id);
stmt.execute();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Could not set flag for plot " + id);
}
@@ -713,8 +702,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(2, getId(world, plot.id));
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set alias for plot " + plot.id);
e.printStackTrace();
}
@@ -748,8 +736,7 @@ public class SQLManager extends AbstractDB {
final int id = result.getInt("id");
ids.add(id);
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '" + world + "'!");
return;
@@ -785,8 +772,7 @@ public class SQLManager extends AbstractDB {
stmt.setString(1, world);
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "FAILED TO PURGE PLOT FROM DB '" + world + "' , '" + id + "' !");
return;
@@ -813,8 +799,7 @@ public class SQLManager extends AbstractDB {
final int id = result.getInt("id");
ids.add(id);
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '" + world + "'!");
return;
@@ -850,8 +835,7 @@ public class SQLManager extends AbstractDB {
stmt.setString(1, world);
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.DANGER, "FAILED TO PURGE WORLD '" + world + "'!");
return;
@@ -879,8 +863,7 @@ public class SQLManager extends AbstractDB {
stmt.setInt(2, getId(world, plot.id));
stmt.executeUpdate();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set position for plot " + plot.id);
e.printStackTrace();
}
@@ -933,8 +916,7 @@ public class SQLManager extends AbstractDB {
}
stmt.close();
;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to load settings for plot: " + id);
e.printStackTrace();
}
@@ -954,8 +936,7 @@ public class SQLManager extends AbstractDB {
statement.setString(4, comment.senderName);
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Failed to remove helper for plot " + plot.id);
}
@@ -979,8 +960,7 @@ public class SQLManager extends AbstractDB {
comments.add(comment);
}
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace();
}
@@ -1000,8 +980,7 @@ public class SQLManager extends AbstractDB {
statement.setString(4, comment.senderName);
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Failed to remove helper for plot " + plot.id);
}
@@ -1025,8 +1004,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Failed to remove helper for plot " + plot.id);
}
@@ -1049,8 +1027,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Failed to remove trusted user for plot " + plot.id);
}
@@ -1073,8 +1050,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set helper for plot " + plot.id);
e.printStackTrace();
}
@@ -1097,8 +1073,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set plot trusted for plot " + plot.id);
e.printStackTrace();
}
@@ -1121,8 +1096,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
Logger.add(LogLevel.WARNING, "Failed to remove denied for plot " + plot.id);
}
@@ -1145,8 +1119,7 @@ public class SQLManager extends AbstractDB {
statement.setString(2, player.getUniqueId().toString());
statement.executeUpdate();
statement.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
@@ -1166,8 +1139,7 @@ public class SQLManager extends AbstractDB {
}
statement.close();
return rating;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
Logger.add(LogLevel.WARNING, "Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace();
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
index 4307234e1..f9993c829 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
@@ -1,16 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database;
+import org.bukkit.plugin.Plugin;
+
import java.io.File;
import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
+import java.sql.*;
import java.util.logging.Level;
-import org.bukkit.plugin.Plugin;
-
/**
* Connects to and uses a SQLite database
*
@@ -19,16 +36,14 @@ import org.bukkit.plugin.Plugin;
*/
public class SQLite extends Database {
- private Connection connection;
+ private Connection connection;
private final String dbLocation;
/**
* Creates a new SQLite instance
*
- * @param plugin
- * Plugin instance
- * @param dbLocation
- * Location of the Database (Must end in .db)
+ * @param plugin Plugin instance
+ * @param dbLocation Location of the Database (Must end in .db)
*/
public SQLite(final Plugin plugin, final String dbLocation) {
super(plugin);
@@ -47,8 +62,7 @@ public class SQLite extends Database {
if (!(file.exists())) {
try {
file.createNewFile();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
this.plugin.getLogger().log(Level.SEVERE, "Unable to create database!");
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLField.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLField.java
index f0dbcb866..2c44c2c09 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLField.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLField.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database.sqlobjects;
/**
@@ -6,7 +27,7 @@ package com.intellectualcrafters.plot.database.sqlobjects;
public class SQLField {
private final SQLType type;
- private final Object value;
+ private final Object value;
public SQLField(final SQLType type, final Object value) {
this.type = type;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
index 793482490..7895169ed 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database.sqlobjects;
import com.intellectualcrafters.plot.Settings;
@@ -7,9 +28,9 @@ import com.intellectualcrafters.plot.Settings;
*/
public abstract class SQLTable {
- private final String name;
+ private final String name;
private final SQLField[] fields;
-
+
public SQLTable(final String name, final String primaryKey, final SQLField... fields) {
this.name = Settings.DB.PREFIX + name;
this.fields = fields;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLType.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLType.java
index 0ba15305e..071e462b5 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLType.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLType.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.database.sqlobjects;
/**
@@ -11,8 +32,8 @@ public enum SQLType {
private Object defaultValue;
private String sqlName;
- private Class javaClass;
- private int length;
+ private Class javaClass;
+ private int length;
SQLType(final Object defaultValue, final String sqlName, final Class javaClass, final int length) {
this.defaultValue = defaultValue;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
index 5d3bdc384..09124d277 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
@@ -1,29 +1,40 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerClaimPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Created by Citymonstret on 2014-08-09.
*/
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private boolean cancelled;
- private final Plot plot;
+ private final Plot plot;
/**
* PlayerClaimPlotEvent: Called when a plot is claimed
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
index 00a93ffc1..c7bf41a80 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
@@ -1,11 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Created by Citymonstret on 2014-08-16.
*/
@@ -13,7 +33,7 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
private static HandlerList handlers = new HandlerList();
- private final Plot plot;
+ private final Plot plot;
/**
* PlayerEnterPlotEvent: Called when a player leaves a plot
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
index c0b19e6c8..44498a7fa 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
@@ -1,18 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Created by Citymonstret on 2014-08-16.
*/
public class PlayerLeavePlotEvent extends PlayerEvent {
private static HandlerList handlers = new HandlerList();
- private final Plot plot;
+ private final Plot plot;
/**
* PlayerLeavePlotEvent: Called when a player leaves a plot
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
index d0d346e4d..40c6615ca 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
@@ -1,12 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.events;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Plot;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-08-16.
@@ -14,10 +34,10 @@ import com.intellectualcrafters.plot.Plot;
public class PlayerPlotDeniedEvent extends Event {
private static HandlerList handlers = new HandlerList();
- private final Plot plot;
- private final Player initiator;
- private final boolean added;
- private final UUID player;
+ private final Plot plot;
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
/**
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
index 14d71f866..2d87a935a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
@@ -1,12 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.events;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Plot;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-08-16.
@@ -14,10 +34,10 @@ import com.intellectualcrafters.plot.Plot;
public class PlayerPlotHelperEvent extends Event {
private static HandlerList handlers = new HandlerList();
- private final Plot plot;
- private final Player initiator;
- private final boolean added;
- private final UUID player;
+ private final Plot plot;
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
/**
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
index ea91c7bd8..4c3bc7094 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
@@ -1,12 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.events;
-import java.util.UUID;
-
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Plot;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-08-16.
@@ -14,10 +34,10 @@ import com.intellectualcrafters.plot.Plot;
public class PlayerPlotTrustedEvent extends Event {
private static HandlerList handlers = new HandlerList();
- private final Plot plot;
- private final Player initiator;
- private final boolean added;
- private final UUID player;
+ private final Plot plot;
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
/**
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
index ec34e20e8..9f94a10bf 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
@@ -1,32 +1,43 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerTeleportToPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 14:57
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Called when a player teleports to a plot
*/
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
- private final Location from;
- private final Plot plot;
+ private final Location from;
+ private final Plot plot;
- private boolean cancelled;
+ private boolean cancelled;
/**
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
index 8b62a2e91..0529076e1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
@@ -1,29 +1,40 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotClearEvent.java >> Generated by: Citymonstret at 2014-08-09
- * 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.PlotId;
-
/**
* Called when a plot is cleared
*/
public class PlotClearEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private boolean cancelled;
- private final PlotId id;
- private final String world;
+ private final PlotId id;
+ private final String world;
/**
* PlotDeleteEvent: Called when a plot is cleared
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
index b510c3cc3..e373df66a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
@@ -1,29 +1,40 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlotDeleteEvent.java >> Generated by: Citymonstret at 2014-08-09
- * 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.PlotId;
-
/**
* Called when a plot is deleted
*/
public class PlotDeleteEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private boolean cancelled;
- private final PlotId id;
- private final String world;
+ private final PlotId id;
+ private final String world;
/**
* PlotDeleteEvent: Called when a plot is deleted
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
index 11193eae3..7b0e3b8d3 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
@@ -1,30 +1,41 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerClaimPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Flag;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Called when a Flag is added to a plot
*/
public class PlotFlagAddEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private boolean cancelled;
- private final Plot plot;
- private final Flag flag;
+ private final Plot plot;
+ private final Flag flag;
/**
* PlotFlagAddEvent: Called when a Flag is added to a plot
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
index 24b5b7c02..9e74ffa53 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
@@ -1,30 +1,41 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerClaimPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
+import com.intellectualcrafters.plot.Flag;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-
/**
* Called when a flag is removed from a plot
*/
public class PlotFlagRemoveEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private boolean cancelled;
- private final Plot plot;
- private final Flag flag;
+ private final Plot plot;
+ private final Flag flag;
/**
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
index b6f4e34cc..abf5e6273 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
@@ -1,34 +1,45 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerClaimPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.PlotId;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
+import java.util.ArrayList;
/**
* Created by Citymonstret on 2014-08-09.
*/
public class PlotMergeEvent extends Event implements Cancellable {
- private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private static HandlerList handlers = new HandlerList();
+ private boolean cancelled;
private final ArrayList plots;
- private Plot plot;
- private World world;
+ private Plot plot;
+ private World world;
/**
* PlotMergeEvent: Called when plots are merged
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
index 0f07856df..1f9582101 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
@@ -1,32 +1,43 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerClaimPlotEvent.java >> Generated by: Citymonstret at
- * 2014-08-09 15:21
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.events;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.PlotId;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import com.intellectualcrafters.plot.PlotId;
+import java.util.ArrayList;
/**
* Created by Citymonstret on 2014-08-09.
*/
public class PlotUnlinkEvent extends Event implements Cancellable {
- private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
+ private static HandlerList handlers = new HandlerList();
+ private boolean cancelled;
private final ArrayList plots;
- private final World world;
+ private final World world;
/**
* Called when a mega-plot is unlinked.
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
index 4a4862a42..da9fc429a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
@@ -1,21 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.generator;
-import java.util.ArrayList;
-
+import com.intellectualcrafters.plot.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
+import java.util.ArrayList;
public class DefaultPlotManager extends PlotManager {
@@ -45,8 +58,7 @@ public class DefaultPlotManager extends PlotManager {
int pathWidthLower;
if ((dpw.ROAD_WIDTH % 2) == 0) {
pathWidthLower = (int) (Math.floor(dpw.ROAD_WIDTH / 2) - 1);
- }
- else {
+ } else {
pathWidthLower = (int) Math.floor(dpw.ROAD_WIDTH / 2);
}
@@ -95,8 +107,7 @@ public class DefaultPlotManager extends PlotManager {
int pathWidthLower;
if ((dpw.ROAD_WIDTH % 2) == 0) {
pathWidthLower = (int) (Math.floor(dpw.ROAD_WIDTH / 2) - 1);
- }
- else {
+ } else {
pathWidthLower = (int) Math.floor(dpw.ROAD_WIDTH / 2);
}
@@ -290,8 +301,7 @@ public class DefaultPlotManager extends PlotManager {
if (min == null) {
min = new Location(world, Math.max(i - 1, plotMinX), 0, Math.max(j - 1, plotMinZ));
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
- }
- else if ((max.getBlockZ() < (j + 15)) || (max.getBlockX() < (i + 15))) {
+ } else if ((max.getBlockZ() < (j + 15)) || (max.getBlockX() < (i + 15))) {
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
}
world.regenerateChunk(i / 16, j / 16);
@@ -303,8 +313,7 @@ public class DefaultPlotManager extends PlotManager {
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
- }
- else {
+ } else {
if (min.getBlockX() < plotMinX) {
min.setX(plotMinX);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
index 50b073540..f1174f173 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
@@ -1,14 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.generator;
+import com.intellectualcrafters.plot.*;
import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection;
-import com.intellectualcrafters.plot.Configuration;
-import com.intellectualcrafters.plot.ConfigurationNode;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
-
public class DefaultPlotWorld extends PlotWorld {
/*
@@ -20,106 +36,106 @@ public class DefaultPlotWorld extends PlotWorld {
/**
* Road Height
*/
- public int ROAD_HEIGHT;
+ public int ROAD_HEIGHT;
/**
* Default Road Height: 64
*/
- public static int ROAD_HEIGHT_DEFAULT = 64;
+ public static int ROAD_HEIGHT_DEFAULT = 64;
/**
* plot height
*/
- public int PLOT_HEIGHT;
+ public int PLOT_HEIGHT;
/**
* Default plot height: 64
*/
- public static int PLOT_HEIGHT_DEFAULT = 64;
+ public static int PLOT_HEIGHT_DEFAULT = 64;
/**
* Wall height
*/
- public int WALL_HEIGHT;
+ public int WALL_HEIGHT;
/**
* Default Wall Height: 64
*/
- public static int WALL_HEIGHT_DEFAULT = 64;
+ public static int WALL_HEIGHT_DEFAULT = 64;
/**
* plot width
*/
- public int PLOT_WIDTH;
+ public int PLOT_WIDTH;
/**
* Default plot width: 32
*/
- public static int PLOT_WIDTH_DEFAULT = 32;
+ public static int PLOT_WIDTH_DEFAULT = 32;
/**
* Road width
*/
- public int ROAD_WIDTH;
+ public int ROAD_WIDTH;
/**
* Default road width: 7
*/
- public static int ROAD_WIDTH_DEFAULT = 7;
+ public static int ROAD_WIDTH_DEFAULT = 7;
/**
* Plot main block
*/
- public PlotBlock[] MAIN_BLOCK;
+ public PlotBlock[] MAIN_BLOCK;
/**
* Default main block: 1
*/
- public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock((short) 1, (byte) 0) };
+ public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 1, (byte) 0)};
/**
* Top blocks
*/
- public PlotBlock[] TOP_BLOCK;
+ public PlotBlock[] TOP_BLOCK;
/**
* Default top blocks: {"2"}
*/
- public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock((short) 2, (byte) 0) };
+ public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 2, (byte) 0)};
/**
* Wall block
*/
- public PlotBlock WALL_BLOCK;
+ public PlotBlock WALL_BLOCK;
/**
* Default wall block: 44
*/
- public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
- public PlotBlock CLAIMED_WALL_BLOCK;
- public static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
+ public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
+ public PlotBlock CLAIMED_WALL_BLOCK;
+ public static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
/**
* Wall filling
*/
- public PlotBlock WALL_FILLING;
+ public PlotBlock WALL_FILLING;
/**
* Default wall filling: 1
*/
- public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
+ public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
/**
* Road stripes
*/
- public PlotBlock ROAD_STRIPES;
+ public PlotBlock ROAD_STRIPES;
/**
* Default road stripes: 35
*/
- public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
+ public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
/**
* enable road stripes
*/
- public boolean ROAD_STRIPES_ENABLED;
- public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
+ public boolean ROAD_STRIPES_ENABLED;
+ public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
/**
* Road block
*/
- public PlotBlock ROAD_BLOCK;
+ public PlotBlock ROAD_BLOCK;
/**
* Default road block: 155
*/
- public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
+ public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
/*
* Here we are just calling the super method, nothing special
@@ -131,7 +147,7 @@ public class DefaultPlotWorld extends PlotWorld {
/**
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED
* FOR INITIAL SETUP
- *
+ *
* Set the last boolean to false if you do not require a specific config
* node to be set while using the setup command - this may be useful if a
* config value can be changed at a later date, and has no impact on the
@@ -140,8 +156,8 @@ public class DefaultPlotWorld extends PlotWorld {
@Override
public ConfigurationNode[] getSettingNodes() {
// TODO return a set of configuration nodes (used for setup command)
- return new ConfigurationNode[] { new ConfigurationNode("plot.height", DefaultPlotWorld.PLOT_HEIGHT_DEFAULT, "Plot height", Configuration.INTEGER, true), new ConfigurationNode("plot.size", DefaultPlotWorld.PLOT_WIDTH_DEFAULT, "Plot width", Configuration.INTEGER, true), new ConfigurationNode("plot.filling", DefaultPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true), new ConfigurationNode("plot.floor", DefaultPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true), new ConfigurationNode("wall.block", DefaultPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true), new ConfigurationNode("wall.block_claimed", DefaultPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true), new ConfigurationNode("road.width", DefaultPlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true),
- new ConfigurationNode("road.height", DefaultPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true), new ConfigurationNode("road.enable_stripes", DefaultPlotWorld.ROAD_STRIPES_ENABLED_DEFAULT, "Enable road stripes", Configuration.BOOLEAN, true), new ConfigurationNode("road.block", DefaultPlotWorld.ROAD_BLOCK_DEFAULT, "Road block", Configuration.BLOCK, true), new ConfigurationNode("road.stripes", DefaultPlotWorld.ROAD_STRIPES_DEFAULT, "Road stripe block", Configuration.BLOCK, true), new ConfigurationNode("wall.filling", DefaultPlotWorld.WALL_FILLING_DEFAULT, "Wall filling block", Configuration.BLOCK, true), new ConfigurationNode("wall.height", DefaultPlotWorld.WALL_HEIGHT_DEFAULT, "Wall height", Configuration.INTEGER, true), };
+ return new ConfigurationNode[]{new ConfigurationNode("plot.height", DefaultPlotWorld.PLOT_HEIGHT_DEFAULT, "Plot height", Configuration.INTEGER, true), new ConfigurationNode("plot.size", DefaultPlotWorld.PLOT_WIDTH_DEFAULT, "Plot width", Configuration.INTEGER, true), new ConfigurationNode("plot.filling", DefaultPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true), new ConfigurationNode("plot.floor", DefaultPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true), new ConfigurationNode("wall.block", DefaultPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true), new ConfigurationNode("wall.block_claimed", DefaultPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true), new ConfigurationNode("road.width", DefaultPlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true),
+ new ConfigurationNode("road.height", DefaultPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true), new ConfigurationNode("road.enable_stripes", DefaultPlotWorld.ROAD_STRIPES_ENABLED_DEFAULT, "Enable road stripes", Configuration.BOOLEAN, true), new ConfigurationNode("road.block", DefaultPlotWorld.ROAD_BLOCK_DEFAULT, "Road block", Configuration.BLOCK, true), new ConfigurationNode("road.stripes", DefaultPlotWorld.ROAD_STRIPES_DEFAULT, "Road stripe block", Configuration.BLOCK, true), new ConfigurationNode("wall.filling", DefaultPlotWorld.WALL_FILLING_DEFAULT, "Wall filling block", Configuration.BLOCK, true), new ConfigurationNode("wall.height", DefaultPlotWorld.WALL_HEIGHT_DEFAULT, "Wall height", Configuration.INTEGER, true),};
}
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
index b2b7c5d5a..40805a6c5 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.generator;
import java.util.Arrays;
@@ -18,23 +39,23 @@ import com.intellectualcrafters.plot.PlotManager;
import com.intellectualcrafters.plot.PlotWorld;
/**
- * @auther Empire92
* @author Citymonstret The default generator is very messy, as we have decided
* to try externalize all calculations from within the loop. - You will
* see a lot of slower implementations have a single for loop. - This is
* perfectly fine to do, it will just mean world generation may take
* somewhat longer
+ * @auther Empire92
*/
public class WorldGenerator extends PlotGenerator {
/**
* result object is returned for each generated chunk, do stuff to it
*/
- short[][] result;
+ short[][] result;
/**
* plotworld object
*/
- DefaultPlotWorld plotworld = null;
+ DefaultPlotWorld plotworld = null;
/**
* Set to static to re-use the same managet for all Default World Generators
*/
@@ -43,19 +64,19 @@ public class WorldGenerator extends PlotGenerator {
/**
* Some generator specific variables (implementation dependent)
*/
- final int plotsize;
- final int pathsize;
- final PlotBlock wall;
- final PlotBlock wallfilling;
- final PlotBlock floor1;
- final PlotBlock floor2;
- final int size;
- final Biome biome;
- final int roadheight;
- final int wallheight;
- final int plotheight;
- final PlotBlock[] plotfloors;
- final PlotBlock[] filling;
+ final int plotsize;
+ final int pathsize;
+ final PlotBlock wall;
+ final PlotBlock wallfilling;
+ final PlotBlock floor1;
+ final PlotBlock floor2;
+ final int size;
+ final Biome biome;
+ final int roadheight;
+ final int wallheight;
+ final int plotheight;
+ final PlotBlock[] plotfloors;
+ final PlotBlock[] filling;
/**
* Return the plot manager for this type of generator, or create one For
@@ -129,8 +150,7 @@ public class WorldGenerator extends PlotGenerator {
private void setCuboidRegion(final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks) {
if (blocks.length == 1) {
setCuboidRegion(x1, x2, y1, y2, z1, z2, blocks[0]);
- }
- else {
+ } else {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
@@ -157,9 +177,18 @@ public class WorldGenerator extends PlotGenerator {
*/
public WorldGenerator(final String world) {
super(world);
-
+
if (this.plotworld == null) {
- this.plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
+ this.plotworld = new DefaultPlotWorld(world);
+ if (!PlotMain.config.contains("worlds." + world)) {
+ PlotMain.config = YamlConfiguration.loadConfiguration(PlotMain.configFile);
+ PlotMain.config.createSection("worlds." + world);
+ }
+ final ConfigurationSection section = PlotMain.config.getConfigurationSection("worlds." + world);
+ this.plotworld.saveConfiguration(section);
+ this.plotworld.loadDefaultConfiguration(section);
+ this.plotworld.loadConfiguration(section);
+ PlotMain.sendConsoleSenderMessage("&cFailed to load the plotworld settings from the configuration. Attempting to reload it");
}
this.plotsize = this.plotworld.PLOT_WIDTH;
@@ -227,8 +256,7 @@ public class WorldGenerator extends PlotGenerator {
double pathWidthLower;
if ((this.pathsize % 2) == 0) {
pathWidthLower = Math.floor(this.pathsize / 2) - 1;
- }
- else {
+ } else {
pathWidthLower = Math.floor(this.pathsize / 2);
}
cx = (cx % this.size) + (8 * this.size);
@@ -283,14 +311,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -304,14 +330,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -325,14 +349,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -346,14 +368,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -375,8 +395,7 @@ public class WorldGenerator extends PlotGenerator {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
}
- }
- else {
+ } else {
if (roadStartZ <= 16) {
if (plotMinX > 16) {
setCuboidRegion(0, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
@@ -388,8 +407,7 @@ public class WorldGenerator extends PlotGenerator {
if (plotMinZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
- }
- else {
+ } else {
int z = 16 - roadStartZ;
if (z < 0) {
z = 16;
@@ -400,8 +418,7 @@ public class WorldGenerator extends PlotGenerator {
if (roadStartZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
- }
- else {
+ } else {
if (roadStartX <= 16) {
if (plotMinZ > 16) {
int x = 16 - roadStartX;
@@ -413,8 +430,7 @@ public class WorldGenerator extends PlotGenerator {
}
}
}
- }
- else {
+ } else {
if (plotMinZ <= 16) {
if (roadStartX > 16) {
int x = 16 - roadStartX;
@@ -424,8 +440,7 @@ public class WorldGenerator extends PlotGenerator {
setCuboidRegion(0, x, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
}
- }
- else {
+ } else {
if (roadStartZ > 16) {
int x = 16 - roadStartX;
if (x < 0) {
@@ -438,16 +453,14 @@ public class WorldGenerator extends PlotGenerator {
if (roadStartX > 16) {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors);
- }
- else {
+ } else {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors);
}
}
}
}
- }
- else {
+ } else {
if (roadStartX <= 16) {
if (roadStartZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
@@ -476,14 +489,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -498,14 +509,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -520,14 +529,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinX + 1) <= 16) {
start = 16 - plotMinX;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX + 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 1) <= 16) || (roadStartX <= 16))) {
@@ -542,14 +549,12 @@ public class WorldGenerator extends PlotGenerator {
int start, end;
if ((plotMinZ + 1) <= 16) {
start = 16 - plotMinZ;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ + 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 1) <= 16) || ((roadStartZ + 1) <= 16))) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
index 7f8d70134..7dd5efe82 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
@@ -1,14 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.generator;
-import java.util.Random;
-
+import com.intellectualcrafters.plot.PlotBlock;
+import com.intellectualcrafters.plot.PlotWorld;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotWorld;
+import java.util.Random;
/**
* @author Citymonstret
@@ -21,8 +41,8 @@ public class XPopulator extends BlockPopulator {
* information about how a BlockPopulator works.
*/
- private int X;
- private int Z;
+ private int X;
+ private int Z;
private long state;
public final long nextLong() {
@@ -59,8 +79,7 @@ public class XPopulator extends BlockPopulator {
private void setCuboidRegion(final int x1, final int x2, final int y1, final int y2, final int z1, final int z2, final PlotBlock[] blocks, final World w) {
if (blocks.length == 1) {
setCuboidRegion(x1, x2, y1, y2, z1, z2, blocks[0], w);
- }
- else {
+ } else {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
@@ -78,26 +97,26 @@ public class XPopulator extends BlockPopulator {
public short[] getBlock(final String block) {
if (block.contains(":")) {
final String[] split = block.split(":");
- return new short[] { Short.parseShort(split[0]), Short.parseShort(split[1]) };
+ return new short[]{Short.parseShort(split[0]), Short.parseShort(split[1])};
}
- return new short[] { Short.parseShort(block), 0 };
+ return new short[]{Short.parseShort(block), 0};
}
- int plotsize;
- int pathsize;
- PlotBlock wall;
- PlotBlock wallfilling;
- PlotBlock floor1;
- PlotBlock floor2;
- int size;
- Biome biome;
- int roadheight;
- int wallheight;
- int plotheight;
- PlotBlock[] plotfloors;
- PlotBlock[] filling;
+ int plotsize;
+ int pathsize;
+ PlotBlock wall;
+ PlotBlock wallfilling;
+ PlotBlock floor1;
+ PlotBlock floor2;
+ int size;
+ Biome biome;
+ int roadheight;
+ int wallheight;
+ int plotheight;
+ PlotBlock[] plotfloors;
+ PlotBlock[] filling;
- private double pathWidthLower;
+ private double pathWidthLower;
private final DefaultPlotWorld plotworld;
public XPopulator(final PlotWorld pw) {
@@ -124,8 +143,7 @@ public class XPopulator extends BlockPopulator {
if ((this.pathsize % 2) == 0) {
this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
- }
- else {
+ } else {
this.pathWidthLower = Math.floor(this.pathsize / 2);
}
}
@@ -187,14 +205,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -208,14 +224,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -229,14 +243,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -250,14 +262,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -273,14 +283,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinX + 2) <= 16) {
start = 16 - plotMinX - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX - 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
@@ -295,14 +303,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinZ + 2) <= 16) {
start = 16 - plotMinZ - 1;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ - 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
@@ -317,14 +323,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinX + 1) <= 16) {
start = 16 - plotMinX;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartX + 1) <= 16) {
end = (16 - roadStartX) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinX + 1) <= 16) || (roadStartX <= 16))) {
@@ -339,14 +343,12 @@ public class XPopulator extends BlockPopulator {
int start, end;
if ((plotMinZ + 1) <= 16) {
start = 16 - plotMinZ;
- }
- else {
+ } else {
start = 16;
}
if ((roadStartZ + 1) <= 16) {
end = (16 - roadStartZ) + 1;
- }
- else {
+ } else {
end = 0;
}
if (!(((plotMinZ + 1) <= 16) || ((roadStartZ + 1) <= 16))) {
@@ -371,8 +373,7 @@ public class XPopulator extends BlockPopulator {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
}
- }
- else {
+ } else {
if (roadStartZ <= 16) {
if (plotMinX > 16) {
setCuboidRegion(0, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
@@ -384,8 +385,7 @@ public class XPopulator extends BlockPopulator {
if (plotMinZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
- }
- else {
+ } else {
int z = 16 - roadStartZ;
if (z < 0) {
z = 16;
@@ -396,8 +396,7 @@ public class XPopulator extends BlockPopulator {
if (roadStartZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
- }
- else {
+ } else {
if (roadStartX <= 16) {
if (plotMinZ > 16) {
int x = 16 - roadStartX;
@@ -409,8 +408,7 @@ public class XPopulator extends BlockPopulator {
}
}
}
- }
- else {
+ } else {
if (plotMinZ <= 16) {
if (roadStartX > 16) {
int x = 16 - roadStartX;
@@ -420,8 +418,7 @@ public class XPopulator extends BlockPopulator {
setCuboidRegion(0, x, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
}
- }
- else {
+ } else {
if (roadStartZ > 16) {
int x = 16 - roadStartX;
if (x < 0) {
@@ -434,16 +431,14 @@ public class XPopulator extends BlockPopulator {
if (roadStartX > 16) {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors, w);
- }
- else {
+ } else {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors, w);
}
}
}
}
- }
- else {
+ } else {
if (roadStartX <= 16) {
if (roadStartZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
index 962090bb5..2b4340d6f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
@@ -1,8 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.listeners;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -12,8 +32,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import java.util.HashSet;
+import java.util.Set;
/**
* Created by Citymonstret on 2014-10-24.
@@ -58,20 +78,17 @@ public class ForceFieldListener implements Listener {
double x = 0d, y = 0d, z = 0d;
if (playerX < oPlayerX) {
x = 1.0d;
- }
- else if (playerX > oPlayerX) {
+ } else if (playerX > oPlayerX) {
x = -1.0d;
}
if (playerY < oPlayerY) {
y = 0.5d;
- }
- else if (playerY > oPlayerY) {
+ } else if (playerY > oPlayerY) {
y = -0.5d;
}
if (playerZ < oPlayerZ) {
z = 1.0d;
- }
- else if (playerZ > oPlayerZ) {
+ } else if (playerZ > oPlayerZ) {
z = -1.0d;
}
return new Vector(x, y, z);
@@ -91,8 +108,7 @@ public class ForceFieldListener implements Listener {
for (final Player oPlayer : players) {
oPlayer.setVelocity(calculateVelocity(player, oPlayer));
}
- }
- else {
+ } else {
final Player oPlayer = hasNearbyPermitted(player, plot);
if (oPlayer == null) {
return;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index a0f2772ad..d53ba4f2b 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -1,21 +1,30 @@
-/*
- * Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
- * and/or monetize any of our intellectual property. IntellectualCrafters is not
- * affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
- *
- * >> File = PlayerEvents.java >> Generated by: Citymonstret at 2014-08-09 01:43
- */
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.listeners;
-import java.util.List;
-import java.util.Set;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.commands.Setup;
+import com.intellectualcrafters.plot.database.DBFunc;
+import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
@@ -24,18 +33,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockDamageEvent;
-import org.bukkit.event.block.BlockFadeEvent;
-import org.bukkit.event.block.BlockFormEvent;
-import org.bukkit.event.block.BlockFromToEvent;
-import org.bukkit.event.block.BlockGrowEvent;
-import org.bukkit.event.block.BlockIgniteEvent;
-import org.bukkit.event.block.BlockPistonExtendEvent;
-import org.bukkit.event.block.BlockPistonRetractEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.block.BlockSpreadEvent;
-import org.bukkit.event.block.EntityBlockFormEvent;
+import org.bukkit.event.block.*;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@@ -43,31 +41,12 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.player.AsyncPlayerChatEvent;
-import org.bukkit.event.player.PlayerBucketEmptyEvent;
-import org.bukkit.event.player.PlayerBucketFillEvent;
-import org.bukkit.event.player.PlayerChangedWorldEvent;
-import org.bukkit.event.player.PlayerEggThrowEvent;
-import org.bukkit.event.player.PlayerInteractEntityEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.event.player.*;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldLoadEvent;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotSelection;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.Settings;
-import com.intellectualcrafters.plot.commands.Setup;
-import com.intellectualcrafters.plot.database.DBFunc;
+import java.util.List;
+import java.util.Set;
/**
* Player Events involving plots
@@ -124,14 +103,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return;
}
plotEntry(player, plot);
- }
- else if (leftPlot(event.getFrom(), event.getTo())) {
+ } else if (leftPlot(event.getFrom(), event.getTo())) {
final Plot plot = getCurrentPlot(event.getFrom());
plotExit(player, plot);
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
// Gotta catch 'em all.
}
}
@@ -176,7 +153,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return;
}
if (isInPlot(event.getBlock().getLocation())) {
- if (event.getBlock().getY()==0) {
+ if (event.getBlock().getY() == 0) {
event.setCancelled(true);
return;
}
@@ -221,7 +198,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public static void onPeskyMobsChangeTheWorldLikeWTFEvent( // LOL!
- final EntityChangeBlockEvent event) {
+ final EntityChangeBlockEvent event) {
final World world = event.getBlock().getWorld();
if (!isPlotWorld(world)) {
return;
@@ -231,23 +208,20 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!(e instanceof org.bukkit.entity.FallingBlock)) {
event.setCancelled(true);
}
- }
- else {
+ } else {
final Block b = event.getBlock();
final Player p = (Player) e;
if (!isInPlot(b.getLocation())) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
event.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
event.setCancelled(true);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
event.setCancelled(true);
}
@@ -337,14 +311,11 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
{
if (e.getDirection() == BlockFace.EAST) {
l = e.getBlock().getLocation().subtract(modifier, 0, 0);
- }
- else if (e.getDirection() == BlockFace.NORTH) {
+ } else if (e.getDirection() == BlockFace.NORTH) {
l = e.getBlock().getLocation().subtract(0, 0, modifier);
- }
- else if (e.getDirection() == BlockFace.SOUTH) {
+ } else if (e.getDirection() == BlockFace.SOUTH) {
l = e.getBlock().getLocation().add(0, 0, modifier);
- }
- else if (e.getDirection() == BlockFace.WEST) {
+ } else if (e.getDirection() == BlockFace.WEST) {
l = e.getBlock().getLocation().add(modifier, 0, 0);
}
@@ -362,18 +333,15 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isInPlot(b.getLocation().subtract(1, 0, 0))) {
e.setCancelled(true);
}
- }
- else if (e.getDirection() == BlockFace.NORTH) {
+ } else if (e.getDirection() == BlockFace.NORTH) {
if (!isInPlot(b.getLocation().subtract(0, 0, 1))) {
e.setCancelled(true);
}
- }
- else if (e.getDirection() == BlockFace.SOUTH) {
+ } else if (e.getDirection() == BlockFace.SOUTH) {
if (!isInPlot(b.getLocation().add(0, 0, 1))) {
e.setCancelled(true);
}
- }
- else if (e.getDirection() == BlockFace.WEST) {
+ } else if (e.getDirection() == BlockFace.WEST) {
if (!isInPlot(b.getLocation().add(1, 0, 0))) {
e.setCancelled(true);
}
@@ -412,7 +380,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (event.getClickedBlock() == null) {
return;
}
- final World world = event.getPlayer().getWorld();
+ final World world = event.getPlayer().getWorld();
if (!isPlotWorld(world)) {
return;
}
@@ -461,11 +429,9 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
if ((reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) && pW.SPAWN_EGGS) {
return;
- }
- else if ((reason == CreatureSpawnEvent.SpawnReason.BREEDING) && pW.SPAWN_BREEDING) {
+ } else if ((reason == CreatureSpawnEvent.SpawnReason.BREEDING) && pW.SPAWN_BREEDING) {
return;
- }
- else if ((reason == CreatureSpawnEvent.SpawnReason.CUSTOM) && pW.SPAWN_CUSTOM) {
+ } else if ((reason == CreatureSpawnEvent.SpawnReason.CUSTOM) && pW.SPAWN_CUSTOM) {
return;
}
if (event.getEntity() instanceof Player) {
@@ -490,22 +456,19 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!PlotMain.hasPermission(p, "plots.admin")) {
e.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
e.setCancelled(true);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
e.setCancelled(true);
}
}
}
- }
- else {
+ } else {
e.setCancelled(true);
}
}
@@ -523,14 +486,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (plot.deny_entry(event.getPlayer())) {
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
event.setCancelled(true);
- }
- else {
+ } else {
if (enteredPlot(f, t)) {
plotEntry(event.getPlayer(), plot);
}
}
- }
- else {
+ } else {
if (leftPlot(f, t)) {
final Plot plot = getCurrentPlot(event.getFrom());
plotExit(event.getPlayer(), plot);
@@ -551,14 +512,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isInPlot(b.getLocation())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
- }
- else if (!plot.hasRights(e.getPlayer())) {
+ } else if (!plot.hasRights(e.getPlayer())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
@@ -601,14 +560,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (!isInPlot(b.getLocation())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
- }
- else if (!plot.hasRights(e.getPlayer())) {
+ } else if (!plot.hasRights(e.getPlayer())) {
PlayerFunctions.sendMessage(e.getPlayer(), C.NO_PLOT_PERMS);
e.setCancelled(true);
}
@@ -627,16 +584,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(b.getLocation());
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
@@ -658,16 +613,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
@@ -688,16 +641,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
@@ -719,8 +670,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final PlotWorld pW = getPlotWorld(l.getWorld());
if (!aPlr && pW.PVE) {
return;
- }
- else if (aPlr && pW.PVP) {
+ } else if (aPlr && pW.PVP) {
return;
}
if (!isInPlot(l)) {
@@ -728,8 +678,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setCancelled(true);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
@@ -737,8 +686,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
e.setCancelled(true);
return;
}
- }
- else if (aPlr && !booleanFlag(plot, "pvp")) {
+ } else if (aPlr && !booleanFlag(plot, "pvp")) {
return;
}
if (!aPlr && !booleanFlag(plot, "pve")) {
@@ -766,16 +714,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
}
- }
- else {
+ } else {
final Plot plot = getCurrentPlot(l);
if (plot == null) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
}
- }
- else if (!plot.hasRights(p)) {
+ } else if (!plot.hasRights(p)) {
if (!PlotMain.hasPermission(p, "plots.admin")) {
PlayerFunctions.sendMessage(p, C.NO_PLOT_PERMS);
e.setHatching(false);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
index 6c441f46b..7ba1e8f42 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
@@ -1,33 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.listeners;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.WeatherType;
-import org.bukkit.World;
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
+import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.FlagManager;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.Settings;
-import com.intellectualcrafters.plot.Title;
-import com.intellectualcrafters.plot.UUIDHandler;
-import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
-import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-10-21.
@@ -133,8 +138,7 @@ public class PlotListener {
str = str.toLowerCase();
if (str.equals("rain")) {
return WeatherType.DOWNFALL;
- }
- else {
+ } else {
return WeatherType.CLEAR;
}
}
@@ -185,8 +189,7 @@ public class PlotListener {
try {
final Long time = Long.parseLong(plot.settings.getFlag("time").getValue());
player.setPlayerTime(time, true);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
plot.settings.setFlags(FlagManager.removeFlag(plot.settings.getFlags(), "time"));
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
index c504f5d26..608550148 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
@@ -1,17 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.listeners;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Effect;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
+import com.intellectualcrafters.plot.C;
+import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
+import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import org.bukkit.*;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -25,11 +40,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
-import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import java.util.*;
/**
* Created by Citymonstret on 2014-10-30.
@@ -232,13 +243,15 @@ public class PlotPlusListener extends PlotListener implements Listener {
*/
public static class RecordMeta {
public static List metaList = new ArrayList<>();
+
static {
for (int x = 3; x < 12; x++) {
metaList.add(new RecordMeta(x + "", Material.valueOf("RECORD_" + x)));
}
}
- private final String name;
- private final Material material;
+
+ private final String name;
+ private final Material material;
public RecordMeta(final String name, final Material material) {
this.name = name;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
index 71106d562..463c57a6a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
@@ -1,9 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.listeners;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -12,28 +32,18 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerPortalEvent;
-import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.event.player.*;
-import com.intellectualcrafters.plot.PWE;
-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.database.DBFunc;
-import com.intellectualcrafters.plot.events.PlotDeleteEvent;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author Citymonstret
*/
public class WorldEditListener implements Listener {
- public final Set blockedcmds = new HashSet(Arrays.asList("/gmask", "//gmask", "/worldedit:gmask"));
+ public final Set blockedcmds = new HashSet(Arrays.asList("/gmask", "//gmask", "/worldedit:gmask"));
public final Set restrictedcmds = new HashSet(Arrays.asList("/up", "//up", "/worldedit:up"));
private boolean isPlotWorld(final Location l) {
@@ -100,8 +110,7 @@ public class WorldEditListener implements Listener {
if ((plot == null) || !(plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
e.setCancelled(true);
}
- }
- else if (this.blockedcmds.contains(cmd)) {
+ } else if (this.blockedcmds.contains(cmd)) {
e.setCancelled(true);
}
}
@@ -115,8 +124,7 @@ public class WorldEditListener implements Listener {
final Location l = p.getLocation();
if (isPlotWorld(l)) {
PWE.setMask(p, l);
- }
- else {
+ } else {
PWE.removeMask(p);
}
}
@@ -175,8 +183,7 @@ public class WorldEditListener implements Listener {
if (!isPlotWorld(t)) {
if (isPlotWorld(f)) {
PWE.removeMask(p);
- }
- else {
+ } else {
return;
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
index 61a3b2970..71716fbc6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
@@ -1,24 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.listeners;
-import java.util.ArrayList;
-import java.util.Map;
-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 org.bukkit.permissions.PermissionAttachment;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.events.PlotMergeEvent;
@@ -30,13 +33,26 @@ import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
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;
+import org.bukkit.permissions.PermissionAttachment;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-09-24.
*/
public class WorldGuardListener implements Listener {
- public ArrayList str_flags = new ArrayList();
- public ArrayList> flags = new ArrayList>();
+ public ArrayList str_flags = new ArrayList();
+ public ArrayList> flags = new ArrayList>();
public WorldGuardListener(final PlotMain plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
@@ -62,12 +78,10 @@ public class WorldGuardListener implements Listener {
manager.getRegion(plot.id.x + "-" + plot.id.y);
requester.performCommand("region setowner " + (plot.id.x + "-" + plot.id.y) + " " + UUIDHandler.getName(owner));
requester.performCommand("region removeowner " + (plot.id.x + "-" + plot.id.y) + " " + UUIDHandler.getName(plot.getOwner()));
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
// requester.setOp(op);
- }
- finally {
+ } finally {
add.remove();
remove.remove();
}
@@ -84,11 +98,9 @@ public class WorldGuardListener implements Listener {
requester.performCommand("region flag " + (plot.id.x + "-" + plot.id.y) + " " + key);
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
requester.setOp(op);
- }
- finally {
+ } finally {
requester.setOp(op);
}
}
@@ -104,11 +116,9 @@ public class WorldGuardListener implements Listener {
requester.performCommand("region flag " + (plot.id.x + "-" + plot.id.y) + " " + key + " " + value);
}
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
requester.setOp(op);
- }
- finally {
+ } finally {
requester.setOp(op);
}
}
@@ -178,8 +188,7 @@ public class WorldGuardListener implements Listener {
manager.addRegion(rg);
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
@@ -205,8 +214,7 @@ public class WorldGuardListener implements Listener {
region.setOwners(owner);
manager.addRegion(region);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
@@ -219,8 +227,7 @@ public class WorldGuardListener implements Listener {
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
manager.removeRegion(plot.x + "-" + plot.y);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/NameFetcher.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/NameFetcher.java
index 6172d1dfa..71ad971d9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/NameFetcher.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/NameFetcher.java
@@ -1,5 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.uuid;
+import com.google.common.collect.ImmutableList;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -9,18 +34,13 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-
-import com.google.common.collect.ImmutableList;
-
/**
* @author
*/
public class NameFetcher implements Callable> {
private static final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
- private final JSONParser jsonParser = new JSONParser();
- private final List uuids;
+ private final JSONParser jsonParser = new JSONParser();
+ private final List uuids;
public NameFetcher(final List uuids) {
this.uuids = ImmutableList.copyOf(uuids);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
index 90891f0dc..9e89f9f96 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
@@ -1,13 +1,26 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.uuid;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.plugin.java.JavaPlugin;
-
import com.google.common.collect.BiMap;
import com.intellectualcrafters.json.JSONObject;
import com.intellectualcrafters.json.JSONTokener;
@@ -15,6 +28,13 @@ import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.Settings;
import com.intellectualcrafters.plot.StringWrapper;
import com.intellectualcrafters.plot.UUIDHandler;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.UUID;
/**
* Created by Citymonstret on 2014-10-13.
@@ -45,8 +65,7 @@ public class PlotUUIDSaver extends UUIDSaver {
double ups;
if ((time == 0l) || (size == 0)) {
ups = size;
- }
- else {
+ } else {
ups = size / time;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDFetcher.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDFetcher.java
index 9ece35217..1921df1df 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDFetcher.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDFetcher.java
@@ -1,32 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.uuid;
+import com.google.common.collect.ImmutableList;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.Callable;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-
-import com.google.common.collect.ImmutableList;
-
/**
* @author
*/
public class UUIDFetcher implements Callable> {
private static final double PROFILES_PER_REQUEST = 100;
- private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
- private final JSONParser jsonParser = new JSONParser();
- private final List names;
- private final boolean rateLimiting;
+ private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
+ private final JSONParser jsonParser = new JSONParser();
+ private final List names;
+ private final boolean rateLimiting;
public UUIDFetcher(final List names, final boolean rateLimiting) {
this.names = ImmutableList.copyOf(names);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
index 9f81bda0c..005496357 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
@@ -1,10 +1,31 @@
-package com.intellectualcrafters.plot.uuid;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
-import java.util.UUID;
+package com.intellectualcrafters.plot.uuid;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.StringWrapper;
+import java.util.UUID;
+
/**
* Created by Citymonstret on 2014-10-13.
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSet.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSet.java
index 811ccb44f..5dec9bcd8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSet.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSet.java
@@ -1,3 +1,24 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PlotSquared - A plot manager and world generator for the Bukkit API /
+// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
+// /
+// This program is free software; you can redistribute it and/or modify /
+// it under the terms of the GNU General Public License as published by /
+// the Free Software Foundation; either version 3 of the License, or /
+// (at your option) any later version. /
+// /
+// This program is distributed in the hope that it will be useful, /
+// but WITHOUT ANY WARRANTY; without even the implied warranty of /
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
+// GNU General Public License for more details. /
+// /
+// You should have received a copy of the GNU General Public License /
+// along with this program; if not, write to the Free Software Foundation, /
+// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
+// /
+// You can contact us via: support@intellectualsites.com /
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
package com.intellectualcrafters.plot.uuid;
import java.util.UUID;
@@ -7,7 +28,7 @@ import java.util.UUID;
*/
public class UUIDSet {
private final String name;
- private final UUID uuid;
+ private final UUID uuid;
public UUIDSet(final String name, final UUID uuid) {
this.name = name;