Compare commits

...

23 Commits
6.1.3 ... 6.1.4

Author SHA1 Message Date
4eafd043a3 Release 6.1.4 2021-11-11 22:49:46 +01:00
826cc8c835 build: Update Gradle 2021-11-11 22:43:48 +01:00
d1dbf777a4 Don't check/set if a chunk should be saved if it's a world-plot 2021-11-11 17:57:59 +00:00
823e78377b feat: Better deciding of heights to use for generation and schematics (#3300)
* Better deciding of heights to use for generation and schematics
 - If bedrock is disabled, we should still be filling the space with something
 - Use minBuildHeight instead of hardcoding "1" for schematics (it is still 1 by default) to ensure all-encompassing schematics
 - Schematic generation/handling for roads etc. should be accounting for all of wall, road, and plot heights for deciding point of origin
 - Fixes #3269
 - Starts to address #3175

* Also do for HybridPlotManager clear
2021-11-11 17:33:38 +00:00
87a2e81ec3 Don't write biome data to schematics if it's not present 2021-11-10 19:51:14 +00:00
88775334b7 Schematic paths are configurable (#3303) 2021-11-09 10:32:07 +00:00
e126547e97 chore: Update com.fastasyncworldedit to v1.17-390 (#3324)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-09 10:00:14 +01:00
c1163cdb2e feat: Split configuration for teleport on claim/auto (#3308)
- Fixes #2953
2021-11-07 22:29:49 +01:00
30d06b7801 build: Reduce consumer dependencies 2021-11-05 11:57:58 +01:00
a5cf7bf2c2 Fix BlockLoc to the requirements for use as a home location
- Add home locations to #fromString
 - Switch to y=Integer#minValue more
 - May help with #3321
2021-11-04 20:47:56 +00:00
3d4d413de8 Minor adjustment to plot home location logic
- Allow "centre" spelling
 - ClassicPlotWorld contains the PLOT_HEIGHT config setting, not HPW
2021-11-02 15:41:16 +00:00
b97e843849 perf: Get rid of Guice overhead when accessing the plot area manager (#3315)
Fixes #3311
Co-authored-by: Jordan <dordsor21@gmail.com>
2021-11-02 13:38:48 +00:00
48c7a3e94e refactor: Use player friendly done message on restricted building (#3309) 2021-11-02 13:32:04 +00:00
7263290bbe fix: Untrusted visit flag not working with untrusted visit permission
Fixes #3317 
Co-authored-by: Alex <mc.cache@web.de>
2021-11-02 13:28:39 +00:00
e99c4e3289 chore: Update dependency org.checkerframework:checker-qual to v3.19.0 (#3320)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 21:51:53 +01:00
87cb26189f Closes #3313 2021-11-01 14:07:44 +01:00
2dae336a5f chore: Update com.fastasyncworldedit to v1.17-380 (#3312)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:47 +01:00
258ed1469b chore: Update dependency net.kyori:adventure-api to v4.9.3 (#3314)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:40 +01:00
6f3eabba0e feat: Don't display the default plot title if on a server-plot, unless configured otherwise. (#3305)
- If plot-title flag is set, title will still be displayed.
2021-11-01 11:23:53 +00:00
804228fa6c Allow pitch and yaw to be used in default home location (#3304) 2021-10-29 10:48:35 +01:00
be85708e5a feat: Add border bypass permission (#3302)
* Add border bypass permission
 - Fixes #3297

* Add permission to plots.admin permpack

* Implement messages on leaving/entering border area

* Rename to border.denied and make border msg red

* change too le/ge as tthey are likely to be equal to border when hit.
 - Since we check for being across the border beforehand, it will hopefully not be spammed too much?
 - If it's spammed then either we use meta to set if a player's left the border, or we just remove the come-back-in altogether because it's a little looong
2021-10-28 10:13:36 +02:00
f2368f97df chore: Update com.sk89q.worldedit to v7.2.7 (#3299)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-25 11:22:31 +02:00
df87bcb743 build: Back to snapshot for development 2021-10-18 20:30:28 +02:00
39 changed files with 413 additions and 251 deletions

View File

@ -24,7 +24,7 @@ dependencies {
implementation(libs.bstats)
// Paper
compileOnlyApi(libs.paper)
compileOnly(libs.paper)
implementation(libs.paperlib)
// Plugins
@ -32,7 +32,7 @@ dependencies {
exclude(group = "org.bukkit")
exclude(group = "org.spigotmc")
}
compileOnlyApi(libs.fastasyncworldeditBukkit) { isTransitive = false }
compileOnly(libs.fastasyncworldeditBukkit) { isTransitive = false }
testImplementation(libs.fastasyncworldeditBukkit) { isTransitive = false }
compileOnly(libs.vault) {
exclude(group = "org.bukkit")

View File

@ -1180,6 +1180,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return this.injector;
}
@Override
public @NonNull PlotAreaManager plotAreaManager() {
return this.plotAreaManager;
}
@NonNull
@Override
public Locale getLocale() {

View File

@ -318,8 +318,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.of("done.building_restricted")
);
event.setCancelled(true);
return;
@ -401,8 +400,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
TranslatableCaption.of("done.building_restricted")
);
event.setCancelled(true);
return;

View File

@ -32,6 +32,7 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.util.ReflectionUtils.RefClass;
import com.plotsquared.core.util.ReflectionUtils.RefField;
import com.plotsquared.core.util.ReflectionUtils.RefMethod;
@ -295,7 +296,7 @@ public class ChunkListener implements Listener {
Chunk chunk = event.getChunk();
if (Settings.Chunk_Processor.AUTO_TRIM) {
String world = chunk.getWorld().getName();
if (this.plotAreaManager.hasPlotArea(world)) {
if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(world)) {
if (unloadChunk(world, chunk, true)) {
return;
}
@ -365,8 +366,7 @@ public class ChunkListener implements Listener {
}
private void cleanChunk(final Chunk chunk) {
TaskManager.index.incrementAndGet();
final int currentIndex = TaskManager.index.get();
final int currentIndex = TaskManager.index.incrementAndGet();
PlotSquaredTask task = TaskManager.runTaskRepeat(() -> {
if (!chunk.isLoaded()) {
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();

View File

@ -564,19 +564,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
int border = area.getBorder();
int x1;
if (x2 > border && this.tmpTeleport) {
to.setX(border - 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border"));
}
if (x2 < -border && this.tmpTeleport) {
to.setX(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border"));
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setX(border - 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setX(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
}
}
}
int z2;
@ -643,18 +655,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
int border = area.getBorder();
int z1;
if (z2 > border && this.tmpTeleport) {
to.setZ(border - 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border"));
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setZ(border - 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (z2 < -border && this.tmpTeleport) {
to.setZ(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.border"));
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
to.setZ(-border + 1);
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
}
}
}
}
@ -960,8 +985,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.of("done.building_restricted")
);
e.setCancelled(true);
return;
@ -1233,8 +1257,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.of("done.building_restricted")
);
event.setCancelled(true);
}
@ -1307,8 +1330,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.of("done.building_restricted")
);
event.setCancelled(true);
}

View File

@ -27,6 +27,7 @@ package com.plotsquared.bukkit.listener;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.util.ReflectionUtils;
import org.bukkit.Chunk;
@ -86,7 +87,7 @@ public class SingleWorldListener implements Listener {
if (!(man instanceof SinglePlotAreaManager)) {
return;
}
if (!isPlotId(name)) {
if (!SinglePlotArea.isSinglePlotWorld(name)) {
return;
}
@ -103,31 +104,4 @@ public class SingleWorldListener implements Listener {
handle(event);
}
private boolean isPlotId(String worldName) {
int len = worldName.length();
int separator = 0;
for (int i = 0; i < len; i++) {
switch (worldName.charAt(i)) {
case '_':
separator++;
break;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
return false;
}
}
return separator == 1;
}
}

View File

@ -178,8 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.of("done.building_restricted")
);
return false;
}

View File

@ -248,9 +248,12 @@ permissions:
plots.admin.components.other: true
plots.admin.vehicle.break.unowned: true
plots.admin.pve.unowned: true
plots.admin.border.bypass: true
plots.teleport.delay.bypass:
default: op
plots.admin.border.bypass:
default: op
plots.worldedit.bypass:
default: op
plots.gamemode.bypass:

View File

@ -25,13 +25,13 @@ dependencies {
compileOnlyApi(libs.findbugs)
// Plugins
compileOnlyApi(libs.worldeditCore) {
compileOnly(libs.worldeditCore) {
exclude(group = "bukkit-classloader-check")
exclude(group = "mockito-core")
exclude(group = "dummypermscompat")
}
testImplementation(libs.worldeditCore)
compileOnlyApi(libs.fastasyncworldeditCore) { isTransitive = false }
compileOnly(libs.fastasyncworldeditCore) { isTransitive = false }
testImplementation(libs.fastasyncworldeditCore) { isTransitive = false }
// Logging

View File

@ -38,6 +38,7 @@ import com.plotsquared.core.inject.annotations.DefaultGenerator;
import com.plotsquared.core.location.World;
import com.plotsquared.core.permissions.PermissionHandler;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
@ -268,6 +269,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
return injector().getInstance(ChunkManager.class);
}
/**
* Get the {@link PlotAreaManager} implementation.
*
* @return the PlotAreaManager
*/
@NonNull PlotAreaManager plotAreaManager();
/**
* Get the platform specific console {@link Audience}
*

View File

@ -283,7 +283,7 @@ public class PlotSquared {
* @return Plot area manager
*/
public @NonNull PlotAreaManager getPlotAreaManager() {
return this.platform.injector().getInstance(PlotAreaManager.class);
return this.platform.plotAreaManager();
}
public void startExpiryTasks() {

View File

@ -193,19 +193,28 @@ public class PlayerBackupProfile implements BackupProfile {
future.completeExceptionally(new IllegalArgumentException(
"The backup is non-existent or not in the correct format"));
} else {
this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, player, new RunnableVal<Boolean>() {
@Override
public void run(Boolean value) {
if (value) {
future.complete(null);
} else {
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
TranslatableCaption
.of("schematics.schematic_paste_failed")
.getComponent(ConsolePlayer.getConsole()))));
this.schematicHandler.paste(
schematic,
plot,
0,
plot.getArea().getMinBuildHeight(),
0,
false,
player,
new RunnableVal<>() {
@Override
public void run(Boolean value) {
if (value) {
future.complete(null);
} else {
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
TranslatableCaption
.of("schematics.schematic_paste_failed")
.getComponent(ConsolePlayer.getConsole()))));
}
}
}
}
});
);
}
});
}

View File

@ -29,6 +29,7 @@ import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
@ -222,7 +223,7 @@ public class Area extends SubCommand {
hybridPlotWorld.setAllowSigns(false);
final File parentFile = FileUtils.getFile(
PlotSquared.platform().getDirectory(),
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator
+ hybridPlotWorld.getId()
);
if (!parentFile.exists() && !parentFile.mkdirs()) {

View File

@ -183,10 +183,12 @@ public class Claim extends SubCommand {
);
}
}
int border = area.getBorder();
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
player.sendMessage(TranslatableCaption.of("border.border"));
return false;
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
int border = area.getBorder();
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
player.sendMessage(TranslatableCaption.of("border.denied"));
return false;
}
}
plot.setOwnerAbs(player.getUUID());
final String finalSchematic = schematic;

View File

@ -149,7 +149,7 @@ public class Load extends SubCommand {
0,
false,
player,
new RunnableVal<Boolean>() {
new RunnableVal<>() {
@Override
public void run(Boolean value) {
plot.removeRunning();

View File

@ -274,7 +274,7 @@ public class MainCommand extends Command {
}
tp = true;
} else {
player.sendMessage(TranslatableCaption.of("border.border"));
player.sendMessage(TranslatableCaption.of("border.denied"));
}
// Trim command
args = Arrays.copyOfRange(args, 1, args.length);

View File

@ -166,7 +166,7 @@ public class SchematicCmd extends SubCommand {
0,
false,
player,
new RunnableVal<Boolean>() {
new RunnableVal<>() {
@Override
public void run(Boolean value) {
SchematicCmd.this.running = false;

View File

@ -140,21 +140,16 @@ public class Visit extends Command {
return;
}
} else {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)) {
// allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or
// plot.admin.visit.untrusted permission
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)
&& !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Templates.of("node", "plots.visit.other")
);
return;
}
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Templates.of("node", "plots.admin.visit.untrusted")
);
return;
}
if (plot.isDenied(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
player.sendMessage(

View File

@ -556,8 +556,10 @@ public class Settings extends Config {
public static boolean ON_DEATH = false;
@Comment("Teleport to your plot on login")
public static boolean ON_LOGIN = false;
@Comment("Teleport to your plot on claim")
@Comment("Teleport to your plot on claim (/plot claim)")
public static boolean ON_CLAIM = true;
@Comment("Teleport to your plot on auto (/plot auto)")
public static boolean ON_AUTO = true;
@Comment({"Add a delay to all teleport commands (in seconds)",
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
public static int DELAY = 0;
@ -708,6 +710,9 @@ public class Settings extends Config {
"If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " +
"former lang key."})
public static boolean TITLES_AS_ACTIONBAR = false;
@Comment({"If the default title should be displayed on plots with server-plot flag set.",
"Titles will still be sent if the plot-title flag is set."})
public static boolean DISPLAY_DEFAULT_ON_SERVER_PLOT = false;
}

View File

@ -2099,6 +2099,7 @@ public class SQLManager implements AbstractDB {
case "default":
case "0,0,0":
case "center":
case "centre":
break;
default:
try {
@ -2946,6 +2947,7 @@ public class SQLManager implements AbstractDB {
case "default":
case "0,0,0":
case "center":
case "centre":
break;
default:
try {

View File

@ -506,16 +506,32 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(
classicPlotWorld.getWorldName(),
sx,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz + 1
),
Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
BlockUtil.get((short) 7, (byte) 0)
);
if (classicPlotWorld.PLOT_BEDROCK) {
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
BlockTypes.BEDROCK.getDefaultState()
);
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
} else {
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
}
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
@ -568,7 +584,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(
classicPlotWorld.getWorldName(),
sx + 1,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz
),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -663,7 +682,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(
classicPlotWorld.getWorldName(),
sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz
),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -703,7 +725,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(
classicPlotWorld.getWorldName(),
sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz
),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
@ -742,7 +767,10 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(
classicPlotWorld.getWorldName(),
sx,
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
Math.min(
classicPlotWorld.PLOT_HEIGHT,
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
) + 1,
sz
),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),

View File

@ -63,7 +63,7 @@ public class HybridGen extends IndependentPlotGenerator {
&& Settings.Schematics.PASTE_ON_TOP)) {
minY = world.SCHEM_Y;
} else {
minY = 1;
minY = world.getMinBuildHeight();
}
BaseBlock[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ));
if (blocks != null) {
@ -156,11 +156,12 @@ public class HybridGen extends IndependentPlotGenerator {
}
}
// generation
int startY = hybridPlotWorld.PLOT_BEDROCK ? 1 : 0;
for (short x = 0; x < 16; x++) {
if (insideRoadX[x]) {
for (short z = 0; z < 16; z++) {
// Road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
}
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -171,7 +172,7 @@ public class HybridGen extends IndependentPlotGenerator {
for (short z = 0; z < 16; z++) {
if (insideRoadZ[z]) {
// road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
}
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -181,7 +182,7 @@ public class HybridGen extends IndependentPlotGenerator {
}
} else {
// wall
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
}
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -201,7 +202,7 @@ public class HybridGen extends IndependentPlotGenerator {
for (short z = 0; z < 16; z++) {
if (insideRoadZ[z]) {
// road
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
}
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -211,7 +212,7 @@ public class HybridGen extends IndependentPlotGenerator {
}
} else if (insideWallZ[z]) {
// wall
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
}
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
@ -227,7 +228,7 @@ public class HybridGen extends IndependentPlotGenerator {
}
} else {
// plot
for (int y = 1; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
for (int y = startY; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern());
}
result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z,

View File

@ -82,10 +82,12 @@ public class HybridPlotManager extends ClassicPlotManager {
Settings.Paths.TEMPLATES + "/tmp-data.yml",
Template.getBytes(hybridPlotWorld)
));
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator;
String dir =
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator;
try {
File sideRoad = FileUtils.getFile(PlotSquared.platform().getDirectory(), dir + "sideroad.schem");
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
String newDir =
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
if (sideRoad.exists()) {
files.add(new FileBytes(newDir + "sideroad.schem", Files.readAllBytes(sideRoad.toPath())));
}
@ -152,7 +154,7 @@ public class HybridPlotManager extends ClassicPlotManager {
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
minY = hybridPlotWorld.SCHEM_Y;
} else {
minY = 1;
minY = hybridPlotWorld.getMinBuildHeight();
}
BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock();
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
@ -249,12 +251,11 @@ public class HybridPlotManager extends ClassicPlotManager {
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern();
final BlockState bedrock;
final BlockState air = BlockTypes.AIR.getDefaultState();
final Pattern bedrock;
if (hybridPlotWorld.PLOT_BEDROCK) {
bedrock = BlockTypes.BEDROCK.getDefaultState();
} else {
bedrock = air;
bedrock = hybridPlotWorld.MAIN_BLOCK.toPattern();
}
final BiomeType biome = hybridPlotWorld.getPlotBiome();
@ -274,7 +275,7 @@ public class HybridPlotManager extends ClassicPlotManager {
// Each component has a different layer
queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling);
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor);
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), air);
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), BlockTypes.AIR.getDefaultState());
queue.setBiomeCuboid(pos1, pos2, biome);
} else {
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));

View File

@ -253,22 +253,32 @@ public class HybridPlotWorld extends ClassicPlotWorld {
int shift = this.ROAD_WIDTH / 2;
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
SCHEM_Y = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
SCHEM_Y = Math.min(PLOT_HEIGHT, Math.min(WALL_HEIGHT, ROAD_HEIGHT));
int plotY = PLOT_HEIGHT - SCHEM_Y;
int roadY = ROAD_HEIGHT - SCHEM_Y;
int roadY = Math.min(ROAD_HEIGHT, WALL_HEIGHT) - SCHEM_Y;
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = 0;
plotY = 0;
roadY = ROAD_HEIGHT;
if (schematic3 != null) {
if (schematic3.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = plotY = 0;
} else if (!Settings.Schematics.PASTE_ON_TOP) {
SCHEM_Y = plotY = getMinBuildHeight();
}
}
if (schematic1 != null && schematic1.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = 0;
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256) {
plotY = PLOT_HEIGHT;
if (schematic1 != null) {
if (schematic1.getClipboard().getDimensions().getY() == 256) {
SCHEM_Y = roadY = 0;
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
&& !Settings.Schematics.PASTE_ON_TOP) {
plotY = PLOT_HEIGHT;
}
} else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
SCHEM_Y = roadY = getMinBuildHeight();
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
&& !Settings.Schematics.PASTE_ON_TOP) {
plotY = PLOT_HEIGHT;
}
}
roadY = 0;
}
if (schematic3 != null) {
@ -324,7 +334,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
LOGGER.info("- plot schematic: {}", schematic3File.getPath());
}
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
if ((schematic1 == null&& schematic2 == null) || this.ROAD_WIDTH == 0) {
if (Settings.DEBUG) {
LOGGER.info("- schematic: false");
}

View File

@ -504,9 +504,10 @@ public class HybridUtils {
Location top = plot.getTopAbs();
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
PlotManager plotManager = plotworld.getPlotManager();
int schemY = Math.min(plotworld.PLOT_HEIGHT, Math.min(plotworld.WALL_HEIGHT, plotworld.ROAD_HEIGHT));
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
int sz = bot.getZ() + 1;
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotworld.ROAD_HEIGHT : 1;
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().getMinBuildHeight();
int ex = bot.getX();
int ez = top.getZ();
int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
@ -517,7 +518,7 @@ public class HybridUtils {
final Set<CuboidRegion> sideRoad = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez));
final Set<CuboidRegion> intersection = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz));
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
final String dir = Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
.getArea()
.toString() + File.separator;

View File

@ -58,6 +58,7 @@ import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.plot.flag.implementations.NotifyEnterFlag;
import com.plotsquared.core.plot.flag.implementations.NotifyLeaveFlag;
import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
import com.plotsquared.core.plot.flag.implementations.TimeFlag;
import com.plotsquared.core.plot.flag.implementations.TitlesFlag;
import com.plotsquared.core.plot.flag.implementations.WeatherFlag;
@ -317,51 +318,52 @@ public class PlotListener {
subtitle = "";
fromFlag = false;
}
// It's not actually possible for these to be null, but IntelliJ is dumb
TaskManager.runTaskLaterAsync(() -> {
Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess =
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null);
}
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
final UUID plotOwner = plot.getOwnerAbs();
String owner = PlayerManager.getName(plotOwner, false);
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
".title_entered_plot");
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
".title_entered_plot_sub");
Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
Template ownerTemplate = Template.of("owner", owner);
Template aliasTemplate = Template.of("alias", plot.getAlias());
final Consumer<String> userConsumer = user -> {
if (Settings.Titles.TITLES_AS_ACTIONBAR) {
player.sendActionBar(header, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
} else {
player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
}
};
UUID uuid = plot.getOwner();
if (uuid == null) {
userConsumer.accept("Unknown");
} else if (uuid.equals(DBFunc.SERVER)) {
userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
.of("info.server")
.getComponent(player)));
} else {
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
if (throwable != null) {
userConsumer.accept("Unknown");
} else {
userConsumer.accept(user);
}
});
if (fromFlag || !plot.getFlag(ServerPlotFlag.class) || Settings.Titles.DISPLAY_DEFAULT_ON_SERVER_PLOT) {
TaskManager.runTaskLaterAsync(() -> {
Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess =
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null);
}
}
}, TaskTime.seconds(1L));
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
final UUID plotOwner = plot.getOwnerAbs();
String owner = PlayerManager.getName(plotOwner, false);
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
".title_entered_plot");
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
".title_entered_plot_sub");
Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
Template ownerTemplate = Template.of("owner", owner);
Template aliasTemplate = Template.of("alias", plot.getAlias());
final Consumer<String> userConsumer = user -> {
if (Settings.Titles.TITLES_AS_ACTIONBAR) {
player.sendActionBar(header, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
} else {
player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
}
};
UUID uuid = plot.getOwner();
if (uuid == null) {
userConsumer.accept("Unknown");
} else if (uuid.equals(DBFunc.SERVER)) {
userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
.of("info.server")
.getComponent(player)));
} else {
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
if (throwable != null) {
userConsumer.accept("Unknown");
} else {
userConsumer.accept(user);
}
});
}
}
}, TaskTime.seconds(1L));
}
}
TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class);

