2022-04-20 20:21:38 +08:00
|
|
|
package emu.grasscutter.command.commands;
|
|
|
|
|
|
|
|
import emu.grasscutter.command.Command;
|
|
|
|
import emu.grasscutter.command.CommandHandler;
|
|
|
|
import emu.grasscutter.game.GenshinPlayer;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Command(label = "changescene", usage = "changescene <scene id>",
|
|
|
|
description = "Changes your scene", aliases = {"scene"}, permission = "player.changescene")
|
|
|
|
public class ChangeScene implements CommandHandler {
|
|
|
|
@Override
|
2022-04-21 00:17:56 +08:00
|
|
|
public void execute(GenshinPlayer sender, List<String> args) {
|
2022-04-20 20:21:38 +08:00
|
|
|
if (sender == null) {
|
|
|
|
CommandHandler.sendMessage(null, "Run this command in-game.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args.size() < 1) {
|
|
|
|
CommandHandler.sendMessage(sender, "Usage: changescene <scene id>");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
int sceneId = Integer.parseInt(args.get(0));
|
|
|
|
boolean result = sender.getWorld().transferPlayerToScene(sender, sceneId, sender.getPos());
|
|
|
|
|
|
|
|
CommandHandler.sendMessage(sender, "Changed to scene " + sceneId);
|
|
|
|
if (!result) {
|
|
|
|
CommandHandler.sendMessage(sender, "Scene does not exist or you are already in it");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
CommandHandler.sendMessage(sender, "Usage: changescene <scene id>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|