mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-28 05:37:44 +01:00
!Removed deprecated methods of MMOLib
This commit is contained in:
parent
5e0999e173
commit
6872d3814b
BIN
lib/MMOLib.jar
BIN
lib/MMOLib.jar
Binary file not shown.
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class ConfigMessage {
|
||||
@ -31,14 +30,14 @@ public class ConfigMessage {
|
||||
}
|
||||
|
||||
public void send(CommandSender sender) {
|
||||
messages.forEach(line -> sender.sendMessage(new ColorParse('&', line).toChatColor()));
|
||||
messages.forEach(line -> sender.sendMessage(MMOLib.plugin.parseColors(line)));
|
||||
}
|
||||
|
||||
public void send(Collection<? extends Player> players) {
|
||||
players.forEach(player -> messages.forEach(line -> player.sendMessage(new ColorParse('&', MMOCore.plugin.placeholderParser.parse(player, line)).toChatColor())));
|
||||
players.forEach(player -> messages.forEach(line -> player.sendMessage(MMOCore.plugin.placeholderParser.parse(player, line))));
|
||||
}
|
||||
|
||||
public void sendAsJSon(Player player) {
|
||||
messages.forEach(line -> MMOLib.plugin.getNMS().sendJson(player, new ColorParse('&', line).toChatColor()));
|
||||
messages.forEach(line -> MMOLib.plugin.getVersion().getWrapper().sendJson(player, MMOLib.plugin.parseColors(line)));
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class PlayerActionBar extends BukkitRunnable {
|
||||
private final int ticks;
|
||||
@ -31,7 +31,7 @@ public class PlayerActionBar extends BukkitRunnable {
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.canSeeActionBar()) {
|
||||
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(),
|
||||
new ColorParse('&', new String(format)
|
||||
MMOLib.plugin.parseColors(new String(format)
|
||||
.replace("{health}", digit.format(data.getPlayer().getHealth()))
|
||||
.replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
||||
.replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon())
|
||||
@ -45,7 +45,7 @@ public class PlayerActionBar extends BukkitRunnable {
|
||||
.replace("{xp}", "" + data.getExperience())
|
||||
.replace("{armor}", "" + StatType.ARMOR.format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue()))
|
||||
.replace("{level}", "" + data.getLevel())
|
||||
.replace("{name}", data.getPlayer().getDisplayName())).toChatColor())));
|
||||
.replace("{name}", data.getPlayer().getDisplayName())))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class SkullBlockType implements BlockType {
|
||||
}
|
||||
|
||||
public SkullBlockType(Block block) {
|
||||
value = MMOLib.plugin.getNMS().getSkullValue(block);
|
||||
value = MMOLib.plugin.getVersion().getWrapper().getSkullValue(block);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
@ -34,7 +34,7 @@ public class SkullBlockType implements BlockType {
|
||||
if (MMOCoreUtils.isPlayerHead(block.getBlockData().getMaterial()) && MMOLib.plugin.getVersion().isStrictlyHigher(1, 12))
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
|
||||
MMOLib.plugin.getNMS().setSkullValue(loc.getBlock(), value);
|
||||
MMOLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,7 +8,7 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||
|
||||
public class PlayerAttribute {
|
||||
@ -25,9 +25,7 @@ public class PlayerAttribute {
|
||||
Validate.notNull(config, "Could not load config");
|
||||
id = config.getName().toLowerCase().replace("_", "-").replace(" ", "-");
|
||||
|
||||
name = config.getString("name");
|
||||
Validate.isTrue(name != null && !name.isEmpty(), "Could not read name");
|
||||
|
||||
name = MMOLib.plugin.parseColors(config.getString("name", "Attribute"));
|
||||
max = config.contains("max-points") ? Math.max(1, config.getInt("max-points")) : 0;
|
||||
|
||||
if (config.contains("buff"))
|
||||
@ -45,7 +43,7 @@ public class PlayerAttribute {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return new ColorParse('&', name).toChatColor();
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean hasMax() {
|
||||
|
@ -37,8 +37,8 @@ import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.CastingParticle;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.MMOLineConfig;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
@ -65,7 +65,7 @@ public class PlayerClass extends PostLoadObject {
|
||||
|
||||
this.id = id.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
|
||||
name = new ColorParse('&', config.getString("display.name")).toChatColor();
|
||||
name = MMOLib.plugin.parseColors(config.getString("display.name"));
|
||||
icon = MMOCoreUtils.readIcon(config.getString("display.item", "BARRIER"));
|
||||
|
||||
if (config.contains("display.texture") && icon.getType() == VersionMaterial.PLAYER_HEAD.toMaterial())
|
||||
@ -83,9 +83,9 @@ public class PlayerClass extends PostLoadObject {
|
||||
}
|
||||
|
||||
for (String string : config.getStringList("display.lore"))
|
||||
description.add(ChatColor.GRAY + new ColorParse('&', string).toChatColor());
|
||||
description.add(ChatColor.GRAY + MMOLib.plugin.parseColors(string));
|
||||
for (String string : config.getStringList("display.attribute-lore"))
|
||||
attrDescription.add(ChatColor.GRAY + new ColorParse('&', string).toChatColor());
|
||||
attrDescription.add(ChatColor.GRAY + MMOLib.plugin.parseColors(string));
|
||||
manaDisplay = config.contains("mana") ? new ManaDisplayOptions(config.getConfigurationSection("mana"))
|
||||
: ManaDisplayOptions.DEFAULT;
|
||||
maxLevel = config.getInt("max-level");
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
|
||||
public class ManaDisplayOptions {
|
||||
@ -30,7 +31,7 @@ public class ManaDisplayOptions {
|
||||
Validate.notEmpty(format, "Could not load mana bar character");
|
||||
barCharacter = format.charAt(0);
|
||||
|
||||
icon = new ColorParse('&', config.getString("icon", "")).toChatColor();
|
||||
icon = MMOLib.plugin.parseColors(config.getString("icon", ""));
|
||||
Validate.notEmpty(format, "Could not load mana action bar icon");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.Indyuce.mmocore.api.player.stats;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.stat.StatInstance;
|
||||
import net.mmogroup.mmolib.api.stat.StatMap;
|
||||
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||
@ -8,8 +9,10 @@ import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||
public class PlayerStats {
|
||||
private final PlayerData data;
|
||||
|
||||
/*
|
||||
* util class to manipulate more easily stat data from MMOLib
|
||||
/**
|
||||
* Utilclass to easily manipulate the MMOLib stat map
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public PlayerStats(PlayerData data) {
|
||||
this.data = data;
|
||||
@ -24,7 +27,7 @@ public class PlayerStats {
|
||||
}
|
||||
|
||||
public StatInstance getInstance(StatType stat) {
|
||||
return getInstance(stat.name());
|
||||
return getMap().getInstance(stat.name());
|
||||
}
|
||||
|
||||
public StatInstance getInstance(String stat) {
|
||||
@ -47,17 +50,18 @@ public class PlayerStats {
|
||||
* used to update MMOCore stat modifiers due to class and send them over to
|
||||
* MMOLib. must be ran everytime the player levels up or changes class.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void updateStats() {
|
||||
getMap().getInstances().forEach(ins -> ins.removeIf(key -> key.equals("mmocoreClass")));
|
||||
|
||||
for (StatType stat : StatType.values()) {
|
||||
StatInstance instance = getMap().getInstance(stat.name());
|
||||
double total = getBase(stat) - instance.getVanilla();
|
||||
double total = getBase(stat) - instance.getBase();
|
||||
|
||||
if (total != 0)
|
||||
instance.addModifier("mmocoreClass", new StatModifier(total));
|
||||
}
|
||||
|
||||
getMap().updateAll();
|
||||
MMOLib.plugin.getStats().runUpdates(getMap());
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmocore.api.quest;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.objective.Objective;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class QuestProgress {
|
||||
private final Quest quest;
|
||||
@ -60,6 +60,6 @@ public class QuestProgress {
|
||||
}
|
||||
|
||||
public String getFormattedLore() {
|
||||
return new ColorParse('&', objectiveProgress.formatLore(objectiveProgress.getObjective().getDefaultLore())).toChatColor();
|
||||
return MMOLib.plugin.parseColors(objectiveProgress.formatLore(objectiveProgress.getObjective().getDefaultLore()));
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ public class MMOCoreUtils {
|
||||
int t = 0;
|
||||
for (ItemStack item : items)
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
t += MMOLib.plugin.getNMS().getNBTItem(item).getInteger("RpgWorth") * item.getAmount();
|
||||
t += MMOLib.plugin.getVersion().getWrapper().getNBTItem(item).getInteger("RpgWorth") * item.getAmount();
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -26,25 +26,25 @@ public class AnvilGUI extends PlayerInput {
|
||||
paperMeta.setDisplayName(MMOCore.plugin.configManager.getSimpleMessage("player-input.anvil." + type.getLowerCaseName()).message());
|
||||
paper.setItemMeta(paperMeta);
|
||||
|
||||
MMOLib.plugin.getNMS().handleInventoryCloseEvent(player);
|
||||
MMOLib.plugin.getNMS().setActiveContainerDefault(player);
|
||||
MMOLib.plugin.getVersion().getWrapper().handleInventoryCloseEvent(player);
|
||||
MMOLib.plugin.getVersion().getWrapper().setActiveContainerDefault(player);
|
||||
|
||||
final Object container = MMOLib.plugin.getNMS().newContainerAnvil(player);
|
||||
final Object container = MMOLib.plugin.getVersion().getWrapper().newContainerAnvil(player);
|
||||
|
||||
inventory = MMOLib.plugin.getNMS().toBukkitInventory(container);
|
||||
inventory = MMOLib.plugin.getVersion().getWrapper().toBukkitInventory(container);
|
||||
inventory.setItem(0, paper);
|
||||
|
||||
containerId = MMOLib.plugin.getNMS().getNextContainerId(player);
|
||||
MMOLib.plugin.getNMS().sendPacketOpenWindow(player, containerId);
|
||||
MMOLib.plugin.getNMS().setActiveContainer(player, container);
|
||||
MMOLib.plugin.getNMS().setActiveContainerId(container, containerId);
|
||||
MMOLib.plugin.getNMS().addActiveContainerSlotListener(container, player);
|
||||
containerId = MMOLib.plugin.getVersion().getWrapper().getNextContainerId(player);
|
||||
MMOLib.plugin.getVersion().getWrapper().sendPacketOpenWindow(player, containerId);
|
||||
MMOLib.plugin.getVersion().getWrapper().setActiveContainer(player, container);
|
||||
MMOLib.plugin.getVersion().getWrapper().setActiveContainerId(container, containerId);
|
||||
MMOLib.plugin.getVersion().getWrapper().addActiveContainerSlotListener(container, player);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
MMOLib.plugin.getNMS().handleInventoryCloseEvent(getPlayer());
|
||||
MMOLib.plugin.getNMS().setActiveContainerDefault(getPlayer());
|
||||
MMOLib.plugin.getNMS().sendPacketCloseWindow(getPlayer(), containerId);
|
||||
MMOLib.plugin.getVersion().getWrapper().handleInventoryCloseEvent(getPlayer());
|
||||
MMOLib.plugin.getVersion().getWrapper().setActiveContainerDefault(getPlayer());
|
||||
MMOLib.plugin.getVersion().getWrapper().sendPacketCloseWindow(getPlayer(), containerId);
|
||||
|
||||
InventoryClickEvent.getHandlerList().unregister(this);
|
||||
InventoryCloseEvent.getHandlerList().unregister(this);
|
||||
|
@ -19,7 +19,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
@ -102,6 +101,7 @@ public class ConfigItem {
|
||||
return build(1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemStack build(int amount) {
|
||||
ItemStack item = getItem(amount);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
@ -138,6 +138,6 @@ public class ConfigItem {
|
||||
for (String placeholder : placeholders.keySet())
|
||||
if (string.contains("{" + placeholder + "}"))
|
||||
string = string.replace("{" + placeholder + "}", "" + placeholders.get(placeholder));
|
||||
return new ColorParse('&', string).toChatColor();
|
||||
return MMOLib.plugin.parseColors(string);
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class NamedItemStack extends ItemStack {
|
||||
public NamedItemStack(Material material, String name) {
|
||||
super(material);
|
||||
|
||||
ItemMeta meta = getItemMeta();
|
||||
meta.setDisplayName(new ColorParse('&', name).toChatColor());
|
||||
meta.setDisplayName(MMOLib.plugin.parseColors(name));
|
||||
setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class ListCommandMap extends CommandEnd {
|
||||
sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------");
|
||||
for (Booster booster : MMOCore.plugin.boosterManager.getBoosters())
|
||||
if (!booster.isTimedOut())
|
||||
MMOLib.plugin.getNMS().sendJson((Player) sender, "{\"text\":\"" + ChatColor.YELLOW + "- " + ChatColor.GOLD + MMOCore.plugin.configManager.decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - " + ChatColor.GOLD + (!booster.hasProfession() ? "ExploreAttributesCommand" : booster.getProfession().getName()) + ChatColor.YELLOW + " - " + ChatColor.GOLD + new DelayFormat().format(booster.getCreationDate() + booster.getLength() - System.currentTimeMillis()) + "\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/mmocore booster remove " + booster.getUniqueId().toString() + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Click to remove.\"}}}");
|
||||
MMOLib.plugin.getVersion().getWrapper().sendJson((Player) sender, "{\"text\":\"" + ChatColor.YELLOW + "- " + ChatColor.GOLD + MMOCore.plugin.configManager.decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - " + ChatColor.GOLD + (!booster.hasProfession() ? "ExploreAttributesCommand" : booster.getProfession().getName()) + ChatColor.YELLOW + " - " + ChatColor.GOLD + new DelayFormat().format(booster.getCreationDate() + booster.getLength() - System.currentTimeMillis()) + "\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/mmocore booster remove " + booster.getUniqueId().toString() + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"Click to remove.\"}}}");
|
||||
sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------");
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -70,7 +70,7 @@ public class Lootsplosion implements Listener {
|
||||
|
||||
if (colored)
|
||||
Bukkit.getScheduler().runTask(MMOCore.plugin, () -> {
|
||||
NBTItem nbt = MMOLib.plugin.getNMS().getNBTItem(item.getItemStack());
|
||||
NBTItem nbt = MMOLib.plugin.getVersion().getWrapper().getNBTItem(item.getItemStack());
|
||||
if (nbt.hasTag("MMOITEMS_TIER")) {
|
||||
ItemTier tier = MMOItems.plugin.getTiers().get(nbt.getString("MMOITEMS_TIER"));
|
||||
if (tier.hasColor())
|
||||
|
@ -2,11 +2,12 @@ package net.Indyuce.mmocore.comp.placeholder;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class DefaultParser implements PlaceholderParser {
|
||||
|
||||
@Override
|
||||
public String parse(OfflinePlayer player, String string) {
|
||||
return new ColorParse('&', string.replace("%player%", player.getName())).toChatColor();
|
||||
return MMOLib.plugin.parseColors(string.replace("%player%", player.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmocore.comp.placeholder;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class PlaceholderAPIParser implements PlaceholderParser {
|
||||
public PlaceholderAPIParser() {
|
||||
@ -12,6 +12,6 @@ public class PlaceholderAPIParser implements PlaceholderParser {
|
||||
|
||||
@Override
|
||||
public String parse(OfflinePlayer player, String string) {
|
||||
return new ColorParse('&', PlaceholderAPI.setPlaceholders(player, string.replace("%player%", player.getName()))).toChatColor();
|
||||
return MMOLib.plugin.parseColors(PlaceholderAPI.setPlaceholders(player, string.replace("%player%", player.getName())));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
@ -68,7 +68,7 @@ public class ClassSelect extends EditableInventory {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (hideFlags())
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName(new ColorParse('&', name).toChatColor().replace("{name}", profess.getName()));
|
||||
meta.setDisplayName(MMOLib.plugin.parseColors(name).replace("{name}", profess.getName()));
|
||||
List<String> lore = new ArrayList<>(this.lore);
|
||||
|
||||
int index = lore.indexOf("{lore}");
|
||||
|
@ -27,7 +27,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryPlaceholderItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.Placeholders;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
@ -71,7 +71,7 @@ public class SkillList extends EditableInventory {
|
||||
|
||||
if (function.equals("slot"))
|
||||
return new InventoryPlaceholderItem(config) {
|
||||
private final String none = new ColorParse('&', config.getString("no-skill")).toChatColor();
|
||||
private final String none = MMOLib.plugin.parseColors(config.getString("no-skill"));
|
||||
private final Material emptyMaterial = Material
|
||||
.valueOf(config.getString("empty-item").toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
|
||||
@ -170,12 +170,12 @@ public class SkillList extends EditableInventory {
|
||||
lore.add(index + j, skillLore.get(j));
|
||||
|
||||
for (int j = 0; j < lore.size(); j++)
|
||||
lore.set(j, ChatColor.GRAY + new ColorParse('&', lore.get(j)).toChatColor());
|
||||
lore.set(j, ChatColor.GRAY + MMOLib.plugin.parseColors(lore.get(j)));
|
||||
|
||||
ItemStack item = cloneItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(new ColorParse('&', getName().replace("{skill}", skill.getSkill().getName())
|
||||
.replace("{roman}", MMOCoreUtils.intToRoman(skillLevel)).replace("{level}", "" + skillLevel)).toChatColor());
|
||||
meta.setDisplayName(MMOLib.plugin.parseColors(getName().replace("{skill}", skill.getSkill().getName())
|
||||
.replace("{roman}", MMOCoreUtils.intToRoman(skillLevel)).replace("{level}", "" + skillLevel)));
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
|
@ -20,7 +20,7 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
@ -65,7 +65,7 @@ public class SubclassSelect extends EditableInventory {
|
||||
|
||||
ItemStack item = profess.getIcon();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(new ColorParse('&', name).toChatColor().replace("{name}", profess.getName()));
|
||||
meta.setDisplayName(MMOLib.plugin.parseColors(name).replace("{name}", profess.getName()));
|
||||
List<String> lore = new ArrayList<>(this.lore);
|
||||
|
||||
int index = lore.indexOf("{lore}");
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
import net.Indyuce.mmocore.gui.api.item.TriggerItem;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public abstract class GeneratedInventory extends PluginInventory {
|
||||
private final EditableInventory editable;
|
||||
@ -54,7 +54,7 @@ public abstract class GeneratedInventory extends PluginInventory {
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
Inventory inv = Bukkit.createInventory(this, editable.getSlots(), new ColorParse('&', calculateName()).toChatColor());
|
||||
Inventory inv = Bukkit.createInventory(this, editable.getSlots(), MMOLib.plugin.parseColors(calculateName()));
|
||||
|
||||
for (InventoryItem item : editable.getItems())
|
||||
if (item.canDisplay(this))
|
||||
|
@ -20,7 +20,7 @@ import net.Indyuce.mmocore.api.util.input.AnvilGUI;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
||||
import net.asangarin.hexcolors.ColorParse;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
@ -157,7 +157,7 @@ public class ConfigManager {
|
||||
String format = messages.getString(key, "");
|
||||
for (int j = 0; j < placeholders.length - 1; j += 2)
|
||||
format = format.replace("{" + placeholders[j] + "}", placeholders[j + 1]);
|
||||
return new SimpleMessage(new ColorParse('&', format).toChatColor());
|
||||
return new SimpleMessage(MMOLib.plugin.parseColors(format));
|
||||
}
|
||||
|
||||
public class SimpleMessage {
|
||||
|
@ -18,6 +18,7 @@ import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.event.PlayerAttackEvent;
|
||||
|
||||
public class Ambers extends Skill implements Listener {
|
||||
@ -38,7 +39,7 @@ public class Ambers extends Skill implements Listener {
|
||||
@EventHandler
|
||||
public void a(PlayerAttackEvent event) {
|
||||
PlayerData data = event.getData().getMMOCore();
|
||||
if (event.isWeapon() || !data.getProfess().hasSkill(this))
|
||||
if (!event.getAttack().hasType(DamageType.SKILL) || !data.getProfess().hasSkill(this))
|
||||
return;
|
||||
|
||||
SkillResult cast = data.cast(this);
|
||||
|
@ -10,6 +10,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.skill.Skill;
|
||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.event.PlayerAttackEvent;
|
||||
|
||||
public class Backstab extends Skill {
|
||||
@ -28,7 +29,9 @@ public class Backstab extends Skill {
|
||||
public void a(PlayerAttackEvent event) {
|
||||
PlayerData data = event.getData().getMMOCore();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
if (!event.isWeapon() || data.isInCombat() || event.getPlayer().getEyeLocation().getDirection().angle(target.getEyeLocation().getDirection()) > Math.PI / 6 || !data.getProfess().hasSkill(this))
|
||||
if (data.isInCombat() || !event.getAttack().hasType(DamageType.WEAPON)
|
||||
|| event.getPlayer().getEyeLocation().getDirection().angle(target.getEyeLocation().getDirection()) > Math.PI / 6
|
||||
|| !data.getProfess().hasSkill(this))
|
||||
return;
|
||||
|
||||
SkillResult cast = data.cast(this);
|
||||
|
@ -81,7 +81,7 @@ public class Empowered_Attack extends Skill {
|
||||
|
||||
@EventHandler
|
||||
public void a(PlayerAttackEvent event) {
|
||||
if (event.getPlayer().equals(player.getPlayer()) && event.isWeapon()) {
|
||||
if (event.getPlayer().equals(player.getPlayer()) && event.getAttack().hasType(DamageType.WEAPON)) {
|
||||
close();
|
||||
|
||||
Entity target = event.getEntity();
|
||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmocore.api.skill.Skill;
|
||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.event.PlayerAttackEvent;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
@ -22,7 +23,8 @@ public class Evade extends Skill {
|
||||
public Evade() {
|
||||
super();
|
||||
setMaterial(Material.LEATHER_BOOTS);
|
||||
setLore("You become imune to damage for &8{duration} &7seconds.", "Cancels when dealing weapon damage.", "", "&e{cooldown}s Cooldown", "&9Costs {mana} {mana_name}");
|
||||
setLore("You become imune to damage for &8{duration} &7seconds.", "Cancels when dealing weapon damage.", "", "&e{cooldown}s Cooldown",
|
||||
"&9Costs {mana} {mana_name}");
|
||||
|
||||
addModifier("cooldown", new LinearValue(20, 0));
|
||||
addModifier("mana", new LinearValue(8, 3));
|
||||
@ -65,7 +67,7 @@ public class Evade extends Skill {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void b(PlayerAttackEvent event) {
|
||||
if (event.isWeapon() && !event.isCancelled() && event.getData().getMMOCore().equals(data))
|
||||
if (event.getAttack().hasType(DamageType.WEAPON) && !event.isCancelled() && event.getData().getMMOCore().equals(data))
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class Fire_Rage extends Skill {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 0);
|
||||
|
||||
for (Entity target : MMOCoreUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOLib.plugin.getNMS().isInBoundingBox(target, loc) && MMOCoreUtils.canTarget(data, target)) {
|
||||
if (MMOLib.plugin.getVersion().getWrapper().isInBoundingBox(target, loc) && MMOCoreUtils.canTarget(data, target)) {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 8);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
|
@ -60,7 +60,7 @@ public class Fireball extends Skill {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 0);
|
||||
|
||||
for (Entity target : MMOCoreUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOLib.plugin.getNMS().isInBoundingBox(target, loc) && MMOCoreUtils.canTarget(data, target)) {
|
||||
if (MMOLib.plugin.getVersion().getWrapper().isInBoundingBox(target, loc) && MMOCoreUtils.canTarget(data, target)) {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 8);
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
|
@ -47,7 +47,7 @@ public class Power_Mark extends Skill implements Listener {
|
||||
@EventHandler
|
||||
public void a(PlayerAttackEvent event) {
|
||||
PlayerData data = event.getData().getMMOCore();
|
||||
if (!event.isWeapon() || !data.getProfess().hasSkill(this))
|
||||
if (!event.getAttack().hasType(DamageType.WEAPON) || !data.getProfess().hasSkill(this))
|
||||
return;
|
||||
|
||||
SkillResult cast = data.cast(this);
|
||||
|
@ -10,6 +10,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.skill.Skill;
|
||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.event.PlayerAttackEvent;
|
||||
|
||||
public class Sneaky_Picky extends Skill {
|
||||
@ -27,7 +28,7 @@ public class Sneaky_Picky extends Skill {
|
||||
@EventHandler
|
||||
public void a(PlayerAttackEvent event) {
|
||||
PlayerData data = event.getData().getMMOCore();
|
||||
if (!event.isWeapon() || data.isInCombat() || !data.getProfess().hasSkill(this))
|
||||
if (!event.getAttack().hasType(DamageType.WEAPON) || data.isInCombat() || !data.getProfess().hasSkill(this))
|
||||
return;
|
||||
|
||||
SkillResult cast = data.cast(this);
|
||||
|
Loading…
Reference in New Issue
Block a user