diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-01-03 19:17:31 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-01-03 19:17:31 +0100 |
commit | ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14 (patch) | |
tree | 8e6fa3e14f56569506f10b3e1900d76191d6c033 | |
parent | 660032073711a6fe5f0ec25560ce3c66aa730a22 (diff) | |
download | bukkit-ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14.tar bukkit-ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14.tar.gz bukkit-ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14.tar.lz bukkit-ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14.tar.xz bukkit-ebfefc8dcfd5fab5092a90f3fb0c0f2d58980b14.zip |
Cleanups. We use Maven, not Ant.
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | build.xml | 39 | ||||
-rw-r--r-- | sample/src/com/dinnerbone/bukkit/sample/SampleBlockListener.java | 42 | ||||
-rw-r--r-- | sample/src/com/dinnerbone/bukkit/sample/SamplePlayerListener.java | 73 | ||||
-rw-r--r-- | sample/src/com/dinnerbone/bukkit/sample/SamplePlugin.java | 58 | ||||
-rw-r--r-- | sample/src/plugin.yml | 2 |
7 files changed, 15 insertions, 221 deletions
@@ -6,15 +6,11 @@ # netbeans /nbproject +# we use maven! +/build.xml + # maven /target # vim .*.sw[a-p] - -# test stuff (do remove me!) -/sample/test -/sample/build.xml -/sample/build -/sample/dist -/sample/nbproject diff --git a/README.md b/README.md new file mode 100644 index 00000000..a5cab05c --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +Bukkit +====== + +A Minecraft Server API. + +Compilation +----------- + +We use maven to handle our dependencies. + +* Install [.Mmaven 3](http://maven.apache.org/download.html) +* Check out this repo and: `mvn clean install` diff --git a/build.xml b/build.xml deleted file mode 100644 index 62e9d2d9..00000000 --- a/build.xml +++ /dev/null @@ -1,39 +0,0 @@ -<project name="Bukkit" default="dist" basedir="."> - <property name="minecraft" location="../../"/> - - <property name="src" location="src"/> - <property name="bin" location="bin"/> - <property name="dist" location="dist"/> - <property name="lib" location="lib"/> - - <target name="init"> - <mkdir dir="${bin}"/> - <mkdir dir="${lib}"/> - <get src="http://repo2.maven.org/maven2/org/yaml/snakeyaml/1.7/snakeyaml-1.7.jar" dest="${lib}/snakeyaml-1.7.jar"/> - </target> - - <target name="compile" depends="init"> - <javac srcdir="${src}" destdir="${bin}" includeantruntime="false"> - <classpath> - <fileset dir="${lib}"> - <include name="snakeyaml-1.7.jar"/> - </fileset> - </classpath> - </javac> - </target> - - <target name="dist" depends="compile"> - <mkdir dir="${dist}"/> - <jar jarfile="${dist}/Bukkit.jar" basedir="${bin}" /> - </target> - - <target name="deploy" depends="dist"> - <copy file="${dist}/Bukkit.jar" todir="${minecraft}"/> - </target> - - <target name="clean"> - <delete dir="${bin}"/> - <delete dir="${lib}"/> - <delete dir="${dist}"/> - </target> -</project> diff --git a/sample/src/com/dinnerbone/bukkit/sample/SampleBlockListener.java b/sample/src/com/dinnerbone/bukkit/sample/SampleBlockListener.java deleted file mode 100644 index 57f27e46..00000000 --- a/sample/src/com/dinnerbone/bukkit/sample/SampleBlockListener.java +++ /dev/null @@ -1,42 +0,0 @@ - -package com.dinnerbone.bukkit.sample; - -import org.bukkit.Block; -import org.bukkit.BlockFace; -import org.bukkit.Material; -import org.bukkit.event.block.BlockCanBuildEvent; -import org.bukkit.event.block.BlockListener; -import org.bukkit.event.block.BlockPhysicsEvent; - -/** - * Sample block listener - * @author Dinnerbone - */ -public class SampleBlockListener extends BlockListener { - private final SamplePlugin plugin; - - public SampleBlockListener(final SamplePlugin plugin) { - this.plugin = plugin; - } - - @Override - public void onBlockPhysics(BlockPhysicsEvent event) { - Block block = event.getBlock(); - - if ((block.getType() == Material.Sand) || (block.getType() == Material.Gravel)) { - Block above = block.getFace(BlockFace.Up); - if (above.getType() == Material.IronBlock) { - event.setCancelled(true); - } - } - } - - @Override - public void onBlockCanBuild(BlockCanBuildEvent event) { - Material mat = event.getMaterial(); - - if (mat.equals(Material.Cactus)) { - event.setBuildable(true); - } - } -} diff --git a/sample/src/com/dinnerbone/bukkit/sample/SamplePlayerListener.java b/sample/src/com/dinnerbone/bukkit/sample/SamplePlayerListener.java deleted file mode 100644 index 4196188e..00000000 --- a/sample/src/com/dinnerbone/bukkit/sample/SamplePlayerListener.java +++ /dev/null @@ -1,73 +0,0 @@ - -package com.dinnerbone.bukkit.sample; - -import org.bukkit.Location; -import org.bukkit.Player; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerListener; -import org.bukkit.event.player.PlayerMoveEvent; - -/** - * Handle events for all Player related events - * @author Dinnerbone - */ -public class SamplePlayerListener extends PlayerListener { - private final SamplePlugin plugin; - - public SamplePlayerListener(SamplePlugin instance) { - plugin = instance; - } - - @Override - public void onPlayerJoin(PlayerEvent event) { - System.out.println(event.getPlayer().getName() + " joined the server! :D"); - } - - @Override - public void onPlayerQuit(PlayerEvent event) { - System.out.println(event.getPlayer().getName() + " left the server! :'("); - } - - @Override - public void onPlayerCommand(PlayerChatEvent event) { - String[] split = event.getMessage().split(" "); - Player player = event.getPlayer(); - - if (split[0].equalsIgnoreCase("/pos")) { - if (split.length == 1) { - Location location = player.getLocation(); - player.sendMessage("You are currently at " + location.getX() +"," + location.getY() + "," + location.getZ() + - " with " + location.getYaw() + " yaw and " + location.getPitch() + " pitch"); - } else if (split.length == 4) { - try { - double x = Double.parseDouble(split[1]); - double y = Double.parseDouble(split[2]); - double z = Double.parseDouble(split[3]); - - player.teleportTo(new Location(player.getWorld(), x, y, z)); - } catch (NumberFormatException ex) { - player.sendMessage("Given location is invalid"); - } - } else { - player.sendMessage("Usage: '/pos' to get current position, or '/pos x y z' to teleport to x,y,z"); - } - - event.setCancelled(true); - } else if (split[0].equalsIgnoreCase("/debug")) { - plugin.setDebugging(player, !plugin.isDebugging(player)); - - event.setCancelled(true); - } - } - - @Override - public void onPlayerMove(PlayerMoveEvent event) { - if (plugin.isDebugging(event.getPlayer())) { - Location from = event.getFrom(); - Location to = event.getTo(); - - System.out.println(String.format("From %.2f,%.2f,%.2f to %.2f,%.2f,%.2f", from.getX(), from.getY(), from.getZ(), to.getX(), to.getY(), to.getZ())); - } - } -} diff --git a/sample/src/com/dinnerbone/bukkit/sample/SamplePlugin.java b/sample/src/com/dinnerbone/bukkit/sample/SamplePlugin.java deleted file mode 100644 index 4d0de3d4..00000000 --- a/sample/src/com/dinnerbone/bukkit/sample/SamplePlugin.java +++ /dev/null @@ -1,58 +0,0 @@ - -package com.dinnerbone.bukkit.sample; - -import java.io.File; -import java.util.HashMap; -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; - -/** - * Sample plugin for Bukkit - * - * @author Dinnerbone - */ -public class SamplePlugin extends JavaPlugin { - private final SamplePlayerListener playerListener = new SamplePlayerListener(this); - private final SampleBlockListener blockListener = new SampleBlockListener(this); - private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>(); - - public SamplePlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) { - super(pluginLoader, instance, desc, plugin, cLoader); - - registerEvents(); - } - - public void onDisable() { - System.out.println("Goodbye world!"); - } - - public void onEnable() { - System.out.println("Hello world!"); - } - - private void registerEvents() { - 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_COMMAND, playerListener, Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.BLOCK_CANBUILD, blockListener, Priority.Normal, this); - } - - public boolean isDebugging(final Player player) { - if (debugees.containsKey(player)) { - return debugees.get(player); - } else { - return false; - } - } - - public void setDebugging(final Player player, final boolean value) { - debugees.put(player, value); - } -} diff --git a/sample/src/plugin.yml b/sample/src/plugin.yml deleted file mode 100644 index e4d19dc7..00000000 --- a/sample/src/plugin.yml +++ /dev/null @@ -1,2 +0,0 @@ -name: Sample Plugin -main: com.dinnerbone.bukkit.sample.SamplePlugin |