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