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
583 changed files with 3720 additions and 4621 deletions

View File

@ -11,7 +11,7 @@ jobs:
- name: Validate Gradle Wrapper" - name: Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1.0.4 uses: gradle/wrapper-validation-action@v1.0.4
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v2.5.0 uses: actions/setup-java@v2.4.0
with: with:
distribution: temurin distribution: temurin
java-version: 17 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: push:
branches: branches:
- v6 - v6
pull_request:
types: [ opened, reopened, synchronize ]
pull_request_target:
types: [ opened, reopened, synchronize ]
jobs: jobs:
update_release_draft: update_release_draft:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: release-drafter/release-drafter@v5.17.5 - uses: release-drafter/release-drafter@v5.15.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -40,6 +40,7 @@ dependencies {
compileOnly(libs.placeholderapi) compileOnly(libs.placeholderapi)
compileOnly(libs.luckperms) compileOnly(libs.luckperms)
compileOnly(libs.essentialsx) compileOnly(libs.essentialsx)
compileOnly(libs.hyperverse) { isTransitive = false }
compileOnly(libs.mvdwapi) { isTransitive = false } compileOnly(libs.mvdwapi) { isTransitive = false }
// Other libraries // Other libraries
@ -74,8 +75,7 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.khelekore.prtree", "com.plotsquared.prtree") relocate("org.khelekore.prtree", "com.plotsquared.prtree")
relocate("com.google.inject", "com.plotsquared.google") relocate("com.google.inject", "com.plotsquared.google")
relocate("org.aopalliance", "com.plotsquared.core.aopalliance") relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
relocate("cloud.commandframework.services", "com.plotsquared.core.services") relocate("com.intellectualsites.services", "com.plotsquared.core.services")
relocate("io.leangen.geantyref", "com.plotsquared.core.geantyref")
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika") relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
relocate("com.intellectualsites.http", "com.plotsquared.core.http") relocate("com.intellectualsites.http", "com.plotsquared.core.http")
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster") 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.jetbrains", "com.plotsquared.core.annotations")
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations") relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
relocate("javax.annotation", "com.plotsquared.core.annotation") relocate("javax.annotation", "com.plotsquared.core.annotation")
relocate("com.google.code.findbugs", "com.plotsquared.core.findbugs")
relocate("javax.inject", "com.plotsquared.core.annotation.inject") relocate("javax.inject", "com.plotsquared.core.annotation.inject")
// Get rid of all the libs which are 100% unused. // 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://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/") 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 * 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 * 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 * 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 * 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 * 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 * 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.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -268,7 +266,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
faweHook = true; faweHook = true;
} catch (Exception ignored) { } catch (Exception ignored) {
LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" + LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
".net/job/FastAsyncWorldEdit/"); ".net/job/FastAsyncWorldEdit-1.17/");
} }
} }
} }
@ -1143,10 +1141,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override @Override
public @NonNull String pluginsFormatted() { public @NonNull String pluginsFormatted() {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
List<Plugin> plugins = new ArrayList<>(); Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
Collections.addAll(plugins, Bukkit.getServer().getPluginManager().getPlugins()); msg.append("Plugins (").append(plugins.length).append("): \n");
plugins.sort(Comparator.comparing(Plugin::getName));
msg.append("Plugins (").append(plugins.size()).append("): \n");
for (Plugin p : plugins) { for (Plugin p : plugins) {
msg.append(" - ").append(p.getName()).append(":").append("\n") msg.append(" - ").append(p.getName()).append(":").append("\n")
.append(" • Version: ").append(p.getDescription().getVersion()).append("\n") .append(" • Version: ").append(p.getDescription().getVersion()).append("\n")
@ -1160,21 +1156,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
return msg.toString(); 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 @Override
public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) { public com.plotsquared.core.location.@NonNull World<?> getPlatformWorld(final @NonNull String worldName) {
return BukkitWorld.of(worldName); return BukkitWorld.of(worldName);

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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.Provides;
import com.google.inject.Singleton; import com.google.inject.Singleton;
import com.plotsquared.bukkit.managers.BukkitWorldManager; import com.plotsquared.bukkit.managers.BukkitWorldManager;
import com.plotsquared.bukkit.managers.HyperverseWorldManager;
import com.plotsquared.bukkit.managers.MultiverseWorldManager; import com.plotsquared.bukkit.managers.MultiverseWorldManager;
import com.plotsquared.core.util.PlatformWorldManager; import com.plotsquared.core.util.PlatformWorldManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -39,7 +40,9 @@ public class WorldManagerModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
PlatformWorldManager<World> provideWorldManager() { 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(); return new MultiverseWorldManager();
} else { } else {
return new BukkitWorldManager(); return new BukkitWorldManager();

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
@ -282,16 +282,16 @@ public class BlockEventListener implements Listener {
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("height.height_limit"), TranslatableCaption.miniMessage("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())), Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight())) Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
); );
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -307,8 +307,8 @@ public class BlockEventListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(player.getName() + " could not place " + event.getBlock().getType() 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)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -334,8 +334,8 @@ public class BlockEventListener implements Listener {
} }
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { } else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -356,8 +356,8 @@ public class BlockEventListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -367,9 +367,9 @@ public class BlockEventListener implements Listener {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("height.height_limit"), TranslatableCaption.miniMessage("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())), Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight())) Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
); );
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
@ -393,14 +393,14 @@ public class BlockEventListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -419,8 +419,8 @@ public class BlockEventListener implements Listener {
} }
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1094,24 +1094,24 @@ public class BlockEventListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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; this.isTrueForNotSave = false;
} else { } else {
this.mustSave = classChunk.getField("mustNotSave"); 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 { } else {
this.visibleChunks = classPlayerChunkMap.getField("visibleChunks");
}
this.methodGetFullChunk = getRefClass("{nms}.PlayerChunk").getMethod("getFullChunk");
this.methodGetBukkitChunk = getRefClass("{nms}.Chunk").getMethod("getBukkitChunk");
*/
}
} else if (version == 17) {
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk"); RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
this.mustSave = classChunk.getField("mustNotSave"); 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) { } catch (NoSuchFieldException e) {
e.printStackTrace(); e.printStackTrace();
@ -152,7 +182,32 @@ public class ChunkListener implements Listener {
} }
toUnload.add(chunk); 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()) { if (toUnload.isEmpty()) {
return; return;

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
@ -324,10 +323,6 @@ public class EntityEventListener implements Listener {
} }
} }
event.setCancelled(true); 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) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -75,7 +75,8 @@ public class EntitySpawnListener implements Listener {
public static void testCreate(final Entity entity) { public static void testCreate(final Entity entity) {
@NonNull World world = entity.getWorld(); @NonNull World world = entity.getWorld();
if (!world.getName().equals(areaName)) { if (areaName.equals(world.getName())) {
} else {
areaName = world.getName(); areaName = world.getName();
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName); hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
@ -302,8 +302,8 @@ public class PaperListener implements Listener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) { if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer()); final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"), TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
); );
event.setCancelled(true); event.setCancelled(true);
event.setBuild(false); event.setBuild(false);
@ -336,8 +336,8 @@ public class PaperListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
@ -345,8 +345,8 @@ public class PaperListener implements Listener {
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
@ -354,8 +354,8 @@ public class PaperListener implements Listener {
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.block.Banner; import org.bukkit.block.Banner;
import org.bukkit.block.Beacon; import org.bukkit.block.Beacon;
import org.bukkit.block.Bed; import org.bukkit.block.Bed;
@ -83,8 +83,8 @@ public class PaperListener113 extends PaperListener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) { if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer()); final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"), TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
); );
event.setCancelled(true); event.setCancelled(true);
event.setBuild(false); event.setBuild(false);

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.PreventCreativeCopyFlag;
import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag; import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag;
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag; 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.VehicleBreakFlag;
import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag; import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag; 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.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
@ -85,14 +87,13 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import net.kyori.adventure.text.Component; 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.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode; import org.bukkit.FluidCollisionMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
@ -154,7 +155,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -308,7 +308,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
perm = "plots.admin.command.blocked-cmds.road"; perm = "plots.admin.command.blocked-cmds.road";
} }
if (!Permissions.hasPermission(plotPlayer, perm)) { if (!Permissions.hasPermission(plotPlayer, perm)) {
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked")); plotPlayer.sendMessage(TranslatableCaption.miniMessage("blockedcmds.command_blocked"));
event.setCancelled(true); event.setCancelled(true);
} }
return; 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 if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString()) && Settings.Enabled_Components.UPDATE_NOTIFICATIONS
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) { && PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
Caption boundary = TranslatableCaption.of("update.update_boundary"); Caption boundary = TranslatableCaption.miniMessage("update.update_boundary");
Caption updateNotification = TranslatableCaption.of("update.update_notification"); Caption updateNotification = TranslatableCaption.miniMessage("update.update_notification");
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString()); Placeholder<?> internalVersion = Placeholder.miniMessage("p2version", UpdateUtility.internalVersion.versionString());
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion); Placeholder<?> spigotVersion = Placeholder.miniMessage("spigotversion", UpdateUtility.spigotVersion);
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates"); Placeholder<?> downloadUrl = Placeholder.miniMessage("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
pp.sendMessage(boundary); pp.sendMessage(boundary);
pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl); pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
pp.sendMessage(boundary); pp.sendMessage(boundary);
@ -417,8 +417,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
.getHomeSynchronous() .getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) { .equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("deny.no_enter"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("plot", plot.toString()) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -506,7 +506,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -533,8 +533,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -551,8 +551,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("deny.no_enter"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("plot", now.toString()) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
to.setX(from.getBlockX()); to.setX(from.getBlockX());
@ -570,9 +570,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else if (MathMan.roundInt(from.getX()) <= border) { // Only send if they just moved out of the border } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (x2 < -border && this.tmpTeleport) { } else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -580,13 +580,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else if (MathMan.roundInt(from.getX()) >= -border) { // Only send if they just moved out of the border } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) { } else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
} }
} }
} }
@ -596,7 +596,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -612,19 +612,19 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
return; return;
} }
Plot plot = area.getPlot(location); Plot now = area.getPlot(location);
Plot lastPlot; Plot lastPlot;
try (final MetaDataAccess<Plot> lastPlotAccess = try (final MetaDataAccess<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
lastPlot = lastPlotAccess.get().orElse(null); lastPlot = lastPlotAccess.get().orElse(null);
} }
if (plot == null) { if (now == null) {
try (final MetaDataAccess<Boolean> kickAccess = try (final MetaDataAccess<Boolean> kickAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -637,12 +637,12 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
} }
} else if (plot.equals(lastPlot)) { } else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, plot); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, plot) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("deny.no_enter"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("plot", plot.toString()) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(from); player.teleport(from);
@ -661,9 +661,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else if (MathMan.roundInt(from.getZ()) <= border) { // Only send if they just moved out of the border } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -671,13 +671,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else if (MathMan.roundInt(from.getZ()) >= -border) { // Only send if they just moved out of the border } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) { } else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
} }
} }
} }
@ -726,45 +726,45 @@ public class PlayerEventListener extends PlotListener implements Listener {
String sender = event.getPlayer().getDisplayName(); String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId(); PlotId id = plot.getId();
String worldName = plot.getWorldName(); String worldName = plot.getWorldName();
Caption msg = TranslatableCaption.of("chat.plot_chat_format"); Caption msg = TranslatableCaption.miniMessage("chat.plot_chat_format");
Template msgTemplate; Placeholder<?> msgTemplate;
Template worldNameTemplate = Template.of("world", worldName); Placeholder<?> worldNameTemplate = Placeholder.miniMessage("world", worldName);
Template plotTemplate = Template.of("plot_id", id.toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot_id", id.toString());
Template senderTemplate = Template.of("sender", sender); 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. // 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 // 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 // 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. // allowing colour.
if (plotPlayer.hasPermission("plots.chat.color")) { if (plotPlayer.hasPermission("plots.chat.color")) {
msgTemplate = Template msgTemplate = Placeholder
.of( .miniMessage(
"msg", "msg",
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes( BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
'&', '&',
message message
)) )).toString()
); );
} else { } else {
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize( msgTemplate = Placeholder.miniMessage("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message))))); ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))).toString());
} }
for (PlotPlayer<?> receiver : plotRecipients) { for (PlotPlayer<?> receiver : plotRecipients) {
receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate); receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
} }
if (!spies.isEmpty()) { if (!spies.isEmpty()) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender); Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
for (PlotPlayer<?> player : spies) { for (PlotPlayer<?> player : spies) {
player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate); player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
} }
} }
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) { if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender); Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
spymessageTemplate spymessageTemplate
); );
@ -919,16 +919,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
cancelled = true; cancelled = true;
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
cancelled = true; cancelled = true;
} }
@ -937,8 +937,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
cancelled = true; cancelled = true;
} }
@ -975,8 +975,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
e.setCancelled(true); e.setCancelled(true);
} }
@ -984,7 +984,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -993,8 +993,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
e.setCancelled(true); e.setCancelled(true);
} }
@ -1008,8 +1008,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
e.setCancelled(true); e.setCancelled(true);
plot.debug(pp.getName() + " could not interact with " + entity.getType() plot.debug(pp.getName() + " could not interact with " + entity.getType()
@ -1224,8 +1224,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
@ -1233,8 +1233,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
@ -1242,14 +1242,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1289,8 +1289,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
@ -1298,8 +1298,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
@ -1307,14 +1307,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1339,8 +1339,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1348,8 +1348,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1359,8 +1359,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.getFlag(HangingPlaceFlag.class)) { if (!plot.getFlag(HangingPlaceFlag.class)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1388,16 +1388,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1407,8 +1407,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(p.getName() plot.debug(p.getName()
@ -1429,8 +1429,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) { .hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1439,8 +1439,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(player.getName() plot.debug(player.getName()
@ -1471,16 +1471,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null && !area.isRoadFlags()) { if (plot == null && !area.isRoadFlags()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (plot != null && !plot.hasOwner()) { } else if (plot != null && !plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1537,8 +1537,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1559,8 +1559,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1568,8 +1568,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -1582,8 +1582,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(pp.getName() plot.debug(pp.getName()
@ -1702,49 +1702,22 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onPortalCreation(PortalCreateEvent event) { public void onPortalCreation(PortalCreateEvent event) {
String world = event.getWorld().getName(); Location location = BukkitUtil.adapt(event.getEntity().getLocation());
if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
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(); PlotArea area = location.getPlotArea();
if (area == null) { if (area == null) {
continue; return;
} }
Plot plot = location.getOwnedPlot(); Plot plot = location.getOwnedPlot();
if (plot == null) { if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) { if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true); event.setCancelled(true);
return;
} }
continue; return;
} }
if (plot.getFlag(DenyPortalsFlag.class)) { if (plot.getFlag(DenyPortalsFlag.class)) {
StringBuilder builder = new StringBuilder(); if (plot.getFlag(DenyPortalsFlag.class)) {
if (event.getEntity() != null) { plot.debug(event.getEntity().getName() + " did not create a portal because of deny-portals = true");
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());
event.setCancelled(true); event.setCancelled(true);
return;
} }
} }
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.PlotHandler;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.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.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -112,8 +112,8 @@ public class ProjectileEventListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
@ -121,8 +121,8 @@ public class ProjectileEventListener implements Listener {
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);
@ -130,8 +130,8 @@ public class ProjectileEventListener implements Listener {
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
); );
entity.remove(); entity.remove();
event.setCancelled(true); event.setCancelled(true);

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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) { public void onServerLoad(ServerLoadEvent event) {
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) { if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry()); 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -25,7 +25,6 @@
*/ */
package com.plotsquared.bukkit.managers; package com.plotsquared.bukkit.managers;
/*
import com.google.inject.Singleton; import com.google.inject.Singleton;
import org.bukkit.World; import org.bukkit.World;
import org.checkerframework.checker.nullness.qual.NonNull; 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.WorldFeatures;
import se.hyperver.hyperverse.world.WorldType; 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 @Singleton
public class HyperverseWorldManager extends BukkitWorldManager { 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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.Permissions;
import com.plotsquared.core.util.entity.EntityCategories; import com.plotsquared.core.util.entity.EntityCategories;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -178,7 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
return false; return false;
} }
@ -187,8 +187,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
); );
return false; return false;
} }
@ -199,8 +199,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() plot.debug(player.getName()
@ -220,8 +220,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -241,8 +241,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -255,8 +255,8 @@ public class BukkitEntityUtil {
if (!plot.getFlag(PvpFlag.class) && !Permissions if (!plot.getFlag(PvpFlag.class) && !Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
); );
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
+ " because pve = false"); + " because pve = false");
@ -269,8 +269,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
); );
return false; return false;
} }
@ -286,8 +286,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -308,8 +308,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage; 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 net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -337,7 +338,7 @@ public class BukkitUtil extends WorldUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void setSign( public void setSign(
final @NonNull Location location, final @NonNull Caption[] lines, final @NonNull Location location, final @NonNull Caption[] lines,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> { ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
@ -369,7 +370,8 @@ public class BukkitUtil extends WorldUtil {
if (blockstate instanceof final Sign sign) { if (blockstate instanceof final Sign sign) {
for (int i = 0; i < lines.length; i++) { for (int i = 0; i < lines.length; i++) {
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER 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); sign.update(true);
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * it under the terms of the GNU General Public License as published by

View File

@ -22,7 +22,7 @@ dependencies {
api(libs.guiceassistedinject) { api(libs.guiceassistedinject) {
exclude("com.google.inject", "guice") exclude("com.google.inject", "guice")
} }
api(libs.findbugs) compileOnlyApi(libs.findbugs)
// Plugins // Plugins
compileOnly(libs.worldeditCore) { compileOnly(libs.worldeditCore) {
@ -40,7 +40,9 @@ dependencies {
// Other libraries // Other libraries
api(libs.prtree) api(libs.prtree)
api(libs.aopalliance) api(libs.aopalliance)
api(libs.cloudServices) api(libs.rorledning) {
exclude(group = "com.google.guava")
}
api(libs.arkitektonika) api(libs.arkitektonika)
api(libs.paster) api(libs.paster)
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.EventDispatcher;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.query.PlotQuery; 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.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -152,9 +152,9 @@ public class PlotAPI {
*/ */
public void sendConsoleMessage( public void sendConsoleMessage(
final @NonNull String message, 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( public void sendConsoleMessage(
final @NonNull Caption caption, final @NonNull Caption caption,
final @NonNull Template @NonNull ... replacements final @NonNull Placeholder<?> @NonNull ... replacements
) { ) {
ConsolePlayer.getConsole().sendMessage(caption, replacements); ConsolePlayer.getConsole().sendMessage(caption, replacements);
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -25,10 +25,10 @@
*/ */
package com.plotsquared.core; package com.plotsquared.core;
import cloud.commandframework.services.ServicePipeline;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Key; import com.google.inject.Key;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.intellectualsites.services.ServicePipeline;
import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.configuration.caption.LocaleHolder; import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.generator.GeneratorWrapper; 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.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.AnnotationHelper;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.PlatformWorldManager; import com.plotsquared.core.util.PlatformWorldManager;
@ -292,15 +291,6 @@ public interface PlotPlatform<P> extends LocaleHolder {
*/ */
@NonNull String pluginsFormatted(); @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 * Load the caption maps
*/ */

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -209,7 +209,7 @@ public class PlayerBackupProfile implements BackupProfile {
} else { } else {
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens( future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
TranslatableCaption TranslatableCaption
.of("schematics.schematic_paste_failed") .miniMessage("schematics.schematic_paste_failed")
.getComponent(ConsolePlayer.getConsole())))); .getComponent(ConsolePlayer.getConsole()))));
} }
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.google.inject.Singleton;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; 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.configuration.caption.TranslatableCaption;
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory; import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.TaskManager; 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.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -106,22 +105,22 @@ public class SimpleBackupManager implements BackupManager {
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_started"), TranslatableCaption.miniMessage("backups.backup_automatic_started"),
Template.of("plot", plot.getId().toString()) Placeholders.miniMessage("plot", plot.getId().toString())
); );
} }
profile.createBackup().whenComplete((backup, throwable) -> { profile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) { if (throwable != null) {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_failure"), TranslatableCaption.miniMessage("backups.backup_automatic_failure"),
Templates.of("reason", throwable.getMessage()) Placeholders.miniMessage("reason", throwable.getMessage())
); );
} }
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage(TranslatableCaption.of("backups.backup_automatic_finished")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_automatic_finished"));
TaskManager.runTaskAsync(whenDone); TaskManager.runTaskAsync(whenDone);
} }
} }

