mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Updated Bukkit support.
This commit is contained in:
parent
8e44295304
commit
8e4558a246
@ -46,7 +46,7 @@ public class BukkitPlayer extends LocalPlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemInHand() {
|
public int getItemInHand() {
|
||||||
ItemStack itemStack = player.getSelectedItem();
|
ItemStack itemStack = player.getItemInHand();
|
||||||
return itemStack != null ? itemStack.getTypeID() : 0;
|
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.BlockListener;
|
||||||
import org.bukkit.event.block.BlockBrokenEvent;
|
import org.bukkit.event.block.BlockBrokenEvent;
|
||||||
import org.bukkit.event.block.BlockPlacedEvent;
|
import org.bukkit.event.block.BlockPlacedEvent;
|
||||||
|
import org.bukkit.event.block.BlockRightClickedEvent;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
|
||||||
public class WorldEditBlockListener extends BlockListener {
|
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
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
public void onBlockPlaced(BlockPlacedEvent event) {
|
public void onBlockRightClicked(BlockRightClickedEvent event) {
|
||||||
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
|
LocalWorld world = new BukkitWorld(event.getBlock().getWorld());
|
||||||
WorldVector pos = new WorldVector(world, event.getBlock().getX(),
|
WorldVector pos = new WorldVector(world, event.getBlock().getX(),
|
||||||
event.getBlock().getY(), event.getBlock().getZ());
|
event.getBlock().getY(), event.getBlock().getZ());
|
||||||
LocalPlayer player = wrapPlayer(event.getPlayer());
|
LocalPlayer player = wrapPlayer(event.getPlayer());
|
||||||
|
|
||||||
if (plugin.controller.handleBlockRightClick(player, pos)) {
|
plugin.controller.handleBlockRightClick(player, pos);
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BukkitPlayer wrapPlayer(Player player) {
|
private BukkitPlayer wrapPlayer(Player player) {
|
||||||
|
@ -76,7 +76,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
playerListener, Priority.Normal, this);
|
playerListener, Priority.Normal, this);
|
||||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
|
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
|
||||||
blockListener, Priority.Normal, this);
|
blockListener, Priority.Normal, this);
|
||||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACED,
|
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_RIGHTCLICKED,
|
||||||
blockListener, Priority.Normal, this);
|
blockListener, Priority.Normal, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user