Compare commits

..

8 Commits

Author SHA1 Message Date
1b5dab3ddd Merge branch 'v6' into refactor/v6/update-mm 2021-12-23 11:09:43 +01:00
6198d98488 refactor: Restore API in favor of deprecation 2021-12-23 11:04:04 +01:00
5325f90f7b Update captions 2021-12-18 00:49:16 +01:00
b07bd6f39c Merge branch 'v6' into refactor/v6/update-mm 2021-12-18 00:48:39 +01:00
b7d5fd4eaf Fix more MM builder issues (#3373)
* fix unpair of signed IDs

* Fix MM builder issues + invalid translation

* Remove disrupting line breaks for help page and inbox list

* Fix loop of mm parsing in /plot f set

* de-clutter help page
2021-12-18 00:44:32 +01:00
0886f9ccd3 style: Javadoc fixup 2021-12-15 11:33:14 +01:00
51abe5565c style: Address style issues from previous commit 2021-12-15 01:29:44 +01:00
fda01502b2 refactor!: Update minimessage implementation 2021-12-15 01:20:26 +01:00
573 changed files with 3977 additions and 4212 deletions

View File

@ -11,7 +11,7 @@ jobs:
- name: Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1.0.4
- name: Setup Java
uses: actions/setup-java@v2.5.0
uses: actions/setup-java@v2.4.0
with:
distribution: temurin
java-version: 17

View File

@ -1,20 +0,0 @@
name: Rebase Pull Request
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'MEMBER'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2.4.0
with:
token: ${{ secrets.REBASE_TOKEN }}
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.5
env:
GITHUB_TOKEN: ${{ secrets.REBASE_TOKEN }}

View File

@ -4,15 +4,11 @@ on:
push:
branches:
- v6
pull_request:
types: [ opened, reopened, synchronize ]
pull_request_target:
types: [ opened, reopened, synchronize ]
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5.17.6
- uses: release-drafter/release-drafter@v5.15.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,4 +0,0 @@
jdkVersion = "17"
build = "gradle clean build -x test"
tools = ["findsecbugs", "ErrorProne", "Semgrep", "Detekt", "Infer"]
ignoreRules = ["CatchAndPrintStackTrace", "ReferenceEquality", "FallThrough", "FutureReturnValueIgnored", "MixedMutabilityReturnType", "EmptyCatch", "MissingCasesInEnumSwitch", "OperatorPrecedence", "StaticAssignmentInConstructor", "ReferenceEquality", "EqualsHashCode", "EqualsGetClass", "TypeParameterUnusedInFormals", "StringSplitter", "InlineMeSuggester", "NULL_DEREFERENCE"]

View File

@ -40,6 +40,7 @@ dependencies {
compileOnly(libs.placeholderapi)
compileOnly(libs.luckperms)
compileOnly(libs.essentialsx)
compileOnly(libs.hyperverse) { isTransitive = false }
compileOnly(libs.mvdwapi) { isTransitive = false }
// Other libraries
@ -74,8 +75,7 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
relocate("com.google.inject", "com.plotsquared.google")
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
relocate("cloud.commandframework.services", "com.plotsquared.core.services")
relocate("io.leangen.geantyref", "com.plotsquared.core.geantyref")
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
@ -83,7 +83,6 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.jetbrains", "com.plotsquared.core.annotations")
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
relocate("javax.annotation", "com.plotsquared.core.annotation")
relocate("com.google.code.findbugs", "com.plotsquared.core.findbugs")
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
// Get rid of all the libs which are 100% unused.
@ -101,5 +100,6 @@ tasks {
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/")
opt.links("https://notmyfault.github.io/MiniMessage-Javadocs/") // Temporary hosting until Kyori adds hosted Javadocs
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -147,8 +147,6 @@ import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -218,7 +216,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
private PlatformWorldManager<World> worldManager;
private Locale serverLocale;
@SuppressWarnings("StringSplitter")
@Override
public int @NonNull [] serverVersion() {
if (this.version == null) {
@ -269,7 +266,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
faweHook = true;
} catch (Exception ignored) {
LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
".net/job/FastAsyncWorldEdit/");
".net/job/FastAsyncWorldEdit-1.17/");
}
}
}
@ -324,6 +321,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Comments
CommentManager.registerDefaultInboxes();
plotSquared.startExpiryTasks();
// Do stuff that was previously done in PlotSquared
// Kill entities
if (Settings.Enabled_Components.KILL_ROAD_MOBS || Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
@ -420,8 +419,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}, TaskTime.ticks(1L));
}
plotSquared.startExpiryTasks();
// Once the server has loaded force updating all generators known to P2
TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L));
@ -971,6 +968,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
iterator.remove();
entity.remove();
continue;
}
}
} else {
@ -982,6 +980,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
iterator.remove();
entity.remove();
continue;
}
}
}
@ -1142,10 +1141,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override
public @NonNull String pluginsFormatted() {
StringBuilder msg = new StringBuilder();
List<Plugin> plugins = new ArrayList<>();
Collections.addAll(plugins, Bukkit.getServer().getPluginManager().getPlugins());
plugins.sort(Comparator.comparing(Plugin::getName));
msg.append("Plugins (").append(plugins.size()).append("): \n");
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
msg.append("Plugins (").append(plugins.length).append("): \n");
for (Plugin p : plugins) {
msg.append(" - ").append(p.getName()).append(":").append("\n")
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
@ -1159,21 +1156,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return msg.toString();
}
@Override
@SuppressWarnings("ConstantConditions")
public @NonNull String worldEditImplementations() {
StringBuilder msg = new StringBuilder();
if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null) {
msg.append("FastAsyncWorldEdit: ").append(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit").getDescription().getVersion());
} else if (Bukkit.getPluginManager().getPlugin("AsyncWorldEdit") != null) {
msg.append("AsyncWorldEdit: ").append(Bukkit.getPluginManager().getPlugin("AsyncWorldEdit").getDescription().getVersion()).append("\n");
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
} else {
msg.append("WorldEdit: ").append(Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
}
return msg.toString();
}
@Override
public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) {
return BukkitWorld.of(worldName);
@ -1222,7 +1204,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override
@NonNull
@SuppressWarnings("unchecked")
@SuppressWarnings("ALL")
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -461,7 +461,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.tamed.tamed = tamed.isTamed();
}
@SuppressWarnings("deprecation") // Paper deprecation
@Override
public Entity spawn(World world, int xOffset, int zOffset) {
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -29,6 +29,7 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.plotsquared.bukkit.managers.BukkitWorldManager;
import com.plotsquared.bukkit.managers.HyperverseWorldManager;
import com.plotsquared.bukkit.managers.MultiverseWorldManager;
import com.plotsquared.core.util.PlatformWorldManager;
import org.bukkit.Bukkit;
@ -36,11 +37,12 @@ import org.bukkit.World;
public class WorldManagerModule extends AbstractModule {
@SuppressWarnings("removal") // Internal use only
@Provides
@Singleton
PlatformWorldManager<World> provideWorldManager() {
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
if (Bukkit.getPluginManager().getPlugin("Hyperverse") != null) {
return new HyperverseWorldManager();
} else if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
return new MultiverseWorldManager();
} else {
return new BukkitWorldManager();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,7 +68,7 @@ import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -166,7 +166,7 @@ public class BlockEventListener implements Listener {
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false;
if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (!plot.getOwner().equals(DBFunc.SERVER)) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
@ -282,16 +282,16 @@ public class BlockEventListener implements Listener {
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
pp.sendMessage(
TranslatableCaption.of("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
TranslatableCaption.miniMessage("height.height_limit"),
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
);
}
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
return;
@ -307,8 +307,8 @@ public class BlockEventListener implements Listener {
}
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
plot.debug(player.getName() + " could not place " + event.getBlock().getType()
@ -318,7 +318,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
event.setCancelled(true);
return;
@ -334,8 +334,8 @@ public class BlockEventListener implements Listener {
}
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
@ -356,8 +356,8 @@ public class BlockEventListener implements Listener {
if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
);
event.setCancelled(true);
return;
@ -367,9 +367,9 @@ public class BlockEventListener implements Listener {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
plotPlayer.sendMessage(
TranslatableCaption.of("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
TranslatableCaption.miniMessage("height.height_limit"),
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
);
}
if (!plot.hasOwner()) {
@ -393,14 +393,14 @@ public class BlockEventListener implements Listener {
return;
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
event.setCancelled(true);
return;
@ -419,8 +419,8 @@ public class BlockEventListener implements Listener {
}
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
);
event.setCancelled(true);
}
@ -1094,24 +1094,24 @@ public class BlockEventListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
}
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -108,11 +108,41 @@ public class ChunkListener implements Listener {
this.isTrueForNotSave = false;
} else {
this.mustSave = classChunk.getField("mustNotSave");
/*
this.worldServer = classCraftWorld.getField("world");
this.methodGetChunkProvider = getRefClass("{nms}.WorldServer").getMethod("getChunkProvider");
this.playerChunkMap = getRefClass("{nms}.ChunkProviderServer").getField("playerChunkMap");
RefClass classPlayerChunkMap = getRefClass("{nms}.PlayerChunkMap");
if (PaperLib.isPaper() && version == 16) {
this.updatingChunks = classPlayerChunkMap.getField("updatingChunks");
this.methodGetVisibleMap = getRefClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object").getMethod(
"getVisibleMap");
} else {
this.visibleChunks = classPlayerChunkMap.getField("visibleChunks");
}
this.methodGetFullChunk = getRefClass("{nms}.PlayerChunk").getMethod("getFullChunk");
this.methodGetBukkitChunk = getRefClass("{nms}.Chunk").getMethod("getBukkitChunk");
*/
}
} else {
} else if (version == 17) {
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
this.mustSave = classChunk.getField("mustNotSave");
/*
this.worldServer = classCraftWorld.getField("world");
this.methodGetChunkProvider = getRefClass("net.minecraft.server.level.WorldServer").getMethod(
"getChunkProvider");
this.playerChunkMap = getRefClass("net.minecraft.server.level.ChunkProviderServer").getField("a");
RefClass classPlayerChunkMap = getRefClass("net.minecraft.server.level.PlayerChunkMap");
if (PaperLib.isPaper()) {
this.updatingChunks = classPlayerChunkMap.getField("updatingChunks");
this.methodGetVisibleMap = getRefClass("com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object").getMethod(
"getVisibleMap");
} else {
this.visibleChunks = classPlayerChunkMap.getField("l");
}
this.methodGetFullChunk = getRefClass("net.minecraft.server.level.PlayerChunk").getMethod("getFullChunk");
this.methodGetBukkitChunk = getRefClass("net.minecraft.world.level.chunk.Chunk").getMethod("getBukkitChunk");
*/
}
} catch (NoSuchFieldException e) {
e.printStackTrace();
@ -152,7 +182,32 @@ public class ChunkListener implements Listener {
}
toUnload.add(chunk);
}
}
}/* else {
Object worldServer = this.worldServer.of(craftWorld).get();
Object chunkProviderServer = methodGetChunkProvider.of(worldServer).call();
Object playerChunkMap = this.playerChunkMap.of(chunkProviderServer).get();
Long2ObjectLinkedOpenHashMap<?> chunks;
if (PaperLib.isPaper() && version > 15) {
Object updatingChunks = this.updatingChunks.of(playerChunkMap).get();
chunks = (Long2ObjectLinkedOpenHashMap<?>) this.methodGetVisibleMap.of(updatingChunks).call();
} else {
chunks = (Long2ObjectLinkedOpenHashMap<?>) this.visibleChunks.of(playerChunkMap).get();
}
for (Object playerChunk : chunks.values()) {
Object nmsChunk = this.methodGetFullChunk.of(playerChunk).call();
if (nmsChunk == null) {
continue;
}
Chunk chunk = (Chunk) this.methodGetBukkitChunk.of(nmsChunk).call();
int x = chunk.getX();
int z = chunk.getZ();
if (!shouldSave(worldName, x, z)) {
unloadChunk(worldName, chunk, false);
continue;
}
toUnload.add(chunk);
}
}*/
}
if (toUnload.isEmpty()) {
return;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -48,7 +48,6 @@ import com.plotsquared.core.util.Permissions;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Ageable;
@ -324,10 +323,6 @@ public class EntityEventListener implements Listener {
}
}
event.setCancelled(true);
//Spawn Explosion Particles when enabled in settings
if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) {
event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0);
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -60,7 +60,7 @@ import java.util.List;
public class EntitySpawnListener implements Listener {
private static final String KEY = "P2";
private final static String KEY = "P2";
private static boolean ignoreTP = false;
private static boolean hasPlotArea = false;
private static String areaName = null;
@ -75,7 +75,8 @@ public class EntitySpawnListener implements Listener {
public static void testCreate(final Entity entity) {
@NonNull World world = entity.getWorld();
if (!world.getName().equals(areaName)) {
if (areaName.equals(world.getName())) {
} else {
areaName = world.getName();
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -46,7 +46,7 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Chunk;
import org.bukkit.block.Block;
import org.bukkit.block.TileState;
@ -302,8 +302,8 @@ public class PaperListener implements Listener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
);
event.setCancelled(true);
event.setBuild(false);
@ -336,8 +336,8 @@ public class PaperListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
);
entity.remove();
event.setCancelled(true);
@ -345,8 +345,8 @@ public class PaperListener implements Listener {
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
);
entity.remove();
event.setCancelled(true);
@ -354,8 +354,8 @@ public class PaperListener implements Listener {
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
entity.remove();
event.setCancelled(true);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,9 +33,10 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.block.Banner;
import org.bukkit.block.Beacon;
import org.bukkit.block.Bed;
import org.bukkit.block.BlockState;
import org.bukkit.block.CommandBlock;
import org.bukkit.block.Comparator;
@ -50,7 +51,6 @@ import org.bukkit.block.Jukebox;
import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
import org.bukkit.block.Structure;
import org.bukkit.block.data.type.Bed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -83,8 +83,8 @@ public class PaperListener113 extends PaperListener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
);
event.setCancelled(true);
event.setBuild(false);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,9 +68,11 @@ import com.plotsquared.core.plot.flag.implementations.PlayerInteractFlag;
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag;
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
import com.plotsquared.core.plot.flag.implementations.UseFlag;
import com.plotsquared.core.plot.flag.implementations.VehicleBreakFlag;
import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan;
@ -85,14 +87,13 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType;
import io.papermc.lib.PaperLib;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.ArmorStand;
@ -223,7 +224,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
}
@SuppressWarnings("StringSplitter")
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void playerCommand(PlayerCommandPreprocessEvent event) {
String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim();
@ -308,7 +308,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
perm = "plots.admin.command.blocked-cmds.road";
}
if (!Permissions.hasPermission(plotPlayer, perm)) {
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
plotPlayer.sendMessage(TranslatableCaption.miniMessage("blockedcmds.command_blocked"));
event.setCancelled(true);
}
return;
@ -361,11 +361,11 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString()) && Settings.Enabled_Components.UPDATE_NOTIFICATIONS
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
Caption boundary = TranslatableCaption.of("update.update_boundary");
Caption updateNotification = TranslatableCaption.of("update.update_notification");
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
Caption boundary = TranslatableCaption.miniMessage("update.update_boundary");
Caption updateNotification = TranslatableCaption.miniMessage("update.update_notification");
Placeholder<?> internalVersion = Placeholder.miniMessage("p2version", UpdateUtility.internalVersion.versionString());
Placeholder<?> spigotVersion = Placeholder.miniMessage("spigotversion", UpdateUtility.spigotVersion);
Placeholder<?> downloadUrl = Placeholder.miniMessage("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
pp.sendMessage(boundary);
pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
pp.sendMessage(boundary);
@ -379,7 +379,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.eventDispatcher.doRespawnTask(pp);
}
@SuppressWarnings("deprecation") // We explicitly want #getHomeSynchronous here
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
@ -418,8 +417,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
.getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage(
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", plot.toString())
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
);
event.setCancelled(true);
}
@ -507,7 +506,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
}
// Set last location
Location location = BukkitUtil.adapt(to);
@ -534,8 +533,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -552,8 +551,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage(
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", now.toString())
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
);
this.tmpTeleport = false;
to.setX(from.getBlockX());
@ -571,9 +570,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else if (MathMan.roundInt(from.getX()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
}
} else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -581,13 +580,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else if (MathMan.roundInt(from.getX()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
}
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
}
}
}
@ -597,7 +596,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
}
// Set last location
Location location = BukkitUtil.adapt(to);
@ -613,19 +612,19 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
return;
}
Plot plot = area.getPlot(location);
Plot now = area.getPlot(location);
Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null);
}
if (plot == null) {
if (now == null) {
try (final MetaDataAccess<Boolean> kickAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
);
this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -638,12 +637,12 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
}
} else if (plot.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, plot);
} else if (!plotEntry(pp, plot) && this.tmpTeleport) {
} else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage(
TranslatableCaption.of("deny.no_enter"),
Template.of("plot", plot.toString())
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
);
this.tmpTeleport = false;
player.teleport(from);
@ -662,9 +661,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else if (MathMan.roundInt(from.getZ()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
}
} else if (z2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -672,13 +671,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false;
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else if (MathMan.roundInt(from.getZ()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
}
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
}
}
}
@ -727,45 +726,45 @@ public class PlayerEventListener extends PlotListener implements Listener {
String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId();
String worldName = plot.getWorldName();
Caption msg = TranslatableCaption.of("chat.plot_chat_format");
Template msgTemplate;
Template worldNameTemplate = Template.of("world", worldName);
Template plotTemplate = Template.of("plot_id", id.toString());
Template senderTemplate = Template.of("sender", sender);
Caption msg = TranslatableCaption.miniMessage("chat.plot_chat_format");
Placeholder<?> msgTemplate;
Placeholder<?> worldNameTemplate = Placeholder.miniMessage("world", worldName);
Placeholder<?> plotTemplate = Placeholder.miniMessage("plot_id", id.toString());
Placeholder<?> senderTemplate = Placeholder.miniMessage("sender", sender);
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
// allowing colour.
if (plotPlayer.hasPermission("plots.chat.color")) {
msgTemplate = Template
.of(
msgTemplate = Placeholder
.miniMessage(
"msg",
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
'&',
message
))
)).toString()
);
} else {
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
msgTemplate = Placeholder.miniMessage("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))).toString());
}
for (PlotPlayer<?> receiver : plotRecipients) {
receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
}
if (!spies.isEmpty()) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message));
Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
for (PlotPlayer<?> player : spies) {
player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
}
}
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message));
Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
spymessageTemplate
);
@ -920,16 +919,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
cancelled = true;
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
cancelled = true;
}
@ -938,8 +937,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
cancelled = true;
}
@ -976,8 +975,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
e.setCancelled(true);
}
@ -985,7 +984,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
e.setCancelled(true);
return;
@ -994,8 +993,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
e.setCancelled(true);
}
@ -1009,8 +1008,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
e.setCancelled(true);
plot.debug(pp.getName() + " could not interact with " + entity.getType()
@ -1064,13 +1063,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (area == null) {
return;
}
PlayerBlockEventType eventType;
PlayerBlockEventType eventType = null;
BlockType blocktype1;
Block block = event.getClickedBlock();
if (block == null) {
// We do not care in this case, the player is likely interacting with air ("nothing").
return;
}
Location location = BukkitUtil.adapt(block.getLocation());
Action action = event.getAction();
switch (action) {
@ -1229,8 +1224,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
@ -1238,8 +1233,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) {
@ -1247,14 +1242,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
event.setCancelled(true);
}
@ -1294,8 +1289,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
@ -1303,8 +1298,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) {
@ -1312,14 +1307,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return;
}
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
event.setCancelled(true);
}
@ -1344,8 +1339,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
);
event.setCancelled(true);
}
@ -1353,8 +1348,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
);
event.setCancelled(true);
}
@ -1364,8 +1359,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.getFlag(HangingPlaceFlag.class)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
);
event.setCancelled(true);
}
@ -1393,16 +1388,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
);
event.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
);
event.setCancelled(true);
}
@ -1412,8 +1407,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
plot.debug(p.getName()
@ -1434,8 +1429,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
);
event.setCancelled(true);
}
@ -1444,8 +1439,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
);
event.setCancelled(true);
plot.debug(player.getName()
@ -1476,16 +1471,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null && !area.isRoadFlags()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
);
event.setCancelled(true);
}
} else if (plot != null && !plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
);
event.setCancelled(true);
}
@ -1542,8 +1537,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
);
event.setCancelled(true);
}
@ -1564,8 +1559,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
);
event.setCancelled(true);
}
@ -1573,8 +1568,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
);
event.setCancelled(true);
return;
@ -1587,8 +1582,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
);
event.setCancelled(true);
plot.debug(pp.getName()
@ -1672,7 +1667,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
}
}
@SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility
@EventHandler
public void onLocaleChange(final PlayerLocaleChangeEvent event) {
// The event is fired before the player is deemed online upon login
@ -1708,49 +1702,22 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler
public void onPortalCreation(PortalCreateEvent event) {
String world = event.getWorld().getName();
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
Location location = BukkitUtil.adapt(event.getEntity().getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
int minX = Integer.MAX_VALUE;
int maxX = Integer.MIN_VALUE;
int minZ = Integer.MAX_VALUE;
int maxZ = Integer.MIN_VALUE;
for (BlockState state : event.getBlocks()) {
minX = Math.min(state.getX(), minX);
maxX = Math.max(state.getX(), maxX);
minZ = Math.min(state.getZ(), minZ);
maxZ = Math.max(state.getZ(), maxZ);
}
int y = event.getBlocks().get(0).getY(); // Don't need to worry about this too much
for (Location location : Set.of( // Use Set to lazily avoid duplicate locations
Location.at(world, minX, y, maxX),
Location.at(world, minZ, y, maxZ),
Location.at(world, minX, y, maxZ),
Location.at(world, minZ, y, maxX)
)) {
PlotArea area = location.getPlotArea();
if (area == null) {
continue;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true);
return;
}
continue;
}
if (plot.getFlag(DenyPortalsFlag.class)) {
StringBuilder builder = new StringBuilder();
if (event.getEntity() != null) {
builder.append(event.getEntity().getName()).append(" did not create a portal");
} else {
builder.append("Portal creation cancelled");
}
plot.debug(builder.append(" because of deny-portals = true").toString());
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true);
}
return;
}
if (plot.getFlag(DenyPortalsFlag.class)) {
if (plot.getFlag(DenyPortalsFlag.class)) {
plot.debug(event.getEntity().getName() + " did not create a portal because of deny-portals = true");
event.setCancelled(true);
return;
}
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotHandler;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -112,8 +112,8 @@ public class ProjectileEventListener implements Listener {
if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
);
entity.remove();
event.setCancelled(true);
@ -121,8 +121,8 @@ public class ProjectileEventListener implements Listener {
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
);
entity.remove();
event.setCancelled(true);
@ -130,8 +130,8 @@ public class ProjectileEventListener implements Listener {
} else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
);
entity.remove();
event.setCancelled(true);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -50,7 +50,7 @@ public class ServerListener implements Listener {
public void onServerLoad(ServerLoadEvent event) {
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.miniMessage("placeholder.hooked"));
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,6 +43,7 @@ import java.lang.reflect.Method;
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused")
public class SingleWorldListener implements Listener {
private final Method methodGetHandleChunk;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,7 +25,6 @@
*/
package com.plotsquared.bukkit.managers;
/*
import com.google.inject.Singleton;
import org.bukkit.World;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -36,9 +35,10 @@ import se.hyperver.hyperverse.world.WorldConfigurationBuilder;
import se.hyperver.hyperverse.world.WorldFeatures;
import se.hyperver.hyperverse.world.WorldType;
Hyperverse implementation is currently put on ice until Hyperverse is released on a stable line and deployed to the central
repository.
/**
* Hyperverse specific manager that creates worlds
* using Hyperverse's API
*/
@Singleton
public class HyperverseWorldManager extends BukkitWorldManager {
@ -67,4 +67,3 @@ public class HyperverseWorldManager extends BukkitWorldManager {
}
}
*/

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,9 +36,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* world creation by executing a console command
*
* @deprecated Deprecated and scheduled for removal without replacement
* in favor of the build in setup wizard.
* in favor of the build in setup wizard.
*/
@Deprecated(forRemoval = true, since = "6.0.0")
@Deprecated(forRemoval = true)
@Singleton
public class MultiverseWorldManager extends BukkitWorldManager {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -162,7 +162,6 @@ public class BukkitPlayer extends PlotPlayer<Player> {
}
}
@SuppressWarnings("StringSplitter")
@Override
@NonNegative
public int hasPermissionRange(
@ -320,7 +319,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
if (id == ItemTypes.AIR) {
// Let's just stop all the discs because why not?
for (final Sound sound : Arrays.stream(Sound.values())
.filter(sound -> sound.name().contains("DISC")).toList()) {
.filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) {
player.stopSound(sound);
}
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
@ -332,7 +331,6 @@ public class BukkitPlayer extends PlotPlayer<Player> {
}
}
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
@Override
public void kick(final String message) {
this.player.kickPlayer(message);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -51,6 +51,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.block.Block;
import org.bukkit.block.Container;
import org.bukkit.block.data.BlockData;
@ -198,7 +199,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
}
}
if (localChunk.getTiles().size() > 0) {
localChunk.getTiles().forEach((blockVector3, tag) -> {
localChunk.getTiles().forEach(((blockVector3, tag) -> {
try {
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
getWorld().setBlock(blockVector3, block, noSideEffectSet);
@ -206,7 +207,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
}
});
}));
}
if (localChunk.getEntities().size() > 0) {
localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity));
@ -237,7 +238,6 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
/**
* Set a block to the world. First tries WNA but defaults to normal block setting methods if that fails
*/
@SuppressWarnings("unused")
private void setWorldBlock(int x, int y, int z, @NonNull BaseBlock block, @NonNull BlockVector2 blockVector2, boolean edge) {
try {
BlockVector3 loc = BlockVector3.at(x, y, z);
@ -266,7 +266,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
} catch (WorldEditException ignored) {
// Fallback to not so nice method
BlockData blockData = BukkitAdapter.adapt(block);
Block existing = getBukkitWorld().getBlockAt(x, y, z);
Chunk chunk = getBukkitWorld().getChunkAt(blockVector2.getX(), blockVector2.getZ());
Block existing = chunk.getBlock(x, y, z);
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
return;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -166,7 +166,6 @@ public class StateWrapper {
return str;
}
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
public boolean restoreTag(String worldName, int x, int y, int z) {
if (this.tag == null) {
return false;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -50,7 +50,7 @@ import com.plotsquared.core.util.EntityUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.entity.EntityCategories;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
@ -178,7 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted")
TranslatableCaption.miniMessage("done.building_restricted")
);
return false;
}
@ -187,8 +187,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
return false;
}
@ -199,8 +199,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
if (plot != null) {
plot.debug(player.getName()
@ -220,8 +220,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -241,8 +241,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -255,8 +255,8 @@ public class BukkitEntityUtil {
if (!plot.getFlag(PvpFlag.class) && !Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
plot.debug(player.getName() + " could not attack " + entityType
+ " because pve = false");
@ -269,8 +269,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
return false;
}
@ -286,8 +286,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -308,8 +308,8 @@ public class BukkitEntityUtil {
}
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
TranslatableCaption.miniMessage("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -77,7 +77,6 @@ public class BukkitInventoryUtil extends InventoryUtil {
return stack;
}
@SuppressWarnings("deprecation") // Paper deprecation
@Override
public void open(PlotInventory inv) {
BukkitPlayer bp = (BukkitPlayer) inv.getPlayer();
@ -114,7 +113,6 @@ public class BukkitInventoryUtil extends InventoryUtil {
bp.player.updateInventory();
}
@SuppressWarnings("deprecation") // Paper deprecation
public PlotItemStack getItem(ItemStack item) {
if (item == null) {
return null;
@ -147,7 +145,6 @@ public class BukkitInventoryUtil extends InventoryUtil {
.toArray(PlotItemStack[]::new);
}
@SuppressWarnings("deprecation") // #getTitle is needed for Spigot compatibility
@Override
public boolean isOpen(PlotInventory plotInventory) {
if (!plotInventory.isOpen()) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -53,7 +53,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -337,7 +338,7 @@ public class BukkitUtil extends WorldUtil {
@SuppressWarnings("deprecation")
public void setSign(
final @NonNull Location location, final @NonNull Caption[] lines,
final @NonNull Template... replacements
final @NonNull Placeholder<?>... replacements
) {
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
PlotArea area = location.getPlotArea();
@ -369,7 +370,8 @@ public class BukkitUtil extends WorldUtil {
if (blockstate instanceof final Sign sign) {
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
.serialize(MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()),
PlaceholderResolver.placeholders(replacements))));
}
sign.update(true);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,7 +61,6 @@ public class UpdateUtility implements Listener {
internalVersion = PlotSquared.get().getVersion();
}
@SuppressWarnings({"deprecation", "DefaultCharset"}) // Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet
public void updateChecker() {
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
try {
@ -69,7 +68,7 @@ public class UpdateUtility implements Listener {
"https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506")
.openConnection();
connection.setRequestMethod("GET");
JsonObject result = new JsonParser()
JsonObject result = (new JsonParser())
.parse(new JsonReader(new InputStreamReader(connection.getInputStream())))
.getAsJsonObject();
spigotVersion = result.get("current_version").getAsString();
@ -92,7 +91,7 @@ public class UpdateUtility implements Listener {
notify = false;
LOGGER.info("Congratulations! You are running the latest PlotSquared version");
}
}, 0L, (long) Settings.UpdateChecker.POLL_RATE * 60 * 20);
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
}
private void cancelTask() {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -75,7 +75,6 @@ public class FaweSchematicHandler extends SchematicHandler {
return delegate.save(tag, path);
}
@SuppressWarnings("removal") // Just the override
@Override
public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
delegate.upload(tag, uuid, file, whenDone);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -4,16 +4,16 @@ api-version: "1.13"
version: "${version}"
load: STARTUP
description: "Easy, yet powerful Plot World generation and management."
authors: [Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault, SirYwell]
authors: [ Citymonstret, Empire92, MattBDev, dordsor21, NotMyFault, SirYwell ]
website: https://www.spigotmc.org/resources/77506/
softdepend: [Vault, PlaceholderAPI, Essentials, LuckPerms, BungeePerms, MVdWPlaceholderAPI]
loadbefore: [MultiWorld, Multiverse-Core]
depend: [WorldEdit]
softdepend: [ Vault, PlaceholderAPI, Essentials, LuckPerms, BungeePerms, MVdWPlaceholderAPI ]
loadbefore: [ MultiWorld, Multiverse-Core ]
depend: [ WorldEdit ]
database: false
commands:
plots:
description: Plot command.
aliases: [p,plot,ps,plotsquared,p2,2,plotme]
aliases: [ p,plot,ps,plotsquared,p2,2,plotme ]
permission: plots.use
permission-message: "You are lacking the permission node 'plots.use'"
permissions:

View File

@ -22,7 +22,7 @@ dependencies {
api(libs.guiceassistedinject) {
exclude("com.google.inject", "guice")
}
api(libs.findbugs)
compileOnlyApi(libs.findbugs)
// Plugins
compileOnly(libs.worldeditCore) {
@ -40,7 +40,9 @@ dependencies {
// Other libraries
api(libs.prtree)
api(libs.aopalliance)
api(libs.cloudServices)
api(libs.rorledning) {
exclude(group = "com.google.guava")
}
api(libs.arkitektonika)
api(libs.paster)
}
@ -48,9 +50,9 @@ dependencies {
tasks.processResources {
filesMatching("plugin.properties") {
expand(
"version" to project.version.toString(),
"commit" to rootProject.grgit.head().abbreviatedId,
"date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
"version" to project.version.toString(),
"commit" to rootProject.grgit.head().abbreviatedId,
"date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
)
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -152,9 +152,9 @@ public class PlotAPI {
*/
public void sendConsoleMessage(
final @NonNull String message,
final @NonNull Template @NonNull ... replacements
final @NonNull Placeholder<?> @NonNull ... replacements
) {
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
ConsolePlayer.getConsole().sendMessage(StaticCaption.miniMessage(message), replacements);
}
/**
@ -165,7 +165,7 @@ public class PlotAPI {
*/
public void sendConsoleMessage(
final @NonNull Caption caption,
final @NonNull Template @NonNull ... replacements
final @NonNull Placeholder<?> @NonNull ... replacements
) {
ConsolePlayer.getConsole().sendMessage(caption, replacements);
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,10 +25,10 @@
*/
package com.plotsquared.core;
import cloud.commandframework.services.ServicePipeline;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import com.intellectualsites.services.ServicePipeline;
import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.generator.GeneratorWrapper;
@ -40,7 +40,6 @@ import com.plotsquared.core.permissions.PermissionHandler;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.AnnotationHelper;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.PlatformWorldManager;
@ -274,7 +273,6 @@ public interface PlotPlatform<P> extends LocaleHolder {
* Get the {@link PlotAreaManager} implementation.
*
* @return the PlotAreaManager
* @since 6.1.4
*/
@NonNull PlotAreaManager plotAreaManager();
@ -293,15 +291,6 @@ public interface PlotPlatform<P> extends LocaleHolder {
*/
@NonNull String pluginsFormatted();
/**
* Get the kind of WorldEdit implementation
*
* @return worldedit implementations
* @since 6.3.0
*/
@AnnotationHelper.ApiDescription(info = "Internal use only")
@NonNull String worldEditImplementations();
/**
* Load the caption maps
*/

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -306,7 +306,7 @@ public class PlotSquared {
*
* @param version First version
* @param version2 Second version
* @return {@code true} if `version` is &gt;= `version2`
* @return true if `version` is &gt;= `version2`
*/
public boolean checkVersion(
final int[] version,
@ -338,13 +338,10 @@ public class PlotSquared {
/**
* Add a global reference to a plot world.
* <p>
* You can remove the reference by calling {@link #removePlotArea(PlotArea)}
* </p>
*
* @param plotArea the {@link PlotArea} to add.
* @see #removePlotArea(PlotArea) To remove the reference
*/
@SuppressWarnings("unchecked")
public void addPlotArea(final @NonNull PlotArea plotArea) {
HashMap<PlotId, Plot> plots;
if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) {
@ -559,7 +556,6 @@ public class PlotSquared {
*
* @param input an array of plots to sort
*/
@SuppressWarnings("unchecked")
private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) {
List<Plot>[] bucket = new ArrayList[32];
Arrays.fill(bucket, new ArrayList<>());
@ -700,12 +696,20 @@ public class PlotSquared {
ArrayList<Plot> toReturn = new ArrayList<>(plots.size());
for (PlotArea area : areas) {
switch (type) {
case CREATION_DATE -> toReturn.addAll(sortPlotsByTemp(map.get(area)));
case CREATION_DATE_TIMESTAMP -> toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
case DISTANCE_FROM_ORIGIN -> toReturn.addAll(sortPlotsByHash(map.get(area)));
case LAST_MODIFIED -> toReturn.addAll(sortPlotsByModified(map.get(area)));
default -> {
}
case CREATION_DATE:
toReturn.addAll(sortPlotsByTemp(map.get(area)));
break;
case CREATION_DATE_TIMESTAMP:
toReturn.addAll(sortPlotsByTimestamp(map.get(area)));
break;
case DISTANCE_FROM_ORIGIN:
toReturn.addAll(sortPlotsByHash(map.get(area)));
break;
case LAST_MODIFIED:
toReturn.addAll(sortPlotsByModified(map.get(area)));
break;
default:
break;
}
}
return toReturn;
@ -735,7 +739,7 @@ public class PlotSquared {
*
* @param plot the plot to remove
* @param callEvent If to call an event about the plot being removed
* @return {@code true} if plot existed | {@code false} if it didn't
* @return true if plot existed | false if it didn't
*/
public boolean removePlot(
final @NonNull Plot plot,
@ -1478,7 +1482,7 @@ public class PlotSquared {
*
* @param world World name
* @param chunkCoordinates Chunk coordinates
* @return {@code true} if the chunk uses non-standard generation, {@code false} if not
* @return True if the chunk uses non-standard generation, false if not
*/
public boolean isNonStandardGeneration(
final @NonNull String world,
@ -1523,12 +1527,10 @@ public class PlotSquared {
/**
* Get the caption map belonging to a namespace. If none exists, a dummy
* caption map will be returned.
* <p>
* You can register a caption map by calling {@link #registerCaptionMap(String, CaptionMap)}
* </p>
*
* @param namespace Namespace
* @return Map instance
* @see #registerCaptionMap(String, CaptionMap) To register a caption map
*/
public @NonNull CaptionMap getCaptionMap(final @NonNull String namespace) {
return this.captionMaps.computeIfAbsent(
@ -1538,7 +1540,7 @@ public class PlotSquared {
}
/**
* Register a caption map. The namespace needs to be equal to the namespace used for
* Register a caption map. The namespace needs be equal to the namespace used for
* the {@link TranslatableCaption}s inside the map.
*
* @param namespace Namespace

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -122,7 +122,7 @@ public final class PlotVersion {
* Compare a given version string with the one cached here.
*
* @param versionString the version to compare
* @return {@code true} if the given version is a "later" version
* @return true if the given version is a "later" version
*/
public boolean isLaterVersion(final @NonNull String versionString) {
int dash = versionString.indexOf('-');
@ -144,7 +144,7 @@ public final class PlotVersion {
* Compare a given version with the one cached here.
*
* @param verArray the version to compare
* @return {@code true} if the given version is a "later" version
* @return true if the given version is a "later" version
*/
public boolean isLaterVersion(int[] verArray) {
if (verArray[0] > version[0]) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -88,7 +88,7 @@ public interface BackupManager {
* Returns true if (potentially) destructive actions should cause
* PlotSquared to create automatic plot backups
*
* @return {@code true} if automatic backups are enabled
* @return True if automatic backups are enabled
*/
boolean shouldAutomaticallyBackup();

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -209,7 +209,7 @@ public class PlayerBackupProfile implements BackupProfile {
} else {
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
TranslatableCaption
.of("schematics.schematic_paste_failed")
.miniMessage("schematics.schematic_paste_failed")
.getComponent(ConsolePlayer.getConsole()))));
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,13 +31,12 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -106,22 +105,22 @@ public class SimpleBackupManager implements BackupManager {
} else {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_started"),
Template.of("plot", plot.getId().toString())
TranslatableCaption.miniMessage("backups.backup_automatic_started"),
Placeholders.miniMessage("plot", plot.getId().toString())
);
}
profile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_failure"),
Templates.of("reason", throwable.getMessage())
TranslatableCaption.miniMessage("backups.backup_automatic_failure"),
Placeholders.miniMessage("reason", throwable.getMessage())
);
}
throwable.printStackTrace();
} else {
if (player != null) {
player.sendMessage(TranslatableCaption.of("backups.backup_automatic_finished"));
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_automatic_finished"));
TaskManager.runTaskAsync(whenDone);
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -29,8 +29,7 @@ import java.util.Arrays;
public class ArrayUtil {
@SuppressWarnings("unchecked")
public static <T> T[] concatAll(T[] first, T[]... rest) {
public static final <T> T[] concatAll(T[] first, T[]... rest) {
int totalLength = first.length;
for (T[] array : rest) {
totalLength += array.length;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +35,6 @@ public class FlatRandomCollection<T> extends RandomCollection<T> {
private final T[] values;
@SuppressWarnings("unchecked")
public FlatRandomCollection(Map<T, Double> weights, Random random) {
super(weights, random);
int max = 0;

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -241,7 +241,6 @@ public class QuadMap<T> {
return false;
}
@SuppressWarnings("unchecked")
public void recalculateSkip() {
QuadMap<T> map = null;
for (QuadMap<T> current : new QuadMap[]{this.one, this.two, this.three, this.four}) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -38,7 +38,7 @@ import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
@ -69,33 +69,33 @@ public class Add extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone
) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
checkTrue(
plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
TranslatableCaption.of("permission.no_plot_perms")
TranslatableCaption.miniMessage("permission.no_plot_perms")
);
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot add <player | *>")
checkTrue(args.length == 1, TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholder.miniMessage("value", "/plot add <player | *>")
);
final CompletableFuture<Boolean> future = new CompletableFuture<>();
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable != null) {
if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else {
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
TranslatableCaption.miniMessage("errors.invalid_player"),
Placeholder.miniMessage("value", args[0])
);
}
future.completeExceptionally(throwable);
return;
} else {
try {
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
checkTrue(!uuids.isEmpty(), TranslatableCaption.miniMessage("errors.invalid_player"),
Placeholder.miniMessage("value", args[0])
);
Iterator<UUID> iterator = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size();
@ -105,24 +105,24 @@ public class Add extends Command {
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", PlayerManager.resolveName(uuid).getComponent(player))
TranslatableCaption.miniMessage("errors.invalid_player"),
Placeholder.miniMessage("value", PlayerManager.getName(uuid))
);
iterator.remove();
continue;
}
if (plot.isOwner(uuid)) {
player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
TranslatableCaption.miniMessage("member.already_added"),
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
);
iterator.remove();
continue;
}
if (plot.getMembers().contains(uuid)) {
player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.of("player", PlayerManager.resolveName(uuid).getComponent(player))
TranslatableCaption.miniMessage("member.already_added"),
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
);
iterator.remove();
continue;
@ -134,8 +134,8 @@ public class Add extends Command {
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
if (localAddSize >= maxAddSize) {
player.sendMessage(
TranslatableCaption.of("members.plot_max_members_added"),
Template.of("amount", String.valueOf(localAddSize))
TranslatableCaption.miniMessage("members.plot_max_members_added"),
Placeholder.miniMessage("amount", String.valueOf(localAddSize))
);
return;
}
@ -151,7 +151,7 @@ public class Add extends Command {
}
plot.addMember(uuid);
this.eventDispatcher.callMember(player, plot, uuid, true);
player.sendMessage(TranslatableCaption.of("member.member_added"));
player.sendMessage(TranslatableCaption.miniMessage("member.member_added"));
}
}, null);
} catch (final Throwable exception) {

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.Collection;
@ -67,12 +67,12 @@ public class Alias extends SubCommand {
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false;
}
if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
return false;
}
@ -90,7 +90,7 @@ public class Alias extends SubCommand {
permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET);
if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false;
}
if (permission) { // is either admin or owner
@ -98,8 +98,8 @@ public class Alias extends SubCommand {
return true;
} else {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
);
}
}
@ -107,15 +107,15 @@ public class Alias extends SubCommand {
permission = isPermitted(player, Permission.PERMISSION_ALIAS_REMOVE);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE);
if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false;
}
if (permission) {
result = removeAlias(player, plot);
} else {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
);
}
}
@ -147,37 +147,37 @@ public class Alias extends SubCommand {
if (alias.isEmpty()) {
sendUsage(player);
} else if (alias.length() >= 50) {
player.sendMessage(TranslatableCaption.of("alias.alias_too_long"));
player.sendMessage(TranslatableCaption.miniMessage("alias.alias_too_long"));
} else if (MathMan.isInteger(alias)) {
player.sendMessage(TranslatableCaption.of("flag.not_valid_value")); // TODO this is obviously wrong
player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_value")); // TODO this is obviously wrong
} else {
if (PlotQuery.newQuery().inArea(plot.getArea())
.withAlias(alias)
.anyMatch()) {
player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"),
Template.of("alias", alias)
TranslatableCaption.miniMessage("alias.alias_is_taken"),
Placeholder.miniMessage("alias", alias)
);
return;
}
if (Settings.UUID.OFFLINE) {
plot.setAlias(alias);
player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("alias", alias));
player.sendMessage(TranslatableCaption.miniMessage("alias.alias_set_to"), Placeholder.miniMessage("alias", alias));
return;
}
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (uuid != null) {
player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"),
Template.of("alias", alias)
TranslatableCaption.miniMessage("alias.alias_is_taken"),
Placeholder.miniMessage("alias", alias)
);
} else {
plot.setAlias(alias);
player.sendMessage(
TranslatableCaption.of("alias.alias_set_to"),
Template.of("alias", alias)
TranslatableCaption.miniMessage("alias.alias_set_to"),
Placeholder.miniMessage("alias", alias)
);
}
}));
@ -188,12 +188,12 @@ public class Alias extends SubCommand {
String alias = plot.getAlias();
if (!plot.getAlias().isEmpty()) {
player.sendMessage(
TranslatableCaption.of("alias.alias_removed"),
Template.of("alias", alias)
TranslatableCaption.miniMessage("alias.alias_removed"),
Placeholder.miniMessage("alias", alias)
);
} else {
player.sendMessage(
TranslatableCaption.of("alias.no_alias_set")
TranslatableCaption.miniMessage("alias.no_alias_set")
);
}
plot.setAlias(null);

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@ import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.events.TeleportCause;
@ -75,7 +75,8 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File;
@ -146,26 +147,26 @@ public class Area extends SubCommand {
}
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
);
return false;
}
if (args.length < 2) {
player.sendMessage(
TranslatableCaption.of("single.single_area_needs_name"),
Template.of("command", "/plot area single <name>")
TranslatableCaption.miniMessage("single.single_area_needs_name"),
Placeholder.miniMessage("command", "/plot area single <name>")
);
return false;
}
final PlotArea existingArea = this.plotAreaManager.getPlotArea(player.getLocation().getWorldName(), args[1]);
if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) {
player.sendMessage(TranslatableCaption.of("single.single_area_name_taken"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_name_taken"));
return false;
}
final LocalSession localSession = WorldEdit.getInstance().getSessionManager().getIfPresent(player.toActor());
if (localSession == null) {
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
return false;
}
Region playerSelectedRegion = null;
@ -174,18 +175,18 @@ public class Area extends SubCommand {
} catch (final Exception ignored) {
}
if (playerSelectedRegion == null) {
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
return false;
}
if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) {
player.sendMessage(TranslatableCaption.of("single.single_area_not_square"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_not_square"));
return false;
}
if (this.plotAreaManager.getPlotAreas(
Objects.requireNonNull(playerSelectedRegion.getWorld()).getName(),
CuboidRegion.makeCuboid(playerSelectedRegion)
).length != 0) {
player.sendMessage(TranslatableCaption.of("single.single_area_overlapping"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_overlapping"));
}
// Alter the region
final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint();
@ -227,7 +228,7 @@ public class Area extends SubCommand {
+ hybridPlotWorld.getId()
);
if (!parentFile.exists() && !parentFile.mkdirs()) {
player.sendMessage(TranslatableCaption.of("single.single_area_could_not_make_directories"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_could_not_make_directories"));
return false;
}
final File file = new File(parentFile, "plot.schem");
@ -245,7 +246,7 @@ public class Area extends SubCommand {
Operations.complete(forwardExtentCopy);
clipboardWriter.write(clipboard);
} catch (final Exception e) {
player.sendMessage(TranslatableCaption.of("single.single_area_failed_to_save"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_failed_to_save"));
e.printStackTrace();
return false;
}
@ -281,11 +282,11 @@ public class Area extends SubCommand {
final String world = this.setupUtils.setupWorld(singleBuilder);
if (this.worldUtil.isWorld(world)) {
PlotSquared.get().loadWorld(world, null);
player.sendMessage(TranslatableCaption.of("single.single_area_created"));
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_created"));
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.of("world", hybridPlotWorld.getWorldName())
TranslatableCaption.miniMessage("errors.error_create"),
Placeholder.miniMessage("world", hybridPlotWorld.getWorldName())
);
}
};
@ -295,16 +296,16 @@ public class Area extends SubCommand {
case "c", "setup", "create" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
);
return false;
}
switch (args.length) {
case 1:
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
);
return false;
case 2:
@ -317,8 +318,8 @@ public class Area extends SubCommand {
.get("area_create_area");
if (area == null) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -328,13 +329,13 @@ public class Area extends SubCommand {
location
);
player.sendMessage(
TranslatableCaption.of("set.set_attribute"),
Template.of("attribute", "area_pos1"),
Template.of("value", location.getX() + "," + location.getZ())
TranslatableCaption.miniMessage("set.set_attribute"),
Placeholder.miniMessage("attribute", "area_pos1"),
Placeholder.miniMessage("value", location.getX() + "," + location.getZ())
);
player.sendMessage(
TranslatableCaption.of("area.set_pos2"),
Template.of("command", "/plot area create pos2")
TranslatableCaption.miniMessage("area.set_pos2"),
Placeholder.miniMessage("command", "/plot area create pos2")
);
return true;
}
@ -347,8 +348,8 @@ public class Area extends SubCommand {
.get("area_create_area");
if (area == null) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -373,8 +374,8 @@ public class Area extends SubCommand {
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(area.getWorldName(), region);
if (!areas.isEmpty()) {
player.sendMessage(
TranslatableCaption.of("cluster.cluster_intersection"),
Template.of("cluster", areas.iterator().next().toString())
TranslatableCaption.miniMessage("cluster.cluster_intersection"),
Placeholder.miniMessage("cluster", areas.iterator().next().toString())
);
return false;
}
@ -397,7 +398,7 @@ public class Area extends SubCommand {
if (this.worldUtil.isWorld(world)) {
PlotSquared.get().loadWorld(world, null);
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
if (area.getTerrain() != PlotAreaTerrainType.ALL) {
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
@ -412,8 +413,8 @@ public class Area extends SubCommand {
}
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.of("world", area.getWorldName())
TranslatableCaption.miniMessage("errors.error_create"),
Placeholder.miniMessage("world", area.getWorldName())
);
}
};
@ -446,8 +447,8 @@ public class Area extends SubCommand {
PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id);
if (other != null && Objects.equals(pa.getId(), other.getId())) {
player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"),
Template.of("value", pa.toString())
TranslatableCaption.miniMessage("setup.setup_world_taken"),
Placeholder.miniMessage("value", pa.toString())
);
return false;
}
@ -461,9 +462,9 @@ public class Area extends SubCommand {
String[] pair = args[i].split("=");
if (pair.length != 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1,", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1,", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -498,9 +499,9 @@ public class Area extends SubCommand {
}
default -> {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -509,8 +510,8 @@ public class Area extends SubCommand {
if (pa.getType() != PlotAreaType.PARTIAL) {
if (this.worldUtil.isWorld(pa.getWorldName())) {
player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"),
Template.of("value", pa.getWorldName())
TranslatableCaption.miniMessage("setup.setup_world_taken"),
Placeholder.miniMessage("value", pa.getWorldName())
);
return false;
}
@ -527,11 +528,11 @@ public class Area extends SubCommand {
String world = this.setupUtils.setupWorld(builder);
if (this.worldUtil.isWorld(world)) {
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
} else {
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.of("world", pa.getWorldName())
TranslatableCaption.miniMessage("errors.error_create"),
Placeholder.miniMessage("world", pa.getWorldName())
);
}
try {
@ -549,13 +550,13 @@ public class Area extends SubCommand {
}
if (pa.getId() == null) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", getUsage())
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholder.miniMessage("value", getUsage())
);
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
);
return false;
}
@ -571,8 +572,8 @@ public class Area extends SubCommand {
}
metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
player.sendMessage(
TranslatableCaption.of("single.get_position"),
Template.of("command", getCommandString())
TranslatableCaption.miniMessage("single.get_position"),
Placeholder.miniMessage("command", getCommandString())
);
break;
}
@ -581,8 +582,8 @@ public class Area extends SubCommand {
case "i", "info" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
);
return false;
}
@ -592,18 +593,18 @@ public class Area extends SubCommand {
case 2 -> area = this.plotAreaManager.getPlotAreaByString(args[1]);
default -> {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()),
Template.of("value2", " info [area]")
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()),
Placeholder.miniMessage("value2", " info [area]")
);
return false;
}
}
if (area == null) {
if (args.length == 2) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
} else {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
}
return false;
}
@ -625,24 +626,24 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
region = "N/A";
}
Template headerTemplate = Template.of(
Placeholder<?> headerTemplate = Placeholder.miniMessage(
"header",
TranslatableCaption.of("info.plot_info_header").getComponent(player)
TranslatableCaption.miniMessage("info.plot_info_header").getComponent(player)
);
Template nameTemplate = Template.of("name", name);
Template typeTemplate = Template.of("type", area.getType().name());
Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region);
Template generatorTemplate = Template.of("generator", generator);
Template footerTemplate = Template.of(
Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name);
Placeholder<?> typeTemplate = Placeholder.miniMessage("type", area.getType().name());
Placeholder<?> terrainTemplate = Placeholder.miniMessage("terrain", area.getTerrain().name());
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent));
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
Placeholder<?> footerTemplate = Placeholder.miniMessage(
"footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
TranslatableCaption.miniMessage("info.plot_info_footer").getComponent(player)
);
player.sendMessage(
TranslatableCaption.of("info.area_info_format"),
TranslatableCaption.miniMessage("info.area_info_format"),
headerTemplate,
nameTemplate,
typeTemplate,
@ -659,8 +660,8 @@ public class Area extends SubCommand {
case "l", "list" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
);
return false;
}
@ -676,9 +677,9 @@ public class Area extends SubCommand {
}
default:
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()),
Template.of("value2", " list [#]")
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()),
Placeholder.miniMessage("value2", " list [#]")
);
return false;
}
@ -704,29 +705,30 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
region = "N/A";
}
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%");
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region);
Template generatorTemplate = Template.of("generator", generator);
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent) + "%");
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
.parse(
TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
claimedTemplate,
usageTemplate,
clustersTemplate,
regionTemplate,
generatorTemplate
));
Template tooltipTemplate = Template.of("hover_info", tooltip);
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
Template numberTemplate = Template.of("number", String.valueOf(i));
Template nameTemplate = Template.of("area_name", name);
Template typeTemplate = Template.of("area_type", area.getType().name());
Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name());
caption.set(TranslatableCaption.of("info.area_list_item"));
caption.setTemplates(
.deserialize(
TranslatableCaption.miniMessage("info.area_list_tooltip").getComponent(player),
PlaceholderResolver.placeholders(
claimedTemplate,
usageTemplate,
clustersTemplate,
regionTemplate,
generatorTemplate
)));
Placeholder<?> tooltipTemplate = Placeholder.miniMessage("hover_info", tooltip);
Placeholder<?> visitcmdTemplate = Placeholder.miniMessage("command_tp", "/plot area tp " + area);
Placeholder<?> infocmdTemplate = Placeholder.miniMessage("command_info", "/plot area info " + area);
Placeholder<?> numberTemplate = Placeholder.miniMessage("number", String.valueOf(i));
Placeholder<?> nameTemplate = Placeholder.miniMessage("area_name", name);
Placeholder<?> typeTemplate = Placeholder.miniMessage("area_type", area.getType().name());
Placeholder<?> terrainTemplate = Placeholder.miniMessage("area_terrain", area.getTerrain().name());
caption.set(TranslatableCaption.miniMessage("info.area_list_item"));
caption.parsePlaceholders(
tooltipTemplate,
visitcmdTemplate,
numberTemplate,
@ -736,26 +738,26 @@ public class Area extends SubCommand {
infocmdTemplate
);
}
}, "/plot area list", TranslatableCaption.of("list.area_list_header_paged"));
}, "/plot area list", TranslatableCaption.miniMessage("list.area_list_header_paged"));
return true;
}
case "regen", "clear", "reset", "regenerate" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
);
return false;
}
final PlotArea area = player.getApplicablePlotArea();
if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false;
}
if (area.getType() != PlotAreaType.PARTIAL) {
player.sendMessage(
TranslatableCaption.of("single.delete_world_region"),
Template.of("world", area.getWorldName())
TranslatableCaption.miniMessage("single.delete_world_region"),
Placeholder.miniMessage("world", area.getWorldName())
);
return false;
}
@ -768,28 +770,28 @@ public class Area extends SubCommand {
null
));
queue.addReadChunks(area.getRegion().getChunks());
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.of("single.regeneration_complete")));
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.miniMessage("single.regeneration_complete")));
queue.enqueue();
return true;
}
case "goto", "v", "teleport", "visit", "tp" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP))
TranslatableCaption.miniMessage("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_TP))
);
return false;
}
if (args.length != 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot area tp [area]")
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Placeholder.miniMessage("value", "/plot area tp [area]")
);
return false;
}
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
return false;
}
Location center;
@ -817,7 +819,7 @@ public class Area extends SubCommand {
return true;
}
case "delete", "remove" -> {
player.sendMessage(TranslatableCaption.of("single.worldcreation_location"));
player.sendMessage(TranslatableCaption.miniMessage("single.worldcreation_location"));
return true;
}
}

View File

@ -8,7 +8,7 @@
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2014 - 2022 IntellectualSites
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show More