diff --git a/build.xml b/build.xml
index 7e4625001..ae05daf13 100644
--- a/build.xml
+++ b/build.xml
@@ -58,6 +58,8 @@
+
+
diff --git a/plugin.yml b/plugin.yml
index 5c9eefa69..a7d75c5a5 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,2 +1,3 @@
name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
+version: WEVERSIONMACRO
\ No newline at end of file
diff --git a/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java
index 8ebd8c589..053449d7e 100644
--- a/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java
+++ b/src/com/sk89q/worldedit/bukkit/BukkitPlayer.java
@@ -74,6 +74,7 @@ public class BukkitPlayer extends LocalPlayer {
@Override
public void giveItem(int type, int amt) {
+ player.getWorld().dropItem(player.getLocation(), new ItemStack(type, amt));
// TODO Auto-generated method stub
}
@@ -101,7 +102,8 @@ public class BukkitPlayer extends LocalPlayer {
@Override
public void setPosition(Vector pos, float pitch, float yaw) {
- // TODO Auto-generated method stub
+ player.teleportTo(new Location(player.getWorld(), pos.getX(), pos.getY(),
+ pos.getZ(), yaw, pitch));
}
@Override
diff --git a/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java
index 3755be932..8b90aeeed 100644
--- a/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java
+++ b/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java
@@ -20,11 +20,7 @@
package com.sk89q.worldedit.bukkit;
import org.bukkit.*;
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.ServerInterface;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.blocks.BaseItemStack;
public class BukkitServerInterface extends ServerInterface {
public Server server;
@@ -34,68 +30,9 @@ public class BukkitServerInterface extends ServerInterface {
}
@Override
- public boolean setBlockType(LocalWorld world, Vector pt, int type) {
- ((BukkitWorld)world).getWorld().getBlockAt(
- pt.getBlockX(),
- pt.getBlockY(),
- pt.getBlockZ()).setTypeID(type);
-
- return true;
- }
-
- @Override
- public int getBlockType(LocalWorld world, Vector pt) {
- return ((BukkitWorld)world).getWorld().getBlockAt(
- pt.getBlockX(),
- pt.getBlockY(),
- pt.getBlockZ()).getTypeID();
- }
-
- @Override
- public void setBlockData(LocalWorld world, Vector pt, int data) {
- ((BukkitWorld)world).getWorld().getBlockAt(
- pt.getBlockX(),
- pt.getBlockY(),
- pt.getBlockZ()).setData((byte)data);
-
- }
-
- @Override
- public int getBlockData(LocalWorld world, Vector pt) {
- return ((BukkitWorld)world).getWorld().getBlockAt(
- pt.getBlockX(),
- pt.getBlockY(),
- pt.getBlockZ()).getData();
- }
-
- @Override
- public void setSignText(LocalWorld world, Vector pt, String[] text) {
+ public int resolveItem(String name) {
// TODO Auto-generated method stub
-
- }
-
- @Override
- public String[] getSignText(LocalWorld world, Vector pt) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BaseItemStack[] getChestContents(LocalWorld world, Vector pt) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean setChestContents(LocalWorld world, Vector pt, BaseItemStack[] contents) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean clearChest(LocalWorld world, Vector pt) {
- // TODO Auto-generated method stub
- return false;
+ return 0;
}
@Override
@@ -104,59 +41,4 @@ public class BukkitServerInterface extends ServerInterface {
return false;
}
- @Override
- public void setMobSpawnerType(LocalWorld world, Vector pt, String mobType) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String getMobSpawnerType(LocalWorld world, Vector pt) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean generateTree(EditSession editSession, LocalWorld world,
- Vector pt) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void dropItem(LocalWorld world, Vector pt, int type, int count, int times) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void dropItem(LocalWorld world, Vector pt, int type, int count) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void dropItem(LocalWorld world, Vector pt, int type) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void simulateBlockMine(LocalWorld world, Vector pt) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public int resolveItem(String name) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int killMobs(LocalWorld world, Vector origin, int radius) {
- // TODO Auto-generated method stub
- return 0;
- }
-
}
diff --git a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java
index 039e88300..8f05871af 100644
--- a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java
+++ b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java
@@ -20,8 +20,10 @@
package com.sk89q.worldedit.bukkit;
import org.bukkit.World;
-
+import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalWorld;
+import com.sk89q.worldedit.Vector;
+import com.sk89q.worldedit.blocks.BaseItemStack;
public class BukkitWorld extends LocalWorld {
private World world;
@@ -34,6 +36,104 @@ public class BukkitWorld extends LocalWorld {
return world;
}
+ @Override
+ public boolean setBlockType(Vector pt, int type) {
+ return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).setTypeID(type);
+ }
+
+ @Override
+ public int getBlockType(Vector pt) {
+ return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getTypeID();
+ }
+
+ @Override
+ public void setBlockData(Vector pt, int data) {
+ world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).setData((byte)data);
+
+ }
+
+ @Override
+ public int getBlockData(Vector pt) {
+ return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getData();
+ }
+
+ @Override
+ public void setSignText(Vector pt, String[] text) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public String[] getSignText(Vector pt) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BaseItemStack[] getChestContents(Vector pt) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean setChestContents(Vector pt, BaseItemStack[] contents) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean clearChest(Vector pt) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setMobSpawnerType(Vector pt, String mobType) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getMobSpawnerType(Vector pt) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean generateTree(EditSession editSession, Vector pt) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void dropItem(Vector pt, int type, int count, int times) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dropItem(Vector pt, int type, int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dropItem(Vector pt, int type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void simulateBlockMine(Vector pt) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int killMobs(Vector origin, int radius) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
@Override
public boolean equals(Object other) {
if (!(other instanceof BukkitWorld)) {
diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java
index c27267455..74d28e779 100644
--- a/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java
+++ b/src/com/sk89q/worldedit/bukkit/WorldEditBlockListener.java
@@ -23,7 +23,6 @@ import org.bukkit.Player;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockBrokenEvent;
import org.bukkit.event.block.BlockPlacedEvent;
-import org.bukkit.event.block.BlockRightClickedEvent;
import com.sk89q.worldedit.*;
public class WorldEditBlockListener extends BlockListener {
@@ -47,12 +46,12 @@ public class WorldEditBlockListener extends BlockListener {
* @param event Relevant event details
*/
public void onBlockBroken(BlockBrokenEvent event) {
- Vector pos = new Vector(event.getBlock().getX(),
- event.getBlock().getY(),
- event.getBlock().getZ());
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
+ WorldVector pos = new WorldVector(world, event.getBlock().getX(),
+ event.getBlock().getY(), event.getBlock().getZ());
LocalPlayer player = wrapPlayer(event.getPlayer());
- plugin.controller.handleBlockLeftClick(player, world, pos);
+
+ plugin.controller.handleBlockLeftClick(player, pos);
}
/**
@@ -61,12 +60,12 @@ public class WorldEditBlockListener extends BlockListener {
* @param event Relevant event details
*/
public void onBlockPlaced(BlockPlacedEvent event) {
- Vector pos = new Vector(event.getBlock().getX(),
- event.getBlock().getY(),
- event.getBlock().getZ());
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
+ WorldVector pos = new WorldVector(world, event.getBlock().getX(),
+ event.getBlock().getY(), event.getBlock().getZ());
LocalPlayer player = wrapPlayer(event.getPlayer());
- plugin.controller.handleBlockRightClick(player, world, pos);
+
+ plugin.controller.handleBlockRightClick(player, pos);
}
private BukkitPlayer wrapPlayer(Player player) {
diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java
index a7fee149c..20aa00d9c 100644
--- a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java
+++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java
@@ -23,7 +23,6 @@ import org.bukkit.*;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
-import com.sk89q.worldedit.*;
/**
* Handles all events thrown in relation to a Player
diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java
index d386e6804..5e5931adc 100644
--- a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java
+++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java
@@ -29,6 +29,11 @@ import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
import com.sk89q.worldedit.*;
+/**
+ * Plugin for Bukkit.
+ *
+ * @author sk89qs
+ */
public class WorldEditPlugin extends JavaPlugin {
public final ServerInterface server;
public final WorldEditController controller;