mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-06 01:23:21 +08:00
Fix bugs with commands
This commit is contained in:
parent
f8496a5ea5
commit
ba4e727302
@ -41,7 +41,7 @@ public final class PlayerCommands {
|
|||||||
case 1:
|
case 1:
|
||||||
try {
|
try {
|
||||||
item = Integer.parseInt(args.get(0));
|
item = Integer.parseInt(args.get(0));
|
||||||
target = player.getId();
|
target = player.getAccount().getPlayerId();
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
// TODO: Parse from item name using GM Handbook.
|
// TODO: Parse from item name using GM Handbook.
|
||||||
CommandHandler.sendMessage(player, "Invalid item id.");
|
CommandHandler.sendMessage(player, "Invalid item id.");
|
||||||
@ -147,7 +147,7 @@ public final class PlayerCommands {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(GenshinPlayer player, List<String> args) {
|
public void execute(GenshinPlayer player, List<String> args) {
|
||||||
if(args.size() < 1) {
|
if(args.size() < 1) {
|
||||||
CommandHandler.sendMessage(null, "Usage: drop <itemId|itemName> [amount]");
|
CommandHandler.sendMessage(player, "Usage: drop <itemId|itemName> [amount]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public final class PlayerCommands {
|
|||||||
|
|
||||||
ItemData itemData = GenshinData.getItemDataMap().get(item);
|
ItemData itemData = GenshinData.getItemDataMap().get(item);
|
||||||
if(itemData == null) {
|
if(itemData == null) {
|
||||||
CommandHandler.sendMessage(null, "Invalid item id."); return;
|
CommandHandler.sendMessage(player, "Invalid item id."); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemData.isEquip()) {
|
if (itemData.isEquip()) {
|
||||||
@ -172,7 +172,7 @@ public final class PlayerCommands {
|
|||||||
player.getWorld().addEntity(entity);
|
player.getWorld().addEntity(entity);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
CommandHandler.sendMessage(null, "Invalid item or player ID.");
|
CommandHandler.sendMessage(player, "Invalid item or player ID.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user