Cleanup & refactoring, part 1.

This commit is contained in:
GJ
2012-04-20 18:09:50 -04:00
parent 153ecf4d13
commit f94a617d94
32 changed files with 224 additions and 188 deletions

View File

@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
public class AddlevelsCommand implements CommandExecutor{
private final mcMMO plugin;
public AddlevelsCommand(mcMMO instance) {
this.plugin = instance;
public AddlevelsCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override

View File

@ -17,8 +17,8 @@ import com.gmail.nossr50.skills.Skills;
public class AddxpCommand implements CommandExecutor {
private final mcMMO plugin;
public AddxpCommand(mcMMO instance) {
this.plugin = instance;
public AddxpCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override

View File

@ -17,8 +17,8 @@ import com.gmail.nossr50.locale.mcLocale;
public class InspectCommand implements CommandExecutor {
private final mcMMO plugin;
public InspectCommand(mcMMO instance) {
this.plugin = instance;
public InspectCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override

View File

@ -19,8 +19,8 @@ import com.gmail.nossr50.skills.Skills;
public class MmoeditCommand implements CommandExecutor {
private final mcMMO plugin;
public MmoeditCommand(mcMMO instance) {
this.plugin = instance;
public MmoeditCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -8,11 +7,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.runnables.SQLConversionTask;
public class MmoupdateCommand implements CommandExecutor {
private final mcMMO plugin;
public MmoupdateCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@ -24,7 +29,7 @@ public class MmoupdateCommand implements CommandExecutor {
Users.clearUsers();
convertToMySQL();
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
for (Player x : plugin.getServer().getOnlinePlayers()) {
Users.addUser(x);
}
@ -41,6 +46,6 @@ public class MmoupdateCommand implements CommandExecutor {
return;
}
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new SQLConversionTask(plugin), 1);
}
}

View File

@ -1,20 +1,25 @@
package com.gmail.nossr50.commands.general;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
public class XprateCommand implements CommandExecutor {
private final mcMMO plugin;
private static int oldrate = LoadProperties.xpGainMultiplier;
public static boolean xpevent = false;
public XprateCommand (mcMMO plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage1 = mcLocale.getString("Commands.xprate.proper");
@ -29,7 +34,7 @@ public class XprateCommand implements CommandExecutor {
case 1:
if (args[0].equalsIgnoreCase("reset")) {
if (xpevent) {
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.over"));
}
@ -63,7 +68,7 @@ public class XprateCommand implements CommandExecutor {
LoadProperties.xpGainMultiplier = m.getInt(args[0]);
if (xpevent) {
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.started"));
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
}