mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-03 06:04:43 +02:00
Compare commits
78 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
04821f777e |
@ -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
|
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
@ -1,17 +1,41 @@
|
||||
name: "build"
|
||||
|
||||
on: ["pull_request", "push"]
|
||||
on: [ "pull_request", "push" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/checkout@v2.3.4"
|
||||
- name: "Setup JDK 16"
|
||||
uses: "actions/setup-java@v2.2.0"
|
||||
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"
|
||||
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"
|
@ -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,9 +95,9 @@ 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/")
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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.of("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -401,8 +400,7 @@ public class BlockEventListener implements Listener {
|
||||
} 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.of("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -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();
|
||||
|
@ -564,19 +564,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
int border = area.getBorder();
|
||||
int x1;
|
||||
if (x2 > border && this.tmpTeleport) {
|
||||
to.setX(border - 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
}
|
||||
if (x2 < -border && this.tmpTeleport) {
|
||||
to.setX(-border + 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
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.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||
}
|
||||
} 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.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||
}
|
||||
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
|
||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
int z2;
|
||||
@ -643,18 +655,31 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
int border = area.getBorder();
|
||||
int z1;
|
||||
if (z2 > border && this.tmpTeleport) {
|
||||
to.setZ(border - 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
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.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||
}
|
||||
} else if (z2 < -border && this.tmpTeleport) {
|
||||
to.setZ(-border + 1);
|
||||
this.tmpTeleport = false;
|
||||
player.teleport(event.getTo());
|
||||
this.tmpTeleport = true;
|
||||
pp.sendMessage(TranslatableCaption.of("border.border"));
|
||||
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.denied"));
|
||||
} else {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
|
||||
}
|
||||
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
|
||||
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
|
||||
pp.sendMessage(TranslatableCaption.of("border.bypass.entered"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -960,8 +985,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.of("done.building_restricted")
|
||||
);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -1233,8 +1257,7 @@ public class PlayerEventListener extends PlotListener 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.of("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -1307,8 +1330,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
} 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.of("done.building_restricted")
|
||||
);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -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;
|
||||
@ -46,7 +47,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
public class SingleWorldListener implements Listener {
|
||||
|
||||
private final Method methodGetHandleChunk;
|
||||
private Field mustSave;
|
||||
private Field shouldSave;
|
||||
|
||||
public SingleWorldListener() throws Exception {
|
||||
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
@ -55,13 +56,13 @@ public class SingleWorldListener implements Listener {
|
||||
if (PlotSquared.platform().serverVersion()[1] < 17) {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
if (PlotSquared.platform().serverVersion()[1] == 13) {
|
||||
this.mustSave = classChunk.getField("mustSave").getRealField();
|
||||
this.shouldSave = classChunk.getField("mustSave").getRealField();
|
||||
} else {
|
||||
this.mustSave = classChunk.getField("unsaved").getRealField();
|
||||
this.shouldSave = classChunk.getField("s").getRealField();
|
||||
}
|
||||
} else {
|
||||
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||
this.mustSave = classChunk.getField("mustNotSave").getRealField();
|
||||
this.shouldSave = classChunk.getField("r").getRealField();
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
@ -71,8 +72,8 @@ public class SingleWorldListener implements Listener {
|
||||
public void markChunkAsClean(Chunk chunk) {
|
||||
try {
|
||||
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||
if (mustSave != null) {
|
||||
this.mustSave.set(nmsChunk, false);
|
||||
if (shouldSave != null) {
|
||||
this.shouldSave.set(nmsChunk, false);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.of("done.building_restricted")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
|
@ -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,19 +193,28 @@ 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>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
if (value) {
|
||||
future.complete(null);
|
||||
} else {
|
||||
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
|
||||
TranslatableCaption
|
||||
.of("schematics.schematic_paste_failed")
|
||||
.getComponent(ConsolePlayer.getConsole()))));
|
||||
this.schematicHandler.paste(
|
||||
schematic,
|
||||
plot,
|
||||
0,
|
||||
plot.getArea().getMinBuildHeight(),
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
if (value) {
|
||||
future.complete(null);
|
||||
} else {
|
||||
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
|
||||
TranslatableCaption
|
||||
.of("schematics.schematic_paste_failed")
|
||||
.getComponent(ConsolePlayer.getConsole()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ 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))
|
||||
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ 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.TranslatableCaption;
|
||||
@ -222,7 +223,7 @@ 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()) {
|
||||
@ -856,11 +857,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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -183,10 +183,12 @@ public class Claim extends SubCommand {
|
||||
);
|
||||
}
|
||||
}
|
||||
int border = area.getBorder();
|
||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
||||
player.sendMessage(TranslatableCaption.of("border.border"));
|
||||
return false;
|
||||
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.denied"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
plot.setOwnerAbs(player.getUUID());
|
||||
final String finalSchematic = schematic;
|
||||
@ -206,13 +208,15 @@ public class Claim extends SubCommand {
|
||||
Template.of("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;
|
||||
|
@ -916,11 +916,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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ public class Delete extends SubCommand {
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
eventDispatcher.callPostDelete(plot);
|
||||
});
|
||||
if (result) {
|
||||
plot.addRunning();
|
||||
|
@ -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 {
|
||||
@ -94,7 +94,7 @@ public class Deny extends SubCommand {
|
||||
|
||||
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))
|
||||
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -307,11 +307,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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -532,7 +532,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;
|
||||
|
@ -149,7 +149,7 @@ public class Load extends SubCommand {
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<Boolean>() {
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
plot.removeRunning();
|
||||
|
@ -274,7 +274,7 @@ public class MainCommand extends Command {
|
||||
}
|
||||
tp = true;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("border.border"));
|
||||
player.sendMessage(TranslatableCaption.of("border.denied"));
|
||||
}
|
||||
// Trim command
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
|
@ -189,6 +189,7 @@ public class Merge extends SubCommand {
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||
@ -225,6 +226,7 @@ public class Merge extends SubCommand {
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
return true;
|
||||
}
|
||||
Plot adjacent = plot.getRelative(direction);
|
||||
@ -272,6 +274,7 @@ public class Merge extends SubCommand {
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
};
|
||||
if (!force && hasConfirmation(player)) {
|
||||
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||
|
@ -44,6 +44,7 @@ import com.plotsquared.core.util.TabCompletions;
|
||||
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;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -76,6 +77,7 @@ public class Owner extends SetCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@Nullable final UUID oldOwner = plot.getOwnerAbs();
|
||||
Set<Plot> plots = plot.getConnectedPlots();
|
||||
|
||||
final Consumer<UUID> uuidConsumer = uuid -> {
|
||||
@ -124,12 +126,15 @@ public class Owner extends SetCommand {
|
||||
);
|
||||
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();
|
||||
}
|
||||
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
return;
|
||||
}
|
||||
@ -178,6 +183,7 @@ public class Owner extends SetCommand {
|
||||
}
|
||||
plot.getPlotModificationManager().setSign(finalName);
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
|
||||
if (other != null) {
|
||||
other.sendMessage(
|
||||
TranslatableCaption.of("owner.now_owner"),
|
||||
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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())
|
||||
);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class SchematicCmd extends SubCommand {
|
||||
0,
|
||||
false,
|
||||
player,
|
||||
new RunnableVal<Boolean>() {
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
SchematicCmd.this.running = false;
|
||||
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -305,11 +305,11 @@ public class Template extends SubCommand {
|
||||
) {
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
if (Permissions.hasPermission(player, Permission.PERMISSION_TEMPLATE) && 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class Trust extends Command {
|
||||
checkTrue(!uuids.isEmpty(), null);
|
||||
int localTrustSize = currentPlot.getTrusted().size();
|
||||
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
|
||||
if (localTrustSize > maxTrustSize) {
|
||||
if (localTrustSize >= maxTrustSize) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("members.plot_max_members_trusted"),
|
||||
Template.of("amount", String.valueOf(localTrustSize))
|
||||
@ -168,7 +168,7 @@ public class Trust 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public class Unlink extends SubCommand {
|
||||
}
|
||||
if (!plot.isMerged()) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.unlink_impossible"));
|
||||
return false;
|
||||
}
|
||||
final boolean createRoad;
|
||||
if (args.length != 0) {
|
||||
@ -100,6 +101,7 @@ public class Unlink extends SubCommand {
|
||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_UNLINK)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return true;
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
if (!plot.getPlotModificationManager().unlinkPlot(createRoad, createRoad)) {
|
||||
@ -107,6 +109,7 @@ public class Unlink extends SubCommand {
|
||||
return;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("merge.unlink_success"));
|
||||
eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.PLAYER_COMMAND);
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable);
|
||||
|
@ -140,21 +140,16 @@ public class Visit extends Command {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)) {
|
||||
// allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or
|
||||
// plot.admin.visit.untrusted permission
|
||||
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)
|
||||
&& !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.visit.other")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Templates.of("node", "plots.admin.visit.untrusted")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (plot.isDenied(player.getUUID())) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
|
||||
player.sendMessage(
|
||||
@ -334,7 +329,7 @@ public class Visit extends Command {
|
||||
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
||||
final List<Command> completions = new ArrayList<>();
|
||||
switch (args.length - 1) {
|
||||
case 0 -> completions.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
|
||||
case 0 -> completions.addAll(TabCompletions.completePlayers(player, args[0], Collections.emptyList()));
|
||||
case 1 -> {
|
||||
completions.addAll(
|
||||
TabCompletions.completeAreas(args[1]));
|
||||
|
@ -71,7 +71,6 @@ public class ComponentPresetManager {
|
||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ComponentPresetManager.class.getSimpleName());
|
||||
|
||||
private final List<ComponentPreset> presets;
|
||||
private final String guiName;
|
||||
private final EconHandler econHandler;
|
||||
private final InventoryUtil inventoryUtil;
|
||||
private File componentsFile;
|
||||
@ -104,15 +103,14 @@ public class ComponentPresetManager {
|
||||
|
||||
final YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(this.componentsFile);
|
||||
|
||||
if (!yamlConfiguration.contains("title")) {
|
||||
yamlConfiguration.set("title", "&6Plot Components");
|
||||
if (yamlConfiguration.contains("title")) {
|
||||
yamlConfiguration.set("title", "#Now in /lang/messages_%.json, preset.title");
|
||||
try {
|
||||
yamlConfiguration.save(this.componentsFile);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to save default values to components.yml", e);
|
||||
}
|
||||
}
|
||||
this.guiName = yamlConfiguration.getString("title", "&6Plot Components");
|
||||
|
||||
if (yamlConfiguration.contains("presets")) {
|
||||
this.presets = yamlConfiguration
|
||||
@ -183,7 +181,8 @@ public class ComponentPresetManager {
|
||||
allowedPresets.add(componentPreset);
|
||||
}
|
||||
final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
|
||||
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size, this.guiName) {
|
||||
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size,
|
||||
TranslatableCaption.of("preset.title").getComponent(player)) {
|
||||
@Override
|
||||
public boolean onClick(final int index) {
|
||||
if (!getPlayer().getCurrentPlot().equals(plot)) {
|
||||
|
@ -556,8 +556,10 @@ public class Settings extends Config {
|
||||
public static boolean ON_DEATH = false;
|
||||
@Comment("Teleport to your plot on login")
|
||||
public static boolean ON_LOGIN = false;
|
||||
@Comment("Teleport to your plot on claim")
|
||||
@Comment("Teleport to your plot on claim (/plot claim)")
|
||||
public static boolean ON_CLAIM = true;
|
||||
@Comment("Teleport to your plot on auto (/plot auto)")
|
||||
public static boolean ON_AUTO = true;
|
||||
@Comment({"Add a delay to all teleport commands (in seconds)",
|
||||
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
|
||||
public static int DELAY = 0;
|
||||
@ -708,6 +710,9 @@ public class Settings extends Config {
|
||||
"If you would like to still show the owner of the plot, append the contents of \"titles.title_entered_plot_sub\" onto the " +
|
||||
"former lang key."})
|
||||
public static boolean TITLES_AS_ACTIONBAR = false;
|
||||
@Comment({"If the default title should be displayed on plots with server-plot flag set.",
|
||||
"Titles will still be sent if the plot-title flag is set."})
|
||||
public static boolean DISPLAY_DEFAULT_ON_SERVER_PLOT = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -2099,6 +2099,7 @@ public class SQLManager implements AbstractDB {
|
||||
case "default":
|
||||
case "0,0,0":
|
||||
case "center":
|
||||
case "centre":
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
@ -2946,6 +2947,7 @@ public class SQLManager implements AbstractDB {
|
||||
case "default":
|
||||
case "0,0,0":
|
||||
case "center":
|
||||
case "centre":
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
||||
|
||||
import com.plotsquared.core.events.PlotPlayerEvent;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
/**
|
||||
* Called after a plot was chosen for a player by {@code /plot auto}
|
||||
* <br>
|
||||
* Called after {@link com.plotsquared.core.events.PlayerAutoPlotEvent} and only, if no listener cancelled the action.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*/
|
||||
public class PostPlayerAutoPlotEvent extends PlotPlayerEvent {
|
||||
|
||||
/**
|
||||
* Instantiate a new PlayerAutoPlotPostEvent.
|
||||
*
|
||||
* @param plotPlayer The player who claims a new plot by {@code /plot auto}.
|
||||
* @param plot The plot that is assigned to the player.
|
||||
*/
|
||||
public PostPlayerAutoPlotEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
|
||||
super(plotPlayer, plot);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
||||
|
||||
import com.plotsquared.core.events.PlotPlayerEvent;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called after the owner of a plot was updated.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*/
|
||||
public class PostPlotChangeOwnerEvent extends PlotPlayerEvent {
|
||||
|
||||
@Nullable
|
||||
private final UUID oldOwner;
|
||||
|
||||
/**
|
||||
* Instantiate a new PlotChangedOwnerEvent.
|
||||
*
|
||||
* @param initiator The player who executed the owner change.
|
||||
* @param plot The plot which owner was changed.
|
||||
* @param oldOwner The previous owner - if present, otherwise {@code null}.
|
||||
*/
|
||||
public PostPlotChangeOwnerEvent(final PlotPlayer<?> initiator, final Plot plot, @Nullable UUID oldOwner) {
|
||||
super(initiator, plot);
|
||||
this.oldOwner = oldOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the old owner of the plot - if present, otherwise {@code null}.
|
||||
*/
|
||||
public @Nullable UUID getOldOwner() {
|
||||
return oldOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the plot had an owner, {@code false} otherwise.
|
||||
* @see #getOldOwner()
|
||||
*/
|
||||
public boolean hasOldOwner() {
|
||||
return getOldOwner() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the plot now has an owner, {@code false} otherwise.
|
||||
* @see Plot#hasOwner()
|
||||
*/
|
||||
public boolean hasNewOwner() {
|
||||
return getPlot().hasOwner();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
||||
|
||||
import com.plotsquared.core.events.PlotEvent;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
/**
|
||||
* Called after a {@link Plot} was deleted.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*/
|
||||
public class PostPlotDeleteEvent extends PlotEvent {
|
||||
|
||||
/**
|
||||
* Instantiate a new PlotDeleteEvent.
|
||||
*
|
||||
* @param plot The plot which was deleted.
|
||||
*/
|
||||
public PostPlotDeleteEvent(final Plot plot) {
|
||||
super(plot);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
||||
|
||||
import com.plotsquared.core.events.PlotPlayerEvent;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
/**
|
||||
* Called after multiple plots were merged with another.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*/
|
||||
public class PostPlotMergeEvent extends PlotPlayerEvent {
|
||||
|
||||
/**
|
||||
* Instantiate a new PlotMergedEvent.
|
||||
*
|
||||
* @param plotPlayer The {@link PlotPlayer} that initiated the merge.
|
||||
* @param plot The final merged plot.
|
||||
*/
|
||||
public PostPlotMergeEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
|
||||
super(plotPlayer, plot);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
||||
|
||||
import com.plotsquared.core.events.PlotEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
|
||||
/**
|
||||
* Called when several plots were unlinked.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*/
|
||||
public class PostPlotUnlinkEvent extends PlotEvent {
|
||||
|
||||
private final PlotUnlinkEvent.REASON reason;
|
||||
|
||||
/**
|
||||
* Instantiate a new PlotUnlinkedEvent.
|
||||
*
|
||||
* @param plot The unlinked plot.
|
||||
* @param reason The reason for the unlink.
|
||||
*/
|
||||
public PostPlotUnlinkEvent(final Plot plot, PlotUnlinkEvent.REASON reason) {
|
||||
super(plot);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* The original reason provided by {@link PlotUnlinkEvent}.
|
||||
*
|
||||
* @return The reason for the unlink.
|
||||
*/
|
||||
public PlotUnlinkEvent.REASON getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2021 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* Contains events which are fired after specific actions are completed.
|
||||
* <br>
|
||||
* E.g. {@link com.plotsquared.core.events.PlotDeleteEvent} is called <b>before</b> a plot is actually deleted and useful for
|
||||
* cancelling the action itself. {@link com.plotsquared.core.events.post.PostPlotDeleteEvent} will be called after the plot was
|
||||
* deleted.
|
||||
*/
|
||||
package com.plotsquared.core.events.post;
|
@ -506,16 +506,32 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location.at(
|
||||
classicPlotWorld.getWorldName(),
|
||||
sx,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
Math.min(
|
||||
classicPlotWorld.PLOT_HEIGHT,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
|
||||
) + 1,
|
||||
sz + 1
|
||||
),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState()
|
||||
);
|
||||
queue.setCuboid(
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
|
||||
BlockUtil.get((short) 7, (byte) 0)
|
||||
);
|
||||
if (classicPlotWorld.PLOT_BEDROCK) {
|
||||
queue.setCuboid(
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
|
||||
BlockTypes.BEDROCK.getDefaultState()
|
||||
);
|
||||
queue.setCuboid(
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
|
||||
classicPlotWorld.WALL_FILLING.toPattern()
|
||||
);
|
||||
} else {
|
||||
queue.setCuboid(
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
|
||||
classicPlotWorld.WALL_FILLING.toPattern()
|
||||
);
|
||||
}
|
||||
queue.setCuboid(
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
|
||||
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
|
||||
@ -568,7 +584,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location.at(
|
||||
classicPlotWorld.getWorldName(),
|
||||
sx + 1,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
Math.min(
|
||||
classicPlotWorld.PLOT_HEIGHT,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
|
||||
) + 1,
|
||||
sz
|
||||
),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
@ -663,7 +682,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location.at(
|
||||
classicPlotWorld.getWorldName(),
|
||||
sx,
|
||||
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
Math.min(
|
||||
classicPlotWorld.PLOT_HEIGHT,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
|
||||
) + 1,
|
||||
sz
|
||||
),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
@ -703,7 +725,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location.at(
|
||||
classicPlotWorld.getWorldName(),
|
||||
sx,
|
||||
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
Math.min(
|
||||
classicPlotWorld.PLOT_HEIGHT,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
|
||||
) + 1,
|
||||
sz
|
||||
),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
@ -742,7 +767,10 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location.at(
|
||||
classicPlotWorld.getWorldName(),
|
||||
sx,
|
||||
Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
Math.min(
|
||||
classicPlotWorld.PLOT_HEIGHT,
|
||||
Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT)
|
||||
) + 1,
|
||||
sz
|
||||
),
|
||||
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
|
@ -63,7 +63,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
&& Settings.Schematics.PASTE_ON_TOP)) {
|
||||
minY = world.SCHEM_Y;
|
||||
} else {
|
||||
minY = 1;
|
||||
minY = world.getMinBuildHeight();
|
||||
}
|
||||
BaseBlock[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ));
|
||||
if (blocks != null) {
|
||||
@ -156,11 +156,12 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
}
|
||||
// generation
|
||||
int startY = hybridPlotWorld.PLOT_BEDROCK ? 1 : 0;
|
||||
for (short x = 0; x < 16; x++) {
|
||||
if (insideRoadX[x]) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
// Road
|
||||
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
||||
}
|
||||
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
@ -171,7 +172,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
if (insideRoadZ[z]) {
|
||||
// road
|
||||
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
||||
}
|
||||
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
@ -181,7 +182,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
} else {
|
||||
// wall
|
||||
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
|
||||
for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
|
||||
}
|
||||
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
@ -201,7 +202,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
if (insideRoadZ[z]) {
|
||||
// road
|
||||
for (int y = 1; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
|
||||
}
|
||||
if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
@ -211,7 +212,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
} else if (insideWallZ[z]) {
|
||||
// wall
|
||||
for (int y = 1; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
|
||||
for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
|
||||
}
|
||||
if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
|
||||
@ -227,7 +228,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
} else {
|
||||
// plot
|
||||
for (int y = 1; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
|
||||
for (int y = startY; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
|
||||
result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern());
|
||||
}
|
||||
result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z,
|
||||
|
@ -82,10 +82,12 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
Settings.Paths.TEMPLATES + "/tmp-data.yml",
|
||||
Template.getBytes(hybridPlotWorld)
|
||||
));
|
||||
String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator;
|
||||
String dir =
|
||||
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator;
|
||||
try {
|
||||
File sideRoad = FileUtils.getFile(PlotSquared.platform().getDirectory(), dir + "sideroad.schem");
|
||||
String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
||||
String newDir =
|
||||
Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
||||
if (sideRoad.exists()) {
|
||||
files.add(new FileBytes(newDir + "sideroad.schem", Files.readAllBytes(sideRoad.toPath())));
|
||||
}
|
||||
@ -152,7 +154,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
|
||||
minY = hybridPlotWorld.SCHEM_Y;
|
||||
} else {
|
||||
minY = 1;
|
||||
minY = hybridPlotWorld.getMinBuildHeight();
|
||||
}
|
||||
BaseBlock airBlock = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
@ -249,12 +251,11 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
|
||||
final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern();
|
||||
|
||||
final BlockState bedrock;
|
||||
final BlockState air = BlockTypes.AIR.getDefaultState();
|
||||
final Pattern bedrock;
|
||||
if (hybridPlotWorld.PLOT_BEDROCK) {
|
||||
bedrock = BlockTypes.BEDROCK.getDefaultState();
|
||||
} else {
|
||||
bedrock = air;
|
||||
bedrock = hybridPlotWorld.MAIN_BLOCK.toPattern();
|
||||
}
|
||||
|
||||
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
||||
@ -274,7 +275,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
// Each component has a different layer
|
||||
queue.setCuboid(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1), filling);
|
||||
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT), plotfloor);
|
||||
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), air);
|
||||
queue.setCuboid(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(getWorldHeight()), BlockTypes.AIR.getDefaultState());
|
||||
queue.setBiomeCuboid(pos1, pos2, biome);
|
||||
} else {
|
||||
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));
|
||||
|
@ -253,22 +253,32 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
int shift = this.ROAD_WIDTH / 2;
|
||||
int oddshift = (this.ROAD_WIDTH & 1) == 0 ? 0 : 1;
|
||||
|
||||
SCHEM_Y = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
|
||||
SCHEM_Y = Math.min(PLOT_HEIGHT, Math.min(WALL_HEIGHT, ROAD_HEIGHT));
|
||||
int plotY = PLOT_HEIGHT - SCHEM_Y;
|
||||
int roadY = ROAD_HEIGHT - SCHEM_Y;
|
||||
int roadY = Math.min(ROAD_HEIGHT, WALL_HEIGHT) - SCHEM_Y;
|
||||
|
||||
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() == 256) {
|
||||
SCHEM_Y = 0;
|
||||
plotY = 0;
|
||||
roadY = ROAD_HEIGHT;
|
||||
if (schematic3 != null) {
|
||||
if (schematic3.getClipboard().getDimensions().getY() == 256) {
|
||||
SCHEM_Y = plotY = 0;
|
||||
} else if (!Settings.Schematics.PASTE_ON_TOP) {
|
||||
SCHEM_Y = plotY = getMinBuildHeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (schematic1 != null && schematic1.getClipboard().getDimensions().getY() == 256) {
|
||||
SCHEM_Y = 0;
|
||||
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256) {
|
||||
plotY = PLOT_HEIGHT;
|
||||
if (schematic1 != null) {
|
||||
if (schematic1.getClipboard().getDimensions().getY() == 256) {
|
||||
SCHEM_Y = roadY = 0;
|
||||
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
|
||||
&& !Settings.Schematics.PASTE_ON_TOP) {
|
||||
plotY = PLOT_HEIGHT;
|
||||
}
|
||||
} else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
|
||||
SCHEM_Y = roadY = getMinBuildHeight();
|
||||
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != 256
|
||||
&& !Settings.Schematics.PASTE_ON_TOP) {
|
||||
plotY = PLOT_HEIGHT;
|
||||
}
|
||||
}
|
||||
roadY = 0;
|
||||
}
|
||||
|
||||
if (schematic3 != null) {
|
||||
@ -324,7 +334,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
LOGGER.info("- plot schematic: {}", schematic3File.getPath());
|
||||
}
|
||||
}
|
||||
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||
if ((schematic1 == null&& schematic2 == null) || this.ROAD_WIDTH == 0) {
|
||||
if (Settings.DEBUG) {
|
||||
LOGGER.info("- schematic: false");
|
||||
}
|
||||
|
@ -504,9 +504,10 @@ public class HybridUtils {
|
||||
Location top = plot.getTopAbs();
|
||||
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
|
||||
PlotManager plotManager = plotworld.getPlotManager();
|
||||
int schemY = Math.min(plotworld.PLOT_HEIGHT, Math.min(plotworld.WALL_HEIGHT, plotworld.ROAD_HEIGHT));
|
||||
int sx = bot.getX() - plotworld.ROAD_WIDTH + 1;
|
||||
int sz = bot.getZ() + 1;
|
||||
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? plotworld.ROAD_HEIGHT : 1;
|
||||
int sy = Settings.Schematics.PASTE_ROAD_ON_TOP ? schemY : plot.getArea().getMinBuildHeight();
|
||||
int ex = bot.getX();
|
||||
int ez = top.getZ();
|
||||
int ey = get_ey(plotManager, queue, sx, ex, sz, ez, sy);
|
||||
@ -517,7 +518,7 @@ public class HybridUtils {
|
||||
final Set<CuboidRegion> sideRoad = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ey, sz, ez));
|
||||
final Set<CuboidRegion> intersection = Collections.singleton(RegionUtil.createRegion(sx, ex, sy, ty, bz, tz));
|
||||
|
||||
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
|
||||
final String dir = Settings.Paths.SCHEMATICS + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plot
|
||||
.getArea()
|
||||
.toString() + File.separator;
|
||||
|
||||
|
@ -58,6 +58,7 @@ import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.NotifyEnterFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.NotifyLeaveFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.TimeFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.TitlesFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.WeatherFlag;
|
||||
@ -173,9 +174,21 @@ public class PlotListener {
|
||||
String greeting = plot.getFlag(GreetingFlag.class);
|
||||
if (!greeting.isEmpty()) {
|
||||
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
|
||||
plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendMessage);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flags.greeting_flag_format"),
|
||||
Template.of("world", plot.getWorldName()),
|
||||
Template.of("plot_id", plot.getId().toString()),
|
||||
Template.of("alias", plot.getAlias()),
|
||||
Template.of("greeting", greeting)
|
||||
);
|
||||
} else {
|
||||
plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendActionBar);
|
||||
player.sendActionBar(
|
||||
TranslatableCaption.of("flags.greeting_flag_format"),
|
||||
Template.of("world", plot.getWorldName()),
|
||||
Template.of("plot_id", plot.getId().toString()),
|
||||
Template.of("alias", plot.getAlias()),
|
||||
Template.of("greeting", greeting)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,50 +318,52 @@ public class PlotListener {
|
||||
subtitle = "";
|
||||
fromFlag = false;
|
||||
}
|
||||
// It's not actually possible for these to be null, but IntelliJ is dumb
|
||||
TaskManager.runTaskLaterAsync(() -> {
|
||||
Plot lastPlot;
|
||||
try (final MetaDataAccess<Plot> lastPlotAccess =
|
||||
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
||||
lastPlot = lastPlotAccess.get().orElse(null);
|
||||
}
|
||||
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
|
||||
final UUID plotOwner = plot.getOwnerAbs();
|
||||
String owner = PlayerManager.getName(plotOwner, false);
|
||||
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
|
||||
".title_entered_plot");
|
||||
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
|
||||
".title_entered_plot_sub");
|
||||
Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
|
||||
Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
|
||||
Template ownerTemplate = Template.of("owner", owner);
|
||||
|
||||
final Consumer<String> userConsumer = user -> {
|
||||
if (Settings.Titles.TITLES_AS_ACTIONBAR) {
|
||||
player.sendActionBar(header, plotTemplate, worldTemplate, ownerTemplate);
|
||||
} else {
|
||||
player.sendTitle(header, subHeader, plotTemplate, worldTemplate, ownerTemplate);
|
||||
}
|
||||
};
|
||||
|
||||
UUID uuid = plot.getOwner();
|
||||
if (uuid == null) {
|
||||
userConsumer.accept("Unknown");
|
||||
} else if (uuid.equals(DBFunc.SERVER)) {
|
||||
userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
|
||||
.of("info.server")
|
||||
.getComponent(player)));
|
||||
} else {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
|
||||
if (throwable != null) {
|
||||
userConsumer.accept("Unknown");
|
||||
} else {
|
||||
userConsumer.accept(user);
|
||||
}
|
||||
});
|
||||
if (fromFlag || !plot.getFlag(ServerPlotFlag.class) || Settings.Titles.DISPLAY_DEFAULT_ON_SERVER_PLOT) {
|
||||
TaskManager.runTaskLaterAsync(() -> {
|
||||
Plot lastPlot;
|
||||
try (final MetaDataAccess<Plot> lastPlotAccess =
|
||||
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
||||
lastPlot = lastPlotAccess.get().orElse(null);
|
||||
}
|
||||
}
|
||||
}, TaskTime.seconds(1L));
|
||||
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
|
||||
final UUID plotOwner = plot.getOwnerAbs();
|
||||
String owner = PlayerManager.getName(plotOwner, false);
|
||||
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" +
|
||||
".title_entered_plot");
|
||||
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" +
|
||||
".title_entered_plot_sub");
|
||||
Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
|
||||
Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
|
||||
Template ownerTemplate = Template.of("owner", owner);
|
||||
Template aliasTemplate = Template.of("alias", plot.getAlias());
|
||||
|
||||
final Consumer<String> userConsumer = user -> {
|
||||
if (Settings.Titles.TITLES_AS_ACTIONBAR) {
|
||||
player.sendActionBar(header, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
|
||||
} else {
|
||||
player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
|
||||
}
|
||||
};
|
||||
|
||||
UUID uuid = plot.getOwner();
|
||||
if (uuid == null) {
|
||||
userConsumer.accept("Unknown");
|
||||
} else if (uuid.equals(DBFunc.SERVER)) {
|
||||
userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption
|
||||
.of("info.server")
|
||||
.getComponent(player)));
|
||||
} else {
|
||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
|
||||
if (throwable != null) {
|
||||
userConsumer.accept("Unknown");
|
||||
} else {
|
||||
userConsumer.accept(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, TaskTime.seconds(1L));
|
||||
}
|
||||
}
|
||||
|
||||
TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class);
|
||||
@ -404,9 +419,21 @@ public class PlotListener {
|
||||
String farewell = plot.getFlag(FarewellFlag.class);
|
||||
if (!farewell.isEmpty()) {
|
||||
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
|
||||
plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendMessage);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("flags.farewell_flag_format"),
|
||||
Template.of("world", plot.getWorldName()),
|
||||
Template.of("plot_id", plot.getId().toString()),
|
||||
Template.of("alias", plot.getAlias()),
|
||||
Template.of("farewell", farewell)
|
||||
);
|
||||
} else {
|
||||
plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendActionBar);
|
||||
player.sendActionBar(
|
||||
TranslatableCaption.of("flags.farewell_flag_format"),
|
||||
Template.of("world", plot.getWorldName()),
|
||||
Template.of("plot_id", plot.getId().toString()),
|
||||
Template.of("alias", plot.getAlias()),
|
||||
Template.of("farewell", farewell)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,14 @@
|
||||
*/
|
||||
package com.plotsquared.core.location;
|
||||
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
|
||||
public class BlockLoc {
|
||||
|
||||
public static final BlockLoc ZERO = new BlockLoc(0, 0, 0);
|
||||
public static final BlockLoc MINY = new BlockLoc(0, Integer.MIN_VALUE, 0);
|
||||
private static final BlockLoc MIDDLE = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
@ -34,6 +40,10 @@ public class BlockLoc {
|
||||
private final float yaw;
|
||||
private final float pitch;
|
||||
|
||||
public BlockLoc(int x, int y, int z) {
|
||||
this(x, y, z, 0f, 0f);
|
||||
}
|
||||
|
||||
public BlockLoc(int x, int y, int z, float yaw, float pitch) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@ -43,26 +53,31 @@ public class BlockLoc {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public BlockLoc(int x, int y, int z) {
|
||||
this(x, y, z, 0f, 0f);
|
||||
}
|
||||
|
||||
public static BlockLoc fromString(String string) {
|
||||
String[] parts = string.split(",");
|
||||
|
||||
float yaw;
|
||||
float pitch;
|
||||
if (parts.length == 5) {
|
||||
yaw = Float.parseFloat(parts[3]);
|
||||
pitch = Float.parseFloat(parts[4]);
|
||||
if (string == null || "side".equalsIgnoreCase(string)) {
|
||||
return null;
|
||||
} else if (StringMan.isEqualIgnoreCaseToAny(string, "center", "middle", "centre")) {
|
||||
return MIDDLE;
|
||||
} else {
|
||||
return new BlockLoc(0, 0, 0);
|
||||
}
|
||||
int x = Integer.parseInt(parts[0]);
|
||||
int y = Integer.parseInt(parts[1]);
|
||||
int z = Integer.parseInt(parts[2]);
|
||||
String[] parts = string.split(",");
|
||||
|
||||
return new BlockLoc(x, y, z, yaw, pitch);
|
||||
float yaw;
|
||||
float pitch;
|
||||
if (parts.length == 5) {
|
||||
yaw = Float.parseFloat(parts[3]);
|
||||
pitch = Float.parseFloat(parts[4]);
|
||||
} else if (parts.length == 3) {
|
||||
yaw = 0;
|
||||
pitch = 0;
|
||||
} else {
|
||||
return ZERO;
|
||||
}
|
||||
int x = Integer.parseInt(parts[0]);
|
||||
int y = Integer.parseInt(parts[1]);
|
||||
int z = Integer.parseInt(parts[2]);
|
||||
|
||||
return new BlockLoc(x, y, z, yaw, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,12 +103,12 @@ public class BlockLoc {
|
||||
}
|
||||
BlockLoc other = (BlockLoc) obj;
|
||||
return this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other
|
||||
.getZ();
|
||||
.getZ() && this.getYaw() == other.getYaw() && this.getPitch() == other.getPitch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) {
|
||||
if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0 && this.getYaw() == 0 && this.getPitch() == 0) {
|
||||
return "";
|
||||
}
|
||||
return this.getX() + "," + this.getY() + ',' + this.getZ() + ',' + this.getYaw() + ','
|
||||
|
@ -56,7 +56,7 @@ public final class PlotLoc {
|
||||
public static @Nullable PlotLoc fromString(final String input) {
|
||||
if (input == null || "side".equalsIgnoreCase(input)) {
|
||||
return null;
|
||||
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) {
|
||||
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle", "centre")) {
|
||||
return new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
} else {
|
||||
try {
|
||||
|
@ -204,7 +204,8 @@ public enum Permission {
|
||||
PERMISSION_ADMIN_DEBUG_OTHER("plots.admin.debug.other"),
|
||||
PERMISSION_RATE("plots.rate"),
|
||||
PERMISSION_ADMIN_FLIGHT("plots.admin.flight"),
|
||||
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other");
|
||||
PERMISSION_ADMIN_COMPONENTS_OTHER("plots.admin.component.other"),
|
||||
PERMISSION_ADMIN_BYPASS_BORDER("plots.admin.border.bypass");
|
||||
//</editor-fold>
|
||||
|
||||
private final String text;
|
||||
|
@ -39,12 +39,12 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.generator.ClassicPlotWorld;
|
||||
import com.plotsquared.core.generator.HybridPlotWorld;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -368,7 +368,7 @@ public class Plot {
|
||||
for (Plot p : plots) {
|
||||
String name = p.getAlias();
|
||||
if (!name.isEmpty() && name.equalsIgnoreCase(arg)) {
|
||||
return p;
|
||||
return p.getBasePlot(false);
|
||||
}
|
||||
}
|
||||
if (message && player != null) {
|
||||
@ -1329,7 +1329,7 @@ public class Plot {
|
||||
return Location.at(
|
||||
"",
|
||||
0,
|
||||
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
0
|
||||
);
|
||||
}
|
||||
@ -1404,7 +1404,7 @@ public class Plot {
|
||||
return Location.at(
|
||||
"",
|
||||
0,
|
||||
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
0
|
||||
);
|
||||
}
|
||||
@ -1443,7 +1443,7 @@ public class Plot {
|
||||
result.accept(Location.at(
|
||||
"",
|
||||
0,
|
||||
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
0
|
||||
));
|
||||
return;
|
||||
@ -1477,7 +1477,7 @@ public class Plot {
|
||||
*/
|
||||
public void setHome(BlockLoc location) {
|
||||
Plot plot = this.getBasePlot(false);
|
||||
if (location != null && new BlockLoc(0, 0, 0).equals(location)) {
|
||||
if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
|
||||
return;
|
||||
}
|
||||
plot.getSettings().setPosition(location);
|
||||
@ -1506,7 +1506,7 @@ public class Plot {
|
||||
@Deprecated
|
||||
public Location getDefaultHomeSynchronous(final boolean member) {
|
||||
Plot plot = this.getBasePlot(false);
|
||||
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
|
||||
BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
|
||||
if (loc != null) {
|
||||
int x;
|
||||
int z;
|
||||
@ -1525,10 +1525,10 @@ public class Plot {
|
||||
x = bot.getX() + loc.getX();
|
||||
z = bot.getZ() + loc.getZ();
|
||||
}
|
||||
int y = loc.getY() < 1
|
||||
int y = loc.getY() == Integer.MIN_VALUE
|
||||
? (isLoaded() ? this.worldUtil.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 : 63)
|
||||
: loc.getY();
|
||||
return Location.at(plot.getWorldName(), x, y, z);
|
||||
return Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch());
|
||||
}
|
||||
// Side
|
||||
return plot.getSideSynchronous();
|
||||
@ -1540,12 +1540,12 @@ public class Plot {
|
||||
result.accept(Location.at(
|
||||
"",
|
||||
0,
|
||||
this.getArea() instanceof HybridPlotWorld ? ((HybridPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 4,
|
||||
0
|
||||
));
|
||||
return;
|
||||
}
|
||||
PlotLoc loc = member ? area.getDefaultHome() : area.getNonmemberHome();
|
||||
BlockLoc loc = member ? area.defaultHome() : area.nonmemberHome();
|
||||
if (loc != null) {
|
||||
int x;
|
||||
int z;
|
||||
@ -1564,7 +1564,7 @@ public class Plot {
|
||||
x = bot.getX() + loc.getX();
|
||||
z = bot.getZ() + loc.getZ();
|
||||
}
|
||||
if (loc.getY() < 1) {
|
||||
if (loc.getY() == Integer.MIN_VALUE) {
|
||||
if (isLoaded()) {
|
||||
this.worldUtil.getHighestBlock(
|
||||
plot.getWorldName(),
|
||||
@ -1573,10 +1573,11 @@ public class Plot {
|
||||
y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z))
|
||||
);
|
||||
} else {
|
||||
result.accept(Location.at(plot.getWorldName(), x, 63, z));
|
||||
int y = this.getArea() instanceof ClassicPlotWorld ? ((ClassicPlotWorld) this.getArea()).PLOT_HEIGHT + 1 : 63;
|
||||
result.accept(Location.at(plot.getWorldName(), x, y, z, loc.getYaw(), loc.getPitch()));
|
||||
}
|
||||
} else {
|
||||
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z));
|
||||
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z, loc.getYaw(), loc.getPitch()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1707,9 +1708,14 @@ public class Plot {
|
||||
}
|
||||
this.getPlotModificationManager().setSign(player.getName());
|
||||
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
|
||||
if (teleport && Settings.Teleport.ON_CLAIM) {
|
||||
teleportPlayer(player, auto ? TeleportCause.COMMAND_AUTO : TeleportCause.COMMAND_CLAIM, result -> {
|
||||
});
|
||||
if (teleport) {
|
||||
if (!auto && Settings.Teleport.ON_CLAIM) {
|
||||
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
|
||||
});
|
||||
} else if (auto && Settings.Teleport.ON_AUTO) {
|
||||
teleportPlayer(player, TeleportCause.COMMAND_AUTO, result -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
PlotArea plotworld = getArea();
|
||||
if (plotworld.isSchematicOnClaim()) {
|
||||
@ -1727,16 +1733,25 @@ public class Plot {
|
||||
e.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
schematicHandler.paste(sch, this, 0, 1, 0, Settings.Schematics.PASTE_ON_TOP, player, new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
if (value) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
|
||||
schematicHandler.paste(
|
||||
sch,
|
||||
this,
|
||||
0,
|
||||
getArea().getMinBuildHeight(),
|
||||
0,
|
||||
Settings.Schematics.PASTE_ON_TOP,
|
||||
player,
|
||||
new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(Boolean value) {
|
||||
if (value) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
plotworld.getPlotManager().claimPlot(this, null);
|
||||
return true;
|
||||
@ -2148,8 +2163,9 @@ public class Plot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the set home location or 0,0,0 if no location is set<br>
|
||||
* Gets the set home location or 0,Integer#MIN_VALUE,0 if no location is set<br>
|
||||
* - Does not take the default home location into account
|
||||
* - PlotSquared will internally find the correct place to teleport to if y = Integer#MIN_VALUE when teleporting to the plot.
|
||||
*
|
||||
* @return home location
|
||||
*/
|
||||
|
@ -41,6 +41,7 @@ import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.generator.GridPlotWorld;
|
||||
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
@ -123,6 +124,7 @@ public abstract class PlotArea {
|
||||
new FlagContainer(GlobalFlagContainer.getInstance());
|
||||
private final YamlConfiguration worldConfiguration;
|
||||
private final GlobalBlockQueue globalBlockQueue;
|
||||
private final boolean roadFlags = false;
|
||||
private boolean autoMerge = false;
|
||||
private boolean allowSigns = true;
|
||||
private boolean miscSpawnUnowned = false;
|
||||
@ -140,14 +142,13 @@ public abstract class PlotArea {
|
||||
private PlotAreaType type = PlotAreaType.NORMAL;
|
||||
private PlotAreaTerrainType terrain = PlotAreaTerrainType.NONE;
|
||||
private boolean homeAllowNonmember = false;
|
||||
private PlotLoc nonmemberHome;
|
||||
private PlotLoc defaultHome;
|
||||
private BlockLoc nonmemberHome;
|
||||
private BlockLoc defaultHome;
|
||||
private int maxBuildHeight = 256;
|
||||
private int minBuildHeight = 1;
|
||||
private GameMode gameMode = GameModes.CREATIVE;
|
||||
private Map<String, PlotExpression> prices = new HashMap<>();
|
||||
private List<String> schematics = new ArrayList<>();
|
||||
private final boolean roadFlags = false;
|
||||
private boolean worldBorder = false;
|
||||
private boolean useEconomy = false;
|
||||
private int hash;
|
||||
@ -370,24 +371,24 @@ public abstract class PlotArea {
|
||||
|
||||
String homeNonMembers = config.getString("home.nonmembers");
|
||||
String homeDefault = config.getString("home.default");
|
||||
this.defaultHome = PlotLoc.fromString(homeDefault);
|
||||
this.defaultHome = BlockLoc.fromString(homeDefault);
|
||||
this.homeAllowNonmember = homeNonMembers.equalsIgnoreCase(homeDefault);
|
||||
if (this.homeAllowNonmember) {
|
||||
this.nonmemberHome = defaultHome;
|
||||
} else {
|
||||
this.nonmemberHome = PlotLoc.fromString(homeNonMembers);
|
||||
this.nonmemberHome = BlockLoc.fromString(homeNonMembers);
|
||||
}
|
||||
|
||||
if ("side".equalsIgnoreCase(homeDefault)) {
|
||||
this.defaultHome = null;
|
||||
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle")) {
|
||||
this.defaultHome = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
} else if (StringMan.isEqualIgnoreCaseToAny(homeDefault, "center", "middle", "centre")) {
|
||||
this.defaultHome = new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
} else {
|
||||
try {
|
||||
/*String[] split = homeDefault.split(",");
|
||||
this.DEFAULT_HOME =
|
||||
new PlotLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]));*/
|
||||
this.defaultHome = PlotLoc.fromString(homeDefault);
|
||||
this.defaultHome = BlockLoc.fromString(homeDefault);
|
||||
} catch (NumberFormatException ignored) {
|
||||
this.defaultHome = null;
|
||||
}
|
||||
@ -408,13 +409,9 @@ public abstract class PlotArea {
|
||||
}
|
||||
}
|
||||
this.getFlagContainer().addAll(parseFlags(flags));
|
||||
|
||||
Component flagsComponent = null;
|
||||
Collection<PlotFlag<?, ?>> flagCollection = this.getFlagContainer().getFlagMap().values();
|
||||
flagsComponent = getFlagsComponent(flagsComponent, flagCollection);
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.area_flags"),
|
||||
Template.of("flags", flagsComponent)
|
||||
Template.of("flags", flags.toString())
|
||||
);
|
||||
|
||||
this.spawnEggs = config.getBoolean("event.spawn.egg");
|
||||
@ -433,13 +430,9 @@ public abstract class PlotArea {
|
||||
}
|
||||
}
|
||||
this.getRoadFlagContainer().addAll(parseFlags(roadflags));
|
||||
|
||||
Component roadFlagsComponent = null;
|
||||
Collection<PlotFlag<?, ?>> roadFlagCollection = this.getRoadFlagContainer().getFlagMap().values();
|
||||
roadFlagsComponent = getFlagsComponent(roadFlagsComponent, roadFlagCollection);
|
||||
ConsolePlayer.getConsole().sendMessage(
|
||||
TranslatableCaption.of("flags.road_flags"),
|
||||
Template.of("flags", roadFlagsComponent)
|
||||
Template.of("flags", roadflags.toString())
|
||||
);
|
||||
|
||||
loadConfiguration(config);
|
||||
@ -1359,15 +1352,38 @@ public abstract class PlotArea {
|
||||
return this.homeAllowNonmember;
|
||||
}
|
||||
|
||||
public PlotLoc getNonmemberHome() {
|
||||
/**
|
||||
* Get the location for non-members to be teleported to.
|
||||
*/
|
||||
public BlockLoc nonmemberHome() {
|
||||
return this.nonmemberHome;
|
||||
}
|
||||
|
||||
public PlotLoc getDefaultHome() {
|
||||
/**
|
||||
* Get the default location for players to be teleported to. May be overriden by {@link #nonmemberHome} if the player is
|
||||
* not a member of the plot.
|
||||
*/
|
||||
public BlockLoc defaultHome() {
|
||||
return this.defaultHome;
|
||||
}
|
||||
|
||||
protected void setDefaultHome(PlotLoc defaultHome) {
|
||||
/**
|
||||
* @deprecated Use {@link #nonmemberHome}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public PlotLoc getNonmemberHome() {
|
||||
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #defaultHome}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public PlotLoc getDefaultHome() {
|
||||
return new PlotLoc(this.defaultHome.getX(), this.defaultHome.getY(), this.defaultHome.getZ());
|
||||
}
|
||||
|
||||
protected void setDefaultHome(BlockLoc defaultHome) {
|
||||
this.defaultHome = defaultHome;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ public final class PlotId {
|
||||
// first increase y, then x
|
||||
if (this.y == this.end.getY()) {
|
||||
this.x++;
|
||||
this.y = 0;
|
||||
this.y = this.start.getY();
|
||||
} else {
|
||||
this.y++;
|
||||
}
|
||||
|
@ -229,8 +229,8 @@ public final class PlotModificationManager {
|
||||
!isDelete,
|
||||
isDelete ? PlotUnlinkEvent.REASON.DELETE : PlotUnlinkEvent.REASON.CLEAR
|
||||
);
|
||||
if (event.getEventResult() != Result.DENY) {
|
||||
this.unlinkPlot(event.isCreateRoad(), event.isCreateSign());
|
||||
if (event.getEventResult() != Result.DENY && this.unlinkPlot(event.isCreateRoad(), event.isCreateSign())) {
|
||||
PlotSquared.get().getEventDispatcher().callPostUnlink(plot, event.getReason());
|
||||
}
|
||||
final PlotManager manager = this.plot.getArea().getPlotManager();
|
||||
Runnable run = new Runnable() {
|
||||
@ -502,7 +502,9 @@ public final class PlotModificationManager {
|
||||
}
|
||||
return;
|
||||
}
|
||||
plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), uuid, player, true);
|
||||
if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), uuid, player, true)) {
|
||||
PlotSquared.get().getEventDispatcher().callPostMerge(player, plot);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -107,7 +107,7 @@ public class PlotSettings {
|
||||
|
||||
public BlockLoc getPosition() {
|
||||
if (this.position == null) {
|
||||
return new BlockLoc(0, 0, 0);
|
||||
return BlockLoc.MINY;
|
||||
}
|
||||
return this.position;
|
||||
}
|
||||
|
@ -426,8 +426,11 @@ public class ExpireManager {
|
||||
.callUnlink(plot.getArea(), plot, true, false,
|
||||
PlotUnlinkEvent.REASON.EXPIRE_DELETE
|
||||
);
|
||||
if (event.getEventResult() != Result.DENY) {
|
||||
plot.getPlotModificationManager().unlinkPlot(event.isCreateRoad(), event.isCreateSign());
|
||||
if (event.getEventResult() != Result.DENY && plot.getPlotModificationManager().unlinkPlot(
|
||||
event.isCreateRoad(),
|
||||
event.isCreateSign()
|
||||
)) {
|
||||
this.eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.EXPIRE_DELETE);
|
||||
}
|
||||
}
|
||||
for (UUID helper : plot.getTrusted()) {
|
||||
|
@ -43,8 +43,18 @@ public abstract class ListFlag<V, F extends PlotFlag<List<V>, F>> extends PlotFl
|
||||
@Override
|
||||
public F merge(@NonNull List<V> newValue) {
|
||||
final List<V> mergedList = new ArrayList<>();
|
||||
mergedList.addAll(getValue());
|
||||
mergedList.addAll(newValue);
|
||||
// If a server already used PS before this fix, we remove all present duplicates on an eventual merge
|
||||
for (final V v : getValue()) {
|
||||
if (!mergedList.contains(v)) {
|
||||
mergedList.add(v);
|
||||
}
|
||||
}
|
||||
// Only add new values if not already present from #getValue()
|
||||
for (final V v : newValue) {
|
||||
if (!mergedList.contains(v)) {
|
||||
mergedList.add(v);
|
||||
}
|
||||
}
|
||||
return this.flagOf(mergedList);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ import com.plotsquared.core.generator.GridPlotWorld;
|
||||
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.BlockLoc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.location.PlotLoc;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
@ -74,7 +74,39 @@ public class SinglePlotArea extends GridPlotWorld {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.plotListener = plotListener;
|
||||
this.setAllowSigns(false);
|
||||
this.setDefaultHome(new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE));
|
||||
this.setDefaultHome(new BlockLoc(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given string matches the naming system used to identify single plot worlds
|
||||
* e.g. -1_5 represents plot id *;-1;5. "*" being the plot area name given to single plot world
|
||||
* {@link com.plotsquared.core.plot.PlotArea}.
|
||||
*/
|
||||
public static boolean isSinglePlotWorld(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;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -89,7 +89,7 @@ public class LocationOffsetDelegateQueueCoordinator extends DelegateQueueCoordin
|
||||
public boolean setBiome(int x, int z, @NonNull BiomeType biome) {
|
||||
boolean result = true;
|
||||
for (int y = 0; y < 256; y++) {
|
||||
result &= this.setBiome(x, z, biome);
|
||||
result &= this.setBiome(x, y, z, biome);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -51,6 +51,11 @@ import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.PlotRateEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
|
||||
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
|
||||
import com.plotsquared.core.events.post.PostPlotDeleteEvent;
|
||||
import com.plotsquared.core.events.post.PostPlotMergeEvent;
|
||||
import com.plotsquared.core.events.post.PostPlotUnlinkEvent;
|
||||
import com.plotsquared.core.listener.PlayerBlockEventType;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
@ -135,6 +140,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public PostPlayerAutoPlotEvent callPostAuto(PlotPlayer<?> player, Plot plot) {
|
||||
PostPlayerAutoPlotEvent event = new PostPlayerAutoPlotEvent(player, plot);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public PlayerAutoPlotsChosenEvent callAutoPlotsChosen(
|
||||
PlotPlayer<?> player, List<Plot> plots
|
||||
) {
|
||||
@ -174,6 +185,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public PostPlotDeleteEvent callPostDelete(Plot plot) {
|
||||
PostPlotDeleteEvent event = new PostPlotDeleteEvent(plot);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public PlotFlagAddEvent callFlagAdd(PlotFlag<?, ?> flag, Plot plot) {
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot);
|
||||
callEvent(event);
|
||||
@ -192,6 +209,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public PostPlotMergeEvent callPostMerge(PlotPlayer<?> player, Plot plot) {
|
||||
PostPlotMergeEvent event = new PostPlotMergeEvent(player, plot);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public PlotAutoMergeEvent callAutoMerge(Plot plot, List<PlotId> plots) {
|
||||
PlotAutoMergeEvent event = new PlotAutoMergeEvent(plot.getWorldName(), plot, plots);
|
||||
callEvent(event);
|
||||
@ -207,6 +230,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public PostPlotUnlinkEvent callPostUnlink(Plot plot, PlotUnlinkEvent.REASON reason) {
|
||||
PostPlotUnlinkEvent event = new PostPlotUnlinkEvent(plot, reason);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public PlayerEnterPlotEvent callEntry(PlotPlayer<?> player, Plot plot) {
|
||||
PlayerEnterPlotEvent event = new PlayerEnterPlotEvent(player, plot);
|
||||
callEvent(event);
|
||||
@ -256,6 +285,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public PostPlotChangeOwnerEvent callPostOwnerChange(PlotPlayer<?> player, Plot plot, @Nullable UUID oldOwner) {
|
||||
PostPlotChangeOwnerEvent event = new PostPlotChangeOwnerEvent(player, plot, oldOwner);
|
||||
callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public PlotRateEvent callRating(PlotPlayer<?> player, Plot plot, Rating rating) {
|
||||
PlotRateEvent event = new PlotRateEvent(player, rating, plot);
|
||||
eventBus.post(event);
|
||||
|
@ -61,7 +61,7 @@ public abstract class RegionManager {
|
||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + RegionManager.class.getSimpleName());
|
||||
|
||||
public static RegionManager manager = null;
|
||||
private final WorldUtil worldUtil;
|
||||
protected final WorldUtil worldUtil;
|
||||
private final GlobalBlockQueue blockQueue;
|
||||
private final ProgressSubscriberFactory subscriberFactory;
|
||||
|
||||
|
@ -581,6 +581,10 @@ public abstract class SchematicHandler {
|
||||
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
|
||||
schematic.put("BlockEntities", new ListTag(CompoundTag.class, tileEntities));
|
||||
|
||||
if (biomeBuffer.size() == 0 || biomePalette.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
|
||||
|
||||
Map<String, Tag> biomePaletteTag = new HashMap<>();
|
||||
|
@ -32,11 +32,13 @@ import com.plotsquared.core.command.Command;
|
||||
import com.plotsquared.core.command.CommandCategory;
|
||||
import com.plotsquared.core.command.RequiredType;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -80,12 +82,31 @@ public final class TabCompletions {
|
||||
* @param input Command input
|
||||
* @param existing Players that should not be included in completions
|
||||
* @return List of completions
|
||||
* @deprecated In favor {@link #completePlayers(PlotPlayer, String, List)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static @NonNull List<Command> completePlayers(
|
||||
final @NonNull String input,
|
||||
final @NonNull List<String> existing
|
||||
) {
|
||||
return completePlayers("players", input, existing, uuid -> true);
|
||||
return completePlayers(ConsolePlayer.getConsole(), input, existing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of tab completions corresponding to player names. This uses the UUID pipeline
|
||||
* cache, so it will complete will all names known to PlotSquared
|
||||
*
|
||||
* @param input Command input
|
||||
* @param issuer The player who issued the tab completion
|
||||
* @param existing Players that should not be included in completions
|
||||
* @return List of completions
|
||||
*/
|
||||
public static @NonNull List<Command> completePlayers(
|
||||
final @NonNull PlotPlayer<?> issuer,
|
||||
final @NonNull String input,
|
||||
final @NonNull List<String> existing
|
||||
) {
|
||||
return completePlayers("players", issuer, input, existing, uuid -> true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,12 +116,32 @@ public final class TabCompletions {
|
||||
* @param input Command input
|
||||
* @param existing Players that should not be included in completions
|
||||
* @return List of completions
|
||||
*
|
||||
* @deprecated In favor {@link #completeAddedPlayers(PlotPlayer, Plot, String, List)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static @NonNull List<Command> completeAddedPlayers(
|
||||
final @NonNull Plot plot,
|
||||
final @NonNull String input, final @NonNull List<String> existing
|
||||
) {
|
||||
return completePlayers("added" + plot, input, existing,
|
||||
return completeAddedPlayers(ConsolePlayer.getConsole(), plot, input, existing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of tab completions corresponding to player names added to the given plot.
|
||||
*
|
||||
* @param issuer The player who issued the tab completion
|
||||
* @param plot Plot to complete added players for
|
||||
* @param input Command input
|
||||
* @param existing Players that should not be included in completions
|
||||
* @return List of completions
|
||||
*/
|
||||
public static @NonNull List<Command> completeAddedPlayers(
|
||||
final @NonNull PlotPlayer<?> issuer,
|
||||
final @NonNull Plot plot,
|
||||
final @NonNull String input, final @NonNull List<String> existing
|
||||
) {
|
||||
return completePlayers("added" + plot, issuer, input, existing,
|
||||
uuid -> plot.getMembers().contains(uuid)
|
||||
|| plot.getTrusted().contains(uuid)
|
||||
|| plot.getDenied().contains(uuid)
|
||||
@ -222,9 +263,28 @@ public final class TabCompletions {
|
||||
* @param existing Players that should not be included in completions
|
||||
* @param uuidFilter Filter applied before caching values
|
||||
* @return List of completions
|
||||
* @deprecated In favor {@link #completePlayers(String, PlotPlayer, String, List, Predicate)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
private static List<Command> completePlayers(
|
||||
final @NonNull String cacheIdentifier,
|
||||
final @NonNull String input, final @NonNull List<String> existing,
|
||||
final @NonNull Predicate<UUID> uuidFilter
|
||||
) {
|
||||
return completePlayers(cacheIdentifier, ConsolePlayer.getConsole(), input, existing, uuidFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacheIdentifier Cache key
|
||||
* @param issuer The player who issued the tab completion
|
||||
* @param input Command input
|
||||
* @param existing Players that should not be included in completions
|
||||
* @param uuidFilter Filter applied before caching values
|
||||
* @return List of completions
|
||||
*/
|
||||
private static List<Command> completePlayers(
|
||||
final @NonNull String cacheIdentifier,
|
||||
final @NonNull PlotPlayer<?> issuer,
|
||||
final @NonNull String input, final @NonNull List<String> existing,
|
||||
final @NonNull Predicate<UUID> uuidFilter
|
||||
) {
|
||||
@ -246,9 +306,13 @@ public final class TabCompletions {
|
||||
final Collection<? extends PlotPlayer<?>> onlinePlayers = PlotSquared.platform().playerManager().getPlayers();
|
||||
players = new ArrayList<>(onlinePlayers.size());
|
||||
for (final PlotPlayer<?> player : onlinePlayers) {
|
||||
if (uuidFilter.test(player.getUUID())) {
|
||||
players.add(player.getName());
|
||||
if (!uuidFilter.test(player.getUUID())) {
|
||||
continue;
|
||||
}
|
||||
if (issuer != null && !issuer.canSee(player)) {
|
||||
continue;
|
||||
}
|
||||
players.add(player.getName());
|
||||
}
|
||||
}
|
||||
return filterCached(players, input, existing);
|
||||
|
@ -69,6 +69,7 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
|
||||
return false;
|
||||
}
|
||||
plot.claim(player, true, schematic, false, true);
|
||||
eventDispatcher.callPostAuto(player, plot);
|
||||
if (area.isAutoMerge()) {
|
||||
PlotMergeEvent event = this.eventDispatcher.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
@ -77,7 +78,9 @@ public final class AutoClaimFinishTask implements Callable<Boolean> {
|
||||
Templates.of("value", "Auto Merge")
|
||||
);
|
||||
} else {
|
||||
plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true);
|
||||
if (plot.getPlotModificationManager().autoMerge(event.getDir(), event.getMax(), player.getUUID(), player, true)) {
|
||||
eventDispatcher.callPostMerge(player, plot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -53,7 +53,9 @@
|
||||
"cluster.cluster_regenerated": "<prefix><dark_aqua>Successfully started cluster regeneration.</dark_aqua>",
|
||||
"cluster.cluster_teleporting": "<prefix><dark_aqua>Teleporting...</dark_aqua>",
|
||||
"cluster.cluster_info": "<prefix><gold>Current cluster: </gold><gray><id></gray>\n<gold>Name: </gold><gray><name></gray>\n<gold>Owner: </gold><gray><owner></gray>\n<gold>Size: </gold><gray><size></gray>\n<gold>Rights: </gold><gray><rights></gray>",
|
||||
"border.border": "<prefix><gray>You are outside the current map border.</gray>",
|
||||
"border.denied": "<prefix><red>You are outside the current map border.</red>",
|
||||
"border.bypass.exited": "<prefix><red>You have bypassed the current map border area.</red>",
|
||||
"border.bypass.entered": "<prefix><gray>You have re-entered the current map border area.</gray>",
|
||||
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
|
||||
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
|
||||
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
|
||||
@ -92,6 +94,7 @@
|
||||
"done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>",
|
||||
"done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>",
|
||||
"done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>",
|
||||
"done.building_restricted": "<prefix><gray>You can't build on plots marked as done.</gray>",
|
||||
"ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>",
|
||||
"ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>",
|
||||
"ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>",
|
||||
@ -183,8 +186,6 @@
|
||||
"error.task_in_process": "<prefix><gold>Task is already running.</gold>",
|
||||
"titles.title_entered_plot": "<gold>Plot: <world>;<plot></gold>",
|
||||
"titles.title_entered_plot_sub": "<dark_aqua>Owned by <owner></dark_aqua>",
|
||||
"titles.prefix_greeting": "<gold><id></gold><gray>></gray>",
|
||||
"titles.prefix_farewell": "<gold><id></gold><gray>></gray>",
|
||||
"core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>",
|
||||
"core.enabled": "<prefix><gold><value> is now enabled.</gold>",
|
||||
"placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>",
|
||||
@ -459,6 +460,7 @@
|
||||
"preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>",
|
||||
"preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
|
||||
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
|
||||
"preset.title": "Plot Components",
|
||||
"generic.generic_other": "<gray>other</gray>",
|
||||
"generic.generic_merged": "<gray>merged</gray>",
|
||||
"generic.generic_unowned": "<gray>unowned</gray>",
|
||||
@ -616,6 +618,8 @@
|
||||
"flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.",
|
||||
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
|
||||
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
|
||||
"flags.greeting_flag_format": "<prefix><gold>[<world>;<plot_id>]:</gold> <greeting>",
|
||||
"flags.farewell_flag_format": "<prefix><gold>[<world>;<plot_id>]:</gold> <farewell>",
|
||||
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
|
||||
"commands.description.alias": "<gray>Set the plot alias.</gray>",
|
||||
"commands.description.area": "<gray>Create a new plot area.</gray>",
|
||||
|
@ -30,14 +30,12 @@ import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
class ClickStripTransformTest {
|
||||
|
||||
@ -53,7 +51,7 @@ class ClickStripTransformTest {
|
||||
)
|
||||
);
|
||||
var transformedComponent = transform.transform(component);
|
||||
assertNull(transformedComponent.clickEvent());
|
||||
Assertions.assertNull(transformedComponent.clickEvent());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -68,7 +66,7 @@ class ClickStripTransformTest {
|
||||
var component = Component.text("Hello")
|
||||
.clickEvent(originalClickEvent);
|
||||
var transformedComponent = transform.transform(component);
|
||||
assertEquals(originalClickEvent, transformedComponent.clickEvent());
|
||||
Assertions.assertEquals(originalClickEvent, transformedComponent.clickEvent());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -88,9 +86,9 @@ class ClickStripTransformTest {
|
||||
inner.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://example.org"))
|
||||
);
|
||||
var transformedComponent = transform.transform(component);
|
||||
assertFalse(transformedComponent.children().isEmpty()); // child still exists
|
||||
assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed
|
||||
assertNull(transformedComponent.children().get(0).clickEvent());
|
||||
Assertions.assertFalse(transformedComponent.children().isEmpty()); // child still exists
|
||||
Assertions.assertEquals(inner, transformedComponent.children().get(0)); // only the click event has changed
|
||||
Assertions.assertNull(transformedComponent.children().get(0).clickEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,10 +32,9 @@ import com.plotsquared.core.plot.flag.implementations.UseFlag;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class FlagTest {
|
||||
|
||||
@ -43,7 +42,7 @@ public class FlagTest {
|
||||
|
||||
private ItemType testBlock;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
//EventUtil.manager = new EventUtilTest();
|
||||
DBFunc.dbManager = new AbstractDBTest();
|
||||
@ -72,7 +71,7 @@ public class FlagTest {
|
||||
@Test
|
||||
public void testFlagName() {
|
||||
String flagName = PlotFlag.getFlagName(UseFlag.class);
|
||||
assertEquals("use", flagName);
|
||||
Assertions.assertEquals("use", flagName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,17 +25,13 @@
|
||||
*/
|
||||
package com.plotsquared.core.plot;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PlotRangeIteratorTest {
|
||||
|
||||
@Test
|
||||
@ -43,10 +39,10 @@ public class PlotRangeIteratorTest {
|
||||
// an iterator that should only contain the given plot
|
||||
PlotId id = PlotId.of(3, 7);
|
||||
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id, id);
|
||||
assertTrue(range.hasNext());
|
||||
assertEquals(id, range.next());
|
||||
assertFalse(range.hasNext());
|
||||
assertThrows(NoSuchElementException.class, range::next);
|
||||
Assertions.assertTrue(range.hasNext());
|
||||
Assertions.assertEquals(id, range.next());
|
||||
Assertions.assertFalse(range.hasNext());
|
||||
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
||||
}
|
||||
|
||||
// the tests below assume a specific order (first increasing y, then increasing x)
|
||||
@ -61,11 +57,11 @@ public class PlotRangeIteratorTest {
|
||||
List<PlotId> all = Arrays.asList(id00, id01, id10, id11);
|
||||
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id11);
|
||||
for (PlotId id : all) {
|
||||
assertTrue(range.hasNext());
|
||||
assertEquals(id, range.next());
|
||||
Assertions.assertTrue(range.hasNext());
|
||||
Assertions.assertEquals(id, range.next());
|
||||
}
|
||||
assertFalse(range.hasNext());
|
||||
assertThrows(NoSuchElementException.class, range::next);
|
||||
Assertions.assertFalse(range.hasNext());
|
||||
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -80,11 +76,11 @@ public class PlotRangeIteratorTest {
|
||||
List<PlotId> all = Arrays.asList(id00, id01, id02, id10, id11, id12);
|
||||
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id12);
|
||||
for (PlotId id : all) {
|
||||
assertTrue(range.hasNext());
|
||||
assertEquals(id, range.next());
|
||||
Assertions.assertTrue(range.hasNext());
|
||||
Assertions.assertEquals(id, range.next());
|
||||
}
|
||||
assertFalse(range.hasNext());
|
||||
assertThrows(NoSuchElementException.class, range::next);
|
||||
Assertions.assertFalse(range.hasNext());
|
||||
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -99,11 +95,23 @@ public class PlotRangeIteratorTest {
|
||||
List<PlotId> all = Arrays.asList(id00, id01, id10, id11, id20, id21);
|
||||
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id21);
|
||||
for (PlotId id : all) {
|
||||
assertTrue(range.hasNext());
|
||||
assertEquals(id, range.next());
|
||||
Assertions.assertTrue(range.hasNext());
|
||||
Assertions.assertEquals(id, range.next());
|
||||
}
|
||||
assertFalse(range.hasNext());
|
||||
assertThrows(NoSuchElementException.class, range::next);
|
||||
Assertions.assertFalse(range.hasNext());
|
||||
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resetYOfIteratorToStart() {
|
||||
PlotId id00 = PlotId.of(0, 1);
|
||||
PlotId id01 = PlotId.of(1, 2);
|
||||
PlotId.PlotRangeIterator range = PlotId.PlotRangeIterator.range(id00, id01);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Assertions.assertNotEquals(0, range.next().getY());
|
||||
}
|
||||
Assertions.assertFalse(range.hasNext());
|
||||
Assertions.assertThrows(NoSuchElementException.class, range::next);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.plot;
|
||||
import com.plotsquared.core.PlotVersion;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PlotVersionTest {
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.synchronization;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -32,9 +33,6 @@ import org.junit.jupiter.api.Test;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
class LockRepositoryTest {
|
||||
|
||||
private LockKey key;
|
||||
@ -55,11 +53,9 @@ class LockRepositoryTest {
|
||||
throw new IllegalStateException("Expected a ReentrantLock");
|
||||
}
|
||||
|
||||
assertThrows(IllegalStateException.class, () -> {
|
||||
this.lockRepository.useLock(this.key, () -> {
|
||||
throw new IllegalStateException();
|
||||
});
|
||||
});
|
||||
assertFalse(lock.isLocked());
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> this.lockRepository.useLock(this.key, () -> {
|
||||
throw new IllegalStateException();
|
||||
}));
|
||||
Assertions.assertFalse(lock.isLocked());
|
||||
}
|
||||
}
|
||||
|
10
README.md
10
README.md
@ -30,21 +30,13 @@ is to provide a lag-free and smooth experience.
|
||||
* [Wiki](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki)
|
||||
* [Issues](https://github.com/IntellectualSites/PlotSquared/issues)
|
||||
* [Translations](https://intellectualsites.crowdin.com/plotsquared/)
|
||||
* [Contributing](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md)
|
||||
|
||||
### Developer Resources
|
||||
* [API Documentation](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki/API-Documentation)
|
||||
* [Event API](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki/Events)
|
||||
* [Flag API](https://github.com/IntellectualSites/PlotSquared-Documentation/wiki/API-Flag)
|
||||
|
||||
# Building
|
||||
Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module.
|
||||
|
||||
# Contributing
|
||||
See [here](https://github.com/IntellectualSites/PlotSquared/blob/v6/CONTRIBUTING.md)
|
||||
|
||||
## Suggestions
|
||||
Suggestions are welcome! We have a separate issue tracker for suggestions, that can be found in [this](https://github.com/IntellectualSites/PlotSquaredSuggestions) repository.
|
||||
|
||||
# Official Addons
|
||||
* [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/)
|
||||
* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/)
|
||||
|
@ -1,3 +0,0 @@
|
||||
If you discover a security vulnerability in PlotSquared, please submit it through the [Security Vulnerability Form](https://forms.gle/btgdRn9yhGtzEiGW8).
|
||||
|
||||
Thanks for helping make PlotSquared safe for everyone.
|
@ -1,6 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
||||
import org.cadixdev.gradle.licenser.LicenseExtension
|
||||
import org.cadixdev.gradle.licenser.Licenser
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
java
|
||||
@ -11,22 +12,13 @@ plugins {
|
||||
alias(libs.plugins.shadow)
|
||||
alias(libs.plugins.licenser)
|
||||
alias(libs.plugins.grgit)
|
||||
alias(libs.plugins.nexus)
|
||||
|
||||
eclipse
|
||||
idea
|
||||
}
|
||||
|
||||
var ver by extra("6.1.1")
|
||||
var versuffix by extra("-SNAPSHOT")
|
||||
val versionsuffix: String? by project
|
||||
if (versionsuffix != null) {
|
||||
versuffix = "-$versionsuffix"
|
||||
}
|
||||
version = if (!project.hasProperty("release")) {
|
||||
ver + versuffix
|
||||
} else {
|
||||
ver
|
||||
}
|
||||
version = "6.2.1"
|
||||
|
||||
allprojects {
|
||||
group = "com.plotsquared"
|
||||
@ -75,8 +67,7 @@ val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name
|
||||
allprojects {
|
||||
dependencies {
|
||||
// Tests
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
||||
}
|
||||
|
||||
plugins.withId("java") {
|
||||
@ -103,6 +94,9 @@ allprojects {
|
||||
|
||||
signing {
|
||||
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||
val signingKey: String? by project
|
||||
val signingPassword: String? by project
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
signing.isRequired
|
||||
sign(publishing.publications)
|
||||
}
|
||||
@ -111,8 +105,6 @@ allprojects {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
// This includes not only the original jar (i.e. not shadowJar),
|
||||
// but also sources & javadocs due to the above java block.
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
@ -133,18 +125,23 @@ allprojects {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("NotMyFault")
|
||||
name.set("NotMyFault")
|
||||
organization.set("IntellectualSites")
|
||||
email.set("contact@notmyfault.dev")
|
||||
}
|
||||
developer {
|
||||
id.set("SirYwell")
|
||||
name.set("Hannes Greule")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("dordsor21")
|
||||
name.set("dordsor21")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,34 +158,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal() // Install to own local repository
|
||||
|
||||
// Accept String? to not err if they're not present.
|
||||
// Check that they both exist before adding the repo, such that
|
||||
// `credentials` doesn't err if one is null.
|
||||
// It's not pretty, but this way it can compile.
|
||||
val nexusUsername: String? by project
|
||||
val nexusPassword: String? by project
|
||||
if (nexusUsername != null && nexusPassword != null) {
|
||||
maven {
|
||||
val releasesRepositoryUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
val snapshotRepositoryUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
url = uri(
|
||||
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
||||
else releasesRepositoryUrl
|
||||
)
|
||||
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -217,10 +186,6 @@ allprojects {
|
||||
)
|
||||
}
|
||||
|
||||
jar {
|
||||
this.archiveClassifier.set("jar")
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
this.archiveClassifier.set(null as String?)
|
||||
this.archiveFileName.set("${project.name}-${project.version}.${this.archiveExtension.getOrElse("jar")}")
|
||||
@ -237,6 +202,15 @@ allprojects {
|
||||
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
||||
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val aggregatedJavadocs = create<Javadoc>("aggregatedJavadocs") {
|
||||
title = "${project.name} ${project.version} API"
|
||||
@ -261,7 +235,7 @@ tasks {
|
||||
|
||||
val rootOptions = aggregatedJavadocs.options as StandardJavadocDocletOptions
|
||||
val subOptions = task.options as StandardJavadocDocletOptions
|
||||
rootOptions.links(*subOptions.links.orEmpty().minus(rootOptions.links.orEmpty()).toTypedArray())
|
||||
rootOptions.links(*subOptions.links.orEmpty().minus(rootOptions.links.orEmpty().toSet()).toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,47 +1,48 @@
|
||||
[versions]
|
||||
# Minecraft expectations
|
||||
guava = "21.0" # Version set by Minecraft
|
||||
gson = "2.8.0" # Version set by Minecraft
|
||||
log4j-api = "2.14.1" # Version set by Minecraft
|
||||
log4j-api = "2.16.0" # Version set by Minecraft
|
||||
guava = "21.0" # Version set by Minecraft
|
||||
|
||||
# Platform expectations
|
||||
paper = "1.17.1-R0.1-SNAPSHOT"
|
||||
checker-qual = "3.18.0"
|
||||
checker-qual = "3.20.0"
|
||||
guice = "5.0.1"
|
||||
findbugs = "3.0.1"
|
||||
snakeyaml = "1.28" # Version set by Bukkit
|
||||
|
||||
# Adventure & MiniMessage
|
||||
adventure-api = "4.9.1"
|
||||
adventure-api = "4.9.3"
|
||||
adventure-text-minimessage = "4.1.0-SNAPSHOT"
|
||||
adventure-platform-bukkit = "4.0.0-SNAPSHOT"
|
||||
adventure-platform-bukkit = "4.0.1"
|
||||
|
||||
# Plugins
|
||||
worldedit = "7.2.6"
|
||||
fawe = "1.17-201"
|
||||
worldedit = "7.2.8"
|
||||
fawe = "1.17-419"
|
||||
vault = "1.7.1"
|
||||
placeholderapi = "2.10.10"
|
||||
luckperms = "5.3"
|
||||
essentialsx = "2.18.2"
|
||||
essentialsx = "2.19.0"
|
||||
hyperverse = "0.6.0-SNAPSHOT"
|
||||
mvdwapi = "3.1.1"
|
||||
|
||||
# Third party
|
||||
prtree = "1.5.0"
|
||||
prtree = "2.0.0"
|
||||
aopalliance = "1.0"
|
||||
pipeline = "1.4.0-SNAPSHOT"
|
||||
arkitektonika = "2.1.0"
|
||||
rorledning = "1.4.0-SNAPSHOT"
|
||||
arkitektonika = "2.1.1"
|
||||
paster = "1.1.1"
|
||||
bstats = "2.2.1"
|
||||
paperlib = "1.0.6"
|
||||
paperlib = "1.0.7"
|
||||
squirrelid = "0.3.0"
|
||||
serverlib = "2.3.0"
|
||||
serverlib = "2.3.1"
|
||||
http4j = "1.3"
|
||||
|
||||
# Gradle plugins
|
||||
shadow = "7.0.0"
|
||||
grgit = "4.1.0"
|
||||
shadow = "7.1.0"
|
||||
grgit = "4.1.1"
|
||||
licenser = "0.6.1"
|
||||
nexus = "1.1.0"
|
||||
|
||||
[libraries]
|
||||
# Platform expectations
|
||||
@ -49,7 +50,6 @@ paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper"
|
||||
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checker-qual" }
|
||||
|
||||
# Minecraft expectations
|
||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j-api" }
|
||||
|
||||
@ -67,18 +67,18 @@ adventurePlatformBukkit = { group = "net.kyori", name = "adventure-platform-bukk
|
||||
# Plugins
|
||||
worldeditCore = { group = "com.sk89q.worldedit", name = "worldedit-core", version.ref = "worldedit" }
|
||||
worldeditBukkit = { group = "com.sk89q.worldedit", name = "worldedit-bukkit", version.ref = "worldedit" }
|
||||
fastasyncworldeditBukkit = { group = "com.fastasyncworldedit", name = "FAWE-Bukkit", version.ref = "fawe" }
|
||||
fastasyncworldeditCore = { group = "com.fastasyncworldedit", name = "FAWE-Core", version.ref = "fawe" }
|
||||
fastasyncworldeditBukkit = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Bukkit", version.ref = "fawe" }
|
||||
fastasyncworldeditCore = { group = "com.fastasyncworldedit", name = "FastAsyncWorldEdit-Core", version.ref = "fawe" }
|
||||
vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" }
|
||||
placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" }
|
||||
luckperms = { group = "net.luckperms", name = "api", version.ref = "luckperms" }
|
||||
essentialsx = { group = "net.ess3", name = "EssentialsX", version.ref = "essentialsx" }
|
||||
essentialsx = { group = "net.essentialsx", name = "EssentialsX", version.ref = "essentialsx" }
|
||||
hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" }
|
||||
|
||||
# Third party
|
||||
prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" }
|
||||
prtree = { group = "com.intellectualsites.prtree", name = "PRTree", version.ref = "prtree" }
|
||||
aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" }
|
||||
pipeline = { group = "com.intellectualsites", name = "Pipeline", version.ref = "pipeline" }
|
||||
rorledning = { group = "com.intellectualsites", name = "Pipeline", version.ref = "rorledning" }
|
||||
mvdwapi = { group = "be.maximvdw", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" }
|
||||
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
|
||||
serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" }
|
||||
@ -87,8 +87,10 @@ paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
|
||||
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
|
||||
http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
|
||||
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||
|
||||
[plugins]
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
|
||||
licenser = { id = "org.cadixdev.licenser", version.ref = "licenser" }
|
||||
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -5,7 +5,16 @@
|
||||
],
|
||||
"ignoreDeps": [
|
||||
"guava",
|
||||
"com.google.guava:guava",
|
||||
"com.google.code.gson:gson",
|
||||
"gson",
|
||||
"snakeyaml"
|
||||
]
|
||||
],
|
||||
"timezone": "Europe/Berlin",
|
||||
"schedule": [
|
||||
"on monday after 9am"
|
||||
],
|
||||
"labels": ["Renovate"],
|
||||
"commitMessagePrefix": "build: ",
|
||||
"rebaseWhen": "conflicted"
|
||||
}
|
||||
|
Reference in New Issue
Block a user