Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-24 07:10:10 +01:00
Implemented startup plugin loading
Dieser Commit ist enthalten in:
Ursprung
ff67eda4c4
Commit
d647e2098e
@ -25,6 +25,7 @@ import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
|||||||
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||||
import org.bukkit.craftbukkit.util.ServerShutdownThread;
|
import org.bukkit.craftbukkit.util.ServerShutdownThread;
|
||||||
import org.bukkit.event.world.WorldSaveEvent;
|
import org.bukkit.event.world.WorldSaveEvent;
|
||||||
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
// CraftBukkit
|
// CraftBukkit
|
||||||
|
|
||||||
public class MinecraftServer implements Runnable, ICommandListener {
|
public class MinecraftServer implements Runnable, ICommandListener {
|
||||||
@ -263,7 +264,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
this.i = null;
|
this.i = null;
|
||||||
this.j = 0;
|
this.j = 0;
|
||||||
|
|
||||||
server.loadPlugins(); // CraftBukkit
|
server.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveChunks() { // CraftBukkit - private -> default
|
void saveChunks() { // CraftBukkit - private -> default
|
||||||
|
@ -58,6 +58,7 @@ import org.bukkit.craftbukkit.command.ServerCommandListener;
|
|||||||
import org.bukkit.scheduler.BukkitWorker;
|
import org.bukkit.scheduler.BukkitWorker;
|
||||||
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
import org.bukkit.event.world.WorldInitEvent;
|
||||||
|
import org.bukkit.plugin.PluginLoadOrder;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
import org.bukkit.util.config.ConfigurationNode;
|
import org.bukkit.util.config.ConfigurationNode;
|
||||||
|
|
||||||
@ -87,6 +88,8 @@ public final class CraftServer implements Server {
|
|||||||
configuration.load();
|
configuration.load();
|
||||||
loadConfigDefaults();
|
loadConfigDefaults();
|
||||||
configuration.save();
|
configuration.save();
|
||||||
|
loadPlugins();
|
||||||
|
enablePlugins(PluginLoadOrder.STARTUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfigDefaults() {
|
private void loadConfigDefaults() {
|
||||||
@ -110,20 +113,13 @@ public final class CraftServer implements Server {
|
|||||||
File pluginFolder = (File) console.options.valueOf("plugins");
|
File pluginFolder = (File) console.options.valueOf("plugins");
|
||||||
|
|
||||||
if (pluginFolder.exists()) {
|
if (pluginFolder.exists()) {
|
||||||
try {
|
Plugin[] plugins = pluginManager.loadPlugins(pluginFolder);
|
||||||
Plugin[] plugins = pluginManager.loadPlugins(pluginFolder);
|
for (Plugin plugin : plugins) {
|
||||||
for (Plugin plugin : plugins) {
|
try {
|
||||||
try {
|
plugin.onLoad();
|
||||||
plugin.onLoad();
|
} catch (Throwable ex) {
|
||||||
} catch (Throwable ex) {
|
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||||
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (Plugin plugin : plugins) {
|
|
||||||
loadPlugin(plugin);
|
|
||||||
}
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " (Is it up to date?)", ex);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pluginFolder.mkdir();
|
pluginFolder.mkdir();
|
||||||
@ -132,6 +128,15 @@ public final class CraftServer implements Server {
|
|||||||
commandMap.registerServerAliases();
|
commandMap.registerServerAliases();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enablePlugins(PluginLoadOrder type) {
|
||||||
|
Plugin[] plugins = pluginManager.getPlugins();
|
||||||
|
for (Plugin plugin : plugins) {
|
||||||
|
if ((!plugin.isEnabled()) && (plugin.getDescription().getLoad() == type)) {
|
||||||
|
loadPlugin(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void disablePlugins() {
|
public void disablePlugins() {
|
||||||
pluginManager.disablePlugins();
|
pluginManager.disablePlugins();
|
||||||
}
|
}
|
||||||
@ -349,6 +354,8 @@ public final class CraftServer implements Server {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
loadPlugins();
|
loadPlugins();
|
||||||
|
enablePlugins(PluginLoadOrder.STARTUP);
|
||||||
|
enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren