mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Static ALL the things!
This commit is contained in:
parent
ca6cafaebd
commit
71446a12af
@ -12,12 +12,6 @@ import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public McmmoCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String description = LocaleLoader.getString("mcMMO.Description");
|
||||
@ -25,7 +19,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage(mcSplit);
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
if (plugin.spoutEnabled && sender instanceof SpoutPlayer) {
|
||||
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = (SpoutPlayer) sender;
|
||||
|
||||
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);
|
||||
|
@ -22,7 +22,7 @@ public class McremoveCommand implements CommandExecutor {
|
||||
|
||||
public McremoveCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
this.location = plugin.usersFile;
|
||||
this.location = mcMMO.usersFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
|
||||
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
@ -20,12 +20,6 @@ import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class XplockCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public XplockCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
String usage = ChatColor.RED + "Proper usage is /xplock [skill]";
|
||||
@ -34,7 +28,7 @@ public class XplockCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
|
||||
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class PlayerProfile {
|
||||
HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||
|
||||
private String playerName;
|
||||
private final String location = mcMMO.p.usersFile;
|
||||
private final static String location = mcMMO.usersFile;
|
||||
|
||||
public PlayerProfile(String name, boolean addNew) {
|
||||
hud = SpoutConfig.getInstance().defaulthud;
|
||||
|
@ -301,7 +301,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* TREE FELLER SOUNDS */
|
||||
if (plugin.spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
|
||||
if (mcMMO.spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ public class BlockListener implements Listener {
|
||||
event.setInstaBreak(true);
|
||||
}
|
||||
|
||||
if (plugin.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class PlayerListener implements Listener {
|
||||
/* GARBAGE COLLECTION */
|
||||
|
||||
//Remove Spout Stuff
|
||||
if (plugin.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
|
||||
if (mcMMO.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
|
||||
SpoutStuff.playerHUDs.remove(player);
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,14 @@ public class mcMMO extends JavaPlugin {
|
||||
public File mcmmo;
|
||||
|
||||
//File Paths
|
||||
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
|
||||
public static String mainDirectory;
|
||||
public static String flatFileDirectory;
|
||||
public static String usersFile;
|
||||
public static String leaderboardDirectory;
|
||||
public static String modDirectory;
|
||||
|
||||
//Spout Check
|
||||
public boolean spoutEnabled;
|
||||
public static boolean spoutEnabled;
|
||||
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
@ -351,7 +355,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (configInstance.getCommandmcMMOEnabled()) {
|
||||
getCommand("mcmmo").setExecutor(new McmmoCommand(this));
|
||||
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||
}
|
||||
|
||||
if (configInstance.getCommandMCRefreshEnabled()) {
|
||||
@ -416,7 +420,7 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Spout commands
|
||||
if (configInstance.getCommandXPLockEnabled()) {
|
||||
getCommand("xplock").setExecutor(new XplockCommand(this));
|
||||
getCommand("xplock").setExecutor(new XplockCommand());
|
||||
}
|
||||
|
||||
getCommand("mchud").setExecutor(new MchudCommand(this));
|
||||
|
@ -170,7 +170,7 @@ public class Party {
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public ArrayList<String> getParties() {
|
||||
String location = plugin.usersFile;
|
||||
String location = mcMMO.usersFile;
|
||||
ArrayList<String> parties = new ArrayList<String>();
|
||||
|
||||
try {
|
||||
|
@ -17,7 +17,7 @@ public class SQLConversionTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String location = plugin.usersFile;
|
||||
String location = mcMMO.usersFile;
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
|
@ -17,14 +17,14 @@ public class SpoutStart implements Runnable{
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
|
||||
plugin.spoutEnabled = true;
|
||||
mcMMO.spoutEnabled = true;
|
||||
}
|
||||
else {
|
||||
plugin.spoutEnabled = false;
|
||||
mcMMO.spoutEnabled = false;
|
||||
}
|
||||
|
||||
//Spout Stuff
|
||||
if (plugin.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutConfig.getInstance();
|
||||
SpoutStuff.setupSpoutConfigs();
|
||||
SpoutStuff.registerCustomEvent();
|
||||
|
@ -126,7 +126,7 @@ public class Excavation {
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ public class Mining {
|
||||
|
||||
miningBlockCheck(player, block);
|
||||
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
@ -376,7 +376,7 @@ public class Mining {
|
||||
|
||||
miningBlockCheck(player, block);
|
||||
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ public class WoodCutting {
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
||||
}
|
||||
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class Repair {
|
||||
Skills.xpProcessing(player, PP, SkillType.REPAIR, dif * 10);
|
||||
|
||||
//CLANG CLANG
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutSounds.playRepairNoise(player, mcMMO.p);
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ public class Repair {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!PP.getPlacedAnvil()) {
|
||||
if (mcMMO.p.spoutEnabled) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
|
@ -32,7 +32,7 @@ import com.gmail.nossr50.util.Users;
|
||||
public class SpoutStuff {
|
||||
private static mcMMO plugin = mcMMO.p;
|
||||
|
||||
public final static String spoutDirectory = plugin.mainDirectory + "Resources" + File.separator;
|
||||
public final static String spoutDirectory = mcMMO.mainDirectory + "Resources" + File.separator;
|
||||
public final static String hudDirectory = spoutDirectory + "HUD" + File.separator;
|
||||
public final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator;
|
||||
public final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
|
||||
|
@ -32,7 +32,7 @@ public class ItemChecks {
|
||||
if (customToolsEnabled && CustomToolsConfig.getInstance().customSwordIDs.contains(is.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutSwords.contains(is)) {
|
||||
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutSwords.contains(is)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -60,7 +60,7 @@ public class ItemChecks {
|
||||
if (customToolsEnabled && CustomToolsConfig.getInstance().customHoeIDs.contains(is.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) {
|
||||
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -88,7 +88,7 @@ public class ItemChecks {
|
||||
if (customToolsEnabled && CustomToolsConfig.getInstance().customShovelIDs.contains(is.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) {
|
||||
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -116,7 +116,7 @@ public class ItemChecks {
|
||||
if (customToolsEnabled && CustomToolsConfig.getInstance().customAxeIDs.contains(is.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) {
|
||||
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -144,7 +144,7 @@ public class ItemChecks {
|
||||
if (customToolsEnabled && CustomToolsConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) {
|
||||
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -15,8 +15,8 @@ import com.gmail.nossr50.datatypes.Tree;
|
||||
|
||||
public class Leaderboard {
|
||||
private static mcMMO plugin = mcMMO.p;
|
||||
private static String leaderboardsDirectory = plugin.leaderboardDirectory;
|
||||
private static String location = plugin.usersFile;
|
||||
private static String leaderboardsDirectory = mcMMO.leaderboardDirectory;
|
||||
private final static String location = mcMMO.usersFile;
|
||||
|
||||
/**
|
||||
* Create the leaderboards.
|
||||
|
@ -209,7 +209,7 @@ public class Skills {
|
||||
String capitalized = Misc.getCapitalized(skillType.toString());
|
||||
|
||||
/* Spout Stuff */
|
||||
if (mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
if (mcMMO.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
@ -234,7 +234,7 @@ public class Skills {
|
||||
}
|
||||
|
||||
/* Always update XP Bar (Check if no levels were gained first to remove redundancy) */
|
||||
if (skillups == 0 && mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
if (skillups == 0 && mcMMO.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = (SpoutPlayer) player;
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
if (SpoutConfig.getInstance().getXPBarEnabled()) {
|
||||
|
@ -22,9 +22,9 @@ public class Users {
|
||||
public static void loadUsers() {
|
||||
|
||||
|
||||
new File(plugin.flatFileDirectory).mkdir();
|
||||
new File(plugin.leaderboardDirectory).mkdir();
|
||||
File theDir = new File(plugin.usersFile);
|
||||
new File(mcMMO.flatFileDirectory).mkdir();
|
||||
new File(mcMMO.leaderboardDirectory).mkdir();
|
||||
File theDir = new File(mcMMO.usersFile);
|
||||
|
||||
if (!theDir.exists()) {
|
||||
try {
|
||||
|
@ -16,15 +16,14 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
|
||||
public class ZipLibrary {
|
||||
private final static mcMMO plugin = mcMMO.p;
|
||||
private static String BackupDirectory = plugin.mainDirectory + "backup" + File.separator;
|
||||
private static String BackupDirectory = mcMMO.mainDirectory + "backup" + File.separator;
|
||||
private static File BackupDir = new File(BackupDirectory);
|
||||
private static File FlatFileDirectory = new File(plugin.flatFileDirectory);
|
||||
private static File ModFileDirectory = new File(plugin.modDirectory);
|
||||
private static File UsersFile = new File(plugin.usersFile);
|
||||
private static File ConfigFile = new File(plugin.mainDirectory + "config.yml");
|
||||
private static File TreasuresFile = new File(plugin.mainDirectory + "treasures.yml");
|
||||
private static File Leaderboards = new File(plugin.leaderboardDirectory);
|
||||
private static File FlatFileDirectory = new File(mcMMO.flatFileDirectory);
|
||||
private static File ModFileDirectory = new File(mcMMO.modDirectory);
|
||||
private static File UsersFile = new File(mcMMO.usersFile);
|
||||
private static File ConfigFile = new File(mcMMO.mainDirectory + "config.yml");
|
||||
private static File TreasuresFile = new File(mcMMO.mainDirectory + "treasures.yml");
|
||||
private static File Leaderboards = new File(mcMMO.leaderboardDirectory);
|
||||
|
||||
public static void mcMMObackup() throws IOException {
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user