本文整理匯總了Java中org.bukkit.event.player.PlayerBucketFillEvent.getBlockClicked方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketFillEvent.getBlockClicked方法的具體用法?Java PlayerBucketFillEvent.getBlockClicked怎麽用?Java PlayerBucketFillEvent.getBlockClicked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerBucketFillEvent
的用法示例。
在下文中一共展示了PlayerBucketFillEvent.getBlockClicked方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketFill(final PlayerBucketFillEvent event) {
if (event.isCancelled())
return;
final Block block = event.getBlockClicked();
final Block blockUp = block.getRelative(BlockFace.UP);
// Ok so a player fills a bucket on a portal block
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final WorldCoord blockCoordUp = new WorldCoord(blockUp);
final Gate nearestGate = Gates.gateFromPortal(blockCoord);
final Gate nearestGateUp = Gates.gateFromPortal(blockCoordUp);
if (nearestGate != null || nearestGateUp != null) {
event.setCancelled(true);
}
}
示例2: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
/**
* Filters PlayerBucketFillEvent (removing a block of liquid).
*
* <p>Applies to: block and block break.<p/>
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent event) {
Match match = Cardinal.getMatch(event.getPlayer());
if (match == null || !match.hasPlayer(event.getPlayer())) {
return;
}
for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_BREAK)) {
Block evaluating = event.getBlockClicked();
if (apply(reg, evaluating.getLocation(), event.getPlayer(), event, event, evaluating, event.getPlayer())) {
break;
}
}
}
示例3: onPlayerBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
Block block = event.getBlockClicked();
Lot lot = this.module.getLotManager().getLot(block.getLocation());
Town town = this.module.getLotManager().getTown(block.getLocation());
if(((lot != null && !lot.canBuild(event.getPlayer())) || (lot == null && town != null)) && !event.getPlayer().hasPermission(LotPermissions.BUILD_ANYWHERE)) {
sendMessage(event.getPlayer(), "lots.cannot-do");
event.setCancelled(true);
}
}
示例4: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent event) {
Block b = event.getBlockClicked();
Location location = BukkitUtil.getLocation(b.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Player player = event.getPlayer();
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
Plot plot = area.getPlot(location);
if (plot == null) {
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
event.setCancelled(true);
} else if (!plot.hasOwner()) {
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) {
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
Block block = event.getBlockClicked();
if (use.isPresent() && use.get().contains(PlotBlock.get(block.getTypeId(), block.getData()))) {
return;
}
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
return;
}
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
}
}
示例5: onFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onFill(PlayerBucketFillEvent event)
{
BytecraftPlayer player = plugin.getPlayer(event.getPlayer());
Block block = event.getBlockClicked();
boolean bool = player.hasBlockPermission(block.getLocation(), true);
if(!bool){
player.setFireTicks(20 * 2);
event.setCancelled(true);
}
}
示例6: onPlayerBucketFillEvent
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
/**
* Checks the player is allowed to fill the bucket.
*
* @param event event being handled
*/
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerBucketFillEvent(PlayerBucketFillEvent event) {
final Player player = event.getPlayer();
final Block block = event.getBlockClicked();
if (!canBuild(player, block)) {
final Town town = plugin.getTown(block.getChunk());
if (town == null) {
player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_CANNOT_BUILD_HERE));
} else {
player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_ONLY_TOWN_MEMBERS_CAN_BREAK_BLOCKS, town.getName()));
}
event.setCancelled(true);
}
}
示例7: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent e) {
final Block b = e.getBlockClicked();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.isPlotWorld(loc.getWorld())) {
final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p);
Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
if (MainUtil.isPlotAreaAbs(loc)) {
if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
return;
}
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
e.setCancelled(true);
return;
}
} else {
if (!plot.hasOwner()) {
if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
return;
}
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
e.setCancelled(true);
return;
} else if (!plot.isAdded(pp.getUUID())) {
final Flag use = FlagManager.getPlotFlag(plot, "use");
final Block block = e.getBlockClicked();
if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
return;
}
if (Permissions.hasPermission(pp, "plots.admin.build.other")) {
return;
}
if (MainUtil.isPlotArea(loc)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
e.setCancelled(true);
return;
}
}
}
}
}