forked from Upstream/mmocore
using holos from MythicLib
This commit is contained in:
parent
3d140f5b5e
commit
b06f38c2eb
BIN
lib/CMI.jar
BIN
lib/CMI.jar
Binary file not shown.
BIN
lib/Citizens.jar
BIN
lib/Citizens.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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();
|
||||
}
|
||||
|
@ -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<String, Integer> 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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user