Remove Static Abuse - Command Tasks

This commit is contained in:
nossr50
2019-07-03 00:40:28 -07:00
parent 40a3de76fb
commit 4da455b9d2
76 changed files with 124 additions and 98 deletions

View File

@@ -12,7 +12,7 @@ import java.util.List;
public class ChatNotificationToggleCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ChatNotificationToggleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -23,7 +23,7 @@ public class ConvertCommand implements TabExecutor {
private CommandExecutor databaseConvertCommand;
private CommandExecutor experienceConvertCommand;
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ConvertCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -16,7 +16,7 @@ import java.util.List;
public class ExperienceRateCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ExperienceRateCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
public class McMMOCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public McMMOCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -13,7 +13,7 @@ import java.util.List;
public class ResetUserHealthBarSettingsCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ResetUserHealthBarSettingsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -12,7 +12,7 @@ import java.util.List;
public class ScoreboardCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ScoreboardCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
public class PlayerDebug implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PlayerDebug(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
*/
public final class ReloadLocaleCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ReloadLocaleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
public class ConvertDatabaseCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ConvertDatabaseCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -14,7 +14,7 @@ import java.util.UUID;
public class McremoveCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public McremoveCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import java.util.List;
public class PurgeCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PurgeCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import java.util.List;
public class ShowDatabaseCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ShowDatabaseCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
public class ConvertExperienceCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ConvertExperienceCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -24,7 +24,7 @@ import java.util.UUID;
*/
public class SkillResetCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public SkillResetCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
public class PartyAcceptCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyAcceptCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyChangeOwnerCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyChangeOwnerCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
public class PartyChangePasswordCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyChangePasswordCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -24,7 +24,7 @@ import java.util.List;
//TODO: This class horrifies me, rewrite it at some point
public class PartyCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
private CommandExecutor partyJoinCommand;
private CommandExecutor partyAcceptCommand;
private CommandExecutor partyCreateCommand;

View File

@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
public class PartyCreateCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyCreateCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyDisbandCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyDisbandCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
public class PartyHelpCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyHelpCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -16,7 +16,7 @@ import java.util.List;
public class PartyInfoCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyInfoCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyInviteCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyInviteCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
public class PartyItemShareCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyItemShareCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyJoinCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyJoinCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
public class PartyKickCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyKickCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyLockCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyLockCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
public class PartyQuitCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyQuitCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
public class PartyRenameCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyRenameCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
public class PartyXpShareCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyXpShareCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
public class PartyAllianceAcceptCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyAllianceAcceptCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -19,7 +19,7 @@ import java.util.List;
public class PartyAllianceCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
private Player player;
private Party playerParty;
private Party targetParty;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyAllianceDisbandCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyAllianceDisbandCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
public class PartyAllianceInviteCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PartyAllianceInviteCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -8,7 +8,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class PtpAcceptAnyCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PtpAcceptAnyCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
public class PtpAcceptCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PtpAcceptCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -24,7 +24,7 @@ import java.util.List;
public class PtpCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
private CommandExecutor ptpToggleCommand;
private CommandExecutor ptpAcceptAnyCommand;
private CommandExecutor ptpAcceptCommand;

View File

@@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
public class PtpToggleCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public PtpToggleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -13,7 +13,7 @@ import java.util.List;
public class CooldownCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public CooldownCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -17,7 +17,7 @@ import java.util.List;
public class InspectCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public InspectCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -4,7 +4,7 @@ import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
import com.gmail.nossr50.runnables.commands.LeaderboardsCommandAsyncTask;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.google.common.collect.ImmutableList;
@@ -20,7 +20,7 @@ import java.util.List;
public class LeaderboardCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public LeaderboardCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
@@ -120,7 +120,7 @@ public class LeaderboardCommand implements TabExecutor {
boolean useBoard = (sender instanceof Player) && (pluginRef.getScoreboardSettings().isScoreboardEnabled(pluginRef.getScoreboardManager().SidebarType.TOP_BOARD));
boolean useChat = !useBoard || pluginRef.getScoreboardSettings().isScoreboardPrinting(pluginRef.getScoreboardManager().SidebarType.TOP_BOARD);
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
new LeaderboardsCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
}
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.runnables.commands.RankCommandAsyncTask;
import com.gmail.nossr50.util.Permissions;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
@@ -18,7 +18,7 @@ import java.util.List;
public class RankCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public RankCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
@@ -117,7 +117,7 @@ public class RankCommand implements TabExecutor {
&& (pluginRef.getScoreboardSettings().isScoreboardEnabled(pluginRef.getScoreboardManager().SidebarType.RANK_BOARD));
boolean useChat = !useBoard || pluginRef.getScoreboardSettings().isScoreboardPrinting(pluginRef.getScoreboardManager().SidebarType.RANK_BOARD);
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
new RankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
}
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@@ -11,7 +11,7 @@ import java.util.List;
public class SkillStatsCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public SkillStatsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
public class ReloadPluginCommand implements CommandExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public ReloadPluginCommand(mcMMO plugin) {
this.pluginRef = plugin;

View File

@@ -22,7 +22,7 @@ import java.util.List;
*/
public class MmoInfoCommand implements TabExecutor {
private mcMMO pluginRef;
private final mcMMO pluginRef;
public MmoInfoCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;

View File

@@ -14,7 +14,7 @@ public class SkillGuideCommand implements CommandExecutor {
private String header;
private ArrayList<String> guide;
private String invalidPage;
private mcMMO pluginRef;
private final mcMMO pluginRef;
public SkillGuideCommand(PrimarySkillType skill, mcMMO pluginRef) {
header = pluginRef.getLocaleManager().getString("Guides.Header", skill.getName());