mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
commit
ad20b79752
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.7.4</version>
|
<version>2.8</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
@ -61,10 +61,6 @@
|
|||||||
<id>sk80q</id>
|
<id>sk80q</id>
|
||||||
<url>http://maven.sk89q.com/artifactory/repo/</url>
|
<url>http://maven.sk89q.com/artifactory/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>vault-repo</id>
|
|
||||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class ByteArrayTag extends Tag {
|
public final class ByteArrayTag extends Tag {
|
||||||
private final byte[] value;
|
private final byte[] value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class ByteArrayTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class ByteArrayTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getValue() {
|
public byte[] getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder hex = new StringBuilder();
|
final StringBuilder hex = new StringBuilder();
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class ByteTag extends Tag {
|
public final class ByteTag extends Tag {
|
||||||
private final byte value;
|
private final byte value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class ByteTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class ByteTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Byte getValue() {
|
public Byte getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public final class CompoundTag extends Tag {
|
public final class CompoundTag extends Tag {
|
||||||
private final Map<String, Tag> value;
|
private final Map<String, Tag> value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -20,7 +20,7 @@ public final class CompoundTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = Collections.unmodifiableMap(value);
|
this.value = Collections.unmodifiableMap(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -31,7 +31,7 @@ public final class CompoundTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = Collections.unmodifiableMap(value);
|
this.value = Collections.unmodifiableMap(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this compound tag contains the given key.
|
* Returns whether this compound tag contains the given key.
|
||||||
*
|
*
|
||||||
@ -42,12 +42,12 @@ public final class CompoundTag extends Tag {
|
|||||||
public boolean containsKey(final String key) {
|
public boolean containsKey(final String key) {
|
||||||
return this.value.containsKey(key);
|
return this.value.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Tag> getValue() {
|
public Map<String, Tag> getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new compound tag with the given values.
|
* Return a new compound tag with the given values.
|
||||||
*
|
*
|
||||||
@ -58,7 +58,7 @@ public final class CompoundTag extends Tag {
|
|||||||
public CompoundTag setValue(final Map<String, Tag> value) {
|
public CompoundTag setValue(final Map<String, Tag> value) {
|
||||||
return new CompoundTag(getName(), value);
|
return new CompoundTag(getName(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a compound tag builder.
|
* Create a compound tag builder.
|
||||||
*
|
*
|
||||||
@ -67,7 +67,7 @@ public final class CompoundTag extends Tag {
|
|||||||
public CompoundTagBuilder createBuilder() {
|
public CompoundTagBuilder createBuilder() {
|
||||||
return new CompoundTagBuilder(new HashMap<String, Tag>(this.value));
|
return new CompoundTagBuilder(new HashMap<String, Tag>(this.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a byte array named with the given key. <p/> <p> If the key does not exist or its value is not a byte array
|
* Get a byte array named with the given key. <p/> <p> If the key does not exist or its value is not a byte array
|
||||||
* tag, then an empty byte array will be returned. </p>
|
* tag, then an empty byte array will be returned. </p>
|
||||||
@ -84,7 +84,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a byte named with the given key. <p/> <p> If the key does not exist or its value is not a byte tag, then
|
* Get a byte named with the given key. <p/> <p> If the key does not exist or its value is not a byte tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -101,7 +101,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return (byte) 0;
|
return (byte) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a double named with the given key. <p/> <p> If the key does not exist or its value is not a double tag, then
|
* Get a double named with the given key. <p/> <p> If the key does not exist or its value is not a double tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -118,7 +118,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a double named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
* Get a double named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
||||||
* its value is not a number, then {@code 0} will be returned. </p>
|
* its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -145,7 +145,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a float named with the given key. <p/> <p> If the key does not exist or its value is not a float tag, then
|
* Get a float named with the given key. <p/> <p> If the key does not exist or its value is not a float tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -162,7 +162,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@code int[]} named with the given key. <p/> <p> If the key does not exist or its value is not an int array
|
* Get a {@code int[]} named with the given key. <p/> <p> If the key does not exist or its value is not an int array
|
||||||
* tag, then an empty array will be returned. </p>
|
* tag, then an empty array will be returned. </p>
|
||||||
@ -179,7 +179,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an int named with the given key. <p/> <p> If the key does not exist or its value is not an int tag, then
|
* Get an int named with the given key. <p/> <p> If the key does not exist or its value is not an int tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -196,7 +196,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an int named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
* Get an int named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
||||||
* its value is not a number, then {@code 0} will be returned. </p>
|
* its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -223,7 +223,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of tags named with the given key. <p/> <p> If the key does not exist or its value is not a list tag,
|
* Get a list of tags named with the given key. <p/> <p> If the key does not exist or its value is not a list tag,
|
||||||
* then an empty list will be returned. </p>
|
* then an empty list will be returned. </p>
|
||||||
@ -240,7 +240,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@code TagList} named with the given key. <p/> <p> If the key does not exist or its value is not a list
|
* Get a {@code TagList} named with the given key. <p/> <p> If the key does not exist or its value is not a list
|
||||||
* tag, then an empty tag list will be returned. </p>
|
* tag, then an empty tag list will be returned. </p>
|
||||||
@ -257,7 +257,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return new ListTag(key, StringTag.class, Collections.<Tag> emptyList());
|
return new ListTag(key, StringTag.class, Collections.<Tag> emptyList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of tags named with the given key. <p/> <p> If the key does not exist or its value is not a list tag,
|
* Get a list of tags named with the given key. <p/> <p> If the key does not exist or its value is not a list tag,
|
||||||
* then an empty list will be returned. If the given key references a list but the list of of a different type, then
|
* then an empty list will be returned. If the given key references a list but the list of of a different type, then
|
||||||
@ -283,7 +283,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a long named with the given key. <p/> <p> If the key does not exist or its value is not a long tag, then
|
* Get a long named with the given key. <p/> <p> If the key does not exist or its value is not a long tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -300,7 +300,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a long named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
* Get a long named with the given key, even if it's another type of number. <p/> <p> If the key does not exist or
|
||||||
* its value is not a number, then {@code 0} will be returned. </p>
|
* its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -327,7 +327,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a short named with the given key. <p/> <p> If the key does not exist or its value is not a short tag, then
|
* Get a short named with the given key. <p/> <p> If the key does not exist or its value is not a short tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -344,7 +344,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a string named with the given key. <p/> <p> If the key does not exist or its value is not a string tag, then
|
* Get a string named with the given key. <p/> <p> If the key does not exist or its value is not a string tag, then
|
||||||
* {@code ""} will be returned. </p>
|
* {@code ""} will be returned. </p>
|
||||||
@ -361,7 +361,7 @@ public final class CompoundTag extends Tag {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -10,14 +10,14 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class CompoundTagBuilder {
|
public class CompoundTagBuilder {
|
||||||
private final Map<String, Tag> entries;
|
private final Map<String, Tag> entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*/
|
*/
|
||||||
CompoundTagBuilder() {
|
CompoundTagBuilder() {
|
||||||
this.entries = new HashMap<String, Tag>();
|
this.entries = new HashMap<String, Tag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance and use the given map (which will be modified).
|
* Create a new instance and use the given map (which will be modified).
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ public class CompoundTagBuilder {
|
|||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.entries = value;
|
this.entries = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new builder instance.
|
* Create a new builder instance.
|
||||||
*
|
*
|
||||||
@ -36,7 +36,7 @@ public class CompoundTagBuilder {
|
|||||||
public static CompoundTagBuilder create() {
|
public static CompoundTagBuilder create() {
|
||||||
return new CompoundTagBuilder();
|
return new CompoundTagBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and tag into the compound tag.
|
* Put the given key and tag into the compound tag.
|
||||||
*
|
*
|
||||||
@ -51,7 +51,7 @@ public class CompoundTagBuilder {
|
|||||||
this.entries.put(key, value);
|
this.entries.put(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code ByteArrayTag}.
|
* Put the given key and value into the compound tag as a {@code ByteArrayTag}.
|
||||||
*
|
*
|
||||||
@ -63,7 +63,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putByteArray(final String key, final byte[] value) {
|
public CompoundTagBuilder putByteArray(final String key, final byte[] value) {
|
||||||
return put(key, new ByteArrayTag(key, value));
|
return put(key, new ByteArrayTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code ByteTag}.
|
* Put the given key and value into the compound tag as a {@code ByteTag}.
|
||||||
*
|
*
|
||||||
@ -75,7 +75,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putByte(final String key, final byte value) {
|
public CompoundTagBuilder putByte(final String key, final byte value) {
|
||||||
return put(key, new ByteTag(key, value));
|
return put(key, new ByteTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code DoubleTag}.
|
* Put the given key and value into the compound tag as a {@code DoubleTag}.
|
||||||
*
|
*
|
||||||
@ -87,7 +87,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putDouble(final String key, final double value) {
|
public CompoundTagBuilder putDouble(final String key, final double value) {
|
||||||
return put(key, new DoubleTag(key, value));
|
return put(key, new DoubleTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code FloatTag}.
|
* Put the given key and value into the compound tag as a {@code FloatTag}.
|
||||||
*
|
*
|
||||||
@ -99,7 +99,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putFloat(final String key, final float value) {
|
public CompoundTagBuilder putFloat(final String key, final float value) {
|
||||||
return put(key, new FloatTag(key, value));
|
return put(key, new FloatTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code IntArrayTag}.
|
* Put the given key and value into the compound tag as a {@code IntArrayTag}.
|
||||||
*
|
*
|
||||||
@ -111,7 +111,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putIntArray(final String key, final int[] value) {
|
public CompoundTagBuilder putIntArray(final String key, final int[] value) {
|
||||||
return put(key, new IntArrayTag(key, value));
|
return put(key, new IntArrayTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as an {@code IntTag}.
|
* Put the given key and value into the compound tag as an {@code IntTag}.
|
||||||
*
|
*
|
||||||
@ -123,7 +123,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putInt(final String key, final int value) {
|
public CompoundTagBuilder putInt(final String key, final int value) {
|
||||||
return put(key, new IntTag(key, value));
|
return put(key, new IntTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code LongTag}.
|
* Put the given key and value into the compound tag as a {@code LongTag}.
|
||||||
*
|
*
|
||||||
@ -135,7 +135,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putLong(final String key, final long value) {
|
public CompoundTagBuilder putLong(final String key, final long value) {
|
||||||
return put(key, new LongTag(key, value));
|
return put(key, new LongTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code ShortTag}.
|
* Put the given key and value into the compound tag as a {@code ShortTag}.
|
||||||
*
|
*
|
||||||
@ -147,7 +147,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putShort(final String key, final short value) {
|
public CompoundTagBuilder putShort(final String key, final short value) {
|
||||||
return put(key, new ShortTag(key, value));
|
return put(key, new ShortTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the given key and value into the compound tag as a {@code StringTag}.
|
* Put the given key and value into the compound tag as a {@code StringTag}.
|
||||||
*
|
*
|
||||||
@ -159,7 +159,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTagBuilder putString(final String key, final String value) {
|
public CompoundTagBuilder putString(final String key, final String value) {
|
||||||
return put(key, new StringTag(key, value));
|
return put(key, new StringTag(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put all the entries from the given map into this map.
|
* Put all the entries from the given map into this map.
|
||||||
*
|
*
|
||||||
@ -174,7 +174,7 @@ public class CompoundTagBuilder {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an unnamed compound tag with this builder's entries.
|
* Build an unnamed compound tag with this builder's entries.
|
||||||
*
|
*
|
||||||
@ -183,7 +183,7 @@ public class CompoundTagBuilder {
|
|||||||
public CompoundTag build() {
|
public CompoundTag build() {
|
||||||
return new CompoundTag(new HashMap<String, Tag>(this.entries));
|
return new CompoundTag(new HashMap<String, Tag>(this.entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a new compound tag with this builder's entries.
|
* Build a new compound tag with this builder's entries.
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class DoubleTag extends Tag {
|
public final class DoubleTag extends Tag {
|
||||||
private final double value;
|
private final double value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class DoubleTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class DoubleTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Double getValue() {
|
public Double getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -10,12 +10,12 @@ public final class EndTag extends Tag {
|
|||||||
public EndTag() {
|
public EndTag() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TAG_End";
|
return "TAG_End";
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class FloatTag extends Tag {
|
public final class FloatTag extends Tag {
|
||||||
private final float value;
|
private final float value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class FloatTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class FloatTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Float getValue() {
|
public Float getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -7,7 +7,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public final class IntArrayTag extends Tag {
|
public final class IntArrayTag extends Tag {
|
||||||
private final int[] value;
|
private final int[] value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@ public final class IntArrayTag extends Tag {
|
|||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -30,12 +30,12 @@ public final class IntArrayTag extends Tag {
|
|||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getValue() {
|
public int[] getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder hex = new StringBuilder();
|
final StringBuilder hex = new StringBuilder();
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class IntTag extends Tag {
|
public final class IntTag extends Tag {
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class IntTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class IntTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getValue() {
|
public Integer getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -14,7 +14,7 @@ import javax.annotation.Nullable;
|
|||||||
public final class ListTag extends Tag {
|
public final class ListTag extends Tag {
|
||||||
private final Class<? extends Tag> type;
|
private final Class<? extends Tag> type;
|
||||||
private final List<Tag> value;
|
private final List<Tag> value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ public final class ListTag extends Tag {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = Collections.unmodifiableList(value);
|
this.value = Collections.unmodifiableList(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -41,7 +41,7 @@ public final class ListTag extends Tag {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = Collections.unmodifiableList(value);
|
this.value = Collections.unmodifiableList(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of item in this list.
|
* Gets the type of item in this list.
|
||||||
*
|
*
|
||||||
@ -50,12 +50,12 @@ public final class ListTag extends Tag {
|
|||||||
public Class<? extends Tag> getType() {
|
public Class<? extends Tag> getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tag> getValue() {
|
public List<Tag> getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new list tag with this tag's name and type.
|
* Create a new list tag with this tag's name and type.
|
||||||
*
|
*
|
||||||
@ -66,7 +66,7 @@ public final class ListTag extends Tag {
|
|||||||
public ListTag setValue(final List<Tag> list) {
|
public ListTag setValue(final List<Tag> list) {
|
||||||
return new ListTag(getName(), getType(), list);
|
return new ListTag(getName(), getType(), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tag if it exists at the given index.
|
* Get the tag if it exists at the given index.
|
||||||
*
|
*
|
||||||
@ -82,7 +82,7 @@ public final class ListTag extends Tag {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a byte array named with the given index. <p/> <p> If the index does not exist or its value is not a byte
|
* Get a byte array named with the given index. <p/> <p> If the index does not exist or its value is not a byte
|
||||||
* array tag, then an empty byte array will be returned. </p>
|
* array tag, then an empty byte array will be returned. </p>
|
||||||
@ -99,7 +99,7 @@ public final class ListTag extends Tag {
|
|||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a byte named with the given index. <p/> <p> If the index does not exist or its value is not a byte tag, then
|
* Get a byte named with the given index. <p/> <p> If the index does not exist or its value is not a byte tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -116,7 +116,7 @@ public final class ListTag extends Tag {
|
|||||||
return (byte) 0;
|
return (byte) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a double named with the given index. <p/> <p> If the index does not exist or its value is not a double tag,
|
* Get a double named with the given index. <p/> <p> If the index does not exist or its value is not a double tag,
|
||||||
* then {@code 0} will be returned. </p>
|
* then {@code 0} will be returned. </p>
|
||||||
@ -133,7 +133,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a double named with the given index, even if it's another type of number. <p/> <p> If the index does not
|
* Get a double named with the given index, even if it's another type of number. <p/> <p> If the index does not
|
||||||
* exist or its value is not a number, then {@code 0} will be returned. </p>
|
* exist or its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -160,7 +160,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a float named with the given index. <p/> <p> If the index does not exist or its value is not a float tag,
|
* Get a float named with the given index. <p/> <p> If the index does not exist or its value is not a float tag,
|
||||||
* then {@code 0} will be returned. </p>
|
* then {@code 0} will be returned. </p>
|
||||||
@ -177,7 +177,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@code int[]} named with the given index. <p/> <p> If the index does not exist or its value is not an int
|
* Get a {@code int[]} named with the given index. <p/> <p> If the index does not exist or its value is not an int
|
||||||
* array tag, then an empty array will be returned. </p>
|
* array tag, then an empty array will be returned. </p>
|
||||||
@ -194,7 +194,7 @@ public final class ListTag extends Tag {
|
|||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an int named with the given index. <p/> <p> If the index does not exist or its value is not an int tag, then
|
* Get an int named with the given index. <p/> <p> If the index does not exist or its value is not an int tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -211,7 +211,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an int named with the given index, even if it's another type of number. <p/> <p> If the index does not exist
|
* Get an int named with the given index, even if it's another type of number. <p/> <p> If the index does not exist
|
||||||
* or its value is not a number, then {@code 0} will be returned. </p>
|
* or its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -238,7 +238,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of tags named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
* Get a list of tags named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
||||||
* tag, then an empty list will be returned. </p>
|
* tag, then an empty list will be returned. </p>
|
||||||
@ -255,7 +255,7 @@ public final class ListTag extends Tag {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@code TagList} named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
* Get a {@code TagList} named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
||||||
* tag, then an empty tag list will be returned. </p>
|
* tag, then an empty tag list will be returned. </p>
|
||||||
@ -272,7 +272,7 @@ public final class ListTag extends Tag {
|
|||||||
return new ListTag(StringTag.class, Collections.<Tag> emptyList());
|
return new ListTag(StringTag.class, Collections.<Tag> emptyList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of tags named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
* Get a list of tags named with the given index. <p/> <p> If the index does not exist or its value is not a list
|
||||||
* tag, then an empty list will be returned. If the given index references a list but the list of of a different
|
* tag, then an empty list will be returned. If the given index references a list but the list of of a different
|
||||||
@ -298,7 +298,7 @@ public final class ListTag extends Tag {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a long named with the given index. <p/> <p> If the index does not exist or its value is not a long tag, then
|
* Get a long named with the given index. <p/> <p> If the index does not exist or its value is not a long tag, then
|
||||||
* {@code 0} will be returned. </p>
|
* {@code 0} will be returned. </p>
|
||||||
@ -315,7 +315,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a long named with the given index, even if it's another type of number. <p/> <p> If the index does not exist
|
* Get a long named with the given index, even if it's another type of number. <p/> <p> If the index does not exist
|
||||||
* or its value is not a number, then {@code 0} will be returned. </p>
|
* or its value is not a number, then {@code 0} will be returned. </p>
|
||||||
@ -342,7 +342,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a short named with the given index. <p/> <p> If the index does not exist or its value is not a short tag,
|
* Get a short named with the given index. <p/> <p> If the index does not exist or its value is not a short tag,
|
||||||
* then {@code 0} will be returned. </p>
|
* then {@code 0} will be returned. </p>
|
||||||
@ -359,7 +359,7 @@ public final class ListTag extends Tag {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a string named with the given index. <p/> <p> If the index does not exist or its value is not a string tag,
|
* Get a string named with the given index. <p/> <p> If the index does not exist or its value is not a string tag,
|
||||||
* then {@code ""} will be returned. </p>
|
* then {@code ""} will be returned. </p>
|
||||||
@ -376,7 +376,7 @@ public final class ListTag extends Tag {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
public class ListTagBuilder {
|
public class ListTagBuilder {
|
||||||
private final Class<? extends Tag> type;
|
private final Class<? extends Tag> type;
|
||||||
private final List<Tag> entries;
|
private final List<Tag> entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*
|
*
|
||||||
@ -24,7 +24,7 @@ public class ListTagBuilder {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.entries = new ArrayList<Tag>();
|
this.entries = new ArrayList<Tag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new builder instance.
|
* Create a new builder instance.
|
||||||
*
|
*
|
||||||
@ -33,7 +33,7 @@ public class ListTagBuilder {
|
|||||||
public static ListTagBuilder create(final Class<? extends Tag> type) {
|
public static ListTagBuilder create(final Class<? extends Tag> type) {
|
||||||
return new ListTagBuilder(type);
|
return new ListTagBuilder(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new builder instance.
|
* Create a new builder instance.
|
||||||
*
|
*
|
||||||
@ -55,7 +55,7 @@ public class ListTagBuilder {
|
|||||||
builder.addAll(Arrays.asList(entries));
|
builder.addAll(Arrays.asList(entries));
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given tag.
|
* Add the given tag.
|
||||||
*
|
*
|
||||||
@ -71,7 +71,7 @@ public class ListTagBuilder {
|
|||||||
this.entries.add(value);
|
this.entries.add(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all the tags in the given list.
|
* Add all the tags in the given list.
|
||||||
*
|
*
|
||||||
@ -86,7 +86,7 @@ public class ListTagBuilder {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an unnamed list tag with this builder's entries.
|
* Build an unnamed list tag with this builder's entries.
|
||||||
*
|
*
|
||||||
@ -95,7 +95,7 @@ public class ListTagBuilder {
|
|||||||
public ListTag build() {
|
public ListTag build() {
|
||||||
return new ListTag(this.type, new ArrayList<Tag>(this.entries));
|
return new ListTag(this.type, new ArrayList<Tag>(this.entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a new list tag with this builder's entries.
|
* Build a new list tag with this builder's entries.
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class LongTag extends Tag {
|
public final class LongTag extends Tag {
|
||||||
private final long value;
|
private final long value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -15,7 +15,7 @@ public final class LongTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -26,12 +26,12 @@ public final class LongTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getValue() {
|
public Long getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -28,13 +28,13 @@ import java.nio.charset.Charset;
|
|||||||
public final class NBTConstants {
|
public final class NBTConstants {
|
||||||
public static final Charset CHARSET = Charset.forName("UTF-8");
|
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.
|
* Default private constructor.
|
||||||
*/
|
*/
|
||||||
private NBTConstants() {
|
private NBTConstants() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a type ID to its corresponding {@link Tag} class.
|
* Convert a type ID to its corresponding {@link Tag} class.
|
||||||
*
|
*
|
||||||
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public final class NBTInputStream implements Closeable {
|
public final class NBTInputStream implements Closeable {
|
||||||
private final DataInputStream is;
|
private final DataInputStream is;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@code NBTInputStream}, which will source its data from the specified input stream.
|
* Creates a new {@code NBTInputStream}, which will source its data from the specified input stream.
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
public NBTInputStream(final InputStream is) throws IOException {
|
public NBTInputStream(final InputStream is) throws IOException {
|
||||||
this.is = new DataInputStream(is);
|
this.is = new DataInputStream(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an NBT tag from the stream.
|
* Reads an NBT tag from the stream.
|
||||||
*
|
*
|
||||||
@ -38,7 +38,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
public Tag readTag() throws IOException {
|
public Tag readTag() throws IOException {
|
||||||
return readTag(0);
|
return readTag(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads an NBT from the stream.
|
* Reads an NBT from the stream.
|
||||||
*
|
*
|
||||||
@ -61,7 +61,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
return readTagPayload(type, name, depth);
|
return readTagPayload(type, name, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the payload of a tag, given the name and type.
|
* Reads the payload of a tag, given the name and type.
|
||||||
*
|
*
|
||||||
@ -137,7 +137,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
throw new IOException("Invalid tag type: " + type + ".");
|
throw new IOException("Invalid tag type: " + type + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
this.is.close();
|
this.is.close();
|
||||||
|
@ -39,7 +39,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
* The output stream.
|
* The output stream.
|
||||||
*/
|
*/
|
||||||
private final DataOutputStream os;
|
private final DataOutputStream os;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>NBTOutputStream</code>, which will write data to the specified underlying output stream.
|
* Creates a new <code>NBTOutputStream</code>, which will write data to the specified underlying output stream.
|
||||||
*
|
*
|
||||||
@ -50,7 +50,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
public NBTOutputStream(final OutputStream os) throws IOException {
|
public NBTOutputStream(final OutputStream os) throws IOException {
|
||||||
this.os = new DataOutputStream(os);
|
this.os = new DataOutputStream(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a tag.
|
* Writes a tag.
|
||||||
*
|
*
|
||||||
@ -70,7 +70,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
writeTagPayload(tag);
|
writeTagPayload(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes tag payload.
|
* Writes tag payload.
|
||||||
*
|
*
|
||||||
@ -121,7 +121,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
throw new IOException("Invalid tag type: " + type + ".");
|
throw new IOException("Invalid tag type: " + type + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Byte</code> tag.
|
* Writes a <code>TAG_Byte</code> tag.
|
||||||
*
|
*
|
||||||
@ -132,7 +132,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeByteTagPayload(final ByteTag tag) throws IOException {
|
private void writeByteTagPayload(final ByteTag tag) throws IOException {
|
||||||
this.os.writeByte(tag.getValue());
|
this.os.writeByte(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Byte_Array</code> tag.
|
* Writes a <code>TAG_Byte_Array</code> tag.
|
||||||
*
|
*
|
||||||
@ -145,7 +145,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
this.os.writeInt(bytes.length);
|
this.os.writeInt(bytes.length);
|
||||||
this.os.write(bytes);
|
this.os.write(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Compound</code> tag.
|
* Writes a <code>TAG_Compound</code> tag.
|
||||||
*
|
*
|
||||||
@ -159,7 +159,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
this.os.writeByte((byte) 0); // end tag - better way?
|
this.os.writeByte((byte) 0); // end tag - better way?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_List</code> tag.
|
* Writes a <code>TAG_List</code> tag.
|
||||||
*
|
*
|
||||||
@ -177,7 +177,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
writeTagPayload(tag1);
|
writeTagPayload(tag1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_String</code> tag.
|
* Writes a <code>TAG_String</code> tag.
|
||||||
*
|
*
|
||||||
@ -190,7 +190,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
this.os.writeShort(bytes.length);
|
this.os.writeShort(bytes.length);
|
||||||
this.os.write(bytes);
|
this.os.write(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Double</code> tag.
|
* Writes a <code>TAG_Double</code> tag.
|
||||||
*
|
*
|
||||||
@ -201,7 +201,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeDoubleTagPayload(final DoubleTag tag) throws IOException {
|
private void writeDoubleTagPayload(final DoubleTag tag) throws IOException {
|
||||||
this.os.writeDouble(tag.getValue());
|
this.os.writeDouble(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Float</code> tag.
|
* Writes a <code>TAG_Float</code> tag.
|
||||||
*
|
*
|
||||||
@ -212,7 +212,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeFloatTagPayload(final FloatTag tag) throws IOException {
|
private void writeFloatTagPayload(final FloatTag tag) throws IOException {
|
||||||
this.os.writeFloat(tag.getValue());
|
this.os.writeFloat(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Long</code> tag.
|
* Writes a <code>TAG_Long</code> tag.
|
||||||
*
|
*
|
||||||
@ -223,7 +223,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeLongTagPayload(final LongTag tag) throws IOException {
|
private void writeLongTagPayload(final LongTag tag) throws IOException {
|
||||||
this.os.writeLong(tag.getValue());
|
this.os.writeLong(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Int</code> tag.
|
* Writes a <code>TAG_Int</code> tag.
|
||||||
*
|
*
|
||||||
@ -234,7 +234,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeIntTagPayload(final IntTag tag) throws IOException {
|
private void writeIntTagPayload(final IntTag tag) throws IOException {
|
||||||
this.os.writeInt(tag.getValue());
|
this.os.writeInt(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Short</code> tag.
|
* Writes a <code>TAG_Short</code> tag.
|
||||||
*
|
*
|
||||||
@ -245,7 +245,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeShortTagPayload(final ShortTag tag) throws IOException {
|
private void writeShortTagPayload(final ShortTag tag) throws IOException {
|
||||||
this.os.writeShort(tag.getValue());
|
this.os.writeShort(tag.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a <code>TAG_Empty</code> tag.
|
* Writes a <code>TAG_Empty</code> tag.
|
||||||
*
|
*
|
||||||
@ -256,7 +256,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
private void writeEndTagPayload(final EndTag tag) {
|
private void writeEndTagPayload(final EndTag tag) {
|
||||||
/* empty */
|
/* empty */
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeIntArrayTagPayload(final IntArrayTag tag) throws IOException {
|
private void writeIntArrayTagPayload(final IntArrayTag tag) throws IOException {
|
||||||
final int[] data = tag.getValue();
|
final int[] data = tag.getValue();
|
||||||
this.os.writeInt(data.length);
|
this.os.writeInt(data.length);
|
||||||
@ -264,7 +264,7 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
this.os.writeInt(element);
|
this.os.writeInt(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
this.os.close();
|
this.os.close();
|
||||||
|
@ -11,7 +11,7 @@ public final class NBTUtils {
|
|||||||
*/
|
*/
|
||||||
private NBTUtils() {
|
private NBTUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type name of a tag.
|
* Gets the type name of a tag.
|
||||||
*
|
*
|
||||||
@ -48,7 +48,7 @@ public final class NBTUtils {
|
|||||||
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
|
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type code of a tag class.
|
* Gets the type code of a tag class.
|
||||||
*
|
*
|
||||||
@ -87,7 +87,7 @@ public final class NBTUtils {
|
|||||||
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
|
throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the class of a type of tag.
|
* Gets the class of a type of tag.
|
||||||
*
|
*
|
||||||
@ -127,7 +127,7 @@ public final class NBTUtils {
|
|||||||
throw new IllegalArgumentException("Invalid tag type : " + type + ".");
|
throw new IllegalArgumentException("Invalid tag type : " + type + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get child tag of a NBT structure.
|
* Get child tag of a NBT structure.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,7 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public final class ShortTag extends Tag {
|
public final class ShortTag extends Tag {
|
||||||
private final short value;
|
private final short value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -35,7 +35,7 @@ public final class ShortTag extends Tag {
|
|||||||
super();
|
super();
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -46,12 +46,12 @@ public final class ShortTag extends Tag {
|
|||||||
super(name);
|
super(name);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Short getValue() {
|
public Short getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -7,7 +7,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public final class StringTag extends Tag {
|
public final class StringTag extends Tag {
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with an empty name.
|
* Creates the tag with an empty name.
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@ public final class StringTag extends Tag {
|
|||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag.
|
* Creates the tag.
|
||||||
*
|
*
|
||||||
@ -30,12 +30,12 @@ public final class StringTag extends Tag {
|
|||||||
checkNotNull(value);
|
checkNotNull(value);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String name = getName();
|
final String name = getName();
|
||||||
|
@ -25,14 +25,14 @@ package com.intellectualcrafters.jnbt;
|
|||||||
*/
|
*/
|
||||||
public abstract class Tag {
|
public abstract class Tag {
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new tag with an empty name.
|
* Create a new tag with an empty name.
|
||||||
*/
|
*/
|
||||||
Tag() {
|
Tag() {
|
||||||
this("");
|
this("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the tag with the specified name.
|
* Creates the tag with the specified name.
|
||||||
*
|
*
|
||||||
@ -44,7 +44,7 @@ public abstract class Tag {
|
|||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of this tag.
|
* Gets the name of this tag.
|
||||||
*
|
*
|
||||||
@ -53,7 +53,7 @@ public abstract class Tag {
|
|||||||
public final String getName() {
|
public final String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of this tag.
|
* Gets the value of this tag.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +60,7 @@ public class CDL {
|
|||||||
return x.nextTo(',');
|
return x.nextTo(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray of strings from a row of comma delimited values.
|
* Produce a JSONArray of strings from a row of comma delimited values.
|
||||||
*
|
*
|
||||||
@ -93,7 +93,7 @@ public class CDL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONObject from a row of comma delimited text, using a parallel JSONArray of strings to provides the
|
* Produce a JSONObject from a row of comma delimited text, using a parallel JSONArray of strings to provides the
|
||||||
* names of the elements.
|
* names of the elements.
|
||||||
@ -110,7 +110,7 @@ public class CDL {
|
|||||||
final JSONArray ja = rowToJSONArray(x);
|
final JSONArray ja = rowToJSONArray(x);
|
||||||
return ja != null ? ja.toJSONObject(names) : null;
|
return ja != null ? ja.toJSONObject(names) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a comma delimited text row from a JSONArray. Values containing the comma character will be quoted.
|
* Produce a comma delimited text row from a JSONArray. Values containing the comma character will be quoted.
|
||||||
* Troublesome characters may be removed.
|
* Troublesome characters may be removed.
|
||||||
@ -146,7 +146,7 @@ public class CDL {
|
|||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
|
* Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
|
||||||
*
|
*
|
||||||
@ -159,7 +159,7 @@ public class CDL {
|
|||||||
public static JSONArray toJSONArray(final String string) throws JSONException {
|
public static JSONArray toJSONArray(final String string) throws JSONException {
|
||||||
return toJSONArray(new JSONTokener(string));
|
return toJSONArray(new JSONTokener(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
|
* Produce a JSONArray of JSONObjects from a comma delimited text string, using the first row as a source of names.
|
||||||
*
|
*
|
||||||
@ -172,7 +172,7 @@ public class CDL {
|
|||||||
public static JSONArray toJSONArray(final JSONTokener x) throws JSONException {
|
public static JSONArray toJSONArray(final JSONTokener x) throws JSONException {
|
||||||
return toJSONArray(rowToJSONArray(x), x);
|
return toJSONArray(rowToJSONArray(x), x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of
|
* Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of
|
||||||
* element names.
|
* element names.
|
||||||
@ -187,7 +187,7 @@ public class CDL {
|
|||||||
public static JSONArray toJSONArray(final JSONArray names, final String string) throws JSONException {
|
public static JSONArray toJSONArray(final JSONArray names, final String string) throws JSONException {
|
||||||
return toJSONArray(names, new JSONTokener(string));
|
return toJSONArray(names, new JSONTokener(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of
|
* Produce a JSONArray of JSONObjects from a comma delimited text string using a supplied JSONArray as the source of
|
||||||
* element names.
|
* element names.
|
||||||
@ -216,7 +216,7 @@ public class CDL {
|
|||||||
}
|
}
|
||||||
return ja;
|
return ja;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a comma delimited text from a JSONArray of JSONObjects. The first row will be a list of names obtained by
|
* Produce a comma delimited text from a JSONArray of JSONObjects. The first row will be a list of names obtained by
|
||||||
* inspecting the first JSONObject.
|
* inspecting the first JSONObject.
|
||||||
@ -237,7 +237,7 @@ public class CDL {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names. The list of names
|
* Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names. The list of names
|
||||||
* is not included in the output.
|
* is not included in the output.
|
||||||
|
@ -56,7 +56,7 @@ public class Cookie {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a cookie specification string into a JSONObject. The string will contain a name value pair separated by
|
* Convert a cookie specification string into a JSONObject. The string will contain a name value pair separated by
|
||||||
* '='. The name and the value will be unescaped, possibly converting '+' and '%' sequences. The cookie properties
|
* '='. The name and the value will be unescaped, possibly converting '+' and '%' sequences. The cookie properties
|
||||||
@ -96,7 +96,7 @@ public class Cookie {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSONObject into a cookie specification string. The JSONObject must contain "name" and "value" members.
|
* Convert a JSONObject into a cookie specification string. The JSONObject must contain "name" and "value" members.
|
||||||
* If the JSONObject contains "expires", "domain", "path", or "secure" members, they will be appended to the cookie
|
* If the JSONObject contains "expires", "domain", "path", or "secure" members, they will be appended to the cookie
|
||||||
@ -130,7 +130,7 @@ public class Cookie {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert <code>%</code><i>hh</i> sequences to single characters, and convert plus to space.
|
* Convert <code>%</code><i>hh</i> sequences to single characters, and convert plus to space.
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@ public class CookieList {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSONObject into a cookie list. A cookie list is a sequence of name/value pairs. The names are separated
|
* Convert a JSONObject into a cookie list. A cookie list is a sequence of name/value pairs. The names are separated
|
||||||
* from the values by '='. The pairs are separated by ';'. The characters '%', '+', '=', and ';' in the names and
|
* from the values by '='. The pairs are separated by ';'. The characters '%', '+', '=', and ';' in the names and
|
||||||
|
@ -33,7 +33,7 @@ public class HTTP {
|
|||||||
* Carriage return/line feed.
|
* Carriage return/line feed.
|
||||||
*/
|
*/
|
||||||
public static final String CRLF = "\r\n";
|
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
|
* Convert an HTTP header string into a JSONObject. It can be a request header or a response header. A request
|
||||||
* header will contain
|
* header will contain
|
||||||
@ -113,7 +113,7 @@ public class HTTP {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSONObject into an HTTP header. A request header must contain
|
* Convert a JSONObject into an HTTP header. A request header must contain
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -15,7 +15,7 @@ public class HTTPTokener extends JSONTokener {
|
|||||||
public HTTPTokener(final String string) {
|
public HTTPTokener(final String string) {
|
||||||
super(string);
|
super(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next token or string. This is used in parsing HTTP headers.
|
* Get the next token or string. This is used in parsing HTTP headers.
|
||||||
*
|
*
|
||||||
|
@ -61,14 +61,14 @@ public class JSONArray {
|
|||||||
* The arrayList where the JSONArray's properties are kept.
|
* The arrayList where the JSONArray's properties are kept.
|
||||||
*/
|
*/
|
||||||
private final ArrayList<Object> myArrayList;
|
private final ArrayList<Object> myArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an empty JSONArray.
|
* Construct an empty JSONArray.
|
||||||
*/
|
*/
|
||||||
public JSONArray() {
|
public JSONArray() {
|
||||||
this.myArrayList = new ArrayList<Object>();
|
this.myArrayList = new ArrayList<Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONArray from a JSONTokener.
|
* Construct a JSONArray from a JSONTokener.
|
||||||
*
|
*
|
||||||
@ -106,7 +106,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONArray from a source JSON text.
|
* Construct a JSONArray from a source JSON text.
|
||||||
*
|
*
|
||||||
@ -118,7 +118,7 @@ public class JSONArray {
|
|||||||
public JSONArray(final String source) throws JSONException {
|
public JSONArray(final String source) throws JSONException {
|
||||||
this(new JSONTokener(source));
|
this(new JSONTokener(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONArray from a Collection.
|
* Construct a JSONArray from a Collection.
|
||||||
*
|
*
|
||||||
@ -132,7 +132,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONArray from an array
|
* Construct a JSONArray from an array
|
||||||
*
|
*
|
||||||
@ -149,7 +149,7 @@ public class JSONArray {
|
|||||||
throw new JSONException("JSONArray initial value should be a string or collection or array.");
|
throw new JSONException("JSONArray initial value should be a string or collection or array.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the object value associated with an index.
|
* Get the object value associated with an index.
|
||||||
*
|
*
|
||||||
@ -166,7 +166,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the boolean value associated with an index. The string values "true" and "false" are converted to boolean.
|
* Get the boolean value associated with an index. The string values "true" and "false" are converted to boolean.
|
||||||
*
|
*
|
||||||
@ -185,7 +185,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
|
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the double value associated with an index.
|
* Get the double value associated with an index.
|
||||||
*
|
*
|
||||||
@ -203,7 +203,7 @@ public class JSONArray {
|
|||||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the int value associated with an index.
|
* Get the int value associated with an index.
|
||||||
*
|
*
|
||||||
@ -221,7 +221,7 @@ public class JSONArray {
|
|||||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the JSONArray associated with an index.
|
* Get the JSONArray associated with an index.
|
||||||
*
|
*
|
||||||
@ -238,7 +238,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
|
throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the JSONObject associated with an index.
|
* Get the JSONObject associated with an index.
|
||||||
*
|
*
|
||||||
@ -255,7 +255,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONArray[" + index + "] is not a JSONObject.");
|
throw new JSONException("JSONArray[" + index + "] is not a JSONObject.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the long value associated with an index.
|
* Get the long value associated with an index.
|
||||||
*
|
*
|
||||||
@ -273,7 +273,7 @@ public class JSONArray {
|
|||||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the string associated with an index.
|
* Get the string associated with an index.
|
||||||
*
|
*
|
||||||
@ -290,7 +290,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONArray[" + index + "] not a string.");
|
throw new JSONException("JSONArray[" + index + "] not a string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the value is null.
|
* Determine if the value is null.
|
||||||
*
|
*
|
||||||
@ -301,7 +301,7 @@ public class JSONArray {
|
|||||||
public boolean isNull(final int index) {
|
public boolean isNull(final int index) {
|
||||||
return JSONObject.NULL.equals(this.opt(index));
|
return JSONObject.NULL.equals(this.opt(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a string from the contents of this JSONArray. The <code>separator</code> string is inserted between each
|
* Make a string from the contents of this JSONArray. The <code>separator</code> string is inserted between each
|
||||||
* element. Warning: This method assumes that the data structure is acyclical.
|
* element. Warning: This method assumes that the data structure is acyclical.
|
||||||
@ -323,7 +323,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of elements in the JSONArray, included nulls.
|
* Get the number of elements in the JSONArray, included nulls.
|
||||||
*
|
*
|
||||||
@ -332,7 +332,7 @@ public class JSONArray {
|
|||||||
public int length() {
|
public int length() {
|
||||||
return this.myArrayList.size();
|
return this.myArrayList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional object value associated with an index.
|
* Get the optional object value associated with an index.
|
||||||
*
|
*
|
||||||
@ -343,7 +343,7 @@ public class JSONArray {
|
|||||||
public Object opt(final int index) {
|
public Object opt(final int index) {
|
||||||
return ((index < 0) || (index >= this.length())) ? null : this.myArrayList.get(index);
|
return ((index < 0) || (index >= this.length())) ? null : this.myArrayList.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional boolean value associated with an index. It returns false if there is no value at that index, or
|
* Get the optional boolean value associated with an index. It returns false if there is no value at that index, or
|
||||||
* if the value is not Boolean.TRUE or the String "true".
|
* if the value is not Boolean.TRUE or the String "true".
|
||||||
@ -355,7 +355,7 @@ public class JSONArray {
|
|||||||
public boolean optBoolean(final int index) {
|
public boolean optBoolean(final int index) {
|
||||||
return this.optBoolean(index, false);
|
return this.optBoolean(index, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional boolean value associated with an index. It returns the defaultValue if there is no value at that
|
* Get the optional boolean value associated with an index. It returns the defaultValue if there is no value at that
|
||||||
* index or if it is not a Boolean or the String "true" or "false" (case insensitive).
|
* index or if it is not a Boolean or the String "true" or "false" (case insensitive).
|
||||||
@ -372,7 +372,7 @@ public class JSONArray {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional double value associated with an index. NaN is returned if there is no value for the index, or if
|
* Get the optional double value associated with an index. NaN 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.
|
* the value is not a number and cannot be converted to a number.
|
||||||
@ -384,7 +384,7 @@ public class JSONArray {
|
|||||||
public double optDouble(final int index) {
|
public double optDouble(final int index) {
|
||||||
return this.optDouble(index, Double.NaN);
|
return this.optDouble(index, Double.NaN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional double value associated with an index. The defaultValue is returned if there is no value for the
|
* Get the optional double value associated with an index. The defaultValue 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.
|
* index, or if the value is not a number and cannot be converted to a number.
|
||||||
@ -401,7 +401,7 @@ public class JSONArray {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional int value associated with an index. Zero is returned if there is no value for the index, or if
|
* Get the optional int value associated with an index. Zero 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.
|
* the value is not a number and cannot be converted to a number.
|
||||||
@ -413,7 +413,7 @@ public class JSONArray {
|
|||||||
public int optInt(final int index) {
|
public int optInt(final int index) {
|
||||||
return this.optInt(index, 0);
|
return this.optInt(index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional int value associated with an index. The defaultValue is returned if there is no value for the
|
* Get the optional int value associated with an index. The defaultValue 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.
|
* index, or if the value is not a number and cannot be converted to a number.
|
||||||
@ -430,7 +430,7 @@ public class JSONArray {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional JSONArray associated with an index.
|
* Get the optional JSONArray associated with an index.
|
||||||
*
|
*
|
||||||
@ -442,7 +442,7 @@ public class JSONArray {
|
|||||||
final Object o = this.opt(index);
|
final Object o = this.opt(index);
|
||||||
return o instanceof JSONArray ? (JSONArray) o : null;
|
return o instanceof JSONArray ? (JSONArray) o : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional JSONObject associated with an index. Null is returned if the key is not found, or null if the
|
* Get the optional JSONObject associated with an index. Null is returned if the key is not found, or null if the
|
||||||
* index has no value, or if the value is not a JSONObject.
|
* index has no value, or if the value is not a JSONObject.
|
||||||
@ -455,7 +455,7 @@ public class JSONArray {
|
|||||||
final Object o = this.opt(index);
|
final Object o = this.opt(index);
|
||||||
return o instanceof JSONObject ? (JSONObject) o : null;
|
return o instanceof JSONObject ? (JSONObject) o : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional long value associated with an index. Zero is returned if there is no value for the index, or if
|
* Get the optional long value associated with an index. Zero 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.
|
* the value is not a number and cannot be converted to a number.
|
||||||
@ -467,7 +467,7 @@ public class JSONArray {
|
|||||||
public long optLong(final int index) {
|
public long optLong(final int index) {
|
||||||
return this.optLong(index, 0);
|
return this.optLong(index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional long value associated with an index. The defaultValue is returned if there is no value for the
|
* Get the optional long value associated with an index. The defaultValue 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.
|
* index, or if the value is not a number and cannot be converted to a number.
|
||||||
@ -484,7 +484,7 @@ public class JSONArray {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional string value associated with an index. It returns an empty string if there is no value at that
|
* Get the optional string value associated with an index. It returns an 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.
|
* index. If the value is not a string and is not null, then it is coverted to a string.
|
||||||
@ -496,7 +496,7 @@ public class JSONArray {
|
|||||||
public String optString(final int index) {
|
public String optString(final int index) {
|
||||||
return this.optString(index, "");
|
return this.optString(index, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the optional string associated with an index. The defaultValue is returned if the key is not found.
|
* Get the optional string associated with an index. The defaultValue is returned if the key is not found.
|
||||||
*
|
*
|
||||||
@ -509,7 +509,7 @@ public class JSONArray {
|
|||||||
final Object object = this.opt(index);
|
final Object object = this.opt(index);
|
||||||
return JSONObject.NULL.equals(object) ? defaultValue : object.toString();
|
return JSONObject.NULL.equals(object) ? defaultValue : object.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a boolean value. This increases the array's length by one.
|
* Append a boolean value. This increases the array's length by one.
|
||||||
*
|
*
|
||||||
@ -521,7 +521,7 @@ public class JSONArray {
|
|||||||
this.put(value ? Boolean.TRUE : Boolean.FALSE);
|
this.put(value ? Boolean.TRUE : Boolean.FALSE);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
|
* Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
|
||||||
*
|
*
|
||||||
@ -533,7 +533,7 @@ public class JSONArray {
|
|||||||
this.put(new JSONArray(value));
|
this.put(new JSONArray(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a double value. This increases the array's length by one.
|
* Append a double value. This increases the array's length by one.
|
||||||
*
|
*
|
||||||
@ -549,7 +549,7 @@ public class JSONArray {
|
|||||||
this.put(d);
|
this.put(d);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an int value. This increases the array's length by one.
|
* Append an int value. This increases the array's length by one.
|
||||||
*
|
*
|
||||||
@ -561,7 +561,7 @@ public class JSONArray {
|
|||||||
this.put(new Integer(value));
|
this.put(new Integer(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an long value. This increases the array's length by one.
|
* Append an long value. This increases the array's length by one.
|
||||||
*
|
*
|
||||||
@ -573,7 +573,7 @@ public class JSONArray {
|
|||||||
this.put(new Long(value));
|
this.put(new Long(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a value in the JSONArray, where the value will be a JSONObject which is produced from a Map.
|
* Put a value in the JSONArray, where the value will be a JSONObject which is produced from a Map.
|
||||||
*
|
*
|
||||||
@ -585,7 +585,7 @@ public class JSONArray {
|
|||||||
this.put(new JSONObject(value));
|
this.put(new JSONObject(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an object value. This increases the array's length by one.
|
* Append an object value. This increases the array's length by one.
|
||||||
*
|
*
|
||||||
@ -598,7 +598,7 @@ public class JSONArray {
|
|||||||
this.myArrayList.add(value);
|
this.myArrayList.add(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put or replace a boolean value in the JSONArray. If the index is greater than the length of the JSONArray, then
|
* Put or replace a boolean value in the JSONArray. If the index is greater than the length of the JSONArray, then
|
||||||
* null elements will be added as necessary to pad it out.
|
* null elements will be added as necessary to pad it out.
|
||||||
@ -614,7 +614,7 @@ public class JSONArray {
|
|||||||
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
|
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
|
* Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
|
||||||
*
|
*
|
||||||
@ -629,7 +629,7 @@ public class JSONArray {
|
|||||||
this.put(index, new JSONArray(value));
|
this.put(index, new JSONArray(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put or replace a double value. If the index is greater than the length of the JSONArray, then null elements will
|
* Put or replace a double value. If the index is greater than the length of the JSONArray, then null elements will
|
||||||
* be added as necessary to pad it out.
|
* be added as necessary to pad it out.
|
||||||
@ -645,7 +645,7 @@ public class JSONArray {
|
|||||||
this.put(index, new Double(value));
|
this.put(index, new Double(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put or replace an int value. If the index is greater than the length of the JSONArray, then null elements will be
|
* Put or replace an int value. If the index is greater than the length of the JSONArray, then null elements will be
|
||||||
* added as necessary to pad it out.
|
* added as necessary to pad it out.
|
||||||
@ -661,7 +661,7 @@ public class JSONArray {
|
|||||||
this.put(index, new Integer(value));
|
this.put(index, new Integer(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put or replace a long value. If the index is greater than the length of the JSONArray, then null elements will be
|
* Put or replace a long value. If the index is greater than the length of the JSONArray, then null elements will be
|
||||||
* added as necessary to pad it out.
|
* added as necessary to pad it out.
|
||||||
@ -677,7 +677,7 @@ public class JSONArray {
|
|||||||
this.put(index, new Long(value));
|
this.put(index, new Long(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a value in the JSONArray, where the value will be a JSONObject that is produced from a Map.
|
* Put a value in the JSONArray, where the value will be a JSONObject that is produced from a Map.
|
||||||
*
|
*
|
||||||
@ -692,7 +692,7 @@ public class JSONArray {
|
|||||||
this.put(index, new JSONObject(value));
|
this.put(index, new JSONObject(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put or replace an object value in the JSONArray. If the index is greater than the length of the JSONArray, then
|
* Put or replace an object value in the JSONArray. If the index is greater than the length of the JSONArray, then
|
||||||
* null elements will be added as necessary to pad it out.
|
* null elements will be added as necessary to pad it out.
|
||||||
@ -720,7 +720,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an index and close the hole.
|
* Remove an index and close the hole.
|
||||||
*
|
*
|
||||||
@ -731,7 +731,7 @@ public class JSONArray {
|
|||||||
public Object remove(final int index) {
|
public Object remove(final int index) {
|
||||||
return (index >= 0) && (index < this.length()) ? this.myArrayList.remove(index) : null;
|
return (index >= 0) && (index < this.length()) ? this.myArrayList.remove(index) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if two JSONArrays are similar. They must contain similar sequences.
|
* Determine if two JSONArrays are similar. They must contain similar sequences.
|
||||||
*
|
*
|
||||||
@ -764,7 +764,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONObject by combining a JSONArray of names with the values of this JSONArray.
|
* Produce a JSONObject by combining a JSONArray of names with the values of this JSONArray.
|
||||||
*
|
*
|
||||||
@ -784,7 +784,7 @@ public class JSONArray {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a JSON text of this JSONArray. For compactness, no unnecessary whitespace is added. If it is not possible to
|
* Make a JSON text of this JSONArray. For compactness, no unnecessary 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
|
* produce a syntactically correct JSON text then null will be returned instead. This could occur if the array
|
||||||
@ -802,7 +802,7 @@ public class JSONArray {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a prettyprinted JSON text of this JSONArray. Warning: This method assumes that the data structure is
|
* Make a prettyprinted JSON text of this JSONArray. Warning: This method assumes that the data structure is
|
||||||
* acyclical.
|
* acyclical.
|
||||||
@ -821,7 +821,7 @@ public class JSONArray {
|
|||||||
return this.write(sw, indentFactor, 0).toString();
|
return this.write(sw, indentFactor, 0).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added.
|
* Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -834,7 +834,7 @@ public class JSONArray {
|
|||||||
public Writer write(final Writer writer) throws JSONException {
|
public Writer write(final Writer writer) throws JSONException {
|
||||||
return this.write(writer, 0, 0);
|
return this.write(writer, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added.
|
* Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -9,7 +9,7 @@ package com.intellectualcrafters.json;
|
|||||||
public class JSONException extends RuntimeException {
|
public class JSONException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 0;
|
private static final long serialVersionUID = 0;
|
||||||
private Throwable cause;
|
private Throwable cause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a JSONException with an explanatory message.
|
* Constructs a JSONException with an explanatory message.
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@ public class JSONException extends RuntimeException {
|
|||||||
public JSONException(final String message) {
|
public JSONException(final String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new JSONException with the specified cause.
|
* Constructs a new JSONException with the specified cause.
|
||||||
*
|
*
|
||||||
@ -28,7 +28,7 @@ public class JSONException extends RuntimeException {
|
|||||||
super(cause.getMessage());
|
super(cause.getMessage());
|
||||||
this.cause = cause;
|
this.cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the cause of this exception or null if the cause is nonexistent or unknown.
|
* Returns the cause of this exception or null if the cause is nonexistent or unknown.
|
||||||
*
|
*
|
||||||
|
@ -183,7 +183,7 @@ public class JSONML {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each
|
* Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each
|
||||||
* XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then
|
* XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then
|
||||||
@ -199,7 +199,7 @@ public class JSONML {
|
|||||||
public static JSONArray toJSONArray(final String string) throws JSONException {
|
public static JSONArray toJSONArray(final String string) throws JSONException {
|
||||||
return toJSONArray(new XMLTokener(string));
|
return toJSONArray(new XMLTokener(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each
|
* Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each
|
||||||
* XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then
|
* XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then
|
||||||
@ -216,7 +216,7 @@ public class JSONML {
|
|||||||
public static JSONArray toJSONArray(final XMLTokener x) throws JSONException {
|
public static JSONArray toJSONArray(final XMLTokener x) throws JSONException {
|
||||||
return (JSONArray) parse(x, true, null);
|
return (JSONArray) parse(x, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each
|
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each
|
||||||
* XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes
|
* XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes
|
||||||
@ -234,7 +234,7 @@ public class JSONML {
|
|||||||
public static JSONObject toJSONObject(final XMLTokener x) throws JSONException {
|
public static JSONObject toJSONObject(final XMLTokener x) throws JSONException {
|
||||||
return (JSONObject) parse(x, false, null);
|
return (JSONObject) parse(x, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each
|
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each
|
||||||
* XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes
|
* XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes
|
||||||
@ -252,7 +252,7 @@ public class JSONML {
|
|||||||
public static JSONObject toJSONObject(final String string) throws JSONException {
|
public static JSONObject toJSONObject(final String string) throws JSONException {
|
||||||
return toJSONObject(new XMLTokener(string));
|
return toJSONObject(new XMLTokener(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the JSONML transformation, making an XML text from a JSONArray.
|
* Reverse the JSONML transformation, making an XML text from a JSONArray.
|
||||||
*
|
*
|
||||||
@ -327,7 +327,7 @@ public class JSONML {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the JSONML transformation, making an XML text from a JSONObject. The JSONObject must contain a "tagName"
|
* Reverse the JSONML transformation, making an XML text from a JSONObject. The JSONObject must contain a "tagName"
|
||||||
* property. If it has children, then it must have a "childNodes" property containing an array of objects. The other
|
* property. If it has children, then it must have a "childNodes" property containing an array of objects. The other
|
||||||
|
@ -64,14 +64,14 @@ public class JSONObject {
|
|||||||
* The map where the JSONObject's properties are kept.
|
* The map where the JSONObject's properties are kept.
|
||||||
*/
|
*/
|
||||||
private final Map<String, Object> map;
|
private final Map<String, Object> map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an empty JSONObject.
|
* Construct an empty JSONObject.
|
||||||
*/
|
*/
|
||||||
public JSONObject() {
|
public JSONObject() {
|
||||||
this.map = new HashMap<String, Object>();
|
this.map = new HashMap<String, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from a subset of another JSONObject. An array of strings is used to identify the keys that
|
* Construct a JSONObject from a subset of another JSONObject. An array of strings is used to identify the keys that
|
||||||
* should be copied. Missing keys are ignored.
|
* should be copied. Missing keys are ignored.
|
||||||
@ -91,7 +91,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from a JSONTokener.
|
* Construct a JSONObject from a JSONTokener.
|
||||||
*
|
*
|
||||||
@ -139,7 +139,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from a Map.
|
* Construct a JSONObject from a Map.
|
||||||
*
|
*
|
||||||
@ -158,7 +158,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from an Object using bean getters. It reflects on all of the public methods of the object.
|
* Construct a JSONObject from an Object using bean getters. It reflects on all of the public methods of the object.
|
||||||
* For each of the methods with no parameters and a name starting with <code>"get"</code> or <code>"is"</code>
|
* For each of the methods with no parameters and a name starting with <code>"get"</code> or <code>"is"</code>
|
||||||
@ -178,7 +178,7 @@ public class JSONObject {
|
|||||||
this();
|
this();
|
||||||
this.populateMap(bean);
|
this.populateMap(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from an Object, using reflection to find the public members. The resulting JSONObject's
|
* Construct a JSONObject from an Object, using reflection to find the public members. The resulting JSONObject's
|
||||||
* keys will be the strings from the names array, and the values will be the field values associated with those keys
|
* keys will be the strings from the names array, and the values will be the field values associated with those keys
|
||||||
@ -197,7 +197,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from a source JSON text string. This is the most commonly used JSONObject constructor.
|
* Construct a JSONObject from a source JSON text string. This is the most commonly used JSONObject constructor.
|
||||||
*
|
*
|
||||||
@ -209,7 +209,7 @@ public class JSONObject {
|
|||||||
public JSONObject(final String source) throws JSONException {
|
public JSONObject(final String source) throws JSONException {
|
||||||
this(new JSONTokener(source));
|
this(new JSONTokener(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONObject from a ResourceBundle.
|
* Construct a JSONObject from a ResourceBundle.
|
||||||
*
|
*
|
||||||
@ -247,7 +247,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a string from a double. The string "null" will be returned if the number is not finite.
|
* Produce a string from a double. The string "null" will be returned if the number is not finite.
|
||||||
*
|
*
|
||||||
@ -271,7 +271,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of field names from a JSONObject.
|
* Get an array of field names from a JSONObject.
|
||||||
*
|
*
|
||||||
@ -291,7 +291,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of field names from an Object.
|
* Get an array of field names from an Object.
|
||||||
*
|
*
|
||||||
@ -313,7 +313,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a string from a Number.
|
* Produce a string from a Number.
|
||||||
*
|
*
|
||||||
@ -340,7 +340,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted
|
* Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted
|
||||||
* within </, producing <\/, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a
|
* within </, producing <\/, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a
|
||||||
@ -361,7 +361,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Writer quote(final String string, final Writer w) throws IOException {
|
public static Writer quote(final String string, final Writer w) throws IOException {
|
||||||
if ((string == null) || (string.length() == 0)) {
|
if ((string == null) || (string.length() == 0)) {
|
||||||
w.write("\"\"");
|
w.write("\"\"");
|
||||||
@ -417,7 +417,7 @@ public class JSONObject {
|
|||||||
w.write('"');
|
w.write('"');
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.
|
* Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.
|
||||||
*
|
*
|
||||||
@ -466,7 +466,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throw an exception if the object is a NaN or infinite number.
|
* Throw an exception if the object is a NaN or infinite number.
|
||||||
*
|
*
|
||||||
@ -487,7 +487,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a JSON text of an Object value. If the object has an value.toJSONString() method, then that method will be
|
* Make a JSON text of an Object value. If the object has an value.toJSONString() method, then that method will be
|
||||||
* used to produce the JSON text. The method is required to produce a strictly conforming text. If the object does
|
* used to produce the JSON text. The method is required to produce a strictly conforming text. If the object does
|
||||||
@ -540,7 +540,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return quote(value.toString());
|
return quote(value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap an object, if necessary. If the object is null, return the NULL object. If it is an array or collection,
|
* Wrap an object, if necessary. If the object is null, return the NULL object. If it is an array or collection,
|
||||||
* wrap it in a JSONArray. If it is a map, wrap it in a JSONObject. If it is a standard property (Double, String, et
|
* wrap it in a JSONArray. If it is a map, wrap it in a JSONObject. If it is a standard property (Double, String, et
|
||||||
@ -578,7 +578,7 @@ public class JSONObject {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final Writer writeValue(final Writer writer, final Object value, final int indentFactor, final int indent) throws JSONException, IOException {
|
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)) {
|
if ((value == null) || value.equals(null)) {
|
||||||
writer.write("null");
|
writer.write("null");
|
||||||
@ -609,13 +609,13 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static final void indent(final Writer writer, final int indent) throws IOException {
|
static final void indent(final Writer writer, final int indent) throws IOException {
|
||||||
for (int i = 0; i < indent; i += 1) {
|
for (int i = 0; i < indent; i += 1) {
|
||||||
writer.write(' ');
|
writer.write(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accumulate values under a key. It is similar to the put method except that if there is already an object stored
|
* Accumulate values under a key. It is similar to the put method except that if there is already an object stored
|
||||||
* under the key then a JSONArray is stored under the key to hold all of the accumulated values. If there is already
|
* under the key then a JSONArray is stored under the key to hold all of the accumulated values. If there is already
|
||||||
@ -643,7 +643,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append values to the array under a key. If the key does not exist in the JSONObject, then the key is put in the
|
* Append values to the array under a key. If the key does not exist in the JSONObject, then the key is put in the
|
||||||
* JSONObject with its value being a JSONArray containing the value parameter. If the key was already associated
|
* JSONObject with its value being a JSONArray containing the value parameter. If the key was already associated
|
||||||
@ -668,7 +668,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value object associated with a key.
|
* Get the value object associated with a key.
|
||||||
*
|
*
|
||||||
@ -688,7 +688,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the boolean value associated with a key.
|
* Get the boolean value associated with a key.
|
||||||
*
|
*
|
||||||
@ -707,7 +707,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a Boolean.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a Boolean.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the double value associated with a key.
|
* Get the double value associated with a key.
|
||||||
*
|
*
|
||||||
@ -726,7 +726,7 @@ public class JSONObject {
|
|||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the int value associated with a key.
|
* Get the int value associated with a key.
|
||||||
*
|
*
|
||||||
@ -744,7 +744,7 @@ public class JSONObject {
|
|||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the JSONArray value associated with a key.
|
* Get the JSONArray value associated with a key.
|
||||||
*
|
*
|
||||||
@ -761,7 +761,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONArray.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONArray.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the JSONObject value associated with a key.
|
* Get the JSONObject value associated with a key.
|
||||||
*
|
*
|
||||||
@ -778,7 +778,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONObject.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONObject.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the long value associated with a key.
|
* Get the long value associated with a key.
|
||||||
*
|
*
|
||||||
@ -796,7 +796,7 @@ public class JSONObject {
|
|||||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the string associated with a key.
|
* Get the string associated with a key.
|
||||||
*
|
*
|
||||||
@ -813,7 +813,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
throw new JSONException("JSONObject[" + quote(key) + "] not a string.");
|
throw new JSONException("JSONObject[" + quote(key) + "] not a string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the JSONObject contains a specific key.
|
* Determine if the JSONObject contains a specific key.
|
||||||
*
|
*
|
||||||
@ -824,7 +824,7 @@ public class JSONObject {
|
|||||||
public boolean has(final String key) {
|
public boolean has(final String key) {
|
||||||
return this.map.containsKey(key);
|
return this.map.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment a property of a JSONObject. If there is no such property, create one with a value of 1. If there is
|
* Increment a property of a JSONObject. If there is no such property, 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.
|
* such a property, and if it is an Integer, Long, Double, or Float, then add one to it.
|
||||||
@ -853,7 +853,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the value associated with the key is null or if there is no value.
|
* Determine if the value associated with the key is null or if there is no value.
|
||||||
*
|
*
|
||||||
@ -864,7 +864,7 @@ public class JSONObject {
|
|||||||
public boolean isNull(final String key) {
|
public boolean isNull(final String key) {
|
||||||
return JSONObject.NULL.equals(this.opt(key));
|
return JSONObject.NULL.equals(this.opt(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an enumeration of the keys of the JSONObject.
|
* Get an enumeration of the keys of the JSONObject.
|
||||||
*
|
*
|
||||||
@ -873,7 +873,7 @@ public class JSONObject {
|
|||||||
public Iterator<String> keys() {
|
public Iterator<String> keys() {
|
||||||
return this.keySet().iterator();
|
return this.keySet().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a set of keys of the JSONObject.
|
* Get a set of keys of the JSONObject.
|
||||||
*
|
*
|
||||||
@ -882,7 +882,7 @@ public class JSONObject {
|
|||||||
public Set<String> keySet() {
|
public Set<String> keySet() {
|
||||||
return this.map.keySet();
|
return this.map.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of keys stored in the JSONObject.
|
* Get the number of keys stored in the JSONObject.
|
||||||
*
|
*
|
||||||
@ -891,7 +891,7 @@ public class JSONObject {
|
|||||||
public int length() {
|
public int length() {
|
||||||
return this.map.size();
|
return this.map.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray containing the names of the elements of this JSONObject.
|
* Produce a JSONArray containing the names of the elements of this JSONObject.
|
||||||
*
|
*
|
||||||
@ -905,7 +905,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return ja.length() == 0 ? null : ja;
|
return ja.length() == 0 ? null : ja;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional value associated with a key.
|
* Get an optional value associated with a key.
|
||||||
*
|
*
|
||||||
@ -916,7 +916,7 @@ public class JSONObject {
|
|||||||
public Object opt(final String key) {
|
public Object opt(final String key) {
|
||||||
return key == null ? null : this.map.get(key);
|
return key == null ? null : this.map.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional boolean associated with a key. It returns false if there is no such key, or if the value is not
|
* 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".
|
* Boolean.TRUE or the String "true".
|
||||||
@ -928,7 +928,7 @@ public class JSONObject {
|
|||||||
public boolean optBoolean(final String key) {
|
public boolean optBoolean(final String key) {
|
||||||
return this.optBoolean(key, false);
|
return this.optBoolean(key, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is
|
* Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is
|
||||||
* not a Boolean or the String "true" or "false" (case insensitive).
|
* not a Boolean or the String "true" or "false" (case insensitive).
|
||||||
@ -945,7 +945,7 @@ public class JSONObject {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional double associated with a key, or NaN if there is no such key or if its value is not a number. If
|
* Get an optional double associated with a key, or NaN if 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.
|
* the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -957,7 +957,7 @@ public class JSONObject {
|
|||||||
public double optDouble(final String key) {
|
public double optDouble(final String key) {
|
||||||
return this.optDouble(key, Double.NaN);
|
return this.optDouble(key, Double.NaN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional double associated with a key, or the defaultValue if there is no such key or if its value is not
|
* Get an optional double associated with a key, or the defaultValue if 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.
|
* a number. If the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -974,7 +974,7 @@ public class JSONObject {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional int value associated with a key, or zero if there is no such key or if the value is not a number.
|
* Get an optional int value associated with a key, or zero if there 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.
|
* If the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -986,7 +986,7 @@ public class JSONObject {
|
|||||||
public int optInt(final String key) {
|
public int optInt(final String key) {
|
||||||
return this.optInt(key, 0);
|
return this.optInt(key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional int value associated with a key, or the default if there is no such key or if the value is not a
|
* Get an optional int value associated with a key, or the default if there 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.
|
* number. If the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -1003,7 +1003,7 @@ public class JSONObject {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional JSONArray associated with a key. It returns null if there is no such key, or if its value is not
|
* 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.
|
* a JSONArray.
|
||||||
@ -1016,7 +1016,7 @@ public class JSONObject {
|
|||||||
final Object o = this.opt(key);
|
final Object o = this.opt(key);
|
||||||
return o instanceof JSONArray ? (JSONArray) o : null;
|
return o instanceof JSONArray ? (JSONArray) o : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional JSONObject associated with a key. It returns null if there is no such key, or if its value is not
|
* 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.
|
* a JSONObject.
|
||||||
@ -1029,7 +1029,7 @@ public class JSONObject {
|
|||||||
final Object object = this.opt(key);
|
final Object object = this.opt(key);
|
||||||
return object instanceof JSONObject ? (JSONObject) object : null;
|
return object instanceof JSONObject ? (JSONObject) object : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional long value associated with a key, or zero if there is no such key or if the value is not a
|
* Get an optional long value associated with a key, or zero if there 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.
|
* number. If the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -1041,7 +1041,7 @@ public class JSONObject {
|
|||||||
public long optLong(final String key) {
|
public long optLong(final String key) {
|
||||||
return this.optLong(key, 0);
|
return this.optLong(key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional long value associated with a key, or the default if there is no such key or if the value is not a
|
* Get an optional long value associated with a key, or the default if there 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.
|
* number. If the value is a string, an attempt will be made to evaluate it as a number.
|
||||||
@ -1058,7 +1058,7 @@ public class JSONObject {
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional string associated with a key. It returns an empty string if there is no such key. If the value is
|
* Get an optional string associated with a key. It returns an empty string if there is no such key. If the value is
|
||||||
* not a string and is not null, then it is converted to a string.
|
* not a string and is not null, then it is converted to a string.
|
||||||
@ -1070,7 +1070,7 @@ public class JSONObject {
|
|||||||
public String optString(final String key) {
|
public String optString(final String key) {
|
||||||
return this.optString(key, "");
|
return this.optString(key, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an optional string associated with a key. It returns the defaultValue if there is no such key.
|
* Get an optional string associated with a key. It returns the defaultValue if there is no such key.
|
||||||
*
|
*
|
||||||
@ -1083,7 +1083,7 @@ public class JSONObject {
|
|||||||
final Object object = this.opt(key);
|
final Object object = this.opt(key);
|
||||||
return NULL.equals(object) ? defaultValue : object.toString();
|
return NULL.equals(object) ? defaultValue : object.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateMap(final Object bean) {
|
private void populateMap(final Object bean) {
|
||||||
final Class klass = bean.getClass();
|
final Class klass = bean.getClass();
|
||||||
// If klass is a System class then set includeSuperClass to false.
|
// If klass is a System class then set includeSuperClass to false.
|
||||||
@ -1119,7 +1119,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/boolean pair in the JSONObject.
|
* Put a key/boolean pair in the JSONObject.
|
||||||
*
|
*
|
||||||
@ -1134,7 +1134,7 @@ public class JSONObject {
|
|||||||
this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
|
this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/value pair in the JSONObject, where the value will be a JSONArray which is produced from a Collection.
|
* Put a key/value pair in the JSONObject, where the value will be a JSONArray which is produced from a Collection.
|
||||||
*
|
*
|
||||||
@ -1149,7 +1149,7 @@ public class JSONObject {
|
|||||||
this.put(key, new JSONArray(value));
|
this.put(key, new JSONArray(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/double pair in the JSONObject.
|
* Put a key/double pair in the JSONObject.
|
||||||
*
|
*
|
||||||
@ -1164,7 +1164,7 @@ public class JSONObject {
|
|||||||
this.put(key, new Double(value));
|
this.put(key, new Double(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/int pair in the JSONObject.
|
* Put a key/int pair in the JSONObject.
|
||||||
*
|
*
|
||||||
@ -1179,7 +1179,7 @@ public class JSONObject {
|
|||||||
this.put(key, new Integer(value));
|
this.put(key, new Integer(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/long pair in the JSONObject.
|
* Put a key/long pair in the JSONObject.
|
||||||
*
|
*
|
||||||
@ -1194,7 +1194,7 @@ public class JSONObject {
|
|||||||
this.put(key, new Long(value));
|
this.put(key, new Long(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/value pair in the JSONObject, where the value will be a JSONObject which is produced from a Map.
|
* Put a key/value pair in the JSONObject, where the value will be a JSONObject which is produced from a Map.
|
||||||
*
|
*
|
||||||
@ -1209,7 +1209,7 @@ public class JSONObject {
|
|||||||
this.put(key, new JSONObject(value));
|
this.put(key, new JSONObject(value));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/value pair in the JSONObject. If the value is null, then the key will be removed from the JSONObject if
|
* 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.
|
* it is present.
|
||||||
@ -1234,7 +1234,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/value pair in the JSONObject, but only if the key and the value are both non-null, and only if there is
|
* Put a key/value pair in the JSONObject, but only if the key and the value are both non-null, and only if there is
|
||||||
* not already a member with that name.
|
* not already a member with that name.
|
||||||
@ -1255,7 +1255,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a key/value pair in the JSONObject, but only if the key and the value are both non-null.
|
* Put a key/value pair in the JSONObject, but only if the key and the value are both non-null.
|
||||||
*
|
*
|
||||||
@ -1273,7 +1273,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a name and its value, if present.
|
* Remove a name and its value, if present.
|
||||||
*
|
*
|
||||||
@ -1284,7 +1284,7 @@ public class JSONObject {
|
|||||||
public Object remove(final String key) {
|
public Object remove(final String key) {
|
||||||
return this.map.remove(key);
|
return this.map.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if two JSONObjects are similar. They must contain the same set of names which must be associated with
|
* Determine if two JSONObjects are similar. They must contain the same set of names which must be associated with
|
||||||
* similar values.
|
* similar values.
|
||||||
@ -1322,7 +1322,7 @@ public class JSONObject {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray containing the values of the members of this JSONObject.
|
* Produce a JSONArray containing the values of the members of this JSONObject.
|
||||||
*
|
*
|
||||||
@ -1343,7 +1343,7 @@ public class JSONObject {
|
|||||||
}
|
}
|
||||||
return ja;
|
return ja;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a JSON text of this JSONObject. For compactness, no whitespace is added. If this would not result in a
|
* 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.
|
* syntactically correct JSON text, then null will be returned instead.
|
||||||
@ -1362,7 +1362,7 @@ public class JSONObject {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a prettyprinted JSON text of this JSONObject.
|
* Make a prettyprinted JSON text of this JSONObject.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -1382,7 +1382,7 @@ public class JSONObject {
|
|||||||
return this.write(w, indentFactor, 0).toString();
|
return this.write(w, indentFactor, 0).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added.
|
* Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -1395,7 +1395,7 @@ public class JSONObject {
|
|||||||
public Writer write(final Writer writer) throws JSONException {
|
public Writer write(final Writer writer) throws JSONException {
|
||||||
return this.write(writer, 0, 0);
|
return this.write(writer, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added.
|
* Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -1449,7 +1449,7 @@ public class JSONObject {
|
|||||||
throw new JSONException(exception);
|
throw new JSONException(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSONObject.NULL is equivalent to the value that JavaScript calls null, whilst Java's null is equivalent to the
|
* JSONObject.NULL is equivalent to the value that JavaScript calls null, whilst Java's null is equivalent to the
|
||||||
* value that JavaScript calls undefined.
|
* value that JavaScript calls undefined.
|
||||||
@ -1468,7 +1468,7 @@ public class JSONObject {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Null object is equal to the null value and to itself.
|
* A Null object is equal to the null value and to itself.
|
||||||
*
|
*
|
||||||
@ -1480,7 +1480,7 @@ public class JSONObject {
|
|||||||
public boolean equals(final Object object) {
|
public boolean equals(final Object object) {
|
||||||
return (object == null) || (object == this);
|
return (object == null) || (object == this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the "null" string value.
|
* Get the "null" string value.
|
||||||
*
|
*
|
||||||
|
@ -40,7 +40,7 @@ public class JSONStringer extends JSONWriter {
|
|||||||
public JSONStringer() {
|
public JSONStringer() {
|
||||||
super(new StringWriter());
|
super(new StringWriter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the JSON text. This method is used to obtain the product of the JSONStringer instance. It will return
|
* Return the JSON text. This method is used to obtain the product of the JSONStringer instance. It will return
|
||||||
* <code>null</code> if there was a problem in the construction of the JSON text (such as the calls to
|
* <code>null</code> if there was a problem in the construction of the JSON text (such as the calls to
|
||||||
|
@ -22,7 +22,7 @@ public class JSONTokener {
|
|||||||
private long line;
|
private long line;
|
||||||
private char previous;
|
private char previous;
|
||||||
private boolean usePrevious;
|
private boolean usePrevious;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONTokener from a Reader.
|
* Construct a JSONTokener from a Reader.
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ public class JSONTokener {
|
|||||||
this.character = 1;
|
this.character = 1;
|
||||||
this.line = 1;
|
this.line = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONTokener from an InputStream.
|
* Construct a JSONTokener from an InputStream.
|
||||||
*
|
*
|
||||||
@ -46,7 +46,7 @@ public class JSONTokener {
|
|||||||
public JSONTokener(final InputStream inputStream) throws JSONException {
|
public JSONTokener(final InputStream inputStream) throws JSONException {
|
||||||
this(new InputStreamReader(inputStream));
|
this(new InputStreamReader(inputStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a JSONTokener from a string.
|
* Construct a JSONTokener from a string.
|
||||||
*
|
*
|
||||||
@ -55,7 +55,7 @@ public class JSONTokener {
|
|||||||
public JSONTokener(final String s) {
|
public JSONTokener(final String s) {
|
||||||
this(new StringReader(s));
|
this(new StringReader(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hex value of a character (base16).
|
* Get the hex value of a character (base16).
|
||||||
*
|
*
|
||||||
@ -75,7 +75,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back up one character. This provides a sort of lookahead capability, so that you can test for a digit or letter
|
* Back up one character. This provides a sort of lookahead capability, so that you can test for a digit or letter
|
||||||
* before attempting to parse the next number or identifier.
|
* before attempting to parse the next number or identifier.
|
||||||
@ -89,11 +89,11 @@ public class JSONTokener {
|
|||||||
this.usePrevious = true;
|
this.usePrevious = true;
|
||||||
this.eof = false;
|
this.eof = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean end() {
|
public boolean end() {
|
||||||
return this.eof && !this.usePrevious;
|
return this.eof && !this.usePrevious;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the source string still contains characters that next() can consume.
|
* Determine if the source string still contains characters that next() can consume.
|
||||||
*
|
*
|
||||||
@ -107,7 +107,7 @@ public class JSONTokener {
|
|||||||
this.back();
|
this.back();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next character in the source string.
|
* Get the next character in the source string.
|
||||||
*
|
*
|
||||||
@ -142,7 +142,7 @@ public class JSONTokener {
|
|||||||
this.previous = (char) c;
|
this.previous = (char) c;
|
||||||
return this.previous;
|
return this.previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consume the next character, and check that it matches a specified character.
|
* Consume the next character, and check that it matches a specified character.
|
||||||
*
|
*
|
||||||
@ -159,7 +159,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next n characters.
|
* Get the next n characters.
|
||||||
*
|
*
|
||||||
@ -184,7 +184,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
return new String(chars);
|
return new String(chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next char in the string, skipping whitespace.
|
* Get the next char in the string, skipping whitespace.
|
||||||
*
|
*
|
||||||
@ -200,7 +200,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the characters up to the next close quote character. Backslash processing is done. The formal JSON format
|
* Return the characters up to the next close quote character. Backslash processing is done. The formal JSON format
|
||||||
* does not allow strings in single quotes, but an implementation is allowed to accept them.
|
* does not allow strings in single quotes, but an implementation is allowed to accept them.
|
||||||
@ -261,7 +261,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the text up but not including the specified character or the end of line, whichever comes first.
|
* Get the text up but not including the specified character or the end of line, whichever comes first.
|
||||||
*
|
*
|
||||||
@ -282,7 +282,7 @@ public class JSONTokener {
|
|||||||
sb.append(c);
|
sb.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the text up but not including one of the specified delimiter characters or the end of line, whichever comes
|
* Get the text up but not including one of the specified delimiter characters or the end of line, whichever comes
|
||||||
* first.
|
* first.
|
||||||
@ -305,7 +305,7 @@ public class JSONTokener {
|
|||||||
sb.append(c);
|
sb.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next value. The value can be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
|
* Get the next value. The value can be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the
|
||||||
* JSONObject.NULL object.
|
* JSONObject.NULL object.
|
||||||
@ -347,7 +347,7 @@ public class JSONTokener {
|
|||||||
}
|
}
|
||||||
return JSONObject.stringToValue(string);
|
return JSONObject.stringToValue(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip characters until the next character is the requested character. If the requested character is not found, no
|
* Skip characters until the next character is the requested character. If the requested character is not found, no
|
||||||
* characters are skipped.
|
* characters are skipped.
|
||||||
@ -379,7 +379,7 @@ public class JSONTokener {
|
|||||||
this.back();
|
this.back();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a JSONException to signal a syntax error.
|
* Make a JSONException to signal a syntax error.
|
||||||
*
|
*
|
||||||
@ -390,7 +390,7 @@ public class JSONTokener {
|
|||||||
public JSONException syntaxError(final String message) {
|
public JSONException syntaxError(final String message) {
|
||||||
return new JSONException(message + this.toString());
|
return new JSONException(message + this.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a printable string of this JSONTokener.
|
* Make a printable string of this JSONTokener.
|
||||||
*
|
*
|
||||||
|
@ -55,7 +55,7 @@ public class JSONWriter {
|
|||||||
* The stack top index. A value of 0 indicates that the stack is empty.
|
* The stack top index. A value of 0 indicates that the stack is empty.
|
||||||
*/
|
*/
|
||||||
private int top;
|
private int top;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a fresh JSONWriter. It can be used to build one JSON text.
|
* Make a fresh JSONWriter. It can be used to build one JSON text.
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ public class JSONWriter {
|
|||||||
this.top = 0;
|
this.top = 0;
|
||||||
this.writer = w;
|
this.writer = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a value.
|
* Append a value.
|
||||||
*
|
*
|
||||||
@ -97,7 +97,7 @@ public class JSONWriter {
|
|||||||
}
|
}
|
||||||
throw new JSONException("Value out of sequence.");
|
throw new JSONException("Value out of sequence.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begin appending a new array. All values until the balancing <code>endArray</code> will be appended to this array.
|
* Begin appending a new array. All values until the balancing <code>endArray</code> will be appended to this array.
|
||||||
* The <code>endArray</code> method must be called to mark the array's end.
|
* The <code>endArray</code> method must be called to mark the array's end.
|
||||||
@ -116,7 +116,7 @@ public class JSONWriter {
|
|||||||
}
|
}
|
||||||
throw new JSONException("Misplaced array.");
|
throw new JSONException("Misplaced array.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End something.
|
* End something.
|
||||||
*
|
*
|
||||||
@ -140,7 +140,7 @@ public class JSONWriter {
|
|||||||
this.comma = true;
|
this.comma = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End an array. This method most be called to balance calls to <code>array</code>.
|
* End an array. This method most be called to balance calls to <code>array</code>.
|
||||||
*
|
*
|
||||||
@ -151,7 +151,7 @@ public class JSONWriter {
|
|||||||
public JSONWriter endArray() throws JSONException {
|
public JSONWriter endArray() throws JSONException {
|
||||||
return this.end('a', ']');
|
return this.end('a', ']');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End an object. This method most be called to balance calls to <code>object</code>.
|
* End an object. This method most be called to balance calls to <code>object</code>.
|
||||||
*
|
*
|
||||||
@ -162,7 +162,7 @@ public class JSONWriter {
|
|||||||
public JSONWriter endObject() throws JSONException {
|
public JSONWriter endObject() throws JSONException {
|
||||||
return this.end('k', '}');
|
return this.end('k', '}');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a key. The key will be associated with the next value. In an object, every value must be preceded by a
|
* Append a key. The key will be associated with the next value. In an object, every value must be preceded by a
|
||||||
* key.
|
* key.
|
||||||
@ -195,7 +195,7 @@ public class JSONWriter {
|
|||||||
}
|
}
|
||||||
throw new JSONException("Misplaced key.");
|
throw new JSONException("Misplaced key.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begin appending a new object. All keys and values until the balancing <code>endObject</code> will be appended to
|
* Begin appending a new object. All keys and values until the balancing <code>endObject</code> will be appended to
|
||||||
* this object. The <code>endObject</code> method must be called to mark the object's end.
|
* this object. The <code>endObject</code> method must be called to mark the object's end.
|
||||||
@ -217,7 +217,7 @@ public class JSONWriter {
|
|||||||
}
|
}
|
||||||
throw new JSONException("Misplaced object.");
|
throw new JSONException("Misplaced object.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pop an array or object scope.
|
* Pop an array or object scope.
|
||||||
*
|
*
|
||||||
@ -236,7 +236,7 @@ public class JSONWriter {
|
|||||||
this.top -= 1;
|
this.top -= 1;
|
||||||
this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
|
this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push an array or object scope.
|
* Push an array or object scope.
|
||||||
*
|
*
|
||||||
@ -252,7 +252,7 @@ public class JSONWriter {
|
|||||||
this.mode = jo == null ? 'a' : 'k';
|
this.mode = jo == null ? 'a' : 'k';
|
||||||
this.top += 1;
|
this.top += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append either the value <code>true</code> or the value <code>false</code> .
|
* Append either the value <code>true</code> or the value <code>false</code> .
|
||||||
*
|
*
|
||||||
@ -265,7 +265,7 @@ public class JSONWriter {
|
|||||||
public JSONWriter value(final boolean b) throws JSONException {
|
public JSONWriter value(final boolean b) throws JSONException {
|
||||||
return this.append(b ? "true" : "false");
|
return this.append(b ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a double value.
|
* Append a double value.
|
||||||
*
|
*
|
||||||
@ -278,7 +278,7 @@ public class JSONWriter {
|
|||||||
public JSONWriter value(final double d) throws JSONException {
|
public JSONWriter value(final double d) throws JSONException {
|
||||||
return this.value(new Double(d));
|
return this.value(new Double(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a long value.
|
* Append a long value.
|
||||||
*
|
*
|
||||||
@ -291,7 +291,7 @@ public class JSONWriter {
|
|||||||
public JSONWriter value(final long l) throws JSONException {
|
public JSONWriter value(final long l) throws JSONException {
|
||||||
return this.append(Long.toString(l));
|
return this.append(Long.toString(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append an object value.
|
* Append an object value.
|
||||||
*
|
*
|
||||||
|
@ -43,7 +43,7 @@ public class Kim {
|
|||||||
* The memoization of toString().
|
* The memoization of toString().
|
||||||
*/
|
*/
|
||||||
private String string = null;
|
private String string = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a kim from a portion of a byte array.
|
* Make a kim from a portion of a byte array.
|
||||||
*
|
*
|
||||||
@ -70,7 +70,7 @@ public class Kim {
|
|||||||
this.hashcode += sum << 16;
|
this.hashcode += sum << 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a kim from a byte array.
|
* Make a kim from a byte array.
|
||||||
*
|
*
|
||||||
@ -80,7 +80,7 @@ public class Kim {
|
|||||||
public Kim(final byte[] bytes, final int length) {
|
public Kim(final byte[] bytes, final int length) {
|
||||||
this(bytes, 0, length);
|
this(bytes, 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a new kim from a substring of an existing kim. The coordinates are in byte units, not character units.
|
* Make a new kim from a substring of an existing kim. The coordinates are in byte units, not character units.
|
||||||
*
|
*
|
||||||
@ -91,7 +91,7 @@ public class Kim {
|
|||||||
public Kim(final Kim kim, final int from, final int thru) {
|
public Kim(final Kim kim, final int from, final int thru) {
|
||||||
this(kim.bytes, from, thru);
|
this(kim.bytes, from, thru);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a kim from a string.
|
* Make a kim from a string.
|
||||||
*
|
*
|
||||||
@ -173,7 +173,7 @@ public class Kim {
|
|||||||
this.hashcode += sum << 16;
|
this.hashcode += sum << 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of bytes needed to contain the character in Kim format.
|
* Returns the number of bytes needed to contain the character in Kim format.
|
||||||
*
|
*
|
||||||
@ -189,7 +189,7 @@ public class Kim {
|
|||||||
}
|
}
|
||||||
return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3;
|
return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the character at the specified index. The index refers to byte values and ranges from 0 to length - 1.
|
* Returns the character at the specified index. The index refers to byte values and ranges from 0 to length - 1.
|
||||||
* The index of the next character is at index + Kim.characterSize(kim.characterAt(index)).
|
* The index of the next character is at index + Kim.characterSize(kim.characterAt(index)).
|
||||||
@ -220,7 +220,7 @@ public class Kim {
|
|||||||
}
|
}
|
||||||
throw new JSONException("Bad character at " + at);
|
throw new JSONException("Bad character at " + at);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the contents of this kim to a byte array.
|
* Copy the contents of this kim to a byte array.
|
||||||
*
|
*
|
||||||
@ -233,7 +233,7 @@ public class Kim {
|
|||||||
System.arraycopy(this.bytes, 0, bytes, at, this.length);
|
System.arraycopy(this.bytes, 0, bytes, at, this.length);
|
||||||
return at + this.length;
|
return at + this.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Two kim objects containing exactly the same bytes in the same order are equal to each other.
|
* Two kim objects containing exactly the same bytes in the same order are equal to each other.
|
||||||
*
|
*
|
||||||
@ -255,7 +255,7 @@ public class Kim {
|
|||||||
}
|
}
|
||||||
return java.util.Arrays.equals(this.bytes, that.bytes);
|
return java.util.Arrays.equals(this.bytes, that.bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a byte from a kim.
|
* Get a byte from a kim.
|
||||||
*
|
*
|
||||||
@ -271,7 +271,7 @@ public class Kim {
|
|||||||
}
|
}
|
||||||
return (this.bytes[at]) & 0xFF;
|
return (this.bytes[at]) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hash code value for the kim.
|
* Returns a hash code value for the kim.
|
||||||
*/
|
*/
|
||||||
@ -279,7 +279,7 @@ public class Kim {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return this.hashcode;
|
return this.hashcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a UTF-16 String from this kim. The number of codepoints in the string will not be greater than the number
|
* Produce a UTF-16 String from this kim. The number of codepoints in the string will not be greater than the number
|
||||||
* of bytes in the kim, although it could be less.
|
* of bytes in the kim, although it could be less.
|
||||||
|
@ -51,7 +51,7 @@ public class Property {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the JSONObject into a property file object.
|
* Converts the JSONObject into a property file object.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +45,7 @@ public class XML {
|
|||||||
* The Character '/'.
|
* The Character '/'.
|
||||||
*/
|
*/
|
||||||
public static final Character SLASH = '/';
|
public static final Character SLASH = '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace special characters with XML escapes:
|
* Replace special characters with XML escapes:
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -87,7 +87,7 @@ public class XML {
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throw an exception if the string contains whitespace. Whitespace is not allowed in tagNames and attributes.
|
* Throw an exception if the string contains whitespace. Whitespace is not allowed in tagNames and attributes.
|
||||||
*
|
*
|
||||||
@ -107,7 +107,7 @@ public class XML {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan the content following the named tag, attaching it to the context.
|
* Scan the content following the named tag, attaching it to the context.
|
||||||
*
|
*
|
||||||
@ -257,7 +257,7 @@ public class XML {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.
|
* Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.
|
||||||
* This is much less ambitious than JSONObject.stringToValue, especially because it does not attempt to convert plus
|
* This is much less ambitious than JSONObject.stringToValue, especially because it does not attempt to convert plus
|
||||||
@ -299,7 +299,7 @@ public class XML {
|
|||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject. Some information may be lost in
|
* Convert a well-formed (but not necessarily valid) XML string into a JSONObject. Some information may be lost in
|
||||||
* this transformation because JSON is a data format and XML is a document format. XML uses elements, attributes,
|
* this transformation because JSON is a data format and XML is a document format. XML uses elements, attributes,
|
||||||
@ -322,7 +322,7 @@ public class XML {
|
|||||||
}
|
}
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSONObject into a well-formed, element-normal XML string.
|
* Convert a JSONObject into a well-formed, element-normal XML string.
|
||||||
*
|
*
|
||||||
@ -335,7 +335,7 @@ public class XML {
|
|||||||
public static String toString(final Object object) throws JSONException {
|
public static String toString(final Object object) throws JSONException {
|
||||||
return toString(object, null);
|
return toString(object, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSONObject into a well-formed, element-normal XML string.
|
* Convert a JSONObject into a well-formed, element-normal XML string.
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
entity.put("lt", XML.LT);
|
entity.put("lt", XML.LT);
|
||||||
entity.put("quot", XML.QUOT);
|
entity.put("quot", XML.QUOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an XMLTokener from a string.
|
* Construct an XMLTokener from a string.
|
||||||
*
|
*
|
||||||
@ -28,7 +28,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
public XMLTokener(final String s) {
|
public XMLTokener(final String s) {
|
||||||
super(s);
|
super(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the text in the CDATA block.
|
* Get the text in the CDATA block.
|
||||||
*
|
*
|
||||||
@ -53,7 +53,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next XML outer token, trimming whitespace. There are two kinds of tokens: the '<' character which begins
|
* Get the next XML outer token, trimming whitespace. There are two kinds of tokens: the '<' character which begins
|
||||||
* a markup tag, and the content text between markup tags.
|
* a markup tag, and the content text between markup tags.
|
||||||
@ -88,7 +88,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
c = next();
|
c = next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the next entity. These entities are translated to Characters: <code>& ' > <
|
* Return the next entity. These entities are translated to Characters: <code>& ' > <
|
||||||
* "</code>.
|
* "</code>.
|
||||||
@ -115,7 +115,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
final Object object = entity.get(string);
|
final Object object = entity.get(string);
|
||||||
return object != null ? object : ampersand + string + ";";
|
return object != null ? object : ampersand + string + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures.
|
* Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures.
|
||||||
*
|
*
|
||||||
@ -179,7 +179,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next XML Token. These tokens are found inside of angle brackets. It may be one of these characters:
|
* Get the next XML Token. These tokens are found inside of angle brackets. It may be one of these characters:
|
||||||
* <code>/ > = ! ?</code> or it may be a string wrapped in single quotes or double quotes, or it may be a name.
|
* <code>/ > = ! ?</code> or it may be a string wrapped in single quotes or double quotes, or it may be a name.
|
||||||
@ -258,7 +258,7 @@ public class XMLTokener extends JSONTokener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip characters until past the requested string. If it is not found, we are left at the end of the source with a
|
* Skip characters until past the requested string. If it is not found, we are left at the end of the source with a
|
||||||
* result of false.
|
* result of false.
|
||||||
|
@ -12,10 +12,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
@ -28,7 +25,7 @@ import com.intellectualcrafters.plot.commands.WE_Anywhere;
|
|||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.database.PlotMeConverter;
|
import com.intellectualcrafters.plot.database.PlotMeConverter;
|
||||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
@ -38,12 +35,19 @@ import com.intellectualcrafters.plot.listeners.PlayerEvents;
|
|||||||
import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
|
import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||||
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.titles.AbstractTitle;
|
||||||
|
import com.intellectualcrafters.plot.titles.DefaultTitle;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.BlockUpdateUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.ConsoleColors;
|
import com.intellectualcrafters.plot.util.ConsoleColors;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitEventUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitSetupUtils;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitSetupUtils;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
@ -51,19 +55,16 @@ import com.intellectualcrafters.plot.util.bukkit.Metrics;
|
|||||||
import com.intellectualcrafters.plot.util.bukkit.SendChunk;
|
import com.intellectualcrafters.plot.util.bukkit.SendChunk;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast;
|
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast_1_8;
|
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast_1_8;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
|
|
||||||
import com.intellectualcrafters.plot.util.bukkit.SetBlockSlow;
|
import com.intellectualcrafters.plot.util.bukkit.SetBlockSlow;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
|
||||||
|
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
||||||
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
|
|
||||||
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||||
public static BukkitMain THIS = null;
|
public static BukkitMain THIS = null;
|
||||||
public static PlotSquared MAIN = null;
|
public static PlotSquared MAIN = null;
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public static void worldLoad(final WorldLoadEvent event) {
|
|
||||||
UUIDHandler.cacheAll(event.getWorld().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean checkVersion(final int major, final int minor, final int minor2) {
|
public static boolean checkVersion(final int major, final int minor, final int minor2) {
|
||||||
try {
|
try {
|
||||||
@ -82,28 +83,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void PlayerCommand(final PlayerCommandPreprocessEvent event) {
|
|
||||||
final String message = event.getMessage();
|
|
||||||
if (message.toLowerCase().startsWith("/plotme")) {
|
|
||||||
final Plugin plotme = Bukkit.getPluginManager().getPlugin("PlotMe");
|
|
||||||
if (plotme == null) {
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
if (Settings.USE_PLOTME_ALIAS) {
|
|
||||||
player.performCommand(message.replace("/plotme", "plots"));
|
|
||||||
} else {
|
|
||||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
MAIN = new PlotSquared(this);
|
|
||||||
THIS = this;
|
THIS = this;
|
||||||
|
MAIN = new PlotSquared(this);
|
||||||
if (Settings.METRICS) {
|
if (Settings.METRICS) {
|
||||||
try {
|
try {
|
||||||
final Metrics metrics = new Metrics(this);
|
final Metrics metrics = new Metrics(this);
|
||||||
@ -117,16 +101,17 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
MAIN.disable();
|
MAIN.disable();
|
||||||
MAIN = null;
|
MAIN = null;
|
||||||
THIS = null;
|
THIS = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(String message) {
|
public void log(String message) {
|
||||||
|
message = message.replaceAll("\u00B2", "2");
|
||||||
if ((THIS == null) || (Bukkit.getServer().getConsoleSender() == null)) {
|
if ((THIS == null) || (Bukkit.getServer().getConsoleSender() == null)) {
|
||||||
System.out.println(ChatColor.stripColor(ConsoleColors.fromString(message)));
|
System.out.println(ChatColor.stripColor(ConsoleColors.fromString(message)));
|
||||||
} else {
|
} else {
|
||||||
@ -137,43 +122,44 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
onDisable();
|
onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return this.getDescription().getVersion();
|
return this.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerCommands() {
|
public void registerCommands() {
|
||||||
final MainCommand command = new MainCommand();
|
new MainCommand();
|
||||||
final BukkitCommand bcmd = new BukkitCommand();
|
final BukkitCommand bcmd = new BukkitCommand();
|
||||||
final PluginCommand plotCommand = getCommand("plots");
|
final PluginCommand plotCommand = getCommand("plots");
|
||||||
plotCommand.setExecutor(bcmd);
|
plotCommand.setExecutor(bcmd);
|
||||||
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
||||||
plotCommand.setTabCompleter(bcmd);
|
plotCommand.setTabCompleter(bcmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getDirectory() {
|
public File getDirectory() {
|
||||||
return getDataFolder();
|
return getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskManager getTaskManager() {
|
public TaskManager getTaskManager() {
|
||||||
return new BukkitTaskManager();
|
return new BukkitTaskManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runEntityTask() {
|
public void runEntityTask() {
|
||||||
log(C.PREFIX.s() + "KillAllEntities started.");
|
log(C.PREFIX.s() + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(new Runnable() {
|
||||||
long ticked = 0l;
|
long ticked = 0l;
|
||||||
long error = 0l;
|
long error = 0l;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (this.ticked > 36_000L) {
|
if (this.ticked > 36_000L) {
|
||||||
@ -208,15 +194,15 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||||
if (!PlotSquared.setupPlotWorld(world, id)) {
|
if (!PlotSquared.setupPlotWorld(world, id)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new HybridGen(world);
|
return new HybridGen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPlayerEvents() {
|
public void registerPlayerEvents() {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
||||||
@ -224,23 +210,23 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerInventoryEvents() {
|
public void registerInventoryEvents() {
|
||||||
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
|
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPlotPlusEvents() {
|
public void registerPlotPlusEvents() {
|
||||||
PlotPlusListener.startRunnable(this);
|
PlotPlusListener.startRunnable(this);
|
||||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerForceFieldEvents() {
|
public void registerForceFieldEvents() {
|
||||||
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
|
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerWorldEditEvents() {
|
public void registerWorldEditEvents() {
|
||||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||||
@ -256,7 +242,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Economy getEconomy() {
|
public Economy getEconomy() {
|
||||||
if ((getServer().getPluginManager().getPlugin("Vault") != null) && getServer().getPluginManager().getPlugin("Vault").isEnabled()) {
|
if ((getServer().getPluginManager().getPlugin("Vault") != null) && getServer().getPluginManager().getPlugin("Vault").isEnabled()) {
|
||||||
@ -268,23 +254,24 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockManager initBlockManager() {
|
public BlockManager initBlockManager() {
|
||||||
if (checkVersion(1, 8, 0)) {
|
if (checkVersion(1, 8, 0)) {
|
||||||
try {
|
try {
|
||||||
SetBlockManager.setBlockManager = new SetBlockFast_1_8();
|
BukkitSetBlockManager.setBlockManager = new SetBlockFast_1_8();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
SetBlockManager.setBlockManager = new SetBlockSlow();
|
BukkitSetBlockManager.setBlockManager = new SetBlockSlow();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
SetBlockManager.setBlockManager = new SetBlockFast();
|
BukkitSetBlockManager.setBlockManager = new SetBlockFast();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
SetBlockManager.setBlockManager = new SetBlockSlow();
|
BukkitSetBlockManager.setBlockManager = new SetBlockSlow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager;
|
||||||
try {
|
try {
|
||||||
new SendChunk();
|
new SendChunk();
|
||||||
MainUtil.canSendChunk = true;
|
MainUtil.canSendChunk = true;
|
||||||
@ -293,7 +280,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
return BlockManager.manager = new BukkitUtil();
|
return BlockManager.manager = new BukkitUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean initPlotMeConverter() {
|
public boolean initPlotMeConverter() {
|
||||||
try {
|
try {
|
||||||
@ -306,35 +293,62 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getGenerator(final String world, final String name) {
|
public void getGenerator(final String world, final String name) {
|
||||||
final Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name);
|
final Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name);
|
||||||
if ((gen_plugin != null) && gen_plugin.isEnabled()) {
|
if ((gen_plugin != null) && gen_plugin.isEnabled()) {
|
||||||
gen_plugin.getDefaultWorldGenerator(world, "");
|
gen_plugin.getDefaultWorldGenerator(world, "");
|
||||||
} else {
|
} else {
|
||||||
new HybridGen(world);
|
new HybridGen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean callRemovePlot(final String world, final PlotId id) {
|
|
||||||
final PlotDeleteEvent event = new PlotDeleteEvent(world, id);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HybridUtils initHybridUtils() {
|
public HybridUtils initHybridUtils() {
|
||||||
return new BukkitHybridUtils();
|
return new BukkitHybridUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SetupUtils initSetupUtils() {
|
public SetupUtils initSetupUtils() {
|
||||||
return new BukkitSetupUtils();
|
return new BukkitSetupUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUIDWrapper initUUIDHandler() {
|
||||||
|
final boolean checkVersion = checkVersion(1, 7, 6);
|
||||||
|
if (!checkVersion) {
|
||||||
|
log(C.PREFIX.s() + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||||
|
Settings.TITLES = false;
|
||||||
|
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||||
|
} else {
|
||||||
|
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
||||||
|
}
|
||||||
|
if (Settings.OFFLINE_MODE) {
|
||||||
|
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||||
|
Settings.OFFLINE_MODE = true;
|
||||||
|
} else if (checkVersion) {
|
||||||
|
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
|
||||||
|
Settings.OFFLINE_MODE = false;
|
||||||
|
} else {
|
||||||
|
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||||
|
Settings.OFFLINE_MODE = true;
|
||||||
|
}
|
||||||
|
if (Settings.OFFLINE_MODE) {
|
||||||
|
log(C.PREFIX.s() + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
|
||||||
|
} else {
|
||||||
|
log(C.PREFIX.s() + " &6PlotSquared is using online UUIDs");
|
||||||
|
}
|
||||||
|
return UUIDHandler.uuidWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkManager initChunkManager() {
|
||||||
|
return new BukkitChunkManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventUtil initEventUtil() {
|
||||||
|
return new BukkitEventUtil();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,47 +5,53 @@ import java.io.File;
|
|||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
|
|
||||||
public interface IPlotMain {
|
public interface IPlotMain {
|
||||||
public void log(String message);
|
public void log(String message);
|
||||||
|
|
||||||
public File getDirectory();
|
public File getDirectory();
|
||||||
|
|
||||||
public void disable();
|
public void disable();
|
||||||
|
|
||||||
public String getVersion();
|
public String getVersion();
|
||||||
|
|
||||||
public TaskManager getTaskManager();
|
public TaskManager getTaskManager();
|
||||||
|
|
||||||
public void runEntityTask();
|
public void runEntityTask();
|
||||||
|
|
||||||
public void registerCommands();
|
public void registerCommands();
|
||||||
|
|
||||||
public void registerPlayerEvents();
|
public void registerPlayerEvents();
|
||||||
|
|
||||||
public void registerInventoryEvents();
|
public void registerInventoryEvents();
|
||||||
|
|
||||||
public void registerPlotPlusEvents();
|
public void registerPlotPlusEvents();
|
||||||
|
|
||||||
public void registerForceFieldEvents();
|
public void registerForceFieldEvents();
|
||||||
|
|
||||||
public void registerWorldEditEvents();
|
public void registerWorldEditEvents();
|
||||||
|
|
||||||
public Economy getEconomy();
|
public Economy getEconomy();
|
||||||
|
|
||||||
public BlockManager initBlockManager();
|
public BlockManager initBlockManager();
|
||||||
|
|
||||||
|
public EventUtil initEventUtil();
|
||||||
|
|
||||||
|
public ChunkManager initChunkManager();
|
||||||
|
|
||||||
public SetupUtils initSetupUtils();
|
public SetupUtils initSetupUtils();
|
||||||
|
|
||||||
public HybridUtils initHybridUtils();
|
public HybridUtils initHybridUtils();
|
||||||
|
|
||||||
|
public UUIDWrapper initUUIDHandler();
|
||||||
|
|
||||||
public boolean initPlotMeConverter();
|
public boolean initPlotMeConverter();
|
||||||
|
|
||||||
public void getGenerator(String world, String name);
|
public void getGenerator(String world, String name);
|
||||||
|
|
||||||
public boolean callRemovePlot(String world, PlotId id);
|
|
||||||
}
|
}
|
||||||
|
@ -50,12 +50,14 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
import com.intellectualcrafters.plot.util.Logger;
|
import com.intellectualcrafters.plot.util.Logger;
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
|
||||||
import com.intellectualcrafters.plot.util.Logger.LogLevel;
|
import com.intellectualcrafters.plot.util.Logger.LogLevel;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
@ -81,11 +83,11 @@ public class PlotSquared {
|
|||||||
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
|
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
|
||||||
private static MySQL mySQL;
|
private static MySQL mySQL;
|
||||||
public static Connection connection;
|
public static Connection connection;
|
||||||
|
|
||||||
public static MySQL getMySQL() {
|
public static MySQL getMySQL() {
|
||||||
return mySQL;
|
return mySQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePlot(final Plot plot) {
|
public static void updatePlot(final Plot plot) {
|
||||||
final String world = plot.world;
|
final String world = plot.world;
|
||||||
if (!plots.containsKey(world)) {
|
if (!plots.containsKey(world)) {
|
||||||
@ -94,14 +96,14 @@ public class PlotSquared {
|
|||||||
plot.hasChanged = true;
|
plot.hasChanged = true;
|
||||||
plots.get(world).put(plot.id, plot);
|
plots.get(world).put(plot.id, plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotWorld getPlotWorld(final String world) {
|
public static PlotWorld getPlotWorld(final String world) {
|
||||||
if (plotworlds.containsKey(world)) {
|
if (plotworlds.containsKey(world)) {
|
||||||
return plotworlds.get(world);
|
return plotworlds.get(world);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPlotWorld(final String world, final PlotWorld plotworld, final PlotManager manager) {
|
public static void addPlotWorld(final String world, final PlotWorld plotworld, final PlotManager manager) {
|
||||||
plotworlds.put(world, plotworld);
|
plotworlds.put(world, plotworld);
|
||||||
plotmanagers.put(world, manager);
|
plotmanagers.put(world, manager);
|
||||||
@ -109,21 +111,21 @@ public class PlotSquared {
|
|||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
plots.put(world, new HashMap<PlotId, Plot>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removePlotWorld(final String world) {
|
public static void removePlotWorld(final String world) {
|
||||||
plots.remove(world);
|
plots.remove(world);
|
||||||
plotmanagers.remove(world);
|
plotmanagers.remove(world);
|
||||||
plotworlds.remove(world);
|
plotworlds.remove(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
|
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
|
||||||
return plots;
|
return plots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||||
PlotSquared.plots = plots;
|
PlotSquared.plots = plots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots() {
|
public static Set<Plot> getPlots() {
|
||||||
final ArrayList<Plot> newplots = new ArrayList<>();
|
final ArrayList<Plot> newplots = new ArrayList<>();
|
||||||
for (final HashMap<PlotId, Plot> world : plots.values()) {
|
for (final HashMap<PlotId, Plot> world : plots.values()) {
|
||||||
@ -131,7 +133,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return new LinkedHashSet<>(newplots);
|
return new LinkedHashSet<>(newplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinkedHashSet<Plot> getPlotsSorted() {
|
public static LinkedHashSet<Plot> getPlotsSorted() {
|
||||||
final ArrayList<Plot> newplots = new ArrayList<>();
|
final ArrayList<Plot> newplots = new ArrayList<>();
|
||||||
for (final HashMap<PlotId, Plot> world : plots.values()) {
|
for (final HashMap<PlotId, Plot> world : plots.values()) {
|
||||||
@ -139,17 +141,17 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return new LinkedHashSet<>(newplots);
|
return new LinkedHashSet<>(newplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final String world, final String player) {
|
public static Set<Plot> getPlots(final String world, final String player) {
|
||||||
final UUID uuid = UUIDHandler.getUUID(player);
|
final UUID uuid = UUIDHandler.getUUID(player);
|
||||||
return getPlots(world, uuid);
|
return getPlots(world, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final String world, final PlotPlayer player) {
|
public static Set<Plot> getPlots(final String world, final PlotPlayer player) {
|
||||||
final UUID uuid = player.getUUID();
|
final UUID uuid = player.getUUID();
|
||||||
return getPlots(world, uuid);
|
return getPlots(world, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final String world, final UUID uuid) {
|
public static Set<Plot> getPlots(final String world, final UUID uuid) {
|
||||||
final ArrayList<Plot> myplots = new ArrayList<>();
|
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||||
for (final Plot plot : getPlots(world).values()) {
|
for (final Plot plot : getPlots(world).values()) {
|
||||||
@ -161,30 +163,30 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return new HashSet<>(myplots);
|
return new HashSet<>(myplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlotWorld(final String world) {
|
public static boolean isPlotWorld(final String world) {
|
||||||
return (plotworlds.containsKey(world));
|
return (plotworlds.containsKey(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotManager getPlotManager(final String world) {
|
public static PlotManager getPlotManager(final String world) {
|
||||||
if (plotmanagers.containsKey(world)) {
|
if (plotmanagers.containsKey(world)) {
|
||||||
return plotmanagers.get(world);
|
return plotmanagers.get(world);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getPlotWorldsString() {
|
public static String[] getPlotWorldsString() {
|
||||||
final Set<String> strings = plots.keySet();
|
final Set<String> strings = plots.keySet();
|
||||||
return strings.toArray(new String[strings.size()]);
|
return strings.toArray(new String[strings.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<PlotId, Plot> getPlots(final String world) {
|
public static HashMap<PlotId, Plot> getPlots(final String world) {
|
||||||
if (plots.containsKey(world)) {
|
if (plots.containsKey(world)) {
|
||||||
return plots.get(world);
|
return plots.get(world);
|
||||||
}
|
}
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<Plot> getPlots(final PlotPlayer player) {
|
public static Set<Plot> getPlots(final PlotPlayer player) {
|
||||||
final UUID uuid = player.getUUID();
|
final UUID uuid = player.getUUID();
|
||||||
final ArrayList<Plot> myplots = new ArrayList<>();
|
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||||
@ -201,13 +203,9 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return new HashSet<>(myplots);
|
return new HashSet<>(myplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
|
public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) {
|
||||||
if (callEvent) {
|
EventUtil.manager.callDelete(world, id);
|
||||||
if (!IMP.callRemovePlot(world, id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plots.get(world).remove(id);
|
plots.get(world).remove(id);
|
||||||
if (MainUtil.lastPlot.containsKey(world)) {
|
if (MainUtil.lastPlot.containsKey(world)) {
|
||||||
final PlotId last = MainUtil.lastPlot.get(world);
|
final PlotId last = MainUtil.lastPlot.get(world);
|
||||||
@ -219,13 +217,16 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadWorld(final String world, final PlotGenerator generator) {
|
public static void loadWorld(final String world, final PlotGenerator generator) {
|
||||||
if (getPlotWorld(world) != null) {
|
PlotWorld plotWorld = getPlotWorld(world);
|
||||||
|
if (plotWorld != null) {
|
||||||
|
if (generator != null) {
|
||||||
|
generator.init(plotWorld);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
||||||
final PlotWorld plotWorld;
|
|
||||||
final PlotGenerator plotGenerator;
|
final PlotGenerator plotGenerator;
|
||||||
final PlotManager plotManager;
|
final PlotManager plotManager;
|
||||||
final String path = "worlds." + world;
|
final String path = "worlds." + world;
|
||||||
@ -251,6 +252,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
// Now add it
|
// Now add it
|
||||||
addPlotWorld(world, plotWorld, plotManager);
|
addPlotWorld(world, plotWorld, plotManager);
|
||||||
|
generator.init(plotWorld);
|
||||||
MainUtil.setupBorder(world);
|
MainUtil.setupBorder(world);
|
||||||
} else {
|
} else {
|
||||||
if (!worlds.contains(world)) {
|
if (!worlds.contains(world)) {
|
||||||
@ -261,7 +263,7 @@ public class PlotSquared {
|
|||||||
try {
|
try {
|
||||||
final String gen_string = config.getString("worlds." + world + "." + "generator.plugin");
|
final String gen_string = config.getString("worlds." + world + "." + "generator.plugin");
|
||||||
if (gen_string == null) {
|
if (gen_string == null) {
|
||||||
new HybridGen(world);
|
new HybridGen();
|
||||||
} else {
|
} else {
|
||||||
IMP.getGenerator(world, gen_string);
|
IMP.getGenerator(world, gen_string);
|
||||||
}
|
}
|
||||||
@ -303,10 +305,11 @@ public class PlotSquared {
|
|||||||
} else if (plotWorld.TYPE == 1) {
|
} else if (plotWorld.TYPE == 1) {
|
||||||
new AugmentedPopulator(world, gen_class, null, plotWorld.TERRAIN == 2, plotWorld.TERRAIN != 2);
|
new AugmentedPopulator(world, gen_class, null, plotWorld.TERRAIN == 2, plotWorld.TERRAIN != 2);
|
||||||
}
|
}
|
||||||
|
gen_class.init(plotWorld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setupPlotWorld(final String world, final String id) {
|
public static boolean setupPlotWorld(final String world, final String id) {
|
||||||
if ((id != null) && (id.length() > 0)) {
|
if ((id != null) && (id.length() > 0)) {
|
||||||
// save configuration
|
// save configuration
|
||||||
@ -398,11 +401,11 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Connection getConnection() {
|
public static Connection getConnection() {
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotSquared(final IPlotMain imp_class) {
|
public PlotSquared(final IPlotMain imp_class) {
|
||||||
THIS = this;
|
THIS = this;
|
||||||
IMP = imp_class;
|
IMP = imp_class;
|
||||||
@ -437,12 +440,18 @@ public class PlotSquared {
|
|||||||
IMP.registerPlotPlusEvents();
|
IMP.registerPlotPlusEvents();
|
||||||
IMP.registerForceFieldEvents();
|
IMP.registerForceFieldEvents();
|
||||||
IMP.registerWorldEditEvents();
|
IMP.registerWorldEditEvents();
|
||||||
|
// create UUIDWrapper
|
||||||
|
UUIDHandler.uuidWrapper = IMP.initUUIDHandler();
|
||||||
|
// create event util class
|
||||||
|
EventUtil.manager = IMP.initEventUtil();
|
||||||
// create Hybrid utility class
|
// create Hybrid utility class
|
||||||
HybridUtils.manager = IMP.initHybridUtils();
|
HybridUtils.manager = IMP.initHybridUtils();
|
||||||
// create setup util class
|
// create setup util class
|
||||||
SetupUtils.manager = IMP.initSetupUtils();
|
SetupUtils.manager = IMP.initSetupUtils();
|
||||||
// Set block
|
// Set block
|
||||||
BlockManager.manager = IMP.initBlockManager();
|
BlockManager.manager = IMP.initBlockManager();
|
||||||
|
// Set chunk
|
||||||
|
ChunkManager.manager = IMP.initChunkManager();
|
||||||
// PlotMe
|
// PlotMe
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -460,7 +469,7 @@ public class PlotSquared {
|
|||||||
ExpireManager.runTask();
|
ExpireManager.runTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
try {
|
try {
|
||||||
connection.close();
|
connection.close();
|
||||||
@ -471,11 +480,11 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(final String message) {
|
public static void log(final String message) {
|
||||||
IMP.log(message);
|
IMP.log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupDatabase() {
|
public void setupDatabase() {
|
||||||
final String[] tables;
|
final String[] tables;
|
||||||
if (Settings.ENABLE_CLUSTERS) {
|
if (Settings.ENABLE_CLUSTERS) {
|
||||||
@ -558,7 +567,7 @@ public class PlotSquared {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupDefaultFlags() {
|
public static void setupDefaultFlags() {
|
||||||
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit");
|
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit");
|
||||||
final List<String> intervalFlags = Arrays.asList("feed", "heal");
|
final List<String> intervalFlags = Arrays.asList("feed", "heal");
|
||||||
@ -609,7 +618,7 @@ public class PlotSquared {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueDesc() {
|
public String getValueDesc() {
|
||||||
return "Flag value must be a gamemode: 'creative' , 'survival' or 'adventure'";
|
return "Flag value must be a gamemode: 'creative' , 'survival' or 'adventure'";
|
||||||
@ -633,14 +642,14 @@ public class PlotSquared {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueDesc() {
|
public String getValueDesc() {
|
||||||
return "Flag value must be weather type: 'clear' or 'rain'";
|
return "Flag value must be weather type: 'clear' or 'rain'";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupConfig() {
|
public static void setupConfig() {
|
||||||
config.set("version", VERSION);
|
config.set("version", VERSION);
|
||||||
final Map<String, Object> options = new HashMap<>();
|
final Map<String, Object> options = new HashMap<>();
|
||||||
@ -699,7 +708,7 @@ public class PlotSquared {
|
|||||||
Settings.UUID_FROM_DISK = config.getBoolean("uuid.read-from-disk");
|
Settings.UUID_FROM_DISK = config.getBoolean("uuid.read-from-disk");
|
||||||
Settings.REQUIRE_SELECTION = config.getBoolean("worldedit.require-selection-in-mask");
|
Settings.REQUIRE_SELECTION = config.getBoolean("worldedit.require-selection-in-mask");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupConfigs() {
|
public static void setupConfigs() {
|
||||||
final File folder = new File(IMP.getDirectory() + File.separator + "config");
|
final File folder = new File(IMP.getDirectory() + File.separator + "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
@ -716,7 +725,7 @@ public class PlotSquared {
|
|||||||
setupStyle();
|
setupStyle();
|
||||||
} catch (final Exception err) {
|
} catch (final Exception err) {
|
||||||
Logger.add(LogLevel.DANGER, "Failed to save style.yml");
|
Logger.add(LogLevel.DANGER, "Failed to save style.yml");
|
||||||
System.out.println("failed to save style.yml");
|
log("failed to save style.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
configFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "settings.yml");
|
configFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "settings.yml");
|
||||||
@ -729,7 +738,7 @@ public class PlotSquared {
|
|||||||
setupConfig();
|
setupConfig();
|
||||||
} catch (final Exception err_trans) {
|
} catch (final Exception err_trans) {
|
||||||
Logger.add(LogLevel.DANGER, "Failed to save settings.yml");
|
Logger.add(LogLevel.DANGER, "Failed to save settings.yml");
|
||||||
System.out.println("Failed to save settings.yml");
|
log("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
storageFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "storage.yml");
|
storageFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "storage.yml");
|
||||||
@ -742,7 +751,7 @@ public class PlotSquared {
|
|||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (final Exception err_trans) {
|
} catch (final Exception err_trans) {
|
||||||
Logger.add(LogLevel.DANGER, "Failed to save storage.yml");
|
Logger.add(LogLevel.DANGER, "Failed to save storage.yml");
|
||||||
System.out.println("Failed to save storage.yml");
|
log("Failed to save storage.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
style.save(styleFile);
|
style.save(styleFile);
|
||||||
@ -753,7 +762,7 @@ public class PlotSquared {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupStorage() {
|
private static void setupStorage() {
|
||||||
storage.set("version", VERSION);
|
storage.set("version", VERSION);
|
||||||
final Map<String, Object> options = new HashMap<>();
|
final Map<String, Object> options = new HashMap<>();
|
||||||
@ -771,9 +780,6 @@ public class PlotSquared {
|
|||||||
storage.set(node.getKey(), node.getValue());
|
storage.set(node.getKey(), node.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void showDebug() {
|
|
||||||
Settings.DB.USE_MYSQL = storage.getBoolean("mysql.use");
|
Settings.DB.USE_MYSQL = storage.getBoolean("mysql.use");
|
||||||
Settings.DB.USER = storage.getString("mysql.user");
|
Settings.DB.USER = storage.getString("mysql.user");
|
||||||
Settings.DB.PASSWORD = storage.getString("mysql.password");
|
Settings.DB.PASSWORD = storage.getString("mysql.password");
|
||||||
@ -790,10 +796,13 @@ public class PlotSquared {
|
|||||||
Settings.API_URL = config.getString("uuid.api.location");
|
Settings.API_URL = config.getString("uuid.api.location");
|
||||||
Settings.CUSTOM_API = config.getBoolean("uuid.api.custom");
|
Settings.CUSTOM_API = config.getBoolean("uuid.api.custom");
|
||||||
Settings.UUID_FECTHING = config.getBoolean("uuid.fetching");
|
Settings.UUID_FECTHING = config.getBoolean("uuid.fetching");
|
||||||
C.COLOR_1 = "\u00A7" + (style.getString("color.1"));
|
}
|
||||||
C.COLOR_2 = "\u00A7" + (style.getString("color.2"));
|
|
||||||
C.COLOR_3 = "\u00A7" + (style.getString("color.3"));
|
public static void showDebug() {
|
||||||
C.COLOR_4 = "\u00A7" + (style.getString("color.4"));
|
C.COLOR_1 = "&" + (style.getString("color.1"));
|
||||||
|
C.COLOR_2 = "&" + (style.getString("color.2"));
|
||||||
|
C.COLOR_3 = "&" + (style.getString("color.3"));
|
||||||
|
C.COLOR_4 = "&" + (style.getString("color.4"));
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
final Map<String, String> settings = new HashMap<>();
|
final Map<String, String> settings = new HashMap<>();
|
||||||
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
|
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
|
||||||
@ -811,7 +820,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupStyle() {
|
private static void setupStyle() {
|
||||||
style.set("version", VERSION);
|
style.set("version", VERSION);
|
||||||
final Map<String, Object> o = new HashMap<>();
|
final Map<String, Object> o = new HashMap<>();
|
||||||
@ -825,11 +834,11 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getJavaVersion() {
|
public static double getJavaVersion() {
|
||||||
return Double.parseDouble(System.getProperty("java.specification.version"));
|
return Double.parseDouble(System.getProperty("java.specification.version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getPlotWorlds() {
|
public static Set<String> getPlotWorlds() {
|
||||||
return plotworlds.keySet();
|
return plotworlds.keySet();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class Auto extends SubCommand {
|
|||||||
public Auto() {
|
public Auto() {
|
||||||
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING, true);
|
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotId getNextPlot(final PlotId id, final int step) {
|
public static PlotId getNextPlot(final PlotId id, final int step) {
|
||||||
final int absX = Math.abs(id.x);
|
final int absX = Math.abs(id.x);
|
||||||
final int absY = Math.abs(id.y);
|
final int absY = Math.abs(id.y);
|
||||||
@ -69,7 +69,7 @@ public class Auto extends SubCommand {
|
|||||||
return new PlotId(id.x + 1, id.y);
|
return new PlotId(id.x + 1, id.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO auto claim a mega plot with schematic
|
// TODO auto claim a mega plot with schematic
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
@ -119,7 +119,7 @@ public class Auto extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
|
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, Settings.MAX_AUTO_SIZE + "");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
||||||
final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots);
|
final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots);
|
||||||
if ((diff + (size_x * size_z)) > 0) {
|
if ((diff + (size_x * size_z)) > 0) {
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
@ -231,7 +231,7 @@ public class Auto extends SubCommand {
|
|||||||
MainUtil.lastPlot.put(worldname, new PlotId(0, 0));
|
MainUtil.lastPlot.put(worldname, new PlotId(0, 0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotId getLastPlot(final String world) {
|
public PlotId getLastPlot(final String world) {
|
||||||
if ((MainUtil.lastPlot == null) || !MainUtil.lastPlot.containsKey(world)) {
|
if ((MainUtil.lastPlot == null) || !MainUtil.lastPlot.containsKey(world)) {
|
||||||
MainUtil.lastPlot.put(world, new PlotId(0, 0));
|
MainUtil.lastPlot.put(world, new PlotId(0, 0));
|
||||||
|
@ -19,16 +19,15 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public class BukkitCommand implements CommandExecutor, TabCompleter {
|
public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String commandLabel, String[] args) {
|
|
||||||
Player player = null;
|
|
||||||
if (commandSender instanceof Player) {
|
|
||||||
player = (Player) commandSender;
|
|
||||||
}
|
|
||||||
return MainCommand.onCommand(BukkitUtil.getPlayer(player), commandLabel, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(final CommandSender commandSender, final Command command, final String commandLabel, final String[] args) {
|
||||||
|
if (commandSender instanceof Player) {
|
||||||
|
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), commandLabel, args);
|
||||||
|
}
|
||||||
|
return MainCommand.onCommand(null, commandLabel, args);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(final CommandSender commandSender, final Command command, final String s, final String[] strings) {
|
public List<String> onTabComplete(final CommandSender commandSender, final Command command, final String s, final String[] strings) {
|
||||||
if (!(commandSender instanceof Player)) {
|
if (!(commandSender instanceof Player)) {
|
||||||
|
@ -41,13 +41,13 @@ public class Buy extends SubCommand {
|
|||||||
public Buy() {
|
public Buy() {
|
||||||
super(Command.BUY, "Buy the plot you are standing on", "b", CommandCategory.CLAIMING, true);
|
super(Command.BUY, "Buy the plot you are standing on", "b", CommandCategory.CLAIMING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (PlotSquared.economy == null) {
|
if (PlotSquared.economy == null) {
|
||||||
return sendMessage(plr, C.ECON_DISABLED);
|
return sendMessage(plr, C.ECON_DISABLED);
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final String world = loc.getWorld();
|
final String world = loc.getWorld();
|
||||||
if (!PlotSquared.isPlotWorld(world)) {
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
return sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
@ -67,7 +67,7 @@ public class Buy extends SubCommand {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
|
||||||
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
|
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
|
||||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
@ -91,14 +91,14 @@ public class Buy extends SubCommand {
|
|||||||
price += plotworld.PLOT_PRICE * size;
|
price += plotworld.PLOT_PRICE * size;
|
||||||
initPrice += plotworld.SELL_PRICE * size;
|
initPrice += plotworld.SELL_PRICE * size;
|
||||||
}
|
}
|
||||||
if (PlotSquared.economy != null && price > 0d) {
|
if ((PlotSquared.economy != null) && (price > 0d)) {
|
||||||
if (EconHandler.getBalance(plr) < price) {
|
if (EconHandler.getBalance(plr) < price) {
|
||||||
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price);
|
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + price);
|
||||||
}
|
}
|
||||||
EconHandler.withdrawPlayer(plr, price);
|
EconHandler.withdrawPlayer(plr, price);
|
||||||
sendMessage(plr, C.REMOVED_BALANCE, price + "");
|
sendMessage(plr, C.REMOVED_BALANCE, price + "");
|
||||||
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice);
|
EconHandler.depositPlayer(UUIDHandler.uuidWrapper.getOfflinePlayer(plot.owner), initPrice);
|
||||||
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
final PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
|
sendMessage(plr, C.PLOT_SOLD, plot.id + "", plr.getName(), initPrice + "");
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -29,9 +27,11 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -40,26 +40,21 @@ public class Claim extends SubCommand {
|
|||||||
public Claim() {
|
public Claim() {
|
||||||
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
|
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final boolean auto) {
|
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final boolean auto) {
|
||||||
return claimPlot(player, plot, teleport, "", auto);
|
return claimPlot(player, plot, teleport, "", auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic, final boolean auto) {
|
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic, final boolean auto) {
|
||||||
if (plot.hasOwner() || plot.settings.isMerged()) {
|
if (plot.hasOwner() || plot.settings.isMerged()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// FIXME claim plot event
|
final boolean result = EventUtil.manager.callClaim(player, plot, false);
|
||||||
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
|
if (result) {
|
||||||
// Bukkit.getPluginManager().callEvent(event);
|
|
||||||
// boolean result = event.isCancelled();
|
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
MainUtil.createPlot(player.getUUID(), plot);
|
MainUtil.createPlot(player.getUUID(), plot);
|
||||||
MainUtil.setSign(player.getName(), plot);
|
MainUtil.setSign(player.getName(), plot);
|
||||||
MainUtil.sendMessage(player, C.CLAIMED);
|
MainUtil.sendMessage(player, C.CLAIMED);
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
if (teleport) {
|
if (teleport) {
|
||||||
MainUtil.teleportPlayer(player, loc, plot);
|
MainUtil.teleportPlayer(player, loc, plot);
|
||||||
}
|
}
|
||||||
@ -67,35 +62,35 @@ public class Claim extends SubCommand {
|
|||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
final Plot plot2 = PlotSquared.getPlots(world).get(plot.id);
|
final Plot plot2 = PlotSquared.getPlots(world).get(plot.id);
|
||||||
if (plotworld.SCHEMATIC_ON_CLAIM) {
|
if (plotworld.SCHEMATIC_ON_CLAIM) {
|
||||||
SchematicHandler.Schematic sch;
|
Schematic sch;
|
||||||
if (schematic.equals("")) {
|
if (schematic.equals("")) {
|
||||||
sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE);
|
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||||
} else {
|
} else {
|
||||||
sch = SchematicHandler.getSchematic(schematic);
|
sch = SchematicHandler.manager.getSchematic(schematic);
|
||||||
if (sch == null) {
|
if (sch == null) {
|
||||||
sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE);
|
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0);
|
SchematicHandler.manager.paste(sch, plot2, 0, 0);
|
||||||
}
|
}
|
||||||
PlotSquared.getPlotManager(world).claimPlot(plotworld, plot);
|
PlotSquared.getPlotManager(world).claimPlot(plotworld, plot);
|
||||||
MainUtil.update(loc);
|
MainUtil.update(loc);
|
||||||
}
|
}
|
||||||
return !result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
String schematic = "";
|
String schematic = "";
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr);
|
final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr);
|
||||||
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
|
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) {
|
||||||
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
|
||||||
}
|
}
|
||||||
@ -103,10 +98,9 @@ public class Claim extends SubCommand {
|
|||||||
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
return sendMessage(plr, C.PLOT_IS_CLAIMED);
|
||||||
}
|
}
|
||||||
final PlotWorld world = PlotSquared.getPlotWorld(plot.world);
|
final PlotWorld world = PlotSquared.getPlotWorld(plot.world);
|
||||||
if (PlotSquared.economy != null && world.USE_ECONOMY) {
|
if ((PlotSquared.economy != null) && world.USE_ECONOMY) {
|
||||||
final double cost = world.PLOT_PRICE;
|
final double cost = world.PLOT_PRICE;
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
final Economy economy = PlotSquared.economy;
|
|
||||||
if (EconHandler.getBalance(plr) < cost) {
|
if (EconHandler.getBalance(plr) < cost) {
|
||||||
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
|
||||||
}
|
}
|
||||||
@ -124,6 +118,6 @@ public class Claim extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !claimPlot(plr, plot, false, schematic, false) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
return claimPlot(plr, plot, false, schematic, false) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class Clear extends SubCommand {
|
|||||||
public Clear() {
|
public Clear() {
|
||||||
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, false);
|
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
@ -62,12 +62,12 @@ public class Clear extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot( plot))) {
|
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||||
}
|
}
|
||||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
||||||
@ -75,7 +75,7 @@ public class Clear extends SubCommand {
|
|||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
final boolean result = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||||
|
@ -45,7 +45,7 @@ public class Cluster extends SubCommand {
|
|||||||
public Cluster() {
|
public Cluster() {
|
||||||
super(Command.CLUSTER, "Manage a plot cluster", "cluster", CommandCategory.ACTIONS, true);
|
super(Command.CLUSTER, "Manage a plot cluster", "cluster", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
||||||
@ -307,7 +307,7 @@ public class Cluster extends SubCommand {
|
|||||||
cluster.invited.add(uuid);
|
cluster.invited.add(uuid);
|
||||||
final String world = plr.getLocation().getWorld();
|
final String world = plr.getLocation().getWorld();
|
||||||
DBFunc.setInvited(world, cluster, uuid);
|
DBFunc.setInvited(world, cluster, uuid);
|
||||||
PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
MainUtil.sendMessage(player, C.CLUSTER_INVITED, cluster.getName());
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
cluster.invited.remove(uuid);
|
cluster.invited.remove(uuid);
|
||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
MainUtil.sendMessage(player, C.CLUSTER_REMOVED, cluster.getName());
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public enum Command {
|
|||||||
* Permission Node
|
* Permission Node
|
||||||
*/
|
*/
|
||||||
private final CommandPermission permission;
|
private final CommandPermission permission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param command Command "name" (/plot [cmd])
|
* @param command Command "name" (/plot [cmd])
|
||||||
*/
|
*/
|
||||||
@ -96,7 +96,7 @@ public enum Command {
|
|||||||
this.alias = command;
|
this.alias = command;
|
||||||
this.permission = new CommandPermission("plots." + command);
|
this.permission = new CommandPermission("plots." + command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param command Command "name" (/plot [cmd])
|
* @param command Command "name" (/plot [cmd])
|
||||||
* @param permission Command Permission Node
|
* @param permission Command Permission Node
|
||||||
@ -106,7 +106,7 @@ public enum Command {
|
|||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.alias = command;
|
this.alias = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param command Command "name" (/plot [cmd])
|
* @param command Command "name" (/plot [cmd])
|
||||||
* @param alias Command Alias
|
* @param alias Command Alias
|
||||||
@ -116,7 +116,7 @@ public enum Command {
|
|||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.permission = new CommandPermission("plots." + command);
|
this.permission = new CommandPermission("plots." + command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param command Command "name" (/plot [cmd])
|
* @param command Command "name" (/plot [cmd])
|
||||||
* @param alias Command Alias
|
* @param alias Command Alias
|
||||||
@ -127,21 +127,21 @@ public enum Command {
|
|||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return command
|
* @return command
|
||||||
*/
|
*/
|
||||||
public String getCommand() {
|
public String getCommand() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return alias
|
* @return alias
|
||||||
*/
|
*/
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
return this.alias;
|
return this.alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return permission object
|
* @return permission object
|
||||||
*
|
*
|
||||||
|
@ -33,14 +33,14 @@ public class CommandPermission {
|
|||||||
* Permission Node
|
* Permission Node
|
||||||
*/
|
*/
|
||||||
public final String permission;
|
public final String permission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param permission Command Permission
|
* @param permission Command Permission
|
||||||
*/
|
*/
|
||||||
public CommandPermission(final String permission) {
|
public CommandPermission(final String permission) {
|
||||||
this.permission = permission.toLowerCase();
|
this.permission = permission.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param player Does the player have the permission?
|
* @param player Does the player have the permission?
|
||||||
*
|
*
|
||||||
|
@ -38,11 +38,11 @@ public class Comment extends SubCommand {
|
|||||||
public Comment() {
|
public Comment() {
|
||||||
super(Command.COMMENT, "Comment on a plot", "comment", CommandCategory.ACTIONS, true);
|
super(Command.COMMENT, "Comment on a plot", "comment", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
|
|
||||||
public class Condense extends SubCommand {
|
public class Condense extends SubCommand {
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
|
|
||||||
public Condense() {
|
public Condense() {
|
||||||
super("condense", "plots.admin", "Condense a plotworld", "condense", "", CommandCategory.DEBUG, false);
|
super("condense", "plots.admin", "Condense a plotworld", "condense", "", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
@ -185,7 +185,7 @@ public class Condense extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]");
|
MainUtil.sendMessage(plr, "/plot condense " + worldname + " <start|stop|info> [radius]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotId> getPlots(final Collection<Plot> plots, final int radius) {
|
public Set<PlotId> getPlots(final Collection<Plot> plots, final int radius) {
|
||||||
final HashSet<PlotId> outside = new HashSet<>();
|
final HashSet<PlotId> outside = new HashSet<>();
|
||||||
for (final Plot plot : plots) {
|
for (final Plot plot : plots) {
|
||||||
@ -195,7 +195,7 @@ public class Condense extends SubCommand {
|
|||||||
}
|
}
|
||||||
return outside;
|
return outside;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(final String message) {
|
public static void sendMessage(final String message) {
|
||||||
PlotSquared.log("&3PlotSquared -> Plot condense&8: &7" + message);
|
PlotSquared.log("&3PlotSquared -> Plot condense&8: &7" + message);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ public class CreateRoadSchematic extends SubCommand {
|
|||||||
public CreateRoadSchematic() {
|
public CreateRoadSchematic() {
|
||||||
super(Command.CREATEROADSCHEMATIC, "Add a road schematic to your world using the road around your current plot", "crs", CommandCategory.DEBUG, true);
|
super(Command.CREATEROADSCHEMATIC, "Add a road schematic to your world using the road around your current plot", "crs", CommandCategory.DEBUG, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT);
|
return sendMessage(player, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,11 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|||||||
*/
|
*/
|
||||||
public class Database extends SubCommand {
|
public class Database extends SubCommand {
|
||||||
final String[] tables = new String[] { "plot_trusted", "plot_ratings", "plot_comments" };
|
final String[] tables = new String[] { "plot_trusted", "plot_ratings", "plot_comments" };
|
||||||
|
|
||||||
public Database() {
|
public Database() {
|
||||||
super(Command.DATABASE, "Convert/Backup Storage", "database [type] [...details]", CommandCategory.DEBUG, false);
|
super(Command.DATABASE, "Convert/Backup Storage", "database [type] [...details]", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean sendMessageU(final UUID uuid, final String msg) {
|
private static boolean sendMessageU(final UUID uuid, final String msg) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
PlotSquared.log(msg);
|
PlotSquared.log(msg);
|
||||||
@ -42,7 +42,7 @@ public class Database extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertPlots(final SQLManager manager, final UUID requester, final Connection c) {
|
public static void insertPlots(final SQLManager manager, final UUID requester, final Connection c) {
|
||||||
final java.util.Set<Plot> plots = PlotSquared.getPlots();
|
final java.util.Set<Plot> plots = PlotSquared.getPlots();
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@ -68,7 +68,7 @@ public class Database extends SubCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -135,7 +135,7 @@ public class Database extends SubCommand {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean sendMessage(final PlotPlayer player, final String msg) {
|
private boolean sendMessage(final PlotPlayer player, final String msg) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
PlotSquared.log(msg);
|
PlotSquared.log(msg);
|
||||||
|
@ -31,7 +31,7 @@ public class Debug extends SubCommand {
|
|||||||
public Debug() {
|
public Debug() {
|
||||||
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.DEBUG, false);
|
super(Command.DEBUG, "Show debug information", "debug [msg]", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) {
|
||||||
@ -55,9 +55,6 @@ public class Debug extends SubCommand {
|
|||||||
for (final String world : PlotSquared.getPlotWorlds()) {
|
for (final String world : PlotSquared.getPlotWorlds()) {
|
||||||
worlds.append(world).append(" ");
|
worlds.append(world).append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME not sure if we actually need any of this debug info as we should just do a timings report which is more detailed anyway
|
|
||||||
|
|
||||||
information.append(header);
|
information.append(header);
|
||||||
information.append(getSection(section, "Lag / TPS"));
|
information.append(getSection(section, "Lag / TPS"));
|
||||||
information.append(getLine(line, "Ticks Per Second", Lag.getTPS()));
|
information.append(getLine(line, "Ticks Per Second", Lag.getTPS()));
|
||||||
@ -78,11 +75,11 @@ public class Debug extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSection(final String line, final String val) {
|
private String getSection(final String line, final String val) {
|
||||||
return line.replaceAll("%val%", val) + "\n";
|
return line.replaceAll("%val%", val) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLine(final String line, final String var, final Object val) {
|
private String getLine(final String line, final String var, final Object val) {
|
||||||
return line.replaceAll("%var%", var).replaceAll("%val%", "" + val) + "\n";
|
return line.replaceAll("%var%", var).replaceAll("%val%", "" + val) + "\n";
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,9 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
@ -47,17 +48,14 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
public DebugClaimTest() {
|
public DebugClaimTest() {
|
||||||
super(Command.DEBUGCLAIMTEST, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. Execution time may vary", "debugclaimtest", CommandCategory.DEBUG, false);
|
super(Command.DEBUGCLAIMTEST, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. Execution time may vary", "debugclaimtest", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport) {
|
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport) {
|
||||||
return claimPlot(player, plot, teleport, "");
|
return claimPlot(player, plot, teleport, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) {
|
public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final String schematic) {
|
||||||
// FIXME call claim event
|
final boolean result = EventUtil.manager.callClaim(player, plot, false);
|
||||||
// boolean result = event result
|
if (result) {
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
MainUtil.createPlot(player.getUUID(), plot);
|
MainUtil.createPlot(player.getUUID(), plot);
|
||||||
MainUtil.setSign(player.getName(), plot);
|
MainUtil.setSign(player.getName(), plot);
|
||||||
MainUtil.sendMessage(player, C.CLAIMED);
|
MainUtil.sendMessage(player, C.CLAIMED);
|
||||||
@ -65,16 +63,16 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return !result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
return !MainUtil.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}");
|
return !MainUtil.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}");
|
||||||
}
|
}
|
||||||
String world = args[0];
|
final String world = args[0];
|
||||||
if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) {
|
if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) {
|
||||||
return !MainUtil.sendMessage(null, "&cInvalid plot world!");
|
return !MainUtil.sendMessage(null, "&cInvalid plot world!");
|
||||||
}
|
}
|
||||||
@ -100,12 +98,12 @@ public class DebugClaimTest extends SubCommand {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final Location loc = manager.getSignLoc(plotworld, plot);
|
final Location loc = manager.getSignLoc(plotworld, plot);
|
||||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||||
boolean result = AChunkManager.manager.loadChunk(world, chunk);
|
final boolean result = ChunkManager.manager.loadChunk(world, chunk);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String[] lines = BlockManager.manager.getSign(loc);
|
final String[] lines = BlockManager.manager.getSign(loc);
|
||||||
if (lines != null) {
|
if (lines != null) {
|
||||||
String line = lines[2];
|
String line = lines[2];
|
||||||
if ((line != null) && (line.length() > 2)) {
|
if ((line != null) && (line.length() > 2)) {
|
||||||
|
@ -27,16 +27,16 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class DebugClear extends SubCommand {
|
public class DebugClear extends SubCommand {
|
||||||
public DebugClear() {
|
public DebugClear() {
|
||||||
super(Command.DEBUGCLEAR, "Clear a plot using a fast experimental algorithm", "debugclear", CommandCategory.DEBUG, false);
|
super(Command.DEBUGCLEAR, "Clear a plot using a fast experimental algorithm", "debugclear", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
@ -77,9 +77,9 @@ public class DebugClear extends SubCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null || !(PlotSquared.getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
|
if ((plot == null) || !(PlotSquared.getPlotWorld(loc.getWorld()) instanceof SquarePlotWorld)) {
|
||||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||||
@ -92,7 +92,7 @@ public class DebugClear extends SubCommand {
|
|||||||
final Location pos1 = MainUtil.getPlotBottomLoc(loc.getWorld(), plot.id).add(1, 0, 1);
|
final Location pos1 = MainUtil.getPlotBottomLoc(loc.getWorld(), plot.id).add(1, 0, 1);
|
||||||
final Location pos2 = MainUtil.getPlotTopLoc(loc.getWorld(), plot.id);
|
final Location pos2 = MainUtil.getPlotTopLoc(loc.getWorld(), plot.id);
|
||||||
if (MainUtil.runners.containsKey(plot)) {
|
if (MainUtil.runners.containsKey(plot)) {
|
||||||
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
|
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.runners.put(plot, 1);
|
MainUtil.runners.put(plot, 1);
|
||||||
|
@ -48,7 +48,7 @@ public class DebugExec extends SubCommand {
|
|||||||
public DebugExec() {
|
public DebugExec() {
|
||||||
super("debugexec", "plots.admin", "Multi-purpose debug command", "debugexec", "exec", CommandCategory.DEBUG, false);
|
super("debugexec", "plots.admin", "Multi-purpose debug command", "debugexec", "exec", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
final List<String> allowed_params = Arrays.asList(new String[] { "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check" });
|
final List<String> allowed_params = Arrays.asList(new String[] { "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check" });
|
||||||
@ -111,8 +111,8 @@ public class DebugExec extends SubCommand {
|
|||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return MainUtil.sendMessage(null, "player not found: " + args[1]);
|
return MainUtil.sendMessage(null, "player not found: " + args[1]);
|
||||||
}
|
}
|
||||||
BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
final BukkitOfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||||
if ((op == null) || op.getLastPlayed() == 0) {
|
if ((op == null) || (op.getLastPlayed() == 0)) {
|
||||||
return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]);
|
return MainUtil.sendMessage(null, "player hasn't connected before: " + args[1]);
|
||||||
}
|
}
|
||||||
final Timestamp stamp = new Timestamp(op.getLastPlayed());
|
final Timestamp stamp = new Timestamp(op.getLastPlayed());
|
||||||
|
@ -38,7 +38,7 @@ public class DebugFixFlags extends SubCommand {
|
|||||||
public DebugFixFlags() {
|
public DebugFixFlags() {
|
||||||
super(Command.DEBUGFIXFLAGS, "Attempt to fix all flags for a world", "debugclear", CommandCategory.DEBUG, false);
|
super(Command.DEBUGFIXFLAGS, "Attempt to fix all flags for a world", "debugclear", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
|
@ -34,7 +34,7 @@ public class DebugLoadTest extends SubCommand {
|
|||||||
public DebugLoadTest() {
|
public DebugLoadTest() {
|
||||||
super(Command.DEBUGLOADTEST, "This debug command will force the reload of all plots in the DB", "debugloadtest", CommandCategory.DEBUG, false);
|
super(Command.DEBUGLOADTEST, "This debug command will force the reload of all plots in the DB", "debugloadtest", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
|
@ -33,16 +33,16 @@ public class DebugRoadRegen extends SubCommand {
|
|||||||
public DebugRoadRegen() {
|
public DebugRoadRegen() {
|
||||||
super(Command.DEBUGROADREGEN, "Regenerate all road schematic in your current chunk", "debugroadregen", CommandCategory.DEBUG, true);
|
super(Command.DEBUGROADREGEN, "Regenerate all road schematic in your current chunk", "debugroadregen", CommandCategory.DEBUG, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
String world = loc.getWorld();
|
final String world = loc.getWorld();
|
||||||
if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) {
|
if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) {
|
||||||
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
return sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
final ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4);
|
||||||
boolean result = HybridUtils.manager.regenerateRoad(world, chunk);
|
final boolean result = HybridUtils.manager.regenerateRoad(world, chunk);
|
||||||
if (result) {
|
if (result) {
|
||||||
MainUtil.update(loc);
|
MainUtil.update(loc);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class DebugSaveTest extends SubCommand {
|
|||||||
public DebugSaveTest() {
|
public DebugSaveTest() {
|
||||||
super(Command.DEBUGSAVETEST, "This debug command will force the recreation of all plots in the DB", "debugsavetest", CommandCategory.DEBUG, false);
|
super(Command.DEBUGSAVETEST, "This debug command will force the recreation of all plots in the DB", "debugsavetest", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
|
@ -36,10 +36,10 @@ public class Delete extends SubCommand {
|
|||||||
public Delete() {
|
public Delete() {
|
||||||
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS, true);
|
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -52,7 +52,7 @@ public class Delete extends SubCommand {
|
|||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
|
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
|
||||||
if (PlotSquared.economy != null && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||||
final double c = pWorld.SELL_PRICE;
|
final double c = pWorld.SELL_PRICE;
|
||||||
if (c > 0d) {
|
if (c > 0d) {
|
||||||
EconHandler.depositPlayer(plr, c);
|
EconHandler.depositPlayer(plr, c);
|
||||||
@ -66,7 +66,7 @@ public class Delete extends SubCommand {
|
|||||||
final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true);
|
final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true);
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
if (result) {
|
if (result) {
|
||||||
boolean result2 = MainUtil.clearAsPlayer(plot, false, new Runnable() {
|
final boolean result2 = MainUtil.clearAsPlayer(plot, true, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||||
|
@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -36,14 +37,14 @@ public class Denied extends SubCommand {
|
|||||||
public Denied() {
|
public Denied() {
|
||||||
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true);
|
super(Command.DENIED, "Manage plot helpers", "denied {add|remove} {player}", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -82,7 +83,7 @@ public class Denied extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.addDenied(uuid);
|
plot.addDenied(uuid);
|
||||||
DBFunc.setDenied(loc.getWorld(), plot, uuid);
|
DBFunc.setDenied(loc.getWorld(), plot, uuid);
|
||||||
//FIXME PlayerPlotDeniedEvent
|
EventUtil.manager.callDenied(plr, plot, uuid, true);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
@ -112,7 +113,7 @@ public class Denied extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||||
// FIXME PlayerPlotDeniedEvent
|
EventUtil.manager.callDenied(plr, plot, uuid, false);
|
||||||
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.DENIED_NEED_ARGUMENT);
|
||||||
|
@ -43,7 +43,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
public FlagCmd() {
|
public FlagCmd() {
|
||||||
super(Command.FLAG, "Manage plot flags", "f", CommandCategory.ACTIONS, true);
|
super(Command.FLAG, "Manage plot flags", "f", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
/*
|
/*
|
||||||
@ -57,7 +57,7 @@ public class FlagCmd extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(player, C.NOT_IN_PLOT);
|
||||||
|
@ -13,7 +13,7 @@ public class Help extends SubCommand {
|
|||||||
public Help() {
|
public Help() {
|
||||||
super("help", "", "Get this help menu", "help", "he", SubCommand.CommandCategory.INFO, false);
|
super("help", "", "Get this help menu", "help", "he", SubCommand.CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,6 +27,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -35,14 +36,14 @@ public class Helpers extends SubCommand {
|
|||||||
public Helpers() {
|
public Helpers() {
|
||||||
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS, true);
|
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -81,7 +82,7 @@ public class Helpers extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.addHelper(uuid);
|
plot.addHelper(uuid);
|
||||||
DBFunc.setHelper(loc.getWorld(), plot, uuid);
|
DBFunc.setHelper(loc.getWorld(), plot, uuid);
|
||||||
// FIXME PlayerPlotHelperEvent
|
EventUtil.manager.callHelper(plr, plot, uuid, true);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
@ -103,7 +104,7 @@ public class Helpers extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||||
// FIXME PlayerPlotHelperEvent
|
EventUtil.manager.callHelper(plr, plot, uuid, false);
|
||||||
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||||
|
@ -34,7 +34,7 @@ public class Home extends SubCommand {
|
|||||||
public Home() {
|
public Home() {
|
||||||
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT, true);
|
super(Command.HOME, "Go to your plot", "home {id|alias}", CommandCategory.TELEPORT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plot isAlias(final String a) {
|
private Plot isAlias(final String a) {
|
||||||
for (final Plot p : PlotSquared.getPlots()) {
|
for (final Plot p : PlotSquared.getPlots()) {
|
||||||
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
|
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
|
||||||
@ -43,7 +43,7 @@ public class Home extends SubCommand {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, String... args) {
|
public boolean execute(final PlotPlayer plr, String... args) {
|
||||||
final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
|
final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
|
||||||
@ -83,7 +83,7 @@ public class Home extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleportPlayer(final PlotPlayer player, final Plot plot) {
|
public void teleportPlayer(final PlotPlayer player, final Plot plot) {
|
||||||
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
MainUtil.teleportPlayer(player, player.getLocation(), plot);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class Inbox extends SubCommand {
|
|||||||
public Inbox() {
|
public Inbox() {
|
||||||
super(Command.INBOX, "Review the comments for a plot", "inbox", CommandCategory.ACTIONS, true);
|
super(Command.INBOX, "Review the comments for a plot", "inbox", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
boolean report = false;
|
boolean report = false;
|
||||||
@ -49,9 +49,9 @@ public class Inbox extends SubCommand {
|
|||||||
report = true;
|
report = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null && !report) {
|
if ((plot == null) && !report) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
}
|
}
|
||||||
if ((plot != null) && !plot.hasOwner()) {
|
if ((plot != null) && !plot.hasOwner()) {
|
||||||
|
@ -47,13 +47,13 @@ public class Info extends SubCommand {
|
|||||||
public Info() {
|
public Info() {
|
||||||
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
|
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, String... args) {
|
public boolean execute(final PlotPlayer player, String... args) {
|
||||||
Plot plot;
|
Plot plot;
|
||||||
String world;
|
String world;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
world = loc.getWorld();
|
world = loc.getWorld();
|
||||||
if (!PlotSquared.isPlotWorld(world)) {
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
MainUtil.sendMessage(player, C.NOT_IN_PLOT_WORLD);
|
||||||
@ -129,7 +129,7 @@ public class Info extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, info, false);
|
MainUtil.sendMessage(player, info, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCaption(final String string) {
|
private String getCaption(final String string) {
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case "helpers":
|
case "helpers":
|
||||||
@ -156,7 +156,7 @@ public class Info extends SubCommand {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String format(String info, final String world, final Plot plot, final PlotPlayer player) {
|
private String format(String info, final String world, final Plot plot, final PlotPlayer player) {
|
||||||
final PlotId id = plot.id;
|
final PlotId id = plot.id;
|
||||||
final PlotId id2 = MainUtil.getTopPlot(plot).id;
|
final PlotId id2 = MainUtil.getTopPlot(plot).id;
|
||||||
@ -191,7 +191,7 @@ public class Info extends SubCommand {
|
|||||||
info = info.replaceAll("%desc%", "No description set.");
|
info = info.replaceAll("%desc%", "No description set.");
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPlayerList(final ArrayList<UUID> l) {
|
private String getPlayerList(final ArrayList<UUID> l) {
|
||||||
if ((l == null) || (l.size() < 1)) {
|
if ((l == null) || (l.size() < 1)) {
|
||||||
return " none";
|
return " none";
|
||||||
@ -207,7 +207,7 @@ public class Info extends SubCommand {
|
|||||||
}
|
}
|
||||||
return list.toString();
|
return list.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPlayerName(final UUID uuid) {
|
private String getPlayerName(final UUID uuid) {
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
@ -35,7 +35,7 @@ public class Inventory extends SubCommand {
|
|||||||
public Inventory() {
|
public Inventory() {
|
||||||
super("inventory", "plots.inventory", "Open a command inventory", "inventory", "inv", CommandCategory.INFO, true);
|
super("inventory", "plots.inventory", "Open a command inventory", "inventory", "inv", CommandCategory.INFO, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
final ArrayList<SubCommand> cmds = new ArrayList<>();
|
final ArrayList<SubCommand> cmds = new ArrayList<>();
|
||||||
@ -53,7 +53,7 @@ public class Inventory extends SubCommand {
|
|||||||
((BukkitPlayer) plr).player.openInventory(inventory);
|
((BukkitPlayer) plr).player.openInventory(inventory);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getItem(final SubCommand cmd) {
|
private ItemStack getItem(final SubCommand cmd) {
|
||||||
final ItemStack stack = new ItemStack(Material.COMMAND);
|
final ItemStack stack = new ItemStack(Material.COMMAND);
|
||||||
final ItemMeta meta = stack.getItemMeta();
|
final ItemMeta meta = stack.getItemMeta();
|
||||||
|
@ -34,10 +34,10 @@ public class Kick extends SubCommand {
|
|||||||
public Kick() {
|
public Kick() {
|
||||||
super(Command.KICK, "Kick a player from your plot", "kick", CommandCategory.ACTIONS, true);
|
super(Command.KICK, "Kick a player from your plot", "kick", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -50,7 +50,7 @@ public class Kick extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "&c/plot kick <player>");
|
MainUtil.sendMessage(plr, "&c/plot kick <player>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotPlayer player = UUIDHandler.getPlayer(args[0]);
|
final PlotPlayer player = UUIDHandler.getPlayer(args[0]);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,18 +40,18 @@ public class MainCommand {
|
|||||||
/**
|
/**
|
||||||
* Main Permission Node
|
* Main Permission Node
|
||||||
*/
|
*/
|
||||||
private final static SubCommand[] _subCommands = new SubCommand[] { new Setup(), new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Claim(), 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 Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd(), new Target(), new DebugFixFlags(), new Move(), new Condense() };
|
private final static SubCommand[] _subCommands = new SubCommand[] { new Template(), new Setup(), new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Claim(), 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 SchematicCmd(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd(), new Target(), new DebugFixFlags(), new Move(), new Condense() };
|
||||||
public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
||||||
{
|
{
|
||||||
addAll(Arrays.asList(_subCommands));
|
addAll(Arrays.asList(_subCommands));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static boolean no_permission(final PlotPlayer player, final String permission) {
|
public static boolean no_permission(final PlotPlayer player, final String permission) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, permission);
|
MainUtil.sendMessage(player, C.NO_PERMISSION, permission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SubCommand> getCommands(final SubCommand.CommandCategory category, final PlotPlayer player) {
|
public static List<SubCommand> getCommands(final SubCommand.CommandCategory category, final PlotPlayer player) {
|
||||||
final List<SubCommand> cmds = new ArrayList<>();
|
final List<SubCommand> cmds = new ArrayList<>();
|
||||||
for (final SubCommand c : subCommands) {
|
for (final SubCommand c : subCommands) {
|
||||||
@ -63,7 +63,7 @@ public class MainCommand {
|
|||||||
}
|
}
|
||||||
return cmds;
|
return cmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> helpMenu(final PlotPlayer player, final SubCommand.CommandCategory category, int page) {
|
public static List<String> helpMenu(final PlotPlayer player, final SubCommand.CommandCategory category, int page) {
|
||||||
List<SubCommand> commands;
|
List<SubCommand> commands;
|
||||||
if (category != null) {
|
if (category != null) {
|
||||||
@ -99,11 +99,11 @@ public class MainCommand {
|
|||||||
}
|
}
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String t(final String s) {
|
private static String t(final String s) {
|
||||||
return MainUtil.colorise('&', s);
|
return MainUtil.colorise('&', s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
|
public static boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
|
||||||
if (!Permissions.hasPermission(player, PlotSquared.MAIN_PERMISSION)) {
|
if (!Permissions.hasPermission(player, PlotSquared.MAIN_PERMISSION)) {
|
||||||
return no_permission(player, PlotSquared.MAIN_PERMISSION);
|
return no_permission(player, PlotSquared.MAIN_PERMISSION);
|
||||||
@ -158,7 +158,7 @@ public class MainCommand {
|
|||||||
for (final String string : helpMenu(player, cato, page)) {
|
for (final String string : helpMenu(player, cato, page)) {
|
||||||
help.append(string).append("\n");
|
help.append(string).append("\n");
|
||||||
}
|
}
|
||||||
player.sendMessage(MainUtil.colorise('&', help.toString()));
|
MainUtil.sendMessage(player, help.toString());
|
||||||
// return PlayerFunctions.sendMessage(player, help.toString());
|
// return PlayerFunctions.sendMessage(player, help.toString());
|
||||||
} else {
|
} else {
|
||||||
for (final SubCommand command : subCommands) {
|
for (final SubCommand command : subCommands) {
|
||||||
|
@ -22,8 +22,6 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
@ -34,6 +32,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -44,11 +43,11 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
public final static String[] values = new String[] { "north", "east", "south", "west" };
|
public final static String[] values = new String[] { "north", "east", "south", "west" };
|
||||||
public final static String[] aliases = new String[] { "n", "e", "s", "w" };
|
public final static String[] aliases = new String[] { "n", "e", "s", "w" };
|
||||||
|
|
||||||
public Merge() {
|
public Merge() {
|
||||||
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
|
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String direction(float yaw) {
|
public static String direction(float yaw) {
|
||||||
yaw = yaw / 90;
|
yaw = yaw / 90;
|
||||||
final int i = Math.round(yaw);
|
final int i = Math.round(yaw);
|
||||||
@ -70,10 +69,10 @@ public class Merge extends SubCommand {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocationFull();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -107,7 +106,7 @@ public class Merge extends SubCommand {
|
|||||||
PlotId bot = MainUtil.getBottomPlot(plot).id;
|
PlotId bot = MainUtil.getBottomPlot(plot).id;
|
||||||
PlotId top = MainUtil.getTopPlot(plot).id;
|
PlotId top = MainUtil.getTopPlot(plot).id;
|
||||||
ArrayList<PlotId> plots;
|
ArrayList<PlotId> plots;
|
||||||
String world = plr.getLocation().getWorld();
|
final String world = plr.getLocation().getWorld();
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0: // north = -y
|
case 0: // north = -y
|
||||||
plots = MainUtil.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
plots = MainUtil.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
||||||
@ -141,11 +140,10 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PlotWorld plotWorld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotWorld = PlotSquared.getPlotWorld(world);
|
||||||
if (PlotSquared.economy != null && plotWorld.USE_ECONOMY) {
|
if ((PlotSquared.economy != null) && plotWorld.USE_ECONOMY) {
|
||||||
double cost = plotWorld.MERGE_PRICE;
|
double cost = plotWorld.MERGE_PRICE;
|
||||||
cost = plots.size() * cost;
|
cost = plots.size() * cost;
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
final Economy economy = PlotSquared.economy;
|
|
||||||
if (EconHandler.getBalance(plr) < cost) {
|
if (EconHandler.getBalance(plr) < cost) {
|
||||||
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
sendMessage(plr, C.CANNOT_AFFORD_MERGE, cost + "");
|
||||||
return false;
|
return false;
|
||||||
@ -154,10 +152,8 @@ public class Merge extends SubCommand {
|
|||||||
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
sendMessage(plr, C.REMOVED_BALANCE, cost + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//FIXME PlotMergeEvent
|
final boolean result = EventUtil.manager.callMerge(world, plot, plots);
|
||||||
// boolean result = event.isCancelled();
|
if (!result) {
|
||||||
boolean result = false;
|
|
||||||
if (result) {
|
|
||||||
MainUtil.sendMessage(plr, "&cMerge has been cancelled");
|
MainUtil.sendMessage(plr, "&cMerge has been cancelled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class Move extends SubCommand {
|
|||||||
public Move() {
|
public Move() {
|
||||||
super("debugmove", "plots.admin", "plot moving debug test", "debugmove", "move", CommandCategory.DEBUG, true);
|
super("debugmove", "plots.admin", "plot moving debug test", "debugmove", "move", CommandCategory.DEBUG, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
|
@ -39,10 +39,10 @@ public class MusicSubcommand extends SubCommand {
|
|||||||
public MusicSubcommand() {
|
public MusicSubcommand() {
|
||||||
super("music", "plots.music", "Play music in plot", "music", "mus", CommandCategory.ACTIONS, true);
|
super("music", "plots.music", "Play music in plot", "music", "mus", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(player, C.NOT_IN_PLOT);
|
return !sendMessage(player, C.NOT_IN_PLOT);
|
||||||
|
@ -40,7 +40,7 @@ public class Purge extends SubCommand {
|
|||||||
public Purge() {
|
public Purge() {
|
||||||
super("purge", "plots.admin", "Purge all plots for a world", "purge", "", CommandCategory.DEBUG, false);
|
super("purge", "plots.admin", "Purge all plots for a world", "purge", "", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotId getId(final String id) {
|
public PlotId getId(final String id) {
|
||||||
try {
|
try {
|
||||||
final String[] split = id.split(";");
|
final String[] split = id.split(";");
|
||||||
@ -49,7 +49,7 @@ public class Purge extends SubCommand {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
@ -159,7 +159,7 @@ public class Purge extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean finishPurge(final int amount) {
|
private boolean finishPurge(final int amount) {
|
||||||
MainUtil.sendMessage(null, C.PURGE_SUCCESS, amount + "");
|
MainUtil.sendMessage(null, C.PURGE_SUCCESS, amount + "");
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,14 +36,14 @@ public class Rate extends SubCommand {
|
|||||||
public Rate() {
|
public Rate() {
|
||||||
super("rate", "plots.rate", "Rate the plot", "rate {0-10}", "rt", CommandCategory.ACTIONS, true);
|
super("rate", "plots.rate", "Rate the plot", "rate {0-10}", "rt", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendMessage(plr, C.RATING_NOT_VALID);
|
sendMessage(plr, C.RATING_NOT_VALID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
|
@ -29,13 +29,13 @@ import com.intellectualcrafters.plot.generator.HybridUtils;
|
|||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
|
|
||||||
public class RegenAllRoads extends SubCommand {
|
public class RegenAllRoads extends SubCommand {
|
||||||
public RegenAllRoads() {
|
public RegenAllRoads() {
|
||||||
super(Command.REGENALLROADS, "Regenerate all roads in the map using the set road schematic", "rgar", CommandCategory.DEBUG, false);
|
super(Command.REGENALLROADS, "Regenerate all roads in the map using the set road schematic", "rgar", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
@ -52,7 +52,7 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
sendMessage(player, C.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final List<ChunkLoc> chunks = AChunkManager.manager.getChunkChunks(name);
|
final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||||
PlotSquared.log("&cIf no schematic is set, the following will not do anything");
|
PlotSquared.log("&cIf no schematic is set, the following will not do anything");
|
||||||
PlotSquared.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
|
PlotSquared.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
|
||||||
PlotSquared.log("&6Potential chunks to update: &7" + (chunks.size() * 1024));
|
PlotSquared.log("&6Potential chunks to update: &7" + (chunks.size() * 1024));
|
||||||
|
@ -30,7 +30,7 @@ public class Reload extends SubCommand {
|
|||||||
public Reload() {
|
public Reload() {
|
||||||
super("reload", "plots.admin.command.reload", "Reload configurations", "", "reload", CommandCategory.INFO, false);
|
super("reload", "plots.admin.command.reload", "Reload configurations", "", "reload", CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
try {
|
try {
|
||||||
|
@ -32,25 +32,27 @@ import com.intellectualcrafters.plot.object.Plot;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||||
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
|
||||||
public class Schematic extends SubCommand {
|
public class SchematicCmd extends SubCommand {
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
private boolean running = false;
|
private boolean running = false;
|
||||||
private Plot[] plots;
|
private Plot[] plots;
|
||||||
private int task;
|
private int task;
|
||||||
|
|
||||||
public Schematic() {
|
public SchematicCmd() {
|
||||||
super("schematic", "plots.schematic", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, false);
|
super("schematic", "plots.schematic", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, false);
|
||||||
// TODO command to fetch schematic from worldedit directory
|
// TODO command to fetch schematic from worldedit directory
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -59,7 +61,7 @@ public class Schematic extends SubCommand {
|
|||||||
}
|
}
|
||||||
final String arg = args[0].toLowerCase();
|
final String arg = args[0].toLowerCase();
|
||||||
final String file;
|
final String file;
|
||||||
final SchematicHandler.Schematic schematic;
|
final Schematic schematic;
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "paste": {
|
case "paste": {
|
||||||
if (plr == null) {
|
if (plr == null) {
|
||||||
@ -75,8 +77,8 @@ public class Schematic extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
final Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
sendMessage(plr, C.NOT_IN_PLOT);
|
sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -90,10 +92,10 @@ public class Schematic extends SubCommand {
|
|||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final SchematicHandler.Schematic schematic = SchematicHandler.getSchematic(file2);
|
final Schematic schematic = SchematicHandler.manager.getSchematic(file2);
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
||||||
Schematic.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int x;
|
final int x;
|
||||||
@ -104,7 +106,7 @@ public class Schematic extends SubCommand {
|
|||||||
final int length2 = MainUtil.getPlotWidth(loc.getWorld(), plot2.id);
|
final int length2 = MainUtil.getPlotWidth(loc.getWorld(), plot2.id);
|
||||||
if ((dem.getX() > length2) || (dem.getZ() > length2)) {
|
if ((dem.getX() > length2) || (dem.getZ() > length2)) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", dem.getX(), dem.getZ(), length2));
|
sendMessage(plr, C.SCHEMATIC_INVALID, String.format("Wrong size (x: %s, z: %d) vs %d ", dem.getX(), dem.getZ(), length2));
|
||||||
Schematic.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((dem.getX() != length2) || (dem.getZ() != length2)) {
|
if ((dem.getX() != length2) || (dem.getZ() != length2)) {
|
||||||
@ -117,26 +119,34 @@ public class Schematic extends SubCommand {
|
|||||||
}
|
}
|
||||||
final DataCollection[] b = schematic.getBlockCollection();
|
final DataCollection[] b = schematic.getBlockCollection();
|
||||||
final int sy = BlockManager.manager.getHeighestBlock(bot);
|
final int sy = BlockManager.manager.getHeighestBlock(bot);
|
||||||
final Location l1 = bot.add(0, sy - 1, 0);
|
|
||||||
final int WIDTH = schematic.getSchematicDimension().getX();
|
final int WIDTH = schematic.getSchematicDimension().getX();
|
||||||
final int LENGTH = schematic.getSchematicDimension().getZ();
|
final int LENGTH = schematic.getSchematicDimension().getZ();
|
||||||
|
final Location l1;
|
||||||
|
if (!(schematic.getSchematicDimension().getY() == BukkitUtil.getMaxHeight(loc.getWorld()))) {
|
||||||
|
l1 = bot.add(0, sy - 1, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
l1 = bot;
|
||||||
|
}
|
||||||
|
|
||||||
final int blen = b.length - 1;
|
final int blen = b.length - 1;
|
||||||
Schematic.this.task = TaskManager.runTaskRepeat(new Runnable() {
|
SchematicCmd.this.task = TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
while (!result) {
|
while (!result) {
|
||||||
final int start = Schematic.this.counter * 5000;
|
final int start = SchematicCmd.this.counter * 5000;
|
||||||
if (start > blen) {
|
if (start > blen) {
|
||||||
|
SchematicHandler.manager.pasteStates(schematic, plot, 0, 0);
|
||||||
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
|
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
|
||||||
MainUtil.update(plr.getLocation());
|
MainUtil.update(plr.getLocation());
|
||||||
Schematic.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
PlotSquared.TASK.cancelTask(Schematic.this.task);
|
PlotSquared.TASK.cancelTask(SchematicCmd.this.task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int end = Math.min(start + 5000, blen);
|
final int end = Math.min(start + 5000, blen);
|
||||||
result = SchematicHandler.pastePart(loc.getWorld(), b, l1, x, z, start, end, WIDTH, LENGTH);
|
result = SchematicHandler.manager.pastePart(loc.getWorld(), b, l1, x, z, start, end, WIDTH, LENGTH);
|
||||||
Schematic.this.counter++;
|
SchematicCmd.this.counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
@ -158,12 +168,12 @@ public class Schematic extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file = args[1];
|
file = args[1];
|
||||||
schematic = SchematicHandler.getSchematic(file);
|
schematic = SchematicHandler.manager.getSchematic(file);
|
||||||
if (schematic == null) {
|
if (schematic == null) {
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final int l1 = schematic.getSchematicDimension().getX();
|
final int l1 = schematic.getSchematicDimension().getX();
|
||||||
final int l2 = schematic.getSchematicDimension().getZ();
|
final int l2 = schematic.getSchematicDimension().getZ();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
@ -204,14 +214,14 @@ public class Schematic extends SubCommand {
|
|||||||
this.task = TaskManager.runTaskRepeat(new Runnable() {
|
this.task = TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Schematic.this.counter >= Schematic.this.plots.length) {
|
if (SchematicCmd.this.counter >= SchematicCmd.this.plots.length) {
|
||||||
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
|
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
|
||||||
Schematic.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
PlotSquared.TASK.cancelTask(Schematic.this.task);
|
PlotSquared.TASK.cancelTask(SchematicCmd.this.task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Plot plot = Schematic.this.plots[Schematic.this.counter];
|
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||||
final CompoundTag sch = SchematicHandler.getCompoundTag(worldname, plot.id);
|
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(worldname, plot.id);
|
||||||
final String o = UUIDHandler.getName(plot.owner);
|
final String o = UUIDHandler.getName(plot.owner);
|
||||||
final String owner = o == null ? "unknown" : o;
|
final String owner = o == null ? "unknown" : o;
|
||||||
if (sch == null) {
|
if (sch == null) {
|
||||||
@ -221,23 +231,22 @@ public class Schematic extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(null, "&6ID: " + plot.id);
|
MainUtil.sendMessage(null, "&6ID: " + plot.id);
|
||||||
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
|
final boolean result = SchematicHandler.manager.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + worldname + "," + owner + ".schematic");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(null, "&7 - Failed to save &c" + plot.id);
|
MainUtil.sendMessage(null, "&7 - Failed to save &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(null, "&7 - &aExport success: " + plot.id);
|
MainUtil.sendMessage(null, "&7 - &a success: " + plot.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Schematic.this.counter++;
|
SchematicCmd.this.counter++;
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "export":
|
case "export":
|
||||||
case "save":
|
case "save": {
|
||||||
{
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
|
if (!Permissions.hasPermission(plr, "plots.schematic.save")) {
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.schematic.save");
|
||||||
return false;
|
return false;
|
||||||
@ -249,7 +258,7 @@ public class Schematic extends SubCommand {
|
|||||||
final String world;
|
final String world;
|
||||||
final Plot p2;
|
final Plot p2;
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -286,14 +295,14 @@ public class Schematic extends SubCommand {
|
|||||||
this.task = TaskManager.runTaskRepeat(new Runnable() {
|
this.task = TaskManager.runTaskRepeat(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Schematic.this.counter >= Schematic.this.plots.length) {
|
if (SchematicCmd.this.counter >= SchematicCmd.this.plots.length) {
|
||||||
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
|
PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
|
||||||
Schematic.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
PlotSquared.TASK.cancelTask(Schematic.this.task);
|
PlotSquared.TASK.cancelTask(SchematicCmd.this.task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Plot plot = Schematic.this.plots[Schematic.this.counter];
|
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||||
final CompoundTag sch = SchematicHandler.getCompoundTag(world, plot.id);
|
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(world, plot.id);
|
||||||
final String o = UUIDHandler.getName(plot.owner);
|
final String o = UUIDHandler.getName(plot.owner);
|
||||||
final String owner = o == null ? "unknown" : o;
|
final String owner = o == null ? "unknown" : o;
|
||||||
if (sch == null) {
|
if (sch == null) {
|
||||||
@ -303,7 +312,7 @@ public class Schematic extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(plr, "&6ID: " + plot.id);
|
MainUtil.sendMessage(plr, "&6ID: " + plot.id);
|
||||||
final boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
|
final boolean result = SchematicHandler.manager.save(sch, Settings.SCHEMATIC_SAVE_PATH + "/" + plot.id.x + ";" + plot.id.y + "," + world + "," + owner.trim() + ".schematic");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
MainUtil.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
|
MainUtil.sendMessage(plr, "&7 - Failed to save &c" + plot.id);
|
||||||
} else {
|
} else {
|
||||||
@ -312,7 +321,7 @@ public class Schematic extends SubCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Schematic.this.counter++;
|
SchematicCmd.this.counter++;
|
||||||
}
|
}
|
||||||
}, 60);
|
}, 60);
|
||||||
break;
|
break;
|
@ -21,6 +21,7 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@ -49,17 +50,17 @@ import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public class Set extends SubCommand {
|
public class Set extends SubCommand {
|
||||||
public final static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "flag" };
|
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
||||||
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
||||||
|
|
||||||
public Set() {
|
public Set() {
|
||||||
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
|
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -73,7 +74,10 @@ public class Set extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
PlotManager manager = PlotSquared.getPlotManager(loc.getWorld());
|
||||||
|
List<String> newValues = Arrays.asList(values);;
|
||||||
|
newValues.addAll(Arrays.asList(manager.getPlotComponents(PlotSquared.getPlotWorld(loc.getWorld()), plot.id)));
|
||||||
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < aliases.length; i++) {
|
for (int i = 0; i < aliases.length; i++) {
|
||||||
@ -90,7 +94,7 @@ public class Set extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("flag")) {
|
if (args[0].equalsIgnoreCase("flag")) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
|
final String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
|
||||||
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -219,22 +223,23 @@ public class Set extends SubCommand {
|
|||||||
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
||||||
for (final String component : components) {
|
for (final String component : components) {
|
||||||
if (component.equalsIgnoreCase(args[0])) {
|
if (component.equalsIgnoreCase(args[0])) {
|
||||||
if (args.length < 2) {
|
|
||||||
MainUtil.sendMessage(plr, C.NEED_BLOCK);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
PlotBlock[] blocks;
|
PlotBlock[] blocks;
|
||||||
try {
|
try {
|
||||||
blocks = (PlotBlock[]) Configuration.BLOCKLIST.parseObject(args[2]);
|
blocks = (PlotBlock[]) Configuration.BLOCKLIST.parseString(args[1]);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
try {
|
try {
|
||||||
blocks = new PlotBlock[] { new PlotBlock((short) BlockManager.manager.getBlockIdFromString(args[2]), (byte) 0) };
|
if (args.length < 2) {
|
||||||
|
MainUtil.sendMessage(plr, C.NEED_BLOCK);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
blocks = new PlotBlock[] { new PlotBlock((short) BlockManager.manager.getBlockIdFromString(args[1]), (byte) 0) };
|
||||||
} catch (final Exception e2) {
|
} catch (final Exception e2) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manager.setComponent(plotworld, plot.id, component, blocks);
|
manager.setComponent(plotworld, plot.id, component, blocks);
|
||||||
|
MainUtil.update(loc);
|
||||||
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -257,22 +262,24 @@ public class Set extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
List<String> newValues = Arrays.asList(values);;
|
||||||
|
newValues.addAll(Arrays.asList(manager.getPlotComponents(plotworld, plot.id)));
|
||||||
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getString(final String s) {
|
private String getString(final String s) {
|
||||||
return MainUtil.colorise('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
return MainUtil.colorise('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getArgumentList(final String[] strings) {
|
private String getArgumentList(final List<String> newValues) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
for (final String s : strings) {
|
for (final String s : newValues) {
|
||||||
builder.append(getString(s));
|
builder.append(getString(s));
|
||||||
}
|
}
|
||||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getBiomeList(final String[] biomes) {
|
private String getBiomeList(final String[] biomes) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
builder.append(MainUtil.colorise('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
builder.append(MainUtil.colorise('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
||||||
|
@ -38,7 +38,7 @@ public class SetOwner extends SubCommand {
|
|||||||
public SetOwner() {
|
public SetOwner() {
|
||||||
super("setowner", "plots.set.owner", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true);
|
super("setowner", "plots.set.owner", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* private UUID getUUID(String string) { OfflinePlayer player =
|
* private UUID getUUID(String string) { OfflinePlayer player =
|
||||||
* Bukkit.getOfflinePlayer(string); return ((player != null) &&
|
* Bukkit.getOfflinePlayer(string); return ((player != null) &&
|
||||||
@ -47,10 +47,10 @@ public class SetOwner extends SubCommand {
|
|||||||
private UUID getUUID(final String string) {
|
private UUID getUUID(final String string) {
|
||||||
return UUIDHandler.getUUID(string);
|
return UUIDHandler.getUUID(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if ((plot == null) || (plot.owner == null)) {
|
if ((plot == null) || (plot.owner == null)) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -66,7 +66,7 @@ public class SetOwner extends SubCommand {
|
|||||||
}
|
}
|
||||||
final String world = loc.getWorld();
|
final String world = loc.getWorld();
|
||||||
final PlotId bot = MainUtil.getBottomPlot(plot).id;
|
final PlotId bot = MainUtil.getBottomPlot(plot).id;
|
||||||
final PlotId top = MainUtil.getTopPlot( plot).id;
|
final PlotId top = MainUtil.getTopPlot(plot).id;
|
||||||
final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top);
|
final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top);
|
||||||
for (final PlotId id : plots) {
|
for (final PlotId id : plots) {
|
||||||
final Plot current = PlotSquared.getPlots(world).get(id);
|
final Plot current = PlotSquared.getPlots(world).get(id);
|
||||||
|
@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
@ -37,7 +38,7 @@ public class Setup extends SubCommand {
|
|||||||
public Setup() {
|
public Setup() {
|
||||||
super("setup", "plots.admin.command.setup", "Plotworld setup command", "setup", "create", CommandCategory.ACTIONS, true);
|
super("setup", "plots.admin.command.setup", "Plotworld setup command", "setup", "create", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
// going through setup
|
// going through setup
|
||||||
@ -179,5 +180,4 @@ public class Setup extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public abstract class SubCommand {
|
|||||||
* Is this a player-online command?
|
* Is this a player-online command?
|
||||||
*/
|
*/
|
||||||
public final boolean isPlayer;
|
public final boolean isPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cmd Command /plot {cmd} <-- That!
|
* @param cmd Command /plot {cmd} <-- That!
|
||||||
* @param permission Permission Node
|
* @param permission Permission Node
|
||||||
@ -81,7 +81,7 @@ public abstract class SubCommand {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
this.isPlayer = isPlayer;
|
this.isPlayer = isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cmd Command /plot {cmd} <-- That!
|
* @param cmd Command /plot {cmd} <-- That!
|
||||||
* @param permission Permission Node
|
* @param permission Permission Node
|
||||||
@ -100,7 +100,7 @@ public abstract class SubCommand {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
this.isPlayer = isPlayer;
|
this.isPlayer = isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param command Command /plot {cmd} <-- That!
|
* @param command Command /plot {cmd} <-- That!
|
||||||
* @param description Simple description
|
* @param description Simple description
|
||||||
@ -117,7 +117,7 @@ public abstract class SubCommand {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
this.isPlayer = isPlayer;
|
this.isPlayer = isPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute.
|
* Execute.
|
||||||
*
|
*
|
||||||
@ -127,7 +127,7 @@ public abstract class SubCommand {
|
|||||||
* @return true on success, false on failure
|
* @return true on success, false on failure
|
||||||
*/
|
*/
|
||||||
public abstract boolean execute(final PlotPlayer plr, final String... args);
|
public abstract boolean execute(final PlotPlayer plr, final String... args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the command as console
|
* Execute the command as console
|
||||||
*
|
*
|
||||||
@ -136,7 +136,7 @@ public abstract class SubCommand {
|
|||||||
public void executeConsole(final String... args) {
|
public void executeConsole(final String... args) {
|
||||||
this.execute(null, args);
|
this.execute(null, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message
|
* Send a message
|
||||||
*
|
*
|
||||||
@ -151,7 +151,7 @@ public abstract class SubCommand {
|
|||||||
MainUtil.sendMessage(plr, c, args);
|
MainUtil.sendMessage(plr, c, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CommandCategory
|
* CommandCategory
|
||||||
*
|
*
|
||||||
@ -193,7 +193,7 @@ public abstract class SubCommand {
|
|||||||
* The category name (Readable)
|
* The category name (Readable)
|
||||||
*/
|
*/
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -202,7 +202,7 @@ public abstract class SubCommand {
|
|||||||
CommandCategory(final String name) {
|
CommandCategory(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -41,7 +41,7 @@ public class Swap extends SubCommand {
|
|||||||
public Swap() {
|
public Swap() {
|
||||||
super(Command.SWAP, "Swap two plots", "switch", CommandCategory.ACTIONS, true);
|
super(Command.SWAP, "Swap two plots", "switch", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -49,7 +49,7 @@ public class Swap extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -83,7 +83,7 @@ public class Swap extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AChunkManager.manager.swap(world, plot.id, plotid);
|
ChunkManager.manager.swap(world, plot.id, plotid);
|
||||||
// FIXME Requires testing!!
|
// FIXME Requires testing!!
|
||||||
DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid));
|
DBFunc.dbManager.swapPlots(plot, MainUtil.getPlot(world, plotid));
|
||||||
MainUtil.sendMessage(plr, C.SWAP_SUCCESS);
|
MainUtil.sendMessage(plr, C.SWAP_SUCCESS);
|
||||||
|
@ -39,7 +39,7 @@ public class TP extends SubCommand {
|
|||||||
public TP() {
|
public TP() {
|
||||||
super(Command.TP, "Teleport to a plot", "tp {alias|id}", CommandCategory.TELEPORT, true);
|
super(Command.TP, "Teleport to a plot", "tp {alias|id}", CommandCategory.TELEPORT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -48,8 +48,8 @@ public class TP extends SubCommand {
|
|||||||
}
|
}
|
||||||
final String id = args[0];
|
final String id = args[0];
|
||||||
PlotId plotid;
|
PlotId plotid;
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
String pworld = loc.getWorld();
|
final String pworld = loc.getWorld();
|
||||||
String world = pworld;
|
String world = pworld;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (BlockManager.manager.isWorld(args[1])) {
|
if (BlockManager.manager.isWorld(args[1])) {
|
||||||
@ -74,7 +74,7 @@ public class TP extends SubCommand {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plot isAlias(final String world, String a) {
|
private Plot isAlias(final String world, String a) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (a.contains(";")) {
|
if (a.contains(";")) {
|
||||||
|
@ -31,10 +31,10 @@ public class Target extends SubCommand {
|
|||||||
public Target() {
|
public Target() {
|
||||||
super(Command.TARGET, "Target a plot with your compass", "target <X;Z>", CommandCategory.ACTIONS, true);
|
super(Command.TARGET, "Target a plot with your compass", "target <X;Z>", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location ploc = plr.getLocation();
|
final Location ploc = plr.getLocation();
|
||||||
if (!PlotSquared.isPlotWorld(ploc.getWorld())) {
|
if (!PlotSquared.isPlotWorld(ploc.getWorld())) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,64 +20,169 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.Set;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
|
import com.intellectualcrafters.plot.object.FileBytes;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.object.SetupObject;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
public class Template extends SubCommand {
|
public class Template extends SubCommand {
|
||||||
public Template() {
|
public Template() {
|
||||||
super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, true);
|
super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length != 2) {
|
if (args.length != 2 && args.length != 3) {
|
||||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world> [template]");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
String world = args[1];
|
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
|
||||||
if (!BlockManager.manager.isWorld(world) || (plotworld == null)) {
|
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
final String world = args[1];
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "import": {
|
case "import": {
|
||||||
// TODO import template
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(plr, "TODO");
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import <world> <template>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (PlotSquared.isPlotWorld(world)) {
|
||||||
|
MainUtil.sendMessage(plr, C.SETUP_WORLD_TAKEN, world);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean result = extractAllFiles(world, args[2]);
|
||||||
|
if (!result) {
|
||||||
|
MainUtil.sendMessage(plr, "&cInvalid template file: " + args[2] +".template");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
File worldFile = new File(PlotSquared.IMP.getDirectory() + File.separator + "templates" + File.separator + "tmp-data.yml");
|
||||||
|
YamlConfiguration worldConfig = YamlConfiguration.loadConfiguration(worldFile);
|
||||||
|
PlotSquared.config.set("worlds." + world, worldConfig.get(""));
|
||||||
|
try {
|
||||||
|
PlotSquared.config.save(PlotSquared.configFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String generator = worldConfig.getString("generator.plugin");
|
||||||
|
if (generator == null) {
|
||||||
|
generator = "PlotSquared";
|
||||||
|
}
|
||||||
|
int type = worldConfig.getInt("generator.type");
|
||||||
|
int terrain = worldConfig.getInt("generator.terrain");
|
||||||
|
SetupObject setup = new SetupObject();
|
||||||
|
setup.generator = generator;
|
||||||
|
setup.type = type;
|
||||||
|
setup.terrain = terrain;
|
||||||
|
setup.step = new ConfigurationNode[0];
|
||||||
|
setup.world = world;
|
||||||
|
SetupUtils.manager.setupWorld(setup);
|
||||||
|
MainUtil.sendMessage(plr, "Done!");
|
||||||
|
if (plr != null) {
|
||||||
|
plr.teleport(BlockManager.manager.getSpawn(world));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "export": {
|
case "export": {
|
||||||
MainUtil.sendMessage(plr, "TODO");
|
if (args.length != 2) {
|
||||||
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template export <world>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
|
if (!BlockManager.manager.isWorld(world) || (plotworld == null)) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||||
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
manager.exportTemplate(plotworld);
|
||||||
|
MainUtil.sendMessage(plr, "Done!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO allow world settings (including schematics to be packed into a single file)
|
|
||||||
// TODO allow world created based on these packaged files
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gzipIt(final String output, final String input) {
|
public static boolean extractAllFiles(String world, String template) {
|
||||||
final byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[2048];
|
||||||
try {
|
try {
|
||||||
final GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream(output));
|
File folder = new File(PlotSquared.IMP.getDirectory() + File.separator + "templates");
|
||||||
final FileInputStream in = new FileInputStream(input);
|
if (!folder.exists()) {
|
||||||
int len;
|
return false;
|
||||||
while ((len = in.read(buffer)) > 0) {
|
|
||||||
gzos.write(buffer, 0, len);
|
|
||||||
}
|
}
|
||||||
in.close();
|
File input = new File(folder + File.separator + template +".template");
|
||||||
gzos.finish();
|
File output = PlotSquared.IMP.getDirectory();
|
||||||
gzos.close();
|
if (!output.exists()) {
|
||||||
|
output.mkdirs();
|
||||||
|
}
|
||||||
|
ZipInputStream zis = new ZipInputStream(new FileInputStream(input));
|
||||||
|
ZipEntry ze = zis.getNextEntry();
|
||||||
|
while (ze != null) {
|
||||||
|
String name = ze.getName();
|
||||||
|
File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world));
|
||||||
|
new File(newFile.getParent()).mkdirs();
|
||||||
|
FileOutputStream fos = new FileOutputStream(newFile);
|
||||||
|
int len;
|
||||||
|
while ((len = zis.read(buffer)) > 0) {
|
||||||
|
fos.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
fos.close();
|
||||||
|
ze = zis.getNextEntry();
|
||||||
|
}
|
||||||
|
zis.closeEntry();
|
||||||
|
zis.close();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getBytes(PlotWorld plotworld) {
|
||||||
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("");
|
||||||
|
plotworld.saveConfiguration(section);
|
||||||
|
return config.saveToString().getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean zipAll(final String world, Set<FileBytes> files) {
|
||||||
|
try {
|
||||||
|
File output = new File(PlotSquared.IMP.getDirectory() + File.separator + "templates");
|
||||||
|
output.mkdirs();
|
||||||
|
FileOutputStream fos = new FileOutputStream(output + File.separator + world + ".template");
|
||||||
|
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||||
|
|
||||||
|
for (FileBytes file : files) {
|
||||||
|
ZipEntry ze = new ZipEntry(file.path);
|
||||||
|
zos.putNextEntry(ze);
|
||||||
|
zos.write(file.data);
|
||||||
|
}
|
||||||
|
zos.closeEntry();
|
||||||
|
zos.close();
|
||||||
|
return true;
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,20 +35,19 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.ChunkManager;
|
|
||||||
|
|
||||||
public class Trim extends SubCommand {
|
public class Trim extends SubCommand {
|
||||||
public static boolean TASK = false;
|
public static boolean TASK = false;
|
||||||
private static int TASK_ID = 0;
|
private static int TASK_ID = 0;
|
||||||
|
|
||||||
public Trim() {
|
public Trim() {
|
||||||
super("trim", "plots.admin", "Delete unmodified portions of your plotworld", "trim", "", CommandCategory.DEBUG, false);
|
super("trim", "plots.admin", "Delete unmodified portions of your plotworld", "trim", "", CommandCategory.DEBUG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotId getId(final String id) {
|
public PlotId getId(final String id) {
|
||||||
try {
|
try {
|
||||||
final String[] split = id.split(";");
|
final String[] split = id.split(";");
|
||||||
@ -57,7 +56,7 @@ public class Trim extends SubCommand {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr != null) {
|
if (plr != null) {
|
||||||
@ -106,7 +105,7 @@ public class Trim extends SubCommand {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getBulkRegions(final ArrayList<ChunkLoc> empty, final String world, final Runnable whenDone) {
|
public static boolean getBulkRegions(final ArrayList<ChunkLoc> empty, final String world, final Runnable whenDone) {
|
||||||
if (Trim.TASK) {
|
if (Trim.TASK) {
|
||||||
return false;
|
return false;
|
||||||
@ -128,7 +127,7 @@ public class Trim extends SubCommand {
|
|||||||
final ChunkLoc loc = new ChunkLoc(x, z);
|
final ChunkLoc loc = new ChunkLoc(x, z);
|
||||||
empty.add(loc);
|
empty.add(loc);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
System.out.print("INVALID MCA: " + name);
|
PlotSquared.log("INVALID MCA: " + name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final Path path = Paths.get(file.getPath());
|
final Path path = Paths.get(file.getPath());
|
||||||
@ -145,7 +144,7 @@ public class Trim extends SubCommand {
|
|||||||
final ChunkLoc loc = new ChunkLoc(x, z);
|
final ChunkLoc loc = new ChunkLoc(x, z);
|
||||||
empty.add(loc);
|
empty.add(loc);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
System.out.print("INVALID MCA: " + name);
|
PlotSquared.log("INVALID MCA: " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -160,16 +159,16 @@ public class Trim extends SubCommand {
|
|||||||
Trim.TASK = true;
|
Trim.TASK = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getTrimRegions(final ArrayList<ChunkLoc> empty, final String world, final Runnable whenDone) {
|
public static boolean getTrimRegions(final ArrayList<ChunkLoc> empty, final String world, final Runnable whenDone) {
|
||||||
if (Trim.TASK) {
|
if (Trim.TASK) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final long startOld = System.currentTimeMillis();
|
System.currentTimeMillis();
|
||||||
sendMessage("Collecting region data...");
|
sendMessage("Collecting region data...");
|
||||||
final ArrayList<Plot> plots = new ArrayList<>();
|
final ArrayList<Plot> plots = new ArrayList<>();
|
||||||
plots.addAll(PlotSquared.getPlots(world).values());
|
plots.addAll(PlotSquared.getPlots(world).values());
|
||||||
final HashSet<ChunkLoc> chunks = new HashSet<>(AChunkManager.manager.getChunkChunks(world));
|
final HashSet<ChunkLoc> chunks = new HashSet<>(ChunkManager.manager.getChunkChunks(world));
|
||||||
sendMessage(" - MCA #: " + chunks.size());
|
sendMessage(" - MCA #: " + chunks.size());
|
||||||
sendMessage(" - CHUNKS: " + (chunks.size() * 1024) + " (max)");
|
sendMessage(" - CHUNKS: " + (chunks.size() * 1024) + " (max)");
|
||||||
sendMessage(" - TIME ESTIMATE: " + (chunks.size() / 1200) + " minutes");
|
sendMessage(" - TIME ESTIMATE: " + (chunks.size() / 1200) + " minutes");
|
||||||
@ -180,7 +179,6 @@ public class Trim extends SubCommand {
|
|||||||
while ((System.currentTimeMillis() - start) < 50) {
|
while ((System.currentTimeMillis() - start) < 50) {
|
||||||
if (plots.size() == 0) {
|
if (plots.size() == 0) {
|
||||||
empty.addAll(chunks);
|
empty.addAll(chunks);
|
||||||
System.out.print("DONE!");
|
|
||||||
Trim.TASK = false;
|
Trim.TASK = false;
|
||||||
TaskManager.runTaskAsync(whenDone);
|
TaskManager.runTaskAsync(whenDone);
|
||||||
PlotSquared.TASK.cancelTask(Trim.TASK_ID);
|
PlotSquared.TASK.cancelTask(Trim.TASK_ID);
|
||||||
@ -202,15 +200,15 @@ public class Trim extends SubCommand {
|
|||||||
Trim.TASK = true;
|
Trim.TASK = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Plot> expired = null;
|
public static ArrayList<Plot> expired = null;
|
||||||
|
|
||||||
public static void deleteChunks(final String world, final ArrayList<ChunkLoc> chunks) {
|
public static void deleteChunks(final String world, final ArrayList<ChunkLoc> chunks) {
|
||||||
for (final ChunkLoc loc : chunks) {
|
for (final ChunkLoc loc : chunks) {
|
||||||
AChunkManager.manager.deleteRegionFile(world, loc);
|
ChunkManager.manager.deleteRegionFile(world, loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(final String message) {
|
public static void sendMessage(final String message) {
|
||||||
PlotSquared.log("&3PlotSquared -> World trim&8: &7" + message);
|
PlotSquared.log("&3PlotSquared -> World trim&8: &7" + message);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -36,14 +37,14 @@ public class Trusted extends SubCommand {
|
|||||||
public Trusted() {
|
public Trusted() {
|
||||||
super(Command.TRUSTED, "Manage trusted users for a plot", "trusted {add|remove} {player}", CommandCategory.ACTIONS, true);
|
super(Command.TRUSTED, "Manage trusted users for a plot", "trusted {add|remove} {player}", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -82,7 +83,7 @@ public class Trusted extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.addTrusted(uuid);
|
plot.addTrusted(uuid);
|
||||||
DBFunc.setTrusted(loc.getWorld(), plot, uuid);
|
DBFunc.setTrusted(loc.getWorld(), plot, uuid);
|
||||||
// FIXME PlayerPlotTrustedEvent
|
EventUtil.manager.callTrusted(plr, plot, uuid, true);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
MainUtil.sendMessage(plr, C.ALREADY_ADDED);
|
||||||
return false;
|
return false;
|
||||||
@ -104,7 +105,7 @@ public class Trusted extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeTrusted(uuid);
|
plot.removeTrusted(uuid);
|
||||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||||
// FIXME PlayerPlotTrustedEvent
|
EventUtil.manager.callTrusted(plr, plot, uuid, false);
|
||||||
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
|
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
@ -38,10 +36,10 @@ public class Unclaim extends SubCommand {
|
|||||||
public Unclaim() {
|
public Unclaim() {
|
||||||
super(Command.UNCLAIM, "Unclaim a plot", "unclaim", CommandCategory.ACTIONS, true);
|
super(Command.UNCLAIM, "Unclaim a plot", "unclaim", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -54,10 +52,9 @@ public class Unclaim extends SubCommand {
|
|||||||
}
|
}
|
||||||
assert plot != null;
|
assert plot != null;
|
||||||
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
|
final PlotWorld pWorld = PlotSquared.getPlotWorld(plot.world);
|
||||||
if (PlotSquared.economy != null && pWorld.USE_ECONOMY) {
|
if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY) {
|
||||||
final double c = pWorld.SELL_PRICE;
|
final double c = pWorld.SELL_PRICE;
|
||||||
if (c > 0d) {
|
if (c > 0d) {
|
||||||
final Economy economy = PlotSquared.economy;
|
|
||||||
EconHandler.depositPlayer(plr, c);
|
EconHandler.depositPlayer(plr, c);
|
||||||
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
@ -44,10 +45,10 @@ public class Unlink extends SubCommand {
|
|||||||
public Unlink() {
|
public Unlink() {
|
||||||
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS, true);
|
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
Location loc = plr.getLocation();
|
final Location loc = plr.getLocation();
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
@ -66,13 +67,16 @@ public class Unlink extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "&6Plots unlinked successfully!");
|
MainUtil.sendMessage(plr, "&6Plots unlinked successfully!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean unlinkPlot(final Plot plot) {
|
public static boolean unlinkPlot(final Plot plot) {
|
||||||
String world = plot.world;
|
final String world = plot.world;
|
||||||
final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
|
final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
|
||||||
final PlotId pos2 = MainUtil.getTopPlot(plot).id;
|
final PlotId pos2 = MainUtil.getTopPlot(plot).id;
|
||||||
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);
|
final ArrayList<PlotId> ids = MainUtil.getPlotSelectionIds(pos1, pos2);
|
||||||
// FIXME PlotUnlinkEvent (cancellable)
|
final boolean result = EventUtil.manager.callUnlink(world, ids);
|
||||||
|
if (!result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||||
manager.startPlotUnlink(plotworld, ids);
|
manager.startPlotUnlink(plotworld, ids);
|
||||||
|
@ -35,7 +35,7 @@ public class Visit extends SubCommand {
|
|||||||
public Visit() {
|
public Visit() {
|
||||||
super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT, true);
|
super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Plot> getPlots(final UUID uuid) {
|
public List<Plot> getPlots(final UUID uuid) {
|
||||||
final List<Plot> plots = new ArrayList<>();
|
final List<Plot> plots = new ArrayList<>();
|
||||||
for (final Plot p : PlotSquared.getPlots()) {
|
for (final Plot p : PlotSquared.getPlots()) {
|
||||||
@ -45,7 +45,7 @@ public class Visit extends SubCommand {
|
|||||||
}
|
}
|
||||||
return plots;
|
return plots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
|
@ -30,7 +30,7 @@ public class WE_Anywhere extends SubCommand {
|
|||||||
public WE_Anywhere() {
|
public WE_Anywhere() {
|
||||||
super("weanywhere", "plots.weanywhere", "Force bypass of WorldEdit", "weanywhere", "wea", CommandCategory.DEBUG, true);
|
super("weanywhere", "plots.weanywhere", "Force bypass of WorldEdit", "weanywhere", "wea", CommandCategory.DEBUG, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (PlotSquared.worldEdit == null) {
|
if (PlotSquared.worldEdit == null) {
|
||||||
|
@ -41,7 +41,7 @@ public class list extends SubCommand {
|
|||||||
public list() {
|
public list() {
|
||||||
super(Command.LIST, "List all plots", "list {mine|shared|all|world|forsale}", CommandCategory.INFO, false);
|
super(Command.LIST, "List all plots", "list {mine|shared|all|world|forsale}", CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getName(final UUID id) {
|
private static String getName(final UUID id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return "none";
|
return "none";
|
||||||
@ -52,7 +52,7 @@ public class list extends SubCommand {
|
|||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
@ -168,7 +168,7 @@ public class list extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getArgumentList(final String[] strings) {
|
private String getArgumentList(final String[] strings) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
for (final String s : strings) {
|
for (final String s : strings) {
|
||||||
|
@ -33,11 +33,11 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
|||||||
|
|
||||||
public class plugin extends SubCommand {
|
public class plugin extends SubCommand {
|
||||||
public static String downloads, version;
|
public static String downloads, version;
|
||||||
|
|
||||||
public plugin() {
|
public plugin() {
|
||||||
super("plugin", "plots.use", "Show plugin information", "plugin", "version", CommandCategory.INFO, false);
|
super("plugin", "plots.use", "Show plugin information", "plugin", "version", CommandCategory.INFO, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +61,7 @@ public class plugin extends SubCommand {
|
|||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertToNumericString(final String str, final boolean dividers) {
|
private static String convertToNumericString(final String str, final boolean dividers) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
for (final char c : str.toCharArray()) {
|
for (final char c : str.toCharArray()) {
|
||||||
@ -73,7 +73,7 @@ public class plugin extends SubCommand {
|
|||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getInfo(final String link) throws Exception {
|
private static String getInfo(final String link) throws Exception {
|
||||||
final URLConnection connection = new URL(link).openConnection();
|
final URLConnection connection = new URL(link).openConnection();
|
||||||
connection.addRequestProperty("User-Agent", "Mozilla/4.0");
|
connection.addRequestProperty("User-Agent", "Mozilla/4.0");
|
||||||
@ -85,7 +85,7 @@ public class plugin extends SubCommand {
|
|||||||
reader.close();
|
reader.close();
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
|
@ -444,7 +444,7 @@ public enum C {
|
|||||||
* @see com.intellectualsites.translation.TranslationLanguage
|
* @see com.intellectualsites.translation.TranslationLanguage
|
||||||
*/
|
*/
|
||||||
protected final static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
|
protected final static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
|
||||||
public static String COLOR_1 = "\u00A76", COLOR_2 = "\u00A77", COLOR_3 = "\u00A78", COLOR_4 = "\u00A73";
|
public static String COLOR_1 = "&6", COLOR_2 = "&7", COLOR_3 = "&8", COLOR_4 = "&3";
|
||||||
/**
|
/**
|
||||||
* The TranslationManager
|
* The TranslationManager
|
||||||
*
|
*
|
||||||
@ -469,7 +469,7 @@ public enum C {
|
|||||||
* Should the string be prefixed?
|
* Should the string be prefixed?
|
||||||
*/
|
*/
|
||||||
private boolean prefix;
|
private boolean prefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for custom strings.
|
* Constructor for custom strings.
|
||||||
*/
|
*/
|
||||||
@ -478,7 +478,7 @@ public enum C {
|
|||||||
* use setCustomString();
|
* use setCustomString();
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -492,7 +492,7 @@ public enum C {
|
|||||||
}
|
}
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -501,7 +501,7 @@ public enum C {
|
|||||||
C(final String d) {
|
C(final String d) {
|
||||||
this(d, true);
|
this(d, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupTranslations() {
|
public static void setupTranslations() {
|
||||||
manager = new TranslationManager();
|
manager = new TranslationManager();
|
||||||
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(), lang, "PlotSquared", manager).read();
|
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(), lang, "PlotSquared", manager).read();
|
||||||
@ -510,7 +510,7 @@ public enum C {
|
|||||||
manager.addTranslationObject(new TranslationObject(c.toString(), c.d, "", ""));
|
manager.addTranslationObject(new TranslationObject(c.toString(), c.d, "", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveTranslations() {
|
public static void saveTranslations() {
|
||||||
try {
|
try {
|
||||||
manager.saveAll(defaultFile).saveFile(defaultFile);
|
manager.saveAll(defaultFile).saveFile(defaultFile);
|
||||||
@ -518,7 +518,7 @@ public enum C {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default string
|
* Get the default string
|
||||||
*
|
*
|
||||||
@ -527,7 +527,7 @@ public enum C {
|
|||||||
public String d() {
|
public String d() {
|
||||||
return this.d;
|
return this.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get translated if exists
|
* Get translated if exists
|
||||||
*
|
*
|
||||||
@ -549,11 +549,11 @@ public enum C {
|
|||||||
* return this.s.replace("\\n", "\n");
|
* return this.s.replace("\\n", "\n");
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean usePrefix() {
|
public boolean usePrefix() {
|
||||||
return this.prefix;
|
return this.prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return translated and color decoded
|
* @return translated and color decoded
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@ public class Configuration {
|
|||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
return string;
|
return string;
|
||||||
@ -48,7 +48,7 @@ public class Configuration {
|
|||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
return string.split(",");
|
return string.split(",");
|
||||||
@ -64,7 +64,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
return Integer.parseInt(string);
|
return Integer.parseInt(string);
|
||||||
@ -80,7 +80,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
return Boolean.parseBoolean(string);
|
return Boolean.parseBoolean(string);
|
||||||
@ -96,7 +96,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
return Double.parseDouble(string);
|
return Double.parseDouble(string);
|
||||||
@ -106,7 +106,7 @@ public class Configuration {
|
|||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
try {
|
try {
|
||||||
int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
|
final int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
|
||||||
if (biome == -1) {
|
if (biome == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
if (validateValue(string)) {
|
if (validateValue(string)) {
|
||||||
@ -123,7 +123,7 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
return "FOREST";
|
return "FOREST";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
return object.toString();
|
return object.toString();
|
||||||
@ -145,7 +145,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
if (string.contains(":")) {
|
if (string.contains(":")) {
|
||||||
@ -155,7 +155,7 @@ public class Configuration {
|
|||||||
return new PlotBlock(Short.parseShort(string), (byte) 0);
|
return new PlotBlock(Short.parseShort(string), (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
return object;
|
return object;
|
||||||
@ -184,7 +184,7 @@ public class Configuration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseString(final String string) {
|
public Object parseString(final String string) {
|
||||||
final String[] blocks = string.split(",");
|
final String[] blocks = string.split(",");
|
||||||
@ -223,20 +223,20 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
return parsedvalues.toArray(new PlotBlock[parsedvalues.size()]);
|
return parsedvalues.toArray(new PlotBlock[parsedvalues.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static int gcd(final int a, final int b) {
|
public static int gcd(final int a, final int b) {
|
||||||
if (b == 0) {
|
if (b == 0) {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
return gcd(b, a % b);
|
return gcd(b, a % b);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int gcd(final int[] a) {
|
private static int gcd(final int[] a) {
|
||||||
int result = a[0];
|
int result = a[0];
|
||||||
for (int i = 1; i < a.length; i++) {
|
for (int i = 1; i < a.length; i++) {
|
||||||
@ -244,27 +244,27 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create your own SettingValue object to make the management of plotworld configuration easier
|
* Create your own SettingValue object to make the management of plotworld configuration easier
|
||||||
*/
|
*/
|
||||||
public static abstract class SettingValue {
|
public static abstract class SettingValue {
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
public SettingValue(final String type) {
|
public SettingValue(final String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object parseObject(final Object object) {
|
public Object parseObject(final Object object) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Object parseString(final String string);
|
public abstract Object parseString(final String string);
|
||||||
|
|
||||||
public abstract boolean validateValue(final String string);
|
public abstract boolean validateValue(final String string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class ConfigurationNode {
|
|||||||
private final String description;
|
private final String description;
|
||||||
private final SettingValue type;
|
private final SettingValue type;
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
public ConfigurationNode(final String constant, final Object default_value, final String description, final SettingValue type, final boolean required) {
|
public ConfigurationNode(final String constant, final Object default_value, final String description, final SettingValue type, final boolean required) {
|
||||||
this.constant = constant;
|
this.constant = constant;
|
||||||
this.default_value = default_value;
|
this.default_value = default_value;
|
||||||
@ -48,11 +48,11 @@ public class ConfigurationNode {
|
|||||||
this.value = default_value;
|
this.value = default_value;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingValue getType() {
|
public SettingValue getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid(final String string) {
|
public boolean isValid(final String string) {
|
||||||
try {
|
try {
|
||||||
final Object result = this.type.parseString(string);
|
final Object result = this.type.parseString(string);
|
||||||
@ -61,7 +61,7 @@ public class ConfigurationNode {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setValue(final String string) {
|
public boolean setValue(final String string) {
|
||||||
if (!this.type.validateValue(string)) {
|
if (!this.type.validateValue(string)) {
|
||||||
return false;
|
return false;
|
||||||
@ -69,7 +69,7 @@ public class ConfigurationNode {
|
|||||||
this.value = this.type.parseString(string);
|
this.value = this.type.parseString(string);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
if (this.value instanceof String[]) {
|
if (this.value instanceof String[]) {
|
||||||
return Arrays.asList((String[]) this.value);
|
return Arrays.asList((String[]) this.value);
|
||||||
@ -84,18 +84,18 @@ public class ConfigurationNode {
|
|||||||
}
|
}
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConstant() {
|
public String getConstant() {
|
||||||
return this.constant;
|
return this.constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDefaultValue() {
|
public Object getDefaultValue() {
|
||||||
if (this.default_value instanceof Object[]) {
|
if (this.default_value instanceof Object[]) {
|
||||||
return StringUtils.join((Object[]) this.default_value, ",");
|
return StringUtils.join((Object[]) this.default_value, ",");
|
||||||
}
|
}
|
||||||
return this.default_value;
|
return this.default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class Settings {
|
|||||||
* Use offline mode storage
|
* Use offline mode storage
|
||||||
*/
|
*/
|
||||||
public static boolean OFFLINE_MODE = false;
|
public static boolean OFFLINE_MODE = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database settings
|
* Database settings
|
||||||
*
|
*
|
||||||
@ -147,9 +147,9 @@ public class Settings {
|
|||||||
* MongoDB enabled?
|
* MongoDB enabled?
|
||||||
*/
|
*/
|
||||||
public static boolean USE_MONGO = false; /*
|
public static boolean USE_MONGO = false; /*
|
||||||
* TODO: Implement Mongo
|
* TODO: Implement Mongo
|
||||||
* @Brandon
|
* @Brandon
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* SQLite enabled?
|
* SQLite enabled?
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ public interface AbstractDB {
|
|||||||
* The UUID that will count as everyone
|
* The UUID that will count as everyone
|
||||||
*/
|
*/
|
||||||
public UUID everyone = UUID.fromString("1-1-3-3-7");
|
public UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Plot owner
|
* Set Plot owner
|
||||||
*
|
*
|
||||||
@ -53,28 +53,28 @@ public interface AbstractDB {
|
|||||||
* @param uuid The uuid of the new owner
|
* @param uuid The uuid of the new owner
|
||||||
*/
|
*/
|
||||||
public void setOwner(final Plot plot, final UUID uuid);
|
public void setOwner(final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create all settings, and create default helpers, trusted + denied lists
|
* Create all settings, and create default helpers, trusted + denied lists
|
||||||
*
|
*
|
||||||
* @param plots Plots for which the default table entries should be created
|
* @param plots Plots for which the default table entries should be created
|
||||||
*/
|
*/
|
||||||
public void createAllSettingsAndHelpers(final ArrayList<Plot> plots);
|
public void createAllSettingsAndHelpers(final ArrayList<Plot> plots);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
*
|
*
|
||||||
* @param plots Plots that should be created
|
* @param plots Plots that should be created
|
||||||
*/
|
*/
|
||||||
public void createPlots(final ArrayList<Plot> plots);
|
public void createPlots(final ArrayList<Plot> plots);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
*
|
*
|
||||||
* @param plot That should be created
|
* @param plot That should be created
|
||||||
*/
|
*/
|
||||||
public void createPlot(final Plot plot);
|
public void createPlot(final Plot plot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create tables
|
* Create tables
|
||||||
*
|
*
|
||||||
@ -83,16 +83,16 @@ public interface AbstractDB {
|
|||||||
* @throws SQLException If the database manager is unable to create the tables
|
* @throws SQLException If the database manager is unable to create the tables
|
||||||
*/
|
*/
|
||||||
public void createTables(final String database, final boolean add_constraint) throws Exception;
|
public void createTables(final String database, final boolean add_constraint) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a plot
|
* Delete a plot
|
||||||
*
|
*
|
||||||
* @param plot Plot that should be deleted
|
* @param plot Plot that should be deleted
|
||||||
*/
|
*/
|
||||||
public void delete(final String world, final Plot plot);
|
public void delete(final String world, final Plot plot);
|
||||||
|
|
||||||
public void delete(final PlotCluster cluster);
|
public void delete(final PlotCluster cluster);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create plot settings
|
* Create plot settings
|
||||||
*
|
*
|
||||||
@ -100,7 +100,7 @@ public interface AbstractDB {
|
|||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
*/
|
*/
|
||||||
public void createPlotSettings(final int id, final Plot plot);
|
public void createPlotSettings(final int id, final Plot plot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the table entry ID
|
* Get the table entry ID
|
||||||
*
|
*
|
||||||
@ -110,7 +110,7 @@ public interface AbstractDB {
|
|||||||
* @return Integer = Plot Entry Id
|
* @return Integer = Plot Entry Id
|
||||||
*/
|
*/
|
||||||
public int getId(final String world, final PlotId id2);
|
public int getId(final String world, final PlotId id2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of a given plot cluster
|
* Get the id of a given plot cluster
|
||||||
*
|
*
|
||||||
@ -121,17 +121,17 @@ public interface AbstractDB {
|
|||||||
* @return Integer = Cluster Entry Id
|
* @return Integer = Cluster Entry Id
|
||||||
*/
|
*/
|
||||||
public int getClusterId(final String world, final PlotClusterId id);
|
public int getClusterId(final String world, final PlotClusterId id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A linked hashmap containing all plots
|
* @return A linked hashmap containing all plots
|
||||||
*/
|
*/
|
||||||
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots();
|
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A hashmap containing all plot clusters
|
* @return A hashmap containing all plot clusters
|
||||||
*/
|
*/
|
||||||
public HashMap<String, HashSet<PlotCluster>> getClusters();
|
public HashMap<String, HashSet<PlotCluster>> getClusters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the merged status for a plot
|
* Set the merged status for a plot
|
||||||
*
|
*
|
||||||
@ -140,14 +140,14 @@ public interface AbstractDB {
|
|||||||
* @param merged boolean[]
|
* @param merged boolean[]
|
||||||
*/
|
*/
|
||||||
public void setMerged(final String world, final Plot plot, final boolean[] merged);
|
public void setMerged(final String world, final Plot plot, final boolean[] merged);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swap the settings, helpers etc. of two plots
|
* Swap the settings, helpers etc. of two plots
|
||||||
* @param p1 Plot1
|
* @param p1 Plot1
|
||||||
* @param p2 Plot2
|
* @param p2 Plot2
|
||||||
*/
|
*/
|
||||||
public void swapPlots(final Plot p1, final Plot p2);
|
public void swapPlots(final Plot p1, final Plot p2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set plot flags
|
* Set plot flags
|
||||||
*
|
*
|
||||||
@ -156,7 +156,7 @@ public interface AbstractDB {
|
|||||||
* @param flags flags to set (flag[])
|
* @param flags flags to set (flag[])
|
||||||
*/
|
*/
|
||||||
public void setFlags(final String world, final Plot plot, final Set<Flag> flags);
|
public void setFlags(final String world, final Plot plot, final Set<Flag> flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cluster flags
|
* Set cluster flags
|
||||||
*
|
*
|
||||||
@ -165,12 +165,12 @@ public interface AbstractDB {
|
|||||||
* @param flags flags to set (flag[])
|
* @param flags flags to set (flag[])
|
||||||
*/
|
*/
|
||||||
public void setFlags(final PlotCluster cluster, final Set<Flag> flags);
|
public void setFlags(final PlotCluster cluster, final Set<Flag> flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename a cluster
|
* Rename a cluster
|
||||||
*/
|
*/
|
||||||
public void setClusterName(final PlotCluster cluster, final String name);
|
public void setClusterName(final PlotCluster cluster, final String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the plot alias
|
* Set the plot alias
|
||||||
*
|
*
|
||||||
@ -178,7 +178,7 @@ public interface AbstractDB {
|
|||||||
* @param alias Plot Alias
|
* @param alias Plot Alias
|
||||||
*/
|
*/
|
||||||
public void setAlias(final String world, final Plot plot, final String alias);
|
public void setAlias(final String world, final Plot plot, final String alias);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purgle a plot
|
* Purgle a plot
|
||||||
*
|
*
|
||||||
@ -186,14 +186,14 @@ public interface AbstractDB {
|
|||||||
* @param id Plot ID
|
* @param id Plot ID
|
||||||
*/
|
*/
|
||||||
public void purgeIds(final String world, final Set<Integer> uniqueIds);
|
public void purgeIds(final String world, final Set<Integer> uniqueIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge a whole world
|
* Purge a whole world
|
||||||
*
|
*
|
||||||
* @param world World in which the plots should be purged
|
* @param world World in which the plots should be purged
|
||||||
*/
|
*/
|
||||||
public void purge(final String world, final Set<PlotId> plotIds);
|
public void purge(final String world, final Set<PlotId> plotIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Plot Home Position
|
* Set Plot Home Position
|
||||||
*
|
*
|
||||||
@ -201,71 +201,71 @@ public interface AbstractDB {
|
|||||||
* @param position Plot Home Position
|
* @param position Plot Home Position
|
||||||
*/
|
*/
|
||||||
public void setPosition(final String world, final Plot plot, final String position);
|
public void setPosition(final String world, final Plot plot, final String position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param cluster
|
* @param cluster
|
||||||
* @param position
|
* @param position
|
||||||
*/
|
*/
|
||||||
public void setPosition(final PlotCluster cluster, final String position);
|
public void setPosition(final PlotCluster cluster, final String position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id Plot Entry ID
|
* @param id Plot Entry ID
|
||||||
*
|
*
|
||||||
* @return Plot Settings
|
* @return Plot Settings
|
||||||
*/
|
*/
|
||||||
public HashMap<String, Object> getSettings(final int id);
|
public HashMap<String, Object> getSettings(final int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public HashMap<String, Object> getClusterSettings(final int id);
|
public HashMap<String, Object> getClusterSettings(final int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param uuid Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void removeHelper(final String world, final Plot plot, final UUID uuid);
|
public void removeHelper(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cluster PlotCluster Object
|
* @param cluster PlotCluster Object
|
||||||
* @param uuid Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void removeHelper(final PlotCluster cluster, final UUID uuid);
|
public void removeHelper(final PlotCluster cluster, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param uuid Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void removeTrusted(final String world, final Plot plot, final UUID uuid);
|
public void removeTrusted(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param cluster
|
* @param cluster
|
||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public void removeInvited(final PlotCluster cluster, final UUID uuid);
|
public void removeInvited(final PlotCluster cluster, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param uuid Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void setHelper(final String world, final Plot plot, final UUID uuid);
|
public void setHelper(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cluster PlotCluster Object
|
* @param cluster PlotCluster Object
|
||||||
* @param uuid Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void setHelper(final PlotCluster cluster, final UUID uuid);
|
public void setHelper(final PlotCluster cluster, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param uuid Player that should be added
|
* @param uuid Player that should be added
|
||||||
*/
|
*/
|
||||||
public void setTrusted(final String world, final Plot plot, final UUID uuid);
|
public void setTrusted(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
@ -273,19 +273,19 @@ public interface AbstractDB {
|
|||||||
* @param uuid
|
* @param uuid
|
||||||
*/
|
*/
|
||||||
public void setInvited(final String world, final PlotCluster cluster, final UUID uuid);
|
public void setInvited(final String world, final PlotCluster cluster, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be added
|
* @param player Player that should be added
|
||||||
*/
|
*/
|
||||||
public void removeDenied(final String world, final Plot plot, final UUID uuid);
|
public void removeDenied(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be added
|
* @param player Player that should be added
|
||||||
*/
|
*/
|
||||||
public void setDenied(final String world, final Plot plot, final UUID uuid);
|
public void setDenied(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Plots ratings
|
* Get Plots ratings
|
||||||
*
|
*
|
||||||
@ -294,7 +294,7 @@ public interface AbstractDB {
|
|||||||
* @return Plot Ratings (pre-calculated)
|
* @return Plot Ratings (pre-calculated)
|
||||||
*/
|
*/
|
||||||
public double getRatings(final Plot plot);
|
public double getRatings(final Plot plot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a plot comment
|
* Remove a plot comment
|
||||||
*
|
*
|
||||||
@ -303,7 +303,7 @@ public interface AbstractDB {
|
|||||||
* @param comment Comment to remove
|
* @param comment Comment to remove
|
||||||
*/
|
*/
|
||||||
public void removeComment(final String world, final Plot plot, final PlotComment comment);
|
public void removeComment(final String world, final Plot plot, final PlotComment comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a plot comment
|
* Set a plot comment
|
||||||
*
|
*
|
||||||
@ -312,7 +312,7 @@ public interface AbstractDB {
|
|||||||
* @param comment Comment to add
|
* @param comment Comment to add
|
||||||
*/
|
*/
|
||||||
public void setComment(final String world, final Plot plot, final PlotComment comment);
|
public void setComment(final String world, final Plot plot, final PlotComment comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Plot Comments
|
* Get Plot Comments
|
||||||
*
|
*
|
||||||
@ -323,12 +323,12 @@ public interface AbstractDB {
|
|||||||
* @return Plot Comments within the specified tier
|
* @return Plot Comments within the specified tier
|
||||||
*/
|
*/
|
||||||
public ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier, boolean below);
|
public ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier, boolean below);
|
||||||
|
|
||||||
public void createPlotAndSettings(Plot plot);
|
public void createPlotAndSettings(Plot plot);
|
||||||
|
|
||||||
public void createCluster(PlotCluster cluster);
|
public void createCluster(PlotCluster cluster);
|
||||||
|
|
||||||
public void resizeCluster(PlotCluster current, PlotClusterId resize);
|
public void resizeCluster(PlotCluster current, PlotClusterId resize);
|
||||||
|
|
||||||
public void movePlot(String world, PlotId originalPlot, PlotId newPlot);
|
public void movePlot(String world, PlotId originalPlot, PlotId newPlot);
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,11 @@ public class DBFunc {
|
|||||||
* Abstract Database Manager
|
* Abstract Database Manager
|
||||||
*/
|
*/
|
||||||
public static AbstractDB dbManager;
|
public static AbstractDB dbManager;
|
||||||
|
|
||||||
public static void movePlot(final String world, final PlotId originalPlot, final PlotId newPlot) {
|
public static void movePlot(final String world, final PlotId originalPlot, final PlotId newPlot) {
|
||||||
dbManager.movePlot(world, originalPlot, newPlot);
|
dbManager.movePlot(world, originalPlot, newPlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the owner of a plot
|
* Set the owner of a plot
|
||||||
*
|
*
|
||||||
@ -63,7 +63,7 @@ public class DBFunc {
|
|||||||
public static void setOwner(final Plot plot, final UUID uuid) {
|
public static void setOwner(final Plot plot, final UUID uuid) {
|
||||||
dbManager.setOwner(plot, uuid);
|
dbManager.setOwner(plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create all settings + (helpers, denied, trusted)
|
* Create all settings + (helpers, denied, trusted)
|
||||||
*
|
*
|
||||||
@ -72,7 +72,7 @@ public class DBFunc {
|
|||||||
public static void createAllSettingsAndHelpers(final ArrayList<Plot> plots) {
|
public static void createAllSettingsAndHelpers(final ArrayList<Plot> plots) {
|
||||||
dbManager.createAllSettingsAndHelpers(plots);
|
dbManager.createAllSettingsAndHelpers(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create all plots
|
* Create all plots
|
||||||
*
|
*
|
||||||
@ -81,7 +81,7 @@ public class DBFunc {
|
|||||||
public static void createPlots(final ArrayList<Plot> plots) {
|
public static void createPlots(final ArrayList<Plot> plots) {
|
||||||
dbManager.createPlots(plots);
|
dbManager.createPlots(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
*
|
*
|
||||||
@ -90,7 +90,7 @@ public class DBFunc {
|
|||||||
public static void createPlot(final Plot plot) {
|
public static void createPlot(final Plot plot) {
|
||||||
dbManager.createPlot(plot);
|
dbManager.createPlot(plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
*
|
*
|
||||||
@ -99,7 +99,7 @@ public class DBFunc {
|
|||||||
public static void createPlotAndSettings(final Plot plot) {
|
public static void createPlotAndSettings(final Plot plot) {
|
||||||
dbManager.createPlotAndSettings(plot);
|
dbManager.createPlotAndSettings(plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create tables
|
* Create tables
|
||||||
*
|
*
|
||||||
@ -108,7 +108,7 @@ public class DBFunc {
|
|||||||
public static void createTables(final String database, final boolean add_constraint) throws Exception {
|
public static void createTables(final String database, final boolean add_constraint) throws Exception {
|
||||||
dbManager.createTables(database, add_constraint);
|
dbManager.createTables(database, add_constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a plot
|
* Delete a plot
|
||||||
*
|
*
|
||||||
@ -117,11 +117,11 @@ public class DBFunc {
|
|||||||
public static void delete(final String world, final Plot plot) {
|
public static void delete(final String world, final Plot plot) {
|
||||||
dbManager.delete(world, plot);
|
dbManager.delete(world, plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void delete(final PlotCluster toDelete) {
|
public static void delete(final PlotCluster toDelete) {
|
||||||
dbManager.delete(toDelete);
|
dbManager.delete(toDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create plot settings
|
* Create plot settings
|
||||||
*
|
*
|
||||||
@ -131,7 +131,7 @@ public class DBFunc {
|
|||||||
public static void createPlotSettings(final int id, final Plot plot) {
|
public static void createPlotSettings(final int id, final Plot plot) {
|
||||||
dbManager.createPlotSettings(id, plot);
|
dbManager.createPlotSettings(id, plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a plot id
|
* Get a plot id
|
||||||
*
|
*
|
||||||
@ -153,26 +153,26 @@ public class DBFunc {
|
|||||||
public static int getId(final String world, final PlotId id2) {
|
public static int getId(final String world, final PlotId id2) {
|
||||||
return dbManager.getId(world, id2);
|
return dbManager.getId(world, id2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Plots
|
* @return Plots
|
||||||
*/
|
*/
|
||||||
public static LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
public static LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||||
return dbManager.getPlots();
|
return dbManager.getPlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMerged(final String world, final Plot plot, final boolean[] merged) {
|
public static void setMerged(final String world, final Plot plot, final boolean[] merged) {
|
||||||
dbManager.setMerged(world, plot, merged);
|
dbManager.setMerged(world, plot, merged);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFlags(final String world, final Plot plot, final Set<Flag> flags) {
|
public static void setFlags(final String world, final Plot plot, final Set<Flag> flags) {
|
||||||
dbManager.setFlags(world, plot, flags);
|
dbManager.setFlags(world, plot, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFlags(final PlotCluster cluster, final Set<Flag> flags) {
|
public static void setFlags(final PlotCluster cluster, final Set<Flag> flags) {
|
||||||
dbManager.setFlags(cluster, flags);
|
dbManager.setFlags(cluster, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param alias
|
* @param alias
|
||||||
@ -180,15 +180,15 @@ public class DBFunc {
|
|||||||
public static void setAlias(final String world, final Plot plot, final String alias) {
|
public static void setAlias(final String world, final Plot plot, final String alias) {
|
||||||
dbManager.setAlias(world, plot, alias);
|
dbManager.setAlias(world, plot, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void purgeIds(final String world, final Set<Integer> uniqueIds) {
|
public static void purgeIds(final String world, final Set<Integer> uniqueIds) {
|
||||||
dbManager.purgeIds(world, uniqueIds);
|
dbManager.purgeIds(world, uniqueIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void purge(final String world, final Set<PlotId> plotIds) {
|
public static void purge(final String world, final Set<PlotId> plotIds) {
|
||||||
dbManager.purge(world, plotIds);
|
dbManager.purge(world, plotIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param position
|
* @param position
|
||||||
@ -196,7 +196,7 @@ public class DBFunc {
|
|||||||
public static void setPosition(final String world, final Plot plot, final String position) {
|
public static void setPosition(final String world, final Plot plot, final String position) {
|
||||||
dbManager.setPosition(world, plot, position);
|
dbManager.setPosition(world, plot, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
*
|
*
|
||||||
@ -205,7 +205,7 @@ public class DBFunc {
|
|||||||
public static HashMap<String, Object> getSettings(final int id) {
|
public static HashMap<String, Object> getSettings(final int id) {
|
||||||
return dbManager.getSettings(id);
|
return dbManager.getSettings(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param comment
|
* @param comment
|
||||||
@ -213,7 +213,7 @@ public class DBFunc {
|
|||||||
public static void removeComment(final String world, final Plot plot, final PlotComment comment) {
|
public static void removeComment(final String world, final Plot plot, final PlotComment comment) {
|
||||||
dbManager.removeComment(world, plot, comment);
|
dbManager.removeComment(world, plot, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param comment
|
* @param comment
|
||||||
@ -221,14 +221,14 @@ public class DBFunc {
|
|||||||
public static void setComment(final String world, final Plot plot, final PlotComment comment) {
|
public static void setComment(final String world, final Plot plot, final PlotComment comment) {
|
||||||
dbManager.setComment(world, plot, comment);
|
dbManager.setComment(world, plot, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
public static ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier, final boolean below) {
|
public static ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier, final boolean below) {
|
||||||
return dbManager.getComments(world, plot, tier, below);
|
return dbManager.getComments(world, plot, tier, below);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -236,7 +236,7 @@ public class DBFunc {
|
|||||||
public static void removeHelper(final String world, final Plot plot, final UUID uuid) {
|
public static void removeHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeHelper(world, plot, uuid);
|
dbManager.removeHelper(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cluster
|
* @param cluster
|
||||||
* @param player
|
* @param player
|
||||||
@ -244,7 +244,7 @@ public class DBFunc {
|
|||||||
public static void removeHelper(final PlotCluster cluster, final UUID uuid) {
|
public static void removeHelper(final PlotCluster cluster, final UUID uuid) {
|
||||||
dbManager.removeHelper(cluster, uuid);
|
dbManager.removeHelper(cluster, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world
|
||||||
* @param cluster
|
* @param cluster
|
||||||
@ -253,7 +253,7 @@ public class DBFunc {
|
|||||||
public static void createCluster(final String world, final PlotCluster cluster) {
|
public static void createCluster(final String world, final PlotCluster cluster) {
|
||||||
dbManager.createCluster(cluster);
|
dbManager.createCluster(cluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world
|
||||||
* @param current
|
* @param current
|
||||||
@ -262,7 +262,7 @@ public class DBFunc {
|
|||||||
public static void resizeCluster(final PlotCluster current, final PlotClusterId resize) {
|
public static void resizeCluster(final PlotCluster current, final PlotClusterId resize) {
|
||||||
dbManager.resizeCluster(current, resize);
|
dbManager.resizeCluster(current, resize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -270,7 +270,7 @@ public class DBFunc {
|
|||||||
public static void removeTrusted(final String world, final Plot plot, final UUID uuid) {
|
public static void removeTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeTrusted(world, plot, uuid);
|
dbManager.removeTrusted(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
@ -280,7 +280,7 @@ public class DBFunc {
|
|||||||
public static void removeInvited(final PlotCluster cluster, final UUID uuid) {
|
public static void removeInvited(final PlotCluster cluster, final UUID uuid) {
|
||||||
dbManager.removeInvited(cluster, uuid);
|
dbManager.removeInvited(cluster, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -288,11 +288,11 @@ public class DBFunc {
|
|||||||
public static void setHelper(final String world, final Plot plot, final UUID uuid) {
|
public static void setHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setHelper(world, plot, uuid);
|
dbManager.setHelper(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setHelper(final PlotCluster cluster, final UUID uuid) {
|
public static void setHelper(final PlotCluster cluster, final UUID uuid) {
|
||||||
dbManager.setHelper(cluster, uuid);
|
dbManager.setHelper(cluster, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -300,11 +300,11 @@ public class DBFunc {
|
|||||||
public static void setTrusted(final String world, final Plot plot, final UUID uuid) {
|
public static void setTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setTrusted(world, plot, uuid);
|
dbManager.setTrusted(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setInvited(final String world, final PlotCluster cluster, final UUID uuid) {
|
public static void setInvited(final String world, final PlotCluster cluster, final UUID uuid) {
|
||||||
dbManager.setInvited(world, cluster, uuid);
|
dbManager.setInvited(world, cluster, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -312,7 +312,7 @@ public class DBFunc {
|
|||||||
public static void removeDenied(final String world, final Plot plot, final UUID uuid) {
|
public static void removeDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeDenied(world, plot, uuid);
|
dbManager.removeDenied(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
@ -320,19 +320,19 @@ public class DBFunc {
|
|||||||
public static void setDenied(final String world, final Plot plot, final UUID uuid) {
|
public static void setDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setDenied(world, plot, uuid);
|
dbManager.setDenied(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getRatings(final Plot plot) {
|
public static double getRatings(final Plot plot) {
|
||||||
return dbManager.getRatings(plot);
|
return dbManager.getRatings(plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, HashSet<PlotCluster>> getClusters() {
|
public static HashMap<String, HashSet<PlotCluster>> getClusters() {
|
||||||
return dbManager.getClusters();
|
return dbManager.getClusters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPosition(final PlotCluster cluster, final String position) {
|
public static void setPosition(final PlotCluster cluster, final String position) {
|
||||||
dbManager.setPosition(cluster, position);
|
dbManager.setPosition(cluster, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, Object> getClusterSettings(final int id) {
|
public static HashMap<String, Object> getClusterSettings(final int id) {
|
||||||
return dbManager.getClusterSettings(id);
|
return dbManager.getClusterSettings(id);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user