View File

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

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -67,12 +67,12 @@ public class Alias extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
return false; return false;
} }
@ -90,7 +90,7 @@ public class Alias extends SubCommand {
permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET); permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET); admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET);
if (!admin && !owner) { if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (permission) { // is either admin or owner if (permission) { // is either admin or owner
@ -98,8 +98,8 @@ public class Alias extends SubCommand {
return true; return true;
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET)) 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); permission = isPermitted(player, Permission.PERMISSION_ALIAS_REMOVE);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE); admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE);
if (!admin && !owner) { if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (permission) { if (permission) {
result = removeAlias(player, plot); result = removeAlias(player, plot);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
); );
} }
} }
@ -147,37 +147,37 @@ public class Alias extends SubCommand {
if (alias.isEmpty()) { if (alias.isEmpty()) {
sendUsage(player); sendUsage(player);
} else if (alias.length() >= 50) { } 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)) { } 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 { } else {
if (PlotQuery.newQuery().inArea(plot.getArea()) if (PlotQuery.newQuery().inArea(plot.getArea())
.withAlias(alias) .withAlias(alias)
.anyMatch()) { .anyMatch()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"), TranslatableCaption.miniMessage("alias.alias_is_taken"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
return; return;
} }
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
plot.setAlias(alias); 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; return;
} }
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> { PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (uuid != null) { } else if (uuid != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"), TranslatableCaption.miniMessage("alias.alias_is_taken"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} else { } else {
plot.setAlias(alias); plot.setAlias(alias);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_set_to"), TranslatableCaption.miniMessage("alias.alias_set_to"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} }
})); }));
@ -188,12 +188,12 @@ public class Alias extends SubCommand {
String alias = plot.getAlias(); String alias = plot.getAlias();
if (!plot.getAlias().isEmpty()) { if (!plot.getAlias().isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_removed"), TranslatableCaption.miniMessage("alias.alias_removed"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.no_alias_set") TranslatableCaption.miniMessage("alias.no_alias_set")
); );
} }
plot.setAlias(null); plot.setAlias(null);

