Don't TP players when plugin is unloading

This commit is contained in:
Daniel Saukel 2020-10-28 18:44:31 +01:00
parent ebaa89a732
commit d3662918c2
3 changed files with 12 additions and 3 deletions

View File

@ -243,12 +243,12 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
if (!loaded) { if (!loaded) {
return; return;
} }
loaded = false;
saveData(); saveData();
deleteAllInstances(); deleteAllInstances();
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
getServer().getScheduler().cancelTasks(this); getServer().getScheduler().cancelTasks(this);
DPermission.unregister(); DPermission.unregister();
loaded = false;
} }
public void initFolders() { public void initFolders() {
@ -560,6 +560,15 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
return groupAdapters; return groupAdapters;
} }
/**
* Returns true if the plugin is not currently in the process of enabling or disabling or entirely disabled, otherwise false.
*
* @return true if the plugin is not currently in the process of enabling or disabling or entirely disabled, otherwise false
*/
public boolean isLoaded() {
return loaded;
}
/** /**
* Returns true if the plugin is currently loading a world, false if not. * Returns true if the plugin is currently loading a world, false if not.
* <p> * <p>

View File

@ -38,7 +38,7 @@ public class StatusCommand extends DCommand {
public static final String TRUE = ChatColor.GREEN + "\u2714"; public static final String TRUE = ChatColor.GREEN + "\u2714";
public static final String FALSE = ChatColor.DARK_RED + "\u2718"; public static final String FALSE = ChatColor.DARK_RED + "\u2718";
public static final String LATEST_IXL = "0.6.2"; public static final String LATEST_IXL = "0.6.3";
public StatusCommand(DungeonsXL plugin) { public StatusCommand(DungeonsXL plugin) {
super(plugin); super(plugin);

View File

@ -169,7 +169,7 @@ public abstract class DInstanceWorld implements InstanceWorld {
public void kickAllPlayers() { public void kickAllPlayers() {
getPlayers().forEach(p -> p.leave()); getPlayers().forEach(p -> p.leave());
// Players who shouldn't be in the dungeon but still are for some reason // Players who shouldn't be in the dungeon but still are for some reason
if (world != null) { if (plugin.isLoaded() && world != null) {
getWorld().getPlayers().forEach(p -> p.teleport(Bukkit.getWorlds().get(0).getSpawnLocation())); getWorld().getPlayers().forEach(p -> p.teleport(Bukkit.getWorlds().get(0).getSpawnLocation()));
} }
} }