aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/djtheredstoner/perspectivemod/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/djtheredstoner/perspectivemod/commands')
-rw-r--r--src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java59
1 files changed, 9 insertions, 50 deletions
diff --git a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java b/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
index cad7f79..00b0d27 100644
--- a/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
+++ b/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
@@ -1,60 +1,19 @@
package me.djtheredstoner.perspectivemod.commands;
-import club.sk1er.mods.core.ModCore;
+import gg.essential.api.EssentialAPI;
+import gg.essential.api.commands.Command;
+import gg.essential.api.commands.DefaultHandler;
import me.djtheredstoner.perspectivemod.PerspectiveMod;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandBase;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-import java.util.Collections;
-import java.util.List;
+public class PerspectiveModCommand extends Command {
-public class PerspectiveModCommand extends CommandBase {
-
- private final String PREFIX = "§c[§6Perspective Mod§c] §r";
-
- @Override
- public String getCommandName() {
- return "perspectivemod";
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Collections.singletonList("pmod");
+ public PerspectiveModCommand(String name) {
+ super(name);
}
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "§6Perspective Mod Help\n" +
- "§b/pmod <enable|disable> §7- Enables or disables the mod.\n" +
- "§b/pmod mode <hold|toggle> §7- Changes the mode.\n" +
- "§7Edit the keybind in the minecraft controls menu.";
+ @DefaultHandler
+ public void handle() {
+ EssentialAPI.getGuiUtil().openScreen(PerspectiveMod.instance.config.gui());
}
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- if (args.length == 1 && args[0].equals("eW91IGZvdW5kIGEgc2VjcmV0IQo=")) {
- sendMessage("you found a secret!");
- } else {
- ModCore.getInstance().getGuiHandler().open(PerspectiveMod.instance.config.gui());
- }
- }
-
- @Override
- public int getRequiredPermissionLevel() {
- return -1;
- }
-
- private void sendHelp() {
- sendMessage(getCommandUsage(Minecraft.getMinecraft().thePlayer), false);
- }
-
- private void sendMessage(String message, boolean addPrefix) {
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((addPrefix ? PREFIX : "") + message));
- }
-
- private void sendMessage(String message) {
- sendMessage(message, true);
- }
}