mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
If NMF can have midnight work, so can I
This commit is contained in:
parent
ad7bcd19d4
commit
9642777750
@ -119,7 +119,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
new PlotSquared(this, "Bukkit");
|
new PlotSquared(this, "Bukkit");
|
||||||
|
|
||||||
if (PlotSquared.get().IMP.getServerVersion()[1] < 13) {
|
if (PaperLib.getMinecraftVersion() < 13 && PaperLib.getMinecraftPatchVersion() < 2) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
||||||
System.out
|
System.out
|
||||||
|
@ -932,10 +932,10 @@ import java.util.regex.Pattern;
|
|||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
Location location = plotPlayer.getLocation();
|
Location location = plotPlayer.getLocation();
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
|
if (location.isPlotArea() || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = location.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlock
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -276,7 +277,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
}
|
}
|
||||||
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||||
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z
|
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z
|
||||||
&& PlotSquared.imp().getServerVersion()[1] == 13) {
|
&& PaperLib.getMinecraftVersion() == 13) {
|
||||||
AugmentedUtils
|
AugmentedUtils
|
||||||
.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z));
|
.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z));
|
||||||
continue;
|
continue;
|
||||||
@ -391,7 +392,7 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
|
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") @Override
|
@Override
|
||||||
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
|
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save,
|
||||||
final boolean safe) {
|
final boolean safe) {
|
||||||
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||||
|
@ -6,6 +6,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.StringPlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings;
|
import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -829,7 +830,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
|
|||||||
LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName,
|
LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName,
|
||||||
@NonNull final String newName, @NonNull final String new14Name) {
|
@NonNull final String newName, @NonNull final String new14Name) {
|
||||||
this(numericalId, dataValue, legacyName,
|
this(numericalId, dataValue, legacyName,
|
||||||
PlotSquared.get().IMP.getServerVersion()[1] == 13 ? newName : new14Name);
|
PaperLib.getMinecraftVersion() == 13 ? newName : new14Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
LegacyBlock(final int numericalId, @NonNull final String legacyName,
|
LegacyBlock(final int numericalId, @NonNull final String legacyName,
|
||||||
|
@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -353,7 +354,7 @@ import java.util.Set;
|
|||||||
} else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
|
} else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
|
||||||
facing = BlockFace.SOUTH;
|
facing = BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) {
|
if (PaperLib.getMinecraftVersion() == 13) {
|
||||||
block.setType(Material.valueOf("WALL_SIGN"), false);
|
block.setType(Material.valueOf("WALL_SIGN"), false);
|
||||||
} else {
|
} else {
|
||||||
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
|
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
|
||||||
|
@ -253,6 +253,9 @@ public class Auto extends SubCommand {
|
|||||||
for (int j = start.y; j <= end.y; j++) {
|
for (int j = start.y; j <= end.y; j++) {
|
||||||
Plot plot = plotarea.getPlotAbs(new PlotId(i, j));
|
Plot plot = plotarea.getPlotAbs(new PlotId(i, j));
|
||||||
boolean teleport = i == end.x && j == end.y;
|
boolean teleport = i == end.x && j == end.y;
|
||||||
|
if (plot == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
plot.claim(player, teleport, null);
|
plot.claim(player, teleport, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -34,13 +35,13 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
||||||
+ hybridPlotWorld.worldname + File.separator;
|
+ hybridPlotWorld.worldname + File.separator;
|
||||||
try {
|
try {
|
||||||
File sideroad =
|
File sideRoad =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
|
||||||
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
|
||||||
+ "__TEMP_DIR__" + File.separator;
|
+ "__TEMP_DIR__" + File.separator;
|
||||||
if (sideroad.exists()) {
|
if (sideRoad.exists()) {
|
||||||
files.add(new FileBytes(newDir + "sideroad.schem",
|
files.add(new FileBytes(newDir + "sideroad.schem",
|
||||||
Files.readAllBytes(sideroad.toPath())));
|
Files.readAllBytes(sideRoad.toPath())));
|
||||||
}
|
}
|
||||||
File intersection =
|
File intersection =
|
||||||
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem");
|
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem");
|
||||||
|
@ -21,6 +21,7 @@ import com.google.common.collect.BiMap;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -46,13 +47,14 @@ import java.util.stream.Collectors;
|
|||||||
public class Plot {
|
public class Plot {
|
||||||
|
|
||||||
private static final int MAX_HEIGHT = 256;
|
private static final int MAX_HEIGHT = 256;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated raw access is deprecated
|
* @deprecated raw access is deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated private static HashSet<Plot> connected_cache;
|
@Deprecated private static HashSet<Plot> connected_cache;
|
||||||
private static HashSet<RegionWrapper> regions_cache;
|
private static HashSet<RegionWrapper> regions_cache;
|
||||||
|
|
||||||
private final PlotId id;
|
@NotNull private final PlotId id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot owner
|
* plot owner
|
||||||
@ -62,10 +64,12 @@ public class Plot {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated public UUID owner;
|
@Deprecated public UUID owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the plot changed since the last save cycle?
|
* Has the plot changed since the last save cycle?
|
||||||
*/
|
*/
|
||||||
public boolean countsTowardsMax = true;
|
public boolean countsTowardsMax = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents whatever the database manager needs it to: <br>
|
* Represents whatever the database manager needs it to: <br>
|
||||||
* - A value of -1 usually indicates the plot will not be stored in the DB<br>
|
* - A value of -1 usually indicates the plot will not be stored in the DB<br>
|
||||||
@ -74,23 +78,28 @@ public class Plot {
|
|||||||
* @deprecated magical
|
* @deprecated magical
|
||||||
*/
|
*/
|
||||||
@Deprecated public int temp;
|
@Deprecated public int temp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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>
|
||||||
@ -99,6 +108,7 @@ public class Plot {
|
|||||||
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>
|
||||||
@ -107,6 +117,7 @@ public class Plot {
|
|||||||
* @see FlagManager
|
* @see FlagManager
|
||||||
*/
|
*/
|
||||||
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
|
||||||
@ -122,7 +133,7 @@ public class Plot {
|
|||||||
* @param owner the plot owner
|
* @param owner the plot owner
|
||||||
* @see Plot#getPlot(Location) for existing plots
|
* @see Plot#getPlot(Location) for existing plots
|
||||||
*/
|
*/
|
||||||
public Plot(PlotArea area, PlotId id, UUID owner) {
|
public Plot(PlotArea area, @NotNull PlotId id, UUID owner) {
|
||||||
this.area = area;
|
this.area = area;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@ -136,7 +147,7 @@ public class Plot {
|
|||||||
* @param id the plot id
|
* @param id the plot id
|
||||||
* @see Plot#getPlot(Location) for existing plots
|
* @see Plot#getPlot(Location) for existing plots
|
||||||
*/
|
*/
|
||||||
public Plot(PlotArea area, PlotId id) {
|
public Plot(PlotArea area, @NotNull PlotId id) {
|
||||||
this.area = area;
|
this.area = area;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -152,7 +163,7 @@ public class Plot {
|
|||||||
* @param temp Represents whatever the database manager needs it to
|
* @param temp Represents whatever the database manager needs it to
|
||||||
* @see Plot#getPlot(Location) for existing plots
|
* @see Plot#getPlot(Location) for existing plots
|
||||||
*/
|
*/
|
||||||
public Plot(PlotArea area, PlotId id, UUID owner, int temp) {
|
public Plot(PlotArea area, @NotNull PlotId id, UUID owner, int temp) {
|
||||||
this.area = area;
|
this.area = area;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@ -166,10 +177,10 @@ public class Plot {
|
|||||||
* @param owner the plot owner
|
* @param owner the plot owner
|
||||||
* @param trusted the plot trusted players
|
* @param trusted the plot trusted players
|
||||||
* @param denied the plot denied players
|
* @param denied the plot denied players
|
||||||
* @param merged array giving merged plots
|
* @param merged an array giving merged plots
|
||||||
* @see Plot#getPlot(Location) for existing plots
|
* @see Plot#getPlot(Location) for existing plots
|
||||||
*/
|
*/
|
||||||
public Plot(PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members,
|
public Plot(@NotNull PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members,
|
||||||
HashSet<UUID> denied, String alias, BlockLoc position, Collection<Flag> flags,
|
HashSet<UUID> denied, String alias, BlockLoc position, Collection<Flag> flags,
|
||||||
PlotArea area, boolean[] merged, long timestamp, int temp) {
|
PlotArea area, boolean[] merged, long timestamp, int temp) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -194,7 +205,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Gets a plot from a string e.g. [area];[id]
|
* Gets a plot from a string e.g. [area];[id]
|
||||||
*
|
*
|
||||||
* @param defaultArea If no area is specified
|
* @param defaultArea if no area is specified
|
||||||
* @param string plot id/area + id
|
* @param string plot id/area + id
|
||||||
* @return New or existing plot object
|
* @return New or existing plot object
|
||||||
*/
|
*/
|
||||||
@ -452,7 +463,7 @@ public class Plot {
|
|||||||
*
|
*
|
||||||
* @return the PlotId for this plot
|
* @return the PlotId for this plot
|
||||||
*/
|
*/
|
||||||
public PlotId getId() {
|
@NotNull public PlotId getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ public abstract class PlotArea {
|
|||||||
this.meta.put(key, value);
|
this.meta.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable public <T> T getMeta(@Nullable final String key, @Nullable final T def) {
|
@NotNull public <T> T getMeta(@Nullable final String key, @NotNull final T def) {
|
||||||
final Object v = getMeta(key);
|
final Object v = getMeta(key);
|
||||||
return v == null ? def : (T) v;
|
return v == null ? def : (T) v;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user