Skip to content

Commit

Permalink
Make commands extends CommandBase 5
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Oct 15, 2024
1 parent 6d0b81a commit 45a55e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 41 deletions.
21 changes: 1 addition & 20 deletions src/main/java/mcjty/theoneprobe/commands/CommandTopCfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
Expand All @@ -18,15 +17,13 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.StringUtils;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

@SideOnly(Side.CLIENT)
public class CommandTopCfg implements ICommand {

public class CommandTopCfg extends CommandBase {

@Override
public String getName() {
Expand Down Expand Up @@ -78,11 +75,6 @@ private static void setPos(String[] args) {
}
}

@Override
public List<String> getAliases() {
return Collections.emptyList();
}

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
if (args.length < 1) {
Expand All @@ -105,19 +97,8 @@ public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
return true;
}


@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
return CommandBase.getListOfStringsMatchingLastWord(args, SUBCOMMANDS.keySet());
}

@Override
public boolean isUsernameIndex(String[] args, int index) {
return false;
}

@Override
public int compareTo(ICommand o) {
return getName().compareTo(o.getName());
}
}
23 changes: 2 additions & 21 deletions src/main/java/mcjty/theoneprobe/commands/CommandTopNeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@
import mcjty.theoneprobe.setup.GuiProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Collections;
import java.util.List;

@SideOnly(Side.CLIENT)
public class CommandTopNeed implements ICommand {
public class CommandTopNeed extends CommandBase {


@Override
Expand All @@ -29,11 +26,6 @@ public String getUsage(ICommandSender sender) {
return "topneed";
}

@Override
public List<String> getAliases() {
return Collections.emptyList();
}

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
ClientForgeEventHandlers.ignoreNextGuiClose = true;
Expand All @@ -46,17 +38,6 @@ public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
return true;
}


@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
return Collections.emptyList();
}

@Override
public boolean isUsernameIndex(String[] args, int index) {
return false;
}

@Override
public int compareTo(ICommand o) {
return getName().compareTo(o.getName());
Expand Down

0 comments on commit 45a55e6

Please sign in to comment.