Compare commits

..

36 Commits

Author SHA1 Message Date
7cdde5a822 build: Back to snapshot for development 2022-01-14 11:46:02 +01:00
8b6e7b2f2b build: Release 6.3.0 2022-01-14 11:14:00 +01:00
06f0b42a97 refactor: Update SquirrelID GAV 2022-01-14 10:58:44 +01:00
9a85080bf6 Allow restoration of road schematic height calculation behaviour from pre 6.1.4 (#3444) 2022-01-14 10:46:04 +01:00
d14d2caa2d refactor: Prepare removal of our maven repository (#3451) 2022-01-13 14:50:07 +01:00
bcfe7c58dd feat: Add 1.18's music disc additions to /plot music (#3446) 2022-01-12 22:22:01 +01:00
289f0f3bfd Sort plugins on /plot debugpaste alphabetically (#3447)
* feat: Sort plugins on debugpaste alphabetically

* Put (F[A])WE at the top
2022-01-12 22:21:51 +01:00
6fc4005c72 Fix for unwanted audio panning (#3430)
* Fixes https://github.com/IntellectualSites/PlotSquared/issues/3422

* Removed old code

Co-authored-by: Alex <mc.cache@web.de>
2022-01-11 11:02:23 +01:00
8f7c2e4c02 fix: /plot music being able to be used on unclaimed plots (#3432) 2022-01-11 11:01:36 +01:00
b43d08f4aa feat: Display explosion particles even after the event got canceled (with setting to control behavior) (#3436)
* feat: display explosion particles even after event cancel
And add settings option to change behavior

* refactor

* refactor: Change settings comment to clearer connect to it's purpose.
2022-01-10 13:18:19 +01:00
2c55c6a92e build: Update dependency org.checkerframework:checker-qual to v3.21.1 (#3441)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-10 11:26:53 +01:00
31f48cc7d1 Fix: 1.18 uses the same field as 1.17 for mustNotSave (#3428) 2022-01-05 21:22:09 +01:00
4b77f1ab28 Make road flags great again (#3420)
Fixes #3111
2022-01-05 21:21:58 +01:00
7cc38b5fa8 Fix: use ownersInclude instead of ownedBy where required (#3419)
* Fix: use ownersInclude instead of ownedBy where required
- Also account for multiple plot owners in Cluster player removal
- Add whereBasePlot to avoid merged plots listing multiple times if required
- Only use ownersInclude in visit if enabled in config
- Fixes #3143

* Remove static import
2022-01-05 21:21:48 +01:00
0c76d08b10 Only send border area exit message once (#3418)
Fixes #3335
2022-01-05 21:21:37 +01:00
9c474570c8 Fix: use portal corners to test for event cancellation as entity can be null (#3417)
* Fix: use portal corners to test for event cancellation as entity can be null

* Remove duplicate flag check?

* Simplify to Set#of
2022-01-05 21:21:25 +01:00
7e1d56c849 fix: Reimplement the "unknown owner" option to plot purge (#3412)
- Warn user that backgorund UUID caching may fix the issue
- Also correct the UUID set when purging based on "shared" (added) player
- Fixes #3353
2022-01-05 21:21:08 +01:00
07d0f124b4 ci: Let release drafter listen to forks too 2022-01-05 11:56:28 +01:00
8d6c621763 ci: Setup auto rebase (#3431) 2022-01-04 15:38:21 +01:00
cef7098014 build: Update plugin shadow to v7.1.2 (#3427)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 13:52:29 +01:00
e1efa7266e build: Update dependency cloud.commandframework:cloud-services to v1.6.1 (#3425)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:45:04 +01:00
f363941719 build: Update dependency org.apache.logging.log4j:log4j-api to v2.17.1 (#3426)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:14:52 +01:00
25095f4546 chore: Welcome 2022 2022-01-02 22:22:19 +01:00
fd0c2050d8 Refactor: Replace Rörledning with Cloud-Services (#3409)
* Refactor: Replace Rörledning with Cloud-Services

Cloud-Services is actually maintained, as opposed to Rörledning. Furthermore, Rörledning is available through Maven Central, whereas rörledning isn't.

This is a semi-breaking change, but because we relocate, it might be fine? Either way, this is a necessary change.

* build: Provide jsr at runtime

* Merge branch 'v6' into refactor/v6/cloud-services

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-12-31 15:49:11 +01:00
07fdc94dd8 Account for mutability of plot objects when sending move/swap success messages (#3414)
Fixes #3337
2021-12-31 15:46:08 +01:00
b501a81e21 build: Exchange mvdwapi version to our ones 2021-12-31 01:29:30 +01:00
eb334b3aac Fix: add missing placeholders for plot info
Fixes #3339
2021-12-30 14:41:31 +00:00
a77a51b6f2 build: Back to snapshot for development 2021-12-30 10:31:08 +01:00
7d981bc610 build: Release 6.2.2 2021-12-30 10:14:15 +01:00
3eb485e900 refactor: Drop guava annotations and create annotation helper (#3389) 2021-12-29 16:18:19 +01:00
9f4af889f7 fix: npe thrown in entity spawn listener (#3399) 2021-12-27 11:01:28 +01:00
2559c889e2 build: Update dependency me.clip:placeholderapi to v2.11.1 (#3403)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:37 +01:00
2cf268b99c build: Update actions/setup-java action to v2.5.0 (#3404)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:07 +01:00
e6fad8309c build: Update dependency gradle to v7.3.3 (#3402)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:40:00 +01:00
7551450cf9 fix: Send user-friendly message on join of denied plot (#3388)
Also refactor local variable `now` to a more fitting name
2021-12-26 23:28:50 +01:00
e042566bb7 fix: Strip redundant space at flag collection (#3400) 2021-12-26 23:28:03 +01:00
571 changed files with 3627 additions and 3706 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.4.0 uses: actions/setup-java@v2.5.0
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17

20
.github/workflows/rebase.yml vendored Normal file
View File

@ -0,0 +1,20 @@
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,6 +4,10 @@ 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:

View File

@ -40,7 +40,6 @@ 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
@ -75,7 +74,8 @@ 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("com.intellectualsites.services", "com.plotsquared.core.services") relocate("cloud.commandframework.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,6 +83,7 @@ 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.
@ -100,6 +101,5 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,6 +147,8 @@ 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;
@ -266,7 +268,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-1.17/"); ".net/job/FastAsyncWorldEdit/");
} }
} }
} }
@ -1141,8 +1143,10 @@ 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();
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); List<Plugin> plugins = new ArrayList<>();
msg.append("Plugins (").append(plugins.length).append("): \n"); Collections.addAll(plugins, Bukkit.getServer().getPluginManager().getPlugins());
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")
@ -1156,6 +1160,21 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,7 +29,6 @@ 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;
@ -40,9 +39,7 @@ public class WorldManagerModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
PlatformWorldManager<World> provideWorldManager() { PlatformWorldManager<World> provideWorldManager() {
if (Bukkit.getPluginManager().getPlugin("Hyperverse") != null) { if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("height.height_limit"), TranslatableCaption.of("height.height_limit"),
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())), Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight())) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Template.of("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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) Template.of("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.miniMessage("height.height_limit"), TranslatableCaption.of("height.height_limit"),
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())), Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight())) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Template.of("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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Template.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,41 +108,11 @@ 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 {
this.visibleChunks = classPlayerChunkMap.getField("visibleChunks");
}
this.methodGetFullChunk = getRefClass("{nms}.PlayerChunk").getMethod("getFullChunk");
this.methodGetBukkitChunk = getRefClass("{nms}.Chunk").getMethod("getBukkitChunk");
*/
} }
} else if (version == 17) { } else {
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();
@ -182,32 +152,7 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,6 +48,7 @@ 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;
@ -323,6 +324,10 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,8 +75,7 @@ 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 (areaName.equals(world.getName())) { if (!world.getName().equals(areaName)) {
} 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("errors.tile_entity_cap_reached"), TranslatableCaption.of("errors.tile_entity_cap_reached"),
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) Template.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("errors.tile_entity_cap_reached"), TranslatableCaption.of("errors.tile_entity_cap_reached"),
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Template.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,11 +68,9 @@ 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;
@ -87,13 +85,14 @@ 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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;
@ -155,6 +154,7 @@ 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.miniMessage("blockedcmds.command_blocked")); plotPlayer.sendMessage(TranslatableCaption.of("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.miniMessage("update.update_boundary"); Caption boundary = TranslatableCaption.of("update.update_boundary");
Caption updateNotification = TranslatableCaption.miniMessage("update.update_notification"); Caption updateNotification = TranslatableCaption.of("update.update_notification");
Placeholder<?> internalVersion = Placeholder.miniMessage("p2version", UpdateUtility.internalVersion.versionString()); Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
Placeholder<?> spigotVersion = Placeholder.miniMessage("spigotversion", UpdateUtility.spigotVersion); Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
Placeholder<?> downloadUrl = Placeholder.miniMessage("downloadurl", "https://www.spigotmc.org/resources/77506/updates"); Template downloadUrl = Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", plot.toString())
); );
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.miniMessage("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", now.toString())
); );
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.miniMessage("border.denied")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else { } else if (MathMan.roundInt(from.getX()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited")); pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
} }
} else if (x2 < -border && this.tmpTeleport) { } else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!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.miniMessage("border.denied")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else { } else if (MathMan.roundInt(from.getX()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited")); pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
} }
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) { } else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered")); pp.sendMessage(TranslatableCaption.of("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.miniMessage("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.of("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 now = area.getPlot(location); Plot plot = 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 (now == null) { if (plot == 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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Template.of("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 (now.equals(lastPlot)) { } else if (plot.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, plot);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, plot) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.miniMessage("permission.no_permission_event"), TranslatableCaption.of("deny.no_enter"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Template.of("plot", plot.toString())
); );
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.miniMessage("border.denied")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else { } else if (MathMan.roundInt(from.getZ()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited")); pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
} }
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!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.miniMessage("border.denied")); pp.sendMessage(TranslatableCaption.of("border.denied"));
} else { } else if (MathMan.roundInt(from.getZ()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited")); pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
} }
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) { } else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered")); pp.sendMessage(TranslatableCaption.of("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.miniMessage("chat.plot_chat_format"); Caption msg = TranslatableCaption.of("chat.plot_chat_format");
Placeholder<?> msgTemplate; Template msgTemplate;
Placeholder<?> worldNameTemplate = Placeholder.miniMessage("world", worldName); Template worldNameTemplate = Template.of("world", worldName);
Placeholder<?> plotTemplate = Placeholder.miniMessage("plot_id", id.toString()); Template plotTemplate = Template.of("plot_id", id.toString());
Placeholder<?> senderTemplate = Placeholder.miniMessage("sender", sender); Template senderTemplate = Template.of("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 = Placeholder msgTemplate = Template
.miniMessage( .of(
"msg", "msg",
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes( BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
'&', '&',
message message
)).toString() ))
); );
} else { } else {
msgTemplate = Placeholder.miniMessage("msg", BukkitUtil.MINI_MESSAGE.deserialize( msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))).toString()); ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
} }
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.miniMessage("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY()); Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender); Template spysenderTemplate = Template.of("sender", sender);
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString()); Template spymessageTemplate = Template.of("msg", Component.text(message));
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.miniMessage("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY()); Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender); Template spysenderTemplate = Template.of("sender", sender);
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString()); Template spymessageTemplate = Template.of("msg", Component.text(message));
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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Template.of("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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Template.of("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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Template.of("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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(pp.getName() plot.debug(pp.getName()
@ -1702,22 +1702,49 @@ public class PlayerEventListener extends PlotListener implements Listener {
@EventHandler @EventHandler
public void onPortalCreation(PortalCreateEvent event) { public void onPortalCreation(PortalCreateEvent event) {
Location location = BukkitUtil.adapt(event.getEntity().getLocation()); String world = event.getWorld().getName();
PlotArea area = location.getPlotArea(); if (PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world).size() == 0) {
if (area == null) {
return; return;
} }
Plot plot = location.getOwnedPlot(); int minX = Integer.MAX_VALUE;
if (plot == null) { int maxX = Integer.MIN_VALUE;
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) { int minZ = Integer.MAX_VALUE;
event.setCancelled(true); int maxZ = Integer.MIN_VALUE;
for (BlockState state : event.getBlocks()) {
minX = Math.min(state.getX(), minX);
maxX = Math.max(state.getX(), maxX);
minZ = Math.min(state.getZ(), minZ);
maxZ = Math.max(state.getZ(), maxZ);
}
int y = event.getBlocks().get(0).getY(); // Don't need to worry about this too much
for (Location location : Set.of( // Use Set to lazily avoid duplicate locations
Location.at(world, minX, y, maxX),
Location.at(world, minZ, y, maxZ),
Location.at(world, minX, y, maxZ),
Location.at(world, minZ, y, maxX)
)) {
PlotArea area = location.getPlotArea();
if (area == null) {
continue;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
event.setCancelled(true);
return;
}
continue;
} }
return;
}
if (plot.getFlag(DenyPortalsFlag.class)) {
if (plot.getFlag(DenyPortalsFlag.class)) { if (plot.getFlag(DenyPortalsFlag.class)) {
plot.debug(event.getEntity().getName() + " did not create a portal because of deny-portals = true"); StringBuilder builder = new StringBuilder();
if (event.getEntity() != null) {
builder.append(event.getEntity().getName()).append(" did not create a portal");
} else {
builder.append("Portal creation cancelled");
}
plot.debug(builder.append(" because of deny-portals = true").toString());
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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) Template.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.miniMessage("placeholder.hooked")); ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
} }
} }

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * PlotSquared plot management system for Minecraft
* Copyright (C) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,6 +25,7 @@
*/ */
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;
@ -35,10 +36,9 @@ 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
* Hyperverse specific manager that creates worlds repository.
* using Hyperverse's API
*/
@Singleton @Singleton
public class HyperverseWorldManager extends BukkitWorldManager { public class HyperverseWorldManager extends BukkitWorldManager {
@ -67,3 +67,4 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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
@ -36,7 +36,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* world creation by executing a console command * world creation by executing a console command
* *
* @deprecated Deprecated and scheduled for removal without replacement * @deprecated Deprecated and scheduled for removal without replacement
* in favor of the build in setup wizard. * in favor of the build in setup wizard.
*/ */
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
@Singleton @Singleton

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * PlotSquared plot management system for Minecraft
* Copyright (C) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("done.building_restricted") TranslatableCaption.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Template.of("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.miniMessage("permission.no_permission_event"), TranslatableCaption.of("permission.no_permission_event"),
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Template.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,8 +53,7 @@ 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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;
@ -338,7 +337,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 Placeholder<?>... replacements final @NonNull Template... 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();
@ -370,8 +369,7 @@ 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.deserialize(lines[i].getComponent(LocaleHolder.console()), .serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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

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

View File

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

View File

@ -8,7 +8,7 @@
* | | * | |
* |_| * |_|
* PlotSquared plot management system for Minecraft * PlotSquared plot management system for Minecraft
* Copyright (C) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.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;
@ -152,9 +152,9 @@ public class PlotAPI {
*/ */
public void sendConsoleMessage( public void sendConsoleMessage(
final @NonNull String message, final @NonNull String message,
final @NonNull Placeholder<?> @NonNull ... replacements final @NonNull Template @NonNull ... replacements
) { ) {
ConsolePlayer.getConsole().sendMessage(StaticCaption.miniMessage(message), replacements); ConsolePlayer.getConsole().sendMessage(StaticCaption.of(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 Placeholder<?> @NonNull ... replacements final @NonNull Template @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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,6 +40,7 @@ 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;
@ -291,6 +292,15 @@ 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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
.miniMessage("schematics.schematic_paste_failed") .of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,12 +31,13 @@ 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.Placeholders; import com.plotsquared.core.configuration.caption.Templates;
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;
@ -105,22 +106,22 @@ public class SimpleBackupManager implements BackupManager {
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("backups.backup_automatic_started"), TranslatableCaption.of("backups.backup_automatic_started"),
Placeholders.miniMessage("plot", plot.getId().toString()) Template.of("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.miniMessage("backups.backup_automatic_failure"), TranslatableCaption.of("backups.backup_automatic_failure"),
Placeholders.miniMessage("reason", throwable.getMessage()) Templates.of("reason", throwable.getMessage())
); );
} }
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_automatic_finished")); player.sendMessage(TranslatableCaption.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned")); checkTrue(plot.hasOwner(), TranslatableCaption.of("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.miniMessage("permission.no_plot_perms") TranslatableCaption.of("permission.no_plot_perms")
); );
checkTrue(args.length == 1, TranslatableCaption.miniMessage("commandconfig.command_syntax"), checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
Placeholder.miniMessage("value", "/plot add <player | *>") Template.of("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.miniMessage("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("errors.invalid_player"), TranslatableCaption.of("errors.invalid_player"),
Placeholder.miniMessage("value", args[0]) Template.of("value", args[0])
); );
} }
future.completeExceptionally(throwable); future.completeExceptionally(throwable);
return; return;
} else { } else {
try { try {
checkTrue(!uuids.isEmpty(), TranslatableCaption.miniMessage("errors.invalid_player"), checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
Placeholder.miniMessage("value", args[0]) Template.of("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.miniMessage("errors.invalid_player"), TranslatableCaption.of("errors.invalid_player"),
Placeholder.miniMessage("value", PlayerManager.getName(uuid)) Template.of("value", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
} }
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("member.already_added"), TranslatableCaption.of("member.already_added"),
Placeholder.miniMessage("player", PlayerManager.getName(uuid)) Template.of("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.miniMessage("member.already_added"), TranslatableCaption.of("member.already_added"),
Placeholder.miniMessage("player", PlayerManager.getName(uuid)) Template.of("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.miniMessage("members.plot_max_members_added"), TranslatableCaption.of("members.plot_max_members_added"),
Placeholder.miniMessage("amount", String.valueOf(localAddSize)) Template.of("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.miniMessage("member.member_added")); player.sendMessage(TranslatableCaption.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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.miniMessage("errors.not_in_plot")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.of("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.miniMessage("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_SET)) Template.of("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.miniMessage("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE)) Template.of("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.miniMessage("alias.alias_too_long")); player.sendMessage(TranslatableCaption.of("alias.alias_too_long"));
} else if (MathMan.isInteger(alias)) { } else if (MathMan.isInteger(alias)) {
player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_value")); // TODO this is obviously wrong player.sendMessage(TranslatableCaption.of("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.miniMessage("alias.alias_is_taken"), TranslatableCaption.of("alias.alias_is_taken"),
Placeholder.miniMessage("alias", alias) Template.of("alias", alias)
); );
return; return;
} }
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
plot.setAlias(alias); plot.setAlias(alias);
player.sendMessage(TranslatableCaption.miniMessage("alias.alias_set_to"), Placeholder.miniMessage("alias", alias)); player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("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.miniMessage("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else if (uuid != null) { } else if (uuid != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("alias.alias_is_taken"), TranslatableCaption.of("alias.alias_is_taken"),
Placeholder.miniMessage("alias", alias) Template.of("alias", alias)
); );
} else { } else {
plot.setAlias(alias); plot.setAlias(alias);
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("alias.alias_set_to"), TranslatableCaption.of("alias.alias_set_to"),
Placeholder.miniMessage("alias", alias) Template.of("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.miniMessage("alias.alias_removed"), TranslatableCaption.of("alias.alias_removed"),
Placeholder.miniMessage("alias", alias) Template.of("alias", alias)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("alias.no_alias_set") TranslatableCaption.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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.Placeholders; import com.plotsquared.core.configuration.caption.Templates;
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,8 +75,7 @@ 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.placeholder.Placeholder; import net.kyori.adventure.text.minimessage.Template;
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;
@ -147,26 +146,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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE)) Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
); );
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("single.single_area_needs_name"), TranslatableCaption.of("single.single_area_needs_name"),
Placeholder.miniMessage("command", "/plot area single <name>") Template.of("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.miniMessage("single.single_area_name_taken")); player.sendMessage(TranslatableCaption.of("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.miniMessage("single.single_area_missing_selection")); player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
return false; return false;
} }
Region playerSelectedRegion = null; Region playerSelectedRegion = null;
@ -175,18 +174,18 @@ public class Area extends SubCommand {
} catch (final Exception ignored) { } catch (final Exception ignored) {
} }
if (playerSelectedRegion == null) { if (playerSelectedRegion == null) {
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection")); player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
return false; return false;
} }
if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) { if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) {
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_not_square")); player.sendMessage(TranslatableCaption.of("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.miniMessage("single.single_area_overlapping")); player.sendMessage(TranslatableCaption.of("single.single_area_overlapping"));
} }
// Alter the region // Alter the region
final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint(); final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint();
@ -228,7 +227,7 @@ public class Area extends SubCommand {
+ hybridPlotWorld.getId() + hybridPlotWorld.getId()
); );
if (!parentFile.exists() && !parentFile.mkdirs()) { if (!parentFile.exists() && !parentFile.mkdirs()) {
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_could_not_make_directories")); player.sendMessage(TranslatableCaption.of("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");
@ -246,7 +245,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.miniMessage("single.single_area_failed_to_save")); player.sendMessage(TranslatableCaption.of("single.single_area_failed_to_save"));
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
@ -282,11 +281,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.miniMessage("single.single_area_created")); player.sendMessage(TranslatableCaption.of("single.single_area_created"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("errors.error_create"), TranslatableCaption.of("errors.error_create"),
Placeholder.miniMessage("world", hybridPlotWorld.getWorldName()) Template.of("world", hybridPlotWorld.getWorldName())
); );
} }
}; };
@ -296,16 +295,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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE)) Template.of("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.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
case 2: case 2:
@ -318,8 +317,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.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -329,13 +328,13 @@ public class Area extends SubCommand {
location location
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("set.set_attribute"), TranslatableCaption.of("set.set_attribute"),
Placeholder.miniMessage("attribute", "area_pos1"), Template.of("attribute", "area_pos1"),
Placeholder.miniMessage("value", location.getX() + "," + location.getZ()) Template.of("value", location.getX() + "," + location.getZ())
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("area.set_pos2"), TranslatableCaption.of("area.set_pos2"),
Placeholder.miniMessage("command", "/plot area create pos2") Template.of("command", "/plot area create pos2")
); );
return true; return true;
} }
@ -348,8 +347,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.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -374,8 +373,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.miniMessage("cluster.cluster_intersection"), TranslatableCaption.of("cluster.cluster_intersection"),
Placeholder.miniMessage("cluster", areas.iterator().next().toString()) Template.of("cluster", areas.iterator().next().toString())
); );
return false; return false;
} }
@ -398,7 +397,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.miniMessage("setup.setup_finished")); player.sendMessage(TranslatableCaption.of("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(
@ -413,8 +412,8 @@ public class Area extends SubCommand {
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("errors.error_create"), TranslatableCaption.of("errors.error_create"),
Placeholder.miniMessage("world", area.getWorldName()) Template.of("world", area.getWorldName())
); );
} }
}; };
@ -447,8 +446,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.miniMessage("setup.setup_world_taken"), TranslatableCaption.of("setup.setup_world_taken"),
Placeholder.miniMessage("value", pa.toString()) Template.of("value", pa.toString())
); );
return false; return false;
} }
@ -462,9 +461,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.miniMessage("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1,", getCommandString()), Template.of("value1,", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...") Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -499,9 +498,9 @@ public class Area extends SubCommand {
} }
default -> { default -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()), Template.of("value1", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...") Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -510,8 +509,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.miniMessage("setup.setup_world_taken"), TranslatableCaption.of("setup.setup_world_taken"),
Placeholder.miniMessage("value", pa.getWorldName()) Template.of("value", pa.getWorldName())
); );
return false; return false;
} }
@ -528,11 +527,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.miniMessage("setup.setup_finished")); player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("errors.error_create"), TranslatableCaption.of("errors.error_create"),
Placeholder.miniMessage("world", pa.getWorldName()) Template.of("world", pa.getWorldName())
); );
} }
try { try {
@ -550,13 +549,13 @@ public class Area extends SubCommand {
} }
if (pa.getId() == null) { if (pa.getId() == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholder.miniMessage("value", getUsage()) Template.of("value", getUsage())
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()), Template.of("value1", getCommandString()),
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...") Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -572,8 +571,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.miniMessage("single.get_position"), TranslatableCaption.of("single.get_position"),
Placeholder.miniMessage("command", getCommandString()) Template.of("command", getCommandString())
); );
break; break;
} }
@ -582,8 +581,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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_INFO)) Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
); );
return false; return false;
} }
@ -593,18 +592,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.miniMessage("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()), Template.of("value1", getCommandString()),
Placeholder.miniMessage("value2", " info [area]") Template.of("value2", " info [area]")
); );
return false; return false;
} }
} }
if (area == null) { if (area == null) {
if (args.length == 2) { if (args.length == 2) {
player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1])); player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
} else { } else {
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
} }
return false; return false;
} }
@ -626,24 +625,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";
} }
Placeholder<?> headerTemplate = Placeholder.miniMessage( Template headerTemplate = Template.of(
"header", "header",
TranslatableCaption.miniMessage("info.plot_info_header").getComponent(player) TranslatableCaption.of("info.plot_info_header").getComponent(player)
); );
Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name); Template nameTemplate = Template.of("name", name);
Placeholder<?> typeTemplate = Placeholder.miniMessage("type", area.getType().name()); Template typeTemplate = Template.of("type", area.getType().name());
Placeholder<?> terrainTemplate = Placeholder.miniMessage("terrain", area.getTerrain().name()); Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent)); Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed)); Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters)); Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region); Template regionTemplate = Template.of("region", region);
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator); Template generatorTemplate = Template.of("generator", generator);
Placeholder<?> footerTemplate = Placeholder.miniMessage( Template footerTemplate = Template.of(
"footer", "footer",
TranslatableCaption.miniMessage("info.plot_info_footer").getComponent(player) TranslatableCaption.of("info.plot_info_footer").getComponent(player)
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("info.area_info_format"), TranslatableCaption.of("info.area_info_format"),
headerTemplate, headerTemplate,
nameTemplate, nameTemplate,
typeTemplate, typeTemplate,
@ -660,8 +659,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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_LIST)) Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
); );
return false; return false;
} }
@ -677,9 +676,9 @@ public class Area extends SubCommand {
} }
default: default:
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Placeholder.miniMessage("value1", getCommandString()), Template.of("value1", getCommandString()),
Placeholder.miniMessage("value2", " list [#]") Template.of("value2", " list [#]")
); );
return false; return false;
} }
@ -705,30 +704,29 @@ 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";
} }
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed)); Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent) + "%"); Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%");
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters)); Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region); Template regionTemplate = Template.of("region", region);
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator); Template generatorTemplate = Template.of("generator", generator);
String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
.deserialize( .parse(
TranslatableCaption.miniMessage("info.area_list_tooltip").getComponent(player), TranslatableCaption.of("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,
@ -738,26 +736,26 @@ public class Area extends SubCommand {
infocmdTemplate infocmdTemplate
); );
} }
}, "/plot area list", TranslatableCaption.miniMessage("list.area_list_header_paged")); }, "/plot area list", TranslatableCaption.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_REGEN)) Template.of("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.miniMessage("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
return false; return false;
} }
if (area.getType() != PlotAreaType.PARTIAL) { if (area.getType() != PlotAreaType.PARTIAL) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("single.delete_world_region"), TranslatableCaption.of("single.delete_world_region"),
Placeholder.miniMessage("world", area.getWorldName()) Template.of("world", area.getWorldName())
); );
return false; return false;
} }
@ -770,28 +768,28 @@ public class Area extends SubCommand {
null null
)); ));
queue.addReadChunks(area.getRegion().getChunks()); queue.addReadChunks(area.getRegion().getChunks());
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.miniMessage("single.regeneration_complete"))); queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_TP)) Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP))
); );
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholder.miniMessage("value", "/plot area tp [area]") Template.of("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.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1])); player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
return false; return false;
} }
Location center; Location center;
@ -819,7 +817,7 @@ public class Area extends SubCommand {
return true; return true;
} }
case "delete", "remove" -> { case "delete", "remove" -> {
player.sendMessage(TranslatableCaption.miniMessage("single.worldcreation_location")); player.sendMessage(TranslatableCaption.of("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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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) 2021 IntellectualSites * Copyright (C) 2014 - 2022 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,9 +25,8 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.common.reflect.TypeToken; import cloud.commandframework.services.ServicePipeline;
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;
@ -51,7 +50,8 @@ 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 net.kyori.adventure.text.minimessage.placeholder.Placeholder; import io.leangen.geantyref.TypeToken;
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.of(AutoService.class), new AutoService.DefaultAutoService()); this.servicePipeline.registerServiceType(TypeToken.get(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.miniMessage("permission.cant_claim_more_plots"), TranslatableCaption.of("permission.cant_claim_more_plots"),
Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots)) Template.of("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.miniMessage("permission.cant_claim_more_plots"), TranslatableCaption.of("permission.cant_claim_more_plots"),
Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots)) Template.of("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.miniMessage("economy.removed_granted_plot"), TranslatableCaption.of("economy.removed_granted_plot"),
Placeholder.miniMessage("usedGrants", String.valueOf(grantedPlots - left)), Template.of("usedGrants", String.valueOf(grantedPlots - left)),
Placeholder.miniMessage("remainingGrants", String.valueOf(left)) Template.of("remainingGrants", String.valueOf(left))
); );
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"), TranslatableCaption.of("permission.cant_claim_more_plots"),
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()) Template.of("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.miniMessage("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.of("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.miniMessage("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Placeholder.miniMessage("value", getUsage()) Template.of("value", getUsage())
); );
return true; return true;
} }
if (sizeX < 1 || sizeZ < 1) { if (sizeX < 1 || sizeZ < 1) {
player.sendMessage(TranslatableCaption.miniMessage("error.plot_size_negative")); player.sendMessage(TranslatableCaption.of("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.miniMessage("events.event_denied"), TranslatableCaption.of("events.event_denied"),
Placeholder.miniMessage("value", "Auto claim") Template.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA)) Template.of("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.miniMessage("permission.cant_claim_more_plots_num"), TranslatableCaption.of("permission.cant_claim_more_plots_num"),
Placeholder.miniMessage("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA)) Template.of("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.miniMessage("schematics.schematic_invalid_named"), TranslatableCaption.of("schematics.schematic_invalid_named"),
Placeholder.miniMessage("schemname", schematic), Template.of("schemname", schematic),
Placeholder.miniMessage("reason", "non-existent") Template.of("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.miniMessage("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Placeholder.miniMessage("node", "plots.claim.%s0") Template.of("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.miniMessage("economy.vault_or_consumer_null")); player.sendMessage(TranslatableCaption.of("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.miniMessage("economy.cannot_afford_plot"), TranslatableCaption.of("economy.cannot_afford_plot"),
Placeholder.miniMessage("money", this.econHandler.format(cost)), Template.of("money", this.econHandler.format(cost)),
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player))) Template.of("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.miniMessage("economy.removed_balance"), TranslatableCaption.of("economy.removed_balance"),
Placeholder.miniMessage("money", this.econHandler.format(cost)) Template.of("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.miniMessage("errors.no_free_plots")); player.sendMessage(TranslatableCaption.of("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.miniMessage("events.event_denied"), TranslatableCaption.of("events.event_denied"),
Placeholder.miniMessage("value", "Auto merge") Template.of("value", "Auto merge")
); );
return false; return false;
} }

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