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