mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 17:35:47 +00:00
Refactor classes
This commit is contained in:
parent
c4bdcc387c
commit
03988414ce
@ -6,20 +6,19 @@ import emu.grasscutter.game.GenshinPlayer;
|
||||
import emu.grasscutter.game.props.FightProperty;
|
||||
import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Command(label = "heal", usage = "heal|h",
|
||||
description = "Heal all characters in your current team.", aliases = {"h"}, permission = "player.heal")
|
||||
public class HealCommand implements CommandHandler {
|
||||
@Command(label = "heal", usage = "heal|h", aliases = {"h"},
|
||||
description = "Heal all characters in your current team.", permission = "player.heal")
|
||||
public final class HealCommand implements CommandHandler {
|
||||
@Override
|
||||
public void execute(GenshinPlayer sender, List<String> args) {
|
||||
if (sender == null) {
|
||||
CommandHandler.sendMessage(null, "Run this command in-game.");
|
||||
return;
|
||||
}
|
||||
|
||||
sender.getTeamManager().getActiveTeam().forEach(entity -> {
|
||||
boolean isAlive = entity.isAlive();
|
||||
entity.setFightProperty(
|
||||
@ -31,6 +30,6 @@ public class HealCommand implements CommandHandler {
|
||||
entity.getWorld().broadcastPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar()));
|
||||
}
|
||||
});
|
||||
CommandHandler.sendMessage(sender, "All characters are healed.");
|
||||
CommandHandler.sendMessage(sender, "All characters have been healed.");
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Command(label = "list", description = "List online players")
|
||||
public class ListCommand implements CommandHandler {
|
||||
public final class ListCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(GenshinPlayer sender, List<String> args) {
|
||||
@ -19,14 +19,10 @@ public class ListCommand implements CommandHandler {
|
||||
|
||||
if (playersMap.size() != 0) {
|
||||
StringBuilder playerSet = new StringBuilder();
|
||||
|
||||
for (Map.Entry<Integer, GenshinPlayer> entry : playersMap.entrySet()) {
|
||||
playerSet.append(entry.getValue().getNickname());
|
||||
playerSet.append(", ");
|
||||
}
|
||||
|
||||
playersMap.values().forEach(player ->
|
||||
playerSet.append(player.getNickname()).append(", "));
|
||||
|
||||
String players = playerSet.toString();
|
||||
|
||||
CommandHandler.sendMessage(sender, players.substring(0, players.length() - 2));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
@Command(label = "talent", usage = "talent <talentID> <value>",
|
||||
description = "Set talent level for your current active character", permission = "player.settalent")
|
||||
public class TalentCommand implements CommandHandler {
|
||||
public final class TalentCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(GenshinPlayer sender, List<String> args) {
|
||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
@Command(label = "teleport", usage = "teleport <x> <y> <z>", aliases = {"tp"},
|
||||
description = "Change the player's position.", permission = "player.teleport")
|
||||
public class TelePortCommand implements CommandHandler {
|
||||
public final class TeleportCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(GenshinPlayer sender, List<String> args) {
|
@ -98,8 +98,8 @@ public final class DispatchServer {
|
||||
byte[] decoded2 = Base64.getDecoder().decode(query_cur_region);
|
||||
QueryCurrRegionHttpRsp regionQuery = QueryCurrRegionHttpRsp.parseFrom(decoded2);
|
||||
|
||||
List<RegionSimpleInfo> servers = new ArrayList<RegionSimpleInfo>();
|
||||
List<String> usedNames = new ArrayList<String>(); // List to check for potential naming conflicts
|
||||
List<RegionSimpleInfo> servers = new ArrayList<>();
|
||||
List<String> usedNames = new ArrayList<>(); // List to check for potential naming conflicts
|
||||
if (Grasscutter.getConfig().RunMode.equalsIgnoreCase("HYBRID")) { // Automatically add the game server if in
|
||||
// hybrid mode
|
||||
RegionSimpleInfo server = RegionSimpleInfo.newBuilder()
|
||||
|
Loading…
Reference in New Issue
Block a user