本文整理匯總了Java中org.bukkit.event.player.PlayerBucketFillEvent類的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketFillEvent類的具體用法?Java PlayerBucketFillEvent怎麽用?Java PlayerBucketFillEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PlayerBucketFillEvent類屬於org.bukkit.event.player包,在下文中一共展示了PlayerBucketFillEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent event) {
final PlayerStat stat = PlayerStat.BUCKETS_FILLED;
// 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()));
}
示例2: onPlayerBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
Player player = event.getPlayer();
Material resultBucket = event.getItemStack().getType();
NormalAchievements category = getCategory(resultBucket);
if (plugin.getDisabledCategorySet().contains(category.toString())) {
return;
}
if (!shouldIncreaseBeTakenIntoAccount(player, category)
|| isInCooldownPeriod(player, category.toString(), false, category)) {
return;
}
updateStatisticAndAwardAchievementsIfAvailable(player, category, 1);
}
示例3: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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);
}
}
示例4: 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);
}
}
示例5: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
/**
* If the player filled up the bucket themselves
*
* @param e
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent e) {
if (DEBUG)
plugin.getLogger().info("Player filled the bucket");
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
if (DEBUG)
plugin.getLogger().info("Correct world");
if (Settings.acidDamage > 0D && Settings.acidBottle) {
ItemStack item = e.getItemStack();
if (item.getType().equals(Material.WATER_BUCKET) || item.getType().equals(Material.POTION)) {
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(plugin.myLocale(e.getPlayer().getUniqueId()).acidBucket);
lore = Arrays.asList(plugin.myLocale(e.getPlayer().getUniqueId()).acidLore.split("\n"));
meta.setLore(lore);
item.setItemMeta(meta);
}
}
}
}
示例6: onPlayerBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
/**
* On player bucket fill.
*
* @param event
* the event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
if (!playerConf.get(event.getPlayer()).isAdminMod()) {
IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
event.getBlockClicked().getLocation());
Material mt = event.getBlockClicked().getType();
if ((land instanceof ILand && ((ILand) land).isBanned(event
.getPlayer()))
|| (mt == Material.LAVA_BUCKET && !checkPermission(land,
event.getPlayer(),
PermissionList.BUCKET_LAVA.getPermissionType()))
|| (mt == Material.WATER_BUCKET && !checkPermission(land,
event.getPlayer(),
PermissionList.BUCKET_WATER.getPermissionType()))) {
messagePermission(event.getPlayer());
event.setCancelled(true);
}
}
}
示例7: onPlayerBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBucketFill(final PlayerBucketFillEvent event)
{
BlockState oldState = event.getBlockClicked().getRelative(event.getBlockFace()).getState();
if (oldState.getType() == WATER || oldState.getType() == STATIONARY_WATER || oldState.getType() == LAVA
|| oldState.getType() == STATIONARY_LAVA)
{
this.setAndLog(BucketFill.class, event.getPlayer(), oldState, AIR);
}
else // TODO better check
{
// milk
BucketMilk action = this.newAction(BucketMilk.class, event.getPlayer().getWorld());
if (action != null)
{
action.setPlayer(event.getPlayer());
action.setLocation(oldState.getLocation());
this.logAction(action);
}
}
}
示例8: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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;
}
}
}
示例9: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (Util.inWorld(e.getPlayer())) {
// This permission bypasses protection
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
Island island = plugin.getIslands().getProtectedIslandAt(e.getBlockClicked().getLocation());
if (island != null) {
if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
return;
}
if (island.getFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
return;
}
if (island.getFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
return;
}
if (island.getFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
return;
}
if (island.getFlag(SettingsFlag.BUCKET)) {
return;
}
} else {
// Null
if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
return;
}
}
// Not allowed
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
示例11: isManual
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的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;
}
示例12: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
/**
* Prevents lobby players from interacting in the world.
*
* @param event The event
*/
@EventHandler
public void onBucketFill(final PlayerBucketFillEvent event) {
if (event.getBlockClicked().getWorld().equals(world)) {
event.setCancelled(true);
}
}
示例13: onBucketEmpty
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketFillEvent event) {
if (!isWithinBorder(event.getBlockClicked().getLocation())) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + "You cannot fill buckets past the border.");
}
}
示例14: onFillBucket
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
if (toEmpty.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtil.sendWarningMessage(event.getPlayer(), ChatConstant.ERROR_BUILD_HEIGHT, ChatUtil.HIGHLIGHT.toString() + height + ChatColor.GRAY.toString());
}
}
示例15: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
/**
* Prevents buckets from being filled
*/
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
CuboidRegion region = regionHandler.getApplicableRegion(event.getBlockClicked().getLocation());
if (!event.isCancelled() && region != null && !region.allows("destroy")) {
event.setCancelled(true);
warnPlayer(event.getPlayer());
}
}