Commit c2a7d607 authored by Akka's avatar Akka Committed by GitHub
Browse files

Merge pull request #9 from Grasscutters/development

Development
parents 0bfa1fa0 9a7d78e0
...@@ -69,3 +69,6 @@ language/ ...@@ -69,3 +69,6 @@ language/
languages/ languages/
gacha-mapping.js gacha-mapping.js
data/gacha_mappings.js data/gacha_mappings.js
# macOS
.DS_Store
...@@ -150,7 +150,7 @@ public final class CommandMap { ...@@ -150,7 +150,7 @@ public final class CommandMap {
int uid = Integer.parseInt(targetUidStr); int uid = Integer.parseInt(targetUidStr);
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid); targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
if (targetPlayer == null) { if (targetPlayer == null) {
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
} else { } else {
targetPlayerIds.put(playerId, uid); targetPlayerIds.put(playerId, uid);
CommandHandler.sendMessage(player, translate("commands.execution.set_target", targetUidStr)); CommandHandler.sendMessage(player, translate("commands.execution.set_target", targetUidStr));
...@@ -178,7 +178,7 @@ public final class CommandMap { ...@@ -178,7 +178,7 @@ public final class CommandMap {
int uid = Integer.parseInt(arg); int uid = Integer.parseInt(arg);
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid); targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
if (targetPlayer == null) { if (targetPlayer == null) {
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
return; return;
} }
break; break;
...@@ -194,7 +194,7 @@ public final class CommandMap { ...@@ -194,7 +194,7 @@ public final class CommandMap {
if (targetPlayerIds.containsKey(playerId)) { if (targetPlayerIds.containsKey(playerId)) {
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId)); // We check every time in case the target goes offline after being targeted targetPlayer = Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId)); // We check every time in case the target goes offline after being targeted
if (targetPlayer == null) { if (targetPlayer == null) {
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error")); CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
return; return;
} }
} else { } else {
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "changescene", usage = "changescene <scene id>", aliases = {"scene"}, permission = "player.changescene", description = "commands.changescene.description") @Command(label = "changescene", usage = "changescene <scene id>", aliases = {"scene"}, permission = "player.changescene", permissionTargeted = "player.changescene.others", description = "commands.changescene.description")
public final class ChangeSceneCommand implements CommandHandler { public final class ChangeSceneCommand implements CommandHandler {
@Override @Override
...@@ -31,11 +31,12 @@ public final class ChangeSceneCommand implements CommandHandler { ...@@ -31,11 +31,12 @@ public final class ChangeSceneCommand implements CommandHandler {
} }
boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, targetPlayer.getPos()); boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, targetPlayer.getPos());
CommandHandler.sendMessage(sender, translate("commands.changescene.result", Integer.toString(sceneId)));
if (!result) { if (!result) {
CommandHandler.sendMessage(sender, translate("commands.changescene.exists_error")); CommandHandler.sendMessage(sender, translate("commands.changescene.exists_error"));
return;
} }
CommandHandler.sendMessage(sender, translate("commands.changescene.success", Integer.toString(sceneId)));
} catch (Exception e) { } catch (Exception e) {
CommandHandler.sendMessage(sender, translate("commands.execution.argument_error")); CommandHandler.sendMessage(sender, translate("commands.execution.argument_error"));
} }
......
...@@ -14,7 +14,7 @@ import static emu.grasscutter.utils.Language.translate; ...@@ -14,7 +14,7 @@ import static emu.grasscutter.utils.Language.translate;
@Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid] @Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid]
description = "commands.clear.description", description = "commands.clear.description",
aliases = {"clear"}, permission = "player.clearinv") aliases = {"clear"}, permission = "player.clearinv", permissionTargeted = "player.clearinv.others")
public final class ClearCommand implements CommandHandler { public final class ClearCommand implements CommandHandler {
......
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "coop", usage = "coop [host UID]", permission = "server.coop", description = "commands.coop.description") @Command(label = "coop", usage = "coop [host UID]", permission = "server.coop", permissionTargeted = "server.coop.others", description = "commands.coop.description")
public final class CoopCommand implements CommandHandler { public final class CoopCommand implements CommandHandler {
@Override @Override
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "drop", usage = "drop <itemId|itemName> [amount]", aliases = {"d", "dropitem"}, permission = "server.drop", description = "commands.drop.description") @Command(label = "drop", usage = "drop <itemId|itemName> [amount]", aliases = {"d", "dropitem"}, permission = "server.drop", permissionTargeted = "server.drop.others", description = "commands.drop.description")
public final class DropCommand implements CommandHandler { public final class DropCommand implements CommandHandler {
@Override @Override
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", aliases = {"dungeon"}, permission = "player.enterdungeon", description = "commands.enter_dungeon.description") @Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", aliases = {"dungeon"}, permission = "player.enterdungeon", permissionTargeted = "player.enterdungeon.others", description = "commands.enter_dungeon.description")
public final class EnterDungeonCommand implements CommandHandler { public final class EnterDungeonCommand implements CommandHandler {
@Override @Override
......
...@@ -15,7 +15,7 @@ import java.util.*; ...@@ -15,7 +15,7 @@ import java.util.*;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "giveall", usage = "giveall [amount]", aliases = {"givea"}, permission = "player.giveall", threading = true, description = "commands.giveAll.description") @Command(label = "giveall", usage = "giveall [amount]", aliases = {"givea"}, permission = "player.giveall", permissionTargeted = "player.giveall.others", threading = true, description = "commands.giveAll.description")
public final class GiveAllCommand implements CommandHandler { public final class GiveAllCommand implements CommandHandler {
@Override @Override
......
...@@ -19,7 +19,7 @@ import static java.util.Map.entry; ...@@ -19,7 +19,7 @@ import static java.util.Map.entry;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", aliases = {"gart"}, permission = "player.giveart", description = "commands.giveArtifact.description") @Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", aliases = {"gart"}, permission = "player.giveart", permissionTargeted = "player.giveart.others", description = "commands.giveArtifact.description")
public final class GiveArtifactCommand implements CommandHandler { public final class GiveArtifactCommand implements CommandHandler {
private static final Map<String, Map<EquipType, Integer>> mainPropMap = Map.ofEntries( private static final Map<String, Map<EquipType, Integer>> mainPropMap = Map.ofEntries(
entry("hp", Map.ofEntries(entry(EquipType.EQUIP_BRACER, 14001))), entry("hp", Map.ofEntries(entry(EquipType.EQUIP_BRACER, 14001))),
......
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "givechar", usage = "givechar <avatarId> [level]", aliases = {"givec"}, permission = "player.givechar", description = "commands.giveChar.description") @Command(label = "givechar", usage = "givechar <avatarId> [level]", aliases = {"givec"}, permission = "player.givechar", permissionTargeted = "player.givechar.others", description = "commands.giveChar.description")
public final class GiveCharCommand implements CommandHandler { public final class GiveCharCommand implements CommandHandler {
@Override @Override
......
...@@ -17,7 +17,7 @@ import java.util.regex.Pattern; ...@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", aliases = { @Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", aliases = {
"g", "item", "giveitem"}, permission = "player.give", description = "commands.give.description") "g", "item", "giveitem"}, permission = "player.give", permissionTargeted = "player.give.others", description = "commands.give.description")
public final class GiveCommand implements CommandHandler { public final class GiveCommand implements CommandHandler {
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
Pattern refineRegex = Pattern.compile("r(\\d+)"); Pattern refineRegex = Pattern.compile("r(\\d+)");
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "godmode", usage = "godmode [on|off|toggle]", permission = "player.godmode", description = "commands.godmode.description") @Command(label = "godmode", usage = "godmode [on|off|toggle]", permission = "player.godmode", permissionTargeted = "player.godmode.others", description = "commands.godmode.description")
public final class GodModeCommand implements CommandHandler { public final class GodModeCommand implements CommandHandler {
@Override @Override
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "heal", usage = "heal|h", aliases = {"h"}, permission = "player.heal", description = "commands.heal.description") @Command(label = "heal", usage = "heal|h", aliases = {"h"}, permission = "player.heal", permissionTargeted = "player.heal.others", description = "commands.heal.description")
public final class HealCommand implements CommandHandler { public final class HealCommand implements CommandHandler {
@Override @Override
......
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "killall", usage = "killall [sceneId]", permission = "server.killall", description = "commands.kill.description") @Command(label = "killall", usage = "killall [sceneId]", permission = "server.killall", permissionTargeted = "server.killall.others", description = "commands.kill.description")
public final class KillAllCommand implements CommandHandler { public final class KillAllCommand implements CommandHandler {
@Override @Override
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, permission = "player.killcharacter", description = "commands.list.description") @Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, permission = "player.killcharacter", permissionTargeted = "player.killcharacter.others", description = "commands.list.description")
public final class KillCharacterCommand implements CommandHandler { public final class KillCharacterCommand implements CommandHandler {
@Override @Override
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "resetconst", usage = "resetconst [all]", @Command(label = "resetconst", usage = "resetconst [all]",
aliases = {"resetconstellation"}, permission = "player.resetconstellation", description = "commands.resetConst.description") aliases = {"resetconstellation"}, permission = "player.resetconstellation", permissionTargeted = "player.resetconstellation.others", description = "commands.resetConst.description")
public final class ResetConstCommand implements CommandHandler { public final class ResetConstCommand implements CommandHandler {
@Override @Override
......
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "resetshop", usage = "resetshop", permission = "server.resetshop", description = "commands.status.description") @Command(label = "resetshop", usage = "resetshop", permission = "server.resetshop", permissionTargeted = "server.resetshop.others", description = "commands.resetshop.description")
public final class ResetShopLimitCommand implements CommandHandler { public final class ResetShopLimitCommand implements CommandHandler {
@Override @Override
......
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "say", usage = "say <message>", @Command(label = "say", usage = "say <message>",
aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage", description = "commands.sendMessage.description") aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage", permissionTargeted = "server.sendmessage.others", description = "commands.sendMessage.description")
public final class SendMessageCommand implements CommandHandler { public final class SendMessageCommand implements CommandHandler {
@Override @Override
......
...@@ -12,7 +12,7 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify; ...@@ -12,7 +12,7 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "setfetterlevel", usage = "setfetterlevel <level>", @Command(label = "setfetterlevel", usage = "setfetterlevel <level>",
aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel", description = "commands.setFetterLevel.description") aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel", permissionTargeted = "player.setfetterlevel.others", description = "commands.setFetterLevel.description")
public final class SetFetterLevelCommand implements CommandHandler { public final class SetFetterLevelCommand implements CommandHandler {
@Override @Override
......
...@@ -15,7 +15,7 @@ import emu.grasscutter.utils.Language; ...@@ -15,7 +15,7 @@ import emu.grasscutter.utils.Language;
import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.utils.Language.translate;
@Command(label = "setstats", usage = "setstats|stats <stat> <value>", aliases = {"stats"}, permission = "player.setstats", description = "commands.setStats.description") @Command(label = "setstats", usage = "setstats|stats <stat> <value>", aliases = {"stats"}, permission = "player.setstats", permissionTargeted = "player.setstats.others", description = "commands.setStats.description")
public final class SetStatsCommand implements CommandHandler { public final class SetStatsCommand implements CommandHandler {
static class Stat { static class Stat {
String name; String name;
...@@ -175,7 +175,7 @@ public final class SetStatsCommand implements CommandHandler { ...@@ -175,7 +175,7 @@ public final class SetStatsCommand implements CommandHandler {
@Override @Override
public void execute(Player sender, Player targetPlayer, List<String> args) { public void execute(Player sender, Player targetPlayer, List<String> args) {
String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.ingame"); String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.usage_ingame");
String usage = syntax + translate("commands.setStats.help_message"); String usage = syntax + translate("commands.setStats.help_message");
String statStr; String statStr;
String valueStr; String valueStr;
......
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