mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Reformat Plot after the owner changes. It was a bit too messy.
This commit is contained in:
parent
ce756411cf
commit
474795367e
@ -90,16 +90,10 @@ public class Plot {
|
|||||||
private static Set<CuboidRegion> regions_cache;
|
private static Set<CuboidRegion> regions_cache;
|
||||||
|
|
||||||
@NotNull private final PlotId id;
|
@NotNull private final PlotId id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot owner
|
* Plot flag container
|
||||||
* (Merged plots can have multiple owners)
|
|
||||||
* Direct access is Deprecated: use getOwners()
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
private UUID owner;
|
@Getter private final FlagContainer flagContainer = new FlagContainer(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the plot changed since the last save cycle?
|
* Has the plot changed since the last save cycle?
|
||||||
*/
|
*/
|
||||||
@ -113,55 +107,50 @@ public class Plot {
|
|||||||
* @deprecated magical
|
* @deprecated magical
|
||||||
*/
|
*/
|
||||||
@Deprecated public int temp;
|
@Deprecated public int temp;
|
||||||
|
/**
|
||||||
|
* plot owner
|
||||||
|
* (Merged plots can have multiple owners)
|
||||||
|
* Direct access is Deprecated: use getOwners()
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
private UUID owner;
|
||||||
/**
|
/**
|
||||||
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
|
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
|
||||||
* - Milliseconds since the epoch<br>
|
* - Milliseconds since the epoch<br>
|
||||||
*/
|
*/
|
||||||
private long timestamp;
|
private long timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of trusted (with plot permissions).
|
* List of trusted (with plot permissions).
|
||||||
*/
|
*/
|
||||||
private HashSet<UUID> trusted;
|
private HashSet<UUID> trusted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of members users (with plot permissions).
|
* List of members users (with plot permissions).
|
||||||
*/
|
*/
|
||||||
private HashSet<UUID> members;
|
private HashSet<UUID> members;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of denied players.
|
* List of denied players.
|
||||||
*/
|
*/
|
||||||
private HashSet<UUID> denied;
|
private HashSet<UUID> denied;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External settings class.
|
* External settings class.
|
||||||
* - Please favor the methods over direct access to this class<br>
|
* - Please favor the methods over direct access to this class<br>
|
||||||
* - The methods are more likely to be left unchanged from version changes<br>
|
* - The methods are more likely to be left unchanged from version changes<br>
|
||||||
*/
|
*/
|
||||||
private PlotSettings settings;
|
private PlotSettings settings;
|
||||||
|
|
||||||
private PlotArea area;
|
private PlotArea area;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session only plot metadata (session is until the server stops)<br>
|
* Session only plot metadata (session is until the server stops)<br>
|
||||||
* <br>
|
* <br>
|
||||||
* For persistent metadata use the flag system
|
* For persistent metadata use the flag system
|
||||||
*/
|
*/
|
||||||
private ConcurrentHashMap<String, Object> meta;
|
private ConcurrentHashMap<String, Object> meta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cached origin plot.
|
* The cached origin plot.
|
||||||
* - The origin plot is used for plot grouping and relational data
|
* - The origin plot is used for plot grouping and relational data
|
||||||
*/
|
*/
|
||||||
private Plot origin;
|
private Plot origin;
|
||||||
|
|
||||||
/**
|
|
||||||
* Plot flag container
|
|
||||||
*/
|
|
||||||
@Getter private final FlagContainer flagContainer = new FlagContainer(null);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a new plot.
|
* Constructor for a new plot.
|
||||||
* (Only changes after plot.create() will be properly set in the database)
|
* (Only changes after plot.create() will be properly set in the database)
|
||||||
@ -289,10 +278,10 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Get the owner of this exact plot, as it is
|
* Get the owner of this exact plot, as it is
|
||||||
* stored in the database.
|
* stored in the database.
|
||||||
*
|
* <p>
|
||||||
* If the plot is a mega-plot, then the method returns
|
* If the plot is a mega-plot, then the method returns
|
||||||
* the owner of this particular subplot.
|
* the owner of this particular subplot.
|
||||||
*
|
* <p>
|
||||||
* Unlike {@link #getOwner()} this method does not
|
* Unlike {@link #getOwner()} this method does not
|
||||||
* consider factors such as {@link com.github.intellectualsites.plotsquared.plot.flags.implementations.ServerPlotFlag}
|
* consider factors such as {@link com.github.intellectualsites.plotsquared.plot.flags.implementations.ServerPlotFlag}
|
||||||
* that could alter the de facto owner of the plot.
|
* that could alter the de facto owner of the plot.
|
||||||
@ -426,10 +415,10 @@ public class Plot {
|
|||||||
* (Merged plots can have multiple owners)
|
* (Merged plots can have multiple owners)
|
||||||
* Direct access is Deprecated: use getOwners()
|
* Direct access is Deprecated: use getOwners()
|
||||||
*
|
*
|
||||||
|
* @see #getOwnerAbs() getOwnerAbs() to get the owner as stored in the database
|
||||||
* @deprecated A mega-plot may have multiple owners
|
* @deprecated A mega-plot may have multiple owners
|
||||||
* and this method only considers the
|
* and this method only considers the
|
||||||
* owner of this particular sub-plot.
|
* owner of this particular sub-plot.
|
||||||
* @see #getOwnerAbs() getOwnerAbs() to get the owner as stored in the database
|
|
||||||
*/
|
*/
|
||||||
@Deprecated public UUID getOwner() {
|
@Deprecated public UUID getOwner() {
|
||||||
if (MainUtil.isServerOwned(this)) {
|
if (MainUtil.isServerOwned(this)) {
|
||||||
@ -1088,7 +1077,9 @@ public class Plot {
|
|||||||
"%plr%", name),
|
"%plr%", name),
|
||||||
Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll(
|
Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll(
|
||||||
"%plr%", name)};
|
"%plr%", name)};
|
||||||
WorldUtil.IMP.setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(), lines);
|
WorldUtil.IMP
|
||||||
|
.setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(),
|
||||||
|
lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1378,8 +1369,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated public Location getCenterSynchronous() {
|
||||||
public Location getCenterSynchronous() {
|
|
||||||
Location[] corners = getCorners();
|
Location[] corners = getCorners();
|
||||||
Location top = corners[0];
|
Location top = corners[0];
|
||||||
Location bot = corners[1];
|
Location bot = corners[1];
|
||||||
@ -1389,7 +1379,8 @@ public class Plot {
|
|||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
int y = WorldUtil.IMP.getHighestBlockSynchronous(getWorldName(), location.getX(), location.getZ());
|
int y = WorldUtil.IMP
|
||||||
|
.getHighestBlockSynchronous(getWorldName(), location.getX(), location.getZ());
|
||||||
if (area.allowSigns()) {
|
if (area.allowSigns()) {
|
||||||
y = Math.max(y, getManager().getSignLoc(this).getY());
|
y = Math.max(y, getManager().getSignLoc(this).getY());
|
||||||
}
|
}
|
||||||
@ -1400,8 +1391,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated public Location getSideSynchronous() {
|
||||||
public Location getSideSynchronous() {
|
|
||||||
CuboidRegion largest = getLargestRegion();
|
CuboidRegion largest = getLargestRegion();
|
||||||
int x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1)
|
int x = (largest.getMaximumPoint().getX() >> 1) - (largest.getMinimumPoint().getX() >> 1)
|
||||||
+ largest.getMinimumPoint().getX();
|
+ largest.getMinimumPoint().getX();
|
||||||
@ -1440,8 +1430,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loading
|
* @deprecated May cause synchronous chunk loading
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated public Location getHomeSynchronous() {
|
||||||
public Location getHomeSynchronous() {
|
|
||||||
BlockLoc home = this.getPosition();
|
BlockLoc home = this.getPosition();
|
||||||
if (home == null || home.getX() == 0 && home.getZ() == 0) {
|
if (home == null || home.getX() == 0 && home.getZ() == 0) {
|
||||||
return this.getDefaultHomeSynchronous(true);
|
return this.getDefaultHomeSynchronous(true);
|
||||||
@ -1455,8 +1444,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
if (!WorldUtil.IMP.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
if (!WorldUtil.IMP.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
||||||
location.setY(Math.max(1 + WorldUtil.IMP
|
location.setY(Math.max(1 + WorldUtil.IMP
|
||||||
.getHighestBlockSynchronous(this.getWorldName(), location.getX(), location.getZ()),
|
.getHighestBlockSynchronous(this.getWorldName(), location.getX(),
|
||||||
bottom.getY()));
|
location.getZ()), bottom.getY()));
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
@ -1481,9 +1470,9 @@ public class Plot {
|
|||||||
WorldUtil.IMP.getBlock(location, block -> {
|
WorldUtil.IMP.getBlock(location, block -> {
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
WorldUtil.IMP
|
WorldUtil.IMP
|
||||||
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(), y -> {
|
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||||
location.setY(Math.max(1 + y,
|
y -> {
|
||||||
bottom.getY()));
|
location.setY(Math.max(1 + y, bottom.getY()));
|
||||||
result.accept(location);
|
result.accept(location);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -1524,8 +1513,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated public Location getDefaultHomeSynchronous(final boolean member) {
|
||||||
public Location getDefaultHomeSynchronous(final boolean member) {
|
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
|
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
@ -1545,7 +1533,9 @@ public class Plot {
|
|||||||
z = bot.getZ() + loc.getZ();
|
z = bot.getZ() + loc.getZ();
|
||||||
}
|
}
|
||||||
int y = loc.getY() < 1 ?
|
int y = loc.getY() < 1 ?
|
||||||
(isLoaded() ? WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 : 63) :
|
(isLoaded() ?
|
||||||
|
WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 :
|
||||||
|
63) :
|
||||||
loc.getY();
|
loc.getY();
|
||||||
return new Location(plot.getWorldName(), x, y, z);
|
return new Location(plot.getWorldName(), x, y, z);
|
||||||
}
|
}
|
||||||
@ -1574,8 +1564,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
if (loc.getY() < 1) {
|
if (loc.getY() < 1) {
|
||||||
if (isLoaded()) {
|
if (isLoaded()) {
|
||||||
WorldUtil.IMP.getHighestBlock(plot.getWorldName(), x, z, y ->
|
WorldUtil.IMP.getHighestBlock(plot.getWorldName(), x, z,
|
||||||
result.accept(new Location(plot.getWorldName(), x, y + 1, z)));
|
y -> result.accept(new Location(plot.getWorldName(), x, y + 1, z)));
|
||||||
} else {
|
} else {
|
||||||
result.accept(new Location(plot.getWorldName(), x, 63, z));
|
result.accept(new Location(plot.getWorldName(), x, 63, z));
|
||||||
}
|
}
|
||||||
@ -1737,8 +1727,8 @@ public class Plot {
|
|||||||
|
|
||||||
public boolean claim(final PlotPlayer player, boolean teleport, String schematic) {
|
public boolean claim(final PlotPlayer player, boolean teleport, String schematic) {
|
||||||
if (!canClaim(player)) {
|
if (!canClaim(player)) {
|
||||||
PlotSquared.debug(Captions.PREFIX.getTranslated() +
|
PlotSquared.debug(Captions.PREFIX.getTranslated() + String
|
||||||
String.format("Player %s attempted to claim plot %s, but was not allowed",
|
.format("Player %s attempted to claim plot %s, but was not allowed",
|
||||||
player.getName(), this.getId().toCommaSeparatedString()));
|
player.getName(), this.getId().toCommaSeparatedString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1750,8 +1740,8 @@ public class Plot {
|
|||||||
|
|
||||||
if (updateDB) {
|
if (updateDB) {
|
||||||
if (!create(player.getUUID(), true)) {
|
if (!create(player.getUUID(), true)) {
|
||||||
PlotSquared.debug(Captions.PREFIX.getTranslated() +
|
PlotSquared.debug(Captions.PREFIX.getTranslated() + String.format(
|
||||||
String.format("Player %s attempted to claim plot %s, but the database failed to update",
|
"Player %s attempted to claim plot %s, but the database failed to update",
|
||||||
player.getName(), this.getId().toCommaSeparatedString()));
|
player.getName(), this.getId().toCommaSeparatedString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1761,7 +1751,8 @@ public class Plot {
|
|||||||
setSign(player.getName());
|
setSign(player.getName());
|
||||||
MainUtil.sendMessage(player, Captions.CLAIMED);
|
MainUtil.sendMessage(player, Captions.CLAIMED);
|
||||||
if (teleport && Settings.Teleport.ON_CLAIM) {
|
if (teleport && Settings.Teleport.ON_CLAIM) {
|
||||||
teleportPlayer(player, TeleportCause.COMMAND, result -> {});
|
teleportPlayer(player, TeleportCause.COMMAND, result -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
PlotArea plotworld = getArea();
|
PlotArea plotworld = getArea();
|
||||||
if (plotworld.isSchematicOnClaim()) {
|
if (plotworld.isSchematicOnClaim()) {
|
||||||
@ -1838,8 +1829,8 @@ public class Plot {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() +
|
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
|
||||||
String.format("Failed to add plot %s to plot area %s", this.getId().toCommaSeparatedString(),
|
.format("Failed to add plot %s to plot area %s", this.getId().toCommaSeparatedString(),
|
||||||
this.area.toString()));
|
this.area.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1862,17 +1853,17 @@ public class Plot {
|
|||||||
* @return the name of the biome
|
* @return the name of the biome
|
||||||
*/
|
*/
|
||||||
public void getBiome(Consumer<BiomeType> result) {
|
public void getBiome(Consumer<BiomeType> result) {
|
||||||
this.getCenter(location ->
|
this.getCenter(location -> WorldUtil.IMP
|
||||||
WorldUtil.IMP.getBiome(location.getWorld(), location.getX(), location.getZ(), result));
|
.getBiome(location.getWorld(), location.getX(), location.getZ(), result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated public BiomeType getBiomeSynchronous() {
|
||||||
public BiomeType getBiomeSynchronous() {
|
|
||||||
final Location location = this.getCenterSynchronous();
|
final Location location = this.getCenterSynchronous();
|
||||||
return WorldUtil.IMP.getBiomeSynchronous(location.getWorld(), location.getX(), location.getZ());
|
return WorldUtil.IMP
|
||||||
|
.getBiomeSynchronous(location.getWorld(), location.getX(), location.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Better documentation needed.
|
//TODO Better documentation needed.
|
||||||
@ -2020,14 +2011,16 @@ public class Plot {
|
|||||||
* - Used when a plot is merged<br>
|
* - Used when a plot is merged<br>
|
||||||
*/
|
*/
|
||||||
public void removeRoadEast() {
|
public void removeRoadEast() {
|
||||||
if (this.area.getType() != PlotAreaType.NORMAL && this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
if (this.area.getType() != PlotAreaType.NORMAL
|
||||||
|
&& this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
||||||
Plot other = this.getRelative(Direction.EAST);
|
Plot other = this.getRelative(Direction.EAST);
|
||||||
Location bot = other.getBottomAbs();
|
Location bot = other.getBottomAbs();
|
||||||
Location top = this.getTopAbs();
|
Location top = this.getTopAbs();
|
||||||
Location pos1 = new Location(this.getWorldName(), top.getX(), 0, bot.getZ());
|
Location pos1 = new Location(this.getWorldName(), top.getX(), 0, bot.getZ());
|
||||||
Location pos2 = new Location(this.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
Location pos2 = new Location(this.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
||||||
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.area.getTerrain()
|
||||||
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.area.getPlotManager().removeRoadEast(this);
|
this.area.getPlotManager().removeRoadEast(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2465,14 +2458,16 @@ public class Plot {
|
|||||||
* - Used when a plot is merged<br>
|
* - Used when a plot is merged<br>
|
||||||
*/
|
*/
|
||||||
public void removeRoadSouth() {
|
public void removeRoadSouth() {
|
||||||
if (this.area.getType() != PlotAreaType.NORMAL && this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
if (this.area.getType() != PlotAreaType.NORMAL
|
||||||
|
&& this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
||||||
Plot other = this.getRelative(Direction.SOUTH);
|
Plot other = this.getRelative(Direction.SOUTH);
|
||||||
Location bot = other.getBottomAbs();
|
Location bot = other.getBottomAbs();
|
||||||
Location top = this.getTopAbs();
|
Location top = this.getTopAbs();
|
||||||
Location pos1 = new Location(this.getWorldName(), bot.getX(), 0, top.getZ());
|
Location pos1 = new Location(this.getWorldName(), bot.getX(), 0, top.getZ());
|
||||||
Location pos2 = new Location(this.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
Location pos2 = new Location(this.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
||||||
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.area.getTerrain()
|
||||||
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.getManager().removeRoadSouth(this);
|
this.getManager().removeRoadSouth(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2641,14 +2636,16 @@ public class Plot {
|
|||||||
* Remove the SE road (only effects terrain)
|
* Remove the SE road (only effects terrain)
|
||||||
*/
|
*/
|
||||||
public void removeRoadSouthEast() {
|
public void removeRoadSouthEast() {
|
||||||
if (this.area.getType() != PlotAreaType.NORMAL && this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
if (this.area.getType() != PlotAreaType.NORMAL
|
||||||
|
&& this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
||||||
Plot other = this.getRelative(1, 1);
|
Plot other = this.getRelative(1, 1);
|
||||||
Location pos1 = this.getTopAbs().add(1, 0, 1);
|
Location pos1 = this.getTopAbs().add(1, 0, 1);
|
||||||
Location pos2 = other.getBottomAbs().subtract(1, 0, 1);
|
Location pos2 = other.getBottomAbs().subtract(1, 0, 1);
|
||||||
pos1.setY(0);
|
pos1.setY(0);
|
||||||
pos2.setY(MAX_HEIGHT);
|
pos2.setY(MAX_HEIGHT);
|
||||||
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
ChunkManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain() != PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
} else if (this.area.getTerrain()
|
||||||
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
this.area.getPlotManager().removeRoadSouthEast(this);
|
this.area.getPlotManager().removeRoadSouthEast(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2789,8 +2786,8 @@ public class Plot {
|
|||||||
if (current.getOwnerAbs() == null || current.settings == null) {
|
if (current.getOwnerAbs() == null || current.settings == null) {
|
||||||
// Invalid plot
|
// Invalid plot
|
||||||
// merged onto unclaimed plot
|
// merged onto unclaimed plot
|
||||||
PlotSquared
|
PlotSquared.debug(
|
||||||
.debug("Ignoring invalid merged plot: " + current + " | " + current.getOwnerAbs());
|
"Ignoring invalid merged plot: " + current + " | " + current.getOwnerAbs());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpSet.add(current);
|
tmpSet.add(current);
|
||||||
@ -3045,23 +3042,27 @@ public class Plot {
|
|||||||
* @param cause the cause of the teleport
|
* @param cause the cause of the teleport
|
||||||
* @return if the teleport succeeded
|
* @return if the teleport succeeded
|
||||||
*/
|
*/
|
||||||
public void teleportPlayer(final PlotPlayer player, TeleportCause cause, Consumer<Boolean> resultConsumer) {
|
public void teleportPlayer(final PlotPlayer player, TeleportCause cause,
|
||||||
|
Consumer<Boolean> resultConsumer) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
Result result =
|
Result result =
|
||||||
PlotSquared.get().getEventDispatcher().callTeleport(player, player.getLocation(), plot).getEventResult();
|
PlotSquared.get().getEventDispatcher().callTeleport(player, player.getLocation(), plot)
|
||||||
|
.getEventResult();
|
||||||
if (result == Result.DENY) {
|
if (result == Result.DENY) {
|
||||||
sendMessage(player, Captions.EVENT_DENIED, "Teleport");
|
sendMessage(player, Captions.EVENT_DENIED, "Teleport");
|
||||||
resultConsumer.accept(false);
|
resultConsumer.accept(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Consumer<Location> locationConsumer = location -> {
|
final Consumer<Location> locationConsumer = location -> {
|
||||||
if (Settings.Teleport.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) {
|
if (Settings.Teleport.DELAY == 0 || Permissions
|
||||||
|
.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||||
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
||||||
player.teleport(location, cause);
|
player.teleport(location, cause);
|
||||||
resultConsumer.accept(true);
|
resultConsumer.accept(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
|
MainUtil
|
||||||
|
.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
|
||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
TaskManager.TELEPORT_QUEUE.add(name);
|
TaskManager.TELEPORT_QUEUE.add(name);
|
||||||
TaskManager.runTaskLater(() -> {
|
TaskManager.runTaskLater(() -> {
|
||||||
@ -3114,7 +3115,8 @@ public class Plot {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean setComponent(String component, Pattern blocks) {
|
public boolean setComponent(String component, Pattern blocks) {
|
||||||
PlotComponentSetEvent event = PlotSquared.get().getEventDispatcher().callComponentSet(this, component, blocks);
|
PlotComponentSetEvent event =
|
||||||
|
PlotSquared.get().getEventDispatcher().callComponentSet(this, component, blocks);
|
||||||
component = event.getComponent();
|
component = event.getComponent();
|
||||||
blocks = event.getPattern();
|
blocks = event.getPattern();
|
||||||
return this.getManager().setComponent(this.getId(), component, blocks);
|
return this.getManager().setComponent(this.getId(), component, blocks);
|
||||||
@ -3212,7 +3214,8 @@ public class Plot {
|
|||||||
* @param allowSwap whether to swap plots
|
* @param allowSwap whether to swap plots
|
||||||
* @return success
|
* @return success
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Boolean> move(final Plot destination, final Runnable whenDone, boolean allowSwap) {
|
public CompletableFuture<Boolean> move(final Plot destination, final Runnable whenDone,
|
||||||
|
boolean allowSwap) {
|
||||||
final PlotId offset = new PlotId(destination.getId().x - this.getId().x,
|
final PlotId offset = new PlotId(destination.getId().x - this.getId().x,
|
||||||
destination.getId().y - this.getId().y);
|
destination.getId().y - this.getId().y);
|
||||||
Location db = destination.getBottomAbs();
|
Location db = destination.getBottomAbs();
|
||||||
@ -3293,7 +3296,8 @@ public class Plot {
|
|||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (regions.isEmpty()) {
|
if (regions.isEmpty()) {
|
||||||
Plot plot = destination.getRelative(0, 0);
|
Plot plot = destination.getRelative(0, 0);
|
||||||
Plot originPlot = originArea.getPlotAbs(new PlotId(plot.id.x - offset.x, plot.id.y - offset.y));
|
Plot originPlot = originArea
|
||||||
|
.getPlotAbs(new PlotId(plot.id.x - offset.x, plot.id.y - offset.y));
|
||||||
final Runnable clearDone = () -> {
|
final Runnable clearDone = () -> {
|
||||||
for (final Plot current : plot.getConnectedPlots()) {
|
for (final Plot current : plot.getConnectedPlots()) {
|
||||||
getManager().claimPlot(current);
|
getManager().claimPlot(current);
|
||||||
|
Loading…
Reference in New Issue
Block a user