mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
chore: Remove things marked as for removal
This commit is contained in:
parent
746028afbc
commit
68c26b5ae6
@ -24,7 +24,6 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
|||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.location.UncheckedWorldLocation;
|
import com.plotsquared.core.location.UncheckedWorldLocation;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
|
||||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
@ -47,17 +46,6 @@ final class BlockStatePopulator extends BlockPopulator {
|
|||||||
this.plotGenerator = plotGenerator;
|
this.plotGenerator = plotGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public BlockStatePopulator(
|
|
||||||
final @NonNull IndependentPlotGenerator plotGenerator,
|
|
||||||
final @NonNull PlotAreaManager plotAreaManager
|
|
||||||
) {
|
|
||||||
this.plotGenerator = plotGenerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(
|
public void populate(
|
||||||
@NonNull final WorldInfo worldInfo,
|
@NonNull final WorldInfo worldInfo,
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
* PlotSquared, a land and world management plugin for Minecraft.
|
|
||||||
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
|
||||||
* Copyright (C) IntellectualSites team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.bukkit.listener;
|
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.core.configuration.Settings;
|
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|
||||||
import com.plotsquared.core.location.Location;
|
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
|
||||||
import org.bukkit.block.Banner;
|
|
||||||
import org.bukkit.block.Beacon;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.CommandBlock;
|
|
||||||
import org.bukkit.block.Comparator;
|
|
||||||
import org.bukkit.block.Conduit;
|
|
||||||
import org.bukkit.block.Container;
|
|
||||||
import org.bukkit.block.CreatureSpawner;
|
|
||||||
import org.bukkit.block.DaylightDetector;
|
|
||||||
import org.bukkit.block.EnchantingTable;
|
|
||||||
import org.bukkit.block.EndGateway;
|
|
||||||
import org.bukkit.block.EnderChest;
|
|
||||||
import org.bukkit.block.Jukebox;
|
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
import org.bukkit.block.Skull;
|
|
||||||
import org.bukkit.block.Structure;
|
|
||||||
import org.bukkit.block.data.type.Bed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated P2 effectively no longer supports 1.13
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.10.4")
|
|
||||||
public class PaperListener113 extends PaperListener {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public PaperListener113(@NonNull PlotAreaManager plotAreaManager) {
|
|
||||||
super(plotAreaManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
|
||||||
if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BlockState state = event.getBlock().getState(false);
|
|
||||||
if (!(state instanceof Banner || state instanceof Beacon || state instanceof Bed || state instanceof CommandBlock
|
|
||||||
|| state instanceof Comparator || state instanceof Conduit || state instanceof Container || state instanceof CreatureSpawner
|
|
||||||
|| state instanceof DaylightDetector || state instanceof EnchantingTable || state instanceof EnderChest || state instanceof EndGateway
|
|
||||||
|| state instanceof Jukebox || state instanceof Sign || state instanceof Skull || state instanceof Structure)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
|
||||||
final PlotArea plotArea = location.getPlotArea();
|
|
||||||
if (plotArea == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
|
||||||
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
|
||||||
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
|
||||||
plotPlayer.sendMessage(
|
|
||||||
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
|
||||||
TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Chunk_Processor.MAX_TILES)))
|
|
||||||
);
|
|
||||||
event.setCancelled(true);
|
|
||||||
event.setBuild(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -71,31 +71,11 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
* @param eventDispatcher EventDispatcher instance
|
* @param eventDispatcher EventDispatcher instance
|
||||||
* @param player Bukkit player instance
|
* @param player Bukkit player instance
|
||||||
* @param permissionHandler PermissionHandler instance
|
* @param permissionHandler PermissionHandler instance
|
||||||
*
|
|
||||||
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
|
|
||||||
* This method will be made private in a future release.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
BukkitPlayer(
|
||||||
public BukkitPlayer(
|
final @NonNull PlotAreaManager plotAreaManager,
|
||||||
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
|
final @NonNull EventDispatcher eventDispatcher,
|
||||||
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
|
final @NonNull Player player,
|
||||||
) {
|
|
||||||
this(plotAreaManager, eventDispatcher, player, false, permissionHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param plotAreaManager PlotAreaManager instance
|
|
||||||
* @param eventDispatcher EventDispatcher instance
|
|
||||||
* @param player Bukkit player instance
|
|
||||||
* @param permissionHandler PermissionHandler instance
|
|
||||||
*
|
|
||||||
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
|
|
||||||
* This method will be made private in a future release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
|
||||||
public BukkitPlayer(
|
|
||||||
final @NonNull PlotAreaManager plotAreaManager, final @NonNull
|
|
||||||
EventDispatcher eventDispatcher, final @NonNull Player player,
|
|
||||||
final boolean realPlayer,
|
final boolean realPlayer,
|
||||||
final @NonNull PermissionHandler permissionHandler
|
final @NonNull PermissionHandler permissionHandler
|
||||||
) {
|
) {
|
||||||
|
@ -66,13 +66,12 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public @NonNull BukkitPlayer createPlayer(final @NonNull UUID uuid) {
|
public @NonNull BukkitPlayer createPlayer(final @NonNull UUID uuid) {
|
||||||
final Player player = Bukkit.getPlayer(uuid);
|
final Player player = Bukkit.getPlayer(uuid);
|
||||||
if (player == null || !player.isOnline()) {
|
if (player == null || !player.isOnline()) {
|
||||||
throw new NoSuchPlayerException(uuid);
|
throw new NoSuchPlayerException(uuid);
|
||||||
}
|
}
|
||||||
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, this.permissionHandler);
|
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, player, false, this.permissionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -37,7 +37,6 @@ import org.bukkit.block.Sign;
|
|||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
@ -52,15 +51,6 @@ public class StateWrapper {
|
|||||||
public org.bukkit.block.BlockState state = null;
|
public org.bukkit.block.BlockState state = null;
|
||||||
public CompoundTag tag = null;
|
public CompoundTag tag = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated in favour of using WE methods for obtaining NBT, specifically by obtaining a
|
|
||||||
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public StateWrapper(org.bukkit.block.BlockState state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StateWrapper(CompoundTag tag) {
|
public StateWrapper(CompoundTag tag) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
@ -254,26 +244,6 @@ public class StateWrapper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a CompoundTag of the contents of a block's inventory (chest, furnace, etc.).
|
|
||||||
*
|
|
||||||
* @deprecated in favour of using WorldEdit methods for obtaining NBT, specifically by obtaining a
|
|
||||||
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public CompoundTag getTag() {
|
|
||||||
if (this.tag != null) {
|
|
||||||
return this.tag;
|
|
||||||
}
|
|
||||||
if (this.state instanceof InventoryHolder inv) {
|
|
||||||
ItemStack[] contents = inv.getInventory().getContents();
|
|
||||||
Map<String, Tag> values = new HashMap<>();
|
|
||||||
values.put("Items", new ListTag(CompoundTag.class, serializeInventory(contents)));
|
|
||||||
return new CompoundTag(values);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
String tileid = this.tag.getString("id").toLowerCase();
|
String tileid = this.tag.getString("id").toLowerCase();
|
||||||
if (tileid.startsWith("minecraft:")) {
|
if (tileid.startsWith("minecraft:")) {
|
||||||
|
@ -105,38 +105,6 @@ public class PlayerAutoPlotEvent extends PlotEvent implements CancellablePlotEve
|
|||||||
return this.plotArea;
|
return this.plotArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeX()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.1.0")
|
|
||||||
public int getSize_x() {
|
|
||||||
return getSizeX();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeX(int)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.1.0")
|
|
||||||
public void setSize_x(int sizeX) {
|
|
||||||
setSizeX(sizeX);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#getSizeZ()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.1.0")
|
|
||||||
public int getSize_z() {
|
|
||||||
return getSizeZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated for removal. Use {@link PlayerAutoPlotEvent#setSizeZ(int)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.1.0")
|
|
||||||
public void setSize_z(int sizeZ) {
|
|
||||||
setSizeZ(sizeZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the x size of the auto-area
|
* Get the x size of the auto-area
|
||||||
*
|
*
|
||||||
|
@ -68,8 +68,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
||||||
public boolean ROAD_SCHEMATIC_ENABLED;
|
public boolean ROAD_SCHEMATIC_ENABLED;
|
||||||
public boolean PLOT_SCHEMATIC = false;
|
public boolean PLOT_SCHEMATIC = false;
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public int PLOT_SCHEMATIC_HEIGHT = -1;
|
|
||||||
public short PATH_WIDTH_LOWER;
|
public short PATH_WIDTH_LOWER;
|
||||||
public short PATH_WIDTH_UPPER;
|
public short PATH_WIDTH_UPPER;
|
||||||
public HashMap<Integer, BaseBlock[]> G_SCH;
|
public HashMap<Integer, BaseBlock[]> G_SCH;
|
||||||
@ -104,22 +102,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
PlotSquared.platform().injector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public static byte wrap(byte data, int start) {
|
|
||||||
if ((data >= start) && (data < (start + 4))) {
|
|
||||||
data = (byte) ((((data - start) + 2) & 3) + start);
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public static byte wrap2(byte data, int start) {
|
|
||||||
if ((data >= start) && (data < (start + 2))) {
|
|
||||||
data = (byte) ((((data - start) + 1) & 1) + start);
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BaseBlock rotate(BaseBlock id) {
|
public static BaseBlock rotate(BaseBlock id) {
|
||||||
|
|
||||||
CompoundTag tag = id.getNbtData();
|
CompoundTag tag = id.getNbtData();
|
||||||
@ -486,11 +468,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
|
||||||
* @deprecated This method should not be available for public API usage and will be made private.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.10.2")
|
|
||||||
public void addOverlayBlock(short x, short y, short z, BaseBlock id, boolean rotate, int height) {
|
|
||||||
if (z < 0) {
|
if (z < 0) {
|
||||||
z += this.SIZE;
|
z += this.SIZE;
|
||||||
} else if (z >= this.SIZE) {
|
} else if (z >= this.SIZE) {
|
||||||
@ -521,11 +499,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
existing[y] = id;
|
existing[y] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void addOverlayBiome(short x, short z, BiomeType id) {
|
||||||
* @deprecated This method should not be available for public API usage and will be made private.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.10.2")
|
|
||||||
public void addOverlayBiome(short x, short z, BiomeType id) {
|
|
||||||
if (z < 0) {
|
if (z < 0) {
|
||||||
z += this.SIZE;
|
z += this.SIZE;
|
||||||
} else if (z >= this.SIZE) {
|
} else if (z >= this.SIZE) {
|
||||||
|
@ -106,17 +106,6 @@ public final class PlotId {
|
|||||||
return PlotId.of(hash >> 16, hash & 0xFFFF);
|
return PlotId.of(hash >> 16, hash & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a copy of the plot ID
|
|
||||||
*
|
|
||||||
* @return Plot ID copy
|
|
||||||
* @deprecated PlotId is immutable, copy is not required.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.10.2")
|
|
||||||
public @NonNull PlotId copy() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ID X component
|
* Get the ID X component
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.plotsquared.core.plot.expiration;
|
package com.plotsquared.core.plot.expiration;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotPlatform;
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.caption.Caption;
|
import com.plotsquared.core.configuration.caption.Caption;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
@ -63,11 +62,6 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
|||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link PlotPlatform#expireManager()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.10.2")
|
|
||||||
public static ExpireManager IMP;
|
|
||||||
private final ConcurrentHashMap<UUID, Long> dates_cache;
|
private final ConcurrentHashMap<UUID, Long> dates_cache;
|
||||||
private final ConcurrentHashMap<UUID, Long> account_age_cache;
|
private final ConcurrentHashMap<UUID, Long> account_age_cache;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
/*
|
|
||||||
* PlotSquared, a land and world management plugin for Minecraft.
|
|
||||||
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
|
||||||
* Copyright (C) IntellectualSites team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.core.util;
|
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Settings;
|
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|
||||||
import com.plotsquared.core.permissions.Permission;
|
|
||||||
import com.plotsquared.core.permissions.PermissionHolder;
|
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Permissions class handles checking user permissions.<br>
|
|
||||||
* - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
|
|
||||||
* - Checking the PlotPlayer class directly will not take the above into account<br>
|
|
||||||
*
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public class Permissions {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
|
||||||
return hasPermission(player, permission.toString(), notify);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the owner of the profile has a given (global) permission
|
|
||||||
*
|
|
||||||
* @param caller permission holder
|
|
||||||
* @param permission Permission
|
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PermissionHolder#hasPermission(Permission)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
|
||||||
return caller.hasPermission(permission.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the owner of the profile has a given (global) permission. There is no guarantee that per-world permissions will
|
|
||||||
* be checked because unmaintained crap plugins like PEX exist.
|
|
||||||
*
|
|
||||||
* @param caller permission holder
|
|
||||||
* @param permission Permission
|
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PermissionHolder#hasPermission(String)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
|
||||||
return caller.hasPermission(permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the owner of the profile has a given (global) keyed permission. Checks both {@code permission.key}
|
|
||||||
* and {@code permission.*}
|
|
||||||
*
|
|
||||||
* @param caller permission holder
|
|
||||||
* @param permission Permission
|
|
||||||
* @param key Permission "key"
|
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
|
||||||
* @since 6.0.10
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PermissionHolder#hasKeyedPermission(String, String)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static boolean hasKeyedPermission(
|
|
||||||
final @NonNull PermissionHolder caller, final @NonNull String permission,
|
|
||||||
final @NonNull String key
|
|
||||||
) {
|
|
||||||
return caller.hasKeyedPermission(permission, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
|
||||||
*
|
|
||||||
* @param player permission holder
|
|
||||||
* @param permission permission
|
|
||||||
* @param notify if to notify the permission holder
|
|
||||||
* @return if permission is had
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
|
||||||
if (!hasPermission(player, permission)) {
|
|
||||||
if (notify) {
|
|
||||||
player.sendMessage(
|
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text(permission)))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PlotPlayer#hasPermissionRange(Permission, int)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
|
||||||
return hasPermissionRange(player, Permission.toString(), range);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check the highest permission a PlotPlayer has within a specified range.<br>
|
|
||||||
* - Excessively high values will lag<br>
|
|
||||||
* - The default range that is checked is {@link Settings.Limit#MAX_PLOTS}<br>
|
|
||||||
*
|
|
||||||
* @param player Player to check for
|
|
||||||
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
|
|
||||||
* @param range The range to check
|
|
||||||
* @return The highest permission they have within that range
|
|
||||||
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
|
||||||
* classes. Use {@link PlotPlayer#hasPermissionRange(String, int)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
|
||||||
return player.hasPermissionRange(stub, range);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user