aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
diff options
context:
space:
mode:
authorDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2021-07-15 20:40:07 -0400
committerDJtheRedstoner <52044242+DJtheRedstoner@users.noreply.github.com>2021-07-15 20:40:07 -0400
commitae2ea9373b8b7cdd1530062d0a42b615f9b94ce3 (patch)
tree412f69c50d572089d12d2e57f483a91ea5de15dd /src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java
parent7a42b12aa3bbb389dd1cdc9c1bd2d81b8a4da2bb (diff)
downloadPerspectiveModv4-ae2ea9373b8b7cdd1530062d0a42b615f9b94ce3.tar.gz
PerspectiveModv4-ae2ea9373b8b7cdd1530062d0a42b615f9b94ce3.tar.bz2
PerspectiveModv4-ae2ea9373b8b7cdd1530062d0a42b615f9b94ce3.zip
Update to Essential
Diffstat (limited to 'src/main/java/me/djtheredstoner/perspectivemod/commands/PerspectiveModCommand.java')
-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);
- }
}