Reformat code

This commit is contained in:
dordsor21
2018-12-19 23:26:20 +00:00
parent fa2dbb2b89
commit 11ccfe7ac4
27 changed files with 365 additions and 401 deletions

View File

@ -1939,7 +1939,7 @@ import java.util.zip.ZipInputStream;
*
* @param alias to search plots
* @param worldname to filter alias to a specific world [optional] null means all worlds
* @return Set<{ @ link Plot }> empty if nothing found
* @return Set<{ @ link Plot }> empty if nothing found
*/
public Set<Plot> getPlotsByAlias(@Nullable final String alias,
@NonNull final String worldname) {

View File

@ -199,7 +199,8 @@ public class Area extends SubCommand {
break;
case "w":
case "wall":
pa.WALL_FILLING = Configuration.BLOCK_BUCKET.parseString(pair[1]);
pa.WALL_FILLING =
Configuration.BLOCK_BUCKET.parseString(pair[1]);
break;
case "b":
case "border":

View File

@ -68,7 +68,8 @@ public class Set extends SubCommand {
StringComparison<PlotBlock>.ComparisonResult match =
WorldUtil.IMP.getClosestBlock(unknownBlock);
if (match != null) {
final String found = WorldUtil.IMP.getClosestMatchingName(match.best);
final String found =
WorldUtil.IMP.getClosestMatchingName(match.best);
if (found != null) {
MainUtil.sendMessage(player, C.DID_YOU_MEAN,
found.toLowerCase());

View File

@ -4,11 +4,11 @@ import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import java.util.ArrayList;
import lombok.Getter;
import lombok.NonNull;
import java.util.ArrayList;
/**
* Main Configuration Utility
*/
@ -104,24 +104,9 @@ public class Configuration {
return value.best;
}
};
public static final class UnknownBlockException extends IllegalArgumentException {
@Getter
private final String unknownValue;
public UnknownBlockException(@NonNull final String unknownValue) {
super(String.format("\"%s\" is not a valid block", unknownValue));
this.unknownValue = unknownValue;
}
}
public static final SettingValue<BlockBucket> BLOCK_BUCKET =
new SettingValue<BlockBucket>("BLOCK_BUCKET") {
@Override
public BlockBucket parseString(final String string) {
@Override public BlockBucket parseString(final String string) {
if (string == null || string.isEmpty()) {
return new BlockBucket();
}
@ -151,8 +136,7 @@ public class Configuration {
return blockBucket;
}
@Override
public boolean validateValue(final String string) {
@Override public boolean validateValue(final String string) {
try {
if (string == null || string.isEmpty()) {
return false;
@ -184,7 +168,6 @@ public class Configuration {
return true;
}
};
public static final SettingValue<PlotBlock[]> BLOCKLIST =
new SettingValue<PlotBlock[]>("BLOCKLIST") {
@Override public boolean validateValue(String string) {
@ -263,6 +246,19 @@ public class Configuration {
return result;
}
public static final class UnknownBlockException extends IllegalArgumentException {
@Getter private final String unknownValue;
public UnknownBlockException(@NonNull final String unknownValue) {
super(String.format("\"%s\" is not a valid block", unknownValue));
this.unknownValue = unknownValue;
}
}
/**
* Create your own SettingValue object to make the management of plotworld configuration easier
*/

View File

@ -13,12 +13,18 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
public int ROAD_HEIGHT = 64;
public int PLOT_HEIGHT = 64;
public int WALL_HEIGHT = 64;
public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone")); // new PlotBlock[] {PlotBlock.get("stone")};
public BlockBucket TOP_BLOCK = BlockBucket.withSingle(PlotBlock.get("grass")); //new PlotBlock[] {PlotBlock.get("grass")};
public BlockBucket WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone_slab")); // PlotBlock.get((short) 44, (byte) 0);
public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("sandstone_slab")); // PlotBlock.get((short) 44, (byte) 1);
public BlockBucket WALL_FILLING = BlockBucket.withSingle(PlotBlock.get("stone")); //PlotBlock.get((short) 1, (byte) 0);
public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(PlotBlock.get("quartz_block")); // PlotBlock.get((short) 155, (byte) 0);
public BlockBucket MAIN_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone"));
// new PlotBlock[] {PlotBlock.get("stone")};
public BlockBucket TOP_BLOCK = BlockBucket.withSingle(PlotBlock.get("grass"));
//new PlotBlock[] {PlotBlock.get("grass")};
public BlockBucket WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("stone_slab"));
// PlotBlock.get((short) 44, (byte) 0);
public BlockBucket CLAIMED_WALL_BLOCK = BlockBucket.withSingle(PlotBlock.get("sandstone_slab"));
// PlotBlock.get((short) 44, (byte) 1);
public BlockBucket WALL_FILLING = BlockBucket.withSingle(PlotBlock.get("stone"));
//PlotBlock.get((short) 1, (byte) 0);
public BlockBucket ROAD_BLOCK = BlockBucket.withSingle(PlotBlock.get("quartz_block"));
// PlotBlock.get((short) 155, (byte) 0);
public boolean PLOT_BEDROCK = true;
public ClassicPlotWorld(String worldName, String id, IndependentPlotGenerator generator,
@ -46,8 +52,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
new ConfigurationNode("wall.block", this.WALL_BLOCK, "Top wall block",
Configuration.BLOCK_BUCKET),
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK,
"Wall block (claimed)",
Configuration.BLOCK_BUCKET),
"Wall block (claimed)", Configuration.BLOCK_BUCKET),
new ConfigurationNode("road.width", this.ROAD_WIDTH, "Road width",
Configuration.INTEGER),
new ConfigurationNode("road.height", this.ROAD_HEIGHT, "Road height",
@ -77,7 +82,8 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
this.WALL_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("wall.block"));
this.ROAD_HEIGHT = Math.min(255, config.getInt("road.height"));
this.ROAD_BLOCK = Configuration.BLOCK_BUCKET.parseString(config.getString("road.block"));
this.WALL_FILLING = Configuration.BLOCK_BUCKET.parseString(config.getString("wall.filling"));
this.WALL_FILLING =
Configuration.BLOCK_BUCKET.parseString(config.getString("wall.filling"));
this.WALL_HEIGHT = Math.min(254, config.getInt("wall.height"));
this.CLAIMED_WALL_BLOCK =
Configuration.BLOCK_BUCKET.parseString(config.getString("wall.block_claimed"));

View File

@ -4,248 +4,236 @@ import com.github.intellectualsites.plotsquared.configuration.serialization.Conf
import com.github.intellectualsites.plotsquared.plot.config.C;
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.*;
import java.util.Map.Entry;
/**
* A block bucket is a container of block types, where each block
* has a specified chance of being randomly picked
*/
@EqualsAndHashCode
@SuppressWarnings({"unused", "WeakerAccess"})
public final class BlockBucket implements Iterable<PlotBlock>, ConfigurationSerializable {
@EqualsAndHashCode @SuppressWarnings({"unused", "WeakerAccess"}) public final class BlockBucket
implements Iterable<PlotBlock>, ConfigurationSerializable {
private final Random random = new Random();
private final Map<Range, PlotBlock> ranges = new HashMap<>();
private final Map<PlotBlock, Integer> blocks;
private final BucketIterator bucketIterator = new BucketIterator();
private boolean compiled;
private final Random random = new Random();
private final Map<Range, PlotBlock> ranges = new HashMap<>();
private final Map<PlotBlock, Integer> blocks;
private final BucketIterator bucketIterator = new BucketIterator();
private boolean compiled;
public static BlockBucket withSingle(@NonNull final PlotBlock block) {
final BlockBucket blockBucket = new BlockBucket();
blockBucket.addBlock(block);
return blockBucket;
}
public static BlockBucket empty() {
final BlockBucket bucket = new BlockBucket();
bucket.compiled = true;
return bucket;
}
public BlockBucket() {
this.blocks = new HashMap<>();
}
public void addBlock(@NonNull final PlotBlock block) {
this.addBlock(block, -1);
}
public void addBlock(@NonNull final PlotBlock block, final int chance) {
this.blocks.put(block, chance);
this.compiled = false;
}
public boolean isEmpty() {
if (isCompiled()) {
return ranges.isEmpty();
}
return blocks.isEmpty();
}
/**
* Get all blocks that are configured in the bucket
*
* @return Immutable collection containing all blocks that can
* be found in the bucket
*/
public Collection<PlotBlock> getBlocks() {
if (!isCompiled()) {
this.compile();
}
return Collections.unmodifiableCollection(this.ranges.values());
}
/**
* Get a collection containing a specified amount of randomly selected blocks
*
* @param count Number of blocks
* @return Immutable collection containing randomly selected blocks
*/
public Collection<PlotBlock> getBlocks(final int count) {
final List<PlotBlock> blocks = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
blocks.add(getBlock());
}
return Collections.unmodifiableCollection(blocks);
}
public void compile() {
if (isCompiled()) {
return;
public BlockBucket() {
this.blocks = new HashMap<>();
}
if (blocks.size() == 1) {
this.ranges.put(new Range(0, 100, true), blocks.keySet().toArray(new PlotBlock[1])[0]);
this.compiled = true;
return;
public static BlockBucket withSingle(@NonNull final PlotBlock block) {
final BlockBucket blockBucket = new BlockBucket();
blockBucket.addBlock(block);
return blockBucket;
}
final Map<PlotBlock, Integer> temp = new HashMap<>(blocks.size());
final List<PlotBlock> unassigned = new ArrayList<>(blocks.size());
public static BlockBucket empty() {
final BlockBucket bucket = new BlockBucket();
bucket.compiled = true;
return bucket;
}
int sum = 0;
for (final Map.Entry<PlotBlock, Integer> entry : blocks.entrySet()) {
if (entry.getValue() == -1) {
unassigned.add(entry.getKey());
} else {
sum += entry.getValue();
}
}
//
// If this doesn't amount to 100 add it up to exactly 100.
//
if (sum < 100) {
final int remaining = 100 - sum;
final int perUnassigned = remaining / unassigned.size();
for (final PlotBlock block : unassigned) {
temp.put(block, perUnassigned);
sum += perUnassigned;
}
// Make sure there isn't a tiny difference remaining
if (sum < 100) {
final int difference = 100 - sum;
temp.put(unassigned.get(0), perUnassigned + difference);
sum = 100;
}
} else if (!unassigned.isEmpty()) {
C.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole());
}
//
// If the sum adds up to more than 100, divide all values
//
if (sum > 100) {
final double ratio = 100D / sum;
for (final Map.Entry<PlotBlock, Integer> entry : blocks.entrySet()) {
if (entry.getValue() == -1) {
continue;
public static BlockBucket deserialize(@NonNull final Map<String, Object> map) {
if (!map.containsKey("blocks")) {
return null;
}
temp.put(entry.getKey(), (int)(entry.getValue() * ratio));
}
} else {
temp.forEach(temp::put);
}
int start = 0;
for (final Map.Entry<PlotBlock, Integer> entry : temp.entrySet()) {
final int rangeStart = start;
final int rangeEnd = rangeStart + entry.getValue();
start = rangeEnd + 1;
final Range range = new Range(rangeStart, rangeEnd, unassigned.contains(entry.getKey()));
this.ranges.put(range, entry.getKey());
}
this.blocks.clear();
this.compiled = true;
}
@Override
public Iterator<PlotBlock> iterator() {
return this.bucketIterator;
}
public boolean isCompiled() {
return this.compiled;
}
/**
* Get a random block out of the bucket
*
* @return Randomly picked block (cased on specified rates)
*/
public PlotBlock getBlock() {
if (!isCompiled()) {
this.compile();
}
if (this.isEmpty()) {
return StringPlotBlock.EVERYTHING;
}
final int number = random.nextInt(101);
for (final Map.Entry<Range, PlotBlock> entry : ranges.entrySet()) {
if (entry.getKey().isInRange(number)) {
return entry.getValue();
}
}
// Didn't find a block? Try again
return getBlock();
}
@Override public String toString() {
final StringBuilder builder = new StringBuilder();
final Iterator<Entry<Range, PlotBlock>> iterator = this.ranges.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<Range, PlotBlock> entry = iterator.next();
builder.append(entry.getValue().getRawId());
if (!entry.getKey().isAutomatic()) {
builder.append(":").append(entry.getKey().getWeight());
}
if (iterator.hasNext()) {
builder.append(",");
}
}
return builder.toString();
}
@Override
public Map<String, Object> serialize() {
return ImmutableMap.of("blocks", this.toString());
}
public static BlockBucket deserialize(@NonNull final Map<String, Object> map) {
if (!map.containsKey("blocks")) {
return null;
}
return Configuration.BLOCK_BUCKET.parseString(map.get("blocks").toString());
}
private final class BucketIterator implements Iterator<PlotBlock> {
@Override
public boolean hasNext() {
return true;
return Configuration.BLOCK_BUCKET.parseString(map.get("blocks").toString());
}
@Override
public PlotBlock next() {
return getBlock();
}
}
@Getter
@EqualsAndHashCode
@RequiredArgsConstructor
private final static class Range {
private final int min;
private final int max;
@Getter
private final boolean automatic;
public int getWeight() {
return max - min;
public void addBlock(@NonNull final PlotBlock block) {
this.addBlock(block, -1);
}
public boolean isInRange(final int num) {
return num <= max && num >= min;
public void addBlock(@NonNull final PlotBlock block, final int chance) {
this.blocks.put(block, chance);
this.compiled = false;
}
public boolean isEmpty() {
if (isCompiled()) {
return ranges.isEmpty();
}
return blocks.isEmpty();
}
/**
* Get all blocks that are configured in the bucket
*
* @return Immutable collection containing all blocks that can
* be found in the bucket
*/
public Collection<PlotBlock> getBlocks() {
if (!isCompiled()) {
this.compile();
}
return Collections.unmodifiableCollection(this.ranges.values());
}
/**
* Get a collection containing a specified amount of randomly selected blocks
*
* @param count Number of blocks
* @return Immutable collection containing randomly selected blocks
*/
public Collection<PlotBlock> getBlocks(final int count) {
final List<PlotBlock> blocks = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
blocks.add(getBlock());
}
return Collections.unmodifiableCollection(blocks);
}
public void compile() {
if (isCompiled()) {
return;
}
if (blocks.size() == 1) {
this.ranges.put(new Range(0, 100, true), blocks.keySet().toArray(new PlotBlock[1])[0]);
this.compiled = true;
return;
}
final Map<PlotBlock, Integer> temp = new HashMap<>(blocks.size());
final List<PlotBlock> unassigned = new ArrayList<>(blocks.size());
int sum = 0;
for (final Map.Entry<PlotBlock, Integer> entry : blocks.entrySet()) {
if (entry.getValue() == -1) {
unassigned.add(entry.getKey());
} else {
sum += entry.getValue();
}
}
//
// If this doesn't amount to 100 add it up to exactly 100.
//
if (sum < 100) {
final int remaining = 100 - sum;
final int perUnassigned = remaining / unassigned.size();
for (final PlotBlock block : unassigned) {
temp.put(block, perUnassigned);
sum += perUnassigned;
}
// Make sure there isn't a tiny difference remaining
if (sum < 100) {
final int difference = 100 - sum;
temp.put(unassigned.get(0), perUnassigned + difference);
sum = 100;
}
} else if (!unassigned.isEmpty()) {
C.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole());
}
//
// If the sum adds up to more than 100, divide all values
//
if (sum > 100) {
final double ratio = 100D / sum;
for (final Map.Entry<PlotBlock, Integer> entry : blocks.entrySet()) {
if (entry.getValue() == -1) {
continue;
}
temp.put(entry.getKey(), (int) (entry.getValue() * ratio));
}
} else {
temp.forEach(temp::put);
}
int start = 0;
for (final Map.Entry<PlotBlock, Integer> entry : temp.entrySet()) {
final int rangeStart = start;
final int rangeEnd = rangeStart + entry.getValue();
start = rangeEnd + 1;
final Range range =
new Range(rangeStart, rangeEnd, unassigned.contains(entry.getKey()));
this.ranges.put(range, entry.getKey());
}
this.blocks.clear();
this.compiled = true;
}
@Override public Iterator<PlotBlock> iterator() {
return this.bucketIterator;
}
public boolean isCompiled() {
return this.compiled;
}
/**
* Get a random block out of the bucket
*
* @return Randomly picked block (cased on specified rates)
*/
public PlotBlock getBlock() {
if (!isCompiled()) {
this.compile();
}
if (this.isEmpty()) {
return StringPlotBlock.EVERYTHING;
}
final int number = random.nextInt(101);
for (final Map.Entry<Range, PlotBlock> entry : ranges.entrySet()) {
if (entry.getKey().isInRange(number)) {
return entry.getValue();
}
}
// Didn't find a block? Try again
return getBlock();
}
@Override public String toString() {
final StringBuilder builder = new StringBuilder();
final Iterator<Entry<Range, PlotBlock>> iterator = this.ranges.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<Range, PlotBlock> entry = iterator.next();
builder.append(entry.getValue().getRawId());
if (!entry.getKey().isAutomatic()) {
builder.append(":").append(entry.getKey().getWeight());
}
if (iterator.hasNext()) {
builder.append(",");
}
}
return builder.toString();
}
@Override public Map<String, Object> serialize() {
return ImmutableMap.of("blocks", this.toString());
}
@Getter @EqualsAndHashCode @RequiredArgsConstructor private final static class Range {
private final int min;
private final int max;
@Getter private final boolean automatic;
public int getWeight() {
return max - min;
}
public boolean isInRange(final int num) {
return num <= max && num >= min;
}
}
private final class BucketIterator implements Iterator<PlotBlock> {
@Override public boolean hasNext() {
return true;
}
@Override public PlotBlock next() {
return getBlock();
}
}
}
}

View File

@ -1,34 +1,34 @@
package com.github.intellectualsites.plotsquared.plot.object;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.NonNull;
import java.util.HashMap;
import java.util.Map;
public abstract class BlockRegistry<T> {
@Getter
private final Class<T> type;
private final Map<PlotBlock, T> map = new HashMap<>();
@Getter private final Class<T> type;
private final Map<PlotBlock, T> map = new HashMap<>();
public BlockRegistry(@NonNull final Class<T> type, final T... preInitializedItems) {
this.type = type;
for (final T preInitializedItem : preInitializedItems) {
this.addMapping(getPlotBlock(preInitializedItem), preInitializedItem);
public BlockRegistry(@NonNull final Class<T> type, final T... preInitializedItems) {
this.type = type;
for (final T preInitializedItem : preInitializedItems) {
this.addMapping(getPlotBlock(preInitializedItem), preInitializedItem);
}
}
}
public final void addMapping(@NonNull final PlotBlock plotBlock, @NonNull final T t) {
if (map.containsKey(plotBlock)) {
return;
public final void addMapping(@NonNull final PlotBlock plotBlock, @NonNull final T t) {
if (map.containsKey(plotBlock)) {
return;
}
this.map.put(plotBlock, t);
}
this.map.put(plotBlock, t);
}
public abstract PlotBlock getPlotBlock(final T item);
public abstract PlotBlock getPlotBlock(final T item);
public final T getItem(final PlotBlock plotBlock) {
return this.map.get(plotBlock);
}
public final T getItem(final PlotBlock plotBlock) {
return this.map.get(plotBlock);
}
}

View File

@ -15,10 +15,8 @@ public class LegacyPlotBlock extends PlotBlock {
}
}
@Getter
public final short id;
@Getter
public final byte data;
@Getter public final short id;
@Getter public final byte data;
public LegacyPlotBlock(short id, byte data) {
this.id = id;

View File

@ -5,13 +5,12 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import lombok.Getter;
public class PlotItemStack {
// public final int id;
// public final short data;
@Getter
private final PlotBlock plotBlock;
public final int amount;
public final String name;
public final String[] lore;
// public final int id;
// public final short data;
@Getter private final PlotBlock plotBlock;
@Deprecated
public PlotItemStack(final int id, final short data, final int amount, final String name,

View File

@ -12,46 +12,41 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.util.*;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import lombok.NonNull;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.NonNull;
/**
* The abstract class supporting {@code BukkitPlayer} and {@code SpongePlayer}.
*/
public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public interface PlotPlayerConverter<BaseObject> {
PlotPlayer convert(BaseObject object);
}
public static final String META_LAST_PLOT = "lastplot";
public static final String META_LOCATION = "location";
private static final Map<Class, PlotPlayerConverter> converters = new HashMap<>();
private Map<String, byte[]> metaMap = new HashMap<>();
/**
* The metadata map.
*/
private ConcurrentHashMap<String, Object> meta;
public static <T> PlotPlayer from(@NonNull final T object) {
if (!converters.containsKey(object.getClass())) {
throw new IllegalArgumentException(
String.format("There is no registered PlotPlayer converter for type %s",
throw new IllegalArgumentException(String
.format("There is no registered PlotPlayer converter for type %s",
object.getClass().getSimpleName()));
}
return converters.get(object.getClass()).convert(object);
}
public static <T> void registerConverter(@NonNull final Class<T> clazz, final PlotPlayerConverter<T> converter) {
public static <T> void registerConverter(@NonNull final Class<T> clazz,
final PlotPlayerConverter<T> converter) {
converters.put(clazz, converter);
}
public static final String META_LAST_PLOT = "lastplot";
public static final String META_LOCATION = "location";
private Map<String, byte[]> metaMap = new HashMap<>();
/**
* The metadata map.
*/
private ConcurrentHashMap<String, Object> meta;
/**
* Efficiently wrap a Player, or OfflinePlayer object to get a PlotPlayer (or fetch if it's already cached)<br>
* - Accepts sponge/bukkit Player (online)
@ -304,10 +299,6 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
return RequiredType.PLAYER;
}
/////////////// PLAYER META ///////////////
////////////// PARTIALLY IMPLEMENTED ///////////
/**
* Get this player's last recorded location or null if they don't any plot relevant location.
*
@ -321,7 +312,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
return getLocationFull();
}
////////////////////////////////////////////////
/////////////// PLAYER META ///////////////
////////////// PARTIALLY IMPLEMENTED ///////////
/**
* Get this player's full location (including yaw/pitch)
@ -330,6 +323,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
*/
public abstract Location getLocationFull();
////////////////////////////////////////////////
/**
* Get this player's UUID.
* === !IMPORTANT ===<br>
@ -376,7 +371,6 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
setPersistentMeta("attrib_" + key, new byte[] {(byte) 1});
}
/**
* Retrieves the attribute of this player.
*
@ -666,4 +660,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
EconHandler.manager.depositMoney(this, amount);
}
}
public interface PlotPlayerConverter<BaseObject> {
PlotPlayer convert(BaseObject object);
}
}

View File

@ -17,6 +17,7 @@ public class StringPlotBlock extends PlotBlock {
@Getter private final String itemId;
@Getter @Setter private BaseBlock baseBlock = null;
private boolean isForeign = false;
public StringPlotBlock(@NonNull final String nameSpace, @NonNull final String itemId) {
this.nameSpace = nameSpace.toLowerCase(Locale.ENGLISH);
this.itemId = itemId.toLowerCase(Locale.ENGLISH);

View File

@ -10,8 +10,7 @@ import lombok.experimental.UtilityClass;
/**
* Entity related general utility methods
*/
@UtilityClass
public final class EntityUtil {
@UtilityClass public final class EntityUtil {
private static int capNumeral(@NonNull final String flagName) {
int i;

View File

@ -134,14 +134,16 @@ public abstract class EventUtil {
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
if (use.isPresent()) {
HashSet<PlotBlock> value = use.get();
if (PlotBlock.containsEverything(value) || value.contains(block.getPlotBlock())) {
if (PlotBlock.containsEverything(value) || value
.contains(block.getPlotBlock())) {
return true;
}
}
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
if (destroy.isPresent()) {
HashSet<PlotBlock> value = destroy.get();
if (PlotBlock.containsEverything(value) || value.contains(block.getPlotBlock())) {
if (PlotBlock.containsEverything(value) || value
.contains(block.getPlotBlock())) {
return true;
}
}