mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-03-11 13:11:50 +01:00
!Moved damage indicators to MythicLib
This commit is contained in:
parent
dd13cab4da
commit
69876347b5
BIN
lib/EcoEnchants v8.1.2.jar
Normal file
BIN
lib/EcoEnchants v8.1.2.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/eco-6.0.6-all.jar
Normal file
BIN
lib/eco-6.0.6-all.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/spigot.jar
BIN
lib/spigot.jar
Binary file not shown.
16
pom.xml
16
pom.xml
@ -373,5 +373,21 @@
|
||||
<systemPath>${basedir}/lib/GlowAPI.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.willfp.eco</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>6.0.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/eco-6.0.6-all.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.willfp</groupId>
|
||||
<artifactId>ecoenchants</artifactId>
|
||||
<version>8.1.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/EcoEnchants v8.1.2.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -24,7 +24,6 @@ import net.Indyuce.mmoitems.comp.flags.DefaultFlags;
|
||||
import net.Indyuce.mmoitems.comp.flags.FlagPlugin;
|
||||
import net.Indyuce.mmoitems.comp.flags.ResidenceFlags;
|
||||
import net.Indyuce.mmoitems.comp.flags.WorldGuardFlags;
|
||||
import net.Indyuce.mmoitems.comp.holograms.*;
|
||||
import net.Indyuce.mmoitems.comp.inventory.*;
|
||||
import net.Indyuce.mmoitems.comp.itemglow.ItemGlowListener;
|
||||
import net.Indyuce.mmoitems.comp.itemglow.NoGlowListener;
|
||||
@ -62,7 +61,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class MMOItems extends LuminePlugin {
|
||||
public static MMOItems plugin;
|
||||
|
||||
@ -95,7 +93,6 @@ public class MMOItems extends LuminePlugin {
|
||||
|
||||
private PlaceholderParser placeholderParser = new DefaultPlaceholderParser();
|
||||
private FlagPlugin flagPlugin = new DefaultFlags();
|
||||
private HologramSupport hologramSupport;
|
||||
private VaultSupport vaultSupport;
|
||||
private RPGHandler rpgPlugin;
|
||||
|
||||
@ -269,20 +266,6 @@ public class MMOItems extends LuminePlugin {
|
||||
getLogger().log(Level.INFO, "Hooked onto Iridescent");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("HolographicDisplays") != null) {
|
||||
hologramSupport = new HolographicDisplaysPlugin();
|
||||
getLogger().log(Level.INFO, "Hooked onto HolographicDisplays");
|
||||
} else if (Bukkit.getPluginManager().getPlugin("CMI") != null) {
|
||||
hologramSupport = new CMIPlugin();
|
||||
getLogger().log(Level.INFO, "Hooked onto CMI Holograms");
|
||||
} else if (Bukkit.getPluginManager().getPlugin("Holograms") != null) {
|
||||
hologramSupport = new HologramsPlugin();
|
||||
getLogger().log(Level.INFO, "Hooked onto Holograms");
|
||||
} else if (Bukkit.getPluginManager().getPlugin("TrHologram") != null) {
|
||||
hologramSupport = new TrHologramPlugin();
|
||||
getLogger().log(Level.INFO, "Hooked onto TrHologram");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
getLogger().log(Level.INFO, "Hooked onto PlaceholderAPI");
|
||||
placeholderParser = new PlaceholderAPIParser();
|
||||
@ -526,10 +509,6 @@ public class MMOItems extends LuminePlugin {
|
||||
return placeholderParser;
|
||||
}
|
||||
|
||||
public HologramSupport getHolograms() {
|
||||
return hologramSupport;
|
||||
}
|
||||
|
||||
public EquipListener getEquipListener() {
|
||||
return equipListener;
|
||||
}
|
||||
|
@ -122,6 +122,14 @@ public class ItemSet {
|
||||
particles.add(particle);
|
||||
}
|
||||
|
||||
public boolean hasStat(ItemStat stat) {
|
||||
return stats.containsKey(stat);
|
||||
}
|
||||
|
||||
public double getStat(ItemStat stat) {
|
||||
return stats.get(stat);
|
||||
}
|
||||
|
||||
public Map<ItemStat, Double> getStats() {
|
||||
return stats;
|
||||
}
|
||||
|
@ -17,134 +17,128 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerStats {
|
||||
private final PlayerData playerData;
|
||||
private final PlayerData playerData;
|
||||
|
||||
public PlayerStats(PlayerData playerData) {
|
||||
this.playerData = playerData;
|
||||
}
|
||||
public PlayerStats(PlayerData playerData) {
|
||||
this.playerData = playerData;
|
||||
}
|
||||
|
||||
public PlayerData getData() {
|
||||
return playerData;
|
||||
}
|
||||
public PlayerData getData() {
|
||||
return playerData;
|
||||
}
|
||||
|
||||
public StatMap getMap() {
|
||||
return playerData.getMMOPlayerData().getStatMap();
|
||||
}
|
||||
public StatMap getMap() {
|
||||
return playerData.getMMOPlayerData().getStatMap();
|
||||
}
|
||||
|
||||
public double getStat(ItemStat stat) {
|
||||
return getMap().getInstance(stat.getId()).getTotal();
|
||||
}
|
||||
public double getStat(ItemStat stat) {
|
||||
return getMap().getInstance(stat.getId()).getTotal();
|
||||
}
|
||||
|
||||
public StatInstance getInstance(ItemStat stat) {
|
||||
return getMap().getInstance(stat.getId());
|
||||
}
|
||||
public StatInstance getInstance(ItemStat stat) {
|
||||
return getMap().getInstance(stat.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to cache stats when a player casts a skill so that if the player
|
||||
* swaps items or changes any of his stat value before the end of the
|
||||
* spell duration, the stat value is not updated.
|
||||
*
|
||||
* @ignored Every stat modifier with that modifier source
|
||||
* will be ignored when calculating the total stat value
|
||||
*/
|
||||
public CachedStats newTemporary(EquipmentSlot castSlot) {
|
||||
return new CachedStats(castSlot);
|
||||
}
|
||||
/**
|
||||
* Used to cache stats when a player casts a skill so that if the player
|
||||
* swaps items or changes any of his stat value before the end of the
|
||||
* spell duration, the stat value is not updated.
|
||||
*
|
||||
* @param castSlot Every stat modifier with the opposite modifier
|
||||
* source will NOT be taken into account for stat calculation
|
||||
*/
|
||||
public CachedStats newTemporary(EquipmentSlot castSlot) {
|
||||
return new CachedStats(castSlot);
|
||||
}
|
||||
|
||||
public void updateStats() {
|
||||
getMap().getInstances().forEach(ins -> ins.removeIf(name -> name.startsWith("MMOItem")));
|
||||
public void updateStats() {
|
||||
|
||||
if (playerData.hasSetBonuses())
|
||||
playerData.getSetBonuses().getStats()
|
||||
.forEach((stat, value) -> getInstance(stat).addModifier("MMOItemSetBonus", new StatModifier(value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)));
|
||||
for (ItemStat stat : MMOItems.plugin.getStats().getNumericStats()) {
|
||||
|
||||
for (ItemStat stat : MMOItems.plugin.getStats().getNumericStats()) {
|
||||
// Let MMOItems first add stat modifiers, and then update the stat instance
|
||||
StatInstance.ModifierPacket packet = getInstance(stat).newPacket();
|
||||
|
||||
/**
|
||||
* Lets MMOItems first add stat modifiers and then update the stat instance
|
||||
*/
|
||||
StatInstance.ModifierPacket packet = getInstance(stat).newPacket();
|
||||
// Remove previous potential modifiers
|
||||
packet.removeIf(name -> name.startsWith("MMOItem"));
|
||||
|
||||
/**
|
||||
* The index of the mmoitem stat modifier being added
|
||||
*/
|
||||
int index = 0;
|
||||
// Add set bonuses
|
||||
if (playerData.hasSetBonuses() && playerData.getSetBonuses().hasStat(stat))
|
||||
packet.addModifier("MMOItemSetBonus",
|
||||
new StatModifier(playerData.getSetBonuses().getStat(stat), ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER));
|
||||
|
||||
for (EquippedPlayerItem item : playerData.getInventory().getEquipped()) {
|
||||
double value = item.getItem().getNBT().getStat(stat.getId());
|
||||
// The index of the mmoitem stat modifier being added
|
||||
int index = 0;
|
||||
|
||||
for (EquippedPlayerItem item : playerData.getInventory().getEquipped()) {
|
||||
double value = item.getItem().getNBT().getStat(stat.getId());
|
||||
|
||||
if (value != 0) {
|
||||
if (value != 0) {
|
||||
|
||||
Type type = item.getItem().getType();
|
||||
ModifierSource source = type == null ? ModifierSource.OTHER : type.getItemSet().getModifierSource();
|
||||
Type type = item.getItem().getType();
|
||||
ModifierSource source = type == null ? ModifierSource.OTHER : type.getItemSet().getModifierSource();
|
||||
|
||||
/**
|
||||
* Apply main hand weapon stat offset ie 4 for attack speed and 1 for attack damage.
|
||||
*/
|
||||
if (item.getSlot() == EquipmentSlot.MAIN_HAND && stat instanceof AttributeStat)
|
||||
value -= ((AttributeStat) stat).getOffset();
|
||||
// Apply main hand weapon stat offset ie 4 for attack speed and 1 for attack damage.
|
||||
if (item.getSlot() == EquipmentSlot.MAIN_HAND && stat instanceof AttributeStat)
|
||||
value -= ((AttributeStat) stat).getOffset();
|
||||
|
||||
packet.addModifier("MMOItem-" + index++, new StatModifier(value, ModifierType.FLAT, item.getSlot(), source));
|
||||
}
|
||||
}
|
||||
packet.addModifier("MMOItem-" + index++, new StatModifier(value, ModifierType.FLAT, item.getSlot(), source));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finally run a stat update after all modifiers
|
||||
* have been gathered by MythicLib
|
||||
*/
|
||||
packet.runUpdate();
|
||||
}
|
||||
}
|
||||
// Finally run a stat update after all modifiers have been gathered in the packet
|
||||
packet.runUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedStats {
|
||||
private final Player player;
|
||||
private final Map<String, Double> stats = new HashMap<>();
|
||||
public class CachedStats {
|
||||
private final Player player;
|
||||
private final Map<String, Double> stats = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Used to cache stats when a player casts a skill so that if the player
|
||||
* swaps items or changes any of his stat value before the end of the
|
||||
* spell duration, the stat value is not updated
|
||||
*
|
||||
* @castSlot The equipment slot of the item the player is casting
|
||||
* a skill/attacking with. Helps determine what stats modifiers needs to be
|
||||
* applied and what modifiers must be filtered
|
||||
*/
|
||||
public CachedStats(EquipmentSlot castSlot) {
|
||||
player = playerData.getPlayer();
|
||||
/**
|
||||
* Used to cache stats when a player casts a skill so that if the player
|
||||
* swaps items or changes any of his stat value before the end of the
|
||||
* spell duration, the stat value is not updated
|
||||
*
|
||||
* @castSlot The equipment slot of the item the player is casting
|
||||
* a skill/attacking with. Helps determine what stats modifiers needs to be
|
||||
* applied and what modifiers must be filtered
|
||||
*/
|
||||
public CachedStats(EquipmentSlot castSlot) {
|
||||
player = playerData.getPlayer();
|
||||
|
||||
if (castSlot.isHand()) {
|
||||
if (castSlot.isHand()) {
|
||||
|
||||
/**
|
||||
* When casting a skill or an attack with a certain hand, stats from the
|
||||
* other hand shouldn't be taken into account
|
||||
*/
|
||||
EquipmentSlot ignored = castSlot.getOppositeHand();
|
||||
for (StatInstance ins : getMap().getInstances())
|
||||
this.stats.put(ins.getStat(), ins.getFilteredTotal(mod -> mod.getSlot() != ignored));
|
||||
} else
|
||||
/*
|
||||
* When casting a skill or an attack with a certain hand, stats
|
||||
* from the other hand shouldn't be taken into account
|
||||
*/
|
||||
EquipmentSlot ignored = castSlot.getOppositeHand();
|
||||
for (StatInstance ins : getMap().getInstances())
|
||||
this.stats.put(ins.getStat(), ins.getFilteredTotal(mod -> mod.getSlot() != ignored));
|
||||
} else
|
||||
|
||||
/**
|
||||
* Not casting the attack with a specific hand so take everything into account
|
||||
*/
|
||||
for (StatInstance ins : getMap().getInstances())
|
||||
this.stats.put(ins.getStat(), ins.getTotal());
|
||||
}
|
||||
/*
|
||||
* Not casting the attack with a specific
|
||||
* hand so take everything into account
|
||||
*/
|
||||
for (StatInstance ins : getMap().getInstances())
|
||||
this.stats.put(ins.getStat(), ins.getTotal());
|
||||
}
|
||||
|
||||
public PlayerData getData() {
|
||||
return playerData;
|
||||
}
|
||||
public PlayerData getData() {
|
||||
return playerData;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public double getStat(ItemStat stat) {
|
||||
return stats.containsKey(stat.getId()) ? stats.get(stat.getId()) : 0;
|
||||
}
|
||||
public double getStat(ItemStat stat) {
|
||||
return stats.containsKey(stat.getId()) ? stats.get(stat.getId()) : 0;
|
||||
}
|
||||
|
||||
public void setStat(ItemStat stat, double value) {
|
||||
stats.put(stat.getId(), value);
|
||||
}
|
||||
}
|
||||
public void setStat(ItemStat stat, double value) {
|
||||
stats.put(stat.getId(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package net.Indyuce.mmoitems.comp.enchants;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
|
||||
public class AdvancedCrazyEnchantsData implements StatData {
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package net.Indyuce.mmoitems.comp.enchants;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.InternalStat;
|
||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class AdvancedEnchantsStat extends StringStat implements InternalStat {
|
||||
public AdvancedEnchantsStat() {
|
||||
super("ADVANCED_ENCHANTS", Material.BOOK, "Advanced Enchants", new String[0], new String[]{"all"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomStatData whenInitialized(Object object) {
|
||||
// Not supported
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StatData data) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull StatData data) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent event) {
|
||||
// Not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
// Not supported
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StatData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenDisplayed(List<String> lore, Optional<RandomStatData> statData) {
|
||||
// Not supported
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public StatData getClearStatData() {
|
||||
// Not supported
|
||||
return null;
|
||||
}
|
||||
}
|
@ -4,6 +4,18 @@ import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
/**
|
||||
* There are three types of enchant plugins.
|
||||
* - enchants saved using the Bukkit Enchantment interface (EcoEnchants, MythicEnchants)
|
||||
* - enchants saved in the NBT (AdvancedEnchants)
|
||||
* - enchants saved in lore only (CrazyEnchants)
|
||||
* <p>
|
||||
* Interface used to support plugins which use the Bukkit Enchantment
|
||||
* interface to register their enchantments. This makes enchant storage
|
||||
* so much easier for MMOItems.
|
||||
*
|
||||
* @param <T> The plugin class implementing Enchantment
|
||||
*/
|
||||
public interface EnchantPlugin<T extends Enchantment> {
|
||||
|
||||
/**
|
||||
|
@ -1,31 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.holograms;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Zrips.CMI.CMI;
|
||||
import com.Zrips.CMI.Modules.Holograms.CMIHologram;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
|
||||
public class CMIPlugin extends HologramSupport {
|
||||
public CMIPlugin() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayIndicator(Location loc, String format, Player player) {
|
||||
final CMIHologram hologram = new CMIHologram("MMOItems_" + UUID.randomUUID().toString(), loc);
|
||||
hologram.setLines(Collections.singletonList(format));
|
||||
if (player != null)
|
||||
hologram.hide(player.getUniqueId());
|
||||
CMI.getInstance().getHologramManager().addHologram(hologram);
|
||||
hologram.update();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, () -> CMI.getInstance().getHologramManager().removeHolo(hologram), 20);
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.holograms;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
|
||||
public abstract class HologramSupport {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public HologramSupport() {
|
||||
|
||||
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.damage.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new Listener() {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void a(EntityDamageEvent event) {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof LivingEntity) || event.getEntity() instanceof ArmorStand || event.getDamage() <= 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* no damage indicator is displayed when the player is
|
||||
* vanished using essentials.
|
||||
*/
|
||||
if (entity instanceof Player && isVanished((Player) entity))
|
||||
return;
|
||||
|
||||
displayIndicator(entity, MMOItems.plugin.getLanguage().damageIndicatorFormat.replace("#",
|
||||
MMOItems.plugin.getLanguage().damageIndicatorDecimalFormat.format(event.getFinalDamage())));
|
||||
}
|
||||
}, MMOItems.plugin);
|
||||
|
||||
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.heal.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new Listener() {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void a(EntityRegainHealthEvent event) {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof LivingEntity) || event.getAmount() <= 0
|
||||
|| ((LivingEntity) entity).getHealth() >= ((LivingEntity) entity).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())
|
||||
return;
|
||||
|
||||
/*
|
||||
* no damage indicator is displayed when the player is
|
||||
* vanished using essentials.
|
||||
*/
|
||||
if (entity instanceof Player && isVanished((Player) entity))
|
||||
return;
|
||||
|
||||
displayIndicator(entity, MMOItems.plugin.getLanguage().healIndicatorFormat.replace("#",
|
||||
MMOItems.plugin.getLanguage().healIndicatorDecimalFormat.format(event.getAmount())));
|
||||
}
|
||||
}, MMOItems.plugin);
|
||||
}
|
||||
|
||||
public void displayIndicator(Entity entity, String message) {
|
||||
displayIndicator(entity.getLocation().add((random.nextDouble() - .5) * 1.2, entity.getHeight() * .75, (random.nextDouble() - .5) * 1.2),
|
||||
message, entity instanceof Player ? (Player) entity : null);
|
||||
}
|
||||
|
||||
/*
|
||||
* the third argument is the player which the hologram needs to be hidden
|
||||
* from to prevent the indicator from taking too much space on the player
|
||||
* screen
|
||||
*/
|
||||
public abstract void displayIndicator(Location loc, String message, Player player);
|
||||
|
||||
private boolean isVanished(Player player) {
|
||||
for (MetadataValue meta : player.getMetadata("vanished"))
|
||||
if (meta.asBoolean())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.holograms;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.sainttx.holograms.HologramPlugin;
|
||||
import com.sainttx.holograms.api.Hologram;
|
||||
import com.sainttx.holograms.api.HologramManager;
|
||||
import com.sainttx.holograms.api.line.TextLine;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
|
||||
public class HologramsPlugin extends HologramSupport {
|
||||
private final HologramManager hologramManager = JavaPlugin.getPlugin(HologramPlugin.class).getHologramManager();
|
||||
|
||||
public HologramsPlugin() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayIndicator(Location loc, String message, Player player) {
|
||||
Hologram hologram = new Hologram("MMOItems_" + UUID.randomUUID().toString(), loc);
|
||||
hologramManager.addActiveHologram(hologram);
|
||||
hologram.addLine(new TextLine(hologram, message));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, () -> hologramManager.deleteHologram(hologram), 20);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.holograms;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.Hologram;
|
||||
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class HolographicDisplaysPlugin extends HologramSupport {
|
||||
public HolographicDisplaysPlugin() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayIndicator(Location loc, String format, Player player) {
|
||||
Hologram hologram = HologramsAPI.createHologram(MMOItems.plugin, loc);
|
||||
hologram.appendTextLine(format);
|
||||
if (player != null)
|
||||
hologram.getVisibilityManager().hideTo(player);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, hologram::delete, 20);
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.holograms;
|
||||
|
||||
import me.arasple.mc.trhologram.api.TrHologramAPI;
|
||||
import me.arasple.mc.trhologram.module.display.Hologram;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* updated comp provided through discord
|
||||
* @author TUCAOEVER
|
||||
*/
|
||||
public class TrHologramPlugin extends HologramSupport
|
||||
{
|
||||
@Override
|
||||
public void displayIndicator(final Location loc, final String format, final Player player) {
|
||||
Hologram hologram = TrHologramAPI.builder(loc)
|
||||
.append(format)
|
||||
.build();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, hologram::destroy, 20L);
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import io.lumine.mythic.lib.api.util.ui.PlusMinusPercent;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythicenchants.MythicEnchants;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
@ -432,6 +431,13 @@ public class Enchants extends ItemStat implements Upgradable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is useful for custom enchant plugins which
|
||||
* utilize the Enchantment bukkit interface.
|
||||
*
|
||||
* @param key String input which can either be the enchant key or name
|
||||
* @return Found bukkit enchantment instance
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Enchantment getEnchant(String key) {
|
||||
key = key.toLowerCase().replace("-", "_");
|
||||
|
@ -210,21 +210,6 @@ action-bar-display:
|
||||
mitigation: true
|
||||
item-break: false
|
||||
|
||||
# Displays in-game damage indicators.
|
||||
# Requires HolographicDisplays/Holograms to work.
|
||||
# Requires /reload when enabled/disabled.
|
||||
game-indicators:
|
||||
damage:
|
||||
enabled: true
|
||||
decimal-format: '0.#'
|
||||
format: '&c-#'
|
||||
#format: '&c&l✦ #'
|
||||
heal:
|
||||
enabled: true
|
||||
decimal-format: '0.#'
|
||||
format: '&a+#'
|
||||
#format: '&a&l❤ #'
|
||||
|
||||
recipes:
|
||||
|
||||
# Allows you to use stack amounts for recipe ingredients.
|
||||
|
Loading…
Reference in New Issue
Block a user