Major refactoring. This WILL break any mcMMO-related plugin that

does not properly hook into the API classes. 

This consolidates the skill-related classes into their own individual
packages, and moves several misc skill classes into the main Skill
package as well. This also moves all Party & Spout related files into
their own respective packages as well.
This commit is contained in:
GJ
2013-01-22 12:43:25 -05:00
parent 00d50953ad
commit 6b0e7a9c61
95 changed files with 233 additions and 239 deletions

View File

@ -0,0 +1,12 @@
package com.gmail.nossr50.spout.huds;
public enum HudType {
DISABLED,
STANDARD,
SMALL,
RETRO;
public HudType getNext() {
return values()[(ordinal() + 1) % values().length];
}
}

View File

@ -0,0 +1,105 @@
package com.gmail.nossr50.spout.huds;
import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.popups.Menu;
import com.gmail.nossr50.datatypes.popups.XpBar;
import com.gmail.nossr50.skills.SkillType;
import com.gmail.nossr50.spout.SpoutConfig;
public class SpoutHud {
private Player player;
private PlayerProfile profile;
private SkillType lastGained;
private SkillType skillLock;
private boolean xpBarLocked;
private Menu menu;
private XpBar xpBar;
public SpoutHud(McMMOPlayer mcMMOPlayer) {
this.player = mcMMOPlayer.getPlayer();
this.profile = mcMMOPlayer.getProfile();
initializeXpBar();
}
/**
* Initialize the HUD.
*/
public void initializeXpBar() {
if (SpoutConfig.getInstance().getXPBarEnabled()) {
if (xpBar != null) {
xpBar.removeWidgets();
}
xpBar = new XpBar(SpoutManager.getPlayer(player), profile.getHudType());
}
}
/**
* Update the XP bar.
*/
public void updateXpBar() {
SkillType skillType = xpBarLocked ? skillLock : lastGained;
if (skillType == null) {
return;
}
xpBar.update(skillType, profile);
}
public boolean isMenuOpened() {
return (menu != null) ? true : false;
}
public void openMenu() {
menu = new Menu(SpoutManager.getPlayer(player), profile);
}
public void onMenuClose() {
menu = null;
}
public void removeWidgets() {
if (menu != null) {
menu.close();
}
SpoutManager.getPlayer(player).getMainScreen().removeWidgets(mcMMO.p);
}
public SkillType getLastGained() {
return lastGained;
}
public void setLastGained(SkillType type) {
this.lastGained = type;
}
public boolean getXpBarLocked() {
return xpBarLocked;
}
public void setXpBarLocked(boolean locked) {
this.xpBarLocked = locked;
}
public void toggleXpBarLocked() {
xpBarLocked = !xpBarLocked;
}
public SkillType getSkillLock() {
return skillLock;
}
public void setSkillLock(SkillType type) {
this.skillLock = type;
}
}