mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-07 08:04:42 +02:00
Compare commits
99 Commits
6.1.1
...
refactor/v
Author | SHA1 | Date | |
---|---|---|---|
1b5dab3ddd | |||
6198d98488 | |||
1f26808c7b | |||
a7026047d0 | |||
af2613202d | |||
3da1e9255a | |||
9394906a79 | |||
d881cb6084 | |||
b9d43897af | |||
76b58485a9 | |||
7002df0bc7 | |||
958aac3cb1 | |||
5325f90f7b | |||
b07bd6f39c | |||
b7d5fd4eaf | |||
a93402e27b | |||
92f41f43c5 | |||
392ee9fa07 | |||
0886f9ccd3 | |||
51abe5565c | |||
fda01502b2 | |||
8859871e89 | |||
93d99630a9 | |||
47ae79e123 | |||
f9ad00c2c8 | |||
566af259db | |||
d9a6431078 | |||
e9c9375e78 | |||
7c99c8aabf | |||
88eb8f88a7 | |||
fd118c2c37 | |||
858b6b5471 | |||
f086826942 | |||
9c84dc2bc0 | |||
cba0f3ac1f | |||
b9a130ab00 | |||
688056352b | |||
2a40f52dea | |||
3ed369de19 | |||
bec51401a3 | |||
109f884b5f | |||
8f3fa419c4 | |||
a9f08bc885 | |||
a8923ec729 | |||
4eafd043a3 | |||
826cc8c835 | |||
d1dbf777a4 | |||
823e78377b | |||
87a2e81ec3 | |||
88775334b7 | |||
e126547e97 | |||
c1163cdb2e | |||
30d06b7801 | |||
a5cf7bf2c2 | |||
3d4d413de8 | |||
b97e843849 | |||
48c7a3e94e | |||
7263290bbe | |||
e99c4e3289 | |||
87cb26189f | |||
2dae336a5f | |||
258ed1469b | |||
6f3eabba0e | |||
804228fa6c | |||
be85708e5a | |||
f2368f97df | |||
df87bcb743 | |||
5653d0f175 | |||
b022a97196 | |||
cb596ee6ea | |||
4e391136c0 | |||
a6a0e1d12f | |||
d2776eed5a | |||
6528c60f4d | |||
7ee46be2ac | |||
13bc231091 | |||
55d1a40394 | |||
d70f99b489 | |||
fde9735da2 | |||
20f0aa3656 | |||
0b7bf2d26d | |||
f10e38af63 | |||
21727ebfc7 | |||
e322ee85fd | |||
541255fe7e | |||
20c2f36f6c | |||
744f7a18ae | |||
18eece0b71 | |||
4f12dcf966 | |||
ee832528db | |||
bb5d6c91da | |||
6d4adecb32 | |||
c37b13dcb3 | |||
086dac2ea4 | |||
b2b8598b5b | |||
61e5d9f1b6 | |||
c8989b3332 | |||
9f54472dd6 | |||
115932c65a |
@ -1008,6 +1008,6 @@ ij_html_uniform_ident = false
|
||||
indent_size = 2
|
||||
ij_yaml_keep_indents_on_empty_lines = false
|
||||
ij_yaml_keep_line_breaks = true
|
||||
ij_yaml_space_before_colon = true
|
||||
ij_yaml_space_before_colon = false
|
||||
ij_yaml_spaces_within_braces = true
|
||||
ij_yaml_spaces_within_brackets = true
|
||||
|
12
.github/FUNDING.yml
vendored
12
.github/FUNDING.yml
vendored
@ -1,12 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [NotMyFault, dordsor21, SirYwell]
|
||||
patreon: IntellectualSites # Replace with a single Patreon username
|
||||
open_collective: IntellectualSites
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://www.paypal.me/AlexanderBrandes # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -18,8 +18,6 @@ body:
|
||||
options:
|
||||
- Paper
|
||||
- Spigot
|
||||
- Tuinity
|
||||
- Purpur
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@ -29,6 +27,8 @@ body:
|
||||
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
|
||||
multiple: false
|
||||
options:
|
||||
- '1.18.1'
|
||||
- '1.18'
|
||||
- '1.17.1'
|
||||
- '1.16.5'
|
||||
- '1.15.2'
|
||||
|
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,17 +0,0 @@
|
||||
## Overview
|
||||
<!-- Please describe which issue this Pull Request targets
|
||||
|
||||
If there is no issue, please create one so we can look into it before approving your PR.
|
||||
You can do so here: https://github.com/IntellectualSites/PlotSquared/issues
|
||||
-->
|
||||
|
||||
**Fixes {Link to issue}**
|
||||
|
||||
## Description
|
||||
|
||||
## Checklist
|
||||
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
|
||||
- [] I included all information required in the sections above
|
||||
- [] I tested my changes and approved their functionality
|
||||
- [] I ensured my changes do not break other parts of the code
|
||||
- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/PlotSquared/blob/v6/CONTRIBUTING.md)
|
1
.github/release-drafter.yml
vendored
Normal file
1
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
_extends: .github
|
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@ -1,4 +1,4 @@
|
||||
daysUntilStale: 60
|
||||
daysUntilStale: 30
|
||||
daysUntilClose: 7
|
||||
only: issues
|
||||
exemptLabels:
|
||||
|
46
.github/workflows/build.yml
vendored
46
.github/workflows/build.yml
vendored
@ -1,17 +1,41 @@
|
||||
name: "build"
|
||||
name: build
|
||||
|
||||
on: ["pull_request", "push"]
|
||||
on: [ pull_request, push ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/checkout@v2.3.4"
|
||||
- name: "Setup JDK 16"
|
||||
uses: "actions/setup-java@v2.2.0"
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2.4.0
|
||||
- name: Validate Gradle Wrapper"
|
||||
uses: gradle/wrapper-validation-action@v1.0.4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v2.4.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "16"
|
||||
- name: "Clean Build"
|
||||
run: "./gradlew clean build"
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
- name: Clean Build
|
||||
run: ./gradlew clean build
|
||||
- name: Determine release status
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
run: |
|
||||
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
||||
echo "STATUS=snapshot" >> $GITHUB_ENV
|
||||
else
|
||||
echo "STATUS=release" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Publish Release
|
||||
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
|
||||
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||
- name: Publish Snapshot
|
||||
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}
|
||||
run: ./gradlew publishToSonatype
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||
|
14
.github/workflows/release-drafter.yml
vendored
Normal file
14
.github/workflows/release-drafter.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: draft release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- v6
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.15.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
12
.github/workflows/validate-gradle-wrapper.yml
vendored
12
.github/workflows/validate-gradle-wrapper.yml
vendored
@ -1,12 +0,0 @@
|
||||
name: "validate gradle wrapper"
|
||||
|
||||
on: ["pull_request", "push"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/checkout@v2.3.4"
|
||||
- name: "Validate Gradle Wrapper"
|
||||
uses: "gradle/wrapper-validation-action@v1.0.4"
|
13
.whitesource
Normal file
13
.whitesource
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"scanSettings": {
|
||||
"baseBranches": ["v6"]
|
||||
},
|
||||
"checkRunSettings": {
|
||||
"vulnerableCheckRunConclusionLevel": "success",
|
||||
"displayMode": "diff"
|
||||
},
|
||||
"issueSettings": {
|
||||
"minSeverityLevel": "LOW"
|
||||
},
|
||||
"enableRenovate": "true"
|
||||
}
|
@ -24,7 +24,7 @@ dependencies {
|
||||
implementation(libs.bstats)
|
||||
|
||||
// Paper
|
||||
compileOnlyApi(libs.paper)
|
||||
compileOnly(libs.paper)
|
||||
implementation(libs.paperlib)
|
||||
|
||||
// Plugins
|
||||
@ -32,8 +32,8 @@ dependencies {
|
||||
exclude(group = "org.bukkit")
|
||||
exclude(group = "org.spigotmc")
|
||||
}
|
||||
compileOnlyApi(libs.fastasyncworldeditBukkit)
|
||||
testImplementation(libs.fastasyncworldeditBukkit)
|
||||
compileOnly(libs.fastasyncworldeditBukkit) { isTransitive = false }
|
||||
testImplementation(libs.fastasyncworldeditBukkit) { isTransitive = false }
|
||||
compileOnly(libs.vault) {
|
||||
exclude(group = "org.bukkit")
|
||||
}
|
||||
@ -80,6 +80,10 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
|
||||
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
|
||||
relocate("org.incendo.serverlib", "com.plotsquared.bukkit.serverlib")
|
||||
relocate("org.jetbrains", "com.plotsquared.core.annotations")
|
||||
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
|
||||
relocate("javax.annotation", "com.plotsquared.core.annotation")
|
||||
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
|
||||
|
||||
// Get rid of all the libs which are 100% unused.
|
||||
minimize()
|
||||
@ -91,10 +95,11 @@ tasks {
|
||||
withType<Javadoc> {
|
||||
val opt = options as StandardJavadocDocletOptions
|
||||
opt.links("https://papermc.io/javadocs/paper/1.17/")
|
||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.6/")
|
||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.6/")
|
||||
opt.links("https://jd.adventure.kyori.net/api/4.9.1/")
|
||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.7/")
|
||||
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.7/")
|
||||
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
|
||||
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
|
||||
opt.links("https://checkerframework.org/api/")
|
||||
opt.links("https://notmyfault.github.io/MiniMessage-Javadocs/") // Temporary hosting until Kyori adds hosted Javadocs
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.bukkit;
|
||||
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.command.MainCommand;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
@ -42,6 +43,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
@ -63,7 +65,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(
|
||||
CommandSender commandSender, Command command, String s,
|
||||
CommandSender commandSender, Command command, String label,
|
||||
String[] args
|
||||
) {
|
||||
if (!(commandSender instanceof Player)) {
|
||||
@ -73,8 +75,11 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 0) {
|
||||
return Collections.singletonList("plots");
|
||||
}
|
||||
if (!Settings.Enabled_Components.TAB_COMPLETED_ALIASES.contains(label.toLowerCase(Locale.ENGLISH))) {
|
||||
return List.of();
|
||||
}
|
||||
Collection<com.plotsquared.core.command.Command> objects =
|
||||
MainCommand.getInstance().tab(player, args, s.endsWith(" "));
|
||||
MainCommand.getInstance().tab(player, args, label.endsWith(" "));
|
||||
if (objects == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1180,6 +1180,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
return this.injector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull PlotAreaManager plotAreaManager() {
|
||||
return this.plotAreaManager;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
|
@ -68,7 +68,7 @@ import com.plotsquared.core.util.task.TaskTime;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
@ -282,16 +282,16 @@ public class BlockEventListener implements Listener {
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||
event.setCancelled(true);
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("height.height_limit"),
|
||||
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||
TranslatableCaption.miniMessage("height.height_limit"),
|
||||
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||
);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -307,8 +307,8 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
plot.debug(player.getName() + " could not place " + event.getBlock().getType()
|
||||
@ -318,8 +318,7 @@ public class BlockEventListener implements Listener {
|
||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -335,8 +334,8 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -357,8 +356,8 @@ public class BlockEventListener implements Listener {
|
||||
if (!Permissions
|
||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -368,9 +367,9 @@ public class BlockEventListener implements Listener {
|
||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
|
||||
event.setCancelled(true);
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("height.height_limit"),
|
||||
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||
TranslatableCaption.miniMessage("height.height_limit"),
|
||||
Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
|
||||
Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
|
||||
);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
@ -394,15 +393,14 @@ public class BlockEventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -421,8 +419,8 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1096,24 +1094,24 @@ public class BlockEventListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.util.ReflectionUtils.RefClass;
|
||||
import com.plotsquared.core.util.ReflectionUtils.RefField;
|
||||
import com.plotsquared.core.util.ReflectionUtils.RefMethod;
|
||||
@ -295,7 +296,7 @@ public class ChunkListener implements Listener {
|
||||
Chunk chunk = event.getChunk();
|
||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||
String world = chunk.getWorld().getName();
|
||||
if (this.plotAreaManager.hasPlotArea(world)) {
|
||||
if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(world)) {
|
||||
if (unloadChunk(world, chunk, true)) {
|
||||
return;
|
||||
}
|
||||
@ -365,8 +366,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
|
||||
private void cleanChunk(final Chunk chunk) {
|
||||
TaskManager.index.incrementAndGet();
|
||||
final int currentIndex = TaskManager.index.get();
|
||||
final int currentIndex = TaskManager.index.incrementAndGet();
|
||||
PlotSquaredTask task = TaskManager.runTaskRepeat(() -> {
|
||||
if (!chunk.isLoaded()) {
|
||||
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();
|
||||
|
@ -371,14 +371,14 @@ public class EntityEventListener implements Listener {
|
||||
if (shooter instanceof Player) {
|
||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
return;
|
||||
}
|
||||
entity.remove();
|
||||
|
@ -75,7 +75,7 @@ public class EntitySpawnListener implements Listener {
|
||||
|
||||
public static void testCreate(final Entity entity) {
|
||||
@NonNull World world = entity.getWorld();
|
||||
if (areaName == world.getName()) {
|
||||
if (areaName.equals(world.getName())) {
|
||||
} else {
|
||||
areaName = world.getName();
|
||||
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
|
||||
|
@ -39,12 +39,14 @@ import com.plotsquared.core.command.MainCommand;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.TileState;
|
||||
@ -53,7 +55,6 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -301,8 +302,8 @@ public class PaperListener implements Listener {
|
||||
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
||||
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||
TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
event.setBuild(false);
|
||||
@ -321,9 +322,6 @@ public class PaperListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Projectile entity = event.getProjectile();
|
||||
if (!(entity instanceof ThrownPotion)) {
|
||||
return;
|
||||
}
|
||||
ProjectileSource shooter = entity.getShooter();
|
||||
if (!(shooter instanceof Player)) {
|
||||
return;
|
||||
@ -332,12 +330,37 @@ public class PaperListener implements Listener {
|
||||
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -33,7 +33,7 @@ import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Beacon;
|
||||
import org.bukkit.block.Bed;
|
||||
@ -83,8 +83,8 @@ public class PaperListener113 extends PaperListener {
|
||||
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
||||
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||
TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
event.setBuild(false);
|
||||
|
@ -87,7 +87,7 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
@ -127,7 +127,6 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
@ -309,7 +308,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
perm = "plots.admin.command.blocked-cmds.road";
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, perm)) {
|
||||
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
|
||||
plotPlayer.sendMessage(TranslatableCaption.miniMessage("blockedcmds.command_blocked"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
@ -362,11 +361,11 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
|
||||
if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString()) && Settings.Enabled_Components.UPDATE_NOTIFICATIONS
|
||||
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
|
||||
Caption boundary = TranslatableCaption.of("update.update_boundary");
|
||||
Caption updateNotification = TranslatableCaption.of("update.update_notification");
|
||||
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString());
|
||||
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion);
|
||||
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
|
||||
Caption boundary = TranslatableCaption.miniMessage("update.update_boundary");
|
||||
Caption updateNotification = TranslatableCaption.miniMessage("update.update_notification");
|
||||
Placeholder<?> internalVersion = Placeholder.miniMessage("p2version", UpdateUtility.internalVersion.versionString());
|
||||
Placeholder<?> spigotVersion = Placeholder.miniMessage("spigotversion", UpdateUtility.spigotVersion);
|
||||
Placeholder<?> downloadUrl = Placeholder.miniMessage("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
|
||||
pp.sendMessage(boundary);
|
||||
pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
|
||||
pp.sendMessage(boundary);
|
||||
@ -418,8 +417,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
.getHomeSynchronous()
|
||||
.equals(BukkitUtil.adaptComplete(to)))) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -507,7 +506,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||
// Cancel teleport
|
||||
if (TaskManager.removeFromTeleportQueue(pp.getName())) {
|
||||
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
|
||||
}
|
||||
// Set last location
|
||||
Location location = BukkitUtil.adapt(to);
|
||||
@ -534,8 +533,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
|
||||
);
|
||||
this.tmpTeleport = false;
|
||||
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
|
||||
@ -552,8 +551,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
ForceFieldListener.handleForcefield(player, pp, now);
|
||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
);
|
||||
this.tmpTeleport = false;
|
||||
to.setX(from.getBlockX());
|
||||
@ -564,19 +563,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
int border = area.getBorder();
|
||||
int x1;
|
||||
if (x2 > border && this.tmpTeleport) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
to.setX(border - 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
|
||||
}
|
||||
if (x2 < -border && this.tmpTeleport) {
|
||||
} else if (x2 < -border && this.tmpTeleport) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
to.setX(-border + 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
|
||||
}
|
||||
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
int z2;
|
||||
@ -585,7 +596,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||
// Cancel teleport
|
||||
if (TaskManager.removeFromTeleportQueue(pp.getName())) {
|
||||
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
|
||||
}
|
||||
// Set last location
|
||||
Location location = BukkitUtil.adapt(to);
|
||||
@ -612,8 +623,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
|
||||
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
|
||||
);
|
||||
this.tmpTeleport = false;
|
||||
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
|
||||
@ -630,8 +641,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
ForceFieldListener.handleForcefield(player, pp, now);
|
||||
} else if (!plotEntry(pp, now) && this.tmpTeleport) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
|
||||
);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(from);
|
||||
@ -643,18 +654,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
int border = area.getBorder();
|
||||
int z1;
|
||||
if (z2 > border && this.tmpTeleport) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
to.setZ(border - 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
|
||||
}
|
||||
} else if (z2 < -border && this.tmpTeleport) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
to.setZ(-border + 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
|
||||
}
|
||||
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -702,45 +726,45 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
String sender = event.getPlayer().getDisplayName();
|
||||
PlotId id = plot.getId();
|
||||
String worldName = plot.getWorldName();
|
||||
Caption msg = TranslatableCaption.of("chat.plot_chat_format");
|
||||
Template msgTemplate;
|
||||
Template worldNameTemplate = Template.of("world", worldName);
|
||||
Template plotTemplate = Template.of("plot_id", id.toString());
|
||||
Template senderTemplate = Template.of("sender", sender);
|
||||
Caption msg = TranslatableCaption.miniMessage("chat.plot_chat_format");
|
||||
Placeholder<?> msgTemplate;
|
||||
Placeholder<?> worldNameTemplate = Placeholder.miniMessage("world", worldName);
|
||||
Placeholder<?> plotTemplate = Placeholder.miniMessage("plot_id", id.toString());
|
||||
Placeholder<?> senderTemplate = Placeholder.miniMessage("sender", sender);
|
||||
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
|
||||
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
|
||||
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
|
||||
// allowing colour.
|
||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
||||
msgTemplate = Template
|
||||
.of(
|
||||
msgTemplate = Placeholder
|
||||
.miniMessage(
|
||||
"msg",
|
||||
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
|
||||
'&',
|
||||
message
|
||||
))
|
||||
)).toString()
|
||||
);
|
||||
} else {
|
||||
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
|
||||
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
|
||||
msgTemplate = Placeholder.miniMessage("msg", BukkitUtil.MINI_MESSAGE.deserialize(
|
||||
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))).toString());
|
||||
}
|
||||
for (PlotPlayer<?> receiver : plotRecipients) {
|
||||
receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
|
||||
}
|
||||
if (!spies.isEmpty()) {
|
||||
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
||||
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
||||
Template spysenderTemplate = Template.of("sender", sender);
|
||||
Template spymessageTemplate = Template.of("msg", Component.text(message));
|
||||
Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
|
||||
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
|
||||
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
|
||||
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
|
||||
for (PlotPlayer<?> player : spies) {
|
||||
player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
|
||||
}
|
||||
}
|
||||
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
|
||||
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
||||
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
||||
Template spysenderTemplate = Template.of("sender", sender);
|
||||
Template spymessageTemplate = Template.of("msg", Component.text(message));
|
||||
Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
|
||||
Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
|
||||
Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
|
||||
Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
|
||||
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
|
||||
spymessageTemplate
|
||||
);
|
||||
@ -895,16 +919,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
);
|
||||
cancelled = true;
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
);
|
||||
cancelled = true;
|
||||
}
|
||||
@ -913,8 +937,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
);
|
||||
cancelled = true;
|
||||
}
|
||||
@ -951,8 +975,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -960,8 +984,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -970,8 +993,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -985,8 +1008,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
);
|
||||
e.setCancelled(true);
|
||||
plot.debug(pp.getName() + " could not interact with " + entity.getType()
|
||||
@ -1201,8 +1224,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (!plot.hasOwner()) {
|
||||
@ -1210,31 +1233,23 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
|
||||
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
|
||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
||||
if (blockTypeWrapper.accepts(blockType)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
return;
|
||||
}
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1274,8 +1289,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (!plot.hasOwner()) {
|
||||
@ -1283,32 +1298,23 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
|
||||
Block block = event.getBlockClicked();
|
||||
final BlockType blockType = BukkitAdapter.asBlockType(block.getType());
|
||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
||||
if (blockTypeWrapper.accepts(blockType)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
return;
|
||||
}
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1333,8 +1339,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1342,8 +1348,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1353,8 +1359,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!plot.getFlag(HangingPlaceFlag.class)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1382,16 +1388,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1401,8 +1407,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
plot.debug(p.getName()
|
||||
@ -1423,8 +1429,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1433,8 +1439,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
plot.debug(player.getName()
|
||||
@ -1465,16 +1471,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (plot == null && !area.isRoadFlags()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (plot != null && !plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1531,8 +1537,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1553,8 +1559,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1562,8 +1568,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -1576,8 +1582,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
|
||||
);
|
||||
event.setCancelled(true);
|
||||
plot.debug(pp.getName()
|
||||
@ -1588,43 +1594,6 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
||||
Location location = BukkitUtil.adapt(event.getEgg().getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
BukkitPlayer plotPlayer = BukkitUtil.adapt(player);
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||
);
|
||||
event.setHatching(false);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||
);
|
||||
event.setHatching(false);
|
||||
}
|
||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
event.setHatching(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemDrop(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -28,6 +28,7 @@ package com.plotsquared.bukkit.listener;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -36,6 +37,7 @@ import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotHandler;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -96,9 +98,6 @@ public class ProjectileEventListener implements Listener {
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Projectile entity = event.getEntity();
|
||||
if (!(entity instanceof ThrownPotion)) {
|
||||
return;
|
||||
}
|
||||
ProjectileSource shooter = entity.getShooter();
|
||||
if (!(shooter instanceof Player)) {
|
||||
return;
|
||||
@ -109,10 +108,35 @@ public class ProjectileEventListener implements Listener {
|
||||
}
|
||||
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -131,14 +155,14 @@ public class ProjectileEventListener implements Listener {
|
||||
if (shooter instanceof Player) {
|
||||
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||
.hasPermission(pp, Permission.PERMISSION_PROJECTILE_OTHER)) {
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
return;
|
||||
}
|
||||
entity.remove();
|
||||
|
@ -50,7 +50,7 @@ public class ServerListener implements Listener {
|
||||
public void onServerLoad(ServerLoadEvent event) {
|
||||
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
|
||||
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
|
||||
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
||||
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.miniMessage("placeholder.hooked"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.bukkit.listener;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.util.ReflectionUtils;
|
||||
import org.bukkit.Chunk;
|
||||
@ -86,7 +87,7 @@ public class SingleWorldListener implements Listener {
|
||||
if (!(man instanceof SinglePlotAreaManager)) {
|
||||
return;
|
||||
}
|
||||
if (!isPlotId(name)) {
|
||||
if (!SinglePlotArea.isSinglePlotWorld(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -103,31 +104,4 @@ public class SingleWorldListener implements Listener {
|
||||
handle(event);
|
||||
}
|
||||
|
||||
private boolean isPlotId(String worldName) {
|
||||
int len = worldName.length();
|
||||
int separator = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
switch (worldName.charAt(i)) {
|
||||
case '_':
|
||||
separator++;
|
||||
break;
|
||||
case '-':
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return separator == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import com.plotsquared.core.util.EntityUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.entity.EntityCategories;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -178,8 +178,7 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions
|
||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
|
||||
TranslatableCaption.miniMessage("done.building_restricted")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -188,8 +187,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -200,8 +199,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName()
|
||||
@ -221,8 +220,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -242,8 +241,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -256,8 +255,8 @@ public class BukkitEntityUtil {
|
||||
if (!plot.getFlag(PvpFlag.class) && !Permissions
|
||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
);
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
+ " because pve = false");
|
||||
@ -270,8 +269,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -287,8 +286,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -309,8 +308,8 @@ public class BukkitEntityUtil {
|
||||
}
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TranslatableCaption.miniMessage("permission.no_permission_event"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
|
@ -176,7 +176,7 @@ public class BukkitRegionManager extends RegionManager {
|
||||
final boolean ignoreAugment,
|
||||
final @Nullable Runnable whenDone
|
||||
) {
|
||||
final BukkitWorld world = new BukkitWorld((World) pos1.getWorld());
|
||||
final BukkitWorld world = (BukkitWorld) worldUtil.getWeWorld(pos1.getWorldName());
|
||||
|
||||
final int p1x = pos1.getX();
|
||||
final int p1z = pos1.getZ();
|
||||
|
@ -53,7 +53,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -337,7 +338,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setSign(
|
||||
final @NonNull Location location, final @NonNull Caption[] lines,
|
||||
final @NonNull Template... replacements
|
||||
final @NonNull Placeholder<?>... replacements
|
||||
) {
|
||||
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -369,7 +370,8 @@ public class BukkitUtil extends WorldUtil {
|
||||
if (blockstate instanceof final Sign sign) {
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
||||
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
|
||||
.serialize(MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()),
|
||||
PlaceholderResolver.placeholders(replacements))));
|
||||
}
|
||||
sign.update(true);
|
||||
}
|
||||
|
@ -248,9 +248,12 @@ permissions:
|
||||
plots.admin.components.other: true
|
||||
plots.admin.vehicle.break.unowned: true
|
||||
plots.admin.pve.unowned: true
|
||||
plots.admin.border.bypass: true
|
||||
|
||||
plots.teleport.delay.bypass:
|
||||
default: op
|
||||
plots.admin.border.bypass:
|
||||
default: op
|
||||
plots.worldedit.bypass:
|
||||
default: op
|
||||
plots.gamemode.bypass:
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Contributing
|
||||
If you feel like you can improve the plugin any way, then you are more than welcome to contribute to PlotSquared. It would be highly appreciated if you made sure to test your code before committing it, as it will save us a lot of time and effort.
|
||||
|
||||
### Code Style
|
||||
If you are planning to commit any changes to the project, it would be highly appreciated if you were to follow the project
|
||||
code style conventions. To make this easier we have provided settings that can be picked up by your IDE.
|
||||
|
||||
IntelliJ: Install the `EditorConfig` plugin. Now IntelliJ is able to pick up the provided `.editorconfig` file automatically.
|
@ -5,8 +5,8 @@ dependencies {
|
||||
compileOnlyApi(libs.checkerqual)
|
||||
|
||||
// Minecraft expectations
|
||||
compileOnlyApi(libs.guava)
|
||||
compileOnlyApi(libs.gson)
|
||||
compileOnly(libs.guava)
|
||||
|
||||
// Platform expectations
|
||||
compileOnlyApi(libs.snakeyaml)
|
||||
@ -25,14 +25,14 @@ dependencies {
|
||||
compileOnlyApi(libs.findbugs)
|
||||
|
||||
// Plugins
|
||||
compileOnlyApi(libs.worldeditCore) {
|
||||
compileOnly(libs.worldeditCore) {
|
||||
exclude(group = "bukkit-classloader-check")
|
||||
exclude(group = "mockito-core")
|
||||
exclude(group = "dummypermscompat")
|
||||
}
|
||||
testImplementation(libs.worldeditCore)
|
||||
compileOnlyApi(libs.fastasyncworldeditCore)
|
||||
testImplementation(libs.fastasyncworldeditCore)
|
||||
compileOnly(libs.fastasyncworldeditCore) { isTransitive = false }
|
||||
testImplementation(libs.fastasyncworldeditCore) { isTransitive = false }
|
||||
|
||||
// Logging
|
||||
compileOnlyApi(libs.log4j)
|
||||
@ -40,7 +40,7 @@ dependencies {
|
||||
// Other libraries
|
||||
api(libs.prtree)
|
||||
api(libs.aopalliance)
|
||||
api(libs.pipeline) {
|
||||
api(libs.rorledning) {
|
||||
exclude(group = "com.google.guava")
|
||||
}
|
||||
api(libs.arkitektonika)
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@ -152,9 +152,9 @@ public class PlotAPI {
|
||||
*/
|
||||
public void sendConsoleMessage(
|
||||
final @NonNull String message,
|
||||
final @NonNull Template @NonNull ... replacements
|
||||
final @NonNull Placeholder<?> @NonNull ... replacements
|
||||
) {
|
||||
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
|
||||
ConsolePlayer.getConsole().sendMessage(StaticCaption.miniMessage(message), replacements);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,7 +165,7 @@ public class PlotAPI {
|
||||
*/
|
||||
public void sendConsoleMessage(
|
||||
final @NonNull Caption caption,
|
||||
final @NonNull Template @NonNull ... replacements
|
||||
final @NonNull Placeholder<?> @NonNull ... replacements
|
||||
) {
|
||||
ConsolePlayer.getConsole().sendMessage(caption, replacements);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import com.plotsquared.core.inject.annotations.DefaultGenerator;
|
||||
import com.plotsquared.core.location.World;
|
||||
import com.plotsquared.core.permissions.PermissionHandler;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
@ -268,6 +269,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
||||
return injector().getInstance(ChunkManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link PlotAreaManager} implementation.
|
||||
*
|
||||
* @return the PlotAreaManager
|
||||
*/
|
||||
@NonNull PlotAreaManager plotAreaManager();
|
||||
|
||||
/**
|
||||
* Get the platform specific console {@link Audience}
|
||||
*
|
||||
|
@ -283,7 +283,7 @@ public class PlotSquared {
|
||||
* @return Plot area manager
|
||||
*/
|
||||
public @NonNull PlotAreaManager getPlotAreaManager() {
|
||||
return this.platform.injector().getInstance(PlotAreaManager.class);
|
||||
return this.platform.plotAreaManager();
|
||||
}
|
||||
|
||||
public void startExpiryTasks() {
|
||||
@ -758,6 +758,9 @@ public class PlotSquared {
|
||||
if (this_max < last_max) {
|
||||
plot.getArea().setMeta("lastPlot", plot.getId());
|
||||
}
|
||||
if (callEvent) {
|
||||
eventDispatcher.callPostDelete(plot);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -193,7 +193,15 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
future.completeExceptionally(new IllegalArgumentException(
|
||||
"The backup is non-existent or not in the correct format"));
|
||||
} else {
|
||||
this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, player, new RunnableVal<Boolean>() {
|
||||
this.schematicHandler.paste(
|
||||
schematic,
|
||||
plot,
|
||||
0,
|
||||
plot.getArea().getMinBuildHeight(),
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
if (value) {
|
||||
@ -201,11 +209,12 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
} else {
|
||||
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
|
||||
TranslatableCaption
|
||||
.of("schematics.schematic_paste_failed")
|
||||
.miniMessage("schematics.schematic_paste_failed")
|
||||
.getComponent(ConsolePlayer.getConsole()))));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -31,13 +31,12 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.Placeholders;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@ -106,22 +105,22 @@ public class SimpleBackupManager implements BackupManager {
|
||||
} else {
|
||||
if (player != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_automatic_started"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("backups.backup_automatic_started"),
|
||||
Placeholders.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
profile.createBackup().whenComplete((backup, throwable) -> {
|
||||
if (throwable != null) {
|
||||
if (player != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_automatic_failure"),
|
||||
Templates.of("reason", throwable.getMessage())
|
||||
TranslatableCaption.miniMessage("backups.backup_automatic_failure"),
|
||||
Placeholders.miniMessage("reason", throwable.getMessage())
|
||||
);
|
||||
}
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
if (player != null) {
|
||||
player.sendMessage(TranslatableCaption.of("backups.backup_automatic_finished"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_automatic_finished"));
|
||||
TaskManager.runTaskAsync(whenDone);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -69,33 +69,33 @@ public class Add extends Command {
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone
|
||||
) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
checkTrue(
|
||||
plot.isOwner(player.getUUID()) || Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
|
||||
TranslatableCaption.of("permission.no_plot_perms")
|
||||
TranslatableCaption.miniMessage("permission.no_plot_perms")
|
||||
);
|
||||
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot add <player | *>")
|
||||
checkTrue(args.length == 1, TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot add <player | *>")
|
||||
);
|
||||
final CompletableFuture<Boolean> future = new CompletableFuture<>();
|
||||
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
||||
if (throwable != null) {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
}
|
||||
future.completeExceptionally(throwable);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
checkTrue(!uuids.isEmpty(), TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
Iterator<UUID> iterator = uuids.iterator();
|
||||
int size = plot.getTrusted().size() + plot.getMembers().size();
|
||||
@ -105,24 +105,24 @@ public class Add extends Command {
|
||||
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", PlayerManager.getName(uuid))
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", PlayerManager.getName(uuid))
|
||||
);
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
if (plot.isOwner(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.already_added"),
|
||||
Template.of("player", PlayerManager.getName(uuid))
|
||||
TranslatableCaption.miniMessage("member.already_added"),
|
||||
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
|
||||
);
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
if (plot.getMembers().contains(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.already_added"),
|
||||
Template.of("player", PlayerManager.getName(uuid))
|
||||
TranslatableCaption.miniMessage("member.already_added"),
|
||||
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
|
||||
);
|
||||
iterator.remove();
|
||||
continue;
|
||||
@ -132,10 +132,10 @@ public class Add extends Command {
|
||||
checkTrue(!uuids.isEmpty(), null);
|
||||
int localAddSize = plot.getMembers().size();
|
||||
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
|
||||
if (localAddSize > maxAddSize) {
|
||||
if (localAddSize >= maxAddSize) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("members.plot_max_members_added"),
|
||||
Template.of("amount", String.valueOf(localAddSize))
|
||||
TranslatableCaption.miniMessage("members.plot_max_members_added"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(localAddSize))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -151,7 +151,7 @@ public class Add extends Command {
|
||||
}
|
||||
plot.addMember(uuid);
|
||||
this.eventDispatcher.callMember(player, plot, uuid, true);
|
||||
player.sendMessage(TranslatableCaption.of("member.member_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("member.member_added"));
|
||||
}
|
||||
}, null);
|
||||
} catch (final Throwable exception) {
|
||||
@ -166,7 +166,7 @@ public class Add extends Command {
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -67,12 +67,12 @@ public class Alias extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class Alias extends SubCommand {
|
||||
permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET);
|
||||
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET);
|
||||
if (!admin && !owner) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (permission) { // is either admin or owner
|
||||
@ -98,8 +98,8 @@ public class Alias extends SubCommand {
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -107,15 +107,15 @@ public class Alias extends SubCommand {
|
||||
permission = isPermitted(player, Permission.PERMISSION_ALIAS_REMOVE);
|
||||
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE);
|
||||
if (!admin && !owner) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (permission) {
|
||||
result = removeAlias(player, plot);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -147,37 +147,37 @@ public class Alias extends SubCommand {
|
||||
if (alias.isEmpty()) {
|
||||
sendUsage(player);
|
||||
} else if (alias.length() >= 50) {
|
||||
player.sendMessage(TranslatableCaption.of("alias.alias_too_long"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("alias.alias_too_long"));
|
||||
} else if (MathMan.isInteger(alias)) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.not_valid_value")); // TODO this is obviously wrong
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_value")); // TODO this is obviously wrong
|
||||
} else {
|
||||
if (PlotQuery.newQuery().inArea(plot.getArea())
|
||||
.withAlias(alias)
|
||||
.anyMatch()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.alias_is_taken"),
|
||||
Template.of("alias", alias)
|
||||
TranslatableCaption.miniMessage("alias.alias_is_taken"),
|
||||
Placeholder.miniMessage("alias", alias)
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
plot.setAlias(alias);
|
||||
player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("alias", alias));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("alias.alias_set_to"), Placeholder.miniMessage("alias", alias));
|
||||
return;
|
||||
}
|
||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (uuid != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.alias_is_taken"),
|
||||
Template.of("alias", alias)
|
||||
TranslatableCaption.miniMessage("alias.alias_is_taken"),
|
||||
Placeholder.miniMessage("alias", alias)
|
||||
);
|
||||
} else {
|
||||
plot.setAlias(alias);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.alias_set_to"),
|
||||
Template.of("alias", alias)
|
||||
TranslatableCaption.miniMessage("alias.alias_set_to"),
|
||||
Placeholder.miniMessage("alias", alias)
|
||||
);
|
||||
}
|
||||
}));
|
||||
@ -188,12 +188,12 @@ public class Alias extends SubCommand {
|
||||
String alias = plot.getAlias();
|
||||
if (!plot.getAlias().isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.alias_removed"),
|
||||
Template.of("alias", alias)
|
||||
TranslatableCaption.miniMessage("alias.alias_removed"),
|
||||
Placeholder.miniMessage("alias", alias)
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.no_alias_set")
|
||||
TranslatableCaption.miniMessage("alias.no_alias_set")
|
||||
);
|
||||
}
|
||||
plot.setAlias(null);
|
||||
|
@ -29,8 +29,9 @@ import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.Placeholders;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
@ -74,7 +75,8 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.io.File;
|
||||
@ -145,26 +147,26 @@ public class Area extends SubCommand {
|
||||
}
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("single.single_area_needs_name"),
|
||||
Template.of("command", "/plot area single <name>")
|
||||
TranslatableCaption.miniMessage("single.single_area_needs_name"),
|
||||
Placeholder.miniMessage("command", "/plot area single <name>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final PlotArea existingArea = this.plotAreaManager.getPlotArea(player.getLocation().getWorldName(), args[1]);
|
||||
if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_name_taken"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_name_taken"));
|
||||
return false;
|
||||
}
|
||||
final LocalSession localSession = WorldEdit.getInstance().getSessionManager().getIfPresent(player.toActor());
|
||||
if (localSession == null) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
|
||||
return false;
|
||||
}
|
||||
Region playerSelectedRegion = null;
|
||||
@ -173,18 +175,18 @@ public class Area extends SubCommand {
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
if (playerSelectedRegion == null) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
|
||||
return false;
|
||||
}
|
||||
if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_not_square"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_not_square"));
|
||||
return false;
|
||||
}
|
||||
if (this.plotAreaManager.getPlotAreas(
|
||||
Objects.requireNonNull(playerSelectedRegion.getWorld()).getName(),
|
||||
CuboidRegion.makeCuboid(playerSelectedRegion)
|
||||
).length != 0) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_overlapping"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_overlapping"));
|
||||
}
|
||||
// Alter the region
|
||||
final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint();
|
||||
@ -222,11 +224,11 @@ public class Area extends SubCommand {
|
||||
hybridPlotWorld.setAllowSigns(false);
|
||||
final File parentFile = FileUtils.getFile(
|
||||
PlotSquared.platform().getDirectory(),
|
||||
"schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator
|
||||
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator
|
||||
+ hybridPlotWorld.getId()
|
||||
);
|
||||
if (!parentFile.exists() && !parentFile.mkdirs()) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_could_not_make_directories"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_could_not_make_directories"));
|
||||
return false;
|
||||
}
|
||||
final File file = new File(parentFile, "plot.schem");
|
||||
@ -244,7 +246,7 @@ public class Area extends SubCommand {
|
||||
Operations.complete(forwardExtentCopy);
|
||||
clipboardWriter.write(clipboard);
|
||||
} catch (final Exception e) {
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_failed_to_save"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_failed_to_save"));
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
@ -280,11 +282,11 @@ public class Area extends SubCommand {
|
||||
final String world = this.setupUtils.setupWorld(singleBuilder);
|
||||
if (this.worldUtil.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
player.sendMessage(TranslatableCaption.of("single.single_area_created"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.single_area_created"));
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error_create"),
|
||||
Template.of("world", hybridPlotWorld.getWorldName())
|
||||
TranslatableCaption.miniMessage("errors.error_create"),
|
||||
Placeholder.miniMessage("world", hybridPlotWorld.getWorldName())
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -294,16 +296,16 @@ public class Area extends SubCommand {
|
||||
case "c", "setup", "create" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
case 2:
|
||||
@ -316,8 +318,8 @@ public class Area extends SubCommand {
|
||||
.get("area_create_area");
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -327,13 +329,13 @@ public class Area extends SubCommand {
|
||||
location
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("set.set_attribute"),
|
||||
Template.of("attribute", "area_pos1"),
|
||||
Template.of("value", location.getX() + "," + location.getZ())
|
||||
TranslatableCaption.miniMessage("set.set_attribute"),
|
||||
Placeholder.miniMessage("attribute", "area_pos1"),
|
||||
Placeholder.miniMessage("value", location.getX() + "," + location.getZ())
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("area.set_pos2"),
|
||||
Template.of("command", "/plot area create pos2")
|
||||
TranslatableCaption.miniMessage("area.set_pos2"),
|
||||
Placeholder.miniMessage("command", "/plot area create pos2")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -346,8 +348,8 @@ public class Area extends SubCommand {
|
||||
.get("area_create_area");
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -372,8 +374,8 @@ public class Area extends SubCommand {
|
||||
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(area.getWorldName(), region);
|
||||
if (!areas.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_intersection"),
|
||||
Template.of("cluster", areas.iterator().next().toString())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_intersection"),
|
||||
Placeholder.miniMessage("cluster", areas.iterator().next().toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -396,7 +398,7 @@ public class Area extends SubCommand {
|
||||
if (this.worldUtil.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
|
||||
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
|
||||
if (area.getTerrain() != PlotAreaTerrainType.ALL) {
|
||||
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
|
||||
queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
|
||||
@ -411,8 +413,8 @@ public class Area extends SubCommand {
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error_create"),
|
||||
Template.of("world", area.getWorldName())
|
||||
TranslatableCaption.miniMessage("errors.error_create"),
|
||||
Placeholder.miniMessage("world", area.getWorldName())
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -445,8 +447,8 @@ public class Area extends SubCommand {
|
||||
PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id);
|
||||
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("setup.setup_world_taken"),
|
||||
Template.of("value", pa.toString())
|
||||
TranslatableCaption.miniMessage("setup.setup_world_taken"),
|
||||
Placeholder.miniMessage("value", pa.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -460,9 +462,9 @@ public class Area extends SubCommand {
|
||||
String[] pair = args[i].split("=");
|
||||
if (pair.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||
Template.of("value1,", getCommandString()),
|
||||
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
|
||||
Placeholder.miniMessage("value1,", getCommandString()),
|
||||
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -497,9 +499,9 @@ public class Area extends SubCommand {
|
||||
}
|
||||
default -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||
Template.of("value1", getCommandString()),
|
||||
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
|
||||
Placeholder.miniMessage("value1", getCommandString()),
|
||||
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -508,8 +510,8 @@ public class Area extends SubCommand {
|
||||
if (pa.getType() != PlotAreaType.PARTIAL) {
|
||||
if (this.worldUtil.isWorld(pa.getWorldName())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("setup.setup_world_taken"),
|
||||
Template.of("value", pa.getWorldName())
|
||||
TranslatableCaption.miniMessage("setup.setup_world_taken"),
|
||||
Placeholder.miniMessage("value", pa.getWorldName())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -526,11 +528,11 @@ public class Area extends SubCommand {
|
||||
String world = this.setupUtils.setupWorld(builder);
|
||||
if (this.worldUtil.isWorld(world)) {
|
||||
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
|
||||
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error_create"),
|
||||
Template.of("world", pa.getWorldName())
|
||||
TranslatableCaption.miniMessage("errors.error_create"),
|
||||
Placeholder.miniMessage("world", pa.getWorldName())
|
||||
);
|
||||
}
|
||||
try {
|
||||
@ -548,13 +550,13 @@ public class Area extends SubCommand {
|
||||
}
|
||||
if (pa.getId() == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", getUsage())
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", getUsage())
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||
Template.of("value1", getCommandString()),
|
||||
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
|
||||
Placeholder.miniMessage("value1", getCommandString()),
|
||||
Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -570,8 +572,8 @@ public class Area extends SubCommand {
|
||||
}
|
||||
metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("single.get_position"),
|
||||
Template.of("command", getCommandString())
|
||||
TranslatableCaption.miniMessage("single.get_position"),
|
||||
Placeholder.miniMessage("command", getCommandString())
|
||||
);
|
||||
break;
|
||||
}
|
||||
@ -580,8 +582,8 @@ public class Area extends SubCommand {
|
||||
case "i", "info" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -591,18 +593,18 @@ public class Area extends SubCommand {
|
||||
case 2 -> area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
default -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||
Template.of("value1", getCommandString()),
|
||||
Template.of("value2", " info [area]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
|
||||
Placeholder.miniMessage("value1", getCommandString()),
|
||||
Placeholder.miniMessage("value2", " info [area]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (area == null) {
|
||||
if (args.length == 2) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -624,24 +626,24 @@ public class Area extends SubCommand {
|
||||
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
|
||||
region = "N/A";
|
||||
}
|
||||
Template headerTemplate = Template.of(
|
||||
Placeholder<?> headerTemplate = Placeholder.miniMessage(
|
||||
"header",
|
||||
TranslatableCaption.of("info.plot_info_header").getComponent(player)
|
||||
TranslatableCaption.miniMessage("info.plot_info_header").getComponent(player)
|
||||
);
|
||||
Template nameTemplate = Template.of("name", name);
|
||||
Template typeTemplate = Template.of("type", area.getType().name());
|
||||
Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
|
||||
Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
|
||||
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
|
||||
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
|
||||
Template regionTemplate = Template.of("region", region);
|
||||
Template generatorTemplate = Template.of("generator", generator);
|
||||
Template footerTemplate = Template.of(
|
||||
Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name);
|
||||
Placeholder<?> typeTemplate = Placeholder.miniMessage("type", area.getType().name());
|
||||
Placeholder<?> terrainTemplate = Placeholder.miniMessage("terrain", area.getTerrain().name());
|
||||
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent));
|
||||
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
|
||||
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
|
||||
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
|
||||
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
|
||||
Placeholder<?> footerTemplate = Placeholder.miniMessage(
|
||||
"footer",
|
||||
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
|
||||
TranslatableCaption.miniMessage("info.plot_info_footer").getComponent(player)
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("info.area_info_format"),
|
||||
TranslatableCaption.miniMessage("info.area_info_format"),
|
||||
headerTemplate,
|
||||
nameTemplate,
|
||||
typeTemplate,
|
||||
@ -658,8 +660,8 @@ public class Area extends SubCommand {
|
||||
case "l", "list" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -675,9 +677,9 @@ public class Area extends SubCommand {
|
||||
}
|
||||
default:
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||
Template.of("value1", getCommandString()),
|
||||
Template.of("value2", " list [#]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
|
||||
Placeholder.miniMessage("value1", getCommandString()),
|
||||
Placeholder.miniMessage("value2", " list [#]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -703,29 +705,30 @@ public class Area extends SubCommand {
|
||||
percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
|
||||
region = "N/A";
|
||||
}
|
||||
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed));
|
||||
Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%");
|
||||
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters));
|
||||
Template regionTemplate = Template.of("region", region);
|
||||
Template generatorTemplate = Template.of("generator", generator);
|
||||
Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
|
||||
Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent) + "%");
|
||||
Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
|
||||
Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
|
||||
Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
|
||||
String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("info.area_list_tooltip").getComponent(player),
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("info.area_list_tooltip").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
claimedTemplate,
|
||||
usageTemplate,
|
||||
clustersTemplate,
|
||||
regionTemplate,
|
||||
generatorTemplate
|
||||
));
|
||||
Template tooltipTemplate = Template.of("hover_info", tooltip);
|
||||
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
|
||||
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
|
||||
Template numberTemplate = Template.of("number", String.valueOf(i));
|
||||
Template nameTemplate = Template.of("area_name", name);
|
||||
Template typeTemplate = Template.of("area_type", area.getType().name());
|
||||
Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name());
|
||||
caption.set(TranslatableCaption.of("info.area_list_item"));
|
||||
caption.setTemplates(
|
||||
)));
|
||||
Placeholder<?> tooltipTemplate = Placeholder.miniMessage("hover_info", tooltip);
|
||||
Placeholder<?> visitcmdTemplate = Placeholder.miniMessage("command_tp", "/plot area tp " + area);
|
||||
Placeholder<?> infocmdTemplate = Placeholder.miniMessage("command_info", "/plot area info " + area);
|
||||
Placeholder<?> numberTemplate = Placeholder.miniMessage("number", String.valueOf(i));
|
||||
Placeholder<?> nameTemplate = Placeholder.miniMessage("area_name", name);
|
||||
Placeholder<?> typeTemplate = Placeholder.miniMessage("area_type", area.getType().name());
|
||||
Placeholder<?> terrainTemplate = Placeholder.miniMessage("area_terrain", area.getTerrain().name());
|
||||
caption.set(TranslatableCaption.miniMessage("info.area_list_item"));
|
||||
caption.parsePlaceholders(
|
||||
tooltipTemplate,
|
||||
visitcmdTemplate,
|
||||
numberTemplate,
|
||||
@ -735,26 +738,26 @@ public class Area extends SubCommand {
|
||||
infocmdTemplate
|
||||
);
|
||||
}
|
||||
}, "/plot area list", TranslatableCaption.of("list.area_list_header_paged"));
|
||||
}, "/plot area list", TranslatableCaption.miniMessage("list.area_list_header_paged"));
|
||||
return true;
|
||||
}
|
||||
case "regen", "clear", "reset", "regenerate" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
if (area.getType() != PlotAreaType.PARTIAL) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("single.delete_world_region"),
|
||||
Template.of("world", area.getWorldName())
|
||||
TranslatableCaption.miniMessage("single.delete_world_region"),
|
||||
Placeholder.miniMessage("world", area.getWorldName())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -767,28 +770,28 @@ public class Area extends SubCommand {
|
||||
null
|
||||
));
|
||||
queue.addReadChunks(area.getRegion().getChunks());
|
||||
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.of("single.regeneration_complete")));
|
||||
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.miniMessage("single.regeneration_complete")));
|
||||
queue.enqueue();
|
||||
return true;
|
||||
}
|
||||
case "goto", "v", "teleport", "visit", "tp" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_TP))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot area tp [area]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot area tp [area]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1]));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
|
||||
return false;
|
||||
}
|
||||
Location center;
|
||||
@ -816,7 +819,7 @@ public class Area extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "delete", "remove" -> {
|
||||
player.sendMessage(TranslatableCaption.of("single.worldcreation_location"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("single.worldcreation_location"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -856,11 +859,11 @@ public class Area extends SubCommand {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ import com.plotsquared.core.util.PlotExpression;
|
||||
import com.plotsquared.core.util.task.AutoClaimFinishTask;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@ -116,14 +116,14 @@ public class Auto extends SubCommand {
|
||||
int grantedPlots = metaDataAccess.get().orElse(0);
|
||||
if (diff < 0 && grantedPlots < sizeX * sizeZ) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(diff + grantedPlots))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
|
||||
);
|
||||
return false;
|
||||
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(diff + grantedPlots))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
|
||||
);
|
||||
return false;
|
||||
} else {
|
||||
@ -134,15 +134,15 @@ public class Auto extends SubCommand {
|
||||
metaDataAccess.set(left);
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_granted_plot"),
|
||||
Template.of("usedGrants", String.valueOf(grantedPlots - left)),
|
||||
Template.of("remainingGrants", String.valueOf(left))
|
||||
TranslatableCaption.miniMessage("economy.removed_granted_plot"),
|
||||
Placeholder.miniMessage("usedGrants", String.valueOf(grantedPlots - left)),
|
||||
Placeholder.miniMessage("remainingGrants", String.valueOf(left))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(player.getAllowedPlots())
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots())
|
||||
)
|
||||
);
|
||||
return false;
|
||||
@ -205,7 +205,7 @@ public class Auto extends SubCommand {
|
||||
plotarea = this.plotAreaManager.getAllPlotAreas()[0];
|
||||
}
|
||||
if (plotarea == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -221,13 +221,13 @@ public class Auto extends SubCommand {
|
||||
sizeZ = Integer.parseInt(split[1]);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", getUsage())
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", getUsage())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (sizeX < 1 || sizeZ < 1) {
|
||||
player.sendMessage(TranslatableCaption.of("error.plot_size_negative"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("error.plot_size_negative"));
|
||||
return true;
|
||||
}
|
||||
if (args.length > 1) {
|
||||
@ -244,8 +244,8 @@ public class Auto extends SubCommand {
|
||||
.callAuto(player, plotarea, schematic, sizeX, sizeZ);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Auto claim")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Auto claim")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -255,14 +255,14 @@ public class Auto extends SubCommand {
|
||||
schematic = event.getSchematic();
|
||||
if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA))
|
||||
);
|
||||
}
|
||||
if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots_num"),
|
||||
Template.of("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots_num"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -279,9 +279,9 @@ public class Auto extends SubCommand {
|
||||
if (schematic != null && !schematic.isEmpty()) {
|
||||
if (!plotarea.hasSchematic(schematic)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
||||
Template.of("schemname", schematic),
|
||||
Template.of("reason", "non-existent")
|
||||
TranslatableCaption.miniMessage("schematics.schematic_invalid_named"),
|
||||
Placeholder.miniMessage("schemname", schematic),
|
||||
Placeholder.miniMessage("reason", "non-existent")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -291,8 +291,8 @@ public class Auto extends SubCommand {
|
||||
) && !Permissions
|
||||
.hasPermission(player, "plots.admin.command.schematic")) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", "plots.claim.%s0")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", "plots.claim.%s0")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -305,21 +305,21 @@ public class Auto extends SubCommand {
|
||||
cost = (sizeX * sizeZ) * cost;
|
||||
if (cost > 0d) {
|
||||
if (!this.econHandler.isSupported()) {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("economy.vault_or_consumer_null"));
|
||||
return false;
|
||||
}
|
||||
if (!force && this.econHandler.getMoney(player) < cost) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||
Template.of("money", this.econHandler.format(cost)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(cost)),
|
||||
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
this.econHandler.withdrawMoney(player, cost);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(cost))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(cost))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -332,7 +332,7 @@ public class Auto extends SubCommand {
|
||||
plots = this.eventDispatcher.callAutoPlotsChosen(player, plots).getPlots();
|
||||
|
||||
if (plots.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.no_free_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.no_free_plots"));
|
||||
return false;
|
||||
} else if (plots.size() == 1) {
|
||||
this.claimSingle(player, plots.get(0), plotarea, schematic);
|
||||
@ -344,6 +344,7 @@ public class Auto extends SubCommand {
|
||||
continue;
|
||||
}
|
||||
plot.claim(player, !plotIterator.hasNext(), null, true, true);
|
||||
eventDispatcher.callPostAuto(player, plot);
|
||||
}
|
||||
final PlotAutoMergeEvent mergeEvent = this.eventDispatcher.callAutoMerge(
|
||||
plots.get(0),
|
||||
@ -351,8 +352,8 @@ public class Auto extends SubCommand {
|
||||
);
|
||||
if (!force && mergeEvent.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Auto merge")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Auto merge")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.nio.file.Files;
|
||||
@ -73,8 +73,8 @@ public final class Backup extends Command {
|
||||
|
||||
private static boolean sendMessage(PlotPlayer<?> player) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot backup <save | list | load>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot backup <save | list | load>")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -138,42 +138,42 @@ public final class Backup extends Command {
|
||||
) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
} else if (!plot.hasOwner()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
|
||||
);
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
} else if (plot.isMerged()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
|
||||
);
|
||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
);
|
||||
} else {
|
||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||
if (backupProfile instanceof NullBackupProfile) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
|
||||
);
|
||||
} else {
|
||||
backupProfile.createBackup().whenComplete((backup, throwable) -> {
|
||||
if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_save_failed"),
|
||||
Template.of("reason", throwable.getMessage())
|
||||
TranslatableCaption.miniMessage("backups.backup_save_failed"),
|
||||
Placeholder.miniMessage("reason", throwable.getMessage())
|
||||
);
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("backups.backup_save_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_save_success"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -192,51 +192,51 @@ public final class Backup extends Command {
|
||||
) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
} else if (!plot.hasOwner()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
|
||||
);
|
||||
} else if (plot.isMerged()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
|
||||
);
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
);
|
||||
} else {
|
||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||
if (backupProfile instanceof NullBackupProfile) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
|
||||
);
|
||||
} else {
|
||||
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
||||
if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_list_failed"),
|
||||
Template.of("reason", throwable.getMessage())
|
||||
TranslatableCaption.miniMessage("backups.backup_list_failed"),
|
||||
Placeholder.miniMessage("reason", throwable.getMessage())
|
||||
);
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_list_header"),
|
||||
Template.of("plot", plot.getId().toCommaSeparatedString())
|
||||
TranslatableCaption.miniMessage("backups.backup_list_header"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toCommaSeparatedString())
|
||||
);
|
||||
try {
|
||||
for (int i = 0; i < backups.size(); i++) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_list_entry"),
|
||||
Template.of("number", Integer.toString(i + 1)),
|
||||
Template.of("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
|
||||
TranslatableCaption.miniMessage("backups.backup_list_entry"),
|
||||
Placeholder.miniMessage("number", Integer.toString(i + 1)),
|
||||
Placeholder.miniMessage("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
|
||||
Instant.ofEpochMilli(backups.get(i).getCreationTime()),
|
||||
ZoneId.systemDefault()
|
||||
)))
|
||||
@ -263,29 +263,29 @@ public final class Backup extends Command {
|
||||
) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
} else if (!plot.hasOwner()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
|
||||
);
|
||||
} else if (plot.isMerged()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
|
||||
);
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
|
||||
);
|
||||
} else if (args.length == 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Usage: /plot backup save/list/load")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Usage: /plot backup save/list/load")
|
||||
);
|
||||
} else {
|
||||
final int number;
|
||||
@ -293,32 +293,32 @@ public final class Backup extends Command {
|
||||
number = Integer.parseInt(args[0]);
|
||||
} catch (final Exception e) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("invalid.not_a_number"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
return;
|
||||
}
|
||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||
if (backupProfile instanceof NullBackupProfile) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player))
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
|
||||
);
|
||||
} else {
|
||||
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
||||
if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_load_failure"),
|
||||
Template.of("reason", throwable.getMessage())
|
||||
TranslatableCaption.miniMessage("backups.backup_load_failure"),
|
||||
Placeholder.miniMessage("reason", throwable.getMessage())
|
||||
);
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
if (number < 1 || number > backups.size()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage(
|
||||
"plot",
|
||||
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
|
||||
TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -327,10 +327,10 @@ public final class Backup extends Command {
|
||||
if (backup == null || backup.getFile() == null || !Files
|
||||
.exists(backup.getFile())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_impossible"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("backups.backup_impossible"),
|
||||
Placeholder.miniMessage(
|
||||
"plot",
|
||||
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
|
||||
TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
@ -339,11 +339,11 @@ public final class Backup extends Command {
|
||||
.whenComplete((n, error) -> {
|
||||
if (error != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_load_failure"),
|
||||
Template.of("reason", error.getMessage())
|
||||
TranslatableCaption.miniMessage("backups.backup_load_failure"),
|
||||
Placeholder.miniMessage("reason", error.getMessage())
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("backups.backup_load_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_load_success"));
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
@ -57,30 +57,30 @@ public class Biome extends SetCommand {
|
||||
String biomes = StringMan.join(
|
||||
BiomeType.REGISTRY.values(),
|
||||
MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption
|
||||
.of("blocklist.block_list_separator")
|
||||
.miniMessage("blocklist.block_list_separator")
|
||||
.getComponent(player)))
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("biome.need_biome"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||
Template.of("values", biomes)
|
||||
TranslatableCaption.miniMessage("commandconfig.subcommand_set_options_header"),
|
||||
Placeholder.miniMessage("values", biomes)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
plot.getPlotModificationManager().setBiome(biome, () -> {
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("biome.biome_set_to"),
|
||||
Template.of("value", value.toLowerCase())
|
||||
TranslatableCaption.miniMessage("biome.biome_set_to"),
|
||||
Placeholder.miniMessage("value", value.toLowerCase())
|
||||
);
|
||||
});
|
||||
return true;
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Set;
|
||||
@ -73,8 +73,8 @@ public class Buy extends Command {
|
||||
) {
|
||||
|
||||
PlotArea area = player.getPlotAreaAbs();
|
||||
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
check(this.econHandler.isEnabled(area), TranslatableCaption.of("economy.econ_disabled"));
|
||||
check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
check(this.econHandler.isEnabled(area), TranslatableCaption.miniMessage("economy.econ_disabled"));
|
||||
final Plot plot;
|
||||
if (args.length != 0) {
|
||||
if (args.length != 1) {
|
||||
@ -83,37 +83,37 @@ public class Buy extends Command {
|
||||
}
|
||||
plot = check(Plot.getPlotFromString(player, args[0], true), null);
|
||||
} else {
|
||||
plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
}
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.miniMessage("economy.cannot_buy_own"));
|
||||
Set<Plot> plots = plot.getConnectedPlots();
|
||||
checkTrue(
|
||||
player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(player.getAllowedPlots()))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
|
||||
);
|
||||
double price = plot.getFlag(PriceFlag.class);
|
||||
if (price <= 0) {
|
||||
throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));
|
||||
throw new CommandException(TranslatableCaption.miniMessage("economy.not_for_sale"));
|
||||
}
|
||||
checkTrue(
|
||||
this.econHandler.isSupported(),
|
||||
TranslatableCaption.of("economy.vault_or_consumer_null")
|
||||
TranslatableCaption.miniMessage("economy.vault_or_consumer_null")
|
||||
);
|
||||
checkTrue(
|
||||
this.econHandler.getMoney(player) >= price,
|
||||
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||
Template.of("money", this.econHandler.format(price)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price)),
|
||||
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
// Failure
|
||||
// Success
|
||||
confirm.run(this, () -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price))
|
||||
);
|
||||
|
||||
this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
|
||||
@ -121,10 +121,10 @@ public class Buy extends Command {
|
||||
PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs());
|
||||
if (owner != null) {
|
||||
owner.sendMessage(
|
||||
TranslatableCaption.of("economy.plot_sold"),
|
||||
Template.of("plot", plot.getId().toString()),
|
||||
Template.of("player", player.getName()),
|
||||
Template.of("price", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.plot_sold"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString()),
|
||||
Placeholder.miniMessage("player", player.getName()),
|
||||
Placeholder.miniMessage("price", this.econHandler.format(price))
|
||||
);
|
||||
}
|
||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
|
||||
@ -134,8 +134,8 @@ public class Buy extends Command {
|
||||
}
|
||||
plot.setOwner(player.getUUID());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.claimed"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("working.claimed"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
||||
}, () -> {
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
|
||||
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
|
||||
@ -55,22 +55,22 @@ public class Caps extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isAdded(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_CAPS_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_CAPS_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_caps_header"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_caps_header"));
|
||||
final int[] countedEntities = plot.countEntities();
|
||||
sendFormatted(plot, player, MobCapFlag.class, countedEntities, "mobs", CAP_MOB);
|
||||
sendFormatted(plot, player, HostileCapFlag.class, countedEntities, "hostile", CAP_MONSTER);
|
||||
@ -90,14 +90,14 @@ public class Caps extends SubCommand {
|
||||
final int max = plot.getFlag(capFlag);
|
||||
final String percentage = String.format("%.1f", 100 * ((float) current / max));
|
||||
String maxBeautified = max >= Integer.MAX_VALUE
|
||||
? TranslatableCaption.of("info.infinite").getComponent(player)
|
||||
? TranslatableCaption.miniMessage("info.infinite").getComponent(player)
|
||||
: String.valueOf(max);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("info.plot_caps_format"),
|
||||
Template.of("cap", name),
|
||||
Template.of("current", String.valueOf(current)),
|
||||
Template.of("limit", maxBeautified),
|
||||
Template.of("percentage", percentage)
|
||||
TranslatableCaption.miniMessage("info.plot_caps_format"),
|
||||
Placeholder.miniMessage("cap", name),
|
||||
Placeholder.miniMessage("current", String.valueOf(current)),
|
||||
Placeholder.miniMessage("limit", maxBeautified),
|
||||
Placeholder.miniMessage("percentage", percentage)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.command;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
/**
|
||||
* @deprecated In favor of "/plot toggle chat" and
|
||||
@ -45,13 +45,13 @@ public class Chat extends SubCommand {
|
||||
@Override
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
PlotArea area = player.getPlotAreaAbs();
|
||||
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.deprecated_commands"),
|
||||
Template.of("replacement", "/plot toggle chat")
|
||||
TranslatableCaption.miniMessage("errors.deprecated_commands"),
|
||||
Placeholder.miniMessage("replacement", "/plot toggle chat")
|
||||
);
|
||||
if (player.getPlotAreaAbs().isForcingPlotChat()) {
|
||||
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("chat.plot_chat_forced"));
|
||||
return true;
|
||||
}
|
||||
MainCommand.getInstance().toggle.chat(this, player, args, null, null);
|
||||
|
@ -45,7 +45,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlotExpression;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -81,15 +81,15 @@ public class Claim extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
final PlayerClaimPlotEvent event = this.eventDispatcher.callClaim(player, plot, schematic);
|
||||
schematic = event.getSchematic();
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Claim")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Claim")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -107,31 +107,31 @@ public class Claim extends SubCommand {
|
||||
grants = metaDataAccess.get().orElse(0);
|
||||
if (grants <= 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(grants))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(grants))
|
||||
);
|
||||
metaDataAccess.remove();
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(player.getAllowedPlots()))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!plot.canClaim(player)) {
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_is_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_is_claimed"));
|
||||
return false;
|
||||
}
|
||||
if (schematic != null && !schematic.isEmpty()) {
|
||||
if (area.isSchematicClaimSpecify()) {
|
||||
if (!area.hasSchematic(schematic)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
||||
Template.of("schemname", schematic),
|
||||
Template.of("reason", "non-existent")
|
||||
TranslatableCaption.miniMessage("schematics.schematic_invalid_named"),
|
||||
Placeholder.miniMessage("schemname", schematic),
|
||||
Placeholder.miniMessage("reason", "non-existent")
|
||||
);
|
||||
}
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLAIM_SCHEMATIC
|
||||
@ -140,8 +140,8 @@ public class Claim extends SubCommand {
|
||||
"plots.admin.command.schematic"
|
||||
) && !force) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_schematic_permission"),
|
||||
Template.of("value", schematic)
|
||||
TranslatableCaption.miniMessage("permission.no_schematic_permission"),
|
||||
Placeholder.miniMessage("value", schematic)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -151,22 +151,22 @@ public class Claim extends SubCommand {
|
||||
double cost = costExr.evaluate(currentPlots);
|
||||
if (cost > 0d) {
|
||||
if (!this.econHandler.isSupported()) {
|
||||
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("economy.vault_or_consumer_null"));
|
||||
return false;
|
||||
}
|
||||
if (this.econHandler.getMoney(player) < cost) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||
Template.of("money", this.econHandler.format(cost)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(cost)),
|
||||
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
this.econHandler.withdrawMoney(player, cost);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(cost)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(cost)),
|
||||
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -177,17 +177,19 @@ public class Claim extends SubCommand {
|
||||
metaDataAccess.set(grants - 1);
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_granted_plot"),
|
||||
Template.of("usedGrants", String.valueOf((grants - 1))),
|
||||
Template.of("remainingGrants", String.valueOf(grants))
|
||||
TranslatableCaption.miniMessage("economy.removed_granted_plot"),
|
||||
Placeholder.miniMessage("usedGrants", String.valueOf((grants - 1))),
|
||||
Placeholder.miniMessage("remainingGrants", String.valueOf(grants))
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
int border = area.getBorder();
|
||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
||||
player.sendMessage(TranslatableCaption.of("border.border"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
plot.setOwnerAbs(player.getUUID());
|
||||
final String finalSchematic = schematic;
|
||||
DBFunc.createPlotSafe(plot, () -> {
|
||||
@ -195,24 +197,26 @@ public class Claim extends SubCommand {
|
||||
TaskManager.getPlatformImplementation().sync(() -> {
|
||||
if (!plot.claim(player, true, finalSchematic, false, false)) {
|
||||
LOGGER.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
|
||||
plot.setOwnerAbs(null);
|
||||
} else if (area.isAutoMerge()) {
|
||||
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
|
||||
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||
if (mergeEvent.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Auto merge on claim")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Auto merge on claim")
|
||||
);
|
||||
} else {
|
||||
plot.getPlotModificationManager().autoMerge(
|
||||
if (plot.getPlotModificationManager().autoMerge(
|
||||
mergeEvent.getDir(),
|
||||
mergeEvent.getMax(),
|
||||
player.getUUID(),
|
||||
player,
|
||||
true
|
||||
);
|
||||
)) {
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -222,7 +226,7 @@ public class Claim extends SubCommand {
|
||||
}
|
||||
}, () -> {
|
||||
LOGGER.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
|
||||
plot.setOwnerAbs(null);
|
||||
});
|
||||
return true;
|
||||
|
@ -43,7 +43,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -80,28 +80,28 @@ public class Clear extends Command {
|
||||
sendUsage(player);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
Result eventResult = this.eventDispatcher.callClear(plot).getEventResult();
|
||||
if (eventResult == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Clear")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Clear")
|
||||
);
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
boolean force = eventResult == Result.FORCE;
|
||||
checkTrue(
|
||||
force || plot.isOwner(player.getUUID()) || Permissions
|
||||
.hasPermission(player, "plots.admin.command.clear"),
|
||||
TranslatableCaption.of("permission.no_plot_perms")
|
||||
TranslatableCaption.miniMessage("permission.no_plot_perms")
|
||||
);
|
||||
checkTrue(plot.getRunning() == 0, TranslatableCaption.of("errors.wait_for_timer"));
|
||||
checkTrue(plot.getRunning() == 0, TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions
|
||||
.hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done"));
|
||||
.hasPermission(player, "plots.continue"), TranslatableCaption.miniMessage("done.done_already_done"));
|
||||
confirm.run(this, () -> {
|
||||
if (Settings.Teleport.ON_CLEAR) {
|
||||
plot.getPlayersInPlot().forEach(playerInPlot -> plot.teleportPlayer(playerInPlot, TeleportCause.COMMAND_CLEAR,
|
||||
@ -135,14 +135,14 @@ public class Clear extends Command {
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.clearing_done"),
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("working.clearing_done"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
});
|
||||
});
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
} else {
|
||||
plot.addRunning();
|
||||
}
|
||||
|
@ -42,13 +42,14 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@ -68,8 +69,8 @@ public class Cluster extends SubCommand {
|
||||
if (args.length == 0) {
|
||||
// return arguments
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_available_args"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("cluster.cluster_available_args"),
|
||||
Placeholder.miniMessage(
|
||||
"list",
|
||||
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
|
||||
)
|
||||
@ -78,77 +79,75 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
String sub = args[0].toLowerCase();
|
||||
switch (sub) {
|
||||
case "l":
|
||||
case "list": {
|
||||
case "l", "list" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LIST)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_LIST))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_LIST))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster list")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster list")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
Set<PlotCluster> clusters = area.getClusters();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_list_heading"),
|
||||
Template.of("amount", clusters.size() + "")
|
||||
TranslatableCaption.miniMessage("cluster.cluster_list_heading"),
|
||||
Placeholder.miniMessage("amount", clusters.size() + "")
|
||||
);
|
||||
for (PlotCluster cluster : clusters) {
|
||||
// Ignore unmanaged clusters
|
||||
String name = "'" + cluster.getName() + "' : " + cluster;
|
||||
if (player.getUUID().equals(cluster.owner)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_list_element_owner"),
|
||||
Template.of("cluster", name)
|
||||
TranslatableCaption.miniMessage("cluster.cluster_list_element_owner"),
|
||||
Placeholder.miniMessage("cluster", name)
|
||||
);
|
||||
} else if (cluster.helpers.contains(player.getUUID())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_list_element_helpers"),
|
||||
Template.of("cluster", name)
|
||||
TranslatableCaption.miniMessage("cluster.cluster_list_element_helpers"),
|
||||
Placeholder.miniMessage("cluster", name)
|
||||
);
|
||||
} else if (cluster.invited.contains(player.getUUID())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_list_element_invited"),
|
||||
Template.of("cluster", name)
|
||||
TranslatableCaption.miniMessage("cluster.cluster_list_element_invited"),
|
||||
Placeholder.miniMessage("cluster", name)
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_list_element"),
|
||||
Template.of("cluster", cluster.toString())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_list_element"),
|
||||
Placeholder.miniMessage("cluster", cluster.toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "c":
|
||||
case "create": {
|
||||
case "c", "create" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 4) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster create <name> <id-bot> <id-top>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster create <name> <id-bot> <id-top>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -157,8 +156,8 @@ public class Cluster extends SubCommand {
|
||||
player.getPlotCount(player.getLocation().getWorldName());
|
||||
if (currentClusters >= player.getAllowedPlots()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_clusters"),
|
||||
Template.of("amount", String.valueOf(player.getAllowedPlots()))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_clusters"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
|
||||
);
|
||||
}
|
||||
PlotId pos1;
|
||||
@ -168,15 +167,15 @@ public class Cluster extends SubCommand {
|
||||
pos1 = PlotId.fromString(args[2]);
|
||||
pos2 = PlotId.fromString(args[3]);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.not_valid_plot_id"));
|
||||
return false;
|
||||
}
|
||||
// check if name is taken
|
||||
String name = args[1];
|
||||
if (area.getCluster(name) != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("alias.alias_is_taken"),
|
||||
Template.of("alias", name)
|
||||
TranslatableCaption.miniMessage("alias.alias_is_taken"),
|
||||
Placeholder.miniMessage("alias", name)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -189,16 +188,16 @@ public class Cluster extends SubCommand {
|
||||
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
|
||||
if (cluster != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_intersection"),
|
||||
Template.of("cluster", cluster.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_intersection"),
|
||||
Placeholder.miniMessage("cluster", cluster.getName())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
// Check if it occupies existing plots
|
||||
if (!area.contains(pos1) || !area.contains(pos2)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_outside"),
|
||||
Template.of("area", String.valueOf(area))
|
||||
TranslatableCaption.miniMessage("cluster.cluster_outside"),
|
||||
Placeholder.miniMessage("area", String.valueOf(area))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -210,8 +209,8 @@ public class Cluster extends SubCommand {
|
||||
for (Plot plot : plots) {
|
||||
if (!plot.isOwner(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -232,8 +231,8 @@ public class Cluster extends SubCommand {
|
||||
);
|
||||
if (current + cluster.getArea() > allowed) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -251,31 +250,29 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_created"),
|
||||
Template.of("name", name)
|
||||
TranslatableCaption.miniMessage("cluster.cluster_created"),
|
||||
Placeholder.miniMessage("name", name)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case "disband":
|
||||
case "del":
|
||||
case "delete": {
|
||||
case "disband", "del", "delete" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster delete [name]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster delete [name]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
PlotCluster cluster;
|
||||
@ -283,15 +280,15 @@ public class Cluster extends SubCommand {
|
||||
cluster = area.getCluster(args[1]);
|
||||
if (cluster == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
|
||||
Placeholder.miniMessage("cluster", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -299,32 +296,31 @@ public class Cluster extends SubCommand {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DBFunc.delete(cluster);
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), Template.of(
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_deleted"), Placeholder.miniMessage(
|
||||
"cluster",
|
||||
String.valueOf(cluster)
|
||||
));
|
||||
return true;
|
||||
}
|
||||
case "res":
|
||||
case "resize": {
|
||||
case "res", "resize" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster resize [name]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster resize [name]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -335,7 +331,7 @@ public class Cluster extends SubCommand {
|
||||
pos1 = PlotId.fromString(args[2]);
|
||||
pos2 = PlotId.fromString(args[3]);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.not_valid_plot_id"));
|
||||
return false;
|
||||
}
|
||||
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
|
||||
@ -345,20 +341,20 @@ public class Cluster extends SubCommand {
|
||||
// check if in cluster
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -367,8 +363,8 @@ public class Cluster extends SubCommand {
|
||||
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
|
||||
if (intersect != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_intersection"),
|
||||
Template.of("cluster", intersect.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_intersection"),
|
||||
Placeholder.miniMessage("cluster", intersect.getName())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -383,8 +379,8 @@ public class Cluster extends SubCommand {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -394,8 +390,8 @@ public class Cluster extends SubCommand {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -413,49 +409,47 @@ public class Cluster extends SubCommand {
|
||||
);
|
||||
if (current + cluster.getArea() > allowed) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea()))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea()))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
// resize cluster
|
||||
DBFunc.resizeCluster(cluster, pos1, pos2);
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_resized"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_resized"));
|
||||
return true;
|
||||
}
|
||||
case "add":
|
||||
case "inv":
|
||||
case "invite": {
|
||||
case "add", "inv", "invite" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_INVITE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_INVITE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster invite <player>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster invite <player>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
// check if in cluster
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_INVITE_OTHER.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_INVITE_OTHER.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -464,11 +458,11 @@ public class Cluster extends SubCommand {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||
.getSingle(args[1], (uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[1])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[1])
|
||||
);
|
||||
} else {
|
||||
if (!cluster.isAdded(uuid)) {
|
||||
@ -479,48 +473,46 @@ public class Cluster extends SubCommand {
|
||||
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||
if (otherPlayer != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_invited"),
|
||||
Template.of("cluster", cluster.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_invited"),
|
||||
Placeholder.miniMessage("cluster", cluster.getName())
|
||||
);
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_user"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_added_user"));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "k":
|
||||
case "remove":
|
||||
case "kick": {
|
||||
case "k", "remove", "kick" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_KICK.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_KICK.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster kick <player>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster kick <player>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_KICK_OTHER.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_KICK_OTHER.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -529,19 +521,19 @@ public class Cluster extends SubCommand {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||
.getSingle(args[1], (uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[1])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[1])
|
||||
);
|
||||
} else {
|
||||
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
||||
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner)
|
||||
|| !cluster.isAdded(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cannot_kick_player"),
|
||||
Template.of("value", cluster.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cannot_kick_player"),
|
||||
Placeholder.miniMessage("value", cluster.getName())
|
||||
);
|
||||
} else {
|
||||
if (cluster.helpers.contains(uuid)) {
|
||||
@ -555,8 +547,8 @@ public class Cluster extends SubCommand {
|
||||
PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||
if (player2 != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_removed"),
|
||||
Template.of("cluster", cluster.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_removed"),
|
||||
Placeholder.miniMessage("cluster", cluster.getName())
|
||||
);
|
||||
}
|
||||
for (final Plot plot : PlotQuery.newQuery().inWorld(player2.getLocation()
|
||||
@ -566,56 +558,55 @@ public class Cluster extends SubCommand {
|
||||
plot.unclaim();
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_kicked_user"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_kicked_user"));
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "quit":
|
||||
case "leave": {
|
||||
case "quit", "leave" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LEAVE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_LEAVE.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_LEAVE.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster leave [name]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster leave [name]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
PlotCluster cluster;
|
||||
if (args.length == 2) {
|
||||
cluster = area.getCluster(args[1]);
|
||||
if (cluster == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
|
||||
Placeholder.miniMessage("cluster", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
UUID uuid = player.getUUID();
|
||||
if (!cluster.isAdded(uuid)) {
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_not_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_not_added"));
|
||||
return false;
|
||||
}
|
||||
if (uuid.equals(cluster.owner)) {
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_cannot_leave"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_cannot_leave"));
|
||||
return false;
|
||||
}
|
||||
if (cluster.helpers.contains(uuid)) {
|
||||
@ -625,8 +616,8 @@ public class Cluster extends SubCommand {
|
||||
cluster.invited.remove(uuid);
|
||||
DBFunc.removeInvited(cluster, uuid);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_removed"),
|
||||
Template.of("cluster", cluster.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cluster_removed"),
|
||||
Placeholder.miniMessage("cluster", cluster.getName())
|
||||
);
|
||||
for (final Plot plot : PlotQuery.newQuery().inWorld(player.getLocation().getWorldName())
|
||||
.ownedBy(uuid)) {
|
||||
@ -637,86 +628,84 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "members": {
|
||||
case "members" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_HELPERS.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_HELPERS.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster members <add | remove> <player>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster members <add | remove> <player>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
|
||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||
.getSingle(args[2], (uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[2])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[2])
|
||||
);
|
||||
} else {
|
||||
if (args[1].equalsIgnoreCase("add")) {
|
||||
cluster.helpers.add(uuid);
|
||||
DBFunc.setHelper(cluster, uuid);
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_helper"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_added_helper"));
|
||||
} else if (args[1].equalsIgnoreCase("remove")) {
|
||||
cluster.helpers.remove(uuid);
|
||||
DBFunc.removeHelper(cluster, uuid);
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_removed_helper"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_removed_helper"));
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster members <add | remove> <player>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster members <add | remove> <player>")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "spawn":
|
||||
case "home":
|
||||
case "tp": {
|
||||
case "spawn", "home", "tp" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster tp <name>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster tp <name>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(args[1]);
|
||||
if (cluster == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
|
||||
Placeholder.miniMessage("cluster", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -724,36 +713,33 @@ public class Cluster extends SubCommand {
|
||||
if (!cluster.isAdded(uuid)) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_TP_OTHER.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP_OTHER.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
cluster.getHome(home -> player.teleport(home, TeleportCause.COMMAND_CLUSTER_TELEPORT));
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_teleporting"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_teleporting"));
|
||||
return true;
|
||||
}
|
||||
case "i":
|
||||
case "info":
|
||||
case "show":
|
||||
case "information": {
|
||||
case "i", "info", "show", "information" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INFO)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster info [name]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster info [name]")
|
||||
);
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
PlotCluster cluster;
|
||||
@ -761,15 +747,15 @@ public class Cluster extends SubCommand {
|
||||
cluster = area.getCluster(args[1]);
|
||||
if (cluster == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
|
||||
Placeholder.miniMessage("cluster", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -778,24 +764,20 @@ public class Cluster extends SubCommand {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||
.getSingle(cluster.owner, (username, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else {
|
||||
final String owner;
|
||||
if (username == null) {
|
||||
owner = "unknown";
|
||||
} else {
|
||||
owner = username;
|
||||
}
|
||||
owner = Objects.requireNonNullElse(username, "unknown");
|
||||
String name = cluster.getName();
|
||||
String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
|
||||
cluster.getP2().getY() - cluster.getP1().getY() + 1);
|
||||
String rights = cluster.isAdded(player.getUUID()) + "";
|
||||
Caption message = TranslatableCaption.of("cluster.cluster_info");
|
||||
Template idTemplate = Template.of("id", id);
|
||||
Template ownerTemplate = Template.of("owner", owner);
|
||||
Template nameTemplate = Template.of("name", name);
|
||||
Template sizeTemplate = Template.of("size", size);
|
||||
Template rightsTemplate = Template.of("rights", rights);
|
||||
Caption message = TranslatableCaption.miniMessage("cluster.cluster_info");
|
||||
Placeholder<?> idTemplate = Placeholder.miniMessage("id", id);
|
||||
Placeholder<?> ownerTemplate = Placeholder.miniMessage("owner", owner);
|
||||
Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name);
|
||||
Placeholder<?> sizeTemplate = Placeholder.miniMessage("size", size);
|
||||
Placeholder<?> rightsTemplate = Placeholder.miniMessage("rights", rights);
|
||||
player.sendMessage(
|
||||
message,
|
||||
idTemplate,
|
||||
@ -808,38 +790,36 @@ public class Cluster extends SubCommand {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "sh":
|
||||
case "setspawn":
|
||||
case "sethome": {
|
||||
case "sh", "setspawn", "sethome" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SETHOME.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster sethome")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot cluster sethome")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME_OTHER.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SETHOME_OTHER.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -852,13 +832,13 @@ public class Cluster extends SubCommand {
|
||||
cluster,
|
||||
relative.getX() + "," + relative.getY() + "," + relative.getZ()
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("position.position_set"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("position.position_set"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cluster_available_args"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("cluster.cluster_available_args"),
|
||||
Placeholder.miniMessage(
|
||||
"list",
|
||||
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
|
||||
)
|
||||
@ -916,11 +896,11 @@ public class Cluster extends SubCommand {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.player.PlayerMetaDataKeys;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.task.TaskTime;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CmdConfirm {
|
||||
@ -58,10 +58,10 @@ public class CmdConfirm {
|
||||
removePending(player);
|
||||
if (commandStr != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("confirm.requires_confirm"),
|
||||
Template.of("command", commandStr),
|
||||
Template.of("timeout", String.valueOf(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)),
|
||||
Template.of("value", "/plot confirm")
|
||||
TranslatableCaption.miniMessage("confirm.requires_confirm"),
|
||||
Placeholder.miniMessage("command", commandStr),
|
||||
Placeholder.miniMessage("timeout", String.valueOf(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)),
|
||||
Placeholder.miniMessage("value", "/plot confirm")
|
||||
);
|
||||
}
|
||||
TaskManager.runTaskLater(() -> {
|
||||
|
@ -38,7 +38,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -213,9 +213,9 @@ public abstract class Command {
|
||||
}
|
||||
Collections.reverse(path);
|
||||
String descriptionKey = String.join(".", path);
|
||||
this.description = TranslatableCaption.of(String.format("commands.description.%s", descriptionKey));
|
||||
this.description = TranslatableCaption.miniMessage(String.format("commands.description.%s", descriptionKey));
|
||||
} else {
|
||||
this.description = StaticCaption.of(declaration.description());
|
||||
this.description = StaticCaption.miniMessage(declaration.description());
|
||||
}
|
||||
this.usage = declaration.usage();
|
||||
this.confirmation = declaration.confirmation();
|
||||
@ -263,9 +263,9 @@ public abstract class Command {
|
||||
max = c.size();
|
||||
}
|
||||
// Send the header
|
||||
Template curTemplate = Template.of("cur", String.valueOf(page + 1));
|
||||
Template maxTemplate = Template.of("max", String.valueOf(totalPages + 1));
|
||||
Template amountTemplate = Template.of("amount", String.valueOf(c.size()));
|
||||
Placeholder<?> curTemplate = Placeholder.miniMessage("cur", String.valueOf(page + 1));
|
||||
Placeholder<?> maxTemplate = Placeholder.miniMessage("max", String.valueOf(totalPages + 1));
|
||||
Placeholder<?> amountTemplate = Placeholder.miniMessage("amount", String.valueOf(c.size()));
|
||||
player.sendMessage(header, curTemplate, maxTemplate, amountTemplate);
|
||||
// Send the page content
|
||||
List<T> subList = c.subList(page * size, max);
|
||||
@ -274,13 +274,14 @@ public abstract class Command {
|
||||
i++;
|
||||
final CaptionHolder msg = new CaptionHolder();
|
||||
add.run(i, obj, msg);
|
||||
player.sendMessage(msg.get(), msg.getTemplates());
|
||||
player.sendMessage(msg.caption(), msg.placeholders());
|
||||
}
|
||||
// Send the footer
|
||||
Template command1 = Template.of("command1", baseCommand + " " + page);
|
||||
Template command2 = Template.of("command2", baseCommand + " " + (page + 2));
|
||||
Template clickable = Template.of("clickable", TranslatableCaption.of("list.clickable").getComponent(player));
|
||||
player.sendMessage(TranslatableCaption.of("list.page_turn"), command1, command2, clickable);
|
||||
Placeholder<?> command1 = Placeholder.miniMessage("command1", baseCommand + " " + page);
|
||||
Placeholder<?> command2 = Placeholder.miniMessage("command2", baseCommand + " " + (page + 2));
|
||||
Placeholder<?> clickable = Placeholder.miniMessage("clickable",
|
||||
TranslatableCaption.miniMessage("list.clickable").getComponent(player));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("list.page_turn"), command1, command2, clickable);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,7 +307,7 @@ public abstract class Command {
|
||||
}
|
||||
if (this.allCommands.isEmpty()) {
|
||||
player.sendMessage(
|
||||
StaticCaption.of("Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues"));
|
||||
StaticCaption.miniMessage("Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
Command cmd = getCommand(args[0]);
|
||||
@ -327,12 +328,12 @@ public abstract class Command {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
// Command recommendation
|
||||
player.sendMessage(TranslatableCaption.of("commandconfig.not_valid_subcommand"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("commandconfig.not_valid_subcommand"));
|
||||
List<Command> commands = getCommands(player);
|
||||
if (commands.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.did_you_mean"),
|
||||
Template.of("value", MainCommand.getInstance().help.getUsage())
|
||||
TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
|
||||
Placeholder.miniMessage("value", MainCommand.getInstance().help.getUsage())
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -352,8 +353,8 @@ public abstract class Command {
|
||||
cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject();
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.did_you_mean"),
|
||||
Template.of("value", cmd.getUsage())
|
||||
TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
|
||||
Placeholder.miniMessage("value", cmd.getUsage())
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -388,8 +389,8 @@ public abstract class Command {
|
||||
if (failed) {
|
||||
// TODO improve or remove the Argument system
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", StringMan.join(fullSplit, " "))
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", StringMan.join(fullSplit, " "))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -477,8 +478,8 @@ public abstract class Command {
|
||||
} else if (!Permissions.hasPermission(player, getPermission())) {
|
||||
if (message) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", getPermission())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", getPermission())
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -502,8 +503,8 @@ public abstract class Command {
|
||||
|
||||
public void sendUsage(PlotPlayer<?> player) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", getUsage())
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", getUsage())
|
||||
);
|
||||
}
|
||||
|
||||
@ -607,13 +608,29 @@ public abstract class Command {
|
||||
return this.getFullId().hashCode();
|
||||
}
|
||||
|
||||
public void checkTrue(boolean mustBeTrue, Caption message, Template... args) {
|
||||
/**
|
||||
* Check whether a given condition is true
|
||||
*
|
||||
* @param mustBeTrue The condition to check, that must be true
|
||||
* @param message The message to send
|
||||
* @param args The arguments to send with the message
|
||||
*/
|
||||
public void checkTrue(boolean mustBeTrue, Caption message, Placeholder<?>... args) {
|
||||
if (!mustBeTrue) {
|
||||
throw new CommandException(message, args);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T check(T object, Caption message, Template... args) {
|
||||
/**
|
||||
* Check whether a given condition is true
|
||||
*
|
||||
* @param object The condition to check, that must be true
|
||||
* @param message The message to send
|
||||
* @param args The arguments to send with the message
|
||||
* @param <T> The type of the object
|
||||
* @return The object
|
||||
*/
|
||||
public <T> T check(T object, Caption message, Placeholder<?>... args) {
|
||||
if (object == null) {
|
||||
throw new CommandException(message, args);
|
||||
}
|
||||
@ -629,17 +646,23 @@ public abstract class Command {
|
||||
|
||||
public static class CommandException extends RuntimeException {
|
||||
|
||||
private final Template[] args;
|
||||
private final Placeholder<?>[] placeholders;
|
||||
private final Caption message;
|
||||
|
||||
public CommandException(final @Nullable Caption message, final Template... args) {
|
||||
/**
|
||||
* Create a new CommandException
|
||||
*
|
||||
* @param message The message to send
|
||||
* @param placeholders The placeholders to send with the message
|
||||
*/
|
||||
public CommandException(final @Nullable Caption message, final Placeholder<?>... placeholders) {
|
||||
this.message = message;
|
||||
this.args = args;
|
||||
this.placeholders = placeholders;
|
||||
}
|
||||
|
||||
public void perform(final @Nullable PlotPlayer<?> player) {
|
||||
if (player != null && message != null) {
|
||||
player.sendMessage(message, args);
|
||||
player.sendMessage(message, placeholders);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.Caption;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
@ -41,7 +41,7 @@ public interface CommandCaller {
|
||||
* @param caption Caption to send
|
||||
* @param replacements Variable replacements
|
||||
*/
|
||||
void sendMessage(@NonNull Caption caption, @NonNull Template... replacements);
|
||||
void sendMessage(@NonNull Caption caption, @NonNull Placeholder<?>... replacements);
|
||||
|
||||
/**
|
||||
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
||||
|
@ -38,42 +38,42 @@ public enum CommandCategory implements Caption {
|
||||
* Claiming CommandConfig.
|
||||
* Such as: /plot claim
|
||||
*/
|
||||
CLAIMING(TranslatableCaption.of("category.command_category_claiming")),
|
||||
CLAIMING(TranslatableCaption.miniMessage("category.command_category_claiming")),
|
||||
/**
|
||||
* Teleportation CommandConfig.
|
||||
* Such as: /plot visit
|
||||
*/
|
||||
TELEPORT(TranslatableCaption.of("category.command_category_teleport")),
|
||||
TELEPORT(TranslatableCaption.miniMessage("category.command_category_teleport")),
|
||||
/**
|
||||
* Protection.
|
||||
*/
|
||||
SETTINGS(TranslatableCaption.of("category.command_category_settings")),
|
||||
SETTINGS(TranslatableCaption.miniMessage("category.command_category_settings")),
|
||||
/**
|
||||
* Chat.
|
||||
*/
|
||||
CHAT(TranslatableCaption.of("category.command_category_chat")),
|
||||
CHAT(TranslatableCaption.miniMessage("category.command_category_chat")),
|
||||
/**
|
||||
* Web.
|
||||
*/
|
||||
SCHEMATIC(TranslatableCaption.of("category.command_category_schematic")),
|
||||
SCHEMATIC(TranslatableCaption.miniMessage("category.command_category_schematic")),
|
||||
/**
|
||||
* Cosmetic.
|
||||
*/
|
||||
APPEARANCE(TranslatableCaption.of("category.command_category_appearance")),
|
||||
APPEARANCE(TranslatableCaption.miniMessage("category.command_category_appearance")),
|
||||
/**
|
||||
* Information CommandConfig.
|
||||
* Such as: /plot info
|
||||
*/
|
||||
INFO(TranslatableCaption.of("category.command_category_info")),
|
||||
INFO(TranslatableCaption.miniMessage("category.command_category_info")),
|
||||
/**
|
||||
* Debug CommandConfig.
|
||||
* Such as: /plot debug
|
||||
*/
|
||||
DEBUG(TranslatableCaption.of("category.command_category_debug")),
|
||||
DEBUG(TranslatableCaption.miniMessage("category.command_category_debug")),
|
||||
/**
|
||||
* Administration commands.
|
||||
*/
|
||||
ADMINISTRATION(TranslatableCaption.of("category.command_category_administration"));
|
||||
ADMINISTRATION(TranslatableCaption.miniMessage("category.command_category_administration"));
|
||||
/**
|
||||
* The category name (Readable).
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.plot.comment.CommentInbox;
|
||||
import com.plotsquared.core.plot.comment.CommentManager;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
@ -50,9 +50,9 @@ public class Comment extends SubCommand {
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_syntax"),
|
||||
Template.of("command", "/plot comment [X;Z]"),
|
||||
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
TranslatableCaption.miniMessage("comment.comment_syntax"),
|
||||
Placeholder.miniMessage("command", "/plot comment [X;Z]"),
|
||||
Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -70,9 +70,9 @@ public class Comment extends SubCommand {
|
||||
} else {
|
||||
if (args.length < 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_syntax"),
|
||||
Template.of("command", "/plot comment [X;Z]"),
|
||||
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
TranslatableCaption.miniMessage("comment.comment_syntax"),
|
||||
Placeholder.miniMessage("command", "/plot comment [X;Z]"),
|
||||
Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -82,15 +82,15 @@ public class Comment extends SubCommand {
|
||||
CommentInbox inbox = CommentManager.inboxes.get(args[index - 1].toLowerCase());
|
||||
if (inbox == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_syntax"),
|
||||
Template.of("command", "/plot comment [X;Z]"),
|
||||
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
TranslatableCaption.miniMessage("comment.comment_syntax"),
|
||||
Placeholder.miniMessage("command", "/plot comment [X;Z]"),
|
||||
Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inbox.canWrite(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -101,22 +101,22 @@ public class Comment extends SubCommand {
|
||||
);
|
||||
boolean result = inbox.addComment(plot, comment);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.no_plot_inbox"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_syntax"),
|
||||
Template.of("command", "/plot comment [X;Z]"),
|
||||
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
TranslatableCaption.miniMessage("comment.comment_syntax"),
|
||||
Placeholder.miniMessage("command", "/plot comment [X;Z]"),
|
||||
Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final PlotPlayer<?> pp : PlotSquared.platform().playerManager().getPlayers()) {
|
||||
if (pp.getAttribute("chatspy")) {
|
||||
pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
|
||||
pp.sendMessage(StaticCaption.miniMessage("/plot comment " + StringMan.join(args, " ")));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(TranslatableCaption.of("comment.comment_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.comment_added"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.util.task.TaskTime;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -73,31 +73,31 @@ public class Condense extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot condense <area> <start | stop | info> [radius]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot condense <area> <start | stop | info> [radius]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||
if (area == null || !this.worldUtil.isWorld(area.getWorldName())) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.invalid_area"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.invalid_area"));
|
||||
return false;
|
||||
}
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "start" -> {
|
||||
if (args.length == 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot condense" + area + " start <radius>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot condense" + area + " start <radius>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (Condense.TASK) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_already_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_already_started"));
|
||||
return false;
|
||||
}
|
||||
if (!MathMan.isInteger(args[2])) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.invalid_radius"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.invalid_radius"));
|
||||
return false;
|
||||
}
|
||||
int radius = Integer.parseInt(args[2]);
|
||||
@ -141,7 +141,7 @@ public class Condense extends SubCommand {
|
||||
int size = allPlots.size();
|
||||
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
||||
if (radius < minimumRadius) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.radius_too_small"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.radius_too_small"));
|
||||
return false;
|
||||
}
|
||||
List<PlotId> toMove = new ArrayList<>(getPlots(allPlots, radius));
|
||||
@ -155,20 +155,20 @@ public class Condense extends SubCommand {
|
||||
start = start.getNextId();
|
||||
}
|
||||
if (free.isEmpty() || toMove.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.no_free_plots_found"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.no_free_plots_found"));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_started"));
|
||||
Condense.TASK = true;
|
||||
Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Condense.TASK) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
|
||||
}
|
||||
if (allPlots.isEmpty()) {
|
||||
Condense.TASK = false;
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_complete"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_complete"));
|
||||
return;
|
||||
}
|
||||
final Runnable task = this;
|
||||
@ -186,9 +186,9 @@ public class Condense extends SubCommand {
|
||||
result.set(origin.getPlotModificationManager().move(possible, player, () -> {
|
||||
if (result.get()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.moving"),
|
||||
Template.of("origin", String.valueOf(origin)),
|
||||
Template.of("possible", String.valueOf(possible))
|
||||
TranslatableCaption.miniMessage("condense.moving"),
|
||||
Placeholder.miniMessage("origin", String.valueOf(origin)),
|
||||
Placeholder.miniMessage("possible", String.valueOf(possible))
|
||||
);
|
||||
TaskManager.runTaskLater(task, TaskTime.ticks(1L));
|
||||
}
|
||||
@ -202,13 +202,13 @@ public class Condense extends SubCommand {
|
||||
}
|
||||
if (free.isEmpty()) {
|
||||
Condense.TASK = false;
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_failed"));
|
||||
return;
|
||||
}
|
||||
if (i >= free.size()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.skipping"),
|
||||
Template.of("plot", String.valueOf(origin))
|
||||
TranslatableCaption.miniMessage("condense.skipping"),
|
||||
Placeholder.miniMessage("plot", String.valueOf(origin))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -218,23 +218,23 @@ public class Condense extends SubCommand {
|
||||
}
|
||||
case "stop" -> {
|
||||
if (!Condense.TASK) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_stopped"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_stopped"));
|
||||
return false;
|
||||
}
|
||||
Condense.TASK = false;
|
||||
player.sendMessage(TranslatableCaption.of("condense.task_stopped"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.task_stopped"));
|
||||
return true;
|
||||
}
|
||||
case "info" -> {
|
||||
if (args.length == 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot condense " + area + " info <radius>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot condense " + area + " info <radius>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!MathMan.isInteger(args[2])) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.invalid_radius"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.invalid_radius"));
|
||||
return false;
|
||||
}
|
||||
int radius = Integer.parseInt(args[2]);
|
||||
@ -242,37 +242,37 @@ public class Condense extends SubCommand {
|
||||
int size = plots.size();
|
||||
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
||||
if (radius < minimumRadius) {
|
||||
player.sendMessage(TranslatableCaption.of("condense.radius_too_small"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.radius_too_small"));
|
||||
return false;
|
||||
}
|
||||
int maxMove = getPlots(plots, minimumRadius).size();
|
||||
int userMove = getPlots(plots, radius).size();
|
||||
player.sendMessage(TranslatableCaption.of("condense.default_eval"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.default_eval"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.minimum_radius"),
|
||||
Template.of("minimumRadius", String.valueOf(minimumRadius))
|
||||
TranslatableCaption.miniMessage("condense.minimum_radius"),
|
||||
Placeholder.miniMessage("minimumRadius", String.valueOf(minimumRadius))
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.minimum_radius"),
|
||||
Template.of("maxMove", String.valueOf(maxMove))
|
||||
TranslatableCaption.miniMessage("condense.minimum_radius"),
|
||||
Placeholder.miniMessage("maxMove", String.valueOf(maxMove))
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("condense.input_eval"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.input_eval"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.input_radius"),
|
||||
Template.of("radius", String.valueOf(radius))
|
||||
TranslatableCaption.miniMessage("condense.input_radius"),
|
||||
Placeholder.miniMessage("radius", String.valueOf(radius))
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.estimated_moves"),
|
||||
Template.of("userMove", String.valueOf(userMove))
|
||||
TranslatableCaption.miniMessage("condense.estimated_moves"),
|
||||
Placeholder.miniMessage("userMove", String.valueOf(userMove))
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("condense.eta"));
|
||||
player.sendMessage(TranslatableCaption.of("condense.radius_measured"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.eta"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("condense.radius_measured"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ public class Confirm extends SubCommand {
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
CmdInstance command = CmdConfirm.getPending(player);
|
||||
if (command == null) {
|
||||
player.sendMessage(TranslatableCaption.of("confirm.failed_confirm"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("confirm.failed_confirm"));
|
||||
return false;
|
||||
}
|
||||
CmdConfirm.removePending(player);
|
||||
if ((System.currentTimeMillis() - command.timestamp)
|
||||
> Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) {
|
||||
player.sendMessage(TranslatableCaption.of("confirm.expired_confirm"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("confirm.expired_confirm"));
|
||||
return false;
|
||||
}
|
||||
TaskManager.runTaskAsync(command.command);
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@CommandDeclaration(command = "continue",
|
||||
@ -57,32 +57,32 @@ public class Continue extends SubCommand {
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", TranslatableCaption.of("permission.no_plot_perms").getComponent(player))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", TranslatableCaption.miniMessage("permission.no_plot_perms").getComponent(player))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!DoneFlag.isDone(plot)) {
|
||||
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_not_done"));
|
||||
return false;
|
||||
}
|
||||
int size = plot.getConnectedPlots().size();
|
||||
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
|
||||
< player.getPlotCount() + size)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.cant_claim_more_plots"),
|
||||
Template.of("amount", String.valueOf(player.getAllowedPlots()))
|
||||
TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class);
|
||||
@ -90,13 +90,13 @@ public class Continue extends SubCommand {
|
||||
this.eventDispatcher.callFlagRemove(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Done flag removal")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Done flag removal")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
plot.removeFlag(event.getFlag());
|
||||
player.sendMessage(TranslatableCaption.of("done.done_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_removed"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
@CommandDeclaration(command = "copy",
|
||||
permission = "plots.copy",
|
||||
@ -46,18 +46,18 @@ public class Copy extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot copy <X;Z>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot copy <X;Z>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -66,21 +66,21 @@ public class Copy extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (plot1.equals(plot2)) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.origin_cant_be_target"));
|
||||
return false;
|
||||
}
|
||||
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.plotworld_incompatible"));
|
||||
return false;
|
||||
}
|
||||
|
||||
plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)),
|
||||
Template.of("target", String.valueOf(plot2))
|
||||
player.sendMessage(TranslatableCaption.miniMessage("move.copy_success"), Placeholder.miniMessage("origin", String.valueOf(plot1)),
|
||||
Placeholder.miniMessage("target", String.valueOf(plot2))
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("move.requires_unowned"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.generator.HybridUtils;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@CommandDeclaration(command = "createroadschematic",
|
||||
@ -55,20 +55,20 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
this.hybridUtils.setupRoadSchematic(plot);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_road_created"),
|
||||
Template.of("command", "/plot debugroadregen")
|
||||
TranslatableCaption.miniMessage("schematics.schematic_road_created"),
|
||||
Placeholder.miniMessage("command", "/plot debugroadregen")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.FileUtils;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.io.File;
|
||||
@ -91,13 +91,13 @@ public class DatabaseCommand extends SubCommand {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
try {
|
||||
ArrayList<Plot> ps = new ArrayList<>(plots);
|
||||
player.sendMessage(TranslatableCaption.of("database.starting_conversion"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.starting_conversion"));
|
||||
manager.createPlotsAndData(ps, () -> {
|
||||
player.sendMessage(TranslatableCaption.of("database.conversion_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.conversion_done"));
|
||||
manager.close();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
player.sendMessage(TranslatableCaption.of("database.conversion_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.conversion_failed"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
@ -107,8 +107,8 @@ public class DatabaseCommand extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot database [area] <sqlite | mysql | import>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot database [area] <sqlite | mysql | import>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -122,10 +122,10 @@ public class DatabaseCommand extends SubCommand {
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot database [area] <sqlite|mysql|import>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot database [area] <sqlite|mysql|import>")
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("database.arg"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.arg"));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@ -135,8 +135,8 @@ public class DatabaseCommand extends SubCommand {
|
||||
case "import" -> {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot database import <sqlite file> [prefix]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot database import <sqlite file> [prefix]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -146,12 +146,12 @@ public class DatabaseCommand extends SubCommand {
|
||||
);
|
||||
if (!file.exists()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("database.does_not_exist"),
|
||||
Template.of("value", String.valueOf(file))
|
||||
TranslatableCaption.miniMessage("database.does_not_exist"),
|
||||
Placeholder.miniMessage("value", String.valueOf(file))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("database.starting_conversion"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.starting_conversion"));
|
||||
implementation = new SQLite(file);
|
||||
SQLManager manager = new SQLManager(implementation, args.length == 3 ? args[2] : "",
|
||||
this.eventDispatcher, this.plotListener, this.worldConfiguration
|
||||
@ -190,9 +190,9 @@ public class DatabaseCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("database.skipping_duplicated_plot"),
|
||||
Template.of("plot", String.valueOf(plot)),
|
||||
Template.of("id", String.valueOf(plot.temp))
|
||||
TranslatableCaption.miniMessage("database.skipping_duplicated_plot"),
|
||||
Placeholder.miniMessage("plot", String.valueOf(plot)),
|
||||
Placeholder.miniMessage("id", String.valueOf(plot.temp))
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@ -207,13 +207,13 @@ public class DatabaseCommand extends SubCommand {
|
||||
}
|
||||
DBFunc.createPlotsAndData(
|
||||
plots,
|
||||
() -> player.sendMessage(TranslatableCaption.of("database.conversion_done"))
|
||||
() -> player.sendMessage(TranslatableCaption.miniMessage("database.conversion_done"))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case "mysql" -> {
|
||||
if (args.length < 6) {
|
||||
player.sendMessage(StaticCaption.of(
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"/plot database mysql [host] [port] [username] [password] [database] {prefix}"));
|
||||
return false;
|
||||
}
|
||||
@ -229,7 +229,7 @@ public class DatabaseCommand extends SubCommand {
|
||||
}
|
||||
case "sqlite" -> {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(StaticCaption.of("/plot database sqlite [file]"));
|
||||
player.sendMessage(StaticCaption.miniMessage("/plot database sqlite [file]"));
|
||||
return false;
|
||||
}
|
||||
File sqliteFile =
|
||||
@ -237,7 +237,7 @@ public class DatabaseCommand extends SubCommand {
|
||||
implementation = new SQLite(sqliteFile);
|
||||
}
|
||||
default -> {
|
||||
player.sendMessage(StaticCaption.of("/plot database [sqlite/mysql]"));
|
||||
player.sendMessage(StaticCaption.miniMessage("/plot database [sqlite/mysql]"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -252,19 +252,19 @@ public class DatabaseCommand extends SubCommand {
|
||||
DatabaseCommand.insertPlots(manager, plots, player);
|
||||
return true;
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.failed_to_save_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_begin"));
|
||||
e.printStackTrace();
|
||||
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_end")));
|
||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage(("errors.stacktrace_end")));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.invalid_args"));
|
||||
return false;
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
player.sendMessage(TranslatableCaption.of("database.failed_to_open"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.failed_to_open"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_begin"));
|
||||
e.printStackTrace();
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_end"));
|
||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_end"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("database.invalid_args"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -74,14 +75,14 @@ public class Debug extends SubCommand {
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debug <loadedchunks | player | debug-players | entitytypes | msg>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot debug <loadedchunks | player | debug-players | entitytypes | msg>")
|
||||
);
|
||||
}
|
||||
if (args.length > 0) {
|
||||
if ("player".equalsIgnoreCase(args[0])) {
|
||||
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
|
||||
player.sendMessage(StaticCaption.of("Key: " + meta.getKey() + " Value: " + meta
|
||||
player.sendMessage(StaticCaption.miniMessage("Key: " + meta.getKey() + " Value: " + meta
|
||||
.getValue()
|
||||
.toString() + " , "));
|
||||
}
|
||||
@ -90,9 +91,9 @@ public class Debug extends SubCommand {
|
||||
}
|
||||
if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) {
|
||||
final long start = System.currentTimeMillis();
|
||||
player.sendMessage(TranslatableCaption.of("debug.fetching_loaded_chunks"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debug.fetching_loaded_chunks"));
|
||||
TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption
|
||||
.of("Loaded chunks: " + this.worldUtil
|
||||
.miniMessage("Loaded chunks: " + this.worldUtil
|
||||
.getChunkChunks(player.getLocation().getWorldName())
|
||||
.size() + " (" + (System.currentTimeMillis()
|
||||
- start) + "ms) using thread: " + Thread.currentThread().getName())));
|
||||
@ -101,31 +102,31 @@ public class Debug extends SubCommand {
|
||||
if (args.length > 0 && "uuids".equalsIgnoreCase(args[0])) {
|
||||
final Collection<UUIDMapping> mappings = PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debug.cached_uuids"),
|
||||
Template.of("value", String.valueOf(mappings.size()))
|
||||
TranslatableCaption.miniMessage("debug.cached_uuids"),
|
||||
Placeholder.miniMessage("value", String.valueOf(mappings.size()))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0 && "debug-players".equalsIgnoreCase(args[0])) {
|
||||
player.sendMessage(TranslatableCaption.of("debug.player_in_debugmode"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debug.player_in_debugmode"));
|
||||
for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debug.player_in_debugmode_list"),
|
||||
Template.of("value", pp.getName())
|
||||
TranslatableCaption.miniMessage("debug.player_in_debugmode_list"),
|
||||
Placeholder.miniMessage("value", pp.getName())
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
|
||||
EntityCategories.init();
|
||||
player.sendMessage(TranslatableCaption.of("debug.entity_categories"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debug.entity_categories"));
|
||||
EntityCategory.REGISTRY.forEach(category -> {
|
||||
final StringBuilder builder =
|
||||
new StringBuilder("§7- §6").append(category.getId()).append("§7: §6");
|
||||
for (final EntityType entityType : category.getAll()) {
|
||||
builder.append(entityType.getId()).append(" ");
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("<prefix>" + builder));
|
||||
player.sendMessage(StaticCaption.miniMessage("<prefix>" + builder));
|
||||
});
|
||||
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
|
||||
.forEach(entityType -> {
|
||||
@ -134,7 +135,7 @@ public class Debug extends SubCommand {
|
||||
if (categoryCount > 0) {
|
||||
return;
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("<prefix>" + entityType.getName() + " is in "
|
||||
player.sendMessage(StaticCaption.miniMessage("<prefix>" + entityType.getName() + " is in "
|
||||
+ categoryCount + " categories"));
|
||||
});
|
||||
return true;
|
||||
@ -144,30 +145,32 @@ public class Debug extends SubCommand {
|
||||
.getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE)
|
||||
.getCaptions();
|
||||
TextComponent.Builder information = Component.text();
|
||||
Component header = MINI_MESSAGE.parse(TranslatableCaption.of("debug.debug_header").getComponent(player) + "\n");
|
||||
String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n";
|
||||
String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n";
|
||||
Component header = MINI_MESSAGE.parse(TranslatableCaption.miniMessage("debug.debug_header").getComponent(player) + "\n");
|
||||
String line = TranslatableCaption.miniMessage("debug.debug_line").getComponent(player) + "\n";
|
||||
String section = TranslatableCaption.miniMessage("debug.debug_section").getComponent(player) + "\n";
|
||||
information.append(header);
|
||||
information.append(MINI_MESSAGE.parse(section, Template.of("val", "PlotArea")));
|
||||
information.append(MINI_MESSAGE.deserialize(section,
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("val", "PlotArea"))));
|
||||
information.append(MINI_MESSAGE
|
||||
.parse(
|
||||
.deserialize(
|
||||
line,
|
||||
Template.of("var", "Plot Worlds"),
|
||||
Template.of("val", StringMan.join(this.plotAreaManager.getAllPlotAreas(), ", "))
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Plot Worlds"),
|
||||
Placeholder.miniMessage("val", StringMan.join(this.plotAreaManager.getAllPlotAreas(), ", ")))
|
||||
));
|
||||
information.append(
|
||||
MINI_MESSAGE.parse(
|
||||
MINI_MESSAGE.deserialize(
|
||||
line,
|
||||
Template.of("var", "Owned Plots"),
|
||||
Template.of("val", String.valueOf(PlotQuery.newQuery().allPlots().count()))
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Owned Plots"),
|
||||
Placeholder.miniMessage("val", String.valueOf(PlotQuery.newQuery().allPlots().count())))
|
||||
));
|
||||
information.append(MINI_MESSAGE.parse(section, Template.of("val", "Messages")));
|
||||
information.append(MINI_MESSAGE.parse(
|
||||
information.append(MINI_MESSAGE.deserialize(section,
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("val", "Messages"))));
|
||||
information.append(MINI_MESSAGE.deserialize(
|
||||
line,
|
||||
Template.of("var", "Total Messages"),
|
||||
Template.of("val", String.valueOf(captions.size()))
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Total Messages"),
|
||||
Placeholder.miniMessage("val", String.valueOf(captions.size())))
|
||||
));
|
||||
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build())));
|
||||
player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(information.build())));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ public class DebugAllowUnsafe extends SubCommand {
|
||||
|
||||
if (unsafeAllowed.contains(player.getUUID())) {
|
||||
unsafeAllowed.remove(player.getUUID());
|
||||
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_off"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("unsafe.debugallowunsafe_off"));
|
||||
} else {
|
||||
unsafeAllowed.add(player.getUUID());
|
||||
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_on"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("unsafe.debugallowunsafe_on"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -95,24 +95,24 @@ public class DebugExec extends SubCommand {
|
||||
case "analyze" -> {
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
PlotAnalysis analysis = plot.getComplexity(null);
|
||||
if (analysis != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.changes_column"),
|
||||
Template.of("value", String.valueOf(analysis.changes))
|
||||
TranslatableCaption.miniMessage("debugexec.changes_column"),
|
||||
Placeholder.miniMessage("value", String.valueOf(analysis.changes))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.starting_task"));
|
||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(PlotAnalysis value) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.analyze_done"),
|
||||
Template.of("command", "/plot debugexec analyze")
|
||||
TranslatableCaption.miniMessage("debugexec.analyze_done"),
|
||||
Placeholder.miniMessage("command", "/plot debugexec analyze")
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -121,10 +121,10 @@ public class DebugExec extends SubCommand {
|
||||
case "calibrate-analysis" -> {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec analyze <threshold>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot debugexec analyze <threshold>")
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.threshold_default"));
|
||||
return false;
|
||||
}
|
||||
double threshold;
|
||||
@ -132,14 +132,14 @@ public class DebugExec extends SubCommand {
|
||||
threshold = Integer.parseInt(args[1]) / 100d;
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.invalid_threshold"),
|
||||
Template.of("value", args[1])
|
||||
TranslatableCaption.miniMessage("debugexec.invalid_threshold"),
|
||||
Placeholder.miniMessage("value", args[1])
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.threshold_default_double"));
|
||||
return false;
|
||||
}
|
||||
PlotAnalysis.calcOptimalModifiers(
|
||||
() -> player.sendMessage(TranslatableCaption.of("debugexec.calibration_done")),
|
||||
() -> player.sendMessage(TranslatableCaption.miniMessage("debugexec.calibration_done")),
|
||||
threshold
|
||||
);
|
||||
return true;
|
||||
@ -149,25 +149,25 @@ public class DebugExec extends SubCommand {
|
||||
ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
|
||||
}
|
||||
if (ExpireManager.IMP.runAutomatedTask()) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.expiry_started"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.expiry_already_started"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "stop-expire" -> {
|
||||
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_halted"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_halted"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "remove-flag" -> {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec remove-flag <flag>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot debugexec remove-flag <flag>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -184,24 +184,24 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.cleared_flag"),
|
||||
Template.of("value", flag)
|
||||
TranslatableCaption.miniMessage("debugexec.cleared_flag"),
|
||||
Placeholder.miniMessage("value", flag)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case "start-rgar" -> {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Invalid syntax: /plot debugexec start-rgar <world>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Invalid syntax: /plot debugexec start-rgar <world>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
Template.of("value", args[1])
|
||||
TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
|
||||
Placeholder.miniMessage("value", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -212,23 +212,23 @@ public class DebugExec extends SubCommand {
|
||||
result = this.hybridUtils.scheduleRoadUpdate(area, 0);
|
||||
}
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "stop-rgar" -> {
|
||||
if (!HybridUtils.UPDATE) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_not_running"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_not_running"));
|
||||
return false;
|
||||
}
|
||||
HybridUtils.UPDATE = false;
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("<prefix><gold>Possible sub commands: </gold><gray>/plot debugexec <"
|
||||
player.sendMessage(StaticCaption.miniMessage("<prefix><gold>Possible sub commands: </gold><gray>/plot debugexec <"
|
||||
+ StringMan.join(allowedParams, " | ") + "></gray>"));
|
||||
return false;
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ public class DebugImportWorlds extends Command {
|
||||
) throws CommandException {
|
||||
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
|
||||
if (!(this.plotAreaManager instanceof SinglePlotAreaManager)) {
|
||||
player.sendMessage(TranslatableCaption.of("debugimportworlds.single_plot_area"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugimportworlds.single_plot_area"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea();
|
||||
PlotId id = PlotId.of(0, 0);
|
||||
File container = PlotSquared.platform().worldContainer();
|
||||
if (container.equals(new File("."))) {
|
||||
player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugimportworlds.world_container"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
for (File folder : container.listFiles()) {
|
||||
@ -87,7 +87,7 @@ public class DebugImportWorlds extends Command {
|
||||
if (name.length() > 16) {
|
||||
uuid = UUID.fromString(name);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_player"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_player"));
|
||||
uuid = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(name, 60000L);
|
||||
}
|
||||
if (uuid == null) {
|
||||
@ -103,7 +103,7 @@ public class DebugImportWorlds extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("players.done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.done"));
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ import com.plotsquared.core.inject.annotations.WorldFile;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.PremiumVerification;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.io.File;
|
||||
@ -132,9 +132,9 @@ public class DebugPaste extends SubCommand {
|
||||
.addFile(logFile);
|
||||
} catch (IOException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.latest_log"),
|
||||
Template.of("file", "latest.log"),
|
||||
Template.of("size", "14MB")
|
||||
TranslatableCaption.miniMessage("debugpaste.latest_log"),
|
||||
Placeholder.miniMessage("file", "latest.log"),
|
||||
Placeholder.miniMessage("size", "14MB")
|
||||
);
|
||||
}
|
||||
|
||||
@ -142,16 +142,16 @@ public class DebugPaste extends SubCommand {
|
||||
incendoPaster.addFile(this.configFile);
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.empty_file"),
|
||||
Template.of("file", "settings.yml")
|
||||
TranslatableCaption.miniMessage("debugpaste.empty_file"),
|
||||
Placeholder.miniMessage("file", "settings.yml")
|
||||
);
|
||||
}
|
||||
try {
|
||||
incendoPaster.addFile(this.worldfile);
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.empty_file"),
|
||||
Template.of("file", "worlds.yml")
|
||||
TranslatableCaption.miniMessage("debugpaste.empty_file"),
|
||||
Placeholder.miniMessage("file", "worlds.yml")
|
||||
);
|
||||
}
|
||||
|
||||
@ -163,8 +163,8 @@ public class DebugPaste extends SubCommand {
|
||||
incendoPaster.addFile(MultiverseWorlds, "Multiverse-Core/worlds.yml");
|
||||
} catch (final IOException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.skip_multiverse"),
|
||||
Template.of("file", "worlds.yml")
|
||||
TranslatableCaption.miniMessage("debugpaste.skip_multiverse"),
|
||||
Placeholder.miniMessage("file", "worlds.yml")
|
||||
);
|
||||
}
|
||||
|
||||
@ -178,21 +178,21 @@ public class DebugPaste extends SubCommand {
|
||||
final String link =
|
||||
String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.debug_report_created"),
|
||||
Template.of("url", link)
|
||||
TranslatableCaption.miniMessage("debugpaste.debug_report_created"),
|
||||
Placeholder.miniMessage("url", link)
|
||||
);
|
||||
} else {
|
||||
final String responseMessage = jsonObject.get("response").getAsString();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.creation_failed"),
|
||||
Template.of("value", responseMessage)
|
||||
TranslatableCaption.miniMessage("debugpaste.creation_failed"),
|
||||
Placeholder.miniMessage("value", responseMessage)
|
||||
);
|
||||
}
|
||||
} catch (final Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.creation_failed"),
|
||||
Template.of("value", throwable.getMessage())
|
||||
TranslatableCaption.miniMessage("debugpaste.creation_failed"),
|
||||
Placeholder.miniMessage("value", throwable.getMessage())
|
||||
);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -66,16 +66,16 @@ public class DebugRoadRegen extends SubCommand {
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
PlotArea area = player.getPlotAreaAbs();
|
||||
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
String kind = args[0].toLowerCase();
|
||||
@ -86,8 +86,8 @@ public class DebugRoadRegen extends SubCommand {
|
||||
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
|
||||
default:
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -97,24 +97,24 @@ public class DebugRoadRegen extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
} else if (plot.isMerged()) {
|
||||
player.sendMessage(TranslatableCaption.of("debug.requires_unmerged"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debug.requires_unmerged"));
|
||||
} else {
|
||||
PlotManager manager = area.getPlotManager();
|
||||
QueueCoordinator queue = area.getQueue();
|
||||
queue.setCompleteTask(() -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_done"),
|
||||
Template.of("value", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("debugroadregen.regen_done"),
|
||||
Placeholder.miniMessage("value", plot.getId().toString())
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_all"),
|
||||
Template.of("value", "/plot regenallroads")
|
||||
TranslatableCaption.miniMessage("debugroadregen.regen_all"),
|
||||
Placeholder.miniMessage("value", "/plot regenallroads")
|
||||
);
|
||||
});
|
||||
manager.createRoadEast(plot, queue);
|
||||
@ -132,19 +132,19 @@ public class DebugRoadRegen extends SubCommand {
|
||||
height = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_valid_number"),
|
||||
Template.of("value", "0, 256")
|
||||
TranslatableCaption.miniMessage("invalid.not_valid_number"),
|
||||
Placeholder.miniMessage("value", "0, 256")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else if (args.length != 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -152,25 +152,25 @@ public class DebugRoadRegen extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
}
|
||||
Plot plot = player.getCurrentPlot();
|
||||
PlotManager manager = area.getPlotManager();
|
||||
if (!(manager instanceof HybridPlotManager)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_plot_world"));
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.schematic"),
|
||||
Template.of("command", "/plot createroadschematic")
|
||||
TranslatableCaption.miniMessage("debugroadregen.schematic"),
|
||||
Placeholder.miniMessage("command", "/plot createroadschematic")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regenallroads"),
|
||||
Template.of("command", "/plot regenallroads")
|
||||
TranslatableCaption.miniMessage("debugroadregen.regenallroads"),
|
||||
Placeholder.miniMessage("command", "/plot regenallroads")
|
||||
);
|
||||
boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -43,10 +43,10 @@ public class DebugSaveTest extends SubCommand {
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
final List<Plot> plots = PlotQuery.newQuery().allPlots().asList();
|
||||
player.sendMessage(TranslatableCaption.of("debugsavetest.starting"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugsavetest.starting"));
|
||||
DBFunc.createPlotsAndData(
|
||||
plots,
|
||||
() -> player.sendMessage(TranslatableCaption.of("debugsavetest.done"))
|
||||
() -> player.sendMessage(TranslatableCaption.miniMessage("debugsavetest.done"))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlotExpression;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
|
||||
@ -70,29 +70,29 @@ public class Delete extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult();
|
||||
if (eventResult == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Delete")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Delete")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
boolean force = eventResult == Result.FORCE;
|
||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DELETE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
final PlotArea plotArea = plot.getArea();
|
||||
@ -102,7 +102,7 @@ public class Delete extends SubCommand {
|
||||
player.getPlotCount(location.getWorldName());
|
||||
Runnable run = () -> {
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return;
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
@ -120,21 +120,22 @@ public class Delete extends SubCommand {
|
||||
if (value > 0d) {
|
||||
this.econHandler.depositMoney(player, value);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.added_balance"),
|
||||
Template.of("money", this.econHandler.format(value))
|
||||
TranslatableCaption.miniMessage("economy.added_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(value))
|
||||
);
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.deleting_done"),
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("working.deleting_done"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
eventDispatcher.callPostDelete(plot);
|
||||
});
|
||||
if (result) {
|
||||
plot.addRunning();
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
}
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
|
@ -42,7 +42,7 @@ import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -52,7 +52,7 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "deny",
|
||||
aliases = {"d", "ban"},
|
||||
usage = "/plot deny <player",
|
||||
usage = "/plot deny <player>",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
public class Deny extends SubCommand {
|
||||
@ -79,36 +79,36 @@ public class Deny extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return true;
|
||||
}
|
||||
|
||||
int maxDenySize = Permissions.hasPermissionRange(player, Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS);
|
||||
int size = plot.getDenied().size();
|
||||
if (size > (maxDenySize - 1)) {
|
||||
if (size >= maxDenySize) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("members.plot_max_members_denied"),
|
||||
Template.of("amount", String.valueOf(size))
|
||||
TranslatableCaption.miniMessage("members.plot_max_members_denied"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(size))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null || uuids.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
} else {
|
||||
for (UUID uuid : uuids) {
|
||||
@ -116,16 +116,16 @@ public class Deny extends SubCommand {
|
||||
Permissions.hasPermission(player, Permission.PERMISSION_DENY_EVERYONE) || Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
} else if (plot.isOwner(uuid)) {
|
||||
player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("deny.cant_remove_owner"));
|
||||
return;
|
||||
} else if (plot.getDenied().contains(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.already_added"),
|
||||
Template.of("player", PlayerManager.getName(uuid))
|
||||
TranslatableCaption.miniMessage("member.already_added"),
|
||||
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
@ -148,7 +148,7 @@ public class Deny extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("deny.denied_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("deny.denied_added"));
|
||||
}
|
||||
});
|
||||
|
||||
@ -157,7 +157,7 @@ public class Deny extends SubCommand {
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
private void handleKick(PlotPlayer<?> player, Plot plot) {
|
||||
@ -175,7 +175,7 @@ public class Deny extends SubCommand {
|
||||
}
|
||||
Location location = player.getLocation();
|
||||
Location spawn = this.worldUtil.getSpawn(location.getWorldName());
|
||||
player.sendMessage(TranslatableCaption.of("deny.you_got_denied"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("deny.you_got_denied"));
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
|
||||
if (plot.equals(newSpawn.getPlot())) {
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@CommandDeclaration(command = "setdescription",
|
||||
@ -60,13 +60,13 @@ public class Desc extends SetCommand {
|
||||
.getFlag(DescriptionFlag.class), plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Description removal")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Description removal")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
plot.removeFlag(event.getFlag());
|
||||
player.sendMessage(TranslatableCaption.of("desc.desc_unset"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("desc.desc_unset"));
|
||||
return true;
|
||||
}
|
||||
PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot
|
||||
@ -75,17 +75,17 @@ public class Desc extends SetCommand {
|
||||
.createFlagInstance(desc), plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Description set")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Description set")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
boolean result = plot.setFlag(event.getFlag());
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("desc.desc_set"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("desc.desc_set"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,11 @@ public class Dislike extends SubCommand {
|
||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@CommandDeclaration(command = "done",
|
||||
@ -70,35 +70,35 @@ public class Done extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
PlotDoneEvent event = this.eventDispatcher.callDone(plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Done")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Done")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
boolean force = event.getEventResult() == Result.FORCE;
|
||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DONE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (DoneFlag.isDone(plot)) {
|
||||
player.sendMessage(TranslatableCaption.of("done.done_already_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_already_done"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("web.generating_link"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||
@ -120,7 +120,7 @@ public class Done extends SubCommand {
|
||||
|
||||
private void finish(Plot plot, PlotPlayer<?> player, boolean success) {
|
||||
if (!success) {
|
||||
player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_insufficient_complexity"));
|
||||
return;
|
||||
}
|
||||
long flagValue = System.currentTimeMillis() / 1000;
|
||||
@ -128,11 +128,11 @@ public class Done extends SubCommand {
|
||||
.createFlagInstance(Long.toString(flagValue));
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(TranslatableCaption.of("events.event_denied"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("events.event_denied"));
|
||||
return;
|
||||
}
|
||||
plot.setFlag(plotFlag);
|
||||
player.sendMessage(TranslatableCaption.of("done.done_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_success"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.net.URL;
|
||||
@ -82,36 +82,36 @@ public class Download extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
String world = player.getLocation().getWorldName();
|
||||
if (!this.plotAreaManager.hasPlotArea(world)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("done.done_not_done"));
|
||||
return false;
|
||||
}
|
||||
if ((!plot.isOwner(player.getUUID())) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0 || (args.length == 1 && StringMan
|
||||
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
@ -120,12 +120,12 @@ public class Download extends SubCommand {
|
||||
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD_WORLD)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_DOWNLOAD_WORLD.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_DOWNLOAD_WORLD.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.mca_file_size"));
|
||||
plot.addRunning();
|
||||
this.worldUtil.saveWorld(world);
|
||||
this.worldUtil.upload(plot, null, null, new RunnableVal<>() {
|
||||
@ -134,19 +134,19 @@ public class Download extends SubCommand {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link_failed"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("web.generating_link_failed"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
return;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("web.generation_link_success_legacy_world"), Template.of("url", url.toString()));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("web.generation_link_success_legacy_world"), Placeholder.miniMessage("url", url.toString()));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendUsage(player);
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", plot.getId().toString()));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("web.generating_link"), Placeholder.miniMessage("plot", plot.getId().toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -173,11 +173,11 @@ public class Download extends SubCommand {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
private void upload(PlotPlayer<?> player, Plot plot) {
|
||||
@ -189,11 +189,11 @@ public class Download extends SubCommand {
|
||||
@Override
|
||||
public void run(URL value) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generation_link_success"),
|
||||
Template.of("download", value.toString()),
|
||||
Template.of("delete", "Not available")
|
||||
TranslatableCaption.miniMessage("web.generation_link_success"),
|
||||
Placeholder.miniMessage("download", value.toString()),
|
||||
Placeholder.miniMessage("delete", "Not available")
|
||||
);
|
||||
player.sendMessage(StaticCaption.of(value.toString()));
|
||||
player.sendMessage(StaticCaption.miniMessage(value.toString()));
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -204,14 +204,14 @@ public class Download extends SubCommand {
|
||||
.whenComplete((result, throwable) -> {
|
||||
if (throwable != null || !result.isSuccess()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link_failed"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("web.generating_link_failed"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generation_link_success"),
|
||||
Template.of("download", result.getDownloadUrl()),
|
||||
Template.of("delete", result.getDeletionUrl())
|
||||
TranslatableCaption.miniMessage("web.generation_link_success"),
|
||||
Placeholder.miniMessage("download", result.getDownloadUrl()),
|
||||
Placeholder.miniMessage("delete", result.getDeletionUrl())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -28,8 +28,8 @@ package com.plotsquared.core.command;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.caption.Placeholders;
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||
@ -53,7 +53,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@ -85,8 +86,8 @@ public final class FlagCommand extends Command {
|
||||
|
||||
private static boolean sendMessage(PlotPlayer<?> player) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot flag <set | remove | add | list | info> <flag> <value>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot flag <set | remove | add | list | info> <flag> <value>")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -111,8 +112,8 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
if (!result) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage(
|
||||
"node",
|
||||
perm
|
||||
)
|
||||
@ -131,16 +132,16 @@ public final class FlagCommand extends Command {
|
||||
);
|
||||
final boolean result = Permissions.hasPermission(player, permission);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", permission));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_permission"), Placeholder.miniMessage("node", permission));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (final FlagParseException e) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", flag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
TranslatableCaption.miniMessage("flag.flag_parse_error"),
|
||||
Placeholder.miniMessage("flag_name", flag.getName()),
|
||||
Placeholder.miniMessage("flag_value", e.getValue()),
|
||||
Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return false;
|
||||
} catch (final Exception e) {
|
||||
@ -157,7 +158,7 @@ public final class FlagCommand extends Command {
|
||||
perm = basePerm;
|
||||
}
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", perm));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_permission"), Placeholder.miniMessage("node", perm));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -171,18 +172,18 @@ public final class FlagCommand extends Command {
|
||||
final Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_SET_FLAG_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SET_FLAG_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -216,14 +217,14 @@ public final class FlagCommand extends Command {
|
||||
final String best = stringComparison.getBestMatch();
|
||||
if (best != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.not_valid_flag_suggested"),
|
||||
Template.of("value", best)
|
||||
TranslatableCaption.miniMessage("flag.not_valid_flag_suggested"),
|
||||
Placeholder.miniMessage("value", best)
|
||||
);
|
||||
suggested = true;
|
||||
}
|
||||
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
|
||||
if (!suggested) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.not_valid_flag"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_flag"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -325,8 +326,8 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot flag set <flag> <value>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.component("value", Component.text("/plot flag set <flag> <value>"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -338,8 +339,8 @@ public final class FlagCommand extends Command {
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Flag set")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Flag set")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -354,16 +355,16 @@ public final class FlagCommand extends Command {
|
||||
parsed = plotFlag.parse(value);
|
||||
} catch (final FlagParseException e) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", plotFlag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
TranslatableCaption.miniMessage("flag.flag_parse_error"),
|
||||
Placeholder.miniMessage("flag_name", plotFlag.getName()),
|
||||
Placeholder.miniMessage("flag_value", e.getValue()),
|
||||
Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return;
|
||||
}
|
||||
plot.setFlag(parsed);
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
|
||||
Template.of("value", String.valueOf(parsed))
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", String.valueOf(args[0])),
|
||||
Placeholder.miniMessage("value", String.valueOf(parsed))
|
||||
);
|
||||
}
|
||||
|
||||
@ -383,8 +384,8 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot flag add <flag> <values>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot flag add <flag> <values>")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -396,8 +397,8 @@ public final class FlagCommand extends Command {
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Flag add")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Flag add")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -417,21 +418,21 @@ public final class FlagCommand extends Command {
|
||||
parsed = event.getFlag().parse(value);
|
||||
} catch (FlagParseException e) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", plotFlag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Template.of("error", e.getErrorMessage().getComponent(player))
|
||||
TranslatableCaption.miniMessage("flag.flag_parse_error"),
|
||||
Placeholder.miniMessage("flag_name", plotFlag.getName()),
|
||||
Placeholder.miniMessage("flag_value", e.getValue()),
|
||||
Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
|
||||
);
|
||||
return;
|
||||
}
|
||||
boolean result =
|
||||
player.getLocation().getPlotAbs().setFlag(localFlag.merge(parsed.getValue()));
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
|
||||
return;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
|
||||
Template.of("value", String.valueOf(parsed))
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", String.valueOf(args[0])),
|
||||
Placeholder.miniMessage("value", String.valueOf(parsed))
|
||||
);
|
||||
}
|
||||
|
||||
@ -451,8 +452,8 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot flag remove <flag> [values]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot flag remove <flag> [values]")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -464,8 +465,8 @@ public final class FlagCommand extends Command {
|
||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Flag remove")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Flag remove")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -474,8 +475,8 @@ public final class FlagCommand extends Command {
|
||||
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))) {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -489,27 +490,27 @@ public final class FlagCommand extends Command {
|
||||
parsedFlag = listFlag.parse(value);
|
||||
} catch (final FlagParseException e) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_parse_error"),
|
||||
Template.of("flag_name", flag.getName()),
|
||||
Template.of("flag_value", e.getValue()),
|
||||
Template.of("error", String.valueOf(e.getErrorMessage()))
|
||||
TranslatableCaption.miniMessage("flag.flag_parse_error"),
|
||||
Placeholder.miniMessage("flag_name", flag.getName()),
|
||||
Placeholder.miniMessage("flag_value", e.getValue()),
|
||||
Placeholder.miniMessage("error", String.valueOf(e.getErrorMessage()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (((List<?>) parsedFlag.getValue()).isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
|
||||
return;
|
||||
}
|
||||
if (list.removeAll((List) parsedFlag.getValue())) {
|
||||
if (list.isEmpty()) {
|
||||
if (plot.removeFlag(flag)) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_removed"), Placeholder.miniMessage("flag", args[0]), Placeholder.miniMessage(
|
||||
"value",
|
||||
String.valueOf(flag)
|
||||
));
|
||||
return;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -517,31 +518,31 @@ public final class FlagCommand extends Command {
|
||||
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (addEvent.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Re-addition of " + plotFlag.getName())
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Re-addition of " + plotFlag.getName())
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (plot.setFlag(addEvent.getFlag())) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_partially_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_partially_removed"));
|
||||
return;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
boolean result = plot.removeFlag(flag);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_removed"), Placeholder.miniMessage("flag", args[0]), Placeholder.miniMessage(
|
||||
"value",
|
||||
String.valueOf(flag)
|
||||
));
|
||||
@ -576,23 +577,25 @@ public final class FlagCommand extends Command {
|
||||
for (final Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
|
||||
Collections.sort(entry.getValue());
|
||||
Component category =
|
||||
MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("flag.flag_list_categories").getComponent(player),
|
||||
Template.of("category", entry.getKey())
|
||||
MINI_MESSAGE.deserialize(
|
||||
TranslatableCaption.miniMessage("flag.flag_list_categories").getComponent(player),
|
||||
PlaceholderResolver.placeholders(Placeholder.miniMessage("category", entry.getKey()))
|
||||
);
|
||||
TextComponent.Builder builder = Component.text().append(category);
|
||||
final Iterator<String> flagIterator = entry.getValue().iterator();
|
||||
while (flagIterator.hasNext()) {
|
||||
final String flag = flagIterator.next();
|
||||
builder.append(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("flag.flag_list_flag").getComponent(player),
|
||||
Template.of("command", "/plot flag info " + flag),
|
||||
Template.of("flag", flag),
|
||||
Template.of("suffix", flagIterator.hasNext() ? ", " : "")
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("flag.flag_list_flag").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("command", "/plot flag info " + flag),
|
||||
Placeholder.miniMessage("flag", flag),
|
||||
Placeholder.miniMessage("suffix", flagIterator.hasNext() ? ", " : "")
|
||||
)
|
||||
));
|
||||
}
|
||||
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
|
||||
player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.build())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,41 +615,41 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot flag info <flag>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot flag info <flag>")
|
||||
);
|
||||
return;
|
||||
}
|
||||
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
|
||||
if (plotFlag != null) {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_header"));
|
||||
// Flag name
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_info_name"), Template.of("flag", plotFlag.getName()));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_name"), Placeholder.miniMessage("flag", plotFlag.getName()));
|
||||
// Flag category
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_info_category"),
|
||||
Templates.of(player, "value", plotFlag.getFlagCategory())
|
||||
TranslatableCaption.miniMessage("flag.flag_info_category"),
|
||||
Placeholder.component("value", MINI_MESSAGE.parse(plotFlag.getFlagCategory().getComponent(player)))
|
||||
);
|
||||
// Flag description
|
||||
// TODO maybe merge and \n instead?
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_info_description"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_description"));
|
||||
player.sendMessage(plotFlag.getFlagDescription());
|
||||
// Flag example
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_info_example"),
|
||||
Template.of("command", "/plot flag set"),
|
||||
Template.of("flag", plotFlag.getName()),
|
||||
Template.of("value", plotFlag.getExample())
|
||||
TranslatableCaption.miniMessage("flag.flag_info_example"),
|
||||
Placeholder.miniMessage("command", "/plot flag set"),
|
||||
Placeholder.miniMessage("flag", plotFlag.getName()),
|
||||
Placeholder.miniMessage("value", plotFlag.getExample())
|
||||
);
|
||||
// Default value
|
||||
final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
|
||||
.getFlagErased(plotFlag.getClass()).toString();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flag.flag_info_default_value"),
|
||||
Template.of("value", defaultValue)
|
||||
TranslatableCaption.miniMessage("flag.flag_info_default_value"),
|
||||
Placeholder.miniMessage("value", defaultValue)
|
||||
);
|
||||
// Footer. Done this way to prevent the duplicate-message-thingy from catching it
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_footer"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -70,16 +70,16 @@ public class Grant extends Command {
|
||||
) throws CommandException {
|
||||
checkTrue(
|
||||
args.length >= 1 && args.length <= 2,
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot grant <check | add> [player]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot grant <check | add> [player]")
|
||||
);
|
||||
final String arg0 = args[0].toLowerCase();
|
||||
switch (arg0) {
|
||||
case "add", "check" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_GRANT.format(arg0))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_GRANT.format(arg0))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_GRANT.format(arg0))
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -88,11 +88,11 @@ public class Grant extends Command {
|
||||
}
|
||||
PlayerManager.getUUIDsFromString(args[1], (uuids, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null || uuids.size() != 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", String.valueOf(uuids))
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", String.valueOf(uuids))
|
||||
);
|
||||
} else {
|
||||
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
|
||||
@ -102,8 +102,8 @@ public class Grant extends Command {
|
||||
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
|
||||
if (args[0].equalsIgnoreCase("check")) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("grants.granted_plots"),
|
||||
Template.of("amount", String.valueOf(access.get().orElse(0)))
|
||||
TranslatableCaption.miniMessage("grants.granted_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(access.get().orElse(0)))
|
||||
);
|
||||
} else {
|
||||
access.set(access.get().orElse(0) + 1);
|
||||
@ -122,8 +122,8 @@ public class Grant extends Command {
|
||||
granted = Ints.fromByteArray(array);
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("grants.granted_plots"),
|
||||
Template.of("amount", String.valueOf(granted))
|
||||
TranslatableCaption.miniMessage("grants.granted_plots"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(granted))
|
||||
);
|
||||
} else { // add
|
||||
int amount;
|
||||
@ -137,8 +137,8 @@ public class Grant extends Command {
|
||||
byte[] rawData = Ints.toByteArray(amount);
|
||||
DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("grants.added"),
|
||||
Template.of("grants", String.valueOf(amount))
|
||||
TranslatableCaption.miniMessage("grants.added"),
|
||||
Placeholder.miniMessage("grants", String.valueOf(amount))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -176,11 +176,11 @@ public class Grant extends Command {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_GRANT_SINGLE) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
@ -117,27 +118,31 @@ public class Help extends Command {
|
||||
}
|
||||
if (cat == null && page == 0) {
|
||||
TextComponent.Builder builder = Component.text();
|
||||
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player)));
|
||||
builder.append(MINI_MESSAGE.parse(TranslatableCaption.miniMessage("help.help_header").getComponent(player)));
|
||||
for (CommandCategory c : CommandCategory.values()) {
|
||||
builder.append(Component.newline()).append(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("help.help_info_item").getComponent(player),
|
||||
Template.of("command", "/plot help"),
|
||||
Template.of("category", c.name().toLowerCase()),
|
||||
Template.of("category_desc", c.getComponent(player))
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("help.help_info_item").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("command", "/plot help"),
|
||||
Placeholder.miniMessage("category", c.name().toLowerCase()),
|
||||
Placeholder.miniMessage("category_desc", c.getComponent(player))
|
||||
)
|
||||
));
|
||||
}
|
||||
builder.append(Component.newline()).append(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("help.help_info_item").getComponent(player),
|
||||
Template.of("command", "/plot help"),
|
||||
Template.of("category", "all"),
|
||||
Template.of("category_desc", "Display all commands")
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("help.help_info_item").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("command", "/plot help"),
|
||||
Placeholder.miniMessage("category", "all"),
|
||||
Placeholder.miniMessage("category_desc", "Display all commands")
|
||||
)
|
||||
));
|
||||
builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption
|
||||
.of("help.help_footer")
|
||||
.miniMessage("help.help_footer")
|
||||
.getComponent(player)));
|
||||
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
|
||||
player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.asComponent())));
|
||||
return true;
|
||||
}
|
||||
new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages().generatePage(
|
||||
|
@ -42,7 +42,7 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -74,13 +74,13 @@ public class HomeCommand extends Command {
|
||||
) {
|
||||
List<Plot> plots = query.asList();
|
||||
if (plots.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
|
||||
return;
|
||||
} else if (plots.size() < page || page < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.number_not_in_range"),
|
||||
Template.of("min", "1"),
|
||||
Template.of("max", String.valueOf(plots.size()))
|
||||
TranslatableCaption.miniMessage("invalid.number_not_in_range"),
|
||||
Placeholder.miniMessage("min", "1"),
|
||||
Placeholder.miniMessage("max", String.valueOf(plots.size()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -114,8 +114,8 @@ public class HomeCommand extends Command {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_HOME)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_VISIT_OWNED.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_VISIT_OWNED.toString())
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -136,8 +136,8 @@ public class HomeCommand extends Command {
|
||||
page = Integer.parseInt(identifier);
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", identifier)
|
||||
TranslatableCaption.miniMessage("invalid.not_a_number"),
|
||||
Placeholder.miniMessage("value", identifier)
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
@ -177,8 +177,8 @@ public class HomeCommand extends Command {
|
||||
page = Integer.parseInt(identifier);
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", identifier)
|
||||
TranslatableCaption.miniMessage("invalid.not_a_number"),
|
||||
Placeholder.miniMessage("value", identifier)
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.plotsquared.core.configuration.caption.Placeholders;
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.MetaDataAccess;
|
||||
@ -43,7 +43,8 @@ import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -60,7 +61,7 @@ public class Inbox extends SubCommand {
|
||||
|
||||
public void displayComments(PlotPlayer<?> player, List<PlotComment> oldComments, int page) {
|
||||
if (oldComments == null || oldComments.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.inbox_empty"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.inbox_empty"));
|
||||
return;
|
||||
}
|
||||
PlotComment[] comments = oldComments.toArray(new PlotComment[0]);
|
||||
@ -79,55 +80,55 @@ public class Inbox extends SubCommand {
|
||||
max = comments.length;
|
||||
}
|
||||
TextComponent.Builder builder = Component.text();
|
||||
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n',
|
||||
Template.of("amount", String.valueOf(comments.length)), Template.of("cur", String.valueOf(page + 1)),
|
||||
Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all")
|
||||
builder.append(MINI_MESSAGE.deserialize(TranslatableCaption.miniMessage("list.comment_list_header_paged").getComponent(player) + '\n',
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("amount", String.valueOf(comments.length)), Placeholder.miniMessage("cur", String.valueOf(page + 1)),
|
||||
Placeholder.miniMessage("max", String.valueOf(totalPages + 1)), Placeholder.miniMessage("word", "all")
|
||||
)
|
||||
));
|
||||
|
||||
// This might work xD
|
||||
for (int x = page * 12; x < max; x++) {
|
||||
PlotComment comment = comments[x];
|
||||
Component commentColored;
|
||||
if (player.getName().equals(comment.senderName)) {
|
||||
commentColored = MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("list.comment_list_by_lister").getComponent(player),
|
||||
Template.of("comment", comment.comment)
|
||||
String localeKey = player.getName().equals(comment.senderName) ?
|
||||
"list.comment_list_by_lister" : "list.comment_list_by_other";
|
||||
|
||||
Placeholder<Component> commentColored = Placeholder.component("comment", MINI_MESSAGE.deserialize(
|
||||
TranslatableCaption.miniMessage(localeKey).getComponent(player), PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("comment", comment.comment)
|
||||
))
|
||||
);
|
||||
} else {
|
||||
commentColored = MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("list.comment_list_by_other").getComponent(player),
|
||||
Template.of("comment", comment.comment)
|
||||
);
|
||||
}
|
||||
Template number = Template.of("number", String.valueOf(x));
|
||||
Template world = Template.of("world", comment.world);
|
||||
Template plot_id = Template.of("plot_id", comment.id.getX() + ";" + comment.id.getY());
|
||||
Template commenter = Template.of("commenter", comment.senderName);
|
||||
Template commentTemplate = Template.of("comment", commentColored);
|
||||
Placeholder<?> number = Placeholder.miniMessage("number", String.valueOf(x));
|
||||
Placeholder<?> world = Placeholder.miniMessage("world", comment.world);
|
||||
Placeholder<?> plot_id = Placeholder.miniMessage("plot_id", comment.id.getX() + ";" + comment.id.getY());
|
||||
Placeholder<?> commenter = Placeholder.miniMessage("commenter", comment.senderName);
|
||||
builder.append(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("list.comment_list_comment").getComponent(player),
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("list.comment_list_comment").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
number,
|
||||
world,
|
||||
plot_id,
|
||||
commenter,
|
||||
commentTemplate
|
||||
));
|
||||
commentColored
|
||||
)));
|
||||
// Apply line break if not last entry
|
||||
if (x != max - 1) {
|
||||
builder.append(Component.newline());
|
||||
}
|
||||
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
|
||||
}
|
||||
player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.build())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
@ -149,21 +150,21 @@ public class Inbox extends SubCommand {
|
||||
}
|
||||
if (total != 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.inbox_item"),
|
||||
Template.of("value", inbox + " (" + total + '/' + unread + ')')
|
||||
TranslatableCaption.miniMessage("comment.inbox_item"),
|
||||
Placeholder.miniMessage("value", inbox + " (" + total + '/' + unread + ')')
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.inbox_item"),
|
||||
Template.of("value", inbox.toString())
|
||||
TranslatableCaption.miniMessage("comment.inbox_item"),
|
||||
Placeholder.miniMessage("value", inbox.toString())
|
||||
);
|
||||
}
|
||||
})) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.inbox_item"),
|
||||
Template.of("value", inbox.toString())
|
||||
TranslatableCaption.miniMessage("comment.inbox_item"),
|
||||
Placeholder.miniMessage("value", inbox.toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -173,8 +174,8 @@ public class Inbox extends SubCommand {
|
||||
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
|
||||
if (inbox == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.invalid_inbox"),
|
||||
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
|
||||
TranslatableCaption.miniMessage("comment.invalid_inbox"),
|
||||
Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -191,13 +192,13 @@ public class Inbox extends SubCommand {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "delete":
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox_modify"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot inbox " + inbox + " delete <index>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot inbox " + inbox + " delete <index>")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -206,15 +207,15 @@ public class Inbox extends SubCommand {
|
||||
index = Integer.parseInt(args[2]);
|
||||
if (index < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
||||
Templates.of("number", index)
|
||||
TranslatableCaption.miniMessage("comment.not_valid_inbox_index"),
|
||||
Placeholders.miniMessage("number", index)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot inbox " + inbox + " delete <index>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot inbox " + inbox + " delete <index>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -224,8 +225,8 @@ public class Inbox extends SubCommand {
|
||||
public void run(List<PlotComment> value) {
|
||||
if (index > value.size()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
||||
Templates.of("number", index)
|
||||
TranslatableCaption.miniMessage("comment.not_valid_inbox_index"),
|
||||
Placeholders.miniMessage("number", index)
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -234,29 +235,29 @@ public class Inbox extends SubCommand {
|
||||
boolean success = plot.getPlotCommentContainer().removeComment(comment);
|
||||
if (success) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
Template.of("value", comment.comment)
|
||||
TranslatableCaption.miniMessage("comment.comment_removed_success"),
|
||||
Placeholder.miniMessage("value", comment.comment)
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_failure"));
|
||||
TranslatableCaption.miniMessage("comment.comment_removed_failure"));
|
||||
}
|
||||
}
|
||||
})) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case "clear":
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox_modify"));
|
||||
}
|
||||
inbox.clearInbox(plot);
|
||||
List<PlotComment> comments = plot.getPlotCommentContainer().getComments(inbox.toString());
|
||||
if (!comments.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
Template.of("value", String.valueOf(comments))
|
||||
TranslatableCaption.miniMessage("comment.comment_removed_success"),
|
||||
Placeholder.miniMessage("value", String.valueOf(comments))
|
||||
);
|
||||
plot.getPlotCommentContainer().removeComments(comments);
|
||||
}
|
||||
@ -273,7 +274,7 @@ public class Inbox extends SubCommand {
|
||||
page = 1;
|
||||
}
|
||||
if (!inbox.canRead(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox"));
|
||||
return false;
|
||||
}
|
||||
if (!inbox.getComments(plot, new RunnableVal<>() {
|
||||
@ -282,7 +283,7 @@ public class Inbox extends SubCommand {
|
||||
displayComments(player, value, page);
|
||||
}
|
||||
})) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -307,11 +308,11 @@ public class Inbox extends SubCommand {
|
||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.CHAT) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_INBOX) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -76,7 +76,7 @@ public class Info extends SubCommand {
|
||||
plot = player.getCurrentPlot();
|
||||
}
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -96,8 +96,8 @@ public class Info extends SubCommand {
|
||||
if (!player
|
||||
.hasPermission(Permission.PERMISSION_AREA_INFO_FORCE.toString())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_AREA_INFO_FORCE.toString())
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_AREA_INFO_FORCE.toString())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class Info extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (!allowed) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_info_hidden"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_info_hidden"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -118,22 +118,22 @@ public class Info extends SubCommand {
|
||||
// Unclaimed?
|
||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("info.plot_info_unclaimed"),
|
||||
Template.of("plot", plot.getId().getX() + ";" + plot.getId().getY())
|
||||
TranslatableCaption.miniMessage("info.plot_info_unclaimed"),
|
||||
Placeholder.miniMessage("plot", plot.getId().getX() + ";" + plot.getId().getY())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
Caption info = TranslatableCaption.of("info.plot_info_format");
|
||||
Caption info = TranslatableCaption.miniMessage("info.plot_info_format");
|
||||
boolean full;
|
||||
if (arg != null) {
|
||||
info = getCaption(arg);
|
||||
if (info == null) {
|
||||
if (Settings.Ratings.USE_LIKES) {
|
||||
player.sendMessage(StaticCaption.of(
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
|
||||
+ "&aowner&7, " + " &alikes"));
|
||||
} else {
|
||||
player.sendMessage(StaticCaption.of(
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
|
||||
+ "&aowner&7, " + " &arating"));
|
||||
}
|
||||
@ -161,7 +161,7 @@ public class Info extends SubCommand {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO_FORCE) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
|
||||
return commands;
|
||||
@ -169,19 +169,19 @@ public class Info extends SubCommand {
|
||||
|
||||
private Caption getCaption(String string) {
|
||||
return switch (string) {
|
||||
case "trusted" -> TranslatableCaption.of("info.plot_info_trusted");
|
||||
case "alias" -> TranslatableCaption.of("info.plot_info_alias");
|
||||
case "biome" -> TranslatableCaption.of("info.plot_info_biome");
|
||||
case "denied" -> TranslatableCaption.of("info.plot_info_denied");
|
||||
case "flags" -> TranslatableCaption.of("info.plot_info_flags");
|
||||
case "id" -> TranslatableCaption.of("info.plot_info_id");
|
||||
case "size" -> TranslatableCaption.of("info.plot_info_size");
|
||||
case "members" -> TranslatableCaption.of("info.plot_info_members");
|
||||
case "owner" -> TranslatableCaption.of("info.plot_info_owner");
|
||||
case "rating" -> TranslatableCaption.of("info.plot_info_rating");
|
||||
case "likes" -> TranslatableCaption.of("info.plot_info_likes");
|
||||
case "seen" -> TranslatableCaption.of("info.plot_info_seen");
|
||||
case "creationdate" -> TranslatableCaption.of("info.plot_info_creationdate");
|
||||
case "trusted" -> TranslatableCaption.miniMessage("info.plot_info_trusted");
|
||||
case "alias" -> TranslatableCaption.miniMessage("info.plot_info_alias");
|
||||
case "biome" -> TranslatableCaption.miniMessage("info.plot_info_biome");
|
||||
case "denied" -> TranslatableCaption.miniMessage("info.plot_info_denied");
|
||||
case "flags" -> TranslatableCaption.miniMessage("info.plot_info_flags");
|
||||
case "id" -> TranslatableCaption.miniMessage("info.plot_info_id");
|
||||
case "size" -> TranslatableCaption.miniMessage("info.plot_info_size");
|
||||
case "members" -> TranslatableCaption.miniMessage("info.plot_info_members");
|
||||
case "owner" -> TranslatableCaption.miniMessage("info.plot_info_owner");
|
||||
case "rating" -> TranslatableCaption.miniMessage("info.plot_info_rating");
|
||||
case "likes" -> TranslatableCaption.miniMessage("info.plot_info_likes");
|
||||
case "seen" -> TranslatableCaption.miniMessage("info.plot_info_seen");
|
||||
case "creationdate" -> TranslatableCaption.miniMessage("info.plot_info_creationdate");
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -74,22 +74,22 @@ public class Kick extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_KICK)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null || uuids.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
} else {
|
||||
Set<PlotPlayer<?>> players = new HashSet<>();
|
||||
@ -112,28 +112,28 @@ public class Kick extends SubCommand {
|
||||
players.remove(player); // Don't ever kick the calling player
|
||||
if (players.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (PlotPlayer<?> player2 : players) {
|
||||
if (!plot.equals(player2.getCurrentPlot())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(player2, Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.cannot_kick_player"),
|
||||
Template.of("name", player2.getName())
|
||||
TranslatableCaption.miniMessage("cluster.cannot_kick_player"),
|
||||
Placeholder.miniMessage("name", player2.getName())
|
||||
);
|
||||
return;
|
||||
}
|
||||
Location spawn = this.worldUtil.getSpawn(location.getWorldName());
|
||||
player2.sendMessage(TranslatableCaption.of("kick.you_got_kicked"));
|
||||
player2.sendMessage(TranslatableCaption.miniMessage("kick.you_got_kicked"));
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
|
||||
if (plot.equals(newSpawn.getPlot())) {
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -59,10 +59,10 @@ public class Leave extends Command {
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone
|
||||
) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned"));
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
if (plot.isOwner(player.getUUID())) {
|
||||
player.sendMessage(TranslatableCaption.of("member.plot_cant_leave_owner"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("member.plot_cant_leave_owner"));
|
||||
} else {
|
||||
UUID uuid = player.getUUID();
|
||||
if (plot.isAdded(uuid)) {
|
||||
@ -73,12 +73,12 @@ public class Leave extends Command {
|
||||
this.eventDispatcher.callMember(player, plot, uuid, false);
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.plot_left"),
|
||||
Template.of("player", player.getName())
|
||||
TranslatableCaption.miniMessage("member.plot_left"),
|
||||
Placeholder.miniMessage("player", player.getName())
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("members.not_added_trusted")
|
||||
TranslatableCaption.miniMessage("members.not_added_trusted")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -115,17 +115,17 @@ public class Like extends SubCommand {
|
||||
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
|
||||
plot.teleportPlayer(player, TeleportCause.COMMAND_LIKE, result -> {
|
||||
});
|
||||
player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("tutorial.rate_this"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
|
||||
return true;
|
||||
}
|
||||
case "purge" -> {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
@ -133,34 +133,34 @@ public class Like extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.clearRatings();
|
||||
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.ratings_purged"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_owned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.isOwner(player.getUUID())) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_your_own"));
|
||||
return false;
|
||||
}
|
||||
if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_done"));
|
||||
return false;
|
||||
}
|
||||
final Runnable run = () -> {
|
||||
final Boolean oldRating = plot.getLikes().get(uuid);
|
||||
if (oldRating != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_already_exists"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_already_exists"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -177,13 +177,13 @@ public class Like extends SubCommand {
|
||||
plot.addRating(uuid, event.getRating());
|
||||
if (like) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_liked"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_liked"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_disliked"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_disliked"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -220,11 +220,11 @@ public class Like extends SubCommand {
|
||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.Caption;
|
||||
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
||||
import com.plotsquared.core.configuration.caption.Templates;
|
||||
import com.plotsquared.core.configuration.caption.Placeholders;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -53,7 +53,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -129,8 +130,8 @@ public class ListCmd extends SubCommand {
|
||||
|
||||
public void noArgs(PlotPlayer<?> player) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
|
||||
Templates.of("values", Arrays.toString(getArgumentList(player)))
|
||||
TranslatableCaption.miniMessage("commandconfig.subcommand_set_options_header"),
|
||||
Placeholders.miniMessage("values", Arrays.toString(getArgumentList(player)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -165,8 +166,8 @@ public class ListCmd extends SubCommand {
|
||||
final Consumer<PlotQuery> plotConsumer = query -> {
|
||||
if (query == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.did_you_mean"),
|
||||
Template.of(
|
||||
TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
|
||||
Placeholder.miniMessage(
|
||||
"value",
|
||||
new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch()
|
||||
)
|
||||
@ -185,7 +186,7 @@ public class ListCmd extends SubCommand {
|
||||
final List<Plot> plots = query.asList();
|
||||
|
||||
if (plots.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
|
||||
return;
|
||||
}
|
||||
displayPlots(player, plots, 12, page, args);
|
||||
@ -195,8 +196,8 @@ public class ListCmd extends SubCommand {
|
||||
case "mine" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.mine")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.mine")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -210,8 +211,8 @@ public class ListCmd extends SubCommand {
|
||||
case "shared" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.shared")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.shared")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -223,15 +224,15 @@ public class ListCmd extends SubCommand {
|
||||
case "world" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.world")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world." + world)
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.world." + world)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -240,8 +241,8 @@ public class ListCmd extends SubCommand {
|
||||
case "expired" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.expired")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.expired")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -254,15 +255,15 @@ public class ListCmd extends SubCommand {
|
||||
case "area" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_AREA)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.area")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.area")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world." + world)
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.world." + world)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -275,8 +276,8 @@ public class ListCmd extends SubCommand {
|
||||
case "all" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.all")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.all")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -285,8 +286,8 @@ public class ListCmd extends SubCommand {
|
||||
case "done" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.done")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.done")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -300,8 +301,8 @@ public class ListCmd extends SubCommand {
|
||||
case "top" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.top")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.top")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -311,8 +312,8 @@ public class ListCmd extends SubCommand {
|
||||
case "forsale" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.forsale")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.forsale")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -324,8 +325,8 @@ public class ListCmd extends SubCommand {
|
||||
case "unowned" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.unowned")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.unowned")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -334,15 +335,15 @@ public class ListCmd extends SubCommand {
|
||||
case "fuzzy" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FUZZY)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.fuzzy")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.fuzzy")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length < (page == -1 ? 2 : 3)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Templates.of("value", "/plot list fuzzy <search...> [#]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholders.miniMessage("value", "/plot list fuzzy <search...> [#]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -359,15 +360,15 @@ public class ListCmd extends SubCommand {
|
||||
if (this.plotAreaManager.hasPlotArea(args[0])) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.world")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.world." + args[0])
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.world." + args[0])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -376,7 +377,7 @@ public class ListCmd extends SubCommand {
|
||||
}
|
||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
} else if (throwable != null) {
|
||||
if (uuid == null) {
|
||||
try {
|
||||
@ -386,12 +387,12 @@ public class ListCmd extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (uuid == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_player"), Templates.of("value", args[0]));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_player"), Placeholders.miniMessage("value", args[0]));
|
||||
} else {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.list.player")
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholders.miniMessage("node", "plots.list.player")
|
||||
);
|
||||
} else {
|
||||
sort[0] = false;
|
||||
@ -416,28 +417,30 @@ public class ListCmd extends SubCommand {
|
||||
public void run(Integer i, Plot plot, CaptionHolder caption) {
|
||||
Caption color;
|
||||
if (plot.getOwner() == null) {
|
||||
color = TranslatableCaption.of("info.plot_list_no_owner");
|
||||
color = TranslatableCaption.miniMessage("info.plot_list_no_owner");
|
||||
} else if (plot.isOwner(player.getUUID())) {
|
||||
color = TranslatableCaption.of("info.plot_list_owned_by");
|
||||
color = TranslatableCaption.miniMessage("info.plot_list_owned_by");
|
||||
} else if (plot.isAdded(player.getUUID())) {
|
||||
color = TranslatableCaption.of("info.plot_list_added_to");
|
||||
color = TranslatableCaption.miniMessage("info.plot_list_added_to");
|
||||
} else if (plot.isDenied(player.getUUID())) {
|
||||
color = TranslatableCaption.of("info.plot_list_denied_on");
|
||||
color = TranslatableCaption.miniMessage("info.plot_list_denied_on");
|
||||
} else {
|
||||
color = TranslatableCaption.of("info.plot_list_default");
|
||||
color = TranslatableCaption.miniMessage("info.plot_list_default");
|
||||
}
|
||||
Component trusted = MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("info.plot_info_trusted").getComponent(player),
|
||||
Template.of("trusted", PlayerManager.getPlayerList(plot.getTrusted(), player))
|
||||
Component trusted = MINI_MESSAGE.deserialize(
|
||||
TranslatableCaption.miniMessage("info.plot_info_trusted").getComponent(player),
|
||||
PlaceholderResolver.placeholders(Placeholder.component("trusted",
|
||||
PlayerManager.getPlayerList(plot.getTrusted(), player)))
|
||||
);
|
||||
Component members = MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("info.plot_info_members").getComponent(player),
|
||||
Template.of("members", PlayerManager.getPlayerList(plot.getMembers(), player))
|
||||
Component members = MINI_MESSAGE.deserialize(
|
||||
TranslatableCaption.miniMessage("info.plot_info_members").getComponent(player),
|
||||
PlaceholderResolver.placeholders(Placeholder.component("members",
|
||||
PlayerManager.getPlayerList(plot.getTrusted(), player)))
|
||||
);
|
||||
Template command_tp = Template.of("command_tp", "/plot visit " + plot.getArea() + ";" + plot.getId());
|
||||
Template command_info = Template.of("command_info", "/plot info " + plot.getArea() + ";" + plot.getId());
|
||||
Template hover_info =
|
||||
Template.of(
|
||||
Placeholder<?> command_tp = Placeholder.miniMessage("command_tp", "/plot visit " + plot.getArea() + ";" + plot.getId());
|
||||
Placeholder<?> command_info = Placeholder.miniMessage("command_info", "/plot info " + plot.getArea() + ";" + plot.getId());
|
||||
Placeholder<?> hover_info =
|
||||
Placeholder.miniMessage(
|
||||
"hover_info",
|
||||
MINI_MESSAGE.serialize(Component
|
||||
.text()
|
||||
@ -446,27 +449,30 @@ public class ListCmd extends SubCommand {
|
||||
.append(members)
|
||||
.asComponent())
|
||||
);
|
||||
Template numberTemplate = Template.of("number", String.valueOf(i));
|
||||
Template plotTemplate = Template.of(
|
||||
Placeholder<?> numberTemplate = Placeholder.miniMessage("number", String.valueOf(i));
|
||||
Placeholder<?> plotTemplate = Placeholder.component(
|
||||
"plot",
|
||||
MINI_MESSAGE.parse(color.getComponent(player), Template.of("plot", plot.toString()))
|
||||
MINI_MESSAGE.deserialize(color.getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.component("plot", Component.text(plot.toString()))
|
||||
))
|
||||
);
|
||||
|
||||
String prefix = "";
|
||||
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
||||
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
||||
String online = TranslatableCaption.miniMessage("info.plot_list_player_online").getComponent(player);
|
||||
String offline = TranslatableCaption.miniMessage("info.plot_list_player_offline").getComponent(player);
|
||||
TextComponent.Builder builder = Component.text();
|
||||
try {
|
||||
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
||||
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||
for (final UUIDMapping uuidMapping : names) {
|
||||
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
||||
Template prefixTemplate = Template.of("prefix", prefix);
|
||||
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
||||
Placeholder<?> prefixTemplate = Placeholder.miniMessage("prefix", prefix);
|
||||
Placeholder<?> playerTemplate = Placeholder.miniMessage("player", uuidMapping.getUsername());
|
||||
if (pp != null) {
|
||||
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
|
||||
builder.append(MINI_MESSAGE.deserialize(online, PlaceholderResolver.placeholders(prefixTemplate, playerTemplate)));
|
||||
} else {
|
||||
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
|
||||
builder.append(MINI_MESSAGE.deserialize(offline, PlaceholderResolver.placeholders(prefixTemplate, playerTemplate)));
|
||||
}
|
||||
prefix = ", ";
|
||||
}
|
||||
@ -481,17 +487,17 @@ public class ListCmd extends SubCommand {
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Templates.of("value", playerBuilder.toString())
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholders.miniMessage("value", playerBuilder.toString())
|
||||
);
|
||||
} catch (TimeoutException e) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
}
|
||||
Template players = Template.of("players", builder.asComponent());
|
||||
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
||||
caption.setTemplates(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
|
||||
Placeholder<?> players = Placeholder.component("players", builder.asComponent());
|
||||
caption.set(TranslatableCaption.miniMessage("info.plot_list_item"));
|
||||
caption.parsePlaceholders(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
|
||||
}
|
||||
}, "/plot list " + args[0], TranslatableCaption.of("list.plot_list_header_paged"));
|
||||
}, "/plot list " + args[0], TranslatableCaption.miniMessage("list.plot_list_header_paged"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -532,7 +538,7 @@ public class ListCmd extends SubCommand {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
|
||||
return commands;
|
||||
|
@ -42,7 +42,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
@ -74,25 +74,25 @@ public class Load extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
final String world = player.getLocation().getWorldName();
|
||||
if (!this.plotAreaManager.hasPlotArea(world)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_LOAD)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -104,8 +104,8 @@ public class Load extends SubCommand {
|
||||
if (schematics == null) {
|
||||
// No schematics found:
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.load_null"),
|
||||
Template.of("command", "/plot load")
|
||||
TranslatableCaption.miniMessage("web.load_null"),
|
||||
Placeholder.miniMessage("command", "/plot load")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -115,8 +115,8 @@ public class Load extends SubCommand {
|
||||
} catch (Exception ignored) {
|
||||
// use /plot load <index>
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_valid_number"),
|
||||
Template.of("value", "(1, " + schematics.size() + ')')
|
||||
TranslatableCaption.miniMessage("invalid.not_valid_number"),
|
||||
Placeholder.miniMessage("value", "(1, " + schematics.size() + ')')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -125,18 +125,18 @@ public class Load extends SubCommand {
|
||||
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(TranslatableCaption.of("web.load_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("web.load_failed"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
player.sendMessage(TranslatableCaption.of("working.generating_component"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.generating_component"));
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
Schematic taskSchematic = this.schematicHandler.getSchematic(url);
|
||||
if (taskSchematic == null) {
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_invalid"),
|
||||
Template.of("reason", "non-existent or not in gzip format")
|
||||
TranslatableCaption.miniMessage("schematics.schematic_invalid"),
|
||||
Placeholder.miniMessage("reason", "non-existent or not in gzip format")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -149,14 +149,14 @@ public class Load extends SubCommand {
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<Boolean>() {
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
plot.removeRunning();
|
||||
if (value) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_success"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,8 +166,8 @@ public class Load extends SubCommand {
|
||||
}
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot load <index>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot load <index>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -181,7 +181,7 @@ public class Load extends SubCommand {
|
||||
List<String> schematics1 = this.schematicHandler.getSaves(player.getUUID());
|
||||
plot.removeRunning();
|
||||
if ((schematics1 == null) || schematics1.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("web.load_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("web.load_failed"));
|
||||
return;
|
||||
}
|
||||
metaDataAccess.set(schematics1);
|
||||
@ -210,15 +210,15 @@ public class Load extends SubCommand {
|
||||
PlotId id = PlotId.fromString(split[2] + ';' + split[3]);
|
||||
String size = split[4];
|
||||
String color = "<dark_aqua>";
|
||||
player.sendMessage(StaticCaption.of("<dark_gray>[</dark_gray><gray>" + (i + 1) + "</gray><dark_aqua>] </dark_aqua>" + color + time + "<dark_gray> | </dark_gray>" + color + world + ';' + id
|
||||
player.sendMessage(StaticCaption.miniMessage("<dark_gray>[</dark_gray><gray>" + (i + 1) + "</gray><dark_aqua>] </dark_aqua>" + color + time + "<dark_gray> | </dark_gray>" + color + world + ';' + id
|
||||
+ "<dark_gray> | </dark_gray>" + color + size + 'x' + size));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.load_list"),
|
||||
Template.of("command", "/plot load #")
|
||||
TranslatableCaption.miniMessage("web.load_list"),
|
||||
Placeholder.miniMessage("command", "/plot load #")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlotExpression;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -274,7 +275,7 @@ public class MainCommand extends Command {
|
||||
}
|
||||
tp = true;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("border.border"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("border.denied"));
|
||||
}
|
||||
// Trim command
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
@ -303,7 +304,7 @@ public class MainCommand extends Command {
|
||||
};
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_command_flag"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_command_flag"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
}
|
||||
@ -317,12 +318,12 @@ public class MainCommand extends Command {
|
||||
String message = e.getMessage();
|
||||
if (message != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error"),
|
||||
net.kyori.adventure.text.minimessage.Template.of("value", message)
|
||||
TranslatableCaption.miniMessage("errors.error"),
|
||||
Placeholder.miniMessage("value", message)
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error_console"));
|
||||
TranslatableCaption.miniMessage("errors.error_console"));
|
||||
}
|
||||
}
|
||||
// Reset command scope //
|
||||
|
@ -42,7 +42,8 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlotExpression;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -88,15 +89,15 @@ public class Merge extends SubCommand {
|
||||
Location location = player.getLocationFull();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
Direction direction = null;
|
||||
@ -121,12 +122,12 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
if (direction == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("help.direction"),
|
||||
Template.of("dir", direction(location.getYaw()))
|
||||
TranslatableCaption.miniMessage("help.direction"),
|
||||
Placeholder.miniMessage("dir", direction(location.getYaw()))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -136,8 +137,8 @@ public class Merge extends SubCommand {
|
||||
this.eventDispatcher.callMerge(plot, direction, max, player);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Merge")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Merge")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -147,8 +148,8 @@ public class Merge extends SubCommand {
|
||||
|
||||
if (!force && size - 1 > maxSize) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_MERGE + "." + (size + 1))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_MERGE + "." + (size + 1))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -160,7 +161,7 @@ public class Merge extends SubCommand {
|
||||
|
||||
if (!force && !plot.isOwner(uuid)) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
} else {
|
||||
uuid = plot.getOwnerAbs();
|
||||
@ -174,8 +175,8 @@ public class Merge extends SubCommand {
|
||||
if (!force && !terrain && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -183,22 +184,23 @@ public class Merge extends SubCommand {
|
||||
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(price)),
|
||||
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price)),
|
||||
Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
|
||||
return false;
|
||||
}
|
||||
if (!force && this.econHandler.isEnabled(plotArea) && price > 0d
|
||||
&& this.econHandler.getMoney(player) < price) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_merge"),
|
||||
Template.of("money", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.cannot_afford_merge"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -211,8 +213,8 @@ public class Merge extends SubCommand {
|
||||
if (!force && !terrain && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -220,23 +222,24 @@ public class Merge extends SubCommand {
|
||||
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price))
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
return true;
|
||||
}
|
||||
Plot adjacent = plot.getRelative(direction);
|
||||
if (adjacent == null || !adjacent.hasOwner() || adjacent
|
||||
.isMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
|
||||
return false;
|
||||
}
|
||||
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_MERGE_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_OTHER))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -250,35 +253,38 @@ public class Merge extends SubCommand {
|
||||
isOnline = true;
|
||||
final Direction dir = direction;
|
||||
Runnable run = () -> {
|
||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
||||
accepter.sendMessage(TranslatableCaption.miniMessage("merge.merge_accepted"));
|
||||
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain);
|
||||
PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID());
|
||||
if (plotPlayer == null) {
|
||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
||||
accepter.sendMessage(TranslatableCaption.miniMessage("merge.merge_not_valid"));
|
||||
return;
|
||||
}
|
||||
if (this.econHandler.isEnabled(plotArea) && price > 0d) {
|
||||
if (!force && this.econHandler.getMoney(player) < price) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.cannot_afford_merge"),
|
||||
Template.of("money", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.cannot_afford_merge"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price))
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.removed_balance"),
|
||||
Template.of("money", this.econHandler.format(price))
|
||||
TranslatableCaption.miniMessage("economy.removed_balance"),
|
||||
Placeholder.miniMessage("money", this.econHandler.format(price))
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
};
|
||||
if (!force && hasConfirmation(player)) {
|
||||
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||
.parse(
|
||||
TranslatableCaption.of("merge.merge_request_confirm").getComponent(player),
|
||||
Template.of("player", player.getName()),
|
||||
Template.of("location", plot.getWorldName() + ";" + plot.getId())
|
||||
.deserialize(
|
||||
TranslatableCaption.miniMessage("merge.merge_request_confirm").getComponent(player),
|
||||
PlaceholderResolver.placeholders(
|
||||
Placeholder.miniMessage("player", player.getName()),
|
||||
Placeholder.miniMessage("location", plot.getWorldName() + ";" + plot.getId())
|
||||
)
|
||||
)),
|
||||
run
|
||||
);
|
||||
@ -287,10 +293,10 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (!force && !isOnline) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.merge_requested"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("merge.merge_requested"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,11 @@ public class Middle extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND_MIDDLE));
|
||||
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("teleport.teleported_to_plot"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -64,12 +64,12 @@ public class Move extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot1 = location.getPlotAbs();
|
||||
if (plot1 == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
boolean override = false;
|
||||
@ -92,16 +92,16 @@ public class Move extends SubCommand {
|
||||
plot2 = area.getPlotAbs(plot1.getId());
|
||||
}
|
||||
if (plot1.equals(plot2)) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.origin_cant_be_target"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN))) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.plotworld_incompatible"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (plot1.isMerged() || plot2.isMerged()) {
|
||||
player.sendMessage(TranslatableCaption.of("move.move_merged"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("move.move_merged"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
@ -109,13 +109,13 @@ public class Move extends SubCommand {
|
||||
}, false).thenApply(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("move.move_success"),
|
||||
Template.of("origin", plot1.toString()),
|
||||
Template.of("target", plot2.toString())
|
||||
TranslatableCaption.miniMessage("move.move_success"),
|
||||
Placeholder.miniMessage("origin", plot1.toString()),
|
||||
Placeholder.miniMessage("target", plot2.toString())
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("move.requires_unowned"));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -41,7 +41,7 @@ import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
||||
import com.plotsquared.core.util.InventoryUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
@ -73,14 +73,14 @@ public class Music extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isAdded(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_MUSIC_OTHER))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_MUSIC_OTHER))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class Music extends SubCommand {
|
||||
this.inventoryUtil,
|
||||
player,
|
||||
2,
|
||||
TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player)
|
||||
TranslatableCaption.miniMessage("plotjukebox.jukebox_header").getComponent(player)
|
||||
) {
|
||||
@Override
|
||||
public boolean onClick(int index) {
|
||||
@ -102,16 +102,16 @@ public class Music extends SubCommand {
|
||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Music removal")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Music removal")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
plot.removeFlag(event.getFlag());
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("flag.flag_removed"),
|
||||
Template.of("flag", "music"),
|
||||
Template.of("value", "music_disc")
|
||||
TranslatableCaption.miniMessage("flag.flag_removed"),
|
||||
Placeholder.miniMessage("flag", "music"),
|
||||
Placeholder.miniMessage("value", "music_disc")
|
||||
);
|
||||
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
|
||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
|
||||
@ -119,17 +119,17 @@ public class Music extends SubCommand {
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Music addition")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Music addition")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
plot.setFlag(event.getFlag());
|
||||
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", "music"),
|
||||
Template.of("value", String.valueOf(event.getFlag().getValue()))
|
||||
getPlayer().sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", "music"),
|
||||
Placeholder.miniMessage("value", String.valueOf(event.getFlag().getValue()))
|
||||
);
|
||||
} else {
|
||||
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
getPlayer().sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -138,15 +138,15 @@ public class Music extends SubCommand {
|
||||
|
||||
for (final String disc : DISCS) {
|
||||
final String name = String.format("<gold>%s</gold>", disc);
|
||||
final String[] lore = {TranslatableCaption.of("plotjukebox.click_to_play").getComponent(player)};
|
||||
final String[] lore = {TranslatableCaption.miniMessage("plotjukebox.click_to_play").getComponent(player)};
|
||||
final PlotItemStack item = new PlotItemStack(disc, 1, name, lore);
|
||||
inv.setItem(index++, item);
|
||||
}
|
||||
|
||||
// Always add the cancel button
|
||||
// if (player.getMeta("music") != null) {
|
||||
String name = TranslatableCaption.of("plotjukebox.cancel_music").getComponent(player);
|
||||
String[] lore = {TranslatableCaption.of("plotjukebox.reset_music").getComponent(player)};
|
||||
String name = TranslatableCaption.miniMessage("plotjukebox.cancel_music").getComponent(player);
|
||||
String[] lore = {TranslatableCaption.miniMessage("plotjukebox.reset_music").getComponent(player)};
|
||||
inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore));
|
||||
// }
|
||||
|
||||
|
@ -31,7 +31,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -52,10 +52,10 @@ public class Near extends Command {
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone
|
||||
) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
|
||||
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("near.plot_near"),
|
||||
Template.of("list", StringMan.join(plot.getPlayersInPlot(), ", "))
|
||||
TranslatableCaption.miniMessage("near.plot_near"),
|
||||
Placeholder.miniMessage("list", StringMan.join(plot.getPlayersInPlot(), ", "))
|
||||
);
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
|
@ -42,8 +42,9 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -71,19 +72,20 @@ public class Owner extends SetCommand {
|
||||
public boolean set(final PlotPlayer<?> player, final Plot plot, String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot setowner <owner>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot setowner <owner>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@Nullable final UUID oldOwner = plot.getOwnerAbs();
|
||||
Set<Plot> plots = plot.getConnectedPlots();
|
||||
|
||||
final Consumer<UUID> uuidConsumer = uuid -> {
|
||||
if (uuid == null && !value.equalsIgnoreCase("none") && !value.equalsIgnoreCase("null")
|
||||
&& !value.equalsIgnoreCase("-")) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", value)
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", value)
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -96,8 +98,8 @@ public class Owner extends SetCommand {
|
||||
);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Owner change")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Owner change")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -119,25 +121,28 @@ public class Owner extends SetCommand {
|
||||
);
|
||||
if (unlinkEvent.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Unlink on owner change")
|
||||
TranslatableCaption.miniMessage("events.event_denied"),
|
||||
Placeholder.miniMessage("value", "Unlink on owner change")
|
||||
);
|
||||
return;
|
||||
}
|
||||
plot.getPlotModificationManager().unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad());
|
||||
if (plot.getPlotModificationManager().unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad())) {
|
||||
eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.NEW_OWNER);
|
||||
}
|
||||
Set<Plot> connected = plot.getConnectedPlots();
|
||||
for (Plot current : connected) {
|
||||
current.unclaim();
|
||||
current.getPlotModificationManager().removeSign();
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
|
||||
player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner"));
|
||||
return;
|
||||
}
|
||||
final PlotPlayer<?> other = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||
if (plot.isOwner(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.already_owner"),
|
||||
Template.of("player", PlayerManager.getName(uuid, false))
|
||||
TranslatableCaption.miniMessage("member.already_owner"),
|
||||
Placeholder.miniMessage("player", PlayerManager.getName(uuid, false))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -145,8 +150,8 @@ public class Owner extends SetCommand {
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
|
||||
if (other == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player_offline"),
|
||||
Template.of("player", PlayerManager.getName(uuid))
|
||||
TranslatableCaption.miniMessage("errors.invalid_player_offline"),
|
||||
Placeholder.miniMessage("player", PlayerManager.getName(uuid))
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -161,7 +166,7 @@ public class Owner extends SetCommand {
|
||||
grants = metaDataAccess.get().orElse(0);
|
||||
if (grants <= 0) {
|
||||
metaDataAccess.remove();
|
||||
player.sendMessage(TranslatableCaption.of("permission.cant_transfer_more_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.cant_transfer_more_plots"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -177,15 +182,16 @@ public class Owner extends SetCommand {
|
||||
plot.removeDenied(finalUUID);
|
||||
}
|
||||
plot.getPlotModificationManager().setSign(finalName);
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner"));
|
||||
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
|
||||
if (other != null) {
|
||||
other.sendMessage(
|
||||
TranslatableCaption.of("owner.now_owner"),
|
||||
Template.of("plot", plot.getArea() + ";" + plot.getId())
|
||||
TranslatableCaption.miniMessage("owner.now_owner"),
|
||||
Placeholder.miniMessage("plot", plot.getArea() + ";" + plot.getId())
|
||||
);
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner_cancelled"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner_cancelled"));
|
||||
}
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
@ -209,7 +215,7 @@ public class Owner extends SetCommand {
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.PremiumVerification;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
@CommandDeclaration(command = "plugin",
|
||||
permission = "plots.use",
|
||||
@ -43,20 +43,24 @@ public class PluginCmd extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
||||
player.sendMessage(
|
||||
StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared
|
||||
StaticCaption.miniMessage("<gray>>> </gray><gold><bold>" + PlotSquared
|
||||
.platform()
|
||||
.pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
|
||||
Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
|
||||
Placeholder.miniMessage("version", String.valueOf(PlotSquared.get().getVersion()))
|
||||
);
|
||||
player.sendMessage(StaticCaption.of(
|
||||
"<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
||||
player.sendMessage(StaticCaption.of(
|
||||
"<gray>>> </gray><gold><bold>Wiki<reset><gray>: </gray><gold><click:open_url:https://github.com/IntellectualSites/PlotSquared-Documentation/wiki>https://github.com/IntellectualSites/PlotSquared-Documentation/wiki</gold>"));
|
||||
player.sendMessage(StaticCaption.of(
|
||||
"<gray>>> </gray><gold><bold>Discord<reset><gray>: </gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>"));
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray>" +
|
||||
"<gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray>" +
|
||||
"<gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"<gray>>> </gray><gold><bold>Wiki<reset><gray>:" +
|
||||
"</gray><gold><click:open_url:https://github.com/IntellectualSites/PlotSquared-Documentation/wiki>https://github.com/IntellectualSites/PlotSquared-Documentation/wiki</gold>"));
|
||||
player.sendMessage(StaticCaption.miniMessage(
|
||||
"<gray>>> </gray><gold><bold>Discord<reset><gray>:" +
|
||||
"</gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>"));
|
||||
player.sendMessage(
|
||||
StaticCaption.of("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
|
||||
Template.of("value", String.valueOf(PremiumVerification.isPremium()))
|
||||
StaticCaption.miniMessage("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
|
||||
Placeholder.miniMessage("value", String.valueOf(PremiumVerification.isPremium()))
|
||||
);
|
||||
});
|
||||
return true;
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -102,8 +102,8 @@ public class Purge extends SubCommand {
|
||||
area = this.plotAreaManager.getPlotAreaByString(split[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
Template.of("value", split[1])
|
||||
TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
|
||||
Placeholder.miniMessage("value", split[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -114,8 +114,8 @@ public class Purge extends SubCommand {
|
||||
id = PlotId.fromString(split[1]);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_valid_plot_id"),
|
||||
Template.of("value", split[1])
|
||||
TranslatableCaption.miniMessage("invalid.not_valid_plot_id"),
|
||||
Placeholder.miniMessage("value", split[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -125,8 +125,8 @@ public class Purge extends SubCommand {
|
||||
UUIDMapping ownerMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
||||
if (ownerMapping == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", split[1])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", split[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -137,8 +137,8 @@ public class Purge extends SubCommand {
|
||||
UUIDMapping addedMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
||||
if (addedMapping == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", split[1])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", split[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -198,7 +198,7 @@ public class Purge extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (toDelete.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
|
||||
return false;
|
||||
}
|
||||
String cmd =
|
||||
@ -242,8 +242,8 @@ public class Purge extends SubCommand {
|
||||
TaskManager.runTask(() -> {
|
||||
DBFunc.purgeIds(ids);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("purge.purge_success"),
|
||||
Template.of("amount", ids.size() + "/" + toDelete.size())
|
||||
TranslatableCaption.miniMessage("purge.purge_success"),
|
||||
Placeholder.miniMessage("amount", ids.size() + "/" + toDelete.size())
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -108,17 +108,17 @@ public class Rate extends SubCommand {
|
||||
.isAdded(uuid)) {
|
||||
p.teleportPlayer(player, TeleportCause.COMMAND_RATE, result -> {
|
||||
});
|
||||
player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("tutorial.rate_this"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
|
||||
return false;
|
||||
}
|
||||
case "purge" -> {
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
@ -126,26 +126,26 @@ public class Rate extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.clearRatings();
|
||||
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.ratings_purged"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_owned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.isOwner(player.getUUID())) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_your_own"));
|
||||
return false;
|
||||
}
|
||||
if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_done"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_done"));
|
||||
return false;
|
||||
}
|
||||
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
||||
@ -154,8 +154,8 @@ public class Rate extends SubCommand {
|
||||
public void run() {
|
||||
if (plot.getRatings().containsKey(player.getUUID())) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_already_exists"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_already_exists"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -174,8 +174,8 @@ public class Rate extends SubCommand {
|
||||
if (event.getRating() != null) {
|
||||
plot.addRating(this.getPlayer().getUUID(), event.getRating());
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_applied"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_applied"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
return false;
|
||||
@ -185,31 +185,31 @@ public class Rate extends SubCommand {
|
||||
}
|
||||
};
|
||||
inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 1,
|
||||
TranslatableCaption.of("ratings.0-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.0-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1,
|
||||
TranslatableCaption.of("ratings.1-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.1-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2,
|
||||
TranslatableCaption.of("ratings.2-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.2-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3,
|
||||
TranslatableCaption.of("ratings.3-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.3-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4,
|
||||
TranslatableCaption.of("ratings.4-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.4-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5,
|
||||
TranslatableCaption.of("ratings.5-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.5-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6,
|
||||
TranslatableCaption.of("ratings.6-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.6-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7,
|
||||
TranslatableCaption.of("ratings.7-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.7-8").getComponent(player)
|
||||
));
|
||||
inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8,
|
||||
TranslatableCaption.of("ratings.8-8").getComponent(player)
|
||||
TranslatableCaption.miniMessage("ratings.8-8").getComponent(player)
|
||||
));
|
||||
inventory.openInventory();
|
||||
}
|
||||
@ -228,7 +228,7 @@ public class Rate extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
|
||||
return true;
|
||||
}
|
||||
String arg = args[0];
|
||||
@ -236,19 +236,19 @@ public class Rate extends SubCommand {
|
||||
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
|
||||
rating = Integer.parseInt(arg);
|
||||
if (rating > 10 || rating < 1) {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
|
||||
return false;
|
||||
}
|
||||
final UUID uuid = player.getUUID();
|
||||
final Runnable run = () -> {
|
||||
if (plot.getRatings().containsKey(uuid)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_already_exists"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_already_exists"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -257,8 +257,8 @@ public class Rate extends SubCommand {
|
||||
if (event.getRating() != null) {
|
||||
plot.addRating(uuid, event.getRating());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_applied"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("ratings.rating_applied"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -292,11 +292,11 @@ public class Rate extends SubCommand {
|
||||
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_RATE) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
private static class MutableInt {
|
||||
|
@ -33,7 +33,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@CommandDeclaration(command = "regenallroads",
|
||||
@ -64,44 +64,44 @@ public class RegenAllRoads extends SubCommand {
|
||||
height = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_valid_number"),
|
||||
Template.of("value", "(0, 256)")
|
||||
TranslatableCaption.miniMessage("invalid.not_valid_number"),
|
||||
Placeholder.miniMessage("value", "(0, 256)")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot regenallroads <world> [height]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot regenallroads <world> [height]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else if (args.length != 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot regenallroads <world> [height]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "/plot regenallroads <world> [height]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
String name = args[0];
|
||||
PlotManager manager = area.getPlotManager();
|
||||
if (!(manager instanceof HybridPlotManager)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_plot_world"));
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.schematic"),
|
||||
Template.of("command", "/plot createroadschematic")
|
||||
TranslatableCaption.miniMessage("debugroadregen.schematic"),
|
||||
Placeholder.miniMessage("command", "/plot createroadschematic")
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugroadregen.regenallroads_started"));
|
||||
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -120,10 +120,10 @@ public class Reload extends SubCommand {
|
||||
}
|
||||
});
|
||||
this.worldConfiguration.save(this.worldFile);
|
||||
player.sendMessage(TranslatableCaption.of("reload.reloaded_configs"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("reload.reloaded_configs"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(TranslatableCaption.of("reload.reload_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("reload.reload_failed"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -65,28 +65,28 @@ public class Remove extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_REMOVE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
||||
int count = 0;
|
||||
if (throwable instanceof TimeoutException) {
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
|
||||
return;
|
||||
} else if (throwable != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
return;
|
||||
} else if (!uuids.isEmpty()) {
|
||||
@ -122,13 +122,13 @@ public class Remove extends SubCommand {
|
||||
}
|
||||
if (count == 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
TranslatableCaption.miniMessage("errors.invalid_player"),
|
||||
Placeholder.miniMessage("value", args[0])
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.removed_players"),
|
||||
Template.of("amount", count + "")
|
||||
TranslatableCaption.miniMessage("member.removed_players"),
|
||||
Placeholder.miniMessage("amount", count + "")
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -142,7 +142,7 @@ public class Remove extends SubCommand {
|
||||
if (plot == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return TabCompletions.completeAddedPlayers(plot, String.join(",", args).trim(),
|
||||
return TabCompletions.completeAddedPlayers(player, plot, String.join(",", args).trim(),
|
||||
Collections.singletonList(player.getName())
|
||||
);
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public enum RequiredType {
|
||||
CONSOLE(TranslatableCaption.of("console.not_console")),
|
||||
PLAYER(TranslatableCaption.of("console.is_console")),
|
||||
NONE(StaticCaption.of("Something went wrong: RequiredType=NONE")); // this caption should never be sent
|
||||
CONSOLE(TranslatableCaption.miniMessage("console.not_console")),
|
||||
PLAYER(TranslatableCaption.miniMessage("console.is_console")),
|
||||
NONE(StaticCaption.miniMessage("Something went wrong: RequiredType=NONE")); // this caption should never be sent
|
||||
|
||||
private final Caption caption;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.net.URL;
|
||||
@ -73,29 +73,29 @@ public class Save extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
final String world = player.getLocation().getWorldName();
|
||||
if (!this.plotAreaManager.hasPlotArea(world)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
|
||||
return false;
|
||||
}
|
||||
final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SAVE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
@ -117,13 +117,13 @@ public class Save extends SubCommand {
|
||||
public void run(URL url) {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
player.sendMessage(TranslatableCaption.of("backups.backup_save_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("backups.backup_save_failed"));
|
||||
return;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("web.save_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("web.save_success"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.deprecated_commands"),
|
||||
Template.of("replacement", "/plot download")
|
||||
TranslatableCaption.miniMessage("errors.deprecated_commands"),
|
||||
Placeholder.miniMessage("replacement", "/plot download")
|
||||
);
|
||||
try (final MetaDataAccess<List<String>> schematicAccess =
|
||||
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {
|
||||
|
@ -43,7 +43,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.net.URL;
|
||||
@ -79,8 +79,8 @@ public class SchematicCmd extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -89,39 +89,39 @@ public class SchematicCmd extends SubCommand {
|
||||
case "paste" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_PASTE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_PASTE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_PASTE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
break;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, "plots.admin.command.schematic.paste")) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (this.running) {
|
||||
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
|
||||
return false;
|
||||
}
|
||||
final String location = args[1];
|
||||
@ -137,8 +137,8 @@ public class SchematicCmd extends SubCommand {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_invalid"),
|
||||
Template.of("reason", "non-existent url: " + location)
|
||||
TranslatableCaption.miniMessage("schematics.schematic_invalid"),
|
||||
Placeholder.miniMessage("reason", "non-existent url: " + location)
|
||||
);
|
||||
SchematicCmd.this.running = false;
|
||||
return;
|
||||
@ -153,8 +153,8 @@ public class SchematicCmd extends SubCommand {
|
||||
if (schematic == null) {
|
||||
SchematicCmd.this.running = false;
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_invalid"),
|
||||
Template.of("reason", "non-existent or not in gzip format")
|
||||
TranslatableCaption.miniMessage("schematics.schematic_invalid"),
|
||||
Placeholder.miniMessage("reason", "non-existent or not in gzip format")
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -166,14 +166,14 @@ public class SchematicCmd extends SubCommand {
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<Boolean>() {
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
SchematicCmd.this.running = false;
|
||||
if (value) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_success"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,108 +184,108 @@ public class SchematicCmd extends SubCommand {
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
if (!(player instanceof ConsolePlayer)) {
|
||||
player.sendMessage(TranslatableCaption.of("console.not_console"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("console.not_console"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_world_args"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_world_args"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Use /plot schematic exportall <area>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Use /plot schematic exportall <area>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
Template.of("value", args[1])
|
||||
TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
|
||||
Placeholder.miniMessage("value", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
Collection<Plot> plots = area.getPlots();
|
||||
if (plots.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("schematic.schematic_exportall_world"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematic.schematic_exportall_world"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Use /plot sch exportall <area>")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Use /plot sch exportall <area>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
boolean result = this.schematicHandler.exportAll(plots, null, null,
|
||||
() -> player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_finished"))
|
||||
() -> player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_finished"))
|
||||
);
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_started"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.plot_to_schem"),
|
||||
Template.of("amount", String.valueOf(plots.size()))
|
||||
TranslatableCaption.miniMessage("schematics.plot_to_schem"),
|
||||
Placeholder.miniMessage("amount", String.valueOf(plots.size()))
|
||||
);
|
||||
}
|
||||
}
|
||||
case "export", "save" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_SAVE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_SAVE))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_SAVE))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (this.running) {
|
||||
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
|
||||
return false;
|
||||
}
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, "plots.admin.command.schematic.save")) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
ArrayList<Plot> plots = Lists.newArrayList(plot);
|
||||
boolean result = this.schematicHandler.exportAll(plots, null, null, () -> {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_single_finished"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_single_finished"));
|
||||
SchematicCmd.this.running = false;
|
||||
});
|
||||
if (!result) {
|
||||
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_started"));
|
||||
}
|
||||
}
|
||||
case "list" -> {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_LIST)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_LIST))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_LIST))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final String string = StringMan.join(this.schematicHandler.getSchematicNames(), "$2, $1");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("schematics.schematic_list"),
|
||||
Template.of("list", string)
|
||||
TranslatableCaption.miniMessage("schematics.schematic_list"),
|
||||
Placeholder.miniMessage("list", string)
|
||||
);
|
||||
}
|
||||
default -> player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
}
|
||||
return true;
|
||||
@ -317,11 +317,11 @@ public class SchematicCmd extends SubCommand {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
return TabCompletions.completePlayers(String.join(",", args).trim(), Collections.emptyList());
|
||||
return TabCompletions.completePlayers(player, String.join(",", args).trim(), Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -129,8 +129,8 @@ public class Set extends SubCommand {
|
||||
continue;
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.component_illegal_block"),
|
||||
Template.of("value", forbiddenType)
|
||||
TranslatableCaption.miniMessage("invalid.component_illegal_block"),
|
||||
Placeholder.miniMessage("value", forbiddenType)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -141,20 +141,20 @@ public class Set extends SubCommand {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_SET_COMPONENT.format(component))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_SET_COMPONENT.format(component))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_SET_COMPONENT.format(component))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(TranslatableCaption.of("need.need_block"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("need.need_block"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Pattern pattern = PatternUtil.parse(player, material, false);
|
||||
|
||||
if (plot.getRunning() > 0) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ public class Set extends SubCommand {
|
||||
queue.setCompleteTask(() -> {
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.component_complete"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
TranslatableCaption.miniMessage("working.component_complete"),
|
||||
Placeholder.miniMessage("plot", plot.getId().toString())
|
||||
);
|
||||
});
|
||||
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
||||
@ -180,7 +180,7 @@ public class Set extends SubCommand {
|
||||
current.getPlotModificationManager().setComponent(component, pattern, player, queue);
|
||||
}
|
||||
queue.enqueue();
|
||||
player.sendMessage(TranslatableCaption.of("working.generating_component"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.generating_component"));
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@ -204,10 +204,10 @@ public class Set extends SubCommand {
|
||||
if (plot != null) {
|
||||
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
}
|
||||
player.sendMessage(StaticCaption.of(TranslatableCaption
|
||||
.of("commandconfig.subcommand_set_options_header_only")
|
||||
player.sendMessage(StaticCaption.miniMessage(TranslatableCaption
|
||||
.miniMessage("commandconfig.subcommand_set_options_header_only")
|
||||
.getComponent(player) + StringMan
|
||||
.join(newValues, TranslatableCaption.of("blocklist.block_list_separator").getComponent(player))));
|
||||
.join(newValues, TranslatableCaption.miniMessage("blocklist.block_list_separator").getComponent(player))));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -227,11 +227,11 @@ public class Set extends SubCommand {
|
||||
// Additional checks
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
// components
|
||||
@ -288,7 +288,7 @@ public class Set extends SubCommand {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_SET) && args[0].length() > 0) {
|
||||
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
commands.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
}
|
||||
return commands;
|
||||
} else if (args.length > 1) {
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
public abstract class SetCommand extends SubCommand {
|
||||
|
||||
@ -41,26 +41,26 @@ public abstract class SetCommand extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID())) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
|
||||
TranslatableCaption.miniMessage("permission.no_permission"),
|
||||
Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
|
||||
);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
|
||||
|
||||
@CommandDeclaration(command = "sethome",
|
||||
permission = "plots.set.home",
|
||||
@ -43,14 +43,14 @@ public class SetHome extends SetCommand {
|
||||
@Override
|
||||
public boolean set(PlotPlayer<?> player, Plot plot, String value) {
|
||||
if (!plot.hasOwner()) {
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
switch (value.toLowerCase()) {
|
||||
case "unset", "reset", "remove", "none" -> {
|
||||
Plot base = plot.getBasePlot(false);
|
||||
base.setHome(null);
|
||||
player.sendMessage(TranslatableCaption.of("position.position_unset"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("position.position_unset"));
|
||||
return true;
|
||||
}
|
||||
case "" -> {
|
||||
@ -61,13 +61,13 @@ public class SetHome extends SetCommand {
|
||||
location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()
|
||||
);
|
||||
base.setHome(rel);
|
||||
player.sendMessage(TranslatableCaption.of("position.position_set"));
|
||||
player.sendMessage(TranslatableCaption.miniMessage("position.position_set"));
|
||||
return true;
|
||||
}
|
||||
default -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Use /plot set home [none]")
|
||||
TranslatableCaption.miniMessage("commandconfig.command_syntax"),
|
||||
Placeholder.miniMessage("value", "Use /plot set home [none]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user