本文整理匯總了Java中org.bukkit.event.player.PlayerBucketEmptyEvent類的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketEmptyEvent類的具體用法?Java PlayerBucketEmptyEvent怎麽用?Java PlayerBucketEmptyEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PlayerBucketEmptyEvent類屬於org.bukkit.event.player包,在下文中一共展示了PlayerBucketEmptyEvent類的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: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
/**
* Filters PlayerBucketEmptyEvent (placing down a block of liquid).
*
* <p>Applies to: block, block place and block place against.<p/>
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Match match = Cardinal.getMatch(event.getPlayer());
if (match == null || !match.hasPlayer(event.getPlayer())) {
return;
}
for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_PLACE, ApplyType.BLOCK_PLACE_AGAINST)) {
Block evaluating = reg.isType(ApplyType.BLOCK_PLACE_AGAINST)
? event.getBlockClicked() : event.getBlockClicked().getRelative(event.getBlockFace());
if (apply(reg, evaluating.getLocation(), event.getPlayer(), event,
event, getBucketResult(event.getBucket()), event.getPlayer())) {
break;
}
}
}
示例3: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
final PlayerStat stat = PlayerStat.BUCKETS_EMPTIED;
// Get player
final Player player = event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
player.getUniqueId().toString(), "value", 1, "world", player.getWorld().getName()));
}
示例4: 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()));
}
示例5: 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");
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: 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);
}
}
}
}
示例10: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event){
if(Minigame.getCurrentMinigame()!=null){
switch(Minigame.getCurrentMinigame().getMap().getType()){
case CIRCLE_OF_BOOM:
event.setCancelled(true);
break;
case KEY_QUEST:
break;
case WATER_THE_MONUMENT:
break;
default:
break;
}
}
}
示例11: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
Player player = event.getPlayer();
Client client = Client.getClient(player);
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
Map map = Rixor.getRotation().getSlot().getMap();
BlockState newState = block.getState();
Material update = Material.LAVA;
if(event.getBucket() == Material.WATER_BUCKET) update = Material.WATER;
newState.setData(new MaterialData(update, (byte) 0));
BlockState oldState = block.getState();
BlockChangeEvent change = new BlockChangeEvent(event, map, client, oldState, newState);
Rixor.callEvent(change);
}
示例12: 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);
}
}
}
示例13: 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();
}
示例14: isManual
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
/**
* Return true if the block transformation was performed "by hand".
*
* Handled:
* - place
* - mine
* - bucket fill/empty
* - flint & steel fire/tnt
*
* Not handled:
* - bonemeal
* - probably lots of other things
*/
public boolean isManual() {
final Event event = getCause();
if(Types.instanceOfAny(
event,
BlockPlaceEvent.class,
BlockBreakEvent.class,
PlayerBucketEmptyEvent.class,
PlayerBucketFillEvent.class
)) return true;
if(event instanceof BlockIgniteEvent) {
BlockIgniteEvent igniteEvent = (BlockIgniteEvent) event;
if(igniteEvent.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && igniteEvent.getIgnitingEntity() != null) {
return true;
}
}
if(event instanceof ExplosionPrimeByEntityEvent && ((ExplosionPrimeByEntityEvent) event).getPrimer() instanceof Player) {
return true;
}
return false;
}
示例15: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@EventWrapper
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
Material contents = Materials.materialInBucket(event.getBucket());
if(contents == null) {
return;
}
BlockState newBlock = BlockStateUtils.cloneWithMaterial(block, contents);
this.callEvent(event, block.getState(), newBlock, event.getPlayer());
}