3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 00:23:03 +01:00

Use an immutable view in GeyserDefineCommandsEvent

Methods to properly register/unregister commands are provided in the command manager
Dieser Commit ist enthalten in:
RednedEpic 2022-07-02 12:30:23 -05:00
Ursprung 36c49a7256
Commit b5eb27693f
2 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -36,8 +36,7 @@ import java.util.Map;
* Called when commands are defined within Geyser. * Called when commands are defined within Geyser.
* *
* @param commandManager the command manager * @param commandManager the command manager
* @param commands a mutable list of the currently * @param commands an immutable view of the default commands
* registered default commands
*/ */
public record GeyserDefineCommandsEvent(@NonNull CommandManager commandManager, @NonNull Map<String, Command> commands) implements Event { public record GeyserDefineCommandsEvent(@NonNull CommandManager commandManager, @NonNull Map<String, Command> commands) implements Event {
} }

Datei anzeigen

@ -70,7 +70,7 @@ public abstract class GeyserCommandManager extends CommandManager {
register(new StopCommand(geyser, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); register(new StopCommand(geyser, "stop", "geyser.commands.stop.desc", "geyser.command.stop"));
} }
this.geyser.eventBus().fire(new GeyserDefineCommandsEvent(this, this.commands)); this.geyser.eventBus().fire(new GeyserDefineCommandsEvent(this, this.commands()));
} }
@Override @Override