View File

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

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * 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 * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -25,8 +25,9 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import cloud.commandframework.services.ServicePipeline; import com.google.common.reflect.TypeToken;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.intellectualsites.services.ServicePipeline;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
@ -50,8 +51,7 @@ import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.AutoClaimFinishTask; import com.plotsquared.core.util.task.AutoClaimFinishTask;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import io.leangen.geantyref.TypeToken; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -84,7 +84,7 @@ public class Auto extends SubCommand {
this.eventDispatcher = eventDispatcher; this.eventDispatcher = eventDispatcher;
this.econHandler = econHandler; this.econHandler = econHandler;
this.servicePipeline = servicePipeline; this.servicePipeline = servicePipeline;
this.servicePipeline.registerServiceType(TypeToken.get(AutoService.class), new AutoService.DefaultAutoService()); this.servicePipeline.registerServiceType(TypeToken.of(AutoService.class), new AutoService.DefaultAutoService());
final AutoService.MultiPlotService multiPlotService = new AutoService.MultiPlotService(); final AutoService.MultiPlotService multiPlotService = new AutoService.MultiPlotService();
this.servicePipeline.registerServiceImplementation(AutoService.class, multiPlotService, this.servicePipeline.registerServiceImplementation(AutoService.class, multiPlotService,
Collections.singletonList(multiPlotService) Collections.singletonList(multiPlotService)
@ -116,14 +116,14 @@ public class Auto extends SubCommand {
int grantedPlots = metaDataAccess.get().orElse(0); int grantedPlots = metaDataAccess.get().orElse(0);
if (diff < 0 && grantedPlots < sizeX * sizeZ) { if (diff < 0 && grantedPlots < sizeX * sizeZ) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)) Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
); );
return false; return false;
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) { } else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)) Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
); );
return false; return false;
} else { } else {
@ -134,15 +134,15 @@ public class Auto extends SubCommand {
metaDataAccess.set(left); metaDataAccess.set(left);
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_granted_plot"), TranslatableCaption.miniMessage("economy.removed_granted_plot"),
Template.of("usedGrants", String.valueOf(grantedPlots - left)), Placeholder.miniMessage("usedGrants", String.valueOf(grantedPlots - left)),
Template.of("remainingGrants", String.valueOf(left)) Placeholder.miniMessage("remainingGrants", String.valueOf(left))
); );
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots()) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots())
) )
); );
return false; return false;
@ -205,7 +205,7 @@ public class Auto extends SubCommand {
plotarea = this.plotAreaManager.getAllPlotAreas()[0]; plotarea = this.plotAreaManager.getAllPlotAreas()[0];
} }
if (plotarea == null) { if (plotarea == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
} }
@ -221,13 +221,13 @@ public class Auto extends SubCommand {
sizeZ = Integer.parseInt(split[1]); sizeZ = Integer.parseInt(split[1]);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", getUsage()) Placeholder.miniMessage("value", getUsage())
); );
return true; return true;
} }
if (sizeX < 1 || sizeZ < 1) { if (sizeX < 1 || sizeZ < 1) {
player.sendMessage(TranslatableCaption.of("error.plot_size_negative")); player.sendMessage(TranslatableCaption.miniMessage("error.plot_size_negative"));
return true; return true;
} }
if (args.length > 1) { if (args.length > 1) {
@ -244,8 +244,8 @@ public class Auto extends SubCommand {
.callAuto(player, plotarea, schematic, sizeX, sizeZ); .callAuto(player, plotarea, schematic, sizeX, sizeZ);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto claim") Placeholder.miniMessage("value", "Auto claim")
); );
return true; return true;
} }
@ -255,14 +255,14 @@ public class Auto extends SubCommand {
schematic = event.getSchematic(); schematic = event.getSchematic();
if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) { if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA))
); );
} }
if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) { if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots_num"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots_num"),
Template.of("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA)) Placeholder.miniMessage("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA))
); );
return false; return false;
} }
@ -279,9 +279,9 @@ public class Auto extends SubCommand {
if (schematic != null && !schematic.isEmpty()) { if (schematic != null && !schematic.isEmpty()) {
if (!plotarea.hasSchematic(schematic)) { if (!plotarea.hasSchematic(schematic)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid_named"), TranslatableCaption.miniMessage("schematics.schematic_invalid_named"),
Template.of("schemname", schematic), Placeholder.miniMessage("schemname", schematic),
Template.of("reason", "non-existent") Placeholder.miniMessage("reason", "non-existent")
); );
return true; return true;
} }
@ -291,8 +291,8 @@ public class Auto extends SubCommand {
) && !Permissions ) && !Permissions
.hasPermission(player, "plots.admin.command.schematic")) { .hasPermission(player, "plots.admin.command.schematic")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", "plots.claim.%s0") Placeholder.miniMessage("node", "plots.claim.%s0")
); );
return true; return true;
} }
@ -305,21 +305,21 @@ public class Auto extends SubCommand {
cost = (sizeX * sizeZ) * cost; cost = (sizeX * sizeZ) * cost;
if (cost > 0d) { if (cost > 0d) {
if (!this.econHandler.isSupported()) { if (!this.econHandler.isSupported()) {
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null")); player.sendMessage(TranslatableCaption.miniMessage("economy.vault_or_consumer_null"));
return false; return false;
} }
if (!force && this.econHandler.getMoney(player) < cost) { if (!force && this.econHandler.getMoney(player) < cost) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(cost)), Placeholder.miniMessage("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
return false; return false;
} }
this.econHandler.withdrawMoney(player, cost); this.econHandler.withdrawMoney(player, cost);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(cost)) Placeholder.miniMessage("money", this.econHandler.format(cost))
); );
} }
} }
@ -332,7 +332,7 @@ public class Auto extends SubCommand {
plots = this.eventDispatcher.callAutoPlotsChosen(player, plots).getPlots(); plots = this.eventDispatcher.callAutoPlotsChosen(player, plots).getPlots();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("errors.no_free_plots")); player.sendMessage(TranslatableCaption.miniMessage("errors.no_free_plots"));
return false; return false;
} else if (plots.size() == 1) { } else if (plots.size() == 1) {
this.claimSingle(player, plots.get(0), plotarea, schematic); this.claimSingle(player, plots.get(0), plotarea, schematic);
@ -352,8 +352,8 @@ public class Auto extends SubCommand {
); );
if (!force && mergeEvent.getEventResult() == Result.DENY) { if (!force && mergeEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto merge") Placeholder.miniMessage("value", "Auto merge")
); );
return false; return false;
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.nio.file.Files; import java.nio.file.Files;
@ -73,8 +73,8 @@ public final class Backup extends Command {
private static boolean sendMessage(PlotPlayer<?> player) { private static boolean sendMessage(PlotPlayer<?> player) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot backup <save | list | load>") Placeholder.miniMessage("value", "/plot backup <save | list | load>")
); );
return true; return true;
} }
@ -138,42 +138,42 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.createBackup().whenComplete((backup, throwable) -> { backupProfile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_save_failed"), TranslatableCaption.miniMessage("backups.backup_save_failed"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
player.sendMessage(TranslatableCaption.of("backups.backup_save_success")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_save_success"));
} }
}); });
} }
@ -192,51 +192,51 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_failed"), TranslatableCaption.miniMessage("backups.backup_list_failed"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_header"), TranslatableCaption.miniMessage("backups.backup_list_header"),
Template.of("plot", plot.getId().toCommaSeparatedString()) Placeholder.miniMessage("plot", plot.getId().toCommaSeparatedString())
); );
try { try {
for (int i = 0; i < backups.size(); i++) { for (int i = 0; i < backups.size(); i++) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_entry"), TranslatableCaption.miniMessage("backups.backup_list_entry"),
Template.of("number", Integer.toString(i + 1)), Placeholder.miniMessage("number", Integer.toString(i + 1)),
Template.of("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant( Placeholder.miniMessage("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
Instant.ofEpochMilli(backups.get(i).getCreationTime()), Instant.ofEpochMilli(backups.get(i).getCreationTime()),
ZoneId.systemDefault() ZoneId.systemDefault()
))) )))
@ -263,29 +263,29 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else if (args.length == 0) { } else if (args.length == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Usage: /plot backup save/list/load") Placeholder.miniMessage("value", "Usage: /plot backup save/list/load")
); );
} else { } else {
final int number; final int number;
@ -293,32 +293,32 @@ public final class Backup extends Command {
number = Integer.parseInt(args[0]); number = Integer.parseInt(args[0]);
} catch (final Exception e) { } catch (final Exception e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_a_number"), TranslatableCaption.miniMessage("invalid.not_a_number"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return; return;
} }
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_load_failure"), TranslatableCaption.miniMessage("backups.backup_load_failure"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
if (number < 1 || number > backups.size()) { if (number < 1 || number > backups.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of( Placeholder.miniMessage(
"plot", "plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
) )
); );
} else { } else {
@ -327,10 +327,10 @@ public final class Backup extends Command {
if (backup == null || backup.getFile() == null || !Files if (backup == null || backup.getFile() == null || !Files
.exists(backup.getFile())) { .exists(backup.getFile())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of( Placeholder.miniMessage(
"plot", "plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
) )
); );
} else { } else {
@ -339,11 +339,11 @@ public final class Backup extends Command {
.whenComplete((n, error) -> { .whenComplete((n, error) -> {
if (error != null) { if (error != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_load_failure"), TranslatableCaption.miniMessage("backups.backup_load_failure"),
Template.of("reason", error.getMessage()) Placeholder.miniMessage("reason", error.getMessage())
); );
} else { } else {
player.sendMessage(TranslatableCaption.of("backups.backup_load_success")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_load_success"));
} }
}) })
); );

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