本文整理匯總了Java中org.bukkit.event.player.PlayerBucketEmptyEvent.isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketEmptyEvent.isCancelled方法的具體用法?Java PlayerBucketEmptyEvent.isCancelled怎麽用?Java PlayerBucketEmptyEvent.isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerBucketEmptyEvent
的用法示例。
在下文中一共展示了PlayerBucketEmptyEvent.isCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBucketUse
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketUse(PlayerBucketEmptyEvent e){
if (e.isCancelled()) {
return;
}
Location l = e.getBlockClicked().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null){
return;
}
if (!RPUtil.canBuildNear(e.getPlayer(), l)){
e.setCancelled(true);
return;
}
if (!bypassBuild(e.getPlayer(), null, 0)) {
e.setCancelled(true);
}
}
示例2: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
if (event.isCancelled())
return;
final Block block = event.getBlockClicked();
final Block blockUp = block.getRelative(BlockFace.UP);
// Ok so a player empties a bucket near on portal/frame block
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final WorldCoord blockCoordUp = new WorldCoord(blockUp);
final Gate nearestGate = Gates.gateFromAll(blockCoord);
final Gate nearestGateUp = Gates.gateFromAll(blockCoordUp);
if (nearestGate != null || nearestGateUp != null) {
event.setCancelled(true);
}
}
示例3: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
*
* @param pbee
*/
@EventHandler
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent pbee) {
ScoreBoardSystem.updatePlayer(pbee.getPlayer());
if (!pbee.isCancelled() && DataHandler.isPlayerActive(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName())) {
if (ConfigHandler.getDefaultBukkitConfig().getBoolean("limits.blacklist")) {
if (ConfigHandler.getBlockBlacklistConfig().getIntegerList("List Items").contains(pbee.getBucket().getId())) {
pbee.setCancelled(true);
return;
}
} else {
if (ConfigHandler.getBlockBlacklistConfig().getIntegerList("List Items").contains(pbee.getBucket().getId())) {
pbee.setCancelled(true);
return;
}
}
final BlockData block = new BlockData(pbee.getBlockClicked().getRelative(pbee.getBlockFace()));
if (DataHandler.isBlueprintBlockAtLocation(pbee.getBlockClicked().getRelative(pbee.getBlockFace()).getLocation())) {
DataHandler.updatePlayerBlock(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName(), block);
} else {
DataHandler.addPlayerBlock(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName(), new ItemStack(pbee.getBucket()), block);
}
}
}
示例4: onEmptyBucket
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
if (toFill.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), ChatConstant.ERROR_BUILD_HEIGHT, ChatUtil.HIGHLIGHT.toString() + height + ChatColor.GRAY.toString());
}
}
示例5: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Prevent bucket usage
*/
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
CuboidRegion region = regionHandler.getApplicableRegion(event.getBlockClicked().getLocation());
if (!event.isCancelled() && region != null && !region.allows("build")) {
event.setCancelled(true);
warnPlayer(event.getPlayer());
}
}
示例6: onEmptyBucket
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
if (toFill.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例7: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), message);
}
}
示例8: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)
&& region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), message);
}
}
示例9: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))
&& filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), message);
}
}
示例10: onBucketUse
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketUse(PlayerBucketEmptyEvent e){
if (e.isCancelled()) {
return;
}
Player p = e.getPlayer();
Location l = e.getBlockClicked().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null && !r.canBuild(p) && (p.getItemInHand().getType().name().contains("BUCKET"))) {
e.setCancelled(true);
}
}
示例11: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler (priority=EventPriority.HIGHEST)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent e) {
if (e.isCancelled()) {
Location loc = e.getBlockClicked().getLocation();
if (loc.getWorld().getName().equals("Build")) {
// String id = PlotManager.getPlotId(loc);
// if (getPlot(id) != null)
// return;
String x1 = PlotManager.getPlotId(loc.clone().add(5, 0, 0));
String x2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 0));
String y1 = PlotManager.getPlotId(loc.clone().add(0, 0, 5));
String y2 = PlotManager.getPlotId(loc.clone().add(0, 0, -5));
boolean allowed = false;
if (getPlot(x1) != null && getPlot(x2) != null)
allowed = getPlot(x1).getOwner().equals(getPlot(x2).getOwner()) && getPlot(x1).isAllowed(e.getPlayer().getName());
if (!allowed && getPlot(y1) != null && getPlot(y2) != null)
allowed = getPlot(y1).getOwner().equals(getPlot(y2).getOwner()) && getPlot(y1).isAllowed(e.getPlayer().getName());
if (allowed) {
e.setCancelled(false);
return;
}
String cor1 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
String cor2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 5));
String cor3 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
String cor4 = PlotManager.getPlotId(loc.clone().add(-5, 0, -5));
if (getPlot(cor1) != null && getPlot(cor2) != null && getPlot(cor3) != null && getPlot(cor4) != null)
if (getPlot(cor1).getOwner().equals(getPlot(cor2).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor3).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor4).getOwner())) {
e.setCancelled(false);
}
}
}
}
示例12: onEmptyBucket
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
if (toFill.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height (" + ChatColor.AQUA + height + ChatColor.RED + " blocks)");
}
}
示例13: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), material, event).equals(FilterState.DENY)) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), message);
}
}
示例14: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && filter.evaluate(event.getPlayer(), material, event).equals(FilterState.DENY)
&& region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), message);
}
}
示例15: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))
&& filter.evaluate(event.getPlayer(), material, event).equals(FilterState.DENY)) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), message);
}
}