Change Spout Config file to only load if Spout is enabled.

Removed unused imports.
This commit is contained in:
GJ 2012-05-23 14:31:03 -04:00
parent b88e076f27
commit 450e938092
13 changed files with 23 additions and 30 deletions

View File

@ -7,8 +7,8 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor {
@ -20,7 +20,7 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) {
if (SpoutConfig.getInstance().spoutEnabled && sender instanceof SpoutPlayer) {
if (mcMMO.p.spoutEnabled && sender instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) sender;
sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "mcmmodev@gmail.com", Material.DIAMOND);

View File

@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor {
return true;
}
if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
if (!plugin.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}

View File

@ -6,6 +6,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
@ -27,7 +28,7 @@ public class XplockCommand implements CommandExecutor {
return true;
}
if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
if (!mcMMO.p.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}

View File

@ -20,7 +20,6 @@ public class SpoutConfig extends ConfigLoader {
super(plugin, "spout.yml");
}
public boolean spoutEnabled;
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
public String getMenuKey() { return config.getString("Menu.Key", "KEY_M"); }

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
@ -254,7 +253,7 @@ public class BlockListener implements Listener {
}
/* TREE FELLER SOUNDS */
if (SpoutConfig.getInstance().spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
if (plugin.spoutEnabled && BlockChecks.isLog(block) && PP.getAbilityMode(AbilityType.TREE_FELLER)) {
SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
}
@ -299,7 +298,7 @@ public class BlockListener implements Listener {
event.setInstaBreak(true);
}
if (SpoutConfig.getInstance().spoutEnabled) {
if (plugin.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}

View File

@ -27,7 +27,6 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.general.XprateCommand;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask;
import com.gmail.nossr50.spout.SpoutStuff;
@ -143,7 +142,7 @@ public class PlayerListener implements Listener {
/* GARBAGE COLLECTION */
//Remove Spout Stuff
if (SpoutConfig.getInstance().spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
if (plugin.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
SpoutStuff.playerHUDs.remove(player);
}

View File

@ -9,7 +9,6 @@ import com.gmail.nossr50.commands.general.*;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.RepairConfigManager;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.config.TreasuresConfig;
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
@ -36,7 +35,6 @@ import net.shatteredlands.shatt.backup.ZipLibrary;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -46,8 +44,6 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
public class mcMMO extends JavaPlugin {
@ -74,6 +70,9 @@ public class mcMMO extends JavaPlugin {
//File Paths
public String mainDirectory, flatFileDirectory, usersFile, leaderboardDirectory, modDirectory;
//Spout Check
public boolean spoutEnabled;
/**
* Things to be run when the plugin is enabled.
*/
@ -85,7 +84,6 @@ public class mcMMO extends JavaPlugin {
Config configInstance = Config.getInstance();
TreasuresConfig.getInstance();
HiddenConfig.getInstance();
SpoutConfig.getInstance().load();
List<Repairable> repairables = new ArrayList<Repairable>();

View File

@ -17,14 +17,15 @@ public class SpoutStart implements Runnable{
@Override
public void run() {
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
SpoutConfig.getInstance().spoutEnabled = true;
plugin.spoutEnabled = true;
}
else {
SpoutConfig.getInstance().spoutEnabled = false;
plugin.spoutEnabled = false;
}
//Spout Stuff
if (SpoutConfig.getInstance().spoutEnabled) {
if (plugin.spoutEnabled) {
SpoutConfig.getInstance().load();
SpoutStuff.setupSpoutConfigs();
SpoutStuff.registerCustomEvent();
SpoutStuff.extractFiles(); //Extract source materials

View File

@ -18,7 +18,6 @@ import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.config.TreasuresConfig;
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
@ -130,7 +129,7 @@ public class Excavation {
Excavation.excavationProcCheck(block, player);
}
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}

View File

@ -19,7 +19,6 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
@ -333,7 +332,7 @@ public class Mining {
miningBlockCheck(player, block);
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}
@ -378,7 +377,7 @@ public class Mining {
miningBlockCheck(player, block);
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}

View File

@ -14,7 +14,6 @@ import org.bukkit.event.block.BlockBreakEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
@ -388,7 +387,7 @@ public class WoodCutting {
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
}
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
}

View File

@ -13,7 +13,6 @@ import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
@ -47,7 +46,7 @@ public class Repair {
Skills.XpCheckSkill(SkillType.REPAIR, player);
//CLANG CLANG
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutSounds.playRepairNoise(player, mcMMO.p);
}
}
@ -243,7 +242,7 @@ public class Repair {
PlayerProfile PP = Users.getProfile(player);
if (!PP.getPlacedAnvil()) {
if (SpoutConfig.getInstance().spoutEnabled) {
if (mcMMO.p.spoutEnabled) {
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
if (sPlayer.isSpoutCraftEnabled()) {

View File

@ -210,7 +210,7 @@ public class Skills {
String capitalized = Misc.getCapitalized(skillType.toString());
/* Spout Stuff */
if (SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
if (mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
if (sPlayer.isSpoutCraftEnabled()) {
@ -235,7 +235,7 @@ public class Skills {
}
/* Always update XP Bar (Check if no levels were gained first to remove redundancy) */
if (skillups == 0 && SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
if (skillups == 0 && mcMMO.p.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player;
if (sPlayer.isSpoutCraftEnabled()) {
if (SpoutConfig.getInstance().getXPBarEnabled()) {