mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-26 02:28:03 +01:00
Minor Spout cleanup.
This commit is contained in:
parent
d5bcb4346e
commit
10e7fe5560
@ -12,7 +12,6 @@ import org.getspout.spoutapi.gui.ScreenType;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.spout.buttons.McmmoButton;
|
||||
import com.gmail.nossr50.spout.huds.SpoutHud;
|
||||
@ -30,14 +29,13 @@ public class SpoutListener implements Listener {
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
|
||||
SpoutPlayer spoutPlayer = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(spoutPlayer);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
//TODO: Add custom titles based on skills
|
||||
if (SpoutTools.showPowerLevel) {
|
||||
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", spoutPlayer.getName(), mcMMOPlayer.getPowerLevel()));
|
||||
}
|
||||
|
||||
profile.setSpoutHud(new SpoutHud(mcMMOPlayer)); //Setup Party HUD stuff
|
||||
mcMMOPlayer.getProfile().setSpoutHud(new SpoutHud(mcMMOPlayer)); //Setup Party HUD stuff
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,40 +1,18 @@
|
||||
package com.gmail.nossr50.spout;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
import org.getspout.spoutapi.sound.SoundManager;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class SpoutSounds {
|
||||
|
||||
/**
|
||||
* Play sound effect through Spout.
|
||||
*
|
||||
* @param effect The sound effect to play
|
||||
* @param player The player to play the sound to
|
||||
* @param location The location the sound should come from
|
||||
*/
|
||||
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location) {
|
||||
SoundManager soundManager = SpoutManager.getSoundManager();
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
soundManager.playSoundEffect(spoutPlayer, effect, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play noise on level-up.
|
||||
*
|
||||
* @param player The player who leveled up
|
||||
*/
|
||||
protected static void playLevelUpNoise(Player player, mcMMO plugin) {
|
||||
SoundManager soundManager = SpoutManager.getSoundManager();
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
//If this is pulling from online, why have it in the jar?
|
||||
soundManager.playCustomSoundEffect(plugin, spoutPlayer, "level.wav", false);
|
||||
SpoutManager.getSoundManager().playCustomSoundEffect(plugin, SpoutManager.getPlayer(player), "level.wav", false);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SpoutTools {
|
||||
private static mcMMO plugin = mcMMO.p;
|
||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
public final static String spoutDirectory = mcMMO.getMainDirectory() + "Resources" + File.separator;
|
||||
public final static String hudDirectory = spoutDirectory + "HUD" + File.separator;
|
||||
@ -146,12 +145,10 @@ public class SpoutTools {
|
||||
continue;
|
||||
}
|
||||
|
||||
String skillTypeString = skillType.toString();
|
||||
String standardFileName = StringUtils.getCapitalized(skillTypeString)+".png";
|
||||
String retroFileName = StringUtils.getCapitalized(skillTypeString)+"_r.png";
|
||||
String skillTypeString = StringUtils.getCapitalized(skillType.toString());
|
||||
|
||||
writeFile(standardFileName, hudStandardDirectory);
|
||||
writeFile(retroFileName, hudRetroDirectory);
|
||||
writeFile(skillTypeString + ".png", hudStandardDirectory);
|
||||
writeFile(skillTypeString + "_r.png", hudRetroDirectory);
|
||||
}
|
||||
|
||||
// Blank icons
|
||||
@ -208,10 +205,10 @@ public class SpoutTools {
|
||||
continue;
|
||||
}
|
||||
|
||||
String skillTypeString = skillType.toString();
|
||||
String skillTypeString = StringUtils.getCapitalized(skillType.toString());
|
||||
|
||||
files.add(new File(hudStandardDirectory + StringUtils.getCapitalized(skillTypeString) + ".png"));
|
||||
files.add(new File(hudRetroDirectory + StringUtils.getCapitalized(skillTypeString) + "_r.png"));
|
||||
files.add(new File(hudStandardDirectory + skillTypeString + ".png"));
|
||||
files.add(new File(hudRetroDirectory + skillTypeString + "_r.png"));
|
||||
}
|
||||
|
||||
// Blank icons
|
||||
@ -280,11 +277,11 @@ public class SpoutTools {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
mat = Material.LAPIS_ORE;
|
||||
mat = Material.DIAMOND_ORE;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
mat = Material.DIAMOND_ORE;
|
||||
mat = Material.EMERALD_ORE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -296,6 +293,9 @@ public class SpoutTools {
|
||||
case WOODCUTTING:
|
||||
switch (notificationTier) {
|
||||
case 1:
|
||||
mat = Material.STICK;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
mat = Material.WOOD;
|
||||
@ -313,31 +313,7 @@ public class SpoutTools {
|
||||
break;
|
||||
|
||||
case REPAIR:
|
||||
switch (notificationTier) {
|
||||
case 1:
|
||||
mat = Material.COBBLESTONE;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mat = Material.IRON_BLOCK;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
mat = Material.GOLD_BLOCK;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
mat = Material.LAPIS_BLOCK;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
mat = Material.DIAMOND_BLOCK;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mat = Material.ANVIL;
|
||||
break;
|
||||
|
||||
case HERBALISM:
|
||||
@ -564,17 +540,17 @@ public class SpoutTools {
|
||||
* @param level The level of the skill
|
||||
* @return the notification tier of the skill
|
||||
*/
|
||||
private static Integer getNotificationTier(Integer level) {
|
||||
if (level >= advancedConfig.getSpoutNotificationTier4()) {
|
||||
private static int getNotificationTier(int level) {
|
||||
if (level >= AdvancedConfig.getInstance().getSpoutNotificationTier4()) {
|
||||
return 5;
|
||||
}
|
||||
else if (level >= advancedConfig.getSpoutNotificationTier3()) {
|
||||
else if (level >= AdvancedConfig.getInstance().getSpoutNotificationTier3()) {
|
||||
return 4;
|
||||
}
|
||||
else if (level >= advancedConfig.getSpoutNotificationTier2()) {
|
||||
else if (level >= AdvancedConfig.getInstance().getSpoutNotificationTier2()) {
|
||||
return 3;
|
||||
}
|
||||
else if (level >= advancedConfig.getSpoutNotificationTier1()) {
|
||||
else if (level >= AdvancedConfig.getInstance().getSpoutNotificationTier1()) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
@ -587,8 +563,7 @@ public class SpoutTools {
|
||||
*/
|
||||
public static void reloadSpoutPlayers() {
|
||||
for (SpoutPlayer spoutPlayer : SpoutManager.getPlayerChunkMap().getOnlinePlayers()) {
|
||||
SpoutCraftEnableEvent spoutCraftEnableEvent = new SpoutCraftEnableEvent(spoutPlayer);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new SpoutCraftEnableEvent(spoutPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,8 +571,7 @@ public class SpoutTools {
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (spoutPlayer != null) {
|
||||
SpoutCraftEnableEvent spoutCraftEnableEvent = new SpoutCraftEnableEvent(spoutPlayer);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new SpoutCraftEnableEvent(spoutPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user