From 51794bae44f8dfa192dcc5af83258ad54d0d551e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 11 Jan 2011 12:03:52 -0800 Subject: [PATCH] And so it begins... --- vBlockListener.java | 9 +++++++++ vMinecraft.java | 46 ++++++++++++++++++++++++++++++++++++++++++++ vPlayerListener.java | 9 +++++++++ 3 files changed, 64 insertions(+) create mode 100644 vBlockListener.java create mode 100644 vMinecraft.java create mode 100644 vPlayerListener.java diff --git a/vBlockListener.java b/vBlockListener.java new file mode 100644 index 000000000..0036da9e7 --- /dev/null +++ b/vBlockListener.java @@ -0,0 +1,9 @@ +import org.bukkit.event.block.*; +import org.bukkit.*; +public class vBlockListener extends BlockListener { + private vMinecraft plugin; + + public vBlockListener(vMinecraft plugin) { + this.plugin = plugin; + } +} diff --git a/vMinecraft.java b/vMinecraft.java new file mode 100644 index 000000000..135cd0b9d --- /dev/null +++ b/vMinecraft.java @@ -0,0 +1,46 @@ +import java.io.File; +import java.util.HashMap; +//Needed for using Color +import org.bukkit.Color; +import org.bukkit.Player; +import org.bukkit.Server; +import org.bukkit.event.Event.Priority; +import org.bukkit.event.Event; +import org.bukkit.plugin.PluginDescriptionFile; +import org.bukkit.plugin.PluginLoader; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.PluginManager; +public class vMinecraft extends JavaPlugin { +private vPlayerListener playerListener; +private vBlockListener blockListener; + + public void onEnable() { + // TODO: Place any custom enable code here including the registration of any events + + // Register our events + PluginManager pm = getServer().getPluginManager(); + + + // EXAMPLE: Custom code, here we just output some info so we can check all is well + PluginDescriptionFile pdfFile = this.getDescription(); + System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); + } + public void onDisable() { + // TODO: Place any custom disable code here + + // NOTE: All registered events are automatically unregistered when a plugin is disabled + + // EXAMPLE: Custom code, here we just output some info so we can check all is well + System.out.println("Goodbye world!"); + } + + private void registerEvents() { + //These are the events, as far as I know they work a lot like hooks from hMod... if not exactly + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Normal, this); + getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this); + } +} \ No newline at end of file diff --git a/vPlayerListener.java b/vPlayerListener.java new file mode 100644 index 000000000..f815733c6 --- /dev/null +++ b/vPlayerListener.java @@ -0,0 +1,9 @@ +import org.bukkit.*; +import org.bukkit.event.player.*; +public class vPlayerListener extends PlayerListener { + private vMinecraft plugin; + + public vPlayerListener(vMinecraft plugin) { + this.plugin = plugin; + } +}