本文整理匯總了Java中org.bukkit.event.player.PlayerBucketEmptyEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketEmptyEvent.setCancelled方法的具體用法?Java PlayerBucketEmptyEvent.setCancelled怎麽用?Java PlayerBucketEmptyEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerBucketEmptyEvent
的用法示例。
在下文中一共展示了PlayerBucketEmptyEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherIslands) {
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
e.setCancelled(true);
}
}
}
}
示例2: onEvent
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onEvent(PlayerBucketEmptyEvent event) {
UUID owner = this.plugin.getApi().getOwnerUUID(new BukkitBlock(event.getBlockClicked()));
UUID ourUuid = event.getPlayer().getUniqueId();
if (this.plugin.getWorldGuardIntegration().isInIgnoredRegion(new BukkitBlock(event.getBlockClicked()))) {
this.plugin.debug("Region has bypass-protection set to true");
return;
}
if (owner != null && ! owner.equals(ourUuid)) {
if (! event.getPlayer().hasPermission("archblock.bypass") && ! this.plugin.getApi().hasFriendship(owner, ourUuid)) {
event.getPlayer().sendMessage(this.plugin.getPrefixedLocalisedString(
"event_bucket_denied", this.plugin.getApi().getUsernameForUuid(owner)
));
event.setCancelled(true);
return;
}
this.plugin.debug("Owner is different but player has a bypass or is friends with the owner");
}
this.plugin.debug("Everything's okay - empty ze bucket");
this.plugin.getApi().removeOwner(new BukkitBlock(event.getBlockClicked()));
}
示例3: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Handles placement of water and lava buckets
*
* @param e an event representing a player emptying a bucket
* @see PlayerBucketEmptyEvent
* @since 2.1.0
*/
@EventHandler
public static void onBucketEmpty(PlayerBucketEmptyEvent e) {
Player player = e.getPlayer();
Arena arena = ArenaManager.getInstance().getArena(player);
if (arena == null)
return;
Plot plot = arena.getPlot(player);
if (plot.getGamePlayer(player).getGamePlayerType() == GamePlayerType.SPECTATOR) {
MessageManager.getInstance().send(player, ChatColor.RED + "Spectators can't build");
e.setCancelled(true);
return;
}
if (!plot.getBoundary().isInside(e.getBlockClicked().getRelative(e.getBlockFace()).getLocation())) {
e.setCancelled(true);
MessageManager.getInstance().send(player, ChatColor.RED + "You can't place blocks outside your plot");
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Prevents the tipping of liquids over the beacon using a bucket
* @param event
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
if (DEBUG)
getLogger().info("DEBUG: " + event.getEventName());
World world = event.getBlockClicked().getWorld();
if (!world.equals(getBeaconzWorld())) {
return;
}
Block b = event.getBlockClicked().getRelative(event.getBlockFace());
BeaconObj beacon = getRegister().getBeaconAt(b.getX(),b.getZ());
if (beacon != null && beacon.getY() <= event.getBlockClicked().getY()) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + Lang.beaconCannotPlaceLiquids);
}
if (getRegister().isAboveBeacon(b.getLocation())) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + Lang.beaconCannotPlaceLiquids);
}
}
示例7: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.newNether) {
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
e.setCancelled(true);
}
}
}
}
示例8: 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);
}
}
}
示例9: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
PlayerDataRPG pd = plugin.getPD(event.getPlayer());
if (pd == null)
event.setCancelled(true);
if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
event.setCancelled(true);
if (!canBuild(pd))
event.setCancelled(true);
event.getPlayer().updateInventory();
}
示例10: onBreak
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBreak(PlayerBucketEmptyEvent e) {
KingdomFactionsPlayer p =PlayerModule.getInstance().getPlayer(e.getPlayer());
if(p.getSettingsProfile().hasAdminMode()) return;
if(!p.canBuild(e.getBlockClicked().getLocation())) {
e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 50));
}
}
示例11: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Prevents lobby players from interacting in the world.
*
* @param event The event
*/
@EventHandler
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
if (event.getBlockClicked().getWorld().equals(world)) {
event.setCancelled(true);
}
}
示例12: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Disable lava buckets if the PvP isn't activated
*
* @param event Event
*/
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
{
if (event.getBucket().equals(Material.LAVA_BUCKET) && !this.game.isPvPActivated())
{
event.getPlayer().sendMessage(ChatColor.RED + "Le PvP est désactivé, l'utilisation de sources de lave est interdite.");
event.getPlayer().getWorld().getBlockAt(event.getBlockClicked().getLocation().add(event.getBlockFace().getModX(), event.getBlockFace().getModY(), event.getBlockFace().getModZ())).setType(Material.AIR);
event.getPlayer().getInventory().getItemInHand().setType(Material.LAVA_BUCKET);
event.setCancelled(true);
}
}
示例13: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
if (!isWithinBorder(event.getBlockClicked().getLocation())) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + "You cannot empty buckets past the border.");
}
}
示例14: 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());
}
}
示例15: 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());
}
}