mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
parent
a910b542a0
commit
b4c33aaa18
@ -931,10 +931,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 (location.isPlotArea() || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
|
if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = location.getPlot();
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
|||||||
import org.bukkit.plugin.RegisteredListener;
|
import org.bukkit.plugin.RegisteredListener;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -56,7 +55,7 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
super.populatePersistentMetaMap();
|
super.populatePersistentMetaMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getLocation() {
|
@NotNull @Override public Location getLocation() {
|
||||||
final Location location = super.getLocation();
|
final Location location = super.getLocation();
|
||||||
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,9 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -243,7 +244,7 @@ import java.util.Set;
|
|||||||
location.getBlockZ());
|
location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getLocationFull(@NonNull final Entity entity) {
|
@NotNull public static Location getLocationFull(@NonNull final Entity entity) {
|
||||||
final org.bukkit.Location location = entity.getLocation();
|
final org.bukkit.Location location = entity.getLocation();
|
||||||
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
|
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
|
||||||
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(),
|
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(),
|
||||||
|
@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.flag.FlagManager;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
@ -45,7 +44,6 @@ import java.util.stream.IntStream;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean set(PlotPlayer player, final Plot plot, String value) {
|
@Override public boolean set(PlotPlayer player, final Plot plot, String value) {
|
||||||
PlotArea plotArea = player.getLocation().getPlotArea();
|
|
||||||
PlotManager manager = player.getLocation().getPlotManager();
|
PlotManager manager = player.getLocation().getPlotManager();
|
||||||
String[] components = manager.getPlotComponents(plot.getId());
|
String[] components = manager.getPlotComponents(plot.getId());
|
||||||
boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID());
|
boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(player.getUUID());
|
||||||
|
@ -12,8 +12,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -47,9 +47,6 @@ public class AugmentedUtils {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IndependentPlotGenerator generator = area.getGenerator();
|
IndependentPlotGenerator generator = area.getGenerator();
|
||||||
if (generator == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Mask
|
// Mask
|
||||||
if (queue == null) {
|
if (queue == null) {
|
||||||
queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||||
|
@ -44,7 +44,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
super(worldName, id, generator, min, max);
|
super(worldName, id, generator, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@NotNull @Override
|
||||||
protected PlotManager createManager() {
|
protected PlotManager createManager() {
|
||||||
return new HybridPlotManager(this);
|
return new HybridPlotManager(this);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public abstract class HybridUtils {
|
|||||||
}
|
}
|
||||||
HybridUtils.UPDATE = true;
|
HybridUtils.UPDATE = true;
|
||||||
Set<ChunkLoc> regions = new HashSet<>();
|
Set<ChunkLoc> regions = new HashSet<>();
|
||||||
regions.add(ChunkManager.manager.getChunkChunk(plot.getCenter()));
|
regions.add(ChunkManager.getChunkChunk(plot.getCenter()));
|
||||||
return scheduleRoadUpdate(plot.getArea(), regions, extend);
|
return scheduleRoadUpdate(plot.getArea(), regions, extend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class ConsolePlayer extends PlotPlayer {
|
|||||||
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
|
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getLocation() {
|
@NotNull @Override public Location getLocation() {
|
||||||
return this.getMeta("location");
|
return this.getMeta("location");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -37,12 +36,12 @@ public abstract class PlotArea {
|
|||||||
|
|
||||||
public final String worldname;
|
public final String worldname;
|
||||||
public final String id;
|
public final String id;
|
||||||
public final PlotManager manager;
|
@NotNull public final PlotManager manager;
|
||||||
public final int worldhash;
|
public final int worldhash;
|
||||||
protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
|
protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
|
||||||
private final PlotId min;
|
private final PlotId min;
|
||||||
private final PlotId max;
|
private final PlotId max;
|
||||||
private final IndependentPlotGenerator generator;
|
@NotNull private final IndependentPlotGenerator generator;
|
||||||
private final BlockBucket[][] blockBucketChunk;
|
private final BlockBucket[][] blockBucketChunk;
|
||||||
public int MAX_PLOT_MEMBERS = 128;
|
public int MAX_PLOT_MEMBERS = 128;
|
||||||
public boolean AUTO_MERGE = false;
|
public boolean AUTO_MERGE = false;
|
||||||
@ -102,7 +101,7 @@ public abstract class PlotArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract PlotManager createManager();
|
@NotNull protected abstract PlotManager createManager();
|
||||||
|
|
||||||
public LocalBlockQueue getQueue(final boolean autoQueue) {
|
public LocalBlockQueue getQueue(final boolean autoQueue) {
|
||||||
return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue);
|
return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue);
|
||||||
@ -117,11 +116,8 @@ public abstract class PlotArea {
|
|||||||
if (blockBucketChunk != null) {
|
if (blockBucketChunk != null) {
|
||||||
return blockBucketChunk;
|
return blockBucketChunk;
|
||||||
}
|
}
|
||||||
if (generator != null) {
|
|
||||||
return generator.generateBlockBucketChunk(this);
|
return generator.generateBlockBucketChunk(this);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the region for this PlotArea or a RegionWrapper encompassing
|
* Returns the region for this PlotArea or a RegionWrapper encompassing
|
||||||
@ -178,7 +174,7 @@ public abstract class PlotArea {
|
|||||||
*
|
*
|
||||||
* @return the {@link IndependentPlotGenerator}
|
* @return the {@link IndependentPlotGenerator}
|
||||||
*/
|
*/
|
||||||
public IndependentPlotGenerator getGenerator() {
|
@NotNull public IndependentPlotGenerator getGenerator() {
|
||||||
return this.generator;
|
return this.generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +613,7 @@ public abstract class PlotArea {
|
|||||||
return this.clusters != null ? this.clusters.get(id.x, id.y) : null;
|
return this.clusters != null ? this.clusters.get(id.x, id.y) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotManager getPlotManager() {
|
@NotNull public PlotManager getPlotManager() {
|
||||||
return this.manager;
|
return this.manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.intellectualsites.plotsquared.plot.object;
|
package com.github.intellectualsites.plotsquared.plot.object;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class PlotId {
|
public class PlotId {
|
||||||
|
@ -16,7 +16,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -307,7 +306,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
|||||||
*
|
*
|
||||||
* @return The location
|
* @return The location
|
||||||
*/
|
*/
|
||||||
public Location getLocation() {
|
@NotNull public Location getLocation() {
|
||||||
Location location = getMeta("location");
|
Location location = getMeta("location");
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
return location;
|
return location;
|
||||||
|
@ -4,8 +4,8 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -9,9 +9,9 @@ import com.github.intellectualsites.plotsquared.plot.object.*;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
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;
|
||||||
@ -26,7 +26,7 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@NotNull @Override
|
||||||
protected PlotManager createManager() {
|
protected PlotManager createManager() {
|
||||||
return new SinglePlotManager(this);
|
return new SinglePlotManager(this);
|
||||||
}
|
}
|
||||||
@ -76,8 +76,8 @@ public class SinglePlotArea extends GridPlotWorld {
|
|||||||
new File(dataDest, file.getName()).toPath());
|
new File(dataDest, file.getName()).toPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ignore) {
|
} catch (IOException exception) {
|
||||||
ignore.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream;
|
import com.github.intellectualsites.plotsquared.plot.object.stream.AbstractDelegateOutputStream;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
@ -560,11 +560,11 @@ public class MainUtil {
|
|||||||
* Send a message to the player.
|
* Send a message to the player.
|
||||||
*
|
*
|
||||||
* @param player Player to receive message
|
* @param player Player to receive message
|
||||||
* @param msg Message to send
|
* @param message Message to send
|
||||||
* @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...))
|
* @return true Can be used in things such as commands (return PlayerFunctions.sendMessage(...))
|
||||||
*/
|
*/
|
||||||
public static boolean sendMessage(PlotPlayer player, String msg) {
|
public static boolean sendMessage(PlotPlayer player, String message) {
|
||||||
return sendMessage(player, msg, true);
|
return sendMessage(player, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -585,7 +585,7 @@ public class MainUtil {
|
|||||||
* @param prefix If the message should be prefixed with the configured prefix
|
* @param prefix If the message should be prefixed with the configured prefix
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean sendMessage(CommandCaller player, String msg, boolean prefix) {
|
public static boolean sendMessage(CommandCaller player, @NotNull String msg, boolean prefix) {
|
||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg;
|
String message = (prefix ? Captions.PREFIX.getTranslated() : "") + msg;
|
||||||
|
Loading…
Reference in New Issue
Block a user