Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Updated Bukkit support.
Dieser Commit ist enthalten in:
Ursprung
8e44295304
Commit
8e4558a246
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren