If NMF can have midnight work, so can I

This commit is contained in:
MattBDev 2019-08-13 17:33:32 -04:00
parent ad7bcd19d4
commit 9642777750
9 changed files with 48 additions and 30 deletions

View File

@ -119,7 +119,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
new PlotSquared(this, "Bukkit");
if (PlotSquared.get().IMP.getServerVersion()[1] < 13) {
if (PaperLib.getMinecraftVersion() < 13 && PaperLib.getMinecraftPatchVersion() < 2) {
System.out.println(
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
System.out

View File

@ -932,10 +932,10 @@ import java.util.regex.Pattern;
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
Location location = plotPlayer.getLocation();
PlotArea area = location.getPlotArea();
if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
if (location.isPlotArea() || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
return;
}
Plot plot = area.getPlot(location);
Plot plot = location.getPlot();
if (plot == null) {
return;
}

View File

@ -14,6 +14,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlock
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
@ -276,7 +277,7 @@ public class BukkitChunkManager extends ChunkManager {
}
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z
&& PlotSquared.imp().getServerVersion()[1] == 13) {
&& PaperLib.getMinecraftVersion() == 13) {
AugmentedUtils
.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.x, chunk.z));
continue;
@ -391,7 +392,7 @@ public class BukkitChunkManager extends ChunkManager {
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,
final boolean safe) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {

View File

@ -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.util.LegacyMappings;
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
import io.papermc.lib.PaperLib;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@ -829,7 +830,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
LegacyBlock(final int numericalId, final int dataValue, @NonNull final String legacyName,
@NonNull final String newName, @NonNull final String new14Name) {
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,

View File

@ -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.WorldUtil;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import io.papermc.lib.PaperLib;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -353,7 +354,7 @@ import java.util.Set;
} else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
facing = BlockFace.SOUTH;
}
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) {
if (PaperLib.getMinecraftVersion() == 13) {
block.setType(Material.valueOf("WALL_SIGN"), false);
} else {
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);

View File

@ -253,6 +253,9 @@ public class Auto extends SubCommand {
for (int j = start.y; j <= end.y; j++) {
Plot plot = plotarea.getPlotAbs(new PlotId(i, j));
boolean teleport = i == end.x && j == end.y;
if (plot == null) {
return false;
}
plot.claim(player, teleport, null);
}
}

View File

@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.google.common.collect.Sets;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@ -34,13 +35,13 @@ public class HybridPlotManager extends ClassicPlotManager {
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
+ hybridPlotWorld.worldname + File.separator;
try {
File sideroad =
File sideRoad =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), dir + "sideroad.schem");
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator
+ "__TEMP_DIR__" + File.separator;
if (sideroad.exists()) {
if (sideRoad.exists()) {
files.add(new FileBytes(newDir + "sideroad.schem",
Files.readAllBytes(sideroad.toPath())));
Files.readAllBytes(sideRoad.toPath())));
}
File intersection =
MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "intersection.schem");

View File

@ -21,6 +21,7 @@ import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -46,13 +47,14 @@ import java.util.stream.Collectors;
public class Plot {
private static final int MAX_HEIGHT = 256;
/**
* @deprecated raw access is deprecated
*/
@Deprecated private static HashSet<Plot> connected_cache;
private static HashSet<RegionWrapper> regions_cache;
private final PlotId id;
@NotNull private final PlotId id;
/**
* plot owner
@ -62,10 +64,12 @@ public class Plot {
* @deprecated
*/
@Deprecated public UUID owner;
/**
* Has the plot changed since the last save cycle?
*/
public boolean countsTowardsMax = true;
/**
* 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>
@ -74,23 +78,28 @@ public class Plot {
* @deprecated magical
*/
@Deprecated public int temp;
/**
* Plot creation timestamp (not accurate if the plot was created before this was implemented)<br>
* - Milliseconds since the epoch<br>
*/
private long timestamp;
/**
* List of trusted (with plot permissions).
*/
private HashSet<UUID> trusted;
/**
* List of members users (with plot permissions).
*/
private HashSet<UUID> members;
/**
* List of denied players.
*/
private HashSet<UUID> denied;
/**
* External settings class.
* - Please favor the methods over direct access to this class<br>
@ -99,6 +108,7 @@ public class Plot {
private PlotSettings settings;
private PlotArea area;
/**
* Session only plot metadata (session is until the server stops)<br>
* <br>
@ -107,6 +117,7 @@ public class Plot {
* @see FlagManager
*/
private ConcurrentHashMap<String, Object> meta;
/**
* The cached origin plot.
* - The origin plot is used for plot grouping and relational data
@ -117,12 +128,12 @@ public class Plot {
* Constructor for a new plot.
* (Only changes after plot.create() will be properly set in the database)
*
* @param area the PlotArea where the plot is located
* @param id the plot id
* @param area the PlotArea where the plot is located
* @param id the plot id
* @param owner the plot owner
* @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.id = id;
this.owner = owner;
@ -133,10 +144,10 @@ public class Plot {
* (Only changes after plot.create() will be properly set in the database)
*
* @param area the PlotArea where the plot is located
* @param id the plot id
* @param id the plot id
* @see Plot#getPlot(Location) for existing plots
*/
public Plot(PlotArea area, PlotId id) {
public Plot(PlotArea area, @NotNull PlotId id) {
this.area = area;
this.id = id;
}
@ -146,13 +157,13 @@ public class Plot {
* The database will ignore any queries regarding temporary plots.
* Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this)
*
* @param area the PlotArea where the plot is located
* @param id the plot id
* @param area the PlotArea where the plot is located
* @param id the plot id
* @param owner the owner of the 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
*/
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.id = id;
this.owner = owner;
@ -162,14 +173,14 @@ public class Plot {
/**
* Constructor for a saved plots (Used by the database manager when plots are fetched)
*
* @param id the plot id
* @param owner the plot owner
* @param id the plot id
* @param owner the plot owner
* @param trusted the plot trusted players
* @param denied the plot denied players
* @param merged array giving merged plots
* @param denied the plot denied players
* @param merged an array giving merged 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,
PlotArea area, boolean[] merged, long timestamp, int temp) {
this.id = id;
@ -194,8 +205,8 @@ public class Plot {
/**
* Gets a plot from a string e.g. [area];[id]
*
* @param defaultArea If no area is specified
* @param string plot id/area + id
* @param defaultArea if no area is specified
* @param string plot id/area + id
* @return New or existing plot object
*/
public static Plot fromString(PlotArea defaultArea, String string) {
@ -452,7 +463,7 @@ public class Plot {
*
* @return the PlotId for this plot
*/
public PlotId getId() {
@NotNull public PlotId getId() {
return this.id;
}
@ -1627,7 +1638,7 @@ public class Plot {
/**
* Moves the settings for a plot.
*
* @param plot the plot to move
* @param plot the plot to move
* @param whenDone
* @return
*/

View File

@ -635,7 +635,7 @@ public abstract class PlotArea {
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);
return v == null ? def : (T) v;
}