mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-27 14:12:52 +08:00
33 lines
1.2 KiB
Java
33 lines
1.2 KiB
Java
|
package emu.grasscutter.command.commands;
|
||
|
|
||
|
import emu.grasscutter.command.Command;
|
||
|
import emu.grasscutter.command.CommandHandler;
|
||
|
import emu.grasscutter.game.player.Player;
|
||
|
import emu.grasscutter.game.tower.TowerLevelRecord;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
import static emu.grasscutter.utils.Language.translate;
|
||
|
|
||
|
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"},
|
||
|
description = "Unlock all levels of tower", permission = "player.tower")
|
||
|
public class UnlockTowerCommand implements CommandHandler {
|
||
|
|
||
|
@Override
|
||
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||
|
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
|
||
|
.getCurrentTowerScheduleData().getEntranceFloorId());
|
||
|
|
||
|
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
|
||
|
.getScheduleFloors());
|
||
|
|
||
|
CommandHandler.sendMessage(sender, translate("commands.tower.unlock_done"));
|
||
|
}
|
||
|
|
||
|
public void unlockFloor(Player player, List<Integer> floors){
|
||
|
floors.stream()
|
||
|
.filter(id -> !player.getTowerManager().getRecordMap().containsKey(id))
|
||
|
.forEach(id -> player.getTowerManager().getRecordMap().put(id, new TowerLevelRecord(id)));
|
||
|
}
|
||
|
}
|