Build with Java 16 for the time being

This commit is contained in:
William committed 2022-08-24 15:22:57 +01:00
1 parent 1c7d45bb81
commit bb66246fb6
7 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ allprojects {
compileJava.options.encoding = 'UTF-8' compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8' javadoc.options.encoding = 'UTF-8'
compileJava.options.release.set 17 compileJava.options.release.set 16
repositories { repositories {
mavenLocal() mavenLocal()
@@ -146,9 +146,11 @@ public class Cache {
} }
@NotNull @NotNull
public MineDown getCommandList(@NotNull Locales locales, @NotNull List<CommandBase> commands, public MineDown getCommandList(@NotNull OnlineUser onlineUser, @NotNull Locales locales,
final int itemsPerPage, final int page) { @NotNull List<CommandBase> commands, final int itemsPerPage, final int page) {
return PaginatedList.of(commands.stream().map(command -> locales.getRawLocale("command_list_item", return PaginatedList.of(commands.stream()
.filter(command -> onlineUser.hasPermission(command.permission))
.map(command -> locales.getRawLocale("command_list_item",
Locales.escapeMineDown(command.command), Locales.escapeMineDown(command.command),
Locales.escapeMineDown(command.getDescription().length() > 50 Locales.escapeMineDown(command.getDescription().length() > 50
? command.getDescription().substring(0, 49).trim() + "…" ? command.getDescription().substring(0, 49).trim() + "…"
@@ -26,7 +26,7 @@ public abstract class CommandBase {
* The permission node required to use this command * The permission node required to use this command
*/ */
@NotNull @NotNull
protected final String permission; public final String permission;
/** /**
* Instance of the implementing plugin * Instance of the implementing plugin
@@ -66,8 +66,8 @@ public class HuskHomesCommand extends CommandBase implements ConsoleExecutable,
return; return;
} }
} }
onlineUser.sendMessage(plugin.getCache().getCommandList(plugin.getLocales(), plugin.getCommands(), onlineUser.sendMessage(plugin.getCache().getCommandList(onlineUser,
plugin.getSettings().listItemsPerPage, page)); plugin.getLocales(), plugin.getCommands(), plugin.getSettings().listItemsPerPage, page));
} }
case "reload" -> { case "reload" -> {
@@ -122,9 +122,7 @@ public class Locales {
} }
/** /**
* Formats a description string, applying space-delimited line breaks after 35 characters. * Formats a description string, wrapping text on whitespace after 40 characters
* <p>
* If there is no space after 35 characters, the string will be split regardless at 45 characters.
* *
* @param string The string to format * @param string The string to format
* @return The line-break formatted string, or a String literal {@code "N/A"} if the input string is empty * @return The line-break formatted string, or a String literal {@code "N/A"} if the input string is empty
@@ -134,7 +132,7 @@ public class Locales {
if (string.isBlank()) { if (string.isBlank()) {
return this.getRawLocale("item_no_description").orElse("N/A"); return this.getRawLocale("item_no_description").orElse("N/A");
} }
return WordUtils.wrap(string, 35); return WordUtils.wrap(string, 40, "\n", true);
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@@ -59,7 +59,7 @@ public class NormalDistributionEngine extends RtpEngine {
*/ */
private static float generateNormallyDistributedRadius(float mean, float standardDeviation, private static float generateNormallyDistributedRadius(float mean, float standardDeviation,
float spawnRadius, float maxRadius) { float spawnRadius, float maxRadius) {
double value = new Random().nextGaussian(mean, standardDeviation) * maxRadius; double value = (new Random().nextGaussian() * mean + standardDeviation) * maxRadius;
if (value < spawnRadius || value > maxRadius) { if (value < spawnRadius || value > maxRadius) {
return generateNormallyDistributedRadius(mean, standardDeviation, spawnRadius, maxRadius); return generateNormallyDistributedRadius(mean, standardDeviation, spawnRadius, maxRadius);
} }
+1 -1
View File
@@ -1,7 +1,7 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
javaVersion=17 javaVersion=16
plugin_version=3.0 plugin_version=3.0
plugin_archive=huskhomes plugin_archive=huskhomes