mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Merge branch 'v6' into v7
# Conflicts: # .github/workflows/codeql.yml # Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java # Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java # Core/src/main/java/com/plotsquared/core/command/Add.java # Core/src/main/java/com/plotsquared/core/command/Caps.java # Core/src/main/java/com/plotsquared/core/command/Cluster.java # Core/src/main/java/com/plotsquared/core/command/Continue.java # Core/src/main/java/com/plotsquared/core/command/Copy.java # Core/src/main/java/com/plotsquared/core/command/Save.java # Core/src/main/java/com/plotsquared/core/command/Visit.java # Core/src/main/java/com/plotsquared/core/plot/Plot.java # build.gradle.kts
This commit is contained in:
commit
6efd581500
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.java text
|
||||||
|
*.jar binary
|
23
.github/workflows/build-pr.yml
vendored
Normal file
23
.github/workflows/build-pr.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
name: Build PR
|
||||||
|
|
||||||
|
on: [ pull_request ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_pr:
|
||||||
|
if: github.repository_owner == 'IntellectualSites'
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
- name: Clean Build
|
||||||
|
run: ./gradlew clean build
|
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -1,15 +1,18 @@
|
|||||||
name: build
|
name: build
|
||||||
|
|
||||||
on: [ pull_request, push ]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v7
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
if: github.repository_owner == 'IntellectualSites'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Validate Gradle Wrapper"
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
|
@ -36,7 +36,6 @@ import com.plotsquared.bukkit.listener.ChunkListener;
|
|||||||
import com.plotsquared.bukkit.listener.EntityEventListener;
|
import com.plotsquared.bukkit.listener.EntityEventListener;
|
||||||
import com.plotsquared.bukkit.listener.EntitySpawnListener;
|
import com.plotsquared.bukkit.listener.EntitySpawnListener;
|
||||||
import com.plotsquared.bukkit.listener.PaperListener;
|
import com.plotsquared.bukkit.listener.PaperListener;
|
||||||
import com.plotsquared.bukkit.listener.PaperListener113;
|
|
||||||
import com.plotsquared.bukkit.listener.PlayerEventListener;
|
import com.plotsquared.bukkit.listener.PlayerEventListener;
|
||||||
import com.plotsquared.bukkit.listener.ProjectileEventListener;
|
import com.plotsquared.bukkit.listener.ProjectileEventListener;
|
||||||
import com.plotsquared.bukkit.listener.ServerListener;
|
import com.plotsquared.bukkit.listener.ServerListener;
|
||||||
@ -364,11 +363,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
getServer().getPluginManager().registerEvents(injector().getInstance(ServerListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(ServerListener.class), this);
|
||||||
getServer().getPluginManager().registerEvents(injector().getInstance(EntitySpawnListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(EntitySpawnListener.class), this);
|
||||||
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
|
||||||
if (serverVersion()[1] == 13) {
|
|
||||||
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener113.class), this);
|
|
||||||
} else {
|
|
||||||
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener.class), this);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
getServer().getPluginManager().registerEvents(injector().getInstance(SpigotListener.class), this);
|
getServer().getPluginManager().registerEvents(injector().getInstance(SpigotListener.class), this);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ import com.plotsquared.core.plot.flag.implementations.VineGrowFlag;
|
|||||||
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
||||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotFlagUtil;
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
@ -290,7 +289,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -310,7 +309,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -324,7 +323,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("done.building_restricted")
|
TranslatableCaption.of("done.building_restricted")
|
||||||
);
|
);
|
||||||
@ -340,7 +339,7 @@ public class BlockEventListener implements Listener {
|
|||||||
+ " did not fall because of disable-physics = true");
|
+ " did not fall because of disable-physics = true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
} else if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -365,8 +364,7 @@ public class BlockEventListener implements Listener {
|
|||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
// == rather than <= as we only care about the "ground level" not being destroyed
|
// == rather than <= as we only care about the "ground level" not being destroyed
|
||||||
if (event.getBlock().getY() == area.getMinGenHeight()) {
|
if (event.getBlock().getY() == area.getMinGenHeight()) {
|
||||||
if (!Permissions
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -389,8 +387,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED, true)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED, true)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -404,8 +401,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Permissions
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -417,7 +413,7 @@ public class BlockEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("done.building_restricted")
|
TranslatableCaption.of("done.building_restricted")
|
||||||
);
|
);
|
||||||
@ -428,7 +424,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.worldEdit != null && pp.getAttribute("worldedit")) {
|
if (this.worldEdit != null && pp.getAttribute("worldedit")) {
|
||||||
@ -516,18 +512,18 @@ public class BlockEventListener implements Listener {
|
|||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.worldEdit != null && plotPlayer.getAttribute("worldedit")) {
|
if (this.worldEdit != null && plotPlayer.getAttribute("worldedit")) {
|
||||||
@ -672,8 +668,7 @@ public class BlockEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
if (Permissions
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -685,8 +680,7 @@ public class BlockEventListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (destroy
|
if (destroy
|
||||||
.contains(BlockTypeWrapper.get(BukkitAdapter.asBlockType(block.getType())))
|
.contains(BlockTypeWrapper.get(BukkitAdapter.asBlockType(block.getType())))
|
||||||
|| Permissions
|
|| plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.debug(player.getName() + " could not break " + block.getType()
|
plot.debug(player.getName() + " could not break " + block.getType()
|
||||||
@ -697,7 +691,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1131,8 +1125,7 @@ public class BlockEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_BUILD_ROAD
|
Permission.PERMISSION_ADMIN_BUILD_ROAD
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1145,8 +1138,7 @@ public class BlockEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_BUILD_UNOWNED
|
Permission.PERMISSION_ADMIN_BUILD_UNOWNED
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1159,7 +1151,7 @@ public class BlockEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1286,8 +1278,7 @@ public class BlockEventListener implements Listener {
|
|||||||
|
|
||||||
for (final BlockState state : event.getReplacedBlockStates()) {
|
for (final BlockState state : event.getReplacedBlockStates()) {
|
||||||
Location currentLocation = BukkitUtil.adapt(state.getLocation());
|
Location currentLocation = BukkitUtil.adapt(state.getLocation());
|
||||||
if (!Permissions.hasPermission(
|
if (!pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_BUILD_ROAD
|
Permission.PERMISSION_ADMIN_BUILD_ROAD
|
||||||
) && !(Objects.equals(currentLocation.getPlot(), plot))) {
|
) && !(Objects.equals(currentLocation.getPlot(), plot))) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
|
@ -37,7 +37,6 @@ import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotFlagUtil;
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -371,14 +370,13 @@ public class EntityEventListener implements Listener {
|
|||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -25,7 +25,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag;
|
import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -109,8 +108,7 @@ public class ForceFieldListener {
|
|||||||
if (plot.isAdded(uuid)) {
|
if (plot.isAdded(uuid)) {
|
||||||
Set<PlotPlayer<?>> players = getNearbyPlayers(player, plot);
|
Set<PlotPlayer<?>> players = getNearbyPlayers(player, plot);
|
||||||
for (PlotPlayer<?> oPlayer : players) {
|
for (PlotPlayer<?> oPlayer : players) {
|
||||||
if (!Permissions
|
if (!oPlayer.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
||||||
.hasPermission(oPlayer, Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
|
||||||
((BukkitPlayer) oPlayer).player
|
((BukkitPlayer) oPlayer).player
|
||||||
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
||||||
}
|
}
|
||||||
@ -120,8 +118,7 @@ public class ForceFieldListener {
|
|||||||
if (oPlayer == null) {
|
if (oPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
|
||||||
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
@ -337,8 +336,7 @@ public class PaperListener implements Listener {
|
|||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
|
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -352,7 +350,7 @@ public class PaperListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -365,7 +363,7 @@ public class PaperListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!plot.getFlag(ProjectilesFlag.class)) {
|
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -67,7 +67,6 @@ import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
|
|||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotFlagUtil;
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
import com.plotsquared.core.util.PremiumVerification;
|
import com.plotsquared.core.util.PremiumVerification;
|
||||||
import com.plotsquared.core.util.entity.EntityCategories;
|
import com.plotsquared.core.util.entity.EntityCategories;
|
||||||
@ -276,8 +275,10 @@ public class PlayerEventListener implements Listener {
|
|||||||
switch (parts[0]) {
|
switch (parts[0]) {
|
||||||
case "up":
|
case "up":
|
||||||
case "worldedit:up":
|
case "worldedit:up":
|
||||||
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !Permissions
|
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !plotPlayer.hasPermission(
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER, true))) {
|
Permission.PERMISSION_ADMIN_BUILD_OTHER,
|
||||||
|
true
|
||||||
|
))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -292,7 +293,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (blockedCommands.isEmpty()) {
|
if (blockedCommands.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// When using namespaced commands, we're not interested in the namespace
|
// When using namespaced commands, we're not interested in the namespace
|
||||||
@ -311,7 +312,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
perm = "plots.admin.command.blocked-cmds.road";
|
perm = "plots.admin.command.blocked-cmds.road";
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, perm)) {
|
if (!plotPlayer.hasPermission(perm)) {
|
||||||
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
|
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -608,7 +609,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
int border = area.getBorder();
|
int border = area.getBorder();
|
||||||
int x1;
|
int x1;
|
||||||
if (x2 > border && this.tmpTeleport) {
|
if (x2 > border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
to.setX(border - 1);
|
to.setX(border - 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
@ -618,7 +619,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (x2 < -border && this.tmpTeleport) {
|
} else if (x2 < -border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
to.setX(-border + 1);
|
to.setX(-border + 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
@ -628,7 +629,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,7 +703,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
int border = area.getBorder();
|
int border = area.getBorder();
|
||||||
int z1;
|
int z1;
|
||||||
if (z2 > border && this.tmpTeleport) {
|
if (z2 > border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
to.setZ(border - 1);
|
to.setZ(border - 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
@ -712,7 +713,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (z2 < -border && this.tmpTeleport) {
|
} else if (z2 < -border && this.tmpTeleport) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
to.setZ(-border + 1);
|
to.setZ(-border + 1);
|
||||||
this.tmpTeleport = false;
|
this.tmpTeleport = false;
|
||||||
player.teleport(event.getTo());
|
player.teleport(event.getTo());
|
||||||
@ -722,7 +723,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||||
}
|
}
|
||||||
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -749,8 +750,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
|| area.isForcingPlotChat())) {
|
|| area.isForcingPlotChat())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isDenied(plotPlayer.getUUID()) && !Permissions
|
if (plot.isDenied(plotPlayer.getUUID()) && !plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_CHAT_BYPASS)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_CHAT_BYPASS)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -823,7 +823,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
plotListener.plotExit(pp, plot);
|
plotListener.plotExit(pp, plot);
|
||||||
}
|
}
|
||||||
if (this.worldEdit != null) {
|
if (this.worldEdit != null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_WORLDEDIT_BYPASS)) {
|
if (!pp.hasPermission(Permission.PERMISSION_WORLDEDIT_BYPASS)) {
|
||||||
if (pp.getAttribute("worldedit")) {
|
if (pp.getAttribute("worldedit")) {
|
||||||
pp.removeAttribute("worldedit");
|
pp.removeAttribute("worldedit");
|
||||||
}
|
}
|
||||||
@ -879,8 +879,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
final Plot plot = pp.getCurrentPlot();
|
final Plot plot = pp.getCurrentPlot();
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (plot.getFlag(PreventCreativeCopyFlag.class) && !plot
|
if (plot.getFlag(PreventCreativeCopyFlag.class) && !plot
|
||||||
.isAdded(player.getUniqueId()) && !Permissions
|
.isAdded(player.getUniqueId()) && !pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
|
||||||
final ItemStack newStack =
|
final ItemStack newStack =
|
||||||
new ItemStack(newItem.getType(), newItem.getAmount());
|
new ItemStack(newItem.getType(), newItem.getAmount());
|
||||||
event.setCursor(newStack);
|
event.setCursor(newStack);
|
||||||
@ -942,7 +941,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
Plot plot = area.getPlotAbs(location);
|
Plot plot = area.getPlotAbs(location);
|
||||||
boolean cancelled = false;
|
boolean cancelled = false;
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -953,7 +952,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
cancelled = true;
|
cancelled = true;
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -966,7 +965,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
UUID uuid = pp.getUUID();
|
UUID uuid = pp.getUUID();
|
||||||
if (!plot.isAdded(uuid)) {
|
if (!plot.isAdded(uuid)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1006,8 +1005,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
Plot plot = location.getPlotAbs();
|
Plot plot = location.getPlotAbs();
|
||||||
BukkitPlayer pp = BukkitUtil.adapt(e.getPlayer());
|
BukkitPlayer pp = BukkitUtil.adapt(e.getPlayer());
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, MiscInteractFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, MiscInteractFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1021,14 +1019,14 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(TranslatableCaption.of("done.building_restricted"));
|
pp.sendMessage(TranslatableCaption.of("done.building_restricted"));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
if (!pp.hasPermission("plots.admin.interact.unowned")) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1046,7 +1044,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (plot.getFlag(MiscInteractFlag.class)) {
|
if (plot.getFlag(MiscInteractFlag.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1274,7 +1272,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(event.getPlayer());
|
BukkitPlayer pp = BukkitUtil.adapt(event.getPlayer());
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1283,7 +1281,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1295,7 +1293,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1307,7 +1305,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("done.building_restricted")
|
TranslatableCaption.of("done.building_restricted")
|
||||||
);
|
);
|
||||||
@ -1345,7 +1343,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -1354,7 +1352,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -1366,7 +1364,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
@ -1378,7 +1376,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
);
|
);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("done.building_restricted")
|
TranslatableCaption.of("done.building_restricted")
|
||||||
);
|
);
|
||||||
@ -1403,7 +1401,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(p);
|
BukkitPlayer pp = BukkitUtil.adapt(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1415,7 +1413,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1429,7 +1427,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!plot.isAdded(pp.getUUID())) {
|
if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!plot.getFlag(HangingPlaceFlag.class)) {
|
if (!plot.getFlag(HangingPlaceFlag.class)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1461,7 +1459,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(p);
|
BukkitPlayer pp = BukkitUtil.adapt(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1472,7 +1470,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1486,7 +1484,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (plot.getFlag(HangingBreakFlag.class)) {
|
if (plot.getFlag(HangingBreakFlag.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1510,8 +1508,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
Plot plot = area.getPlot(BukkitUtil.adapt(event.getEntity().getLocation()));
|
Plot plot = area.getPlot(BukkitUtil.adapt(event.getEntity().getLocation()));
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1523,8 +1520,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (!plot.isAdded(player.getUUID())) {
|
} else if (!plot.isAdded(player.getUUID())) {
|
||||||
if (!plot.getFlag(HangingBreakFlag.class)) {
|
if (!plot.getFlag(HangingBreakFlag.class)) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1559,7 +1555,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(p);
|
BukkitPlayer pp = BukkitUtil.adapt(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null && !area.isRoadFlags()) {
|
if (plot == null && !area.isRoadFlags()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1570,7 +1566,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (plot != null && !plot.hasOwner()) {
|
} else if (plot != null && !plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1631,7 +1627,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1656,8 +1652,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
BukkitPlayer pp = BukkitUtil.adapt(p);
|
BukkitPlayer pp = BukkitUtil.adapt(p);
|
||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, VehicleBreakFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, VehicleBreakFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD
|
Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -1671,7 +1666,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -1688,7 +1683,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (plot.getFlag(VehicleBreakFlag.class)) {
|
if (plot.getFlag(VehicleBreakFlag.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotHandler;
|
import com.plotsquared.core.plot.PlotHandler;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import com.plotsquared.core.util.PlotFlagUtil;
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
@ -107,8 +106,7 @@ public class ProjectileEventListener implements Listener {
|
|||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
|
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
||||||
)) {
|
)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
@ -122,7 +120,7 @@ public class ProjectileEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -135,7 +133,7 @@ public class ProjectileEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
if (!plot.getFlag(ProjectilesFlag.class)) {
|
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
pp.sendMessage(
|
pp.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -180,8 +178,7 @@ public class ProjectileEventListener implements Listener {
|
|||||||
|
|
||||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
pp,
|
|
||||||
Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED
|
Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED
|
||||||
)) {
|
)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -189,8 +186,8 @@ public class ProjectileEventListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag(
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag(ProjectilesFlag.class)) {
|
ProjectilesFlag.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -30,8 +30,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
*
|
*
|
||||||
* @deprecated Deprecated and scheduled for removal without replacement
|
* @deprecated Deprecated and scheduled for removal without replacement
|
||||||
* in favor of the build in setup wizard.
|
* in favor of the build in setup wizard.
|
||||||
|
* However, this class will be kept around for a while, given it's not a maintenance burden.
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.0.0")
|
@Deprecated
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MultiverseWorldManager extends BukkitWorldManager {
|
public class MultiverseWorldManager extends BukkitWorldManager {
|
||||||
|
|
||||||
|
@ -87,4 +87,9 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(@NonNull final String permission, final boolean notify) {
|
||||||
|
return hasPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,14 +67,15 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Please do not use this method. Instead use
|
|
||||||
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
|
|
||||||
*
|
|
||||||
* @param plotAreaManager PlotAreaManager instance
|
* @param plotAreaManager PlotAreaManager instance
|
||||||
* @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")
|
||||||
public BukkitPlayer(
|
public BukkitPlayer(
|
||||||
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
|
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
|
||||||
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
|
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
|
||||||
@ -82,6 +83,16 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
this(plotAreaManager, eventDispatcher, player, false, permissionHandler);
|
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(
|
public BukkitPlayer(
|
||||||
final @NonNull PlotAreaManager plotAreaManager, final @NonNull
|
final @NonNull PlotAreaManager plotAreaManager, final @NonNull
|
||||||
EventDispatcher eventDispatcher, final @NonNull Player player,
|
EventDispatcher eventDispatcher, final @NonNull Player player,
|
||||||
|
@ -54,6 +54,7 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public BukkitPlayer getPlayer(final @NonNull Player object) {
|
public BukkitPlayer getPlayer(final @NonNull Player object) {
|
||||||
if (object.getUniqueId().version() == 2) { // not a real player
|
if (object.getUniqueId().version() == 2) { // not a real player
|
||||||
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, false, this.permissionHandler);
|
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, false, this.permissionHandler);
|
||||||
@ -65,6 +66,7 @@ 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()) {
|
||||||
|
@ -239,9 +239,11 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
* server's main thread.
|
* server's main thread.
|
||||||
*/
|
*/
|
||||||
private void processChunk(final @NonNull Chunk chunk) {
|
private void processChunk(final @NonNull Chunk chunk) {
|
||||||
|
/* Chunk#isLoaded does not necessarily return true shortly after PaperLib#getChunkAtAsync completes, but the chunk is
|
||||||
|
still loaded.
|
||||||
if (!chunk.isLoaded()) {
|
if (!chunk.isLoaded()) {
|
||||||
throw new IllegalArgumentException(String.format("Chunk %d;%d is is not loaded", chunk.getX(), chunk.getZ()));
|
throw new IllegalArgumentException(String.format("Chunk %d;%d is is not loaded", chunk.getX(), chunk.getZ());
|
||||||
}
|
}*/
|
||||||
if (finished) {
|
if (finished) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ import com.plotsquared.core.plot.flag.implementations.PvpFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.TamedAttackFlag;
|
import com.plotsquared.core.plot.flag.implementations.TamedAttackFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
||||||
import com.plotsquared.core.util.EntityUtil;
|
import com.plotsquared.core.util.EntityUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.entity.EntityCategories;
|
import com.plotsquared.core.util.entity.EntityCategories;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -170,8 +169,7 @@ public class BukkitEntityUtil {
|
|||||||
if (plot != null && (plot.getFlag(HangingBreakFlag.class) || plot
|
if (plot != null && (plot.getFlag(HangingBreakFlag.class) || plot
|
||||||
.isAdded(plotPlayer.getUUID()))) {
|
.isAdded(plotPlayer.getUUID()))) {
|
||||||
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
if (!Permissions
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("done.building_restricted")
|
TranslatableCaption.of("done.building_restricted")
|
||||||
);
|
);
|
||||||
@ -180,7 +178,7 @@ public class BukkitEntityUtil {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -195,7 +193,7 @@ public class BukkitEntityUtil {
|
|||||||
.isAdded(plotPlayer.getUUID()))) {
|
.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -219,7 +217,7 @@ public class BukkitEntityUtil {
|
|||||||
.getFlag(PveFlag.class))) {
|
.getFlag(PveFlag.class))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -243,7 +241,7 @@ public class BukkitEntityUtil {
|
|||||||
.getFlag(PveFlag.class))) {
|
.getFlag(PveFlag.class))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -259,8 +257,7 @@ public class BukkitEntityUtil {
|
|||||||
}
|
}
|
||||||
} else if (EntityCategories.PLAYER.contains(entityType)) {
|
} else if (EntityCategories.PLAYER.contains(entityType)) {
|
||||||
if (isPlot) {
|
if (isPlot) {
|
||||||
if (!plot.getFlag(PvpFlag.class) && !Permissions
|
if (!plot.getFlag(PvpFlag.class) && !plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -277,7 +274,7 @@ public class BukkitEntityUtil {
|
|||||||
} else if (roadFlags && area.getRoadFlag(PvpFlag.class)) {
|
} else if (roadFlags && area.getRoadFlag(PvpFlag.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -297,7 +294,7 @@ public class BukkitEntityUtil {
|
|||||||
.getFlag(PveFlag.class))) {
|
.getFlag(PveFlag.class))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -322,7 +319,7 @@ public class BukkitEntityUtil {
|
|||||||
} else if (roadFlags && area.getRoadFlag(PveFlag.class)) {
|
} else if (roadFlags && area.getRoadFlag(PveFlag.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission_event"),
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -80,4 +80,3 @@ public class FaweSchematicHandler extends SchematicHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
@ -60,18 +59,19 @@ public class Add extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> execute(
|
public CompletableFuture<Boolean> execute(
|
||||||
final PlotPlayer<?> player, String[] args,
|
final PlotPlayer<?> player,
|
||||||
|
String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone
|
RunnableVal2<Command, CommandResult> whenDone
|
||||||
) throws CommandException {
|
) throws CommandException {
|
||||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||||
checkTrue(
|
checkTrue(
|
||||||
plot.isOwner(player.getUUID()) || Permissions
|
plot.isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
|
|
||||||
TranslatableCaption.of("permission.no_plot_perms")
|
TranslatableCaption.of("permission.no_plot_perms")
|
||||||
);
|
);
|
||||||
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
checkTrue(args.length == 1,
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
TagResolver.resolver("value", Tag.inserting(Component.text("/plot add <player | *>")))
|
TagResolver.resolver("value", Tag.inserting(Component.text("/plot add <player | *>")))
|
||||||
);
|
);
|
||||||
final CompletableFuture<Boolean> future = new CompletableFuture<>();
|
final CompletableFuture<Boolean> future = new CompletableFuture<>();
|
||||||
@ -96,9 +96,8 @@ public class Add extends Command {
|
|||||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
UUID uuid = iterator.next();
|
UUID uuid = iterator.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(player.hasPermission(Permission.PERMISSION_TRUST_EVERYONE) || player.hasPermission(
|
||||||
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
|
Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
TagResolver.resolver("value", Tag.inserting(
|
TagResolver.resolver("value", Tag.inserting(
|
||||||
@ -132,7 +131,7 @@ public class Add extends Command {
|
|||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
int localAddSize = plot.getMembers().size();
|
int localAddSize = plot.getMembers().size();
|
||||||
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
|
int maxAddSize = player.hasPermissionRange(Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
|
||||||
if (localAddSize >= maxAddSize) {
|
if (localAddSize >= maxAddSize) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("members.plot_max_members_added"),
|
TranslatableCaption.of("members.plot_max_members_added"),
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
@ -205,7 +204,7 @@ public class Alias extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPermitted(PlotPlayer<?> player, Permission permission) {
|
private boolean isPermitted(PlotPlayer<?> player, Permission permission) {
|
||||||
return Permissions.hasPermission(player, permission);
|
return player.hasPermission(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ import com.plotsquared.core.queue.QueueCoordinator;
|
|||||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||||
import com.plotsquared.core.util.FileUtils;
|
import com.plotsquared.core.util.FileUtils;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.RegionUtil;
|
import com.plotsquared.core.util.RegionUtil;
|
||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
@ -139,7 +138,7 @@ public class Area extends SubCommand {
|
|||||||
player.sendMessage(RequiredType.CONSOLE.getErrorMessage());
|
player.sendMessage(RequiredType.CONSOLE.getErrorMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -292,7 +291,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "c", "setup", "create" -> {
|
case "c", "setup", "create" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -618,7 +617,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "i", "info" -> {
|
case "i", "info" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_INFO)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -694,7 +693,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "l", "list" -> {
|
case "l", "list" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_LIST)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -772,7 +771,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "regen", "clear", "reset", "regenerate" -> {
|
case "regen", "clear", "reset", "regenerate" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_REGEN)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -807,7 +806,7 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "goto", "v", "teleport", "visit", "tp" -> {
|
case "goto", "v", "teleport", "visit", "tp" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
|
if (!player.hasPermission(Permission.PERMISSION_AREA_TP)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AREA_TP))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AREA_TP))
|
||||||
@ -866,19 +865,19 @@ public class Area extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
||||||
completions.add("create");
|
completions.add("create");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_CREATE)) {
|
||||||
completions.add("single");
|
completions.add("single");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_LIST)) {
|
||||||
completions.add("list");
|
completions.add("list");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_INFO)) {
|
||||||
completions.add("info");
|
completions.add("info");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_TP)) {
|
||||||
completions.add("tp");
|
completions.add("tp");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -893,7 +892,7 @@ public class Area extends SubCommand {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_AREA) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -38,7 +38,6 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
|||||||
import com.plotsquared.core.services.plots.AutoService;
|
import com.plotsquared.core.services.plots.AutoService;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.task.AutoClaimFinishTask;
|
import com.plotsquared.core.util.task.AutoClaimFinishTask;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
@ -249,7 +248,7 @@ public class Auto extends SubCommand {
|
|||||||
sizeX = event.getSizeX();
|
sizeX = event.getSizeX();
|
||||||
sizeZ = event.getSizeZ();
|
sizeZ = event.getSizeZ();
|
||||||
schematic = event.getSchematic();
|
schematic = event.getSchematic();
|
||||||
if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) {
|
if (!force && mega && !player.hasPermission(Permission.PERMISSION_AUTO_MEGA)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AUTO_MEGA))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_AUTO_MEGA))
|
||||||
@ -284,11 +283,9 @@ public class Auto extends SubCommand {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!force && !Permissions.hasPermission(
|
if (!force && !player.hasPermission(
|
||||||
player,
|
|
||||||
Permission.PERMISSION_CLAIM_SCHEMATIC.format(schematic)
|
Permission.PERMISSION_CLAIM_SCHEMATIC.format(schematic)
|
||||||
) && !Permissions
|
) && !player.hasPermission("plots.admin.command.schematic")) {
|
||||||
.hasPermission(player, "plots.admin.command.schematic")) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.claim.%s0")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.claim.%s0")))
|
||||||
|
@ -27,7 +27,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -150,8 +149,7 @@ public final class Backup extends Command {
|
|||||||
TranslatableCaption.of("generic.generic_merged").toComponent(player)
|
TranslatableCaption.of("generic.generic_merged").toComponent(player)
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -215,8 +213,7 @@ public final class Backup extends Command {
|
|||||||
);
|
);
|
||||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -301,8 +298,7 @@ public final class Backup extends Command {
|
|||||||
);
|
);
|
||||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -27,7 +27,6 @@ import com.sk89q.worldedit.command.util.SuggestionHelper;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import com.plotsquared.core.plot.flag.implementations.HostileCapFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.ComponentLike;
|
import net.kyori.adventure.text.ComponentLike;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
@ -54,8 +53,7 @@ public class Caps extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player.getUUID()) && !Permissions
|
if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_CAPS_OTHER))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_ADMIN_CAPS_OTHER))
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -131,9 +130,8 @@ public class Claim extends SubCommand {
|
|||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLAIM_SCHEMATIC
|
if (!player.hasPermission(Permission.PERMISSION_CLAIM_SCHEMATIC
|
||||||
.format(schematic)) && !Permissions.hasPermission(
|
.format(schematic)) && !player.hasPermission(
|
||||||
player,
|
|
||||||
"plots.admin.command.schematic"
|
"plots.admin.command.schematic"
|
||||||
) && !force) {
|
) && !force) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -194,7 +192,7 @@ public class Claim extends SubCommand {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||||
int border = area.getBorder();
|
int border = area.getBorder();
|
||||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
||||||
player.sendMessage(TranslatableCaption.of("border.denied"));
|
player.sendMessage(TranslatableCaption.of("border.denied"));
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -91,13 +90,14 @@ public class Clear extends Command {
|
|||||||
}
|
}
|
||||||
boolean force = eventResult == Result.FORCE;
|
boolean force = eventResult == Result.FORCE;
|
||||||
checkTrue(
|
checkTrue(
|
||||||
force || plot.isOwner(player.getUUID()) || Permissions
|
force || plot.isOwner(player.getUUID()) || player.hasPermission("plots.admin.command.clear"),
|
||||||
.hasPermission(player, "plots.admin.command.clear"),
|
|
||||||
TranslatableCaption.of("permission.no_plot_perms")
|
TranslatableCaption.of("permission.no_plot_perms")
|
||||||
);
|
);
|
||||||
checkTrue(plot.getRunning() == 0, TranslatableCaption.of("errors.wait_for_timer"));
|
checkTrue(plot.getRunning() == 0, TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions
|
checkTrue(
|
||||||
.hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done"));
|
force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || player.hasPermission("plots.continue"),
|
||||||
|
TranslatableCaption.of("done.done_already_done")
|
||||||
|
);
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
if (Settings.Teleport.ON_CLEAR) {
|
if (Settings.Teleport.ON_CLEAR) {
|
||||||
plot.getPlayersInPlot().forEach(playerInPlot -> plot.teleportPlayer(playerInPlot, TeleportCause.COMMAND_CLEAR,
|
plot.getPlayersInPlot().forEach(playerInPlot -> plot.teleportPlayer(playerInPlot, TeleportCause.COMMAND_CLEAR,
|
||||||
|
@ -33,7 +33,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotCluster;
|
import com.plotsquared.core.plot.PlotCluster;
|
||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.util.ComponentHelper;
|
import com.plotsquared.core.util.ComponentHelper;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -80,7 +79,7 @@ public class Cluster extends SubCommand {
|
|||||||
switch (sub) {
|
switch (sub) {
|
||||||
case "l":
|
case "l":
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LIST)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LIST)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -136,7 +135,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
case "c":
|
case "c":
|
||||||
case "create": {
|
case "create": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -213,8 +212,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
||||||
if (!plots.isEmpty()) {
|
if (!plots.isEmpty()) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE_OTHER)) {
|
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
if (!plot.isOwner(uuid)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
@ -238,10 +236,10 @@ public class Cluster extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
current = player.getPlayerClusterCount(player.getLocation().getWorldName());
|
current = player.getPlayerClusterCount(player.getLocation().getWorldName());
|
||||||
}
|
}
|
||||||
int allowed = Permissions
|
int allowed = player.hasPermissionRange(
|
||||||
.hasPermissionRange(player, Permission.PERMISSION_CLUSTER_SIZE,
|
Permission.PERMISSION_CLUSTER_SIZE,
|
||||||
Settings.Limit.MAX_PLOTS
|
Settings.Limit.MAX_PLOTS
|
||||||
);
|
);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
@ -274,7 +272,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "disband":
|
case "disband":
|
||||||
case "del":
|
case "del":
|
||||||
case "delete": {
|
case "delete": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -314,8 +312,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cluster.owner.equals(player.getUUID())) {
|
if (!cluster.owner.equals(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -335,7 +332,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
case "res":
|
case "res":
|
||||||
case "resize": {
|
case "resize": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -378,8 +375,7 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -406,8 +402,7 @@ public class Cluster extends SubCommand {
|
|||||||
removed.removeAll(newPlots);
|
removed.removeAll(newPlots);
|
||||||
// Check expand / shrink
|
// Check expand / shrink
|
||||||
if (!removed.isEmpty()) {
|
if (!removed.isEmpty()) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -420,8 +415,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
newPlots.removeAll(existing);
|
newPlots.removeAll(existing);
|
||||||
if (!newPlots.isEmpty()) {
|
if (!newPlots.isEmpty()) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -440,7 +434,8 @@ public class Cluster extends SubCommand {
|
|||||||
current = player.getPlayerClusterCount(player.getLocation().getWorldName());
|
current = player.getPlayerClusterCount(player.getLocation().getWorldName());
|
||||||
}
|
}
|
||||||
current -= cluster.getArea() + (1 + pos2.getX() - pos1.getX()) * (1 + pos2.getY() - pos1.getY());
|
current -= cluster.getArea() + (1 + pos2.getX() - pos1.getX()) * (1 + pos2.getY() - pos1.getY());
|
||||||
int allowed = Permissions.hasPermissionRange(player, Permission.PERMISSION_CLUSTER,
|
int allowed = player.hasPermissionRange(
|
||||||
|
Permission.PERMISSION_CLUSTER,
|
||||||
Settings.Limit.MAX_PLOTS
|
Settings.Limit.MAX_PLOTS
|
||||||
);
|
);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
@ -460,7 +455,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "add":
|
case "add":
|
||||||
case "inv":
|
case "inv":
|
||||||
case "invite": {
|
case "invite": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -488,8 +483,7 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -532,7 +526,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "k":
|
case "k":
|
||||||
case "remove":
|
case "remove":
|
||||||
case "kick": {
|
case "kick": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -559,8 +553,7 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -614,7 +607,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
case "quit":
|
case "quit":
|
||||||
case "leave": {
|
case "leave": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LEAVE)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LEAVE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -675,7 +668,7 @@ public class Cluster extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "members": {
|
case "members": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_HELPERS)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -738,7 +731,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "spawn":
|
case "spawn":
|
||||||
case "home":
|
case "home":
|
||||||
case "tp": {
|
case "tp": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -770,7 +763,7 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP_OTHER)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP_OTHER)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -789,7 +782,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "info":
|
case "info":
|
||||||
case "show":
|
case "show":
|
||||||
case "information": {
|
case "information": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INFO)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INFO)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -860,7 +853,7 @@ public class Cluster extends SubCommand {
|
|||||||
case "sh":
|
case "sh":
|
||||||
case "setspawn":
|
case "setspawn":
|
||||||
case "sethome": {
|
case "sethome": {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME)) {
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_CLUSTER_SETHOME))
|
||||||
@ -884,8 +877,7 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -937,37 +929,37 @@ public class Cluster extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LIST)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_LIST)) {
|
||||||
completions.add("list");
|
completions.add("list");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE)) {
|
||||||
completions.add("create");
|
completions.add("create");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE)) {
|
||||||
completions.add("delete");
|
completions.add("delete");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE)) {
|
||||||
completions.add("resize");
|
completions.add("resize");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE)) {
|
||||||
completions.add("invite");
|
completions.add("invite");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
|
||||||
completions.add("kick");
|
completions.add("kick");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
|
||||||
completions.add("leave");
|
completions.add("leave");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_HELPERS)) {
|
||||||
completions.add("members");
|
completions.add("members");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INFO)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_INFO)) {
|
||||||
completions.add("info");
|
completions.add("info");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_TP)) {
|
||||||
completions.add("tp");
|
completions.add("tp");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME)) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME)) {
|
||||||
completions.add("sethome");
|
completions.add("sethome");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -982,7 +974,7 @@ public class Cluster extends SubCommand {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_CLUSTER) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -25,7 +25,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|||||||
import com.plotsquared.core.permissions.PermissionHolder;
|
import com.plotsquared.core.permissions.PermissionHolder;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringComparison;
|
import com.plotsquared.core.util.StringComparison;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
@ -483,7 +482,7 @@ public abstract class Command {
|
|||||||
if (message) {
|
if (message) {
|
||||||
player.sendMessage(this.required.getErrorMessage());
|
player.sendMessage(this.required.getErrorMessage());
|
||||||
}
|
}
|
||||||
} else if (!Permissions.hasPermission(player, getPermission())) {
|
} else if (!player.hasPermission(getPermission())) {
|
||||||
if (message) {
|
if (message) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
@ -23,7 +23,6 @@ import com.plotsquared.core.configuration.caption.LocaleHolder;
|
|||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.ComponentLike;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
@ -55,8 +54,7 @@ public class Continue extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(
|
TagResolver.resolver("node", Tag.inserting(
|
||||||
|
@ -23,7 +23,6 @@ import com.plotsquared.core.location.Location;
|
|||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
@ -44,8 +43,7 @@ public class Copy extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN.toString())) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ import com.plotsquared.core.uuid.UUIDMapping;
|
|||||||
import com.sk89q.worldedit.world.entity.EntityType;
|
import com.sk89q.worldedit.world.entity.EntityType;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
import net.kyori.adventure.text.format.TextColor;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -85,8 +84,7 @@ public class Delete extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = eventResult == Result.FORCE;
|
boolean force = eventResult == Result.FORCE;
|
||||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
if (!force && !plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DELETE)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DELETE)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
|||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
@ -81,13 +80,12 @@ public class Deny extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DENY)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxDenySize = Permissions.hasPermissionRange(player, Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS);
|
int maxDenySize = player.hasPermissionRange(Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS);
|
||||||
int size = plot.getDenied().size();
|
int size = plot.getDenied().size();
|
||||||
if (size >= maxDenySize) {
|
if (size >= maxDenySize) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -108,8 +106,7 @@ public class Deny extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, Permission.PERMISSION_DENY_EVERYONE) || Permissions
|
player.hasPermission(Permission.PERMISSION_DENY_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
||||||
|
@ -21,7 +21,6 @@ package com.plotsquared.core.command;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ public class Dislike extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
if (player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
||||||
completions.add("purge");
|
completions.add("purge");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -62,7 +61,7 @@ public class Dislike extends SubCommand {
|
|||||||
.startsWith(args[0].toLowerCase()))
|
.startsWith(args[0].toLowerCase()))
|
||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -34,7 +34,6 @@ import com.plotsquared.core.plot.expiration.PlotAnalysis;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
@ -77,8 +76,7 @@ public class Done extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
if (!force && !plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DONE)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DONE)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
|||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotUploader;
|
import com.plotsquared.core.util.PlotUploader;
|
||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
@ -89,13 +88,11 @@ public class Download extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && !DoneFlag.isDone(plot)) && !Permissions
|
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && !DoneFlag.isDone(plot)) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN.toString())) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,7 +110,7 @@ public class Download extends SubCommand {
|
|||||||
upload(player, plot);
|
upload(player, plot);
|
||||||
} else if (args.length == 1 && StringMan
|
} else if (args.length == 1 && StringMan
|
||||||
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
if (!player.hasPermission(Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -158,10 +155,10 @@ public class Download extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD)) {
|
if (player.hasPermission(Permission.PERMISSION_DOWNLOAD)) {
|
||||||
completions.add("schem");
|
completions.add("schem");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
if (player.hasPermission(Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
||||||
completions.add("world");
|
completions.add("world");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -176,7 +173,7 @@ public class Download extends SubCommand {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_DOWNLOAD) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -39,7 +39,6 @@ import com.plotsquared.core.plot.flag.types.IntegerFlag;
|
|||||||
import com.plotsquared.core.plot.flag.types.ListFlag;
|
import com.plotsquared.core.plot.flag.types.ListFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringComparison;
|
import com.plotsquared.core.util.StringComparison;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.helpmenu.HelpMenu;
|
import com.plotsquared.core.util.helpmenu.HelpMenu;
|
||||||
@ -132,7 +131,7 @@ public final class FlagCommand extends Command {
|
|||||||
key.toLowerCase(),
|
key.toLowerCase(),
|
||||||
entry.toString().toLowerCase()
|
entry.toString().toLowerCase()
|
||||||
);
|
);
|
||||||
final boolean result = Permissions.hasPermission(player, permission);
|
final boolean result = player.hasPermission(permission);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
@ -159,9 +158,9 @@ public final class FlagCommand extends Command {
|
|||||||
boolean result;
|
boolean result;
|
||||||
String basePerm = Permission.PERMISSION_SET_FLAG_KEY.format(key.toLowerCase());
|
String basePerm = Permission.PERMISSION_SET_FLAG_KEY.format(key.toLowerCase());
|
||||||
if (flag.isValuedPermission()) {
|
if (flag.isValuedPermission()) {
|
||||||
result = Permissions.hasKeyedPermission(player, basePerm, value);
|
result = player.hasKeyedPermission(basePerm, value);
|
||||||
} else {
|
} else {
|
||||||
result = Permissions.hasPermission(player, basePerm);
|
result = player.hasPermission(basePerm);
|
||||||
perm = basePerm;
|
perm = basePerm;
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@ -189,8 +188,7 @@ public final class FlagCommand extends Command {
|
|||||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_SET_FLAG_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_SET_FLAG_OTHER))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_SET_FLAG_OTHER))
|
||||||
@ -497,7 +495,7 @@ public final class FlagCommand extends Command {
|
|||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
flag = event.getFlag();
|
flag = event.getFlag();
|
||||||
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))) {
|
if (!force && !player.hasPermission(Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))) {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.MetaDataAccess;
|
import com.plotsquared.core.player.MetaDataAccess;
|
||||||
import com.plotsquared.core.player.PlayerMetaDataKeys;
|
import com.plotsquared.core.player.PlayerMetaDataKeys;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
@ -71,7 +70,7 @@ public class Grant extends Command {
|
|||||||
final String arg0 = args[0].toLowerCase();
|
final String arg0 = args[0].toLowerCase();
|
||||||
switch (arg0) {
|
switch (arg0) {
|
||||||
case "add", "check" -> {
|
case "add", "check" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_GRANT.format(arg0))) {
|
if (!player.hasPermission(Permission.PERMISSION_GRANT.format(arg0))) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_GRANT.format(arg0))))
|
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_GRANT.format(arg0))))
|
||||||
@ -152,10 +151,10 @@ public class Grant extends Command {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_GRANT_ADD)) {
|
if (player.hasPermission(Permission.PERMISSION_GRANT_ADD)) {
|
||||||
completions.add("add");
|
completions.add("add");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_GRANT_CHECK)) {
|
if (player.hasPermission(Permission.PERMISSION_GRANT_CHECK)) {
|
||||||
completions.add("check");
|
completions.add("check");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -170,7 +169,7 @@ public class Grant extends Command {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_GRANT_SINGLE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_GRANT_SINGLE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -29,7 +29,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.query.SortingStrategy;
|
import com.plotsquared.core.util.query.SortingStrategy;
|
||||||
@ -108,8 +107,7 @@ public class HomeCommand extends Command {
|
|||||||
// /plot home <[area;]x;y>
|
// /plot home <[area;]x;y>
|
||||||
// /plot home <area> <x;y>
|
// /plot home <area> <x;y>
|
||||||
// /plot home <area> <page>
|
// /plot home <area> <page>
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_HOME)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_VISIT_OWNED.toString())))
|
TagResolver.resolver("node", Tag.inserting(Component.text(Permission.PERMISSION_VISIT_OWNED.toString())))
|
||||||
|
@ -29,7 +29,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.comment.CommentInbox;
|
import com.plotsquared.core.plot.comment.CommentInbox;
|
||||||
import com.plotsquared.core.plot.comment.CommentManager;
|
import com.plotsquared.core.plot.comment.CommentManager;
|
||||||
import com.plotsquared.core.plot.comment.PlotComment;
|
import com.plotsquared.core.plot.comment.PlotComment;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
@ -300,13 +299,13 @@ public class Inbox extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX_READ_OWNER)) {
|
if (player.hasPermission(Permission.PERMISSION_INBOX_READ_OWNER)) {
|
||||||
completions.add("owner");
|
completions.add("owner");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX_READ_PUBLIC)) {
|
if (player.hasPermission(Permission.PERMISSION_INBOX_READ_PUBLIC)) {
|
||||||
completions.add("public");
|
completions.add("public");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX_READ_REPORT)) {
|
if (player.hasPermission(Permission.PERMISSION_INBOX_READ_REPORT)) {
|
||||||
completions.add("report");
|
completions.add("report");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -314,7 +313,7 @@ public class Inbox extends SubCommand {
|
|||||||
.startsWith(args[0].toLowerCase()))
|
.startsWith(args[0].toLowerCase()))
|
||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.CHAT) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.CHAT) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_INBOX) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -27,7 +27,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
|
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
@ -152,7 +151,7 @@ public class Info extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO_FORCE)) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_INFO_FORCE)) {
|
||||||
completions.add("-f");
|
completions.add("-f");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ public class Info extends SubCommand {
|
|||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO_FORCE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_AREA_INFO_FORCE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
@ -72,8 +71,7 @@ public class Kick extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
|
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_KICK)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_KICK)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -91,8 +89,7 @@ public class Kick extends SubCommand {
|
|||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
if (uuid == DBFunc.EVERYONE) {
|
if (uuid == DBFunc.EVERYONE) {
|
||||||
for (PlotPlayer<?> pp : plot.getPlayersInPlot()) {
|
for (PlotPlayer<?> pp : plot.getPlayersInPlot()) {
|
||||||
if (pp == player || Permissions
|
if (pp == player || pp.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
players.add(pp);
|
players.add(pp);
|
||||||
@ -120,7 +117,7 @@ public class Kick extends SubCommand {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player2, Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
if (player2.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("cluster.cannot_kick_player"),
|
TranslatableCaption.of("cluster.cannot_kick_player"),
|
||||||
TagResolver.resolver("name", Tag.inserting(Component.text(player2.getName())))
|
TagResolver.resolver("name", Tag.inserting(Component.text(player2.getName())))
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.Rating;
|
import com.plotsquared.core.plot.Rating;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -123,8 +122,7 @@ public class Like extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS, true)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS, true)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.clearRatings();
|
plot.clearRatings();
|
||||||
@ -206,7 +204,7 @@ public class Like extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
if (player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
||||||
completions.add("purge");
|
completions.add("purge");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -214,7 +212,7 @@ public class Like extends SubCommand {
|
|||||||
.startsWith(args[0].toLowerCase()))
|
.startsWith(args[0].toLowerCase()))
|
||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
|||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.StringComparison;
|
import com.plotsquared.core.util.StringComparison;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
@ -82,40 +81,40 @@ public class ListCmd extends SubCommand {
|
|||||||
|
|
||||||
private String[] getArgumentList(PlotPlayer<?> player) {
|
private String[] getArgumentList(PlotPlayer<?> player) {
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
if (this.econHandler != null && Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
|
if (this.econHandler != null && player.hasPermission(Permission.PERMISSION_LIST_FOR_SALE)) {
|
||||||
args.add("forsale");
|
args.add("forsale");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_MINE)) {
|
||||||
args.add("mine");
|
args.add("mine");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_SHARED)) {
|
||||||
args.add("shared");
|
args.add("shared");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
||||||
args.add("world");
|
args.add("world");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_TOP)) {
|
||||||
args.add("top");
|
args.add("top");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_ALL)) {
|
||||||
args.add("all");
|
args.add("all");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_UNOWNED)) {
|
||||||
args.add("unowned");
|
args.add("unowned");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_PLAYER)) {
|
||||||
args.add("<player>");
|
args.add("<player>");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
||||||
args.add("<world>");
|
args.add("<world>");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_DONE)) {
|
||||||
args.add("done");
|
args.add("done");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_EXPIRED)) {
|
||||||
args.add("expired");
|
args.add("expired");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_FUZZY)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_FUZZY)) {
|
||||||
args.add("fuzzy <search...>");
|
args.add("fuzzy <search...>");
|
||||||
}
|
}
|
||||||
return args.toArray(new String[args.size()]);
|
return args.toArray(new String[args.size()]);
|
||||||
@ -192,7 +191,7 @@ public class ListCmd extends SubCommand {
|
|||||||
|
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "mine" -> {
|
case "mine" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_MINE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.mine")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.mine")))
|
||||||
@ -207,7 +206,7 @@ public class ListCmd extends SubCommand {
|
|||||||
.withSortingStrategy(SortingStrategy.SORT_BY_TEMP));
|
.withSortingStrategy(SortingStrategy.SORT_BY_TEMP));
|
||||||
}
|
}
|
||||||
case "shared" -> {
|
case "shared" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_SHARED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.shared")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.shared")))
|
||||||
@ -220,14 +219,14 @@ public class ListCmd extends SubCommand {
|
|||||||
.thatPasses(plot -> !plot.isOwnerAbs(player.getUUID())));
|
.thatPasses(plot -> !plot.isOwnerAbs(player.getUUID())));
|
||||||
}
|
}
|
||||||
case "world" -> {
|
case "world" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
if (!player.hasPermission("plots.list.world." + world)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
||||||
@ -237,7 +236,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
|
plotConsumer.accept(PlotQuery.newQuery().inWorld(world));
|
||||||
}
|
}
|
||||||
case "expired" -> {
|
case "expired" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_EXPIRED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.expired")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.expired")))
|
||||||
@ -251,14 +250,14 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "area" -> {
|
case "area" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_AREA)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_AREA)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.area")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.area")))
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
if (!player.hasPermission("plots.list.world." + world)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + world)))
|
||||||
@ -272,7 +271,7 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "all" -> {
|
case "all" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_ALL)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.all")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.all")))
|
||||||
@ -282,7 +281,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots());
|
plotConsumer.accept(PlotQuery.newQuery().allPlots());
|
||||||
}
|
}
|
||||||
case "done" -> {
|
case "done" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_DONE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.done")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.done")))
|
||||||
@ -297,7 +296,7 @@ public class ListCmd extends SubCommand {
|
|||||||
.withSortingStrategy(SortingStrategy.SORT_BY_DONE));
|
.withSortingStrategy(SortingStrategy.SORT_BY_DONE));
|
||||||
}
|
}
|
||||||
case "top" -> {
|
case "top" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_TOP)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.top")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.top")))
|
||||||
@ -308,7 +307,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots().withSortingStrategy(SortingStrategy.SORT_BY_RATING));
|
plotConsumer.accept(PlotQuery.newQuery().allPlots().withSortingStrategy(SortingStrategy.SORT_BY_RATING));
|
||||||
}
|
}
|
||||||
case "forsale" -> {
|
case "forsale" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_FOR_SALE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.forsale")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.forsale")))
|
||||||
@ -321,7 +320,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getFlag(PriceFlag.class) > 0));
|
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getFlag(PriceFlag.class) > 0));
|
||||||
}
|
}
|
||||||
case "unowned" -> {
|
case "unowned" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_UNOWNED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.unowned")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.unowned")))
|
||||||
@ -331,7 +330,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getOwner() == null));
|
plotConsumer.accept(PlotQuery.newQuery().allPlots().thatPasses(plot -> plot.getOwner() == null));
|
||||||
}
|
}
|
||||||
case "fuzzy" -> {
|
case "fuzzy" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FUZZY)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_FUZZY)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.fuzzy")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.fuzzy")))
|
||||||
@ -356,14 +355,14 @@ public class ListCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
if (this.plotAreaManager.hasPlotArea(args[0])) {
|
if (this.plotAreaManager.hasPlotArea(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world")))
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) {
|
if (!player.hasPermission("plots.list.world." + args[0])) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + args[0])))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.world." + args[0])))
|
||||||
@ -390,7 +389,7 @@ public class ListCmd extends SubCommand {
|
|||||||
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
TagResolver.resolver("value", Tag.inserting(Component.text(args[0])))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER)) {
|
if (!player.hasPermission(Permission.PERMISSION_LIST_PLAYER)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.player")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.list.player")))
|
||||||
@ -527,31 +526,31 @@ public class ListCmd extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (this.econHandler.isSupported() && Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
|
if (this.econHandler.isSupported() && player.hasPermission(Permission.PERMISSION_LIST_FOR_SALE)) {
|
||||||
completions.add("forsale");
|
completions.add("forsale");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_MINE)) {
|
||||||
completions.add("mine");
|
completions.add("mine");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_SHARED)) {
|
||||||
completions.add("shared");
|
completions.add("shared");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_WORLD)) {
|
||||||
completions.addAll(PlotSquared.platform().worldManager().getWorlds());
|
completions.addAll(PlotSquared.platform().worldManager().getWorlds());
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_TOP)) {
|
||||||
completions.add("top");
|
completions.add("top");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_ALL)) {
|
||||||
completions.add("all");
|
completions.add("all");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_UNOWNED)) {
|
||||||
completions.add("unowned");
|
completions.add("unowned");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_DONE)) {
|
||||||
completions.add("done");
|
completions.add("done");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_EXPIRED)) {
|
||||||
completions.add("expired");
|
completions.add("expired");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +560,7 @@ public class ListCmd extends SubCommand {
|
|||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.TELEPORT) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.TELEPORT) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_LIST_PLAYER) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.plot.schematic.Schematic;
|
import com.plotsquared.core.plot.schematic.Schematic;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.TimeUtil;
|
import com.plotsquared.core.util.TimeUtil;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
@ -82,8 +81,7 @@ public class Load extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_LOAD)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_LOAD)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
@ -245,8 +244,8 @@ public class MainCommand extends Command {
|
|||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
Plot newPlot = Plot.fromString(area, args[0]);
|
Plot newPlot = Plot.fromString(area, args[0]);
|
||||||
if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea()
|
if (newPlot != null && (player instanceof ConsolePlayer || newPlot.getArea()
|
||||||
.equals(area) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN)
|
.equals(area) || player.hasPermission(Permission.PERMISSION_ADMIN)
|
||||||
|| Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_AREA_SUDO))
|
|| player.hasPermission(Permission.PERMISSION_ADMIN_AREA_SUDO))
|
||||||
&& !newPlot.isDenied(player.getUUID())) {
|
&& !newPlot.isDenied(player.getUUID())) {
|
||||||
final Location newLoc;
|
final Location newLoc;
|
||||||
if (newPlot.getArea() instanceof SinglePlotArea) {
|
if (newPlot.getArea() instanceof SinglePlotArea) {
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -128,7 +127,7 @@ public class Merge extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int size = plot.getConnectedPlots().size();
|
final int size = plot.getConnectedPlots().size();
|
||||||
int max = Permissions.hasPermissionRange(player, "plots.merge", Settings.Limit.MAX_PLOTS);
|
int max = player.hasPermissionRange("plots.merge", Settings.Limit.MAX_PLOTS);
|
||||||
PlotMergeEvent event =
|
PlotMergeEvent event =
|
||||||
this.eventDispatcher.callMerge(plot, direction, max, player);
|
this.eventDispatcher.callMerge(plot, direction, max, player);
|
||||||
if (event.getEventResult() == Result.DENY) {
|
if (event.getEventResult() == Result.DENY) {
|
||||||
@ -156,7 +155,7 @@ public class Merge extends SubCommand {
|
|||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
|
|
||||||
if (!force && !plot.isOwner(uuid)) {
|
if (!force && !plot.isOwner(uuid)) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -168,8 +167,7 @@ public class Merge extends SubCommand {
|
|||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
terrain = "true".equalsIgnoreCase(args[1]);
|
terrain = "true".equalsIgnoreCase(args[1]);
|
||||||
}
|
}
|
||||||
if (!force && !terrain && !Permissions
|
if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -212,8 +210,7 @@ public class Merge extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
terrain = true;
|
terrain = true;
|
||||||
}
|
}
|
||||||
if (!force && !terrain && !Permissions
|
if (!force && !terrain && !player.hasPermission(Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
||||||
@ -238,7 +235,7 @@ public class Merge extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_MERGE_OTHER)) {
|
if (!force && !player.hasPermission(Permission.PERMISSION_MERGE_OTHER)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_OTHER))
|
TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_MERGE_OTHER))
|
||||||
@ -298,8 +295,14 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (force || !isOnline) {
|
if (force || !isOnline) {
|
||||||
if (force || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE_OTHER_OFFLINE)) {
|
if (force || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE_OTHER_OFFLINE)) {
|
||||||
if (plot.getPlotModificationManager().autoMerge(direction, maxSize - size, uuids.iterator().next(), player, terrain)) {
|
if (plot.getPlotModificationManager().autoMerge(
|
||||||
|
direction,
|
||||||
|
maxSize - size,
|
||||||
|
uuids.iterator().next(),
|
||||||
|
player,
|
||||||
|
terrain
|
||||||
|
)) {
|
||||||
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
||||||
if (!force && this.econHandler.getMoney(player) < price) {
|
if (!force && this.econHandler.getMoney(player) < price) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
|||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
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.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -62,8 +61,7 @@ public class Move extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
@ -90,8 +88,7 @@ public class Move extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target"));
|
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
|
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !player.hasPermission(Permission.PERMISSION_ADMIN))) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN))) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ import com.plotsquared.core.plot.flag.PlotFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -81,8 +80,7 @@ public class Music extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isAdded(player.getUUID()) && !Permissions
|
if (!plot.isAdded(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -31,7 +31,6 @@ import com.plotsquared.core.player.PlayerMetaDataKeys;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -101,10 +100,10 @@ public class Owner extends SetCommand {
|
|||||||
uuid = event.getNewOwner();
|
uuid = event.getNewOwner();
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
if (!force && !Permissions
|
if (!force && !player.hasPermission(
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER,
|
Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER,
|
||||||
true
|
true
|
||||||
)) {
|
)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotUnlinkEvent unlinkEvent = this.eventDispatcher.callUnlink(
|
PlotUnlinkEvent unlinkEvent = this.eventDispatcher.callUnlink(
|
||||||
@ -144,8 +143,7 @@ public class Owner extends SetCommand {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!force && !Permissions
|
if (!force && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
|
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("errors.invalid_player_offline"),
|
TranslatableCaption.of("errors.invalid_player_offline"),
|
||||||
|
@ -34,7 +34,6 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
|||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -116,8 +115,7 @@ public class Rate extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Permissions
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS, true)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS, true)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.clearRatings();
|
plot.clearRatings();
|
||||||
@ -275,10 +273,10 @@ public class Rate extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE)) {
|
if (player.hasPermission(Permission.PERMISSION_RATE)) {
|
||||||
completions.add("1 - 10");
|
completions.add("1 - 10");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
if (player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_PURGE_RATINGS)) {
|
||||||
completions.add("purge");
|
completions.add("purge");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -286,7 +284,7 @@ public class Rate extends SubCommand {
|
|||||||
.startsWith(args[0].toLowerCase()))
|
.startsWith(args[0].toLowerCase()))
|
||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -67,8 +66,7 @@ public class Remove extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_REMOVE)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_REMOVE)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.schematic.Schematic;
|
import com.plotsquared.core.plot.schematic.Schematic;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
@ -82,7 +81,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
String arg = args[0].toLowerCase();
|
String arg = args[0].toLowerCase();
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case "paste" -> {
|
case "paste" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -112,8 +111,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission("plots.admin.command.schematic.paste")) {
|
||||||
.hasPermission(player, "plots.admin.command.schematic.paste")) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,7 +233,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "export", "save" -> {
|
case "export", "save" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -263,8 +261,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !player.hasPermission("plots.admin.command.schematic.save")) {
|
||||||
.hasPermission(player, "plots.admin.command.schematic.save")) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -281,7 +278,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "list" -> {
|
case "list" -> {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_LIST)) {
|
if (!player.hasPermission(Permission.PERMISSION_SCHEMATIC_LIST)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -309,13 +306,13 @@ public class SchematicCmd extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
if (player.hasPermission(Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
||||||
completions.add("save");
|
completions.add("save");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_LIST)) {
|
if (player.hasPermission(Permission.PERMISSION_SCHEMATIC_LIST)) {
|
||||||
completions.add("list");
|
completions.add("list");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
if (player.hasPermission(Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
||||||
completions.add("paste");
|
completions.add("paste");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -330,7 +327,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_SCHEMATIC) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.PlotManager;
|
import com.plotsquared.core.plot.PlotManager;
|
||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.PatternUtil;
|
import com.plotsquared.core.util.PatternUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
@ -98,7 +97,7 @@ public class Set extends SubCommand {
|
|||||||
BlockType::getName).toList());
|
BlockType::getName).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_ALLOW_UNSAFE) &&
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_ALLOW_UNSAFE) &&
|
||||||
!forbiddenTypes.isEmpty()) {
|
!forbiddenTypes.isEmpty()) {
|
||||||
for (String forbiddenType : forbiddenTypes) {
|
for (String forbiddenType : forbiddenTypes) {
|
||||||
forbiddenType = forbiddenType.toLowerCase(Locale.ENGLISH);
|
forbiddenType = forbiddenType.toLowerCase(Locale.ENGLISH);
|
||||||
@ -134,7 +133,7 @@ public class Set extends SubCommand {
|
|||||||
|
|
||||||
for (String component : components) {
|
for (String component : components) {
|
||||||
if (component.equalsIgnoreCase(args[0])) {
|
if (component.equalsIgnoreCase(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SET_COMPONENT.format(component))) {
|
if (!player.hasPermission(Permission.PERMISSION_SET_COMPONENT.format(component))) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -216,7 +215,7 @@ public class Set extends SubCommand {
|
|||||||
}
|
}
|
||||||
Command cmd = MainCommand.getInstance().getCommand("set" + args[0]);
|
Command cmd = MainCommand.getInstance().getCommand("set" + args[0]);
|
||||||
if (cmd != null) {
|
if (cmd != null) {
|
||||||
if (!Permissions.hasPermission(player, cmd.getPermission(), true)) {
|
if (!player.hasPermission(cmd.getPermission(), true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), null, null);
|
cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), null, null);
|
||||||
@ -246,37 +245,37 @@ public class Set extends SubCommand {
|
|||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
|
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_BIOME)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_BIOME)) {
|
||||||
completions.add("biome");
|
completions.add("biome");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_ALIAS)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_ALIAS)) {
|
||||||
completions.add("alias");
|
completions.add("alias");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_HOME)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_HOME)) {
|
||||||
completions.add("home");
|
completions.add("home");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_MAIN)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_MAIN)) {
|
||||||
completions.add("main");
|
completions.add("main");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_FLOOR)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_FLOOR)) {
|
||||||
completions.add("floor");
|
completions.add("floor");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_AIR)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_AIR)) {
|
||||||
completions.add("air");
|
completions.add("air");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_ALL)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_ALL)) {
|
||||||
completions.add("all");
|
completions.add("all");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_BORDER)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_BORDER)) {
|
||||||
completions.add("border");
|
completions.add("border");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_WALL)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_WALL)) {
|
||||||
completions.add("wall");
|
completions.add("wall");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_OUTLINE)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_OUTLINE)) {
|
||||||
completions.add("outline");
|
completions.add("outline");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET_MIDDLE)) {
|
if (player.hasPermission(Permission.PERMISSION_SET_MIDDLE)) {
|
||||||
completions.add("middle");
|
completions.add("middle");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -285,7 +284,7 @@ public class Set extends SubCommand {
|
|||||||
.map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.APPEARANCE) {
|
.map(completion -> new Command(null, true, completion, "", RequiredType.NONE, CommandCategory.APPEARANCE) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_SET) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
@ -301,7 +300,7 @@ public class Set extends SubCommand {
|
|||||||
|
|
||||||
final Command cmd = MainCommand.getInstance().getCommand("set" + args[0]);
|
final Command cmd = MainCommand.getInstance().getCommand("set" + args[0]);
|
||||||
if (cmd != null) {
|
if (cmd != null) {
|
||||||
if (!Permissions.hasPermission(player, cmd.getPermission(), true)) {
|
if (!player.hasPermission(cmd.getPermission(), true)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
return cmd.tab(player, newArgs, space);
|
return cmd.tab(player, newArgs, space);
|
||||||
|
@ -23,7 +23,6 @@ import com.plotsquared.core.location.Location;
|
|||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
@ -40,7 +39,7 @@ public abstract class SetCommand extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -53,7 +52,7 @@ public abstract class SetCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID())) {
|
if (!plot.isOwner(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -23,7 +23,6 @@ import com.plotsquared.core.location.Location;
|
|||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -51,8 +50,7 @@ public class Swap extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ import com.plotsquared.core.setup.PlotAreaBuilder;
|
|||||||
import com.plotsquared.core.setup.SettingsNodesWrapper;
|
import com.plotsquared.core.setup.SettingsNodesWrapper;
|
||||||
import com.plotsquared.core.util.FileBytes;
|
import com.plotsquared.core.util.FileBytes;
|
||||||
import com.plotsquared.core.util.FileUtils;
|
import com.plotsquared.core.util.FileUtils;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
@ -288,10 +287,10 @@ public class Template extends SubCommand {
|
|||||||
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) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
final List<String> completions = new LinkedList<>();
|
final List<String> completions = new LinkedList<>();
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_TEMPLATE_EXPORT)) {
|
if (player.hasPermission(Permission.PERMISSION_TEMPLATE_EXPORT)) {
|
||||||
completions.add("export");
|
completions.add("export");
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_TEMPLATE_IMPORT)) {
|
if (player.hasPermission(Permission.PERMISSION_TEMPLATE_IMPORT)) {
|
||||||
completions.add("import");
|
completions.add("import");
|
||||||
}
|
}
|
||||||
final List<Command> commands = completions.stream().filter(completion -> completion
|
final List<Command> commands = completions.stream().filter(completion -> completion
|
||||||
@ -306,7 +305,7 @@ public class Template extends SubCommand {
|
|||||||
CommandCategory.ADMINISTRATION
|
CommandCategory.ADMINISTRATION
|
||||||
) {
|
) {
|
||||||
}).collect(Collectors.toCollection(LinkedList::new));
|
}).collect(Collectors.toCollection(LinkedList::new));
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_TEMPLATE) && args[0].length() > 0) {
|
if (player.hasPermission(Permission.PERMISSION_TEMPLATE) && args[0].length() > 0) {
|
||||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
|
@ -26,7 +26,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
@ -70,8 +69,7 @@ public class Trust extends Command {
|
|||||||
}
|
}
|
||||||
checkTrue(currentPlot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
checkTrue(currentPlot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||||
checkTrue(
|
checkTrue(
|
||||||
currentPlot.isOwner(player.getUUID()) || Permissions
|
currentPlot.isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
|
|
||||||
TranslatableCaption.of("permission.no_plot_perms")
|
TranslatableCaption.of("permission.no_plot_perms")
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -102,8 +100,7 @@ public class Trust extends Command {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
UUID uuid = iterator.next();
|
UUID uuid = iterator.next();
|
||||||
if (uuid == DBFunc.EVERYONE && !(
|
if (uuid == DBFunc.EVERYONE && !(
|
||||||
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
|
player.hasPermission(Permission.PERMISSION_TRUST_EVERYONE) || player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
@ -140,7 +137,7 @@ public class Trust extends Command {
|
|||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
int localTrustSize = currentPlot.getTrusted().size();
|
int localTrustSize = currentPlot.getTrusted().size();
|
||||||
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
|
int maxTrustSize = player.hasPermissionRange(Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
|
||||||
if (localTrustSize >= maxTrustSize) {
|
if (localTrustSize >= maxTrustSize) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("members.plot_max_members_trusted"),
|
TranslatableCaption.of("members.plot_max_members_trusted"),
|
||||||
|
@ -27,7 +27,6 @@ import com.plotsquared.core.permissions.Permission;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -93,8 +92,7 @@ public class Unlink extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean force = event.getEventResult() == Result.FORCE;
|
boolean force = event.getEventResult() == Result.FORCE;
|
||||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
if (!force && !plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_UNLINK)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_UNLINK)) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
|
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.TabCompletions;
|
import com.plotsquared.core.util.TabCompletions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
@ -111,7 +110,7 @@ public class Visit extends Command {
|
|||||||
|
|
||||||
final Plot plot = plots.get(page - 1);
|
final Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) {
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_UNOWNED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.unowned")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.unowned")))
|
||||||
@ -119,8 +118,7 @@ public class Visit extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isOwner(player.getUUID())) {
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_OWNED) && !player.hasPermission(Permission.PERMISSION_HOME)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_HOME)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.owned")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.owned")))
|
||||||
@ -128,7 +126,7 @@ public class Visit extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SHARED)) {
|
if (!player.hasPermission(Permission.PERMISSION_SHARED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.shared")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.shared")))
|
||||||
@ -138,8 +136,8 @@ public class Visit extends Command {
|
|||||||
} else {
|
} else {
|
||||||
// allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or
|
// allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or
|
||||||
// plot.admin.visit.untrusted permission
|
// plot.admin.visit.untrusted permission
|
||||||
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)
|
if (!plot.getFlag(UntrustedVisitFlag.class) && !player.hasPermission(Permission.PERMISSION_VISIT_OTHER)
|
||||||
&& !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
|
&& !player.hasPermission(Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.other")))
|
TagResolver.resolver("node", Tag.inserting(Component.text("plots.visit.other")))
|
||||||
@ -147,7 +145,7 @@ public class Visit extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.isDenied(player.getUUID())) {
|
if (plot.isDenied(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
|
if (!player.hasPermission(Permission.PERMISSION_VISIT_DENIED)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("permission.no_permission"),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.queue.QueueCoordinator;
|
|||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import com.plotsquared.core.util.PatternUtil;
|
import com.plotsquared.core.util.PatternUtil;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -53,7 +52,6 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -155,8 +153,7 @@ public class ComponentPresetManager {
|
|||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||||
return null;
|
return null;
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission(
|
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !player.hasPermission(
|
||||||
player,
|
|
||||||
Permission.PERMISSION_ADMIN_COMPONENTS_OTHER
|
Permission.PERMISSION_ADMIN_COMPONENTS_OTHER
|
||||||
)) {
|
)) {
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
@ -168,8 +165,7 @@ public class ComponentPresetManager {
|
|||||||
|
|
||||||
final List<ComponentPreset> allowedPresets = new ArrayList<>(this.presets.size());
|
final List<ComponentPreset> allowedPresets = new ArrayList<>(this.presets.size());
|
||||||
for (final ComponentPreset componentPreset : this.presets) {
|
for (final ComponentPreset componentPreset : this.presets) {
|
||||||
if (!componentPreset.getPermission().isEmpty() && !Permissions.hasPermission(
|
if (!componentPreset.getPermission().isEmpty() && !player.hasPermission(
|
||||||
player,
|
|
||||||
componentPreset.getPermission()
|
componentPreset.getPermission()
|
||||||
)) {
|
)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -20,7 +20,6 @@ package com.plotsquared.core.configuration.caption;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.ComponentLike;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ package com.plotsquared.core.configuration.caption;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.ComponentLike;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
|
@ -144,7 +144,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
plot.getRegions(),
|
plot.getRegions(),
|
||||||
blocks,
|
blocks,
|
||||||
classicPlotWorld.getMinBuildHeight(),
|
classicPlotWorld.getMinBuildHeight(),
|
||||||
classicPlotWorld.getMaxBuildHeight(),
|
classicPlotWorld.getMaxBuildHeight() - 1,
|
||||||
actor,
|
actor,
|
||||||
queue
|
queue
|
||||||
);
|
);
|
||||||
@ -175,7 +175,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
plot.getRegions(),
|
plot.getRegions(),
|
||||||
blocks,
|
blocks,
|
||||||
classicPlotWorld.PLOT_HEIGHT + 1,
|
classicPlotWorld.PLOT_HEIGHT + 1,
|
||||||
classicPlotWorld.getMaxBuildHeight(),
|
classicPlotWorld.getMaxBuildHeight() - 1,
|
||||||
actor,
|
actor,
|
||||||
queue
|
queue
|
||||||
);
|
);
|
||||||
@ -281,7 +281,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxY = classicPlotWorld.getMaxBuildHeight();
|
int maxY = classicPlotWorld.getMaxBuildHeight() - 1;
|
||||||
if (!plot.isMerged(Direction.NORTH)) {
|
if (!plot.isMerged(Direction.NORTH)) {
|
||||||
int z = bottom.getZ();
|
int z = bottom.getZ();
|
||||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||||
|
@ -23,7 +23,6 @@ import com.plotsquared.core.configuration.Settings;
|
|||||||
import com.plotsquared.core.configuration.caption.Caption;
|
import com.plotsquared.core.configuration.caption.Caption;
|
||||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
@ -56,7 +55,6 @@ import com.plotsquared.core.plot.flag.implementations.TitlesFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.WeatherFlag;
|
import com.plotsquared.core.plot.flag.implementations.WeatherFlag;
|
||||||
import com.plotsquared.core.plot.flag.types.TimedFlag;
|
import com.plotsquared.core.plot.flag.types.TimedFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
@ -79,7 +77,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class PlotListener {
|
public class PlotListener {
|
||||||
|
|
||||||
@ -152,8 +149,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
|
public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
|
||||||
if (plot.isDenied(player.getUUID()) && !Permissions
|
if (plot.isDenied(player.getUUID()) && !player.hasPermission("plots.admin.entry.denied")) {
|
||||||
.hasPermission(player, "plots.admin.entry.denied")) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("deny.no_enter"),
|
TranslatableCaption.of("deny.no_enter"),
|
||||||
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
|
||||||
@ -191,7 +187,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plot.getFlag(NotifyEnterFlag.class)) {
|
if (plot.getFlag(NotifyEnterFlag.class)) {
|
||||||
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
|
if (!player.hasPermission("plots.flag.notify-enter.bypass")) {
|
||||||
for (UUID uuid : plot.getOwners()) {
|
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)) {
|
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
||||||
@ -203,7 +199,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final FlyFlag.FlyStatus flyStatus = plot.getFlag(FlyFlag.class);
|
final FlyFlag.FlyStatus flyStatus = plot.getFlag(FlyFlag.class);
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_FLIGHT)) {
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_FLIGHT)) {
|
||||||
if (flyStatus != FlyFlag.FlyStatus.DEFAULT) {
|
if (flyStatus != FlyFlag.FlyStatus.DEFAULT) {
|
||||||
boolean flight = player.getFlight();
|
boolean flight = player.getFlight();
|
||||||
GameMode gamemode = player.getGameMode();
|
GameMode gamemode = player.getGameMode();
|
||||||
@ -219,7 +215,7 @@ public class PlotListener {
|
|||||||
final GameMode gameMode = plot.getFlag(GamemodeFlag.class);
|
final GameMode gameMode = plot.getFlag(GamemodeFlag.class);
|
||||||
if (!gameMode.equals(GamemodeFlag.DEFAULT)) {
|
if (!gameMode.equals(GamemodeFlag.DEFAULT)) {
|
||||||
if (player.getGameMode() != gameMode) {
|
if (player.getGameMode() != gameMode) {
|
||||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
if (!player.hasPermission("plots.gamemode.bypass")) {
|
||||||
player.setGameMode(gameMode);
|
player.setGameMode(gameMode);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -236,7 +232,7 @@ public class PlotListener {
|
|||||||
final GameMode guestGameMode = plot.getFlag(GuestGamemodeFlag.class);
|
final GameMode guestGameMode = plot.getFlag(GuestGamemodeFlag.class);
|
||||||
if (!guestGameMode.equals(GamemodeFlag.DEFAULT)) {
|
if (!guestGameMode.equals(GamemodeFlag.DEFAULT)) {
|
||||||
if (player.getGameMode() != guestGameMode && !plot.isAdded(player.getUUID())) {
|
if (player.getGameMode() != guestGameMode && !plot.isAdded(player.getUUID())) {
|
||||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
if (!player.hasPermission("plots.gamemode.bypass")) {
|
||||||
player.setGameMode(guestGameMode);
|
player.setGameMode(guestGameMode);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -381,8 +377,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
try (final MetaDataAccess<Boolean> kickAccess =
|
try (final MetaDataAccess<Boolean> kickAccess =
|
||||||
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
||||||
if (plot.getFlag(DenyExitFlag.class) && !Permissions
|
if (plot.getFlag(DenyExitFlag.class) && !player.hasPermission(Permission.PERMISSION_ADMIN_EXIT_DENIED) &&
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_EXIT_DENIED) &&
|
|
||||||
!kickAccess.get().orElse(false)) {
|
!kickAccess.get().orElse(false)) {
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
lastPlot.set(previous);
|
lastPlot.set(previous);
|
||||||
@ -393,7 +388,7 @@ public class PlotListener {
|
|||||||
if (!plot.getFlag(GamemodeFlag.class).equals(GamemodeFlag.DEFAULT) || !plot
|
if (!plot.getFlag(GamemodeFlag.class).equals(GamemodeFlag.DEFAULT) || !plot
|
||||||
.getFlag(GuestGamemodeFlag.class).equals(GamemodeFlag.DEFAULT)) {
|
.getFlag(GuestGamemodeFlag.class).equals(GamemodeFlag.DEFAULT)) {
|
||||||
if (player.getGameMode() != pw.getGameMode()) {
|
if (player.getGameMode() != pw.getGameMode()) {
|
||||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
if (!player.hasPermission("plots.gamemode.bypass")) {
|
||||||
player.setGameMode(pw.getGameMode());
|
player.setGameMode(pw.getGameMode());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -417,7 +412,7 @@ public class PlotListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plot.getFlag(NotifyLeaveFlag.class)) {
|
if (plot.getFlag(NotifyLeaveFlag.class)) {
|
||||||
if (!Permissions.hasPermission(player, "plots.flag.notify-leave.bypass")) {
|
if (!player.hasPermission("plots.flag.notify-leave.bypass")) {
|
||||||
for (UUID uuid : plot.getOwners()) {
|
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)) {
|
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
||||||
|
@ -25,7 +25,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.WEManager;
|
import com.plotsquared.core.util.WEManager;
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
@ -94,7 +93,7 @@ public class WESubscriber {
|
|||||||
} else {
|
} else {
|
||||||
mask = WEManager.getMask(plotPlayer);
|
mask = WEManager.getMask(plotPlayer);
|
||||||
if (mask.isEmpty()) {
|
if (mask.isEmpty()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
|
if (plotPlayer.hasPermission("plots.worldedit.bypass")) {
|
||||||
plotPlayer.sendMessage(
|
plotPlayer.sendMessage(
|
||||||
TranslatableCaption.of("worldedit.worldedit_bypass"),
|
TranslatableCaption.of("worldedit.worldedit_bypass"),
|
||||||
TagResolver.resolver("command", Tag.inserting(Component.text("/plot toggle worldedit")))
|
TagResolver.resolver("command", Tag.inserting(Component.text("/plot toggle worldedit")))
|
||||||
|
@ -38,6 +38,16 @@ public interface PermissionHolder {
|
|||||||
return hasPermission(null, permission);
|
return hasPermission(null, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the owner of the profile has a given (global) permission
|
||||||
|
*
|
||||||
|
* @param permission Permission
|
||||||
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
|
*/
|
||||||
|
default boolean hasPermission(final @NonNull Permission permission) {
|
||||||
|
return hasPermission(permission.toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the owner of the profile has a given (global) keyed permission. Checks both {@code permission.key}
|
* Check if the owner of the profile has a given (global) keyed permission. Checks both {@code permission.key}
|
||||||
* and {@code permission.*}
|
* and {@code permission.*}
|
||||||
@ -54,6 +64,23 @@ public interface PermissionHolder {
|
|||||||
return hasKeyedPermission(null, permission, key);
|
return hasKeyedPermission(null, permission, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 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
|
||||||
|
*/
|
||||||
|
@NonNegative
|
||||||
|
default int hasPermissionRange(
|
||||||
|
final @NonNull Permission stub,
|
||||||
|
@NonNegative final int range
|
||||||
|
) {
|
||||||
|
return hasPermissionRange(stub.toString(), range);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the highest permission a PlotPlayer has within a specified range.<br>
|
* Check the highest permission a PlotPlayer has within a specified range.<br>
|
||||||
* - Excessively high values will lag<br>
|
* - Excessively high values will lag<br>
|
||||||
@ -92,6 +119,26 @@ public interface PermissionHolder {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the owner of the profile has a permission, and optionally send the no permission message if applicable.
|
||||||
|
*
|
||||||
|
* @param permission Permission
|
||||||
|
* @param notify If to notify the permission holder
|
||||||
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
|
*/
|
||||||
|
default boolean hasPermission(@NonNull Permission permission, boolean notify) {
|
||||||
|
return hasPermission(permission.toString(), notify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the owner of the profile has a permission, and optionally send the no permission message if applicable.
|
||||||
|
*
|
||||||
|
* @param permission Permission
|
||||||
|
* @param notify If to notify the permission holder
|
||||||
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
|
*/
|
||||||
|
boolean hasPermission(@NonNull String permission, boolean notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the owner of the profile has a given permission
|
* Check if the owner of the profile has a given permission
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,6 @@ import com.plotsquared.core.plot.world.SinglePlotArea;
|
|||||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||||
import com.plotsquared.core.synchronization.LockRepository;
|
import com.plotsquared.core.synchronization.LockRepository;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -57,7 +56,6 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
|
|||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.ComponentLike;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
import net.kyori.adventure.title.Title;
|
import net.kyori.adventure.title.Title;
|
||||||
@ -201,6 +199,20 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
return this.permissionProfile.hasKeyedPermission(world, permission, key);
|
return this.permissionProfile.hasKeyedPermission(world, permission, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean hasPermission(@NonNull String permission, boolean notify) {
|
||||||
|
if (!hasPermission(permission)) {
|
||||||
|
if (notify) {
|
||||||
|
sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", permission)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract Actor toActor();
|
public abstract Actor toActor();
|
||||||
|
|
||||||
public abstract P getPlatformPlayer();
|
public abstract P getPlatformPlayer();
|
||||||
@ -291,7 +303,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
* @return number of allowed plots within the scope (globally, or in the player's current world as defined in the settings.yml)
|
* @return number of allowed plots within the scope (globally, or in the player's current world as defined in the settings.yml)
|
||||||
*/
|
*/
|
||||||
public int getAllowedPlots() {
|
public int getAllowedPlots() {
|
||||||
return Permissions.hasPermissionRange(this, "plots.plot", Settings.Limit.MAX_PLOTS);
|
return hasPermissionRange("plots.plot", Settings.Limit.MAX_PLOTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,6 @@ import com.plotsquared.core.plot.world.SinglePlotArea;
|
|||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import com.plotsquared.core.util.RegionManager;
|
import com.plotsquared.core.util.RegionManager;
|
||||||
import com.plotsquared.core.util.RegionUtil;
|
import com.plotsquared.core.util.RegionUtil;
|
||||||
@ -122,9 +121,6 @@ public class Plot {
|
|||||||
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
||||||
private static final Cleaner CLEANER = Cleaner.create();
|
private static final Cleaner CLEANER = Cleaner.create();
|
||||||
|
|
||||||
static Set<Plot> connected_cache;
|
|
||||||
static Set<CuboidRegion> regions_cache;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
|
FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
|
||||||
}
|
}
|
||||||
@ -207,6 +203,8 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
private Plot origin;
|
private Plot origin;
|
||||||
|
|
||||||
|
private Set<Plot> connectedCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a new plot.
|
* Constructor for a new plot.
|
||||||
* (Only changes after plot.create() will be properly set in the database)
|
* (Only changes after plot.create() will be properly set in the database)
|
||||||
@ -576,7 +574,14 @@ public class Plot {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Set<Plot> connected = getConnectedPlots();
|
final Set<Plot> connected = getConnectedPlots();
|
||||||
return connected.stream().anyMatch(current -> uuid.equals(current.getOwner()));
|
for (Plot current : connected) {
|
||||||
|
// can skip ServerPlotFlag check in getOwner()
|
||||||
|
// as flags are synchronized between plots
|
||||||
|
if (uuid.equals(current.getOwnerAbs())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1294,6 +1299,7 @@ public class Plot {
|
|||||||
DBFunc.delete(current);
|
DBFunc.delete(current);
|
||||||
current.setOwnerAbs(null);
|
current.setOwnerAbs(null);
|
||||||
current.settings = null;
|
current.settings = null;
|
||||||
|
current.clearCache();
|
||||||
for (final PlotPlayer<?> pp : players) {
|
for (final PlotPlayer<?> pp : players) {
|
||||||
this.plotListener.plotEntry(pp, current);
|
this.plotListener.plotEntry(pp, current);
|
||||||
}
|
}
|
||||||
@ -1854,6 +1860,7 @@ public class Plot {
|
|||||||
this.area.removePlot(this.id);
|
this.area.removePlot(this.id);
|
||||||
this.id = plot.getId();
|
this.id = plot.getId();
|
||||||
this.area.addPlotAbs(this);
|
this.area.addPlotAbs(this);
|
||||||
|
clearCache();
|
||||||
DBFunc.movePlot(this, plot);
|
DBFunc.movePlot(this, plot);
|
||||||
TaskManager.runTaskLater(whenDone, TaskTime.ticks(1L));
|
TaskManager.runTaskLater(whenDone, TaskTime.ticks(1L));
|
||||||
return true;
|
return true;
|
||||||
@ -2118,17 +2125,16 @@ public class Plot {
|
|||||||
this.origin.origin = base;
|
this.origin.origin = base;
|
||||||
other.origin = base;
|
other.origin = base;
|
||||||
this.origin = base;
|
this.origin = base;
|
||||||
connected_cache = null;
|
this.connectedCache = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.origin != null) {
|
if (this.origin != null) {
|
||||||
this.origin.origin = null;
|
this.origin.origin = null;
|
||||||
this.origin = null;
|
this.origin = null;
|
||||||
}
|
}
|
||||||
connected_cache = null;
|
this.connectedCache = null;
|
||||||
}
|
}
|
||||||
DBFunc.setMerged(this, this.getSettings().getMerged());
|
DBFunc.setMerged(this, this.getSettings().getMerged());
|
||||||
regions_cache = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2163,8 +2169,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
connected_cache = null;
|
this.connectedCache = null;
|
||||||
regions_cache = null;
|
|
||||||
if (this.origin != null) {
|
if (this.origin != null) {
|
||||||
this.origin.origin = null;
|
this.origin.origin = null;
|
||||||
this.origin = null;
|
this.origin = null;
|
||||||
@ -2191,7 +2196,7 @@ public class Plot {
|
|||||||
public boolean canClaim(@NonNull PlotPlayer<?> player) {
|
public boolean canClaim(@NonNull PlotPlayer<?> player) {
|
||||||
PlotCluster cluster = this.getCluster();
|
PlotCluster cluster = this.getCluster();
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
if (!cluster.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.claim")) {
|
if (!cluster.isAdded(player.getUUID()) && !player.hasPermission("plots.admin.command.claim")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2291,10 +2296,9 @@ public class Plot {
|
|||||||
if (!this.isMerged()) {
|
if (!this.isMerged()) {
|
||||||
return Collections.singleton(this);
|
return Collections.singleton(this);
|
||||||
}
|
}
|
||||||
if (connected_cache != null && connected_cache.contains(this)) {
|
if (this.connectedCache != null && this.connectedCache.contains(this)) {
|
||||||
return connected_cache;
|
return this.connectedCache;
|
||||||
}
|
}
|
||||||
regions_cache = null;
|
|
||||||
|
|
||||||
HashSet<Plot> tmpSet = new HashSet<>();
|
HashSet<Plot> tmpSet = new HashSet<>();
|
||||||
tmpSet.add(this);
|
tmpSet.add(this);
|
||||||
@ -2399,7 +2403,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connected_cache = tmpSet;
|
this.connectedCache = tmpSet;
|
||||||
return tmpSet;
|
return tmpSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2411,19 +2415,15 @@ public class Plot {
|
|||||||
* @return all regions within the plot
|
* @return all regions within the plot
|
||||||
*/
|
*/
|
||||||
public @NonNull Set<CuboidRegion> getRegions() {
|
public @NonNull Set<CuboidRegion> getRegions() {
|
||||||
if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) {
|
|
||||||
return regions_cache;
|
|
||||||
}
|
|
||||||
if (!this.isMerged()) {
|
if (!this.isMerged()) {
|
||||||
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
|
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
|
||||||
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
|
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
|
||||||
connected_cache = Sets.newHashSet(this);
|
this.connectedCache = Sets.newHashSet(this);
|
||||||
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||||
regions_cache = Collections.singleton(rg);
|
return Collections.singleton(rg);
|
||||||
return regions_cache;
|
|
||||||
}
|
}
|
||||||
Set<Plot> plots = this.getConnectedPlots();
|
Set<Plot> plots = this.getConnectedPlots();
|
||||||
Set<CuboidRegion> regions = regions_cache = new HashSet<>();
|
Set<CuboidRegion> regions = new HashSet<>();
|
||||||
Set<PlotId> visited = new HashSet<>();
|
Set<PlotId> visited = new HashSet<>();
|
||||||
for (Plot current : plots) {
|
for (Plot current : plots) {
|
||||||
if (visited.contains(current.getId())) {
|
if (visited.contains(current.getId())) {
|
||||||
@ -2496,7 +2496,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int minHeight = getArea().getMinBuildHeight();
|
int minHeight = getArea().getMinBuildHeight();
|
||||||
int maxHeight = getArea().getMaxBuildHeight();
|
int maxHeight = getArea().getMaxBuildHeight() - 1;
|
||||||
Location gtopabs = this.area.getPlotAbs(top).getTopAbs();
|
Location gtopabs = this.area.getPlotAbs(top).getTopAbs();
|
||||||
Location gbotabs = this.area.getPlotAbs(bot).getBottomAbs();
|
Location gbotabs = this.area.getPlotAbs(bot).getBottomAbs();
|
||||||
visited.addAll(Lists.newArrayList((Iterable<? extends PlotId>) PlotId.PlotRangeIterator.range(bot, top)));
|
visited.addAll(Lists.newArrayList((Iterable<? extends PlotId>) PlotId.PlotRangeIterator.range(bot, top)));
|
||||||
@ -2589,7 +2589,7 @@ public class Plot {
|
|||||||
.tag("message", Tag.inserting(Component.text(message)))
|
.tag("message", Tag.inserting(Component.text(message)))
|
||||||
.build();
|
.build();
|
||||||
for (final PlotPlayer<?> player : players) {
|
for (final PlotPlayer<?> player : players) {
|
||||||
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
|
if (isOwner(player.getUUID()) || player.hasPermission(Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
|
||||||
player.sendMessage(caption, resolver);
|
player.sendMessage(caption, resolver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2626,8 +2626,7 @@ public class Plot {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Consumer<Location> locationConsumer = location -> {
|
final Consumer<Location> locationConsumer = location -> {
|
||||||
if (Settings.Teleport.DELAY == 0 || Permissions
|
if (Settings.Teleport.DELAY == 0 || player.hasPermission("plots.teleport.delay.bypass")) {
|
||||||
.hasPermission(player, "plots.teleport.delay.bypass")) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
|
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
|
||||||
player.teleport(location, cause);
|
player.teleport(location, cause);
|
||||||
resultConsumer.accept(true);
|
resultConsumer.accept(true);
|
||||||
|
@ -48,7 +48,6 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
|||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.RegionUtil;
|
import com.plotsquared.core.util.RegionUtil;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
@ -654,7 +653,7 @@ public abstract class PlotArea implements ComponentLike {
|
|||||||
* @since 6.9.1
|
* @since 6.9.1
|
||||||
*/
|
*/
|
||||||
public boolean notifyIfOutsideBuildArea(PlotPlayer<?> player, int y) {
|
public boolean notifyIfOutsideBuildArea(PlotPlayer<?> player, int y) {
|
||||||
if (!buildRangeContainsY(y) && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
if (!buildRangeContainsY(y) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("height.height_limit"),
|
TranslatableCaption.of("height.height_limit"),
|
||||||
TagResolver.builder()
|
TagResolver.builder()
|
||||||
|
@ -265,6 +265,7 @@ public final class PlotModificationManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot current = queue.poll();
|
Plot current = queue.poll();
|
||||||
|
current.clearCache();
|
||||||
if (plot.getArea().getTerrain() != PlotAreaTerrainType.NONE) {
|
if (plot.getArea().getTerrain() != PlotAreaTerrainType.NONE) {
|
||||||
try {
|
try {
|
||||||
PlotSquared.platform().regionManager().regenerateRegion(
|
PlotSquared.platform().regionManager().regenerateRegion(
|
||||||
@ -329,6 +330,7 @@ public final class PlotModificationManager {
|
|||||||
ArrayList<PlotId> ids = new ArrayList<>(plots.size());
|
ArrayList<PlotId> ids = new ArrayList<>(plots.size());
|
||||||
for (Plot current : plots) {
|
for (Plot current : plots) {
|
||||||
current.setHome(null);
|
current.setHome(null);
|
||||||
|
current.clearCache();
|
||||||
ids.add(current.getId());
|
ids.add(current.getId());
|
||||||
}
|
}
|
||||||
this.plot.clearRatings();
|
this.plot.clearRatings();
|
||||||
@ -483,8 +485,7 @@ public final class PlotModificationManager {
|
|||||||
this.plot.updateWorldBorder();
|
this.plot.updateWorldBorder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Plot.connected_cache = null;
|
this.plot.clearCache();
|
||||||
Plot.regions_cache = null;
|
|
||||||
this.plot.getTrusted().clear();
|
this.plot.getTrusted().clear();
|
||||||
this.plot.getMembers().clear();
|
this.plot.getMembers().clear();
|
||||||
this.plot.getDenied().clear();
|
this.plot.getDenied().clear();
|
||||||
@ -635,6 +636,7 @@ public final class PlotModificationManager {
|
|||||||
if (queue.size() > 0) {
|
if (queue.size() > 0) {
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
}
|
}
|
||||||
|
visited.forEach(Plot::clearCache);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ package com.plotsquared.core.plot.comment;
|
|||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -37,9 +36,8 @@ public abstract class CommentInbox {
|
|||||||
* @return the inbox, otherwise {@code false} false
|
* @return the inbox, otherwise {@code false} false
|
||||||
*/
|
*/
|
||||||
public boolean canRead(Plot plot, PlotPlayer<?> player) {
|
public boolean canRead(Plot plot, PlotPlayer<?> player) {
|
||||||
if (Permissions.hasPermission(player, "plots.inbox.read." + this, true)) {
|
if (player.hasPermission("plots.inbox.read." + this, true)) {
|
||||||
return plot.isOwner(player.getUUID()) || Permissions
|
return plot.isOwner(player.getUUID()) || player.hasPermission("plots.inbox.read." + this + ".other", true);
|
||||||
.hasPermission(player, "plots.inbox.read." + this + ".other", true);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -51,11 +49,10 @@ public abstract class CommentInbox {
|
|||||||
*/
|
*/
|
||||||
public boolean canWrite(Plot plot, PlotPlayer<?> player) {
|
public boolean canWrite(Plot plot, PlotPlayer<?> player) {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(player, "plots.inbox.write." + this, true);
|
return player.hasPermission("plots.inbox.write." + this, true);
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(player, "plots.inbox.write." + this, true) && (
|
return player.hasPermission("plots.inbox.write." + this, true) && (
|
||||||
plot.isOwner(player.getUUID()) || Permissions
|
plot.isOwner(player.getUUID()) || player.hasPermission("plots.inbox.write." + this + ".other", true));
|
||||||
.hasPermission(player, "plots.inbox.write." + this + ".other", true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,9 +62,8 @@ public abstract class CommentInbox {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings({"BooleanMethodIsAlwaysInverted"})
|
@SuppressWarnings({"BooleanMethodIsAlwaysInverted"})
|
||||||
public boolean canModify(Plot plot, PlotPlayer<?> player) {
|
public boolean canModify(Plot plot, PlotPlayer<?> player) {
|
||||||
if (Permissions.hasPermission(player, "plots.inbox.modify." + this, true)) {
|
if (player.hasPermission("plots.inbox.modify." + this, true)) {
|
||||||
return plot.isOwner(player.getUUID()) || Permissions
|
return plot.isOwner(player.getUUID()) || player.hasPermission("plots.inbox.modify." + this + ".other", true);
|
||||||
.hasPermission(player, "plots.inbox.modify." + this + ".other", true);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -334,8 +334,7 @@ public class EventDispatcher {
|
|||||||
) {
|
) {
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
assert area != null;
|
assert area != null;
|
||||||
if (!area.buildRangeContainsY(location.getY()) && !Permissions
|
if (!area.buildRangeContainsY(location.getY()) && !player.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("height.height_limit"),
|
TranslatableCaption.of("height.height_limit"),
|
||||||
TagResolver.builder()
|
TagResolver.builder()
|
||||||
@ -364,12 +363,12 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -380,7 +379,7 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) {
|
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (notifyPerms) {
|
if (notifyPerms) {
|
||||||
@ -399,12 +398,12 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), false
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), false
|
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -418,19 +417,19 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Permissions
|
return player.hasPermission(
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case SPAWN_MOB: {
|
case SPAWN_MOB: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -444,10 +443,10 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Permissions
|
if (player.hasPermission(
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
||||||
false
|
false
|
||||||
)) {
|
)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (notifyPerms) {
|
if (notifyPerms) {
|
||||||
@ -467,12 +466,12 @@ public class EventDispatcher {
|
|||||||
}
|
}
|
||||||
case PLACE_MISC: {
|
case PLACE_MISC: {
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -486,10 +485,10 @@ public class EventDispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Permissions
|
if (player.hasPermission(
|
||||||
.hasPermission(player, Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
|
||||||
false
|
false
|
||||||
)) {
|
)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (notifyPerms) {
|
if (notifyPerms) {
|
||||||
@ -509,12 +508,12 @@ public class EventDispatcher {
|
|||||||
}
|
}
|
||||||
case PLACE_VEHICLE:
|
case PLACE_VEHICLE:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(player,
|
return player.hasPermission(
|
||||||
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -34,14 +34,14 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
* - Checking the PlotPlayer class directly will not take the above into account<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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public class Permissions {
|
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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
||||||
@ -55,7 +55,7 @@ public class Permissions {
|
|||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PermissionHolder#hasPermission(Permission)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
||||||
@ -70,7 +70,7 @@ public class Permissions {
|
|||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PermissionHolder#hasPermission(String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
||||||
@ -87,7 +87,7 @@ public class Permissions {
|
|||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
* @since 6.0.10
|
* @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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PermissionHolder#hasKeyedPermission(String, String)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static boolean hasKeyedPermission(
|
public static boolean hasKeyedPermission(
|
||||||
@ -105,7 +105,7 @@ public class Permissions {
|
|||||||
* @param notify if to notify the permission holder
|
* @param notify if to notify the permission holder
|
||||||
* @return if permission is had
|
* @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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PlotPlayer#hasPermission(String, boolean)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
||||||
@ -123,7 +123,7 @@ 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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PlotPlayer#hasPermissionRange(Permission, int)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
||||||
@ -140,7 +140,7 @@ public class Permissions {
|
|||||||
* @param range The range to check
|
* @param range The range to check
|
||||||
* @return The highest permission they have within that range
|
* @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
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
* classes
|
* classes. Use {@link PlotPlayer#hasPermissionRange(String, int)}
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "6.9.3")
|
@Deprecated(forRemoval = true, since = "6.9.3")
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
||||||
|
@ -106,7 +106,7 @@ public class WEManager {
|
|||||||
.getTrusted().contains(uuid))) && !plot.getFlag(NoWorldeditFlag.class)) {
|
.getTrusted().contains(uuid))) && !plot.getFlag(NoWorldeditFlag.class)) {
|
||||||
for (CuboidRegion region : plot.getRegions()) {
|
for (CuboidRegion region : plot.getRegions()) {
|
||||||
BlockVector3 pos1 = region.getMinimumPoint().withY(area.getMinBuildHeight());
|
BlockVector3 pos1 = region.getMinimumPoint().withY(area.getMinBuildHeight());
|
||||||
BlockVector3 pos2 = region.getMaximumPoint().withY(area.getMaxBuildHeight());
|
BlockVector3 pos2 = region.getMaximumPoint().withY(area.getMaxBuildHeight() - 1);
|
||||||
CuboidRegion copy = new CuboidRegion(pos1, pos2);
|
CuboidRegion copy = new CuboidRegion(pos1, pos2);
|
||||||
regions.add(copy);
|
regions.add(copy);
|
||||||
}
|
}
|
||||||
|
@ -55,4 +55,3 @@ public class AbstractDelegateOutputStream extends OutputStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
|||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
class GlobalPlotProvider implements PlotProvider {
|
class GlobalPlotProvider implements PlotProvider {
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class GlobalPlotProvider implements PlotProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Plot> getPlots() {
|
public Collection<Plot> getPlots() {
|
||||||
final Set<Plot> plots = new HashSet<>();
|
final List<Plot> plots = new ArrayList<>();
|
||||||
for (final PlotArea plotArea : this.plotAreaManager.getAllPlotAreas()) {
|
for (final PlotArea plotArea : this.plotAreaManager.getAllPlotAreas()) {
|
||||||
plots.addAll(plotArea.getPlots());
|
plots.addAll(plotArea.getPlots());
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ package com.plotsquared.core.util.query;
|
|||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
class OwnersIncludeFilter implements PlotFilter {
|
class OwnersIncludeFilter implements PlotFilter {
|
||||||
|
@ -83,4 +83,3 @@ public interface PlotSquaredTask extends Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,4 +276,3 @@ public class AbstractDBTest implements AbstractDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,16 @@ plugins {
|
|||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
version = "7.0.0-SNAPSHOT"
|
version = "7.0.0-SNAPSHOT"
|
||||||
|
|
||||||
|
if (!File("$rootDir/.git").exists()) {
|
||||||
|
logger.lifecycle("""
|
||||||
|
**************************************************************************************
|
||||||
|
You need to fork and clone this repository! Don't download a .zip file.
|
||||||
|
If you need assistance, consult the GitHub docs: https://docs.github.com/get-started/quickstart/fork-a-repo
|
||||||
|
**************************************************************************************
|
||||||
|
""".trimIndent()
|
||||||
|
).also { kotlin.system.exitProcess(1) }
|
||||||
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
group = rootProject.group
|
group = rootProject.group
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
@ -64,7 +74,7 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(platform("com.intellectualsites.bom:bom-newest:1.21"))
|
implementation(platform("com.intellectualsites.bom:bom-newest:1.22"))
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -90,6 +100,9 @@ subprojects {
|
|||||||
java {
|
java {
|
||||||
licenseHeaderFile(rootProject.file("HEADER.txt"))
|
licenseHeaderFile(rootProject.file("HEADER.txt"))
|
||||||
target("**/*.java")
|
target("**/*.java")
|
||||||
|
endWithNewline()
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
removeUnusedImports()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ squirrelid = "0.3.1"
|
|||||||
# Gradle plugins
|
# Gradle plugins
|
||||||
shadow = "7.1.2"
|
shadow = "7.1.2"
|
||||||
grgit = "4.1.1"
|
grgit = "4.1.1"
|
||||||
spotless = "6.12.1"
|
spotless = "6.13.0"
|
||||||
nexus = "1.1.0"
|
nexus = "1.1.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
Loading…
Reference in New Issue
Block a user