View File

@ -25,8 +25,14 @@
*/
package com.plotsquared.core.location;
import com.plotsquared.core.util.StringMan;
public class BlockLoc {
public static final BlockLoc ZERO = new BlockLoc(0, 0, 0);
public static final BlockLoc MINY = new BlockLoc(0, Integer.MIN_VALUE, 0);
private static final BlockLoc MIDDLE = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
private final int x;
private final int y;
private final int z;
@ -34,6 +40,10 @@ public class BlockLoc {
private final float yaw;
private final float pitch;
public BlockLoc(int x, int y, int z) {
this(x, y, z, 0f, 0f);
}
public BlockLoc(int x, int y, int z, float yaw, float pitch) {
this.x = x;
this.y = y;
@ -43,26 +53,31 @@ public class BlockLoc {
this.pitch = pitch;
}
public BlockLoc(int x, int y, int z) {
this(x, y, z, 0f, 0f);
}
public static BlockLoc fromString(String string) {
String[] parts = string.split(",");
float yaw;
float pitch;
if (parts.length == 5) {
yaw = Float.parseFloat(parts[3]);
pitch = Float.parseFloat(parts[4]);
if (string == null || "side".equalsIgnoreCase(string)) {
return null;
} else if (StringMan.isEqualIgnoreCaseToAny(string, "center", "middle", "centre")) {
return MIDDLE;
} else {
return new BlockLoc(0, 0, 0);
}
int x = Integer.parseInt(parts[0]);
int y = Integer.parseInt(parts[1]);
int z = Integer.parseInt(parts[2]);
String[] parts = string.split(",");
return new BlockLoc(x, y, z, yaw, pitch);
float yaw;
float pitch;
if (parts.length == 5) {
yaw = Float.parseFloat(parts[3]);
pitch = Float.parseFloat(parts[4]);
} else if (parts.length == 3) {
yaw = 0;
pitch = 0;
} else {
return ZERO;
}
int x = Integer.parseInt(parts[0]);
int y = Integer.parseInt(parts[1]);
int z = Integer.parseInt(parts[2]);
return new BlockLoc(x, y, z, yaw, pitch);
}
}
@Override
@ -88,12 +103,12 @@ public class BlockLoc {
}
BlockLoc other = (BlockLoc) obj;
return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other
.getZ();
.getZ() && this.getYaw() == other.getYaw() && this.getPitch() == other.getPitch();
}
@Override
public String toString() {
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) {
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0 && this.getYaw() == 0 && this.getPitch() == 0) {
return "";
}
return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw() + ','

View File

@ -56,7 +56,7 @@ public final class PlotLoc {
public static @Nullable PlotLoc fromString(final String input) {
if (input == null || "side".equalsIgnoreCase(input)) {
return null;
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) {
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle", "centre")) {
return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
} else {
try {

View File

@ -204,7 +204,8 @@ public enum Permission {
PERMISSION_ADMIN_DEBUG_OTHER("plots.admin.debug.other"),
PERMISSION_RATE("plots.rate"),
PERMISSION_ADMIN_FLIGHT("plots.admin.flight"),
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other");
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"),
PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass");
//</editor-fold>
private final String text;

View File

@ -39,12 +39,12 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.ClassicPlotWorld;
import com.plotsquared.core.generator.HybridPlotWorld;
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.permissions.Permission;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer;
@ -1329,7 +1329,7 @@ public class Plot {
return Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
);
}
@ -1404,7 +1404,7 @@ public class Plot {
return Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
);
}
@ -1443,7 +1443,7 @@ public class Plot {
result.accept(Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
));
return;
@ -1477,7 +1477,7 @@ public class Plot {
*/
public void setHome(BlockLoc location) {
Plot plot = this.getBasePlot(false);
if (location != null && new BlockLoc(0, 0, 0).equals(location)) {
if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
return;
}
plot.getSettings().setPosition(location);
@ -1506,7 +1506,7 @@ public class Plot {
@Deprecated
public Location getDefaultHomeSynchronous(final boolean member) {
Plot plot = this.getBasePlot(false);
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
if (loc != null) {
int x;
int z;
@ -1525,10 +1525,10 @@ public class Plot {
x = bot.getX() + loc.getX();
z = bot.getZ() + loc.getZ();
}
int y = loc.getY() < 1
int y = loc.getY() == Integer.MIN_VALUE
? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 : 63)
: loc.getY();
return Location.at(plot.getWorldName(), x, y, z);
return Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch());
}
// Side
return plot.getSideSynchronous();
@ -1540,12 +1540,12 @@ public class Plot {
result.accept(Location.at(
"",
0,
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
0
));
return;
}
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
if (loc != null) {
int x;
int z;
@ -1564,7 +1564,7 @@ public class Plot {
x = bot.getX() + loc.getX();
z = bot.getZ() + loc.getZ();
}
if (loc.getY() < 1) {
if (loc.getY() == Integer.MIN_VALUE) {
if (isLoaded()) {
this.worldUtil.getHighestBlock(
plot.getWorldName(),
@ -1573,10 +1573,11 @@ public class Plot {
y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z))
);
} else {
result.accept(Location.at(plot.getWorldName(), x, 63, z));
int y = this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 63;
result.accept(Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch()));
}
} else {
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z));
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z, loc.getYaw(), loc.getPitch()));
}
return;
}
@ -1707,9 +1708,14 @@ public class Plot {
}
this.getPlotModificationManager().setSign(player.getName());
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
if (teleport && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, auto ? TeleportCause.COMMAND_AUTO : TeleportCause.COMMAND_CLAIM, result -> {
});
if (teleport) {
if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
});
} else if (auto && Settings.Teleport.ON_AUTO) {
teleportPlayer(player, TeleportCause.COMMAND_AUTO, result -> {
});
}
}
PlotArea plotworld = getArea();
if (plotworld.isSchematicOnClaim()) {
@ -1727,16 +1733,25 @@ public class Plot {
e.printStackTrace();
return true;
}
schematicHandler.paste(sch, this, 0, 1, 0, Settings.Schematics.PASTE_ON_TOP, player, new RunnableVal<>() {
@Override
public void run(Boolean value) {
if (value) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
schematicHandler.paste(
sch,
this,
0,
getArea().getMinBuildHeight(),
0,
Settings.Schematics.PASTE_ON_TOP,
player,
new RunnableVal<>() {
@Override
public void run(Boolean value) {
if (value) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
}
}
}
}
});
);
}
plotworld.getPlotManager().claimPlot(this, null);
return true;
@ -2148,8 +2163,9 @@ public class Plot {
}
/**
* Gets the set home location or 0,0,0 if no location is set<br>
* Gets the set home location or 0,Integer#MIN_VALUE,0 if no location is set<br>
* - Does not take the default home location into account
* - PlotSquared will internally find the correct place to teleport to if y = Integer#MIN_VALUE when teleporting to the plot.
*
* @return home location
*/

View File

@ -41,6 +41,7 @@ import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.generator.GridPlotWorld;
import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
@ -123,6 +124,7 @@ public abstract class PlotArea {
new FlagContainer(GlobalFlagContainer.getInstance());
private final YamlConfiguration worldConfiguration;
private final GlobalBlockQueue globalBlockQueue;
private final boolean roadFlags = false;
private boolean autoMerge = false;
private boolean allowSigns = true;
private boolean miscSpawnUnowned = false;
@ -140,14 +142,13 @@ public abstract class PlotArea {
private PlotAreaType type = PlotAreaType.NORMAL;
private PlotAreaTerrainType terrain = PlotAreaTerrainType.NONE;
private boolean homeAllowNonmember = false;
private PlotLoc nonmemberHome;
private PlotLoc defaultHome;
private BlockLoc nonmemberHome;
private BlockLoc defaultHome;
private int maxBuildHeight = 256;
private int minBuildHeight = 1;
private GameMode gameMode = GameModes.CREATIVE;
private Map<String, PlotExpression> prices = new HashMap<>();
private List<String> schematics = new ArrayList<>();
private final boolean roadFlags = false;
private boolean worldBorder = false;
private boolean useEconomy = false;
private int hash;
@ -370,24 +371,24 @@ public abstract class PlotArea {
String homeNonMembers = config.getString("home.nonmembers");
String homeDefault = config.getString("home.default");
this.defaultHome = PlotLoc.fromString(homeDefault);
this.defaultHome = BlockLoc.fromString(homeDefault);
this.homeAllowNonmember = homeNonMembers.equalsIgnoreCase(homeDefault);
if (this.homeAllowNonmember) {
this.nonmemberHome = defaultHome;
} else {
this.nonmemberHome = PlotLoc.fromString(homeNonMembers);
this.nonmemberHome = BlockLoc.fromString(homeNonMembers);
}
if ("side".equalsIgnoreCase(homeDefault)) {
this.defaultHome = null;
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle")) {
this.defaultHome = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle", "centre")) {
this.defaultHome = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
} else {
try {
/*String[] split = homeDefault.split(",");
this.DEFAULT_HOME =
new PlotLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]));*/
this.defaultHome = PlotLoc.fromString(homeDefault);
this.defaultHome = BlockLoc.fromString(homeDefault);
} catch (NumberFormatException ignored) {
this.defaultHome = null;
}
@ -1351,15 +1352,38 @@ public abstract class PlotArea {
return this.homeAllowNonmember;
}
public PlotLoc getNonmemberHome() {
/**
* Get the location for non-members to be teleported to.
*/
public BlockLoc nonmemberHome() {
return this.nonmemberHome;
}
public PlotLoc getDefaultHome() {
/**
* Get the default location for players to be teleported to. May be overriden by {@link #nonmemberHome} if the player is
* not a member of the plot.
*/
public BlockLoc defaultHome() {
return this.defaultHome;
}
protected void setDefaultHome(PlotLoc defaultHome) {
/**
* @deprecated Use {@link #nonmemberHome}
*/
@Deprecated(forRemoval = true)
public PlotLoc getNonmemberHome() {
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
}
/**
* @deprecated Use {@link #defaultHome}
*/
@Deprecated(forRemoval = true)
public PlotLoc getDefaultHome() {
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
}
protected void setDefaultHome(BlockLoc defaultHome) {
this.defaultHome = defaultHome;
}

View File

@ -107,7 +107,7 @@ public class PlotSettings {
public BlockLoc getPosition() {
if (this.position == null) {
return new BlockLoc(0, 0, 0);
return BlockLoc.MINY;
}
return this.position;
}

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.generator.GridPlotWorld;
import com.plotsquared.core.generator.SingleWorldGenerator;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.BlockLoc;
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;
@ -74,7 +74,39 @@ public class SinglePlotArea extends GridPlotWorld {
this.eventDispatcher = eventDispatcher;
this.plotListener = plotListener;
this.setAllowSigns(false);
this.setDefaultHome(new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE));
this.setDefaultHome(new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE));
}
/**
* Returns true if the given string matches the naming system used to identify single plot worlds
* e.g. -1_5 represents plot id *;-1;5. "*" being the plot area name given to single plot world
* {@link com.plotsquared.core.plot.PlotArea}.
*/
public static boolean isSinglePlotWorld(String worldName) {
int len = worldName.length();
int separator = 0;
for (int i = 0; i < len; i++) {
switch (worldName.charAt(i)) {
case '_':
separator++;
break;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
return false;
}
}
return separator == 1;
}
@NonNull

View File

@ -581,6 +581,10 @@ public abstract class SchematicHandler {
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
schematic.put("BlockEntities", new ListTag(CompoundTag.class, tileEntities));
if (biomeBuffer.size() == 0 || biomePalette.size() == 0) {
return;
}
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
Map<String, Tag> biomePaletteTag = new HashMap<>();

View File

@ -53,7 +53,9 @@
"cluster.cluster_regenerated": "<prefix><dark_aqua>Successfully started cluster regeneration.</dark_aqua>",
"cluster.cluster_teleporting": "<prefix><dark_aqua>Teleporting...</dark_aqua>",
"cluster.cluster_info": "<prefix><gold>Current cluster: </gold><gray><id></gray>\n<gold>Name: </gold><gray><name></gray>\n<gold>Owner: </gold><gray><owner></gray>\n<gold>Size: </gold><gray><size></gray>\n<gold>Rights: </gold><gray><rights></gray>",
"border.border": "<prefix><gray>You are outside the current map border.</gray>",
"border.denied": "<prefix><red>You are outside the current map border.</red>",
"border.bypass.exited": "<prefix><red>You have bypassed the current map border area.</red>",
"border.bypass.entered": "<prefix><gray>You have re-entered the current map border area.</gray>",
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
@ -92,6 +94,7 @@
"done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>",
"done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>",
"done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>",
"done.building_restricted": "<prefix><gray>You can't build on plots marked as done.</gray>",
"ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>",
"ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>",
"ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>",

View File

@ -18,7 +18,7 @@ plugins {
idea
}
version = "6.1.3"
version = "6.1.4"
allprojects {
group = "com.plotsquared"

View File

@ -6,19 +6,19 @@ log4j-api = "2.14.1" # Version set by Minecraft
# Platform expectations
paper = "1.17.1-R0.1-SNAPSHOT"
checker-qual = "3.18.1"
checker-qual = "3.19.0"
guice = "5.0.1"
findbugs = "3.0.1"
snakeyaml = "1.28" # Version set by Bukkit
# Adventure & MiniMessage
adventure-api = "4.9.2"
adventure-api = "4.9.3"
adventure-text-minimessage = "4.1.0-SNAPSHOT"
adventure-platform-bukkit = "4.0.0"
# Plugins
worldedit = "7.2.6"
fawe = "1.17-343"
worldedit = "7.2.7"
fawe = "1.17-390"
vault = "1.7.1"
placeholderapi = "2.10.10"
luckperms = "5.3"

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -5,7 +5,8 @@
],
"ignoreDeps": [
"guava",
"com.google.guava:guava",
"com.google.guava:guava",
"com.google.code.gson:gson",
"gson",
"snakeyaml"
],