3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Updated Bukkit support.

Dieser Commit ist enthalten in:
sk89q 2011-01-09 11:43:47 -08:00
Ursprung 8e44295304
Commit 8e4558a246
3 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -46,7 +46,7 @@ public class BukkitPlayer extends LocalPlayer {
@Override
public int getItemInHand() {
ItemStack itemStack = player.getSelectedItem();
ItemStack itemStack = player.getItemInHand();
return itemStack != null ? itemStack.getTypeID() : 0;
}

Datei anzeigen

@ -23,6 +23,8 @@ 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 {
@ -55,19 +57,17 @@ public class WorldEditBlockListener extends BlockListener {
}
/**
* Called when a player places a block
* Called when a player right clicks a block
*
* @param event Relevant event details
*/
public void onBlockPlaced(BlockPlacedEvent event) {
public void onBlockRightClicked(BlockRightClickedEvent event) {
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());
if (plugin.controller.handleBlockRightClick(player, pos)) {
event.setCancelled(true);
}
plugin.controller.handleBlockRightClick(player, pos);
}
private BukkitPlayer wrapPlayer(Player player) {

Datei anzeigen

@ -76,7 +76,7 @@ public class WorldEditPlugin extends JavaPlugin {
playerListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
blockListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED,
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_RIGHTCLICKED,
blockListener, Priority.Normal, this);
}
}