mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-19 15:27:45 +01:00
Better handling of plugin reloaders and /reload
This commit is contained in:
parent
4a4661ef8d
commit
5f2ddc6ae1
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.gmail.filoghost.holographicdisplays.SimpleUpdater.ResponseHandler;
|
import com.gmail.filoghost.holographicdisplays.SimpleUpdater.ResponseHandler;
|
||||||
@ -20,6 +21,8 @@ import com.gmail.filoghost.holographicdisplays.metrics.MetricsLite;
|
|||||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
|
import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
|
||||||
import com.gmail.filoghost.holographicdisplays.object.NamedHologram;
|
import com.gmail.filoghost.holographicdisplays.object.NamedHologram;
|
||||||
import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager;
|
import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager;
|
||||||
|
import com.gmail.filoghost.holographicdisplays.object.PluginHologram;
|
||||||
|
import com.gmail.filoghost.holographicdisplays.object.PluginHologramManager;
|
||||||
import com.gmail.filoghost.holographicdisplays.placeholder.AnimationsRegister;
|
import com.gmail.filoghost.holographicdisplays.placeholder.AnimationsRegister;
|
||||||
import com.gmail.filoghost.holographicdisplays.placeholder.PlaceholdersManager;
|
import com.gmail.filoghost.holographicdisplays.placeholder.PlaceholdersManager;
|
||||||
import com.gmail.filoghost.holographicdisplays.task.BungeeCleanupTask;
|
import com.gmail.filoghost.holographicdisplays.task.BungeeCleanupTask;
|
||||||
@ -56,12 +59,12 @@ public class HolographicDisplays extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
// Blocks plugin reloaders and the /reload command.
|
// Warn about plugin reloaders and the /reload command.
|
||||||
if (instance != null) {
|
if (instance != null || System.getProperty("HolographicDisplaysLoaded") != null) {
|
||||||
getLogger().warning("Please do not use /reload or plugin reloaders. Do \"/holograms reload\" instead.");
|
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[HolographicDisplays] Please do not use /reload or plugin reloaders. Use the command \"/holograms reload\" instead. You will receive no support for doing this operation.");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.setProperty("HolographicDisplaysLoaded", "true");
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
// Load placeholders.yml.
|
// Load placeholders.yml.
|
||||||
@ -140,7 +143,7 @@ public class HolographicDisplays extends JavaPlugin {
|
|||||||
"******************************************************",
|
"******************************************************",
|
||||||
" This version of HolographicDisplays can",
|
" This version of HolographicDisplays can",
|
||||||
" only work on these server versions:",
|
" only work on these server versions:",
|
||||||
" from 1.6.4 to 1.9.",
|
" from 1.6.4 to 1.9.2.",
|
||||||
" The plugin will be disabled.",
|
" The plugin will be disabled.",
|
||||||
"******************************************************"
|
"******************************************************"
|
||||||
);
|
);
|
||||||
@ -173,7 +176,7 @@ public class HolographicDisplays extends JavaPlugin {
|
|||||||
// ProtocolLib check.
|
// ProtocolLib check.
|
||||||
try {
|
try {
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("ProtocolLib")) {
|
if (Bukkit.getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
ProtocolLibHook protocolLibHook;
|
ProtocolLibHook protocolLibHook;
|
||||||
|
|
||||||
if (is19orGreater) {
|
if (is19orGreater) {
|
||||||
protocolLibHook = new com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.ProtocolLibHookImpl();
|
protocolLibHook = new com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.ProtocolLibHookImpl();
|
||||||
@ -256,6 +259,9 @@ public class HolographicDisplays extends JavaPlugin {
|
|||||||
for (NamedHologram hologram : NamedHologramManager.getHolograms()) {
|
for (NamedHologram hologram : NamedHologramManager.getHolograms()) {
|
||||||
hologram.despawnEntities();
|
hologram.despawnEntities();
|
||||||
}
|
}
|
||||||
|
for (PluginHologram hologram : PluginHologramManager.getHolograms()) {
|
||||||
|
hologram.despawnEntities();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NMSManager getNMSManager() {
|
public static NMSManager getNMSManager() {
|
||||||
|
Loading…
Reference in New Issue
Block a user