diff --git a/lib/CMI.jar b/lib/CMI.jar deleted file mode 100644 index 2e76be83..00000000 Binary files a/lib/CMI.jar and /dev/null differ diff --git a/lib/Citizens.jar b/lib/Citizens.jar deleted file mode 100644 index 5b89ae94..00000000 Binary files a/lib/Citizens.jar and /dev/null differ diff --git a/lib/Holograms.jar b/lib/Holograms.jar deleted file mode 100644 index 51871132..00000000 Binary files a/lib/Holograms.jar and /dev/null differ diff --git a/lib/HolographicDisplays.jar b/lib/HolographicDisplays.jar deleted file mode 100644 index a2ef58db..00000000 Binary files a/lib/HolographicDisplays.jar and /dev/null differ diff --git a/lib/Residence.jar b/lib/Residence.jar deleted file mode 100644 index d560907e..00000000 Binary files a/lib/Residence.jar and /dev/null differ diff --git a/lib/SpartanAPI.jar b/lib/SpartanAPI.jar deleted file mode 100644 index 1f2d578a..00000000 Binary files a/lib/SpartanAPI.jar and /dev/null differ diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 63d35289..8ad97c99 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -1,17 +1,5 @@ package net.Indyuce.mmocore; -import java.io.File; -import java.lang.reflect.Field; -import java.util.HashSet; -import java.util.logging.Level; - -import io.papermc.lib.PaperLib; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandMap; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.scheduler.BukkitRunnable; - import io.lumine.mythic.lib.comp.Metrics; import io.lumine.mythic.lib.version.SpigotPlugin; import io.lumine.mythic.utils.plugin.LuminePlugin; @@ -23,18 +11,7 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.social.guilds.Guild; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.debug.DebugMode; -import net.Indyuce.mmocore.command.AttributesCommand; -import net.Indyuce.mmocore.command.ClassCommand; -import net.Indyuce.mmocore.command.DepositCommand; -import net.Indyuce.mmocore.command.FriendsCommand; -import net.Indyuce.mmocore.command.GuildCommand; -import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; -import net.Indyuce.mmocore.command.PartyCommand; -import net.Indyuce.mmocore.command.PlayerStatsCommand; -import net.Indyuce.mmocore.command.QuestsCommand; -import net.Indyuce.mmocore.command.SkillsCommand; -import net.Indyuce.mmocore.command.WaypointsCommand; -import net.Indyuce.mmocore.command.WithdrawCommand; +import net.Indyuce.mmocore.command.*; import net.Indyuce.mmocore.comp.anticheat.AntiCheatSupport; import net.Indyuce.mmocore.comp.anticheat.SpartanPlugin; import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; @@ -43,10 +20,6 @@ import net.Indyuce.mmocore.comp.flags.DefaultFlags; import net.Indyuce.mmocore.comp.flags.FlagPlugin; import net.Indyuce.mmocore.comp.flags.ResidenceFlags; import net.Indyuce.mmocore.comp.flags.WorldGuardFlags; -import net.Indyuce.mmocore.comp.holograms.CMIPlugin; -import net.Indyuce.mmocore.comp.holograms.HologramSupport; -import net.Indyuce.mmocore.comp.holograms.HologramsPlugin; -import net.Indyuce.mmocore.comp.holograms.HolographicDisplaysPlugin; import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsDrops; import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader; import net.Indyuce.mmocore.comp.placeholder.DefaultParser; @@ -58,46 +31,32 @@ import net.Indyuce.mmocore.comp.region.WorldGuardMMOLoader; import net.Indyuce.mmocore.comp.region.WorldGuardRegionHandler; import net.Indyuce.mmocore.comp.vault.VaultEconomy; import net.Indyuce.mmocore.comp.vault.VaultMMOLoader; -import net.Indyuce.mmocore.listener.BlockListener; -import net.Indyuce.mmocore.listener.GoldPouchesListener; -import net.Indyuce.mmocore.listener.GuildListener; -import net.Indyuce.mmocore.listener.LootableChestsListener; -import net.Indyuce.mmocore.listener.PartyListener; -import net.Indyuce.mmocore.listener.PlayerListener; -import net.Indyuce.mmocore.listener.SpellCast; -import net.Indyuce.mmocore.listener.WaypointsListener; +import net.Indyuce.mmocore.listener.*; import net.Indyuce.mmocore.listener.option.DeathExperienceLoss; import net.Indyuce.mmocore.listener.option.NoSpawnerEXP; import net.Indyuce.mmocore.listener.option.RedirectVanillaExp; import net.Indyuce.mmocore.listener.option.VanillaExperienceOverride; import net.Indyuce.mmocore.listener.profession.FishingListener; import net.Indyuce.mmocore.listener.profession.PlayerCollectStats; -import net.Indyuce.mmocore.manager.AttributeManager; -import net.Indyuce.mmocore.manager.ClassManager; -import net.Indyuce.mmocore.manager.ConfigItemManager; -import net.Indyuce.mmocore.manager.ConfigManager; -import net.Indyuce.mmocore.manager.CustomBlockManager; -import net.Indyuce.mmocore.manager.DropTableManager; import net.Indyuce.mmocore.manager.ExperienceManager; -import net.Indyuce.mmocore.manager.InventoryManager; -import net.Indyuce.mmocore.manager.LootChestManager; -import net.Indyuce.mmocore.manager.MMOLoadManager; -import net.Indyuce.mmocore.manager.QuestManager; -import net.Indyuce.mmocore.manager.RestrictionManager; -import net.Indyuce.mmocore.manager.SkillManager; -import net.Indyuce.mmocore.manager.SoundManager; -import net.Indyuce.mmocore.manager.WaypointManager; +import net.Indyuce.mmocore.manager.*; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider; import net.Indyuce.mmocore.manager.data.yaml.YAMLDataProvider; -import net.Indyuce.mmocore.manager.profession.AlchemyManager; -import net.Indyuce.mmocore.manager.profession.EnchantManager; -import net.Indyuce.mmocore.manager.profession.FishingManager; -import net.Indyuce.mmocore.manager.profession.ProfessionManager; -import net.Indyuce.mmocore.manager.profession.SmithingManager; +import net.Indyuce.mmocore.manager.profession.*; import net.Indyuce.mmocore.manager.social.BoosterManager; import net.Indyuce.mmocore.manager.social.PartyManager; import net.Indyuce.mmocore.manager.social.RequestManager; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandMap; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.scheduler.BukkitRunnable; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.HashSet; +import java.util.logging.Level; public class MMOCore extends LuminePlugin { public static MMOCore plugin; @@ -109,7 +68,6 @@ public class MMOCore extends LuminePlugin { public RequestManager requestManager; public ConfigItemManager configItems; public VaultEconomy economy; - public HologramSupport hologramSupport; public AntiCheatSupport antiCheatSupport; public RegionHandler regionHandler = new DefaultRegionHandler(); public FlagPlugin flagPlugin = new DefaultFlags(); @@ -203,17 +161,6 @@ public class MMOCore extends LuminePlugin { getLogger().log(Level.INFO, "Hooked onto Residence"); } - 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"); - } - if (Bukkit.getPluginManager().getPlugin("Spartan") != null) { antiCheatSupport = new SpartanPlugin(); getLogger().log(Level.INFO, "Hooked onto Spartan"); @@ -456,10 +403,6 @@ public class MMOCore extends LuminePlugin { return antiCheatSupport != null; } - public boolean hasHolograms() { - return hologramSupport != null; - } - public boolean hasEconomy() { return economy != null && economy.isValid(); } diff --git a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java index cc52806e..7e96cc08 100644 --- a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java @@ -1,21 +1,11 @@ package net.Indyuce.mmocore.api.experience; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import javax.annotation.Nullable; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Particle; -import org.bukkit.configuration.ConfigurationSection; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - +import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.utils.holograms.Hologram; +import io.lumine.mythic.utils.serialize.Position; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.event.PlayerExperienceGainEvent; @@ -23,7 +13,17 @@ import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect; import net.Indyuce.mmocore.manager.SoundManager; -import io.lumine.mythic.lib.MythicLib; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.configuration.ConfigurationSection; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; public class PlayerProfessions { private final Map exp = new HashMap<>(); @@ -139,9 +139,10 @@ public class PlayerProfessions { value = MMOCore.plugin.boosterManager.calculateExp(profession, value); // display hologram - if (hologramLocation != null && playerData.isOnline() && MMOCore.plugin.hasHolograms()) - MMOCore.plugin.hologramSupport.displayIndicator(hologramLocation.add(.5, 1.5, .5), - MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer()); + if (hologramLocation != null && playerData.isOnline()) { + Hologram holo = Hologram.create(Position.of(hologramLocation.add(.5, 1.5, .5)), Arrays.asList(MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message())); + Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> holo.despawn(), 20); + } PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(playerData, profession, value, source); Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 11f99744..7be6c96e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1,6 +1,8 @@ package net.Indyuce.mmocore.api.player; import io.lumine.mythic.lib.api.player.MMOPlayerData; +import io.lumine.mythic.utils.holograms.Hologram; +import io.lumine.mythic.utils.serialize.Position; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.Waypoint; @@ -470,9 +472,10 @@ public class PlayerData extends OfflinePlayerData { } // Experience hologram - if (hologramLocation != null && isOnline() && MMOCore.plugin.hasHolograms()) - MMOCore.plugin.hologramSupport.displayIndicator(hologramLocation.add(.5, 1.5, .5), - MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer()); + if (hologramLocation != null && isOnline()) { + Hologram holo = Hologram.create(Position.of(hologramLocation.add(.5, 1.5, .5)), Arrays.asList(MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message())); + Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> holo.despawn(), 20); + } value = MMOCore.plugin.boosterManager.calculateExp(null, value); value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100; diff --git a/src/main/java/net/Indyuce/mmocore/comp/holograms/CMIPlugin.java b/src/main/java/net/Indyuce/mmocore/comp/holograms/CMIPlugin.java deleted file mode 100644 index b5d5dec2..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/holograms/CMIPlugin.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.Indyuce.mmocore.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.mmocore.MMOCore; - -public class CMIPlugin extends HologramSupport { - @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().runTaskLater(MMOCore.plugin, () -> CMI.getInstance().getHologramManager().removeHolo(hologram), 20); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramSupport.java b/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramSupport.java deleted file mode 100644 index 1ce668bd..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramSupport.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.Indyuce.mmocore.comp.holograms; - -import javax.annotation.Nullable; - -import org.bukkit.Location; -import org.bukkit.entity.Player; - -public abstract class HologramSupport { - - /** - * Displays a message using a hologram - * - * @param loc The location at which the message should be displayed - * @param message The message to display - * @param player Source player, can be null in some cases source player for - * instance for regen holograms - */ - public abstract void displayIndicator(Location loc, String message, @Nullable Player player); - - public void displayIndicator(Location loc, String message) { - displayIndicator(loc, message, null); - } - - public void displayIndicator(Player player, String message) { - displayIndicator(player.getLocation().add(0, 1, 0), message, player); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramsPlugin.java b/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramsPlugin.java deleted file mode 100644 index 98e2451d..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/holograms/HologramsPlugin.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.Indyuce.mmocore.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.mmocore.MMOCore; - -public class HologramsPlugin extends HologramSupport { - private final HologramManager hologramManager = JavaPlugin.getPlugin(HologramPlugin.class).getHologramManager(); - - @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(MMOCore.plugin, () -> hologramManager.deleteHologram(hologram), 20); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/comp/holograms/HolographicDisplaysPlugin.java b/src/main/java/net/Indyuce/mmocore/comp/holograms/HolographicDisplaysPlugin.java deleted file mode 100644 index 0bf6ceca..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/holograms/HolographicDisplaysPlugin.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.Indyuce.mmocore.comp.holograms; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import com.gmail.filoghost.holographicdisplays.api.Hologram; -import com.gmail.filoghost.holographicdisplays.api.HologramsAPI; - -import net.Indyuce.mmocore.MMOCore; - -public class HolographicDisplaysPlugin extends HologramSupport { - @Override - public void displayIndicator(Location loc, String format, Player player) { - Hologram hologram = HologramsAPI.createHologram(MMOCore.plugin, loc); - hologram.appendTextLine(format); - // if (player != null) - // hologram.getVisibilityManager().hideTo(player); - Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, hologram::delete, 20); - } -}