mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2026-01-01 21:26:39 +00:00
Make case conversion operations use the English locale
This commit is contained in:
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -31,7 +32,7 @@ public class EnderChestCommand extends CommandBase implements TabCompletable {
|
||||
.ifPresent(player::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getDatabase().getUserByName(args[0].toLowerCase()).thenAccept(optionalUser ->
|
||||
plugin.getDatabase().getUserByName(args[0].toLowerCase(Locale.ENGLISH)).thenAccept(optionalUser ->
|
||||
optionalUser.ifPresentOrElse(user -> {
|
||||
if (args.length == 2) {
|
||||
// View user data by specified UUID
|
||||
|
||||
@@ -7,10 +7,7 @@ import net.william278.husksync.migrator.Migrator;
|
||||
import net.william278.husksync.player.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -53,7 +50,7 @@ public class HuskSyncCommand extends CommandBase implements TabCompletable, Cons
|
||||
sendAboutMenu(player);
|
||||
return;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
switch (args[0].toLowerCase(Locale.ENGLISH)) {
|
||||
case "update", "version" -> {
|
||||
if (!player.hasPermission(Permission.COMMAND_HUSKSYNC_UPDATE.node)) {
|
||||
plugin.getLocales().getLocale("error_no_permission").ifPresent(player::sendMessage);
|
||||
@@ -91,7 +88,7 @@ public class HuskSyncCommand extends CommandBase implements TabCompletable, Cons
|
||||
plugin.log(Level.INFO, "Console usage: \"husksync <update/about/reload/migrate>\"");
|
||||
return;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
switch (args[0].toLowerCase(Locale.ENGLISH)) {
|
||||
case "update", "version" -> plugin.getLatestVersionIfOutdated().thenAccept(newestVersion ->
|
||||
newestVersion.ifPresentOrElse(newVersion -> plugin.log(Level.WARNING,
|
||||
"An update is available for HuskSync, v" + newVersion
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -31,7 +32,7 @@ public class InventoryCommand extends CommandBase implements TabCompletable {
|
||||
.ifPresent(player::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getDatabase().getUserByName(args[0].toLowerCase()).thenAccept(optionalUser ->
|
||||
plugin.getDatabase().getUserByName(args[0].toLowerCase(Locale.ENGLISH)).thenAccept(optionalUser ->
|
||||
optionalUser.ifPresentOrElse(user -> {
|
||||
if (args.length == 2) {
|
||||
// View user data by specified UUID
|
||||
|
||||
@@ -3,16 +3,13 @@ package net.william278.husksync.command;
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.data.DataSaveCause;
|
||||
import net.william278.husksync.data.UserData;
|
||||
import net.william278.husksync.util.DataSnapshotList;
|
||||
import net.william278.husksync.player.OnlineUser;
|
||||
import net.william278.husksync.util.DataDumper;
|
||||
import net.william278.husksync.util.DataSnapshotList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -34,7 +31,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (args[0].toLowerCase()) {
|
||||
switch (args[0].toLowerCase(Locale.ENGLISH)) {
|
||||
case "view" -> {
|
||||
if (args.length < 2) {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax",
|
||||
@@ -47,7 +44,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
try {
|
||||
final UUID versionUuid = UUID.fromString(args[2]);
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser
|
||||
.ifPresentOrElse(user -> plugin.getDatabase().getUserData(user, versionUuid)
|
||||
.thenAccept(data -> data.ifPresentOrElse(
|
||||
@@ -63,7 +60,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
}
|
||||
} else {
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser
|
||||
.ifPresentOrElse(user -> plugin.getDatabase().getCurrentUserData(user)
|
||||
.thenAccept(latestData -> latestData.ifPresentOrElse(
|
||||
@@ -87,7 +84,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
}
|
||||
final String username = args[1];
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser.ifPresentOrElse(
|
||||
user -> plugin.getDatabase().getUserData(user).thenAccept(dataList -> {
|
||||
// Check if there is data to display
|
||||
@@ -133,7 +130,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
try {
|
||||
final UUID versionUuid = UUID.fromString(args[2]);
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser.ifPresentOrElse(
|
||||
user -> plugin.getDatabase().deleteUserData(user, versionUuid).thenAccept(deleted -> {
|
||||
if (deleted) {
|
||||
@@ -172,7 +169,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
try {
|
||||
final UUID versionUuid = UUID.fromString(args[2]);
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser.ifPresentOrElse(
|
||||
user -> plugin.getDatabase().getUserData(user, versionUuid).thenAccept(data -> {
|
||||
if (data.isEmpty()) {
|
||||
@@ -219,7 +216,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
try {
|
||||
final UUID versionUuid = UUID.fromString(args[2]);
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser.ifPresentOrElse(
|
||||
user -> plugin.getDatabase().getUserData(user, versionUuid).thenAccept(
|
||||
optionalUserData -> optionalUserData.ifPresentOrElse(userData -> {
|
||||
@@ -267,7 +264,7 @@ public class UserDataCommand extends CommandBase implements TabCompletable {
|
||||
try {
|
||||
final UUID versionUuid = UUID.fromString(args[2]);
|
||||
CompletableFuture.runAsync(() -> plugin.getDatabase()
|
||||
.getUserByName(username.toLowerCase())
|
||||
.getUserByName(username.toLowerCase(Locale.ENGLISH))
|
||||
.thenAccept(optionalUser -> optionalUser.ifPresentOrElse(
|
||||
user -> plugin.getDatabase().getUserData(user, versionUuid).thenAccept(
|
||||
optionalUserData -> optionalUserData.ifPresentOrElse(userData -> {
|
||||
|
||||
Reference in New Issue
Block a user