本文整理匯總了Java中org.bukkit.event.player.PlayerBucketFillEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketFillEvent.setCancelled方法的具體用法?Java PlayerBucketFillEvent.setCancelled怎麽用?Java PlayerBucketFillEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerBucketFillEvent
的用法示例。
在下文中一共展示了PlayerBucketFillEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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);
}
}
}
示例4: 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;
}
}
}
示例5: 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();
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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.");
}
}
示例9: 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());
}
}
示例10: 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());
}
}
示例11: onFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
public void onFill(PlayerBucketFillEvent e) {
Player p = e.getPlayer();
int prot = plugin.getSettings().getProtectedSpawnRadius();
if (p.getWorld().getSpawnLocation().distance(p.getLocation()) < prot) {
e.setCancelled(true);
p.sendMessage(ColoringUtil.colorText("&cNie mozesz ingerowac w bloki na spawnie!"));
}
}
示例12: onFillBucket
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
return;
Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
if (toEmpty.getY() >= height && !event.isCancelled()) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
}
}
示例13: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), message);
}
}
示例14: onBucketFill
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
public void onBucketFill(PlayerBucketFillEvent event) {
if (!event.isCancelled() && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)
&& region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
event.setCancelled(true);
ChatUtils.sendWarningMessage(event.getPlayer(), message);
}
}
示例15: onBucketTake
import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketTake(PlayerBucketFillEvent e) {
if(e.getPlayer().hasPermission("scg.cuboid.bypassplace")) {
return;
}
Player p = e.getPlayer();
User user = plugin.getManager().getUserManager().getUsers().get(p.getName());
Guild guild = user.getGuild();
Cuboid cuboid = user.getCurrentCuboid();
if (cuboid != null) {
if (guild != null) {
if (!user.getGuild().equals(cuboid.getGuild())) {
p.sendMessage(plugin.getManager().getMsgManager().getMsg("enemyguildblockplace"));
e.setCancelled(true);
}
} else {
p.sendMessage(plugin.getManager().getMsgManager().getMsg("enemyguildblockplace"));
e.setCancelled(true);
}
//Bukkit.broadcastMessage("Gracz "+p.getName()+" robi cos na cuboidzie "+cuboid.getGuild().getGuildTag());
} else {
if (p.getLocation().distance(p.getWorld().getSpawnLocation()) <= plugin.getManager().getSettingsManager().getProtectedSpawnRadius()) {
p.sendMessage(plugin.getManager().getMsgManager().getMsg("spawnplacecantbreak"));
}
}
}