Moved Spout stuff to its own config file.

This commit is contained in:
GJ 2012-05-23 10:50:47 -04:00
parent 9525ce8299
commit 63f683982f
19 changed files with 311 additions and 213 deletions

View File

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

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor {
return true; return true;
} }
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled()) { if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -26,7 +27,7 @@ public class XplockCommand implements CommandExecutor {
return true; return true;
} }
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) { if (!SpoutConfig.getInstance().spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }

View File

@ -372,66 +372,6 @@ public class Config extends ConfigLoader {
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); } public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); } public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
/*
* SPOUT SETTINGS
*/
public boolean spoutEnabled;
public boolean getShowPowerLevelForSpout() { return config.getBoolean("Spout.HUD.Show_Power_Level", true); }
/* Spout XP Bar */
public boolean getSpoutXPBarEnabled() { return config.getBoolean("Spout.XP.Bar.Enabled", true); }
public boolean getSpoutXPBarIconEnabled() { return config.getBoolean("Spout.XP.Icon.Enabled", true); }
public int getSpoutXPBarXPosition() { return config.getInt("Spout.XP.Bar.X_POS", 95); }
public int getSpoutXPBarYPosition() { return config.getInt("Spout.XP.Bar.Y_POS", 6); }
public int getSpoutXPIconXPosition() { return config.getInt("Spout.XP.Icon.X_POS", 78); }
public int getSpoutXPIconYPosition() { return config.getInt("Spout.XP.Icon.Y_POS", 2); }
/* Spout HUD Colors */
public double getSpoutRetroHUDXPBorderRed() { return config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); }
public double getSpoutRetroHUDXPBorderGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); }
public double getSpoutRetroHUDXPBorderBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); }
public double getSpoutRetroHUDXPBackgroundRed() { return config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); }
public double getSpoutRetroHUDXPBackgroundGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); }
public double getSpoutRetroHUDXPBackgroundBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); }
public double getSpoutRetroHUDAcrobaticsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); }
public double getSpoutRetroHUDAcrobaticsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); }
public double getSpoutRetroHUDAcrobaticsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); }
public double getSpoutRetroHUDArcheryRed() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); }
public double getSpoutRetroHUDArcheryGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); }
public double getSpoutRetroHUDArcheryBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); }
public double getSpoutRetroHUDAxesRed() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); }
public double getSpoutRetroHUDAxesGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); }
public double getSpoutRetroHUDAxesBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); }
public double getSpoutRetroHUDExcavationRed() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); }
public double getSpoutRetroHUDExcavationGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); }
public double getSpoutRetroHUDExcavationBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); }
public double getSpoutRetroHUDHerbalismRed() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); }
public double getSpoutRetroHUDHerbalismGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); }
public double getSpoutRetroHUDHerbalismBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); }
public double getSpoutRetroHUDMiningRed() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); }
public double getSpoutRetroHUDMiningGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); }
public double getSpoutRetroHUDMiningBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); }
public double getSpoutRetroHUDRepairRed() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); }
public double getSpoutRetroHUDRepairGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); }
public double getSpoutRetroHUDRepairBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); }
public double getSpoutRetroHUDSwordsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); }
public double getSpoutRetroHUDSwordsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); }
public double getSpoutRetroHUDSwordsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); }
public double getSpoutRetroHUDTamingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); }
public double getSpoutRetroHUDTamingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); }
public double getSpoutRetroHUDTamingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); }
public double getSpoutRetroHUDUnarmedRed() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); }
public double getSpoutRetroHUDUnarmedGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); }
public double getSpoutRetroHUDUnarmedBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); }
public double getSpoutRetroHUDWoodcuttingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); }
public double getSpoutRetroHUDWoodcuttingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); }
public double getSpoutRetroHUDWoodcuttingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); }
public double getSpoutRetroHUDFishingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); }
public double getSpoutRetroHUDFishingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); }
public double getSpoutRetroHUDFishingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); }
/* /*
* CONFIG LOADING * CONFIG LOADING
*/ */
@ -458,18 +398,5 @@ public class Config extends ConfigLoader {
@Override @Override
protected void loadKeys() { protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO config.yml File..."); plugin.getLogger().info("Loading mcMMO config.yml File...");
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().toLowerCase().equalsIgnoreCase(temp.toString().toLowerCase())) {
defaulthud = x;
}
}
if (defaulthud == null) {
defaulthud = HUDType.STANDARD;
}
} }
} }

View File

@ -0,0 +1,113 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType;
public class SpoutConfig extends ConfigLoader {
private static SpoutConfig instance;
public static SpoutConfig getInstance() {
if (instance == null) {
instance = new SpoutConfig(mcMMO.p);
}
return instance;
}
public HUDType defaulthud;
public SpoutConfig(mcMMO plugin) {
super(plugin, "spout.yml");
config = plugin.getSpoutConfig();
}
/*
* SPOUT SETTINGS
*/
public boolean spoutEnabled;
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
/* Spout XP Bar */
public boolean getXPBarEnabled() { return config.getBoolean("XP.Bar.Enabled", true); }
public boolean getXPBarIconEnabled() { return config.getBoolean("XP.Icon.Enabled", true); }
public int getXPBarXPosition() { return config.getInt("XP.Bar.X_POS", 95); }
public int getXPBarYPosition() { return config.getInt("XP.Bar.Y_POS", 6); }
public int getXPIconXPosition() { return config.getInt("XP.Icon.X_POS", 78); }
public int getXPIconYPosition() { return config.getInt("XP.Icon.Y_POS", 2); }
/* Spout HUD Colors */
public double getRetroHUDXPBorderRed() { return config.getDouble("HUD.Retro.Colors.Border.RED", 0.0); }
public double getRetroHUDXPBorderGreen() { return config.getDouble("HUD.Retro.Colors.Border.GREEN", 0.0); }
public double getRetroHUDXPBorderBlue() { return config.getDouble("HUD.Retro.Colors.Border.BLUE", 0.0); }
public double getRetroHUDXPBackgroundRed() { return config.getDouble("HUD.Retro.Colors.Background.RED", 0.75); }
public double getRetroHUDXPBackgroundGreen() { return config.getDouble("HUD.Retro.Colors.Background.GREEN", 0.75); }
public double getRetroHUDXPBackgroundBlue() { return config.getDouble("HUD.Retro.Colors.Background.BLUE", 0.75); }
public double getRetroHUDAcrobaticsRed() { return config.getDouble("HUD.Retro.Colors.Acrobatics.RED", 0.3); }
public double getRetroHUDAcrobaticsGreen() { return config.getDouble("HUD.Retro.Colors.Acrobatics.GREEN", 0.3); }
public double getRetroHUDAcrobaticsBlue() { return config.getDouble("HUD.Retro.Colors.Acrobatics.BLUE", 0.75); }
public double getRetroHUDArcheryRed() { return config.getDouble("HUD.Retro.Colors.Archery.RED", 0.3); }
public double getRetroHUDArcheryGreen() { return config.getDouble("HUD.Retro.Colors.Archery.GREEN", 0.3); }
public double getRetroHUDArcheryBlue() { return config.getDouble("HUD.Retro.Colors.Archery.BLUE", 0.75); }
public double getRetroHUDAxesRed() { return config.getDouble("HUD.Retro.Colors.Axes.RED", 0.3); }
public double getRetroHUDAxesGreen() { return config.getDouble("HUD.Retro.Colors.Axes.GREEN", 0.3); }
public double getRetroHUDAxesBlue() { return config.getDouble("HUD.Retro.Colors.Axes.BLUE", 0.75); }
public double getRetroHUDExcavationRed() { return config.getDouble("HUD.Retro.Colors.Excavation.RED", 0.3); }
public double getRetroHUDExcavationGreen() { return config.getDouble("HUD.Retro.Colors.Excavation.GREEN", 0.3); }
public double getRetroHUDExcavationBlue() { return config.getDouble("HUD.Retro.Colors.Excavation.BLUE", 0.75); }
public double getRetroHUDHerbalismRed() { return config.getDouble("HUD.Retro.Colors.Herbalism.RED", 0.3); }
public double getRetroHUDHerbalismGreen() { return config.getDouble("HUD.Retro.Colors.Herbalism.GREEN", 0.3); }
public double getRetroHUDHerbalismBlue() { return config.getDouble("HUD.Retro.Colors.Herbalism.BLUE", 0.75); }
public double getRetroHUDMiningRed() { return config.getDouble("HUD.Retro.Colors.Mining.RED", 0.3); }
public double getRetroHUDMiningGreen() { return config.getDouble("HUD.Retro.Colors.Mining.GREEN", 0.3); }
public double getRetroHUDMiningBlue() { return config.getDouble("HUD.Retro.Colors.Mining.BLUE", 0.75); }
public double getRetroHUDRepairRed() { return config.getDouble("HUD.Retro.Colors.Repair.RED", 0.3); }
public double getRetroHUDRepairGreen() { return config.getDouble("HUD.Retro.Colors.Repair.GREEN", 0.3); }
public double getRetroHUDRepairBlue() { return config.getDouble("HUD.Retro.Colors.Repair.BLUE", 0.75); }
public double getRetroHUDSwordsRed() { return config.getDouble("HUD.Retro.Colors.Swords.RED", 0.3); }
public double getRetroHUDSwordsGreen() { return config.getDouble("HUD.Retro.Colors.Swords.GREEN", 0.3); }
public double getRetroHUDSwordsBlue() { return config.getDouble("HUD.Retro.Colors.Swords.BLUE", 0.75); }
public double getRetroHUDTamingRed() { return config.getDouble("HUD.Retro.Colors.Taming.RED", 0.3); }
public double getRetroHUDTamingGreen() { return config.getDouble("HUD.Retro.Colors.Taming.GREEN", 0.3); }
public double getRetroHUDTamingBlue() { return config.getDouble("HUD.Retro.Colors.Taming.BLUE", 0.75); }
public double getRetroHUDUnarmedRed() { return config.getDouble("HUD.Retro.Colors.Unarmed.RED", 0.3); }
public double getRetroHUDUnarmedGreen() { return config.getDouble("HUD.Retro.Colors.Unarmed.GREEN", 0.3); }
public double getRetroHUDUnarmedBlue() { return config.getDouble("HUD.Retro.Colors.Unarmed.BLUE", 0.75); }
public double getRetroHUDWoodcuttingRed() { return config.getDouble("HUD.Retro.Colors.Woodcutting.RED", 0.3); }
public double getRetroHUDWoodcuttingGreen() { return config.getDouble("HUD.Retro.Colors.Woodcutting.GREEN", 0.3); }
public double getRetroHUDWoodcuttingBlue() { return config.getDouble("HUD.Retro.Colors.Woodcutting.BLUE", 0.75); }
public double getRetroHUDFishingRed() { return config.getDouble("HUD.Retro.Colors.Fishing.RED", 0.3); }
public double getRetroHUDFishingGreen() { return config.getDouble("HUD.Retro.Colors.Fishing.GREEN", 0.3); }
public double getRetroHUDFishingBlue() { return config.getDouble("HUD.Retro.Colors.Fishing.BLUE", 0.75); }
@Override
public void load() {
if (!configFile.exists()) {
dataFolder.mkdir();
plugin.saveSpoutConfig();
}
addDefaults();
loadKeys();
}
@Override
protected void loadKeys() {
plugin.getLogger().info("Loading mcMMO spout.yml File...");
// Setup default HUD
String temp = config.getString("Spout.HUD.Default", "STANDARD");
for (HUDType x : HUDType.values()) {
if (x.toString().equalsIgnoreCase(temp.toString())) {
defaulthud = x;
}
}
if (defaulthud == null) {
defaulthud = HUDType.STANDARD;
}
}
}

View File

@ -10,7 +10,7 @@ import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -119,9 +119,9 @@ public class HUDmmo {
* @param sPlayer Player to initialize XP bar for * @param sPlayer Player to initialize XP bar for
*/ */
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) { private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) {
Color border = new Color((float) Config.getInstance().getSpoutRetroHUDXPBorderRed(), (float) Config.getInstance().getSpoutRetroHUDXPBorderGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBorderBlue(), 1f); Color border = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBorderRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderBlue(), 1f);
Color green = new Color(0f, 1f, 0f, 1f); Color green = new Color(0f, 1f, 0f, 1f);
Color background = new Color((float) Config.getInstance().getSpoutRetroHUDXPBackgroundRed(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundBlue(), 1f); Color background = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBackgroundRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundBlue(), 1f);
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f); Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpicon = new GenericTexture(); xpicon = new GenericTexture();
@ -185,12 +185,12 @@ public class HUDmmo {
xpbg.setPriority(RenderPriority.Low); xpbg.setPriority(RenderPriority.Low);
xpbg.setDirty(true); xpbg.setDirty(true);
if (Config.getInstance().getSpoutXPBarEnabled()) { if (SpoutConfig.getInstance().getXPBarEnabled()) {
sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpfill); sPlayer.getMainScreen().attachWidget(plugin, xpfill);
sPlayer.getMainScreen().attachWidget(plugin, xpbg); sPlayer.getMainScreen().attachWidget(plugin, xpbg);
if (Config.getInstance().getSpoutXPBarIconEnabled()) { if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
sPlayer.getMainScreen().attachWidget(plugin, xpicon); sPlayer.getMainScreen().attachWidget(plugin, xpicon);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg); sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg);
sPlayer.getMainScreen().attachWidget(plugin, xpicon_border); sPlayer.getMainScreen().attachWidget(plugin, xpicon_border);
@ -206,26 +206,26 @@ public class HUDmmo {
* @param sPlayer Player to initialize XP bar for * @param sPlayer Player to initialize XP bar for
*/ */
public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) { public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) {
if (Config.getInstance().getSpoutXPBarEnabled()) { if (SpoutConfig.getInstance().getXPBarEnabled()) {
xpbar = new GenericTexture(); xpbar = new GenericTexture();
((GenericTexture) xpbar).setUrl("xpbar_inc000.png"); ((GenericTexture) xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(Config.getInstance().getSpoutXPBarXPosition()); xpbar.setX(SpoutConfig.getInstance().getXPBarXPosition());
xpbar.setY(Config.getInstance().getSpoutXPBarYPosition()); xpbar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpbar.setHeight(8); xpbar.setHeight(8);
xpbar.setWidth(256); xpbar.setWidth(256);
sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (Config.getInstance().getSpoutXPBarIconEnabled()) { if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpicon = new GenericTexture(); xpicon = new GenericTexture();
xpicon.setUrl("Icon.png"); xpicon.setUrl("Icon.png");
xpicon.setHeight(16); xpicon.setHeight(16);
xpicon.setWidth(32); xpicon.setWidth(32);
xpicon.setX(Config.getInstance().getSpoutXPIconXPosition()); xpicon.setX(SpoutConfig.getInstance().getXPIconXPosition());
xpicon.setY(Config.getInstance().getSpoutXPIconYPosition()); xpicon.setY(SpoutConfig.getInstance().getXPIconYPosition());
xpicon.setDirty(true); xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon); sPlayer.getMainScreen().attachWidget(plugin, xpicon);
@ -241,25 +241,25 @@ public class HUDmmo {
* @param sPlayer Player to initialize XP bar for * @param sPlayer Player to initialize XP bar for
*/ */
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) { private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) {
if (Config.getInstance().getSpoutXPBarEnabled()) { if (SpoutConfig.getInstance().getXPBarEnabled()) {
xpbar = new GenericTexture(); xpbar = new GenericTexture();
((GenericTexture)xpbar).setUrl("xpbar_inc000.png"); ((GenericTexture)xpbar).setUrl("xpbar_inc000.png");
xpbar.setX(center_x - 64); xpbar.setX(center_x - 64);
xpbar.setY(Config.getInstance().getSpoutXPBarYPosition()); xpbar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpbar.setHeight(4); xpbar.setHeight(4);
xpbar.setWidth(128); xpbar.setWidth(128);
sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpbar);
if (Config.getInstance().getSpoutXPBarIconEnabled()) { if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpicon = new GenericTexture(); xpicon = new GenericTexture();
xpicon.setUrl("Icon.png"); xpicon.setUrl("Icon.png");
xpicon.setHeight(8); xpicon.setHeight(8);
xpicon.setWidth(16); xpicon.setWidth(16);
xpicon.setX(center_x - (8 + 64)); xpicon.setX(center_x - (8 + 64));
xpicon.setY(Config.getInstance().getSpoutXPIconYPosition() + 2); xpicon.setY(SpoutConfig.getInstance().getXPIconYPosition() + 2);
xpicon.setDirty(true); xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon); sPlayer.getMainScreen().attachWidget(plugin, xpicon);
@ -276,7 +276,7 @@ public class HUDmmo {
* @param PP Profile of the given player * @param PP Profile of the given player
*/ */
private void updateXpBarStandard(Player player, PlayerProfile PP) { private void updateXpBarStandard(Player player, PlayerProfile PP) {
if (!Config.getInstance().getSpoutXPBarEnabled()) { if (!SpoutConfig.getInstance().getXPBarEnabled()) {
return; return;
} }
@ -302,7 +302,7 @@ public class HUDmmo {
* @param PP Profile of the given player * @param PP Profile of the given player
*/ */
private void updateXpBarRetro(Player player, PlayerProfile PP) { private void updateXpBarRetro(Player player, PlayerProfile PP) {
if (!Config.getInstance().getSpoutXPBarEnabled()) { if (!SpoutConfig.getInstance().getXPBarEnabled()) {
return; return;
} }
@ -327,40 +327,40 @@ public class HUDmmo {
private static Color getRetroColor(SkillType type) { private static Color getRetroColor(SkillType type) {
switch (type) { switch (type) {
case ACROBATICS: case ACROBATICS:
return new Color((float) Config.getInstance().getSpoutRetroHUDAcrobaticsRed(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsGreen(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDAcrobaticsRed(), (float) SpoutConfig.getInstance().getRetroHUDAcrobaticsGreen(), (float) SpoutConfig.getInstance().getRetroHUDAcrobaticsBlue(), 1f);
case ARCHERY: case ARCHERY:
return new Color((float) Config.getInstance().getSpoutRetroHUDArcheryRed(), (float) Config.getInstance().getSpoutRetroHUDArcheryGreen(), (float) Config.getInstance().getSpoutRetroHUDArcheryBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDArcheryRed(), (float) SpoutConfig.getInstance().getRetroHUDArcheryGreen(), (float) SpoutConfig.getInstance().getRetroHUDArcheryBlue(), 1f);
case AXES: case AXES:
return new Color((float) Config.getInstance().getSpoutRetroHUDAxesRed(), (float) Config.getInstance().getSpoutRetroHUDAxesGreen(), (float) Config.getInstance().getSpoutRetroHUDAxesBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDAxesRed(), (float) SpoutConfig.getInstance().getRetroHUDAxesGreen(), (float) SpoutConfig.getInstance().getRetroHUDAxesBlue(), 1f);
case EXCAVATION: case EXCAVATION:
return new Color((float) Config.getInstance().getSpoutRetroHUDExcavationRed(), (float) Config.getInstance().getSpoutRetroHUDExcavationGreen(), (float) Config.getInstance().getSpoutRetroHUDExcavationBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDExcavationRed(), (float) SpoutConfig.getInstance().getRetroHUDExcavationGreen(), (float) SpoutConfig.getInstance().getRetroHUDExcavationBlue(), 1f);
case HERBALISM: case HERBALISM:
return new Color((float) Config.getInstance().getSpoutRetroHUDHerbalismRed(), (float) Config.getInstance().getSpoutRetroHUDHerbalismGreen(), (float) Config.getInstance().getSpoutRetroHUDHerbalismBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDHerbalismRed(), (float) SpoutConfig.getInstance().getRetroHUDHerbalismGreen(), (float) SpoutConfig.getInstance().getRetroHUDHerbalismBlue(), 1f);
case MINING: case MINING:
return new Color((float) Config.getInstance().getSpoutRetroHUDMiningRed(), (float) Config.getInstance().getSpoutRetroHUDMiningGreen(), (float) Config.getInstance().getSpoutRetroHUDMiningBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDMiningRed(), (float) SpoutConfig.getInstance().getRetroHUDMiningGreen(), (float) SpoutConfig.getInstance().getRetroHUDMiningBlue(), 1f);
case REPAIR: case REPAIR:
return new Color((float) Config.getInstance().getSpoutRetroHUDRepairRed(), (float) Config.getInstance().getSpoutRetroHUDRepairGreen(), (float) Config.getInstance().getSpoutRetroHUDRepairBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDRepairRed(), (float) SpoutConfig.getInstance().getRetroHUDRepairGreen(), (float) SpoutConfig.getInstance().getRetroHUDRepairBlue(), 1f);
case SWORDS: case SWORDS:
return new Color((float) Config.getInstance().getSpoutRetroHUDSwordsRed(), (float) Config.getInstance().getSpoutRetroHUDSwordsGreen(), (float) Config.getInstance().getSpoutRetroHUDSwordsBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDSwordsRed(), (float) SpoutConfig.getInstance().getRetroHUDSwordsGreen(), (float) SpoutConfig.getInstance().getRetroHUDSwordsBlue(), 1f);
case TAMING: case TAMING:
return new Color((float) Config.getInstance().getSpoutRetroHUDTamingRed(), (float) Config.getInstance().getSpoutRetroHUDTamingGreen(), (float) Config.getInstance().getSpoutRetroHUDTamingBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDTamingRed(), (float) SpoutConfig.getInstance().getRetroHUDTamingGreen(), (float) SpoutConfig.getInstance().getRetroHUDTamingBlue(), 1f);
case UNARMED: case UNARMED:
return new Color((float) Config.getInstance().getSpoutRetroHUDUnarmedRed(), (float) Config.getInstance().getSpoutRetroHUDUnarmedGreen(), (float) Config.getInstance().getSpoutRetroHUDUnarmedBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDUnarmedRed(), (float) SpoutConfig.getInstance().getRetroHUDUnarmedGreen(), (float) SpoutConfig.getInstance().getRetroHUDUnarmedBlue(), 1f);
case WOODCUTTING: case WOODCUTTING:
return new Color((float) Config.getInstance().getSpoutRetroHUDWoodcuttingRed(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingGreen(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDWoodcuttingRed(), (float) SpoutConfig.getInstance().getRetroHUDWoodcuttingGreen(), (float) SpoutConfig.getInstance().getRetroHUDWoodcuttingBlue(), 1f);
case FISHING: case FISHING:
return new Color((float) Config.getInstance().getSpoutRetroHUDFishingRed(), (float) Config.getInstance().getSpoutRetroHUDFishingGreen(), (float) Config.getInstance().getSpoutRetroHUDFishingBlue(), 1f); return new Color((float) SpoutConfig.getInstance().getRetroHUDFishingRed(), (float) SpoutConfig.getInstance().getRetroHUDFishingGreen(), (float) SpoutConfig.getInstance().getRetroHUDFishingBlue(), 1f);
default: default:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color(0.3f, 0.3f, 0.75f, 1f);

View File

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

View File

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

View File

@ -7,7 +7,7 @@ import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
@ -32,9 +32,8 @@ public class SpoutListener implements Listener {
PlayerProfile PPs = Users.getProfile(sPlayer); PlayerProfile PPs = Users.getProfile(sPlayer);
//TODO: Add custom titles based on skills //TODO: Add custom titles based on skills
if (Config.getInstance().getShowPowerLevelForSpout()) { if (SpoutConfig.getInstance().getShowPowerLevel()) {
sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE+"." + ChatColor.GREEN + String.valueOf(PPs.getPowerLevel()));
+ ChatColor.WHITE+"." + ChatColor.GREEN + String.valueOf(PPs.getPowerLevel()));
} }
if (sPlayer.isSpoutCraftEnabled()) { if (sPlayer.isSpoutCraftEnabled()) {

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.commands.general.*;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig; import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.RepairConfigManager; import com.gmail.nossr50.config.RepairConfigManager;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.config.TreasuresConfig; import com.gmail.nossr50.config.TreasuresConfig;
import com.gmail.nossr50.config.mods.CustomBlocksConfig; import com.gmail.nossr50.config.mods.CustomBlocksConfig;
import com.gmail.nossr50.config.mods.CustomArmorConfig; import com.gmail.nossr50.config.mods.CustomArmorConfig;
@ -84,6 +85,7 @@ public class mcMMO extends JavaPlugin {
Config configInstance = Config.getInstance(); Config configInstance = Config.getInstance();
TreasuresConfig.getInstance(); TreasuresConfig.getInstance();
HiddenConfig.getInstance(); HiddenConfig.getInstance();
SpoutConfig.getInstance().load();
List<Repairable> repairables = new ArrayList<Repairable>(); List<Repairable> repairables = new ArrayList<Repairable>();
@ -599,6 +601,59 @@ public class mcMMO extends JavaPlugin {
} }
} }
/*
* Boilerplate Custom Config Stuff (Spout)
*/
private FileConfiguration spoutConfig = null;
private File spoutConfigFile = null;
/**
* Reload the Spout.yml file.
*/
public void reloadSpoutConfig() {
if (spoutConfigFile == null) {
spoutConfigFile = new File(modDirectory, "spout.yml");
}
spoutConfig = YamlConfiguration.loadConfiguration(spoutConfigFile);
if (isInJar("spout.yml")) {
InputStream defConfigStream = getResource("spout.yml");
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
spoutConfig.setDefaults(defConfig);
}
}
/**
* Get the Spout config information.
*
* @return the configuration object for spout.yml
*/
public FileConfiguration getSpoutConfig() {
if (spoutConfig == null) {
reloadSpoutConfig();
}
return spoutConfig;
}
/**
* Save the Spout config informtion.
*/
public void saveSpoutConfig() {
if (spoutConfig == null || spoutConfigFile == null) {
return;
}
try {
spoutConfig.save(spoutConfigFile);
}
catch (IOException ex) {
getLogger().severe("Could not save config to " + spoutConfigFile + ex.toString());
}
}
public boolean isInJar(String resource) { public boolean isInJar(String resource) {
InputStream iStream = getResource(resource); InputStream iStream = getResource(resource);
return iStream != null; return iStream != null;

View File

@ -4,7 +4,7 @@ import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.FileManager; import org.getspout.spoutapi.player.FileManager;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class SpoutStart implements Runnable{ public class SpoutStart implements Runnable{
@ -17,14 +17,14 @@ public class SpoutStart implements Runnable{
@Override @Override
public void run() { public void run() {
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) { if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
Config.getInstance().spoutEnabled = true; SpoutConfig.getInstance().spoutEnabled = true;
} }
else { else {
Config.getInstance().spoutEnabled = false; SpoutConfig.getInstance().spoutEnabled = false;
} }
//Spout Stuff //Spout Stuff
if (Config.getInstance().spoutEnabled) { if (SpoutConfig.getInstance().spoutEnabled) {
SpoutStuff.setupSpoutConfigs(); SpoutStuff.setupSpoutConfigs();
SpoutStuff.registerCustomEvent(); SpoutStuff.registerCustomEvent();
SpoutStuff.extractFiles(); //Extract source materials SpoutStuff.extractFiles(); //Extract source materials

View File

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

View File

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

View File

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

View File

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

View File

@ -138,7 +138,7 @@ public class SpoutStuff {
* Setup Spout config options * Setup Spout config options
*/ */
public static void setupSpoutConfigs() { public static void setupSpoutConfigs() {
String temp = plugin.getConfig().getString("Spout.Menu.Key", "KEY_M"); String temp = plugin.getSpoutConfig().getString("Menu.Key", "KEY_M");
for (Keyboard x : Keyboard.values()) { for (Keyboard x : Keyboard.values()) {
if (x.toString().equalsIgnoreCase(temp)) { if (x.toString().equalsIgnoreCase(temp)) {
@ -147,7 +147,7 @@ public class SpoutStuff {
} }
if (keypress == null) { if (keypress == null) {
System.out.println("Invalid KEY for Spout.Menu.Key, using KEY_M"); System.out.println("Invalid KEY for Menu.Key, using KEY_M");
keypress = Keyboard.KEY_M; keypress = Keyboard.KEY_M;
} }
} }

View File

@ -13,6 +13,7 @@ import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -209,18 +210,18 @@ public class Skills {
String capitalized = Misc.getCapitalized(skillType.toString()); String capitalized = Misc.getCapitalized(skillType.toString());
/* Spout Stuff */ /* Spout Stuff */
if (Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) { if (SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = SpoutManager.getPlayer(player); SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
if (sPlayer.isSpoutCraftEnabled()) { if (sPlayer.isSpoutCraftEnabled()) {
if (Config.getInstance().getSpoutXPBarEnabled()) { if (SpoutConfig.getInstance().getXPBarEnabled()) {
SpoutStuff.updateXpBar(player); SpoutStuff.updateXpBar(player);
} }
SpoutStuff.levelUpNotification(skillType, sPlayer); SpoutStuff.levelUpNotification(skillType, sPlayer);
/* Update custom titles */ /* Update custom titles */
if (Config.getInstance().getShowPowerLevelForSpout()) { if (SpoutConfig.getInstance().getShowPowerLevel()) {
sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE + "." + ChatColor.GREEN + String.valueOf(PP.getPowerLevel())); sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE + "." + ChatColor.GREEN + String.valueOf(PP.getPowerLevel()));
} }
} }
@ -234,10 +235,10 @@ public class Skills {
} }
/* Always update XP Bar (Check if no levels were gained first to remove redundancy) */ /* Always update XP Bar (Check if no levels were gained first to remove redundancy) */
if (skillups == 0 && Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) { if (skillups == 0 && SpoutConfig.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player; SpoutPlayer sPlayer = (SpoutPlayer) player;
if (sPlayer.isSpoutCraftEnabled()) { if (sPlayer.isSpoutCraftEnabled()) {
if (Config.getInstance().getSpoutXPBarEnabled()) { if (SpoutConfig.getInstance().getXPBarEnabled()) {
SpoutStuff.updateXpBar(player); SpoutStuff.updateXpBar(player);
} }
} }

View File

@ -345,85 +345,3 @@ Commands:
Enabled: true Enabled: true
a: a:
Enabled: true Enabled: true
#
# Settings for Spout features
###
Spout:
Menu:
Key: KEY_M
XP:
Bar:
Enabled: true
X_POS: 95
Y_POS: 6
Icon:
Enabled: true
X_POS: 78
Y_POS: 2
Party:
HUD:
Show_Faces: true
Enabled: true
Show_Display_Name: false
HUD:
Show_Power_Level: true
Default: STANDARD
Retro:
Colors:
Swords:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Taming:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Acrobatics:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Border:
BLUE: 0.0
GREEN: 0.0
RED: 0.0
Background:
BLUE: 0.75
GREEN: 0.75
RED: 0.75
Woodcutting:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Archery:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Axes:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Repair:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Fishing:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Excavation:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Herbalism:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Unarmed:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Mining:
BLUE: 0.75
GREEN: 0.3
RED: 0.3

View File

@ -0,0 +1,77 @@
Menu:
Key: KEY_M
XP:
Bar:
Enabled: true
X_POS: 95
Y_POS: 6
Icon:
Enabled: true
X_POS: 78
Y_POS: 2
Party:
HUD:
Show_Faces: true
Enabled: true
Show_Display_Name: false
HUD:
Show_Power_Level: true
Default: STANDARD
Retro:
Colors:
Swords:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Taming:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Acrobatics:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Border:
BLUE: 0.0
GREEN: 0.0
RED: 0.0
Background:
BLUE: 0.75
GREEN: 0.75
RED: 0.75
Woodcutting:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Archery:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Axes:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Repair:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Fishing:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Excavation:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Herbalism:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Unarmed:
BLUE: 0.75
GREEN: 0.3
RED: 0.3
Mining:
BLUE: 0.75
GREEN: 0.3
RED: 0.3