mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Reformat it all.
This commit is contained in:
@ -25,14 +25,14 @@
|
||||
*/
|
||||
package com.plotsquared.core.api;
|
||||
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
@ -60,7 +60,9 @@ import java.util.UUID;
|
||||
*
|
||||
* @version 5
|
||||
*/
|
||||
@SuppressWarnings({"unused", "WeakerAccess"}) @NoArgsConstructor public class PlotAPI {
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
@NoArgsConstructor
|
||||
public class PlotAPI {
|
||||
|
||||
/**
|
||||
* Gets all plots.
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.command.Claim;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.command.Claim;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
public class PlayerEnterPlotEvent extends PlotPlayerEvent {
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -58,13 +58,11 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel
|
||||
return this.from;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl
|
||||
this.world = world;
|
||||
this.plots = plots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plots being added.
|
||||
*
|
||||
@ -65,13 +66,11 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl
|
||||
return Collections.unmodifiableList(this.plots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -57,13 +57,11 @@ public class PlotClearEvent extends PlotEvent implements CancellablePlotEvent {
|
||||
return getPlot().getWorldName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -57,13 +57,11 @@ public class PlotDeleteEvent extends PlotEvent implements CancellablePlotEvent {
|
||||
return getPlot().getWorldName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
|
||||
/**
|
||||
* Called when a Flag is added to a plot.
|
||||
@ -45,13 +45,11 @@ public class PlotFlagAddEvent extends PlotFlagEvent implements CancellablePlotEv
|
||||
super(plot, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
|
||||
public abstract class PlotFlagEvent extends PlotEvent {
|
||||
private final PlotFlag<?, ?> flag;
|
||||
@ -39,7 +39,7 @@ public abstract class PlotFlagEvent extends PlotEvent {
|
||||
/**
|
||||
* Get the flag involved
|
||||
*
|
||||
* @return the flag involved
|
||||
* @return the flag involved
|
||||
*/
|
||||
public PlotFlag<?, ?> getFlag() {
|
||||
return flag;
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
|
||||
/**
|
||||
* Called when a flag is removed from a plot
|
||||
@ -45,13 +45,11 @@ public class PlotFlagRemoveEvent extends PlotFlagEvent implements CancellablePlo
|
||||
super(plot, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
@Override public Result getEventResult() {
|
||||
return eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result e) {
|
||||
@Override public void setEventResult(Result e) {
|
||||
this.eventResult = e;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
public abstract class PlotPlayerEvent extends PlotEvent {
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import com.plotsquared.core.configuration.serialization.ConfigurationSerializable;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.BlockUtil;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.serialization.ConfigurationSerializable;
|
||||
import com.plotsquared.core.util.BlockUtil;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -49,7 +49,8 @@ import java.util.regex.Matcher;
|
||||
* A block bucket is a container of block types, where each block
|
||||
* has a specified chance of being randomly picked
|
||||
*/
|
||||
@EqualsAndHashCode(of = {"input"}) @SuppressWarnings({"unused", "WeakerAccess"})
|
||||
@EqualsAndHashCode(of = {"input"})
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public final class BlockBucket implements ConfigurationSerializable {
|
||||
private static java.util.regex.Pattern regex = java.util.regex.Pattern.compile(
|
||||
"((?<namespace>[A-Za-z_]+):)?(?<block>([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?<chance>[0-9]{1,3}))?");
|
||||
@ -134,7 +135,8 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
String chanceStr = matcher.group("chance");
|
||||
String block = matcher.group("block");
|
||||
//noinspection PointlessNullCheck
|
||||
if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) {
|
||||
if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan
|
||||
.isInteger(chanceStr)) {
|
||||
String namespace = matcher.group("namespace");
|
||||
string = (namespace == null ? "" : namespace + ":") + block;
|
||||
}
|
||||
@ -191,7 +193,10 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
return ImmutableMap.of("blocks", this.toString());
|
||||
}
|
||||
|
||||
@Getter @EqualsAndHashCode @RequiredArgsConstructor private static final class Range {
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@RequiredArgsConstructor
|
||||
private static final class Range {
|
||||
|
||||
private final int min;
|
||||
private final int max;
|
||||
|
@ -25,13 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -40,32 +37,35 @@ import com.plotsquared.core.events.PlotComponentSetEvent;
|
||||
import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.generator.SquarePlotWorld;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.expiration.PlotAnalysis;
|
||||
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
||||
import com.plotsquared.core.plot.flag.InternalFlag;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
||||
import com.plotsquared.core.generator.SquarePlotWorld;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.plotsquared.core.plot.schematic.Schematic;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.StringWrapper;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.expiration.PlotAnalysis;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
@ -103,7 +103,12 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.plotsquared.core.command.SubCommand.sendMessage;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.*;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_MISC;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_MOB;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_MONSTER;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
|
||||
|
||||
/**
|
||||
@ -1285,12 +1290,12 @@ public class Plot {
|
||||
int[] count = new int[6];
|
||||
for (Plot current : this.getConnectedPlots()) {
|
||||
int[] result = ChunkManager.manager.countEntities(current);
|
||||
count[CAP_ENTITY] += result[CAP_ENTITY];
|
||||
count[CAP_ANIMAL] += result[CAP_ANIMAL];
|
||||
count[CAP_MONSTER] += result[CAP_MONSTER];
|
||||
count[CAP_MOB] += result[CAP_MOB];
|
||||
count[CAP_VEHICLE] += result[CAP_VEHICLE];
|
||||
count[CAP_MISC] += result[CAP_MISC];
|
||||
count[CAP_ENTITY] += result[CAP_ENTITY];
|
||||
count[CAP_ANIMAL] += result[CAP_ANIMAL];
|
||||
count[CAP_MONSTER] += result[CAP_MONSTER];
|
||||
count[CAP_MOB] += result[CAP_MOB];
|
||||
count[CAP_VEHICLE] += result[CAP_VEHICLE];
|
||||
count[CAP_MISC] += result[CAP_MISC];
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -3058,8 +3063,8 @@ public class Plot {
|
||||
/**
|
||||
* Teleport a player to a plot and send them the teleport message.
|
||||
*
|
||||
* @param player the player
|
||||
* @param cause the cause of the teleport
|
||||
* @param player the player
|
||||
* @param cause the cause of the teleport
|
||||
* @param resultConsumer Called with the result of the teleportation
|
||||
*/
|
||||
public void teleportPlayer(final PlotPlayer player, TeleportCause cause,
|
||||
|
@ -31,10 +31,10 @@ import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.collection.QuadMap;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.ConfigurationNode;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.generator.GridPlotWorld;
|
||||
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
@ -217,8 +217,8 @@ public abstract class PlotArea {
|
||||
return false;
|
||||
}
|
||||
PlotArea plotarea = (PlotArea) obj;
|
||||
return this.getWorldHash() == plotarea.getWorldHash() && this.getWorldName().equals(plotarea.getWorldName())
|
||||
&& StringMan.isEqual(this.getId(), plotarea.getId());
|
||||
return this.getWorldHash() == plotarea.getWorldHash() && this.getWorldName()
|
||||
.equals(plotarea.getWorldName()) && StringMan.isEqual(this.getId(), plotarea.getId());
|
||||
}
|
||||
|
||||
public Set<PlotCluster> getClusters() {
|
||||
@ -359,8 +359,9 @@ public abstract class PlotArea {
|
||||
String prefix = " ";
|
||||
for (final PlotFlag<?, ?> flag : flagCollection) {
|
||||
Object value = flag.toString();
|
||||
flagBuilder.append(prefix).append(CaptionUtility.format(null, Captions.PLOT_FLAG_LIST.getTranslated(),
|
||||
flag.getName(), CaptionUtility.formatRaw(null, value.toString(), "")));
|
||||
flagBuilder.append(prefix).append(CaptionUtility
|
||||
.format(null, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
|
||||
CaptionUtility.formatRaw(null, value.toString(), "")));
|
||||
prefix = ", ";
|
||||
}
|
||||
}
|
||||
@ -543,8 +544,8 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
public boolean contains(@NotNull final Location location) {
|
||||
return StringMan.isEqual(location.getWorld(), this.getWorldName()) && (getRegionAbs() == null
|
||||
|| this.region.contains(location.getBlockVector3()));
|
||||
return StringMan.isEqual(location.getWorld(), this.getWorldName()) && (
|
||||
getRegionAbs() == null || this.region.contains(location.getBlockVector3()));
|
||||
}
|
||||
|
||||
@NotNull public Set<Plot> getPlotsAbs(final UUID uuid) {
|
||||
@ -599,6 +600,7 @@ public abstract class PlotArea {
|
||||
public int getPlotCount(@Nullable final PlotPlayer player) {
|
||||
return player != null ? getPlotCount(player.getUUID()) : 0;
|
||||
}
|
||||
|
||||
@Nullable public Plot getPlotAbs(@NotNull final PlotId id) {
|
||||
Plot plot = getOwnedPlotAbs(id);
|
||||
if (plot == null) {
|
||||
@ -640,7 +642,8 @@ public abstract class PlotArea {
|
||||
return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null;
|
||||
}
|
||||
|
||||
@Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1,
|
||||
@Nullable
|
||||
public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1,
|
||||
@NotNull final PlotId pos2) {
|
||||
if (this.clusters == null) {
|
||||
return null;
|
||||
@ -1051,15 +1054,16 @@ public abstract class PlotArea {
|
||||
} else {
|
||||
split = key.split(":");
|
||||
}
|
||||
final PlotFlag<?, ?> flagInstance = GlobalFlagContainer.getInstance().getFlagFromString(split[0]);
|
||||
final PlotFlag<?, ?> flagInstance =
|
||||
GlobalFlagContainer.getInstance().getFlagFromString(split[0]);
|
||||
if (flagInstance != null) {
|
||||
try {
|
||||
flags.add(flagInstance.parse(split[1]));
|
||||
} catch (final FlagParseException e) {
|
||||
PlotSquared.log(Captions.PREFIX.getTranslated() +
|
||||
String.format("§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c."
|
||||
+ " Reason: %s. This flag will not be added as a default flag.",
|
||||
e.getFlag().getName(), e.getValue(), e.getErrorMessage()));
|
||||
PlotSquared.log(Captions.PREFIX.getTranslated() + String.format(
|
||||
"§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c."
|
||||
+ " Reason: %s. This flag will not be added as a default flag.",
|
||||
e.getFlag().getName(), e.getValue(), e.getErrorMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,14 +54,13 @@ public enum PlotAreaTerrainType {
|
||||
ALL;
|
||||
|
||||
private static final Map<String, PlotAreaTerrainType> types = Stream.of(values())
|
||||
.collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity()));
|
||||
.collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity()));
|
||||
|
||||
public static Optional<PlotAreaTerrainType> fromString(String typeString) {
|
||||
return Optional.ofNullable(types.get(typeString.toLowerCase()));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Optional<PlotAreaTerrainType> fromLegacyInt(int typeId) {
|
||||
@Deprecated public static Optional<PlotAreaTerrainType> fromLegacyInt(int typeId) {
|
||||
if (typeId < 0 || typeId >= values().length) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -32,19 +32,16 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum PlotAreaType {
|
||||
NORMAL,
|
||||
AUGMENTED,
|
||||
PARTIAL;
|
||||
NORMAL, AUGMENTED, PARTIAL;
|
||||
|
||||
private static final Map<String, PlotAreaType> types = Stream.of(values())
|
||||
.collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity()));
|
||||
.collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity()));
|
||||
|
||||
public static Optional<PlotAreaType> fromString(String typeName) {
|
||||
return Optional.ofNullable(types.get(typeName.toLowerCase()));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Optional<PlotAreaType> fromLegacyInt(int typeId) {
|
||||
@Deprecated public static Optional<PlotAreaType> fromLegacyInt(int typeId) {
|
||||
if (typeId < 0 || typeId >= values().length) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.RegionUtil;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -154,12 +154,13 @@ public class PlotCluster {
|
||||
public void getHome(Consumer<Location> result) {
|
||||
BlockLoc home = this.settings.getPosition();
|
||||
Consumer<Location> locationConsumer = toReturn -> {
|
||||
MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(), max -> {
|
||||
if (max > toReturn.getY()) {
|
||||
toReturn.setY(1 + max);
|
||||
}
|
||||
result.accept(toReturn);
|
||||
});
|
||||
MainUtil.getHighestBlock(this.area.getWorldName(), toReturn.getX(), toReturn.getZ(),
|
||||
max -> {
|
||||
if (max > toReturn.getY()) {
|
||||
toReturn.setY(1 + max);
|
||||
}
|
||||
result.accept(toReturn);
|
||||
});
|
||||
};
|
||||
if (home.getY() == 0) {
|
||||
// default pos
|
||||
|
@ -31,10 +31,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PlotId {
|
||||
|
||||
@Deprecated
|
||||
public int x;
|
||||
@Deprecated
|
||||
public int y;
|
||||
@Deprecated public int x;
|
||||
@Deprecated public int y;
|
||||
private int hash;
|
||||
|
||||
/**
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.command.Template;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.util.FileBytes;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -26,10 +26,10 @@
|
||||
package com.plotsquared.core.plot.comment;
|
||||
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot.comment;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.google.common.annotations.Beta;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -32,21 +32,21 @@ import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.generator.HybridUtils;
|
||||
import com.plotsquared.core.player.OfflinePlotPlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
||||
import com.plotsquared.core.generator.HybridUtils;
|
||||
import com.plotsquared.core.player.OfflinePlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.message.PlotMessage;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
|
||||
@ -337,8 +337,10 @@ public class ExpireManager {
|
||||
}
|
||||
}, () -> {
|
||||
PlotFlag<?, ?> plotFlag = GlobalFlagContainer.getInstance()
|
||||
.getFlag(AnalysisFlag.class).createFlagInstance(changed.asList());
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, newPlot);
|
||||
.getFlag(AnalysisFlag.class)
|
||||
.createFlagInstance(changed.asList());
|
||||
PlotFlagAddEvent event =
|
||||
new PlotFlagAddEvent(plotFlag, newPlot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
return;
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ public class ExpiryTask {
|
||||
}
|
||||
|
||||
public boolean allowsArea(PlotArea area) {
|
||||
return settings.WORLDS.contains(area.toString()) || settings.WORLDS.contains(area.getWorldName())
|
||||
|| settings.WORLDS.contains("*");
|
||||
return settings.WORLDS.contains(area.toString()) || settings.WORLDS
|
||||
.contains(area.getWorldName()) || settings.WORLDS.contains("*");
|
||||
}
|
||||
|
||||
public boolean applies(PlotArea area) {
|
||||
|
@ -27,11 +27,11 @@ package com.plotsquared.core.plot.expiration;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
||||
import com.plotsquared.core.generator.HybridUtils;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
@ -26,10 +26,10 @@
|
||||
package com.plotsquared.core.plot.flag.implementations;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.FlagParseException;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -26,9 +26,9 @@
|
||||
package com.plotsquared.core.plot.flag.implementations;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.InternalFlag;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DoneFlag extends PlotFlag<String, DoneFlag> implements InternalFlag {
|
||||
|
@ -88,9 +88,7 @@ public class FlyFlag extends PlotFlag<FlyFlag.FlyStatus, FlyFlag> {
|
||||
}
|
||||
|
||||
public enum FlyStatus {
|
||||
ENABLED,
|
||||
DISABLED,
|
||||
DEFAULT
|
||||
ENABLED, DISABLED, DEFAULT
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ public class MusicFlag extends PlotFlag<ItemType, MusicFlag> {
|
||||
input = "music_disc_" + input;
|
||||
}
|
||||
final ItemType itemType = ItemUtil.get(input);
|
||||
if (itemType != null && itemType.getId() != null &&
|
||||
(itemType == ItemTypes.AIR || itemType.getId().contains("music_disc_"))) {
|
||||
if (itemType != null && itemType.getId() != null && (itemType == ItemTypes.AIR || itemType
|
||||
.getId().contains("music_disc_"))) {
|
||||
return new MusicFlag(ItemUtil.get(input));
|
||||
} else {
|
||||
throw new FlagParseException(this, input, Captions.FLAG_ERROR_MUSIC);
|
||||
|
@ -83,9 +83,7 @@ public class TitlesFlag extends PlotFlag<TitlesFlag.TitlesFlagValue, TitlesFlag>
|
||||
}
|
||||
|
||||
public enum TitlesFlagValue {
|
||||
NONE,
|
||||
TRUE,
|
||||
FALSE;
|
||||
NONE, TRUE, FALSE;
|
||||
|
||||
@Nullable public static TitlesFlagValue fromString(final String value) {
|
||||
if (value.equalsIgnoreCase("true")) {
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.plot.flag.implementations;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.PlotWeather;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -35,12 +35,9 @@ import java.util.Collection;
|
||||
|
||||
public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
||||
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN =
|
||||
new WeatherFlag(PlotWeather.RAIN);
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR =
|
||||
new WeatherFlag(PlotWeather.CLEAR);
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_OFF =
|
||||
new WeatherFlag(PlotWeather.RESET);
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = new WeatherFlag(PlotWeather.RAIN);
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = new WeatherFlag(PlotWeather.CLEAR);
|
||||
public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.RESET);
|
||||
|
||||
/**
|
||||
* Construct a new flag instance.
|
||||
@ -92,7 +89,8 @@ public class WeatherFlag extends PlotFlag<PlotWeather, WeatherFlag> {
|
||||
}
|
||||
|
||||
@Override public Collection<String> getTabCompletions() {
|
||||
return Arrays.asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset");
|
||||
return Arrays
|
||||
.asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,11 @@ public abstract class BlockTypeListFlag<F extends ListFlag<BlockTypeWrapper, F>>
|
||||
if (blockState == null) {
|
||||
// If it's not a block state, we assume it's a block category
|
||||
final BlockCategory blockCategory;
|
||||
if (!blockString.startsWith("#") || (blockCategory = BlockCategory.REGISTRY.get(blockString.substring(1))) == null) {
|
||||
throw new FlagParseException(this, blockString, Captions.FLAG_ERROR_INVALID_BLOCK);
|
||||
if (!blockString.startsWith("#")
|
||||
|| (blockCategory = BlockCategory.REGISTRY.get(blockString.substring(1)))
|
||||
== null) {
|
||||
throw new FlagParseException(this, blockString,
|
||||
Captions.FLAG_ERROR_INVALID_BLOCK);
|
||||
} else {
|
||||
blockTypeWrapper = BlockTypeWrapper.get(blockCategory);
|
||||
}
|
||||
@ -79,10 +82,12 @@ public abstract class BlockTypeListFlag<F extends ListFlag<BlockTypeWrapper, F>>
|
||||
|
||||
@Override public Collection<String> getTabCompletions() {
|
||||
final Collection<String> tabCompletions = new ArrayList<>();
|
||||
tabCompletions.addAll(BlockType.REGISTRY.keySet().stream().map(val -> val.replace("minecraft:", ""))
|
||||
.collect(Collectors.toList()));
|
||||
tabCompletions.addAll(BlockCategory.REGISTRY.keySet().stream().map(val -> "#" + val.replace("minecraft:", ""))
|
||||
.collect(Collectors.toList()));
|
||||
tabCompletions.addAll(
|
||||
BlockType.REGISTRY.keySet().stream().map(val -> val.replace("minecraft:", ""))
|
||||
.collect(Collectors.toList()));
|
||||
tabCompletions.addAll(
|
||||
BlockCategory.REGISTRY.keySet().stream().map(val -> "#" + val.replace("minecraft:", ""))
|
||||
.collect(Collectors.toList()));
|
||||
return tabCompletions;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,8 @@ import java.util.Map;
|
||||
* Container that class either contains a {@link BlockType}
|
||||
* or a {@link BlockCategory}
|
||||
*/
|
||||
@EqualsAndHashCode public class BlockTypeWrapper {
|
||||
@EqualsAndHashCode
|
||||
public class BlockTypeWrapper {
|
||||
|
||||
@Nullable @Getter private final BlockType blockType;
|
||||
@Nullable @Getter private final BlockCategory blockCategory;
|
||||
@ -63,7 +64,7 @@ import java.util.Map;
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
} else if(this.blockCategory != null) {
|
||||
} else if (this.blockCategory != null) {
|
||||
final String key = this.blockCategory.toString();
|
||||
if (key.startsWith("minecraft:")) {
|
||||
return '#' + key.substring(10);
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.plot.message;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.ChatManager;
|
||||
|
||||
public class PlotMessage {
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot.world;
|
||||
|
||||
import com.plotsquared.core.collection.QuadMap;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.collection.QuadMap;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public interface PlotAreaManager {
|
||||
* method assumes that the caller already knows that
|
||||
* the location belongs to a plot area, in which
|
||||
* case it will return the appropriate plot area.
|
||||
*
|
||||
* <p>
|
||||
* If the location does not belong to a plot area,
|
||||
* it may still return an area.
|
||||
*
|
||||
|
@ -25,12 +25,12 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot.world;
|
||||
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -25,25 +25,25 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot.world;
|
||||
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.ConfigurationNode;
|
||||
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.generator.GridPlotWorld;
|
||||
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.plot.PlotSettings;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.plot.SetupObject;
|
||||
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -197,8 +197,9 @@ public class SinglePlotArea extends GridPlotWorld {
|
||||
PlotSettings s = p.getSettings();
|
||||
|
||||
final FlagContainer oldContainer = p.getFlagContainer();
|
||||
p = new SinglePlot(p.getId(), p.getOwnerAbs(), p.getTrusted(), p.getMembers(), p.getDenied(),
|
||||
s.getAlias(), s.getPosition(), null, this, s.getMerged(), p.getTimestamp(), p.temp);
|
||||
p = new SinglePlot(p.getId(), p.getOwnerAbs(), p.getTrusted(), p.getMembers(),
|
||||
p.getDenied(), s.getAlias(), s.getPosition(), null, this, s.getMerged(),
|
||||
p.getTimestamp(), p.temp);
|
||||
p.getFlagContainer().addAll(oldContainer);
|
||||
|
||||
return p;
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot.world;
|
||||
|
||||
import com.plotsquared.core.collection.ArrayUtil;
|
||||
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.collection.ArrayUtil;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -27,11 +27,11 @@ package com.plotsquared.core.queue;
|
||||
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
@ -131,7 +131,8 @@ public abstract class LocalBlockQueue {
|
||||
.equals(loc)) {
|
||||
continue;
|
||||
}
|
||||
pLoc.setY(WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ()));
|
||||
pLoc.setY(
|
||||
WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ()));
|
||||
pp.teleport(pLoc);
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,8 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue
|
||||
private final int blockX;
|
||||
private final int blockZ;
|
||||
|
||||
public LocationOffsetDelegateLocalBlockQueue(final boolean[][] canPlace,
|
||||
final int blockX, final int blockZ,
|
||||
@Nullable LocalBlockQueue parent) {
|
||||
public LocationOffsetDelegateLocalBlockQueue(final boolean[][] canPlace, final int blockX,
|
||||
final int blockZ, @Nullable LocalBlockQueue parent) {
|
||||
super(parent);
|
||||
this.canPlace = canPlace;
|
||||
this.blockX = blockX;
|
||||
@ -62,8 +61,10 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue
|
||||
return super.setBlock(x, y, z, id);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
PlotSquared.debug(String.format("Failed to set block at: %d;%d;%d (to = %s) with offset %d;%d."
|
||||
+ " Translated to: %d;%d", x, y, z, id, blockX, blockZ, x - blockX, z - blockZ));
|
||||
PlotSquared.debug(String.format(
|
||||
"Failed to set block at: %d;%d;%d (to = %s) with offset %d;%d."
|
||||
+ " Translated to: %d;%d", x, y, z, id, blockX, blockZ, x - blockX,
|
||||
z - blockZ));
|
||||
throw e;
|
||||
}
|
||||
return false;
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.plot.message.PlotMessage;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.message.PlotMessage;
|
||||
|
||||
public abstract class ChatManager<T> {
|
||||
public static ChatManager<?> manager;
|
||||
|
@ -28,10 +28,10 @@ package com.plotsquared.core.util;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
|
@ -26,9 +26,9 @@
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import lombok.NonNull;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@ -42,7 +42,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
/**
|
||||
* 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;
|
||||
|
@ -25,7 +25,11 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.events.PlayerAutoPlotEvent;
|
||||
import com.plotsquared.core.events.PlayerClaimPlotEvent;
|
||||
import com.plotsquared.core.events.PlayerEnterPlotEvent;
|
||||
@ -46,10 +50,15 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||
import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.PlotRateEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.listener.PlayerBlockEventType;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DeviceInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.MiscPlaceFlag;
|
||||
@ -58,17 +67,8 @@ import com.plotsquared.core.plot.flag.implementations.PlaceFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.UseFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.VehiclePlaceFlag;
|
||||
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
||||
import com.plotsquared.core.listener.PlayerBlockEventType;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -241,7 +241,8 @@ public class EventDispatcher {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (Settings.Teleport.ON_LOGIN && plot != null && !(plot
|
||||
.getArea() instanceof SinglePlotArea)) {
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {}));
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {
|
||||
}));
|
||||
MainUtil.sendMessage(player,
|
||||
CaptionUtility.format(player, Captions.TELEPORTED_TO_ROAD.getTranslated())
|
||||
+ " (on-login) " + "(" + plot.getId().x + ";" + plot.getId().y + ")");
|
||||
@ -251,7 +252,8 @@ public class EventDispatcher {
|
||||
public void doRespawnTask(final PlotPlayer player) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (Settings.Teleport.ON_DEATH && plot != null) {
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {}));
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {
|
||||
}));
|
||||
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_ROAD);
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotInventory;
|
||||
import com.plotsquared.core.plot.PlotItemStack;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
|
||||
/**
|
||||
* This class is only used by internal functions, for most cases use the PlotInventory class
|
||||
|
@ -25,12 +25,12 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.plot.BlockBucket;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.plot.BlockBucket;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import lombok.NonNull;
|
||||
|
||||
@ -42,7 +42,8 @@ import java.util.Map;
|
||||
/**
|
||||
* Converts legacy configurations into the new (BlockBucket) format
|
||||
*/
|
||||
@SuppressWarnings("unused") public final class LegacyConverter {
|
||||
@SuppressWarnings("unused")
|
||||
public final class LegacyConverter {
|
||||
|
||||
public static final String CONFIGURATION_VERSION = "post_flattening";
|
||||
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
|
||||
@ -109,7 +110,8 @@ import java.util.Map;
|
||||
final BlockBucket bucket = this.blockToBucket(block);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(CaptionUtility
|
||||
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString()));
|
||||
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(),
|
||||
block, bucket.toString()));
|
||||
}
|
||||
|
||||
private void convertBlockList(@NonNull final ConfigurationSection section,
|
||||
@ -118,8 +120,8 @@ import java.util.Map;
|
||||
final BlockBucket bucket = this.blockListToBucket(blocks);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(CaptionUtility
|
||||
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks),
|
||||
bucket.toString()));
|
||||
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(),
|
||||
plotBlockArrayString(blocks), bucket.toString()));
|
||||
}
|
||||
|
||||
private String plotBlockArrayString(@NonNull final BlockState[] blocks) {
|
||||
|
@ -26,28 +26,27 @@
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.util.net.AbstractDelegateOutputStream;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.command.Like;
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
||||
import com.plotsquared.core.plot.flag.types.DoubleFlag;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotAreaTerrainType;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
||||
import com.plotsquared.core.plot.flag.types.DoubleFlag;
|
||||
import com.plotsquared.core.util.net.AbstractDelegateOutputStream;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
@ -59,11 +58,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@ -97,6 +94,7 @@ import java.util.stream.IntStream;
|
||||
public class MainUtil {
|
||||
|
||||
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
||||
|
||||
static {
|
||||
FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
|
||||
}
|
||||
@ -252,10 +250,12 @@ public class MainUtil {
|
||||
*/
|
||||
public static boolean resetBiome(PlotArea area, Location pos1, Location pos2) {
|
||||
BiomeType biome = area.getPlotBiome();
|
||||
if (!Objects.equals(WorldUtil.IMP.getBiomeSynchronous(area.getWorldName(), (pos1.getX() + pos2.getX()) / 2,
|
||||
(pos1.getZ() + pos2.getZ()) / 2), biome)) {
|
||||
MainUtil.setBiome(area.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(),
|
||||
biome);
|
||||
if (!Objects.equals(WorldUtil.IMP
|
||||
.getBiomeSynchronous(area.getWorldName(), (pos1.getX() + pos2.getX()) / 2,
|
||||
(pos1.getZ() + pos2.getZ()) / 2), biome)) {
|
||||
MainUtil
|
||||
.setBiome(area.getWorldName(), pos1.getX(), pos1.getZ(), pos2.getX(), pos2.getZ(),
|
||||
biome);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -656,8 +656,8 @@ public class MainUtil {
|
||||
.format(null, (prefix ? Captions.PREFIX.getTranslated() : "") + msg);
|
||||
PlotSquared.log(message);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
CaptionUtility.format(player, (prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg)));
|
||||
player.sendMessage(CaptionUtility.format(player,
|
||||
(prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -776,8 +776,8 @@ public class MainUtil {
|
||||
* @param full
|
||||
* @param whenDone
|
||||
*/
|
||||
public static void format(final String iInfo, final Plot plot, PlotPlayer player, final boolean full,
|
||||
final RunnableVal<String> whenDone) {
|
||||
public static void format(final String iInfo, final Plot plot, PlotPlayer player,
|
||||
final boolean full, final RunnableVal<String> whenDone) {
|
||||
int num = plot.getConnectedPlots().size();
|
||||
String alias = !plot.getAlias().isEmpty() ? plot.getAlias() : Captions.NONE.getTranslated();
|
||||
Location bot = plot.getCorners()[0];
|
||||
@ -820,16 +820,19 @@ public class MainUtil {
|
||||
} else {
|
||||
value = flag.toString();
|
||||
}
|
||||
flags.append(prefix).append(CaptionUtility.format(player, Captions.PLOT_FLAG_LIST.getTranslated(),
|
||||
flag.getName(), CaptionUtility.formatRaw(player, value.toString(), "")));
|
||||
flags.append(prefix).append(CaptionUtility
|
||||
.format(player, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
|
||||
CaptionUtility.formatRaw(player, value.toString(), "")));
|
||||
prefix = ", ";
|
||||
}
|
||||
}
|
||||
boolean build = plot.isAdded(player.getUUID());
|
||||
String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners());
|
||||
if (plot.getArea() != null) {
|
||||
info = info.replace("%area%", plot.getArea().getWorldName() +
|
||||
(plot.getArea().getId() == null ? "" : "(" + plot.getArea().getId() + ")"));
|
||||
info = info.replace("%area%",
|
||||
plot.getArea().getWorldName() + (plot.getArea().getId() == null ?
|
||||
"" :
|
||||
"(" + plot.getArea().getId() + ")"));
|
||||
} else {
|
||||
info = info.replace("%area%", Captions.NONE.getTranslated());
|
||||
}
|
||||
@ -941,9 +944,8 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
private static <T> T getValueFromConfig(ConfigurationSection config, String path,
|
||||
IntFunction<Optional<T>> intParser,
|
||||
Function<String, Optional<T>> textualParser,
|
||||
Supplier<T> defaultValue) {
|
||||
IntFunction<Optional<T>> intParser, Function<String, Optional<T>> textualParser,
|
||||
Supplier<T> defaultValue) {
|
||||
String value = config.getString(path);
|
||||
if (value == null) {
|
||||
return defaultValue.get();
|
||||
@ -955,16 +957,12 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static PlotAreaType getType(ConfigurationSection config) {
|
||||
return getValueFromConfig(config, "generator.type",
|
||||
PlotAreaType::fromLegacyInt,
|
||||
PlotAreaType::fromString,
|
||||
() -> PlotAreaType.NORMAL);
|
||||
return getValueFromConfig(config, "generator.type", PlotAreaType::fromLegacyInt,
|
||||
PlotAreaType::fromString, () -> PlotAreaType.NORMAL);
|
||||
}
|
||||
|
||||
public static PlotAreaTerrainType getTerrain(ConfigurationSection config) {
|
||||
return getValueFromConfig(config, "generator.terrain",
|
||||
PlotAreaTerrainType::fromLegacyInt,
|
||||
PlotAreaTerrainType::fromString,
|
||||
() -> PlotAreaTerrainType.NONE);
|
||||
return getValueFromConfig(config, "generator.terrain", PlotAreaTerrainType::fromLegacyInt,
|
||||
PlotAreaTerrainType::fromString, () -> PlotAreaTerrainType.NONE);
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
package com.plotsquared.core.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.plotsquared.core.command.Command;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -47,10 +47,8 @@ public class PatternUtil {
|
||||
|
||||
public static BaseBlock apply(@NotNull Pattern pattern, int x, int y, int z) {
|
||||
Preconditions.checkNotNull(pattern, "Pattern may not be null");
|
||||
if (pattern instanceof BlockPattern
|
||||
|| pattern instanceof RandomPattern
|
||||
|| pattern instanceof BlockState
|
||||
|| pattern instanceof BlockType
|
||||
if (pattern instanceof BlockPattern || pattern instanceof RandomPattern
|
||||
|| pattern instanceof BlockState || pattern instanceof BlockType
|
||||
|| pattern instanceof BaseBlock) {
|
||||
return pattern.apply(BlockVector3.ZERO);
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@RequiredArgsConstructor public class RuntimeExceptionRunnableVal<T> extends RunnableVal<RuntimeException> {
|
||||
@RequiredArgsConstructor
|
||||
public class RuntimeExceptionRunnableVal<T> extends RunnableVal<RuntimeException> {
|
||||
|
||||
private final RunnableVal<T> function;
|
||||
private final AtomicBoolean running;
|
||||
|
@ -31,11 +31,11 @@ import com.plotsquared.core.generator.ClassicPlotWorld;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.plot.schematic.Schematic;
|
||||
import com.plotsquared.core.queue.LocalBlockQueue;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.uuid.UUIDHandler;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
@ -205,7 +205,8 @@ public abstract class SchematicHandler {
|
||||
if (pw instanceof ClassicPlotWorld) {
|
||||
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||
} else {
|
||||
y_offset_actual = yOffset + 1 + WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(),
|
||||
y_offset_actual = yOffset + 1 + WorldUtil.IMP
|
||||
.getHighestBlockSynchronous(plot.getWorldName(),
|
||||
region.getMinimumPoint().getX() + 1,
|
||||
region.getMinimumPoint().getZ() + 1);
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.NoWorldeditFlag;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.NoWorldeditFlag;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
|
||||
|
@ -27,8 +27,8 @@ package com.plotsquared.core.util;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
@ -70,8 +70,7 @@ public abstract class WorldUtil {
|
||||
/**
|
||||
* @deprecated May result in synchronous chunk loading
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract String[] getSignSynchronous(Location location);
|
||||
@Deprecated public abstract String[] getSignSynchronous(Location location);
|
||||
|
||||
public abstract Location getSpawn(String world);
|
||||
|
||||
@ -90,24 +89,21 @@ public abstract class WorldUtil {
|
||||
/**
|
||||
* @deprecated May result in synchronous chunk loading
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract BiomeType getBiomeSynchronous(String world, int x, int z);
|
||||
@Deprecated public abstract BiomeType getBiomeSynchronous(String world, int x, int z);
|
||||
|
||||
public abstract void getBlock(Location location, Consumer<BlockState> result);
|
||||
|
||||
/**
|
||||
* @deprecated May result in synchronous chunk loading
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract BlockState getBlockSynchronous(Location location);
|
||||
@Deprecated public abstract BlockState getBlockSynchronous(Location location);
|
||||
|
||||
public abstract void getHighestBlock(String world, int x, int z, final IntConsumer result);
|
||||
|
||||
/**
|
||||
* @deprecated May result in synchronous chunk loading
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract int getHighestBlockSynchronous(String world, int x, int z);
|
||||
@Deprecated public abstract int getHighestBlockSynchronous(String world, int x, int z);
|
||||
|
||||
public abstract void setSign(String world, int x, int y, int z, String[] lines);
|
||||
|
||||
@ -115,7 +111,8 @@ public abstract class WorldUtil {
|
||||
|
||||
public abstract com.sk89q.worldedit.world.World getWeWorld(String world);
|
||||
|
||||
public void upload(@NotNull final Plot plot, UUID uuid, String file, RunnableVal<URL> whenDone) {
|
||||
public void upload(@NotNull final Plot plot, UUID uuid, String file,
|
||||
RunnableVal<URL> whenDone) {
|
||||
plot.getHome(home -> MainUtil.upload(uuid, file, "zip", new RunnableVal<OutputStream>() {
|
||||
@Override public void run(OutputStream output) {
|
||||
try (final ZipOutputStream zos = new ZipOutputStream(output)) {
|
||||
|
@ -30,22 +30,22 @@ package com.plotsquared.core.util.entity;
|
||||
*/
|
||||
public class EntityCategories {
|
||||
|
||||
public static final int CAP_ENTITY = 0;
|
||||
public static final int CAP_ANIMAL = 1;
|
||||
public static final int CAP_ENTITY = 0;
|
||||
public static final int CAP_ANIMAL = 1;
|
||||
public static final int CAP_MONSTER = 2;
|
||||
public static final int CAP_MOB = 3;
|
||||
public static final int CAP_MOB = 3;
|
||||
public static final int CAP_VEHICLE = 4;
|
||||
public static final int CAP_MISC = 5;
|
||||
public static final int CAP_MISC = 5;
|
||||
|
||||
public static final EntityCategory ANIMAL = register("animal");
|
||||
public static final EntityCategory TAMEABLE = register("tameable");
|
||||
public static final EntityCategory VEHICLE = register("vehicle");
|
||||
public static final EntityCategory HOSTILE = register("hostile");
|
||||
public static final EntityCategory HANGING = register("hanging");
|
||||
public static final EntityCategory VILLAGER = register("villager");
|
||||
public static final EntityCategory PROJECTILE = register("projectile");
|
||||
public static final EntityCategory OTHER = register("other");
|
||||
public static final EntityCategory PLAYER = register("player");
|
||||
public static final EntityCategory ANIMAL = register("animal");
|
||||
public static final EntityCategory TAMEABLE = register("tameable");
|
||||
public static final EntityCategory VEHICLE = register("vehicle");
|
||||
public static final EntityCategory HOSTILE = register("hostile");
|
||||
public static final EntityCategory HANGING = register("hanging");
|
||||
public static final EntityCategory VILLAGER = register("villager");
|
||||
public static final EntityCategory PROJECTILE = register("projectile");
|
||||
public static final EntityCategory OTHER = register("other");
|
||||
public static final EntityCategory PLAYER = register("player");
|
||||
|
||||
public static EntityCategory register(final String id) {
|
||||
final EntityCategory entityCategory = new EntityCategory(id);
|
||||
@ -53,6 +53,7 @@ public class EntityCategories {
|
||||
return entityCategory;
|
||||
}
|
||||
|
||||
public static void init() {}
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ import java.util.Set;
|
||||
*/
|
||||
public class EntityCategory extends Category<EntityType> implements Keyed {
|
||||
|
||||
public static final NamespacedRegistry<EntityCategory> REGISTRY = new NamespacedRegistry<>("entity type");
|
||||
public static final NamespacedRegistry<EntityCategory> REGISTRY =
|
||||
new NamespacedRegistry<>("entity type");
|
||||
|
||||
private final String key;
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.util.net;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
@ -44,7 +44,8 @@ import java.util.Locale;
|
||||
/**
|
||||
* Single class paster for the Incendo paste service
|
||||
*/
|
||||
@SuppressWarnings({"unused", "WeakerAccess"}) public final class IncendoPaster {
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public final class IncendoPaster {
|
||||
|
||||
/**
|
||||
* Upload service URL
|
||||
|
@ -32,14 +32,15 @@ import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import static com.plotsquared.core.util.MainUtil.sendMessage;
|
||||
|
||||
@RequiredArgsConstructor public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||
@RequiredArgsConstructor
|
||||
public final class AutoClaimFinishTask extends RunnableVal<Object> {
|
||||
|
||||
private final PlotPlayer player;
|
||||
private final Plot plot;
|
||||
@ -62,8 +63,7 @@ import static com.plotsquared.core.util.MainUtil.sendMessage;
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
sendMessage(player, Captions.EVENT_DENIED, "Auto merge");
|
||||
} else {
|
||||
plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(),
|
||||
true);
|
||||
plot.autoMerge(event.getDir(), event.getMax(), player.getUUID(), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -29,7 +29,8 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@RequiredArgsConstructor public class ObjectTaskRunnable<T> implements Runnable {
|
||||
@RequiredArgsConstructor
|
||||
public class ObjectTaskRunnable<T> implements Runnable {
|
||||
|
||||
private final Iterator<T> iterator;
|
||||
private final RunnableVal<T> task;
|
||||
|
@ -131,8 +131,8 @@ public abstract class TaskManager {
|
||||
return function.value;
|
||||
}
|
||||
final AtomicBoolean running = new AtomicBoolean(true);
|
||||
final RuntimeExceptionRunnableVal<T>
|
||||
run = new RuntimeExceptionRunnableVal<>(function, running);
|
||||
final RuntimeExceptionRunnableVal<T> run =
|
||||
new RuntimeExceptionRunnableVal<>(function, running);
|
||||
TaskManager.IMP.task(run);
|
||||
try {
|
||||
synchronized (function) {
|
||||
|
@ -25,14 +25,14 @@
|
||||
*/
|
||||
package com.plotsquared.core.util.uuid;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.OfflinePlotPlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.StringWrapper;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -25,20 +25,20 @@
|
||||
*/
|
||||
package com.plotsquared.core.util.uuid;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.OfflinePlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.StringWrapper;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
Reference in New Issue
Block a user