Address a few deprecations

This commit is contained in:
NotMyFault 2021-05-01 18:33:02 +02:00
parent 11af33f2d5
commit 0106a4222d
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
64 changed files with 133 additions and 126 deletions

View File

@ -69,7 +69,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
if (!(commandSender instanceof Player)) {
return null;
}
PlotPlayer player = BukkitUtil.adapt((Player) commandSender);
PlotPlayer<?> player = BukkitUtil.adapt((Player) commandSender);
if (args.length == 0) {
return Collections.singletonList("plots");
}

View File

@ -44,11 +44,11 @@ import java.util.UUID;
@SuppressWarnings("unused")
public class ForceFieldListener {
private static Set<PlotPlayer> getNearbyPlayers(Player player, Plot plot) {
Set<PlotPlayer> players = new HashSet<>();
private static Set<PlotPlayer<?>> getNearbyPlayers(Player player, Plot plot) {
Set<PlotPlayer<?>> players = new HashSet<>();
for (Player nearPlayer : Iterables
.filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) {
PlotPlayer plotPlayer;
PlotPlayer<?> plotPlayer;
if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot
.equals(plotPlayer.getCurrentPlot())) {
continue;
@ -60,10 +60,10 @@ public class ForceFieldListener {
return players;
}
private static PlotPlayer hasNearbyPermitted(Player player, Plot plot) {
private static PlotPlayer<?> hasNearbyPermitted(Player player, Plot plot) {
for (Player nearPlayer : Iterables
.filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) {
PlotPlayer plotPlayer;
PlotPlayer<?> plotPlayer;
if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot
.equals(plotPlayer.getCurrentPlot())) {
continue;
@ -75,7 +75,7 @@ public class ForceFieldListener {
return null;
}
private static Vector calculateVelocity(PlotPlayer player, PlotPlayer e) {
private static Vector calculateVelocity(PlotPlayer<?> player, PlotPlayer<?> e) {
Location playerLocation = player.getLocationFull();
Location oPlayerLocation = e.getLocation();
double playerX = playerLocation.getX();
@ -105,12 +105,12 @@ public class ForceFieldListener {
return new Vector(x, y, z);
}
public static void handleForcefield(Player player, PlotPlayer plotPlayer, Plot plot) {
public static void handleForcefield(Player player, PlotPlayer<?> plotPlayer, Plot plot) {
if (plot.getFlag(ForcefieldFlag.class)) {
UUID uuid = plotPlayer.getUUID();
if (plot.isAdded(uuid)) {
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
for (PlotPlayer oPlayer : players) {
Set<PlotPlayer<?>> players = getNearbyPlayers(player, plot);
for (PlotPlayer<?> oPlayer : players) {
if (!Permissions
.hasPermission(oPlayer, Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
((BukkitPlayer) oPlayer).player
@ -118,7 +118,7 @@ public class ForceFieldListener {
}
}
} else {
PlotPlayer oPlayer = hasNearbyPermitted(player, plot);
PlotPlayer<?> oPlayer = hasNearbyPermitted(player, plot);
if (oPlayer == null) {
return;
}

View File

@ -138,7 +138,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
}
@Override
public PlotItemStack[] getItems(PlotPlayer player) {
public PlotItemStack[] getItems(PlotPlayer<?> player) {
BukkitPlayer bp = (BukkitPlayer) player;
PlayerInventory inv = bp.player.getInventory();
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i)))

View File

@ -430,7 +430,7 @@ public class BukkitUtil extends WorldUtil {
@Override
@NonNegative
public double getHealth(final @NonNull PlotPlayer player) {
public double getHealth(final @NonNull PlotPlayer<?> player) {
return Objects.requireNonNull(Bukkit.getPlayer(player.getUUID())).getHealth();
}

View File

@ -45,7 +45,7 @@ public interface BackupManager {
* @param plot Plot to perform the automatic backup on
* @param whenDone Action that runs when the automatic backup has been completed
*/
static void backup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) {
static void backup(@Nullable PlotPlayer<?> player, final @NonNull Plot plot, @NonNull Runnable whenDone) {
Objects.requireNonNull(PlotSquared.platform()).backupManager().automaticBackup(player, plot, whenDone);
}
@ -67,7 +67,7 @@ public interface BackupManager {
* @param plot Plot to perform the automatic backup on
* @param whenDone Action that runs when the automatic backup has been completed
*/
void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone);
void automaticBackup(@Nullable PlotPlayer<?> player, final @NonNull Plot plot, @NonNull Runnable whenDone);
/**
* Get the directory in which backups are stored

View File

@ -48,7 +48,7 @@ public class NullBackupManager implements BackupManager {
@Override
public void automaticBackup(
@Nullable PlotPlayer plotPlayer,
@Nullable PlotPlayer<?> plotPlayer,
@NonNull Plot plot, @NonNull Runnable whenDone
) {
whenDone.run();

View File

@ -99,7 +99,7 @@ public class SimpleBackupManager implements BackupManager {
}
@Override
public void automaticBackup(@Nullable PlotPlayer player, final @NonNull Plot plot, @NonNull Runnable whenDone) {
public void automaticBackup(@Nullable PlotPlayer<?> player, final @NonNull Plot plot, @NonNull Runnable whenDone) {
final BackupProfile profile;
if (!this.shouldAutomaticallyBackup() || (profile = getProfile(plot)) instanceof NullBackupProfile) {
whenDone.run();

View File

@ -164,7 +164,7 @@ public class Add extends Command {
}
@Override
public Collection<Command> tab(final PlotPlayer player, final String[] args, final boolean space) {
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
}

View File

@ -130,7 +130,7 @@ public class Alias extends SubCommand {
}
@Override
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
final List<Command> commands = new ArrayList<>(2);
if (args.length == 1) {
if ("set".startsWith(args[0])) {
@ -144,7 +144,7 @@ public class Alias extends SubCommand {
return Collections.emptySet();
}
private void setAlias(PlotPlayer player, Plot plot, String alias) {
private void setAlias(PlotPlayer<?> player, Plot plot, String alias) {
if (alias.isEmpty()) {
sendUsage(player);
} else if (alias.length() >= 50) {

View File

@ -96,7 +96,7 @@ public class Auto extends SubCommand {
}
public static boolean checkAllowedPlots(
PlotPlayer player, PlotArea plotarea,
PlotPlayer<?> player, PlotArea plotarea,
@Nullable Integer allowedPlots, int sizeX, int sizeZ
) {
if (allowedPlots == null) {

View File

@ -47,7 +47,7 @@ import java.util.stream.Collectors;
public class Biome extends SetCommand {
@Override
public boolean set(final PlotPlayer player, final Plot plot, final String value) {
public boolean set(final PlotPlayer<?> player, final Plot plot, final String value) {
BiomeType biome = null;
try {
biome = BiomeTypes.get(value.toLowerCase());

View File

@ -462,7 +462,7 @@ public class Cluster extends SubCommand {
// add the user if not added
cluster.invited.add(uuid);
DBFunc.setInvited(cluster, uuid);
final PlotPlayer otherPlayer =
final PlotPlayer<?> otherPlayer =
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (otherPlayer != null) {
player.sendMessage(
@ -538,7 +538,7 @@ public class Cluster extends SubCommand {
cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid);
final PlotPlayer player2 =
final PlotPlayer<?> player2 =
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (player2 != null) {
player.sendMessage(

View File

@ -75,7 +75,7 @@ public abstract class Command {
private String permission;
private boolean confirmation;
private CommandCategory category;
private Argument[] arguments;
private Argument<?>[] arguments;
public Command(
Command parent, boolean isStatic, String id, String permission,
@ -183,11 +183,11 @@ public abstract class Command {
return this.required;
}
public Argument[] getRequiredArguments() {
public Argument<?>[] getRequiredArguments() {
return this.arguments;
}
public void setRequiredArguments(Argument[] arguments) {
public void setRequiredArguments(Argument<?>[] arguments) {
this.arguments = arguments;
}
@ -460,7 +460,7 @@ public abstract class Command {
return cmd;
}
public Command getCommand(Class clazz) {
public Command getCommand(Class<?> clazz) {
for (Command cmd : this.allCommands) {
if (cmd.getClass() == clazz) {
return cmd;

View File

@ -110,7 +110,7 @@ public class Comment extends SubCommand {
return false;
}
for (final PlotPlayer pp : PlotSquared.platform().playerManager().getPlayers()) {
for (final PlotPlayer<?> pp : PlotSquared.platform().playerManager().getPlayers()) {
if (pp.getAttribute("chatspy")) {
pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
}

View File

@ -86,7 +86,7 @@ public class DatabaseCommand extends SubCommand {
public static void insertPlots(
final SQLManager manager, final List<Plot> plots,
final PlotPlayer player
final PlotPlayer<?> player
) {
TaskManager.runTaskAsync(() -> {
try {

View File

@ -108,7 +108,7 @@ public class DebugExec extends SubCommand {
return true;
}
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
this.hybridUtils.analyzePlot(plot, new RunnableVal<>() {
@Override
public void run(PlotAnalysis value) {
player.sendMessage(

View File

@ -89,7 +89,7 @@ public class DebugRoadRegen extends SubCommand {
}
}
public boolean regenPlot(PlotPlayer player) {
public boolean regenPlot(PlotPlayer<?> player) {
Location location = player.getLocation();
PlotArea area = location.getPlotArea();
if (area == null) {
@ -122,7 +122,7 @@ public class DebugRoadRegen extends SubCommand {
return true;
}
public boolean regenRegion(PlotPlayer player, String[] args) {
public boolean regenRegion(PlotPlayer<?> player, String[] args) {
int height = 0;
if (args.length == 1) {
try {

View File

@ -138,7 +138,7 @@ public class Deny extends SubCommand {
if (!uuid.equals(DBFunc.EVERYONE)) {
handleKick(PlotSquared.platform().playerManager().getPlayerIfExists(uuid), plot);
} else {
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
for (PlotPlayer<?> plotPlayer : plot.getPlayersInPlot()) {
// Ignore plot-owners
if (plot.isAdded(plotPlayer.getUUID())) {
continue;
@ -156,11 +156,11 @@ public class Deny extends SubCommand {
}
@Override
public Collection<Command> tab(final PlotPlayer player, final String[] args, final boolean space) {
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
}
private void handleKick(PlotPlayer player, Plot plot) {
private void handleKick(PlotPlayer<?> player, Plot plot) {
if (player == null) {
return;
}

View File

@ -53,7 +53,7 @@ public class Desc extends SetCommand {
}
@Override
public boolean set(PlotPlayer player, Plot plot, String desc) {
public boolean set(PlotPlayer<?> player, Plot plot, String desc) {
if (desc.isEmpty()) {
PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plot
.getFlagContainer()

View File

@ -115,7 +115,7 @@ public class Done extends SubCommand {
return true;
}
private void finish(Plot plot, PlotPlayer player, boolean success) {
private void finish(Plot plot, PlotPlayer<?> player, boolean success) {
if (!success) {
player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity"));
return;

View File

@ -51,7 +51,7 @@ public class Help extends Command {
}
@Override
public boolean canExecute(PlotPlayer player, boolean message) {
public boolean canExecute(PlotPlayer<?> player, boolean message) {
return true;
}
@ -90,7 +90,7 @@ public class Help extends Command {
}
public CompletableFuture<Boolean> displayHelp(
final PlotPlayer player, final String catRaw,
final PlotPlayer<?> player, final String catRaw,
final int page
) {
return CompletableFuture.supplyAsync(() -> {

View File

@ -223,7 +223,7 @@ public class HomeCommand extends Command {
}
@Override
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
final List<Command> completions = new ArrayList<>();
switch (args.length - 1) {
case 0:

View File

@ -153,7 +153,7 @@ public class Kick extends SubCommand {
}
@Override
public Collection<Command> tab(final PlotPlayer player, final String[] args, final boolean space) {
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {

View File

@ -86,7 +86,7 @@ public class ListCmd extends SubCommand {
this.econHandler = econHandler;
}
private String[] getArgumentList(PlotPlayer player) {
private String[] getArgumentList(PlotPlayer<?> player) {
List<String> args = new ArrayList<>();
if (this.econHandler != null && Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
args.add("forsale");

View File

@ -348,7 +348,7 @@ public class MainCommand extends Command {
}
@Override
public boolean canExecute(PlotPlayer player, boolean message) {
public boolean canExecute(PlotPlayer<?> player, boolean message) {
return true;
}

View File

@ -260,7 +260,7 @@ public class Merge extends SubCommand {
java.util.Set<UUID> uuids = adjacent.getOwners();
boolean isOnline = false;
for (final UUID owner : uuids) {
final PlotPlayer accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner);
final PlotPlayer<?> accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner);
if (!force && accepter == null) {
continue;
}

View File

@ -68,7 +68,7 @@ public class Owner extends SetCommand {
}
@Override
public boolean set(final PlotPlayer player, final Plot plot, String value) {
public boolean set(final PlotPlayer<?> player, final Plot plot, String value) {
if (value == null || value.isEmpty()) {
player.sendMessage(TranslatableCaption.of("owner.set_owner_missing_player"));
player.sendMessage(

View File

@ -136,7 +136,7 @@ public class Remove extends SubCommand {
}
@Override
public Collection<Command> tab(final PlotPlayer player, final String[] args, final boolean space) {
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {

View File

@ -83,7 +83,7 @@ public class Set extends SubCommand {
}
@Override
public boolean set(PlotPlayer player, final Plot plot, String value) {
public boolean set(PlotPlayer<?> player, final Plot plot, String value) {
final PlotArea plotArea = player.getLocation().getPlotArea();
if (plotArea == null) {
return false;
@ -190,7 +190,7 @@ public class Set extends SubCommand {
@Override
public Collection<Command> tab(
final PlotPlayer player, final String[] args,
final PlotPlayer<?> player, final String[] args,
final boolean space
) {
return TabCompletions.completePatterns(StringMan.join(args, ","));
@ -198,7 +198,7 @@ public class Set extends SubCommand {
};
}
public boolean noArgs(PlotPlayer player) {
public boolean noArgs(PlotPlayer<?> player) {
ArrayList<String> newValues = new ArrayList<>(Arrays.asList("biome", "alias", "home"));
Plot plot = player.getCurrentPlot();
if (plot != null) {

View File

@ -70,6 +70,6 @@ public abstract class SetCommand extends SubCommand {
return set(player, plot, StringMan.join(args, " "));
}
public abstract boolean set(PlotPlayer player, Plot plot, String value);
public abstract boolean set(PlotPlayer<?> player, Plot plot, String value);
}

View File

@ -41,7 +41,7 @@ import net.kyori.adventure.text.minimessage.Template;
public class SetHome extends SetCommand {
@Override
public boolean set(PlotPlayer player, Plot plot, String value) {
public boolean set(PlotPlayer<?> player, Plot plot, String value) {
switch (value.toLowerCase()) {
case "unset":
case "reset":

View File

@ -118,7 +118,7 @@ public class Setup extends SubCommand {
}
@Override
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
SetupProcess process;
try (final MetaDataAccess<SetupProcess> metaDataAccess =
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SETUP)) {

View File

@ -166,7 +166,7 @@ public class Trust extends Command {
}
@Override
public Collection<Command> tab(final PlotPlayer player, final String[] args, final boolean space) {
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
}

View File

@ -73,7 +73,7 @@ public class Visit extends Command {
}
private void visit(
final @NonNull PlotPlayer player, final @NonNull PlotQuery query, final PlotArea sortByArea,
final @NonNull PlotPlayer<?> player, final @NonNull PlotQuery query, final PlotArea sortByArea,
final RunnableVal3<Command, Runnable, Runnable> confirm, final RunnableVal2<Command, CommandResult> whenDone, int page
) {
// We get the query once,
@ -311,7 +311,7 @@ public class Visit extends Command {
}
@Override
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
final List<Command> completions = new ArrayList<>();
switch (args.length - 1) {
case 0:

View File

@ -134,7 +134,7 @@ public class Config {
file.createNewFile();
}
try (PrintWriter writer = new PrintWriter(file)) {
Object instance = root.newInstance();
Object instance = root.getDeclaredConstructor().newInstance();
save(writer, root, instance, 0);
}
} catch (Throwable e) {
@ -184,7 +184,7 @@ public class Config {
return value != null ? value.toString() : "null";
}
private static void save(PrintWriter writer, Class clazz, Object instance, int indent) {
private static void save(PrintWriter writer, Class<?> clazz, Object instance, int indent) {
try {
String lineSeparator = System.lineSeparator();
String spacing = StringMan.repeat(" ", indent);
@ -204,9 +204,9 @@ public class Config {
if (value == null && field.getType() != ConfigBlock.class) {
setAccessible(field);
Class<?>[] classes = clazz.getDeclaredClasses();
for (Class current : classes) {
for (Class<?> current : classes) {
if (StringMan.isEqual(current.getSimpleName(), field.getName())) {
field.set(instance, current.newInstance());
field.set(instance, current.getDeclaredConstructor().newInstance());
break;
}
}
@ -235,12 +235,12 @@ public class Config {
Field instanceField =
clazz.getDeclaredField(toFieldName(current.getSimpleName()));
setAccessible(instanceField);
ConfigBlock value = (ConfigBlock) instanceField.get(instance);
ConfigBlock value = (ConfigBlock<?>) instanceField.get(instance);
if (value == null) {
value = new ConfigBlock();
instanceField.set(instance, value);
for (String blockName : blockNames.value()) {
value.put(blockName, current.newInstance());
value.put(blockName, current.getDeclaredConstructor().newInstance());
}
}
// Save each instance
@ -250,9 +250,8 @@ public class Config {
writer.write(spacing + " " + toNodeName(key) + ":" + lineSeparator);
save(writer, current, entry.getValue(), indent + 4);
}
continue;
} else {
save(writer, current, current.newInstance(), indent + 2);
save(writer, current, current.getDeclaredConstructor().newInstance(), indent + 2);
}
}
} catch (Throwable e) {
@ -307,7 +306,7 @@ public class Config {
private static Object getInstance(String[] split, Class<?> root) {
try {
Class<?> clazz = root == null ? MethodHandles.lookup().lookupClass() : root;
Object instance = clazz.newInstance();
Object instance = clazz.getDeclaredConstructor().newInstance();
while (split.length > 0) {
if (split.length == 1) {
return instance;
@ -326,7 +325,7 @@ public class Config {
if (instanceField.getType() != ConfigBlock.class) {
Object value = instanceField.get(instance);
if (value == null) {
value = found.newInstance();
value = found.getDeclaredConstructor().newInstance();
instanceField.set(instance, value);
}
clazz = found;
@ -334,14 +333,14 @@ public class Config {
split = Arrays.copyOfRange(split, 1, split.length);
continue;
}
ConfigBlock value = (ConfigBlock) instanceField.get(instance);
ConfigBlock value = (ConfigBlock<?>) instanceField.get(instance);
if (value == null) {
value = new ConfigBlock();
instanceField.set(instance, value);
}
instance = value.get(split[1]);
if (instance == null) {
instance = found.newInstance();
instance = found.getDeclaredConstructor().newInstance();
value.put(split[1], instance);
}
clazz = found;
@ -352,7 +351,7 @@ public class Config {
if (found != null) {
split = Arrays.copyOfRange(split, 1, split.length);
clazz = found;
instance = clazz.newInstance();
instance = clazz.getDeclaredConstructor().newInstance();
continue;
}
return null;

View File

@ -42,20 +42,20 @@ public class ConfigurationNode {
private final String constant;
private final Object defaultValue;
private final String description;
private final ConfigurationUtil.SettingValue type;
private final ConfigurationUtil.SettingValue<?> type;
private final Collection<String> suggestions;
private Object value;
public ConfigurationNode(
String constant, Object defaultValue, String description,
ConfigurationUtil.SettingValue type
ConfigurationUtil.SettingValue<?> type
) {
this(constant, defaultValue, description, type, new ArrayList<>());
}
public ConfigurationNode(
String constant, Object defaultValue, String description,
ConfigurationUtil.SettingValue type, Collection<String> suggestions
ConfigurationUtil.SettingValue<?> type, Collection<String> suggestions
) {
this.constant = constant;
this.defaultValue = defaultValue;
@ -65,7 +65,7 @@ public class ConfigurationNode {
this.suggestions = suggestions;
}
public ConfigurationUtil.SettingValue getType() {
public ConfigurationUtil.SettingValue<?> getType() {
return this.type;
}

View File

@ -42,7 +42,7 @@ public class PlayerClaimPlotEvent extends PlotPlayerEvent implements Cancellable
* @param plot Plot that was claimed
* @param schematic The schematic defined or null
*/
public PlayerClaimPlotEvent(PlotPlayer player, Plot plot, @Nullable String schematic) {
public PlayerClaimPlotEvent(PlotPlayer<?> player, Plot plot, @Nullable String schematic) {
super(player, plot);
this.schematic = schematic;
}

View File

@ -36,7 +36,7 @@ public class PlayerEnterPlotEvent extends PlotPlayerEvent {
* @param player Player that entered the plot
* @param plot Plot that was entered
*/
public PlayerEnterPlotEvent(PlotPlayer player, Plot plot) {
public PlayerEnterPlotEvent(PlotPlayer<?> player, Plot plot) {
super(player, plot);
}

View File

@ -39,7 +39,7 @@ public class PlayerLeavePlotEvent extends PlotPlayerEvent {
* @param player Player that left the plot
* @param plot Plot that was left
*/
public PlayerLeavePlotEvent(PlotPlayer player, Plot plot) {
public PlayerLeavePlotEvent(PlotPlayer<?> player, Plot plot) {
super(player, plot);
}

View File

@ -32,7 +32,7 @@ import java.util.UUID;
public class PlayerPlotDeniedEvent extends PlotEvent {
private final PlotPlayer initiator;
private final PlotPlayer<?> initiator;
private final boolean added;
private final UUID player;
@ -44,7 +44,7 @@ public class PlayerPlotDeniedEvent extends PlotEvent {
* @param player Player that was denied/un-denied
* @param added true of add to deny list, false if removed
*/
public PlayerPlotDeniedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
public PlayerPlotDeniedEvent(PlotPlayer<?> initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
@ -74,7 +74,7 @@ public class PlayerPlotDeniedEvent extends PlotEvent {
*
* @return PlotPlayer
*/
public PlotPlayer getInitiator() {
public PlotPlayer<?> getInitiator() {
return this.initiator;
}

View File

@ -35,7 +35,7 @@ import java.util.UUID;
*/
public class PlayerPlotHelperEvent extends PlotEvent {
private final PlotPlayer initiator;
private final PlotPlayer<?> initiator;
private final boolean added;
private final UUID player;
@ -47,7 +47,7 @@ public class PlayerPlotHelperEvent extends PlotEvent {
* @param player Player that was added/removed from the helper list
* @param added true of the player was added, false if the player was removed
*/
public PlayerPlotHelperEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
public PlayerPlotHelperEvent(PlotPlayer<?> initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
@ -77,7 +77,7 @@ public class PlayerPlotHelperEvent extends PlotEvent {
*
* @return PlotPlayer
*/
public PlotPlayer getInitiator() {
public PlotPlayer<?> getInitiator() {
return this.initiator;
}

View File

@ -32,7 +32,7 @@ import java.util.UUID;
public class PlayerPlotTrustedEvent extends PlotEvent {
private final PlotPlayer initiator;
private final PlotPlayer<?> initiator;
private final boolean added;
private final UUID player;
@ -44,7 +44,7 @@ public class PlayerPlotTrustedEvent extends PlotEvent {
* @param player Player that was added/removed from the trusted list
* @param added true of the player was added, false if the player was removed
*/
public PlayerPlotTrustedEvent(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
public PlayerPlotTrustedEvent(PlotPlayer<?> initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
@ -74,7 +74,7 @@ public class PlayerPlotTrustedEvent extends PlotEvent {
*
* @return PlotPlayer
*/
public PlotPlayer getInitiator() {
public PlotPlayer<?> getInitiator() {
return this.initiator;
}

View File

@ -44,7 +44,7 @@ public class PlayerTeleportToPlotEvent extends PlotPlayerEvent implements Cancel
* @param from Start location
* @param plot Plot to which the player was teleported
*/
public PlayerTeleportToPlotEvent(PlotPlayer player, Location from, Plot plot) {
public PlayerTeleportToPlotEvent(PlotPlayer<?> player, Location from, Plot plot) {
super(player, plot);
this.from = from;
}

View File

@ -34,12 +34,12 @@ import java.util.UUID;
public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEvent {
private final PlotPlayer initiator;
private final PlotPlayer<?> initiator;
@Nullable
private final UUID oldOwner;
@Nullable
private UUID newOwner;
private boolean hasOldOwner;
private final boolean hasOldOwner;
private Result eventResult;
/**
@ -52,7 +52,7 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv
* @param hasOldOwner If the plot has an old owner
*/
public PlotChangeOwnerEvent(
PlotPlayer initiator, Plot plot, @Nullable UUID oldOwner,
PlotPlayer<?> initiator, Plot plot, @Nullable UUID oldOwner,
@Nullable UUID newOwner, boolean hasOldOwner
) {
super(plot);
@ -81,11 +81,11 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv
}
/**
* Get the change-owner initator
* Get the change-owner initiator
*
* @return Player
*/
public PlotPlayer getInitiator() {
public PlotPlayer<?> getInitiator() {
return this.initiator;
}

View File

@ -40,7 +40,7 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable
private Direction dir;
private int max;
private Result eventResult;
private PlotPlayer player;
private final PlotPlayer<?> player;
/**
* PlotMergeEvent: Called when plots are merged
@ -93,7 +93,7 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable
this.max = max;
}
public PlotPlayer getPlayer() {
public PlotPlayer<?> getPlayer() {
return this.player;
}

View File

@ -30,14 +30,14 @@ import com.plotsquared.core.plot.Plot;
public abstract class PlotPlayerEvent extends PlotEvent {
private final PlotPlayer plotPlayer;
private final PlotPlayer<?> plotPlayer;
public PlotPlayerEvent(PlotPlayer plotPlayer, Plot plot) {
public PlotPlayerEvent(PlotPlayer<?> plotPlayer, Plot plot) {
super(plot);
this.plotPlayer = plotPlayer;
}
public PlotPlayer getPlotPlayer() {
public PlotPlayer<?> getPlotPlayer() {
return this.plotPlayer;
}

View File

@ -32,7 +32,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent {
private final PlotPlayer rater;
private final PlotPlayer<?> rater;
@Nullable
private Rating rating;
private Result eventResult;
@ -44,13 +44,13 @@ public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent {
* @param rating The rating being given
* @param plot The plot being rated
*/
public PlotRateEvent(PlotPlayer rater, @Nullable Rating rating, Plot plot) {
public PlotRateEvent(PlotPlayer<?> rater, @Nullable Rating rating, Plot plot) {
super(plot);
this.rater = rater;
this.rating = rating;
}
public PlotPlayer getRater() {
public PlotPlayer<?> getRater() {
return this.rater;
}

View File

@ -173,7 +173,7 @@ public class PlotListener {
if (plot.getFlag(NotifyEnterFlag.class)) {
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
player.sendMessage(
TranslatableCaption.of("notification.notify_enter"),
@ -381,7 +381,7 @@ public class PlotListener {
if (plot.getFlag(NotifyLeaveFlag.class)) {
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
player.sendMessage(
TranslatableCaption.of("notification.notify_leave"),

View File

@ -41,7 +41,7 @@ import java.util.Map;
*/
public final class MetaDataKey<T> {
private static final Map<String, MetaDataKey> keyMap = new HashMap<>();
private static final Map<String, MetaDataKey<?>> keyMap = new HashMap<>();
private static final Object keyMetaData = new Object();
private final String key;
@ -82,7 +82,7 @@ public final class MetaDataKey<T> {
if (o == null || getClass() != o.getClass()) {
return false;
}
final MetaDataKey lockKey = (MetaDataKey) o;
final MetaDataKey<?> lockKey = (MetaDataKey<?>) o;
return Objects.equal(this.key, lockKey.key);
}

View File

@ -121,6 +121,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
*/
public class Plot {
public static final int MAX_HEIGHT = 256;
private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
@ -2134,7 +2135,7 @@ public class Plot {
* @param player the claiming player
* @return if the given player can claim the plot
*/
public boolean canClaim(@NonNull PlotPlayer player) {
public boolean canClaim(@NonNull PlotPlayer<?> player) {
PlotCluster cluster = this.getCluster();
if (cluster != null) {
if (!cluster.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.claim")) {

View File

@ -716,7 +716,7 @@ public abstract class PlotArea {
* @deprecated Use {@link #getPlots(UUID)}
*/
@Deprecated
public Set<Plot> getPlots(final @NonNull PlotPlayer player) {
public Set<Plot> getPlots(final @NonNull PlotPlayer<?> player) {
return getPlots(player.getUUID());
}
@ -872,7 +872,7 @@ public abstract class PlotArea {
return this.plots.put(plot.getId(), plot) == null;
}
public Plot getNextFreePlot(final PlotPlayer player, @Nullable PlotId start) {
public Plot getNextFreePlot(final PlotPlayer<?> player, @Nullable PlotId start) {
int plots;
PlotId center;
PlotId min = getMin();
@ -968,7 +968,7 @@ public abstract class PlotArea {
}
public @Nullable List<Plot> canClaim(
final @Nullable PlotPlayer player, final @NonNull PlotId pos1,
final @Nullable PlotPlayer<?> player, final @NonNull PlotId pos1,
final @NonNull PlotId pos2
) {
if (pos1.getX() == pos2.getX() && pos1.getY() == pos2.getY()) {

View File

@ -210,6 +210,11 @@ public abstract class PlotManager {
Template.zipAll(plotArea.getWorldName(), files);
}
/**
* @return the world height
* @deprecated In favor of custom world heights within 1.17 and therefore scheduled for removal without replacement
*/
@Deprecated
public int getWorldHeight() {
return 255;
}

View File

@ -55,7 +55,7 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
);
}
public static boolean allowsTeleport(PlotPlayer player, Plot plot) {
public static boolean allowsTeleport(PlotPlayer<?> player, Plot plot) {
final DeniedGroup value = plot.getFlag(DenyTeleportFlag.class);
if (value == DeniedGroup.NONE) {
return true;

View File

@ -89,7 +89,7 @@ public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
@Override
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
this.storeCache(x, y, z, pattern.apply(BlockVector3.at(x, y, z)).toImmutableState());
this.storeCache(x, y, z, pattern.applyBlock(BlockVector3.at(x, y, z)).toImmutableState());
return true;
}

View File

@ -82,7 +82,7 @@ public class LocationOffsetDelegateQueueCoordinator extends DelegateQueueCoordin
@Override
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
final BlockVector3 blockVector3 = BlockVector3.at(x + blockX, y, z + blockZ);
return this.setBlock(x, y, z, pattern.apply(blockVector3));
return this.setBlock(x, y, z, pattern.applyBlock(blockVector3));
}
@Override

View File

@ -199,6 +199,8 @@ public abstract class QueueCoordinator {
* @param z z coordinate
* @param biome biome
* @return success or not
*
* @deprecated Biomes now take XYZ, see {@code setBiome int x, int y, int z}
*/
@Deprecated
public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome);

View File

@ -101,6 +101,6 @@ public abstract class ChunkManager {
}
@Deprecated
public abstract CompletableFuture loadChunk(String world, BlockVector2 loc, boolean force);
public abstract CompletableFuture<?> loadChunk(String world, BlockVector2 loc, boolean force);
}

View File

@ -43,7 +43,7 @@ public abstract class InventoryUtil {
final PlotItemStack item
);
public abstract PlotItemStack[] getItems(final PlotPlayer player);
public abstract PlotItemStack[] getItems(final PlotPlayer<?> player);
public abstract boolean isOpen(final PlotInventory plotInventory);

View File

@ -54,12 +54,12 @@ public class PatternUtil {
if (pattern instanceof BlockPattern || pattern instanceof RandomPattern
|| pattern instanceof BlockState || pattern instanceof BlockType
|| pattern instanceof BaseBlock) {
return pattern.apply(BlockVector3.ZERO);
return pattern.applyBlock(BlockVector3.ZERO);
}
return pattern.apply(BlockVector3.at(x, y, z));
return pattern.applyBlock(BlockVector3.at(x, y, z));
}
public static Pattern parse(PlotPlayer plotPlayer, String input) {
public static Pattern parse(PlotPlayer<?> plotPlayer, String input) {
return parse(plotPlayer, input, true);
}
@ -71,7 +71,7 @@ public class PatternUtil {
return new ArrayList<>();
}
public static Pattern parse(PlotPlayer plotPlayer, String input, boolean allowLegacy) {
public static Pattern parse(PlotPlayer<?> plotPlayer, String input, boolean allowLegacy) {
ParserContext context = new ParserContext();
if (plotPlayer != null) {
Actor actor = plotPlayer.toActor();

View File

@ -100,7 +100,7 @@ public class ReflectionUtils {
* @param clazz class
* @return RefClass based on passed class
*/
public static RefClass getRefClass(Class clazz) {
public static RefClass getRefClass(Class<?> clazz) {
return new RefClass(clazz);
}
@ -133,11 +133,11 @@ public class ReflectionUtils {
* @throws NoSuchMethodException if method not found
*/
public RefMethod getMethod(String name, Object... types) throws NoSuchMethodException {
Class[] classes = new Class[types.length];
Class<?>[] classes = new Class[types.length];
int i = 0;
for (Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
classes[i++] = (Class<?>) e;
} else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
} else {
@ -232,9 +232,9 @@ public class ReflectionUtils {
*/
public static class RefConstructor {
private final Constructor constructor;
private final Constructor<?> constructor;
private RefConstructor(Constructor constructor) {
private RefConstructor(Constructor<?> constructor) {
this.constructor = constructor;
constructor.setAccessible(true);
}

View File

@ -312,7 +312,7 @@ public class StringMan {
return null;
}
startsWith = startsWith.toLowerCase();
Iterator iterator = col.iterator();
Iterator<?> iterator = col.iterator();
while (iterator.hasNext()) {
Object item = iterator.next();
if (item == null || !item.toString().toLowerCase().startsWith(startsWith)) {

View File

@ -36,13 +36,13 @@ public class HelpMenu {
private static final int PER_PAGE = 5;
private final PlotPlayer commandCaller;
private final PlotPlayer<?> commandCaller;
private HelpPage page = new HelpPage(CommandCategory.INFO, 0, 0);
private int maxPage;
private CommandCategory commandCategory;
private List<Command> commands;
public HelpMenu(PlotPlayer commandCaller) {
public HelpMenu(PlotPlayer<?> commandCaller) {
this.commandCaller = commandCaller;
}

View File

@ -51,7 +51,7 @@ public class HelpPage {
this.maxTemplate = Template.of("max", String.valueOf(maxPages + 1));
}
public void render(PlotPlayer player) {
public void render(PlotPlayer<?> player) {
if (this.helpObjects.size() < 1) {
player.sendMessage(TranslatableCaption.of("invalid.not_valid_number"), Template.of("value", "(0)"));
} else {

View File

@ -197,7 +197,7 @@ public final class PlotQuery implements Iterable<Plot> {
* @param owner Owner
* @return The query instance
*/
public @NonNull PlotQuery ownedBy(final @NonNull PlotPlayer owner) {
public @NonNull PlotQuery ownedBy(final @NonNull PlotPlayer<?> owner) {
Preconditions.checkNotNull(owner, "Owner may not be null");
return this.addFilter(new OwnerFilter(owner.getUUID()));
}