Removing redundancy in most commands

This commit is contained in:
nossr50 2012-02-28 11:17:54 -08:00
parent e31aea3492
commit 1281843d45
20 changed files with 2 additions and 125 deletions

View File

@ -34,11 +34,6 @@ public class AddlevelsCommand implements CommandExecutor{
return true; return true;
} }
if (!LoadProperties.addlevelsEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
if (args.length < 2) { if (args.length < 2) {
System.out.println("Usage is /addlevels playername skillname levels"); System.out.println("Usage is /addlevels playername skillname levels");

View File

@ -33,11 +33,6 @@ public class AddxpCommand implements CommandExecutor {
return true; return true;
} }
if (!LoadProperties.addxpEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
if (args.length < 2) { if (args.length < 2) {
// No console aliasing yet // No console aliasing yet

View File

@ -20,7 +20,7 @@ public class ClearmyspawnCommand implements CommandExecutor {
sender.sendMessage("This command is not enabled."); sender.sendMessage("This command is not enabled.");
return true; return true;
} }
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");
return true; return true;

View File

@ -25,10 +25,6 @@ public class McstatsCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcstatsEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
Player player = null; Player player = null;
if (sender instanceof Player) { if (sender instanceof Player) {

View File

@ -34,11 +34,6 @@ public class MmoeditCommand implements CommandExecutor {
return true; return true;
} }
if (!LoadProperties.mmoeditEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
if (args.length < 2) { if (args.length < 2) {
System.out.println("Usage is /mmoedit playername skillname newvalue"); System.out.println("Usage is /mmoedit playername skillname newvalue");

View File

@ -25,10 +25,6 @@ public class WhoisCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.whoisEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
Player player = null; Player player = null;
if (sender instanceof Player) { if (sender instanceof Player) {

View File

@ -19,10 +19,6 @@ public class XprateCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.xprateEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
if(args.length <= 0) if(args.length <= 0)

View File

@ -25,11 +25,6 @@ public class McabilityCommand implements CommandExecutor {
return true; return true;
} }
if (!LoadProperties.mcabilityEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");
return true; return true;

View File

@ -13,10 +13,6 @@ import com.gmail.nossr50.locale.mcLocale;
public class MccCommand implements CommandExecutor { public class MccCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mccEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -15,10 +15,6 @@ import com.gmail.nossr50.locale.mcLocale;
public class McgodCommand implements CommandExecutor { public class McgodCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcgodEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -14,10 +14,6 @@ public class McmmoCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcmmoEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -22,10 +22,6 @@ public class McrefreshCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcrefreshEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -1,52 +0,0 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
public class Mcremove implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && !mcPermissions.getInstance().mcremove(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (!LoadProperties.mcremoveEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if(args.length == 1)
{
sender.sendMessage("Correct usage is /mcremove [Player Name]");
}
//If the server is using MySQL
if(LoadProperties.useMySQL)
{
} else {
}
return true;
}
}

View File

@ -20,10 +20,6 @@ import com.gmail.nossr50.skills.Skills;
public class MctopCommand implements CommandExecutor { public class MctopCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mctopEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -16,10 +16,6 @@ import com.gmail.nossr50.party.Party;
public class AcceptCommand implements CommandExecutor { public class AcceptCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.acceptEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -23,10 +23,6 @@ public class InviteCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.inviteEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -26,10 +26,6 @@ public class PCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.partyEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
// Console message? // Console message?
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {

View File

@ -17,10 +17,6 @@ import com.gmail.nossr50.party.Party;
public class PartyCommand implements CommandExecutor { public class PartyCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.partyEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -22,10 +22,6 @@ public class PtpCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.ptpEnable) {
sender.sendMessage("This command is not enabled.");
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage."); sender.sendMessage("This command does not support console useage.");

View File

@ -296,6 +296,7 @@ public class mcMMO extends JavaPlugin
getCommand("woodcutting").setExecutor(new WoodcuttingCommand()); getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
//Mc* commands //Mc* commands
if(LoadProperties.mcremoveEnable) getCommand("mcremove").setExecutor(new McremoveCommand());
if(LoadProperties.mcabilityEnable) getCommand("mcability").setExecutor(new McabilityCommand()); if(LoadProperties.mcabilityEnable) getCommand("mcability").setExecutor(new McabilityCommand());
if(LoadProperties.mccEnable) getCommand("mcc").setExecutor(new MccCommand()); if(LoadProperties.mccEnable) getCommand("mcc").setExecutor(new MccCommand());
if(LoadProperties.mcgodEnable) getCommand("mcgod").setExecutor(new McgodCommand()); if(LoadProperties.mcgodEnable) getCommand("mcgod").setExecutor(new McgodCommand());