add option to disable exp gain hologram

please add these lines to your config.yml
# Allows to toggle exp hologram from gaining experiences
game-indicators:
    exp:
        enabled: false
This commit is contained in:
Blackdigits 2020-02-12 20:51:24 +07:00
parent d9f0444df0
commit 2a90717e56
3 changed files with 15 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.stream.Collectors;
import net.Indyuce.mmoitems.MMOItems;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Color;
@ -525,8 +526,10 @@ public class PlayerData {
}
// display hologram
if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.exp.enabled")) {
if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
}
value = MMOCore.plugin.boosterManager.calculateExp(null, value);
value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100;

View File

@ -3,6 +3,7 @@ package net.Indyuce.mmocore.api.player;
import java.util.HashMap;
import java.util.Map;
import net.Indyuce.mmoitems.MMOItems;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -86,8 +87,10 @@ public class Professions {
exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value);
// display hologram
if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.exp.enabled")) {
if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
}
int needed, exp, level;
boolean check = false;

View File

@ -70,6 +70,11 @@ health-scale:
enabled: true
scale: 20
# Allows to toggle exp hologram from gaining experiences
game-indicators:
exp:
enabled: false
# Players can swap their hotbar with the 9 inventory slots
# right above it by pressing [swap items] while crouching.
hotbar-swap: true