Skip to content

Commit

Permalink
Fix whitespace [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and Melledy committed Jul 21, 2022
1 parent 510d564 commit ae2d1fe
Show file tree
Hide file tree
Showing 166 changed files with 13,900 additions and 13,900 deletions.
50 changes: 25 additions & 25 deletions src/main/java/emu/grasscutter/GameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
import emu.grasscutter.utils.Utils;

public final class GameConstants {
public static String VERSION = "2.8.0";

public static final int MAX_TEAMS = 4;
public static final int MAIN_CHARACTER_MALE = 10000005;
public static final int MAIN_CHARACTER_FEMALE = 10000007;
public static final Position START_POSITION = new Position(2747, 194, -1719);

public static final int MAX_FRIENDS = 45;
public static final int MAX_FRIEND_REQUESTS = 50;

public static final int SERVER_CONSOLE_UID = 99; // The UID of the server console's "player".

public static final int BATTLE_PASS_MAX_LEVEL = 50;
public static final int BATTLE_PASS_POINT_PER_LEVEL = 1000;
public static final int BATTLE_PASS_POINT_PER_WEEK = 10000;
public static final int BATTLE_PASS_LEVEL_PRICE = 150;
public static final int BATTLE_PASS_CURRENT_INDEX = 2;

// Default entity ability hashes.
public static final String[] DEFAULT_ABILITY_STRINGS = {
"Avatar_DefaultAbility_VisionReplaceDieInvincible", "Avatar_DefaultAbility_AvartarInShaderChange", "Avatar_SprintBS_Invincible",
"Avatar_Freeze_Duration_Reducer", "Avatar_Attack_ReviveEnergy", "Avatar_Component_Initializer", "Avatar_FallAnthem_Achievement_Listener"
};
public static final int[] DEFAULT_ABILITY_HASHES = Arrays.stream(DEFAULT_ABILITY_STRINGS).mapToInt(Utils::abilityHash).toArray();
public static final int DEFAULT_ABILITY_NAME = Utils.abilityHash("Default");
public static String VERSION = "2.8.0";

public static final int MAX_TEAMS = 4;
public static final int MAIN_CHARACTER_MALE = 10000005;
public static final int MAIN_CHARACTER_FEMALE = 10000007;
public static final Position START_POSITION = new Position(2747, 194, -1719);

public static final int MAX_FRIENDS = 45;
public static final int MAX_FRIEND_REQUESTS = 50;

public static final int SERVER_CONSOLE_UID = 99; // The UID of the server console's "player".

public static final int BATTLE_PASS_MAX_LEVEL = 50;
public static final int BATTLE_PASS_POINT_PER_LEVEL = 1000;
public static final int BATTLE_PASS_POINT_PER_WEEK = 10000;
public static final int BATTLE_PASS_LEVEL_PRICE = 150;
public static final int BATTLE_PASS_CURRENT_INDEX = 2;

// Default entity ability hashes.
public static final String[] DEFAULT_ABILITY_STRINGS = {
"Avatar_DefaultAbility_VisionReplaceDieInvincible", "Avatar_DefaultAbility_AvartarInShaderChange", "Avatar_SprintBS_Invincible",
"Avatar_Freeze_Duration_Reducer", "Avatar_Attack_ReviveEnergy", "Avatar_Component_Initializer", "Avatar_FallAnthem_Achievement_Listener"
};
public static final int[] DEFAULT_ABILITY_HASHES = Arrays.stream(DEFAULT_ABILITY_STRINGS).mapToInt(Utils::abilityHash).toArray();
public static final int DEFAULT_ABILITY_NAME = Utils.abilityHash("Default");
}
2 changes: 1 addition & 1 deletion src/main/java/emu/grasscutter/Grasscutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static void main(String[] args) throws Exception {
*/
private static void onShutdown() {
// Disable all plugins.
if(pluginManager != null)
if (pluginManager != null)
pluginManager.disablePlugins();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emu/grasscutter/command/CommandMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private boolean setPlayerTarget(String playerId, Player player, String targetUid
CommandHandler.sendTranslatedMessage(player, "commands.execution.clear_target");
return true;
}

// Sets default targetPlayer to the UID provided.
try {
int uid = Integer.parseInt(targetUid);
Expand Down Expand Up @@ -237,7 +237,7 @@ public void invoke(Player player, Player targetPlayer, String rawMessage) {
Command annotation = this.annotations.get(label);

// Resolve targetPlayer
try{
try {
targetPlayer = getTargetPlayer(playerId, player, targetPlayer, args);
} catch (IllegalArgumentException e) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
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]");

Expand All @@ -53,7 +53,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
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]");
}
Expand All @@ -76,7 +76,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
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("*");
Expand All @@ -93,7 +93,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
CommandHandler.sendMessage(null, translate(sender, "commands.account.no_account"));
return;
}

// Get the player for the account.
// If that player is currently online, we kick them before proceeding with the deletion.
Player player = Grasscutter.getGameServer().getPlayerByAccountId(toDelete.getId());
Expand All @@ -106,12 +106,12 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
return;
}

switch (args.get(0)){
switch (args.get(0)) {
case "tpl":
if (args.size() < 2) {
CommandHandler.sendTranslatedMessage(sender, "commands.announce.command_usage");
Expand All @@ -37,7 +37,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {

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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
CommandHandler.sendMessage(sender, translate(sender, "commands.coop.usage"));
return;
}

// There's no target==host check but this just places them in multiplayer in their own world which seems fine.
if (targetPlayer.isInMultiplayer()) {
targetPlayer.getServer().getMultiplayerSystem().leaveCoop(targetPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
try {
int dungeonId = Integer.parseInt(args.get(0));
if (dungeonId == targetPlayer.getSceneId()) {
CommandHandler.sendMessage(sender, translate(sender, "commands.enter_dungeon.in_dungeon_error"));
return;
CommandHandler.sendMessage(sender, translate(sender, "commands.enter_dungeon.in_dungeon_error"));
return;
}

boolean result = targetPlayer.getServer().getDungeonSystem().enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId);

if (!result) {
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/emu/grasscutter/command/commands/GiveCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private static Avatar makeAvatar(AvatarData avatarData, int level, int promoteLe
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));
}

Expand Down Expand Up @@ -352,11 +352,11 @@ private static List<Integer> getArtifactAffixes(ItemData itemData, FightProperty
return affixes;
}

private static int getAppendPropId(String substatText, ItemData itemData) throws IllegalArgumentException {
// If the given substat text is an integer, we just use that as the append prop ID.
try {
return Integer.parseInt(substatText);
} catch (NumberFormatException ignored) {
private static int getAppendPropId(String substatText, ItemData itemData) throws IllegalArgumentException {
// If the given substat text is an integer, we just use that as the append prop ID.
try {
return Integer.parseInt(substatText);
} catch (NumberFormatException ignored) {
// If the argument was not an integer, we try to determine
// the append prop ID from the given text + artifact information.
// A substat string has the format `substat_tier`, with the
Expand All @@ -378,8 +378,8 @@ private static int getAppendPropId(String substatText, ItemData itemData) throws
substatTier -= 1; // 1-indexed to 0-indexed
substatTier = Math.min(Math.max(0, substatTier), substats.size() - 1);
return substats.get(substatTier);
}
}
}
}

private static void parseRelicArgs(GiveItemParameters param, List<String> args) throws IllegalArgumentException {
// Get the main stat from the arguments.
Expand Down Expand Up @@ -476,11 +476,11 @@ private static void giveAll(Player player, GiveItemParameters param) {
10000-10008, 11411, 11506-11508, 12505, 12506, 12508, 12509,
13503, 13506, 14411, 14503, 14505, 14508, 15504-15506
""");

private static final SparseSet illegalRelicIds = new SparseSet("""
20001, 23300-23340, 23383-23385, 78310-78554, 99310-99554
""");

private static final SparseSet illegalItemIds = new SparseSet("""
100086, 100087, 100100-101000, 101106-101110, 101306, 101500-104000,
105001, 105004, 106000-107000, 107011, 108000, 109000-110000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ private void createCommand(StringBuilder builder, Player player, Command annotat
}
}
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public final class ReloadCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
CommandHandler.sendMessage(sender, translate(sender, "commands.reload.reload_start"));

Grasscutter.loadConfig();
Grasscutter.loadLanguage();
Grasscutter.getGameServer().getGachaSystem().load();
Grasscutter.getGameServer().getDropSystem().load();
Grasscutter.getGameServer().getShopSystem().load();

CommandHandler.sendMessage(sender, translate(sender, "commands.reload.reload_done"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -162,7 +162,7 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
}

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");
Expand Down
Loading

0 comments on commit ae2d1fe

Please sign in to comment.