Static Abuse Removal - Command package done for now

This commit is contained in:
nossr50 2019-07-02 19:27:51 -07:00
parent a9207b6f38
commit 67afdd7efb
9 changed files with 21 additions and 20 deletions

View File

@ -7,10 +7,8 @@ import org.bukkit.command.CommandSender;
public class AbilityToggleCommand extends ToggleCommand { public class AbilityToggleCommand extends ToggleCommand {
private mcMMO pluginRef;
public AbilityToggleCommand(mcMMO pluginRef) { public AbilityToggleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef; super(pluginRef);
} }
@Override @Override

View File

@ -7,10 +7,8 @@ import org.bukkit.command.CommandSender;
public class GodModeCommand extends ToggleCommand { public class GodModeCommand extends ToggleCommand {
private mcMMO pluginRef;
public GodModeCommand(mcMMO pluginRef) { public GodModeCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef; super(pluginRef);
} }
@Override @Override

View File

@ -7,10 +7,8 @@ import org.bukkit.command.CommandSender;
public class RefreshCooldownsCommand extends ToggleCommand { public class RefreshCooldownsCommand extends ToggleCommand {
private mcMMO pluginRef;
public RefreshCooldownsCommand(mcMMO pluginRef) { public RefreshCooldownsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef; super(pluginRef);
} }
@Override @Override

View File

@ -12,11 +12,11 @@ import org.bukkit.command.TabExecutor;
import java.util.List; import java.util.List;
public class MHDCommand implements TabExecutor { public class ResetUserHealthBarSettingsCommand implements TabExecutor {
private mcMMO pluginRef; private mcMMO pluginRef;
public MHDCommand(mcMMO pluginRef) { public ResetUserHealthBarSettingsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef; this.pluginRef = pluginRef;
} }

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -12,6 +13,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class ToggleCommand implements TabExecutor { public abstract class ToggleCommand implements TabExecutor {
protected mcMMO pluginRef;
public ToggleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -45,9 +53,10 @@ public abstract class ToggleCommand implements TabExecutor {
return true; return true;
} }
if (pluginRef.getCommandTools().isOffline(sender, mcMMOPlayer.getPlayer())) { //TODO: Does it matter if they are offline?
/*if (pluginRef.getCommandTools().isOffline(sender, mcMMOPlayer.getPlayer())) {
return true; return true;
} }*/
applyCommandAction(mcMMOPlayer); applyCommandAction(mcMMOPlayer);
sendSuccessMessage(sender, playerName); sendSuccessMessage(sender, playerName);

View File

@ -18,9 +18,9 @@ import java.util.List;
public abstract class ChatCommand implements TabExecutor { public abstract class ChatCommand implements TabExecutor {
private ChatMode chatMode; private ChatMode chatMode;
public mcMMO pluginRef; protected mcMMO pluginRef;
public ChatCommand(ChatMode chatMode, mcMMO pluginRef) { ChatCommand(ChatMode chatMode, mcMMO pluginRef) {
this.chatMode = chatMode; this.chatMode = chatMode;
this.pluginRef = pluginRef; this.pluginRef = pluginRef;
} }

View File

@ -8,10 +8,8 @@ import org.bukkit.command.CommandSender;
public class ChatSpyCommand extends ToggleCommand { public class ChatSpyCommand extends ToggleCommand {
private mcMMO pluginRef;
public ChatSpyCommand(mcMMO pluginRef) { public ChatSpyCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef; super(pluginRef);
} }
@Override @Override

View File

@ -40,7 +40,7 @@ public abstract class SkillCommand implements TabExecutor {
this.pluginRef = pluginRef; this.pluginRef = pluginRef;
this.skill = skill; this.skill = skill;
skillName = skill.getName(); skillName = skill.getName();
skillGuideCommand = new SkillGuideCommand(skill); skillGuideCommand = new SkillGuideCommand(skill, pluginRef);
} }
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) { public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {

View File

@ -388,7 +388,7 @@ public final class CommandRegistrationManager {
command.setPermission("mcmmo.commands.mhd"); command.setPermission("mcmmo.commands.mhd");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mhd")); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mhd"));
command.setExecutor(new MHDCommand()); command.setExecutor(new ResetUserHealthBarSettingsCommand());
} }
private void registerMcscoreboardCommand() { private void registerMcscoreboardCommand() {