Code Patterns
Copy-paste examples for common plugin tasks. Commands, events, ECS, GUI, and more.
All
225
Command
60
Damage
2
Ecs
27
Entity
5
Gui
75
Interaction
2
Inventory
4
Moderation
3
Permission
2
Player
9
Plugin
4
Storage
2
Teleport
3
Ui
22
Util
5
← Back to Patterns
java
command
Config Command
/config command using AbstractCommand
Example Code
package dev.myplugin.example;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractCommandCollection;
// import dev.myplugin.example.ReloadCommand; // Anonymized
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.*;
import java.util.concurrent.CompletableFuture;
/**
* Command for managing global BetterMap configuration.
*/
public class ExampleCommand extends AbstractCommandCollection {
public static final String CONFIG_PERMISSION = "dev.ninesliced.bettermap.command.config";
/**
* Constructs the ExampleCommand and registers subcommands.
*/
public ExampleCommand() {
super("config", "Manage global BetterMap configuration");
this.requirePermission(CONFIG_PERMISSION);
this.addSubCommand(new MapMinScaleCommand());
this.addSubCommand(new MapMaxScaleCommand());
this.addSubCommand(new MapExplorationRadiusCommand());
this.addSubCommand(new DebugCommand());
this.addSubCommand(new MapQualityCommand());
this.addSubCommand(new LocationCommand());
this.addSubCommand(new ShareAllExplorationCommand());
this.addSubCommand(new MaxChunksToLoadCommand());
this.addSubCommand(new RadarToggleCommand());
this.addSubCommand(new RadarRangeCommand());
this.addSubCommand(new HidePlayersCommand());
this.addSubCommand(new HideOtherWarpsCommand());
this.addSubCommand(new HideUnexploredWarpsCommand());
this.addSubCommand(new HideAllPoiCommand());
this.addSubCommand(new HideUnexploredPoiCommand());
this.addSubCommand(new WaypointTeleportCommand());
this.addSubCommand(new MarkerTeleportCommand());
this.addSubCommand(new TrackWorldCommand());
this.addSubCommand(new UntrackWorldCommand());
this.addSubCommand(new AutoSaveIntervalCommand());
}
@Override
protected String generatePermissionNode() {
return "config";
}
@Override
protected boolean canGeneratePermission() {
return false;
}
}