New API of TPluginManager#delayDisable
This commit is contained in:
parent
1878a67c6e
commit
8479abf02d
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.skymc</groupId>
|
<groupId>me.skymc</groupId>
|
||||||
<artifactId>TabooLib</artifactId>
|
<artifactId>TabooLib</artifactId>
|
||||||
<version>4.09</version>
|
<version>4.10</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -20,6 +20,7 @@ import java.util.regex.Pattern;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class TPluginManager implements PluginManager {
|
public class TPluginManager implements PluginManager {
|
||||||
|
|
||||||
|
private static TPluginManager singleton;
|
||||||
private final PluginManager instance;
|
private final PluginManager instance;
|
||||||
private final Main main = (Main) Main.getInst();
|
private final Main main = (Main) Main.getInst();
|
||||||
private static File updateDirectory = null;
|
private static File updateDirectory = null;
|
||||||
@ -33,6 +34,12 @@ public class TPluginManager implements PluginManager {
|
|||||||
private Map<String, Map<Permissible, Boolean>> permSubs = new HashMap<>();
|
private Map<String, Map<Permissible, Boolean>> permSubs = new HashMap<>();
|
||||||
private Map<Boolean, Map<Permissible, Boolean>> defSubs = new HashMap<>();
|
private Map<Boolean, Map<Permissible, Boolean>> defSubs = new HashMap<>();
|
||||||
private boolean useTimings = false;
|
private boolean useTimings = false;
|
||||||
|
private List<Plugin> delayedDisable = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void delayDisable(Plugin plugin) {
|
||||||
|
if (!singleton.delayedDisable.contains(plugin))
|
||||||
|
singleton.delayedDisable.add(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
public TPluginManager() {
|
public TPluginManager() {
|
||||||
instance = Bukkit.getPluginManager();
|
instance = Bukkit.getPluginManager();
|
||||||
@ -48,6 +55,7 @@ public class TPluginManager implements PluginManager {
|
|||||||
cloneField("permSubs");
|
cloneField("permSubs");
|
||||||
cloneField("defSubs");
|
cloneField("defSubs");
|
||||||
cloneField("useTimings");
|
cloneField("useTimings");
|
||||||
|
singleton = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cloneField(String bukkitName) {
|
private void cloneField(String bukkitName) {
|
||||||
@ -104,10 +112,12 @@ public class TPluginManager implements PluginManager {
|
|||||||
@Override
|
@Override
|
||||||
public void disablePlugins() {
|
public void disablePlugins() {
|
||||||
for (Plugin plugin : getPlugins()) {
|
for (Plugin plugin : getPlugins()) {
|
||||||
if (plugin != main) {
|
if (plugin != main && !delayedDisable.contains(plugin)) {
|
||||||
disablePlugin(plugin);
|
disablePlugin(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Collections.reverse(delayedDisable);
|
||||||
|
delayedDisable.forEach(singleton::disablePlugin);
|
||||||
disablePlugin(main);
|
disablePlugin(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user