From 0e4db041021fa6eb30ffa82356d724fdd5d10324 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot <noreply+git-craftbukkit@papermc.io> Date: Fri, 24 Dec 2010 17:24:21 +0000 Subject: [PATCH] Load sample plugin for now By: Dinnerbone <dinnerbone@dinnerbone.com> --- paper-server/.gitignore | 7 ++++++ .../org/bukkit/craftbukkit/CraftServer.java | 25 ++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 paper-server/.gitignore diff --git a/paper-server/.gitignore b/paper-server/.gitignore new file mode 100644 index 0000000000..f0fde81a2a --- /dev/null +++ b/paper-server/.gitignore @@ -0,0 +1,7 @@ + +/jarjar +/build +/build.xml +/manifest.mf +/nbproject +/dist \ No newline at end of file diff --git a/paper-server/src/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/org/bukkit/craftbukkit/CraftServer.java index c275359ee9..8d2d602341 100644 --- a/paper-server/src/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/org/bukkit/craftbukkit/CraftServer.java @@ -1,16 +1,22 @@ package org.bukkit.craftbukkit; -import java.util.ArrayList; +import java.io.File; import java.util.HashMap; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bukkit.*; import net.minecraft.server.*; +import org.bukkit.plugin.InvalidPluginException; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPluginLoader; -public class CraftServer implements Server { - private final String serverName = "CraftBucket"; +public final class CraftServer implements Server { + private final String serverName = "Craftbukkit"; private final String serverVersion; private final HashMap<String, Player> playerCache = new HashMap<String, Player>(); + private final PluginManager pluginManager = new PluginManager(this); protected final MinecraftServer console; protected final hl server; @@ -20,6 +26,16 @@ public class CraftServer implements Server { console = instance; server = console.f; + + pluginManager.RegisterInterface(JavaPluginLoader.class); + + try { + pluginManager.loadPlugin(new File("sample.jar")); + } catch (InvalidPluginException ex) { + Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, null, ex); + } catch (Throwable ex) { + Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "(Did you extract the lib folder?)", ex); + } } public String getName() { @@ -48,4 +64,7 @@ public class CraftServer implements Server { return players; } + public PluginManager getPluginManager() { + return pluginManager; + } }