Commit ae2d1fe4 authored by github-actions's avatar github-actions Committed by Melledy
Browse files

Fix whitespace [skip actions]

parent 510d564b
......@@ -217,7 +217,7 @@ public final class Grasscutter {
*/
private static void onShutdown() {
// Disable all plugins.
if(pluginManager != null)
if (pluginManager != null)
pluginManager.disablePlugins();
}
......
......@@ -21,7 +21,7 @@ public final class DefaultAuthentication implements AuthenticationSystem {
private OAuthAuthenticator oAuthAuthenticator = new OAuthAuthentication();
public DefaultAuthentication() {
if(ACCOUNT.EXPERIMENTAL_RealPassword) {
if (ACCOUNT.EXPERIMENTAL_RealPassword) {
passwordAuthenticator = new ExperimentalPasswordAuthenticator();
} else {
passwordAuthenticator = new PasswordAuthenticator();
......
......@@ -237,7 +237,7 @@ public final class CommandMap {
Command annotation = this.annotations.get(label);
// Resolve targetPlayer
try{
try {
targetPlayer = getTargetPlayer(playerId, player, targetPlayer, args);
} catch (IllegalArgumentException e) {
return;
......
......@@ -39,8 +39,8 @@ public final class AccountCommand implements CommandHandler {
int uid = 0;
String password = "";
if(Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
if(args.size() < 3) {
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
if (args.size() < 3) {
CommandHandler.sendMessage(null, "EXPERIMENTAL_RealPassword requires a password argument");
CommandHandler.sendMessage(null, "Usage: account create <username> <password> [uid]");
......@@ -53,7 +53,7 @@ public final class AccountCommand implements CommandHandler {
uid = Integer.parseInt(args.get(3));
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(null, translate(sender, "commands.account.invalid"));
if(Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
CommandHandler.sendMessage(null, "EXPERIMENTAL_RealPassword requires argument 2 to be a password, not a uid");
CommandHandler.sendMessage(null, "Usage: account create <username> <password> [uid]");
}
......@@ -76,7 +76,7 @@ public final class AccountCommand implements CommandHandler {
CommandHandler.sendMessage(null, translate(sender, "commands.account.exists"));
return;
} else {
if(Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword == true) {
account.setPassword(BCrypt.withDefaults().hashToString(12, password.toCharArray()));
}
account.addPermission("*");
......@@ -106,12 +106,12 @@ public final class AccountCommand implements CommandHandler {
CommandHandler.sendMessage(null, translate(sender, "commands.account.delete"));
return;
case "resetpass":
if(Configuration.ACCOUNT.EXPERIMENTAL_RealPassword != true) {
if (Configuration.ACCOUNT.EXPERIMENTAL_RealPassword != true) {
CommandHandler.sendMessage(null, "resetpass requires EXPERIMENTAL_RealPassword to be true.");
return;
}
if(args.size() != 3) {
if (args.size() != 3) {
CommandHandler.sendMessage(null, "Invalid Args");
CommandHandler.sendMessage(null, "Usage: account resetpass <username> <password>");
return;
......
......@@ -28,7 +28,7 @@ public final class AnnounceCommand implements CommandHandler {
return;
}
switch (args.get(0)){
switch (args.get(0)) {
case "tpl":
if (args.size() < 2) {
CommandHandler.sendTranslatedMessage(sender, "commands.announce.command_usage");
......@@ -37,7 +37,7 @@ public final class AnnounceCommand implements CommandHandler {
var templateId = Integer.parseInt(args.get(1));
var tpl = manager.getAnnounceConfigItemMap().get(templateId);
if(tpl == null){
if (tpl == null) {
CommandHandler.sendMessage(sender, translate(sender, "commands.announce.not_found", templateId));
return;
}
......
......@@ -257,7 +257,7 @@ public final class GiveCommand implements CommandHandler {
if (avatar.getAvatarId() == GameConstants.MAIN_CHARACTER_MALE) {
avatar.setSkillDepotData(GameData.getAvatarSkillDepotDataMap().get(504));
}
else if(avatar.getAvatarId() == GameConstants.MAIN_CHARACTER_FEMALE) {
else if (avatar.getAvatarId() == GameConstants.MAIN_CHARACTER_FEMALE) {
avatar.setSkillDepotData(GameData.getAvatarSkillDepotDataMap().get(704));
}
......
......@@ -22,13 +22,13 @@ public final class HelpCommand implements CommandHandler {
}
}
builder.append("\n\t").append(translate(player, "commands.help.tip_need_permission"));
if(annotation.permission().isEmpty() || annotation.permission().isBlank()) {
if (annotation.permission().isEmpty() || annotation.permission().isBlank()) {
builder.append(translate(player, "commands.help.tip_need_no_permission"));
} else {
builder.append(annotation.permission());
}
if(!annotation.permissionTargeted().isEmpty() && !annotation.permissionTargeted().isBlank()) {
if (!annotation.permissionTargeted().isEmpty() && !annotation.permissionTargeted().isBlank()) {
String permissionTargeted = annotation.permissionTargeted();
builder.append(" ").append(translate(player, "commands.help.tip_permission_targeted", permissionTargeted));
}
......
......@@ -27,7 +27,7 @@ public final class SendMailCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
int senderId;
if(sender != null) {
if (sender != null) {
senderId = sender.getUid();
} else {
senderId = -1;
......@@ -162,7 +162,7 @@ public final class SendMailCommand implements CommandHandler {
}
private String getConstructionArgs(int stage, Player sender) {
return switch(stage) {
return switch (stage) {
case 0 -> translate(sender, "commands.sendMail.title");
case 1 -> translate(sender, "commands.sendMail.message");
case 2 -> translate(sender, "commands.sendMail.sender");
......
......@@ -107,7 +107,7 @@ public final class SetPropCommand implements CommandHandler {
return;
}
try {
value = switch(valueStr.toLowerCase()) {
value = switch (valueStr.toLowerCase()) {
case "on", "true" -> 1;
case "off", "false" -> 0;
case "toggle" -> -1;
......
......@@ -86,7 +86,7 @@ public final class SpawnCommand implements CommandHandler {
double maxRadius = Math.sqrt(amount * 0.2 / Math.PI);
for (int i = 0; i < amount; i++) {
Position pos = GetRandomPositionInCircle(targetPlayer.getPosition(), maxRadius).addY(3);
if(x != 0 && y != 0 && z != 0) {
if (x != 0 && y != 0 && z != 0) {
pos = GetRandomPositionInCircle(new Position(x, y, z), maxRadius).addY(3);
}
GameEntity entity = null;
......@@ -120,7 +120,7 @@ public final class SpawnCommand implements CommandHandler {
CommandHandler.sendMessage(sender, translate(sender, "commands.spawn.success", Integer.toString(amount), Integer.toString(id)));
}
private Position GetRandomPositionInCircle(Position origin, double radius){
private Position GetRandomPositionInCircle(Position origin, double radius) {
Position target = origin.clone();
double angle = Math.random() * 360;
double r = Math.sqrt(Math.random() * radius * radius);
......
......@@ -142,7 +142,7 @@ public final class TeamCommand implements CommandHandler {
try {
index = Integer.parseInt(args.get(1)) - 1;
if (index < 0) index = 0;
} catch(Exception e) {
} catch (Exception e) {
CommandHandler.sendTranslatedMessage(sender, "commands.team.failed_to_parse_index", args.get(1));
return false;
}
......@@ -155,7 +155,7 @@ public final class TeamCommand implements CommandHandler {
int avatarId;
try {
avatarId = Integer.parseInt(args.get(2));
} catch(Exception e) {
} catch (Exception e) {
CommandHandler.sendTranslatedMessage(sender, "commands.team.failed_parse_avatar_id", args.get(2));
return false;
}
......
......@@ -28,7 +28,7 @@ public class ConfigContainer {
try { // Check if the server is using a legacy config.
JsonObject configObject = Grasscutter.getGsonFactory()
.fromJson(new FileReader(Grasscutter.configFile), JsonObject.class);
if(!configObject.has("version")) {
if (!configObject.has("version")) {
Grasscutter.getLogger().info("Updating legacy ..");
Grasscutter.saveConfig(null);
}
......@@ -37,7 +37,7 @@ public class ConfigContainer {
var existing = config.version;
var latest = version();
if(existing == latest)
if (existing == latest)
return;
// Create a new configuration instance.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment