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

@@ -146,9 +146,11 @@ public class Cache {
}
@NotNull
public MineDown getCommandList(@NotNull Locales locales, @NotNull List<CommandBase> commands,
final int itemsPerPage, final int page) {
return PaginatedList.of(commands.stream().map(command -> locales.getRawLocale("command_list_item",
public MineDown getCommandList(@NotNull OnlineUser onlineUser, @NotNull Locales locales,
@NotNull List<CommandBase> commands, final int itemsPerPage, final int page) {
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.getDescription().length() > 50
? command.getDescription().substring(0, 49).trim() + "…"
@@ -26,7 +26,7 @@ public abstract class CommandBase {
* The permission node required to use this command
*/
@NotNull
protected final String permission;
public final String permission;
/**
* Instance of the implementing plugin
@@ -66,8 +66,8 @@ public class HuskHomesCommand extends CommandBase implements ConsoleExecutable,
return;
}
}
onlineUser.sendMessage(plugin.getCache().getCommandList(plugin.getLocales(), plugin.getCommands(),
plugin.getSettings().listItemsPerPage, page));
onlineUser.sendMessage(plugin.getCache().getCommandList(onlineUser,
plugin.getLocales(), plugin.getCommands(), plugin.getSettings().listItemsPerPage, page));
}
case "reload" -> {
@@ -122,9 +122,7 @@ public class Locales {
}
/**
* Formats a description string, applying space-delimited line breaks after 35 characters.
* <p>
* If there is no space after 35 characters, the string will be split regardless at 45 characters.
* Formats a description string, wrapping text on whitespace after 40 characters
*
* @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
@@ -134,7 +132,7 @@ public class Locales {
if (string.isBlank()) {
return this.getRawLocale("item_no_description").orElse("N/A");
}
return WordUtils.wrap(string, 35);
return WordUtils.wrap(string, 40, "\n", true);
}
@SuppressWarnings("unused")
@@ -59,7 +59,7 @@ public class NormalDistributionEngine extends RtpEngine {
*/
private static float generateNormallyDistributedRadius(float mean, float standardDeviation,
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) {
return generateNormallyDistributedRadius(mean, standardDeviation, spawnRadius, maxRadius);
}