Compare commits

..

8 Commits

Author SHA1 Message Date
c07ac43528 fix: Add user friendly message for creationdate placeholder 2022-07-27 16:06:14 +02:00
9609990832 build: Update dependency com.intellectualsites.bom:bom-1.18.x to v1.12 (#3739)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-26 22:47:51 +02:00
0e4319b757 build: Update dependency org.junit.jupiter:junit-jupiter to v5.9.0 (#3741)
* build: Update dependency org.junit.jupiter:junit-jupiter to v5.9.0

* Update renovate.json

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-26 22:47:25 +02:00
c8f4907f77 build: Back to snapshot for development 2022-07-25 21:11:35 +02:00
dcf98c2298 build: Release 6.9.3 2022-07-25 21:10:39 +02:00
ae59c7442f fix: improve handling of missing message files (#3718)
* improve handling of missing message files

* fix javadoc

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-25 21:02:54 +02:00
98708118d8 Deprecate the static Permissions "util" class that is almost entirely superseded by methods in PermissionHolder instances themselves (#3695)
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-24 15:55:43 +02:00
276d8f8e1e change message of /p remove <player> if player does not need to be removed (#3734)
refactor: change message of `/p remove <player>` if unnecessary
2022-07-24 10:32:29 +02:00
7 changed files with 41 additions and 12 deletions

View File

@ -115,8 +115,8 @@ public class Remove extends SubCommand {
} }
if (count == 0) { if (count == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.of("member.player_not_removed"),
Template.of("value", args[0]) Template.of("player", args[0])
); );
} else { } else {
player.sendMessage( player.sendMessage(

View File

@ -174,7 +174,7 @@ public final class CaptionLoader {
public @NonNull CaptionMap loadAll(final @NonNull Path directory) throws IOException { public @NonNull CaptionMap loadAll(final @NonNull Path directory) throws IOException {
final Map<Locale, CaptionMap> localeMaps = new HashMap<>(); final Map<Locale, CaptionMap> localeMaps = new HashMap<>();
try (final Stream<Path> files = Files.list(directory)) { try (final Stream<Path> files = Files.list(directory)) {
final List<Path> captionFiles = files.filter(Files::isRegularFile).collect(Collectors.toList()); final List<Path> captionFiles = files.filter(Files::isRegularFile).toList();
for (Path file : captionFiles) { for (Path file : captionFiles) {
try { try {
final CaptionMap localeMap = loadSingle(file); final CaptionMap localeMap = loadSingle(file);
@ -221,7 +221,7 @@ public final class CaptionLoader {
* @throws IOException if the file couldn't be accessed or read successfully. * @throws IOException if the file couldn't be accessed or read successfully.
* @throws IllegalArgumentException if the file name doesn't match the specified format. * @throws IllegalArgumentException if the file name doesn't match the specified format.
* @see #loadSingle(Path) * @see #loadSingle(Path)
* @since TODO * @since 6.9.3
*/ */
public @NonNull CaptionMap loadOrCreateSingle(final @NonNull Path file) throws IOException { public @NonNull CaptionMap loadOrCreateSingle(final @NonNull Path file) throws IOException {
final Locale locale = this.localeExtractor.apply(file); final Locale locale = this.localeExtractor.apply(file);

View File

@ -30,9 +30,18 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* The Permissions class handles checking user permissions.<br> * The Permissions class handles checking user permissions.<br>
* - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br> * - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
* - Checking the PlotPlayer class directly will not take the above into account<br> * - Checking the PlotPlayer class directly will not take the above into account<br>
*
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public class Permissions { public class Permissions {
/**
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/
@Deprecated(forRemoval = true, since = "6.9.3")
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) { public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
return hasPermission(player, permission.toString(), notify); return hasPermission(player, permission.toString(), notify);
} }
@ -43,18 +52,25 @@ public class Permissions {
* @param caller permission holder * @param caller permission holder
* @param permission Permission * @param permission Permission
* @return {@code true} if the owner has the given permission, else {@code false} * @return {@code true} if the owner has the given permission, else {@code false}
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) { public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
return caller.hasPermission(permission.toString()); return caller.hasPermission(permission.toString());
} }
/** /**
* Check if the owner of the profile has a given (global) permission * Check if the owner of the profile has a given (global) permission. There is no guarantee that per-world permissions will
* be checked because unmaintained crap plugins like PEX exist.
* *
* @param caller permission holder * @param caller permission holder
* @param permission Permission * @param permission Permission
* @return {@code true} if the owner has the given permission, else {@code false} * @return {@code true} if the owner has the given permission, else {@code false}
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) { public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
return caller.hasPermission(permission); return caller.hasPermission(permission);
} }
@ -68,7 +84,10 @@ public class Permissions {
* @param key Permission "key" * @param key Permission "key"
* @return {@code true} if the owner has the given permission, else {@code false} * @return {@code true} if the owner has the given permission, else {@code false}
* @since 6.0.10 * @since 6.0.10
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public static boolean hasKeyedPermission( public static boolean hasKeyedPermission(
final @NonNull PermissionHolder caller, final @NonNull String permission, final @NonNull PermissionHolder caller, final @NonNull String permission,
final @NonNull String key final @NonNull String key
@ -83,7 +102,10 @@ public class Permissions {
* @param permission permission * @param permission permission
* @param notify if to notify the permission holder * @param notify if to notify the permission holder
* @return if permission is had * @return if permission is had
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) { public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
if (!hasPermission(player, permission)) { if (!hasPermission(player, permission)) {
if (notify) { if (notify) {
@ -97,6 +119,11 @@ public class Permissions {
return true; return true;
} }
/**
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/
@Deprecated(forRemoval = true, since = "6.9.3")
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) { public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
return hasPermissionRange(player, Permission.toString(), range); return hasPermissionRange(player, Permission.toString(), range);
} }
@ -110,7 +137,10 @@ public class Permissions {
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot` * @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
* @param range The range to check * @param range The range to check
* @return The highest permission they have within that range * @return The highest permission they have within that range
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
* classes
*/ */
@Deprecated(forRemoval = true, since = "6.9.3")
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) { public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
return player.hasPermissionRange(stub, range); return player.hasPermissionRange(stub, range);
} }

View File

@ -164,7 +164,7 @@ public final class PlaceholderRegistry {
PlayerManager.getPlayerList(plot.getDenied(), player)); PlayerManager.getPlayerList(plot.getDenied(), player));
}); });
this.createPlaceholder("currentplot_creationdate", (player, plot) -> { this.createPlaceholder("currentplot_creationdate", (player, plot) -> {
if (plot.getTimestamp() == 0) { if (plot.getTimestamp() == 0 || !plot.hasOwner()) {
return legacyComponent(TranslatableCaption.of("info.unknown"), player); return legacyComponent(TranslatableCaption.of("info.unknown"), player);
} }
long creationDate = plot.getTimestamp(); long creationDate = plot.getTimestamp();

View File

@ -414,6 +414,7 @@
"kick.you_got_kicked": "<prefix><dark_aqua>You got kicked from the plot!</dark_aqua>", "kick.you_got_kicked": "<prefix><dark_aqua>You got kicked from the plot!</dark_aqua>",
"trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>", "trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>",
"trusted.plot_removed_user": "<prefix><red>Plot <plot> of which you were added to has been deleted due to owner inactivity.</red>", "trusted.plot_removed_user": "<prefix><red>Plot <plot> of which you were added to has been deleted due to owner inactivity.</red>",
"member.player_not_removed": "<prefix><gray><player></gray><red> is neither added, trusted or denied on the plot, thus doesn't need to be removed.</red>",
"member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>", "member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>",
"member.plot_left": "<prefix><gray><player> left the plot.</gray>", "member.plot_left": "<prefix><gray><player> left the plot.</gray>",
"member.plot_cant_leave_owner": "<prefix><red>You are the plot owner. You cannot leave this plot.</red>", "member.plot_cant_leave_owner": "<prefix><red>You are the plot owner. You cannot leave this plot.</red>",

View File

@ -19,7 +19,7 @@ plugins {
} }
group = "com.plotsquared" group = "com.plotsquared"
version = "6.9.3-SNAPSHOT" version = "6.9.4-SNAPSHOT"
subprojects { subprojects {
group = rootProject.group group = rootProject.group
@ -65,12 +65,12 @@ subprojects {
} }
dependencies { dependencies {
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.11")) implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.12"))
} }
dependencies { dependencies {
// Tests // Tests
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")
} }
plugins.withId("java") { plugins.withId("java") {

View File

@ -1,9 +1,7 @@
{ {
"extends": [ "extends": [
"config:base", "config:base"
":disableDependencyDashboard"
], ],
"labels": ["Renovate"], "labels": ["Renovate"],
"commitMessagePrefix": "build: ",
"rebaseWhen": "conflicted" "rebaseWhen": "conflicted"
} }