mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 05:04:43 +02:00
Moved hudType back to PlayerProfile
Removed some convenient methods from PlayerProfile to avoid NPE because of spoutHud
This commit is contained in:
@ -92,7 +92,12 @@ public class McMMOPlayer {
|
||||
else {
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
||||
profile.setSkillXPLevel(skillType, profile.getSkillXpLevel(skillType) + xp);
|
||||
profile.setLastGained(skillType);
|
||||
|
||||
SpoutHud spoutHud = profile.getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.setLastGained(skillType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +167,12 @@ public class McMMOPlayer {
|
||||
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
|
||||
profile.setSkillXPLevel(skillType, profile.getSkillXpLevel(skillType) + xp);
|
||||
profile.setLastGained(skillType);
|
||||
|
||||
SpoutHud spoutHud = profile.getSpoutHud();
|
||||
|
||||
if (spoutHud != null) {
|
||||
spoutHud.setLastGained(skillType);
|
||||
}
|
||||
}
|
||||
|
||||
// Players & Profiles
|
||||
|
@ -20,6 +20,7 @@ public class PlayerProfile {
|
||||
|
||||
/* HUD */
|
||||
private SpoutHud spoutHud;
|
||||
private HudType hudType = SpoutConfig.getInstance().defaultHudType;
|
||||
|
||||
/* Party Stuff */
|
||||
private Party party;
|
||||
@ -98,7 +99,7 @@ public class PlayerProfile {
|
||||
else {
|
||||
for (HudType type : HudType.values()) {
|
||||
if (type.toString().equals(huds.get(1).get(0))) {
|
||||
spoutHud.setHudType(type);
|
||||
hudType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,7 +239,7 @@ public class PlayerProfile {
|
||||
if (character.length > 33) {
|
||||
for (HudType type : HudType.values()) {
|
||||
if (type.toString().equalsIgnoreCase(character[33])) {
|
||||
spoutHud.setHudType(type);
|
||||
hudType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,7 +268,7 @@ public class PlayerProfile {
|
||||
|
||||
// if we are using mysql save to database
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
mcMMO.database.write("UPDATE " + Config.getInstance().getMySQLTablePrefix() + "huds SET hudtype = '" + spoutHud.getHudType().toString() + "' WHERE user_id = " + userId);
|
||||
mcMMO.database.write("UPDATE " + Config.getInstance().getMySQLTablePrefix() + "huds SET hudtype = '" + hudType.toString() + "' WHERE user_id = " + userId);
|
||||
mcMMO.database.write("UPDATE " + Config.getInstance().getMySQLTablePrefix() + "users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + userId);
|
||||
mcMMO.database.write("UPDATE " + Config.getInstance().getMySQLTablePrefix() + "cooldowns SET "
|
||||
+ " mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER)
|
||||
@ -361,7 +362,7 @@ public class PlayerProfile {
|
||||
writer.append(String.valueOf(skillsDATS.get(AbilityType.SERRATED_STRIKES)) + ":");
|
||||
writer.append(String.valueOf(skillsDATS.get(AbilityType.SKULL_SPLIITER)) + ":");
|
||||
writer.append(String.valueOf(skillsDATS.get(AbilityType.SUPER_BREAKER)) + ":");
|
||||
writer.append(spoutHud.getHudType().toString() + ":");
|
||||
writer.append(hudType.toString() + ":");
|
||||
writer.append(skills.get(SkillType.FISHING) + ":");
|
||||
writer.append(skillsXp.get(SkillType.FISHING) + ":");
|
||||
writer.append(String.valueOf(skillsDATS.get(AbilityType.BLAST_MINING)) + ":");
|
||||
@ -475,6 +476,10 @@ public class PlayerProfile {
|
||||
* HUD Stuff
|
||||
*/
|
||||
|
||||
public HudType getHudType() {
|
||||
return hudType;
|
||||
}
|
||||
|
||||
public SpoutHud getSpoutHud() {
|
||||
return spoutHud;
|
||||
}
|
||||
@ -483,44 +488,8 @@ public class PlayerProfile {
|
||||
this.spoutHud = spoutHud;
|
||||
}
|
||||
|
||||
public void setXpBarLocked(boolean locked) {
|
||||
spoutHud.setXpBarLocked(locked);
|
||||
}
|
||||
|
||||
public boolean getXpBarLocked() {
|
||||
return spoutHud.getXpBarLocked();
|
||||
}
|
||||
|
||||
public void toggleXpBarLocked() {
|
||||
spoutHud.toggleXpBarLocked();
|
||||
}
|
||||
|
||||
public void setSkillLock(SkillType type) {
|
||||
spoutHud.setSkillLock(type);
|
||||
}
|
||||
|
||||
public SkillType getSkillLock() {
|
||||
return spoutHud.getSkillLock();
|
||||
}
|
||||
|
||||
public HudType getHudType() {
|
||||
return spoutHud.getHudType();
|
||||
}
|
||||
|
||||
public void setHudType(HudType type) {
|
||||
spoutHud.setHudType(type);
|
||||
}
|
||||
|
||||
public void setLastGained(SkillType type) {
|
||||
spoutHud.setLastGained(type);
|
||||
}
|
||||
|
||||
public SkillType getLastGained() {
|
||||
return spoutHud.getLastGained();
|
||||
}
|
||||
|
||||
public void updateXpBar() {
|
||||
spoutHud.updateXpBar();
|
||||
public void setHudType(HudType hudType) {
|
||||
this.hudType = hudType;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -12,7 +12,6 @@ public class SpoutHud {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
|
||||
private HudType hudType = SpoutConfig.getInstance().defaultHudType;
|
||||
private SkillType lastGained;
|
||||
private SkillType skillLock;
|
||||
private boolean xpBarLocked;
|
||||
@ -36,7 +35,7 @@ public class SpoutHud {
|
||||
xpBar.removeWidgets();
|
||||
}
|
||||
|
||||
xpBar = new XpBar(SpoutManager.getPlayer(player), hudType);
|
||||
xpBar = new XpBar(SpoutManager.getPlayer(player), profile.getHudType());
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,14 +72,6 @@ public class SpoutHud {
|
||||
SpoutManager.getPlayer(player).getMainScreen().removeWidgets(mcMMO.p);
|
||||
}
|
||||
|
||||
public HudType getHudType() {
|
||||
return hudType;
|
||||
}
|
||||
|
||||
public void setHudType(HudType type) {
|
||||
this.hudType = type;
|
||||
}
|
||||
|
||||
public SkillType getLastGained() {
|
||||
return lastGained;
|
||||
}
|
||||
|
Reference in New Issue
Block a user