mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 00:45:27 +01:00
Fixing some issues with scoreboards, it's getting late so I'll take a better look at them in the morning.
This commit is contained in:
parent
1d62f8b177
commit
b572c0aea9
@ -676,6 +676,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
|
||||
|
||||
|
||||
/* GENERAL */
|
||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||
|
@ -8,6 +8,7 @@ public enum NotificationType {
|
||||
SUBSKILL_UNLOCKED("SubSkillUnlocked"),
|
||||
LEVEL_UP_MESSAGE("LevelUps"),
|
||||
SUBSKILL_MESSAGE("SubSkillInteraction"),
|
||||
SUBSKILL_MESSAGE_FAILURE("SubSkillFailure"),
|
||||
TOOL("ToolReady"),
|
||||
UNSKILLED("LevelRequirementNotMet"),
|
||||
ABILITY_OFF("AbilityOff"),
|
||||
|
@ -19,7 +19,7 @@ public class McMMOPlayerNotificationEvent extends PlayerEvent implements Cancell
|
||||
protected TextComponent notificationTextComponent;
|
||||
protected final NotificationType notificationType;
|
||||
|
||||
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, net.md_5.bungee.api.chat.TextComponent notificationTextComponent, ChatMessageType chatMessageType) {
|
||||
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, TextComponent notificationTextComponent, ChatMessageType chatMessageType) {
|
||||
super(who);
|
||||
this.notificationType = notificationType;
|
||||
this.notificationTextComponent = notificationTextComponent;
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.TextComponentFactory;
|
||||
|
@ -59,13 +59,13 @@ public class Taming {
|
||||
protected static String getCallOfTheWildFailureMessage(EntityType type) {
|
||||
switch (type) {
|
||||
case OCELOT:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Ocelot");
|
||||
return "Taming.Summon.Fail.Ocelot";
|
||||
|
||||
case WOLF:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Wolf");
|
||||
return "Taming.Summon.Fail.Wolf";
|
||||
|
||||
case HORSE:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Horse");
|
||||
return "Taming.Summon.Fail.Horse";
|
||||
|
||||
default:
|
||||
return "";
|
||||
|
@ -3,12 +3,14 @@ package com.gmail.nossr50.skills.taming;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActivationCheckEvent;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
@ -328,7 +330,7 @@ public class TamingManager extends SkillManager {
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||
if (entity.getType() == type) {
|
||||
player.sendMessage(Taming.getCallOfTheWildFailureMessage(type));
|
||||
InteractionManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, Taming.getCallOfTheWildFailureMessage(type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerSkillScoreboard(Player player, PrimarySkill skill) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(skill);
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getSkillScoreboardTime());
|
||||
@ -273,7 +273,7 @@ public class ScoreboardManager {
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(skill);
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getSkillLevelUpTime());
|
||||
@ -282,7 +282,7 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerStatsScoreboard(Player player) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSelfStats();
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getStatsScoreboardTime());
|
||||
@ -291,7 +291,7 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerInspectScoreboard(Player player, PlayerProfile targetProfile) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectStats(targetProfile);
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getInspectScoreboardTime());
|
||||
@ -300,7 +300,7 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerCooldownScoreboard(Player player) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeCooldowns();
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getCooldownScoreboardTime());
|
||||
@ -309,7 +309,7 @@ public class ScoreboardManager {
|
||||
public static void showPlayerRankScoreboard(Player player, Map<PrimarySkill, Integer> rank) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSelfRank();
|
||||
wrapper.acceptRankData(rank);
|
||||
|
||||
@ -319,7 +319,7 @@ public class ScoreboardManager {
|
||||
public static void showPlayerRankScoreboardOthers(Player player, String targetName, Map<PrimarySkill, Integer> rank) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectRank(targetName);
|
||||
wrapper.acceptRankData(rank);
|
||||
|
||||
@ -329,7 +329,7 @@ public class ScoreboardManager {
|
||||
public static void showTopScoreboard(Player player, PrimarySkill skill, int pageNumber, List<PlayerStat> stats) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeTop(skill, pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
|
||||
@ -339,7 +339,7 @@ public class ScoreboardManager {
|
||||
public static void showTopPowerScoreboard(Player player, int pageNumber, List<PlayerStat> stats) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.get(player.getName());
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
//wrapper.setOldScoreboard();
|
||||
wrapper.setTypeTopPower(pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
|
||||
|
@ -33,6 +33,7 @@ public class ScoreboardWrapper {
|
||||
public final String playerName;
|
||||
public final UUID playerUUID;
|
||||
private final Scoreboard scoreboard;
|
||||
private final Player player;
|
||||
private boolean tippedKeep = false;
|
||||
private boolean tippedClear = false;
|
||||
|
||||
@ -49,23 +50,24 @@ public class ScoreboardWrapper {
|
||||
public int leaderboardPage = -1;
|
||||
|
||||
private ScoreboardWrapper(Player player, Scoreboard scoreboard) {
|
||||
this.player = player;
|
||||
this.playerName = player.getName();
|
||||
this.scoreboard = scoreboard;
|
||||
this.playerUUID = player.getUniqueId();
|
||||
sidebarType = SidebarType.NONE;
|
||||
|
||||
if(this.scoreboard.getObjective(getObjective(ObjectiveType.SIDEBAR)) == null)
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
|
||||
if(this.scoreboard.getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)) == null)
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR), "dummy");
|
||||
else
|
||||
{
|
||||
this.scoreboard.getObjective(getObjective(ObjectiveType.SIDEBAR)).unregister();
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
|
||||
this.scoreboard.getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)).unregister();
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR), "dummy");
|
||||
}
|
||||
|
||||
if(this.scoreboard.getObjective(getObjective(ObjectiveType.POWER)) == null)
|
||||
powerObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.POWER), "dummy");
|
||||
if(this.scoreboard.getObjective(getObjectiveIdentifier(ObjectiveType.POWER)) == null)
|
||||
powerObjective = this.scoreboard.registerNewObjective(getObjectiveIdentifier(ObjectiveType.POWER), "dummy");
|
||||
else
|
||||
powerObjective = this.scoreboard.getObjective(getObjective(ObjectiveType.POWER));
|
||||
powerObjective = this.scoreboard.getObjective(getObjectiveIdentifier(ObjectiveType.POWER));
|
||||
|
||||
if (Config.getInstance().getPowerLevelTagsEnabled()) {
|
||||
powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
|
||||
@ -77,7 +79,7 @@ public class ScoreboardWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
public String getObjective(ObjectiveType objectiveType)
|
||||
public String getObjectiveIdentifier(ObjectiveType objectiveType)
|
||||
{
|
||||
switch(objectiveType)
|
||||
{
|
||||
@ -92,7 +94,7 @@ public class ScoreboardWrapper {
|
||||
}
|
||||
|
||||
public static ScoreboardWrapper create(Player player) {
|
||||
return new ScoreboardWrapper(player, mcMMO.p.getServer().getScoreboardManager().getMainScoreboard());
|
||||
return new ScoreboardWrapper(player, getMainScoreboard());
|
||||
}
|
||||
|
||||
public BukkitTask updateTask = null;
|
||||
@ -173,7 +175,7 @@ public class ScoreboardWrapper {
|
||||
/**
|
||||
* Set the old scoreboard, for use in reverting.
|
||||
*/
|
||||
public void setOldScoreboard() {
|
||||
/*public void setOldScoreboard() {
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
|
||||
if (player == null) {
|
||||
@ -192,7 +194,7 @@ public class ScoreboardWrapper {
|
||||
else {
|
||||
this.oldBoard = oldBoard;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void showBoardWithNoRevert() {
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
@ -253,7 +255,7 @@ public class ScoreboardWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
if (oldBoard != null) {
|
||||
if (oldBoard != null && oldBoard != player.getScoreboard()) {
|
||||
if (player.getScoreboard() == scoreboard) {
|
||||
player.setScoreboard(oldBoard);
|
||||
oldBoard = null;
|
||||
@ -265,6 +267,13 @@ public class ScoreboardWrapper {
|
||||
|
||||
cancelRevert();
|
||||
|
||||
//Unregister the boards
|
||||
if (getMainScoreboard().getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)) != null)
|
||||
{
|
||||
getMainScoreboard().getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)).unregister();
|
||||
} else
|
||||
unregisterPlayerSideboard(getObjectiveIdentifier(ObjectiveType.POWER));
|
||||
|
||||
sidebarType = SidebarType.NONE;
|
||||
targetPlayer = null;
|
||||
targetSkill = null;
|
||||
@ -399,8 +408,18 @@ public class ScoreboardWrapper {
|
||||
|
||||
// Setup for after a board type change
|
||||
protected void loadObjective(String displayName) {
|
||||
sidebarObjective.unregister();
|
||||
sidebarObjective = scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
|
||||
//Unregister the old sidebarobjective if it exists
|
||||
try {
|
||||
if (getMainScoreboard().getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)) != null)
|
||||
getMainScoreboard().getObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR)).unregister();
|
||||
} catch (IllegalStateException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
//Unregister our player-named sideboard if it exists
|
||||
unregisterPlayerSideboard(player.getName());
|
||||
|
||||
sidebarObjective = scoreboard.registerNewObjective(getObjectiveIdentifier(ObjectiveType.SIDEBAR), "dummy");
|
||||
|
||||
if (displayName.length() > 32) {
|
||||
displayName = displayName.substring(0, 32);
|
||||
@ -413,6 +432,15 @@ public class ScoreboardWrapper {
|
||||
sidebarObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
}
|
||||
|
||||
private void unregisterPlayerSideboard(String s) {
|
||||
if (getMainScoreboard().getObjective(s) != null)
|
||||
getMainScoreboard().getObjective(s).unregister();
|
||||
}
|
||||
|
||||
private static Scoreboard getMainScoreboard() {
|
||||
return mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load new values into the sidebar.
|
||||
*/
|
||||
|
@ -23,16 +23,21 @@ Skills:
|
||||
LevelUps: true
|
||||
ToolReady: true
|
||||
SubSkillInteraction: true
|
||||
SubSkillFailure: true
|
||||
SubSkillUnlocked: true
|
||||
SuperAbilityInteraction: true
|
||||
SuperAbilityAlertOthers: true
|
||||
ExperienceGain: true
|
||||
General:
|
||||
Ability:
|
||||
EnchantBuff: 5
|
||||
# IncreaseLevel: This setting will determine when the length of every ability gets longer with 1 second
|
||||
# EnchantBuff: This setting determines how many enchant levels to use when buffing Super Breaker & Giga Drill Breaker
|
||||
IncreaseLevel: 5
|
||||
EnchantBuff: 5
|
||||
ClassicScaling:
|
||||
IncreaseLevel: 50
|
||||
StandardScaling:
|
||||
IncreaseLevel: 5
|
||||
|
||||
#
|
||||
# Settings for Acrobatics
|
||||
###
|
||||
@ -675,6 +680,8 @@ Skills:
|
||||
Style:
|
||||
JSON:
|
||||
Notification:
|
||||
SubSkillFailure:
|
||||
Color: RED
|
||||
AbilityOff:
|
||||
Color: GRAY
|
||||
LevelRequirementNotMet:
|
||||
|
@ -17,6 +17,7 @@ General:
|
||||
# This is the value that is skill level requirements are multiplied by in Classic Mode (Default is 10)
|
||||
Classic_LevelReq_Factor: 10
|
||||
# This is the value that the xp required to level is multiplied by when in classic mode
|
||||
# Default is 1
|
||||
Classic_XP_Formula_Factor: 1
|
||||
Locale: en_US
|
||||
MOTD_Enabled: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user