本文整理匯總了Java中org.bukkit.event.player.PlayerBucketEmptyEvent.getPlayer方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketEmptyEvent.getPlayer方法的具體用法?Java PlayerBucketEmptyEvent.getPlayer怎麽用?Java PlayerBucketEmptyEvent.getPlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerBucketEmptyEvent
的用法示例。
在下文中一共展示了PlayerBucketEmptyEvent.getPlayer方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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()));
}
示例2: 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");
}
}
示例3: 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);
}
示例4: onEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
public void onEmpty(PlayerBucketEmptyEvent 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!"));
}
}
示例5: onBucketFlow
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketFlow(PlayerBucketEmptyEvent e) {
if(e.getPlayer().hasPermission("openguild.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"));
}
}
}
示例6: 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);
}
}
示例7: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
Player player = event.getPlayer();
NovaPlayer nPlayer = PlayerManager.getPlayer(player);
if(nPlayer.getPreferences().getBypass()) {
return;
}
//Fluid protection
NovaRegion fluidProtectRegion = null;
for(NovaRegion region : plugin.getRegionManager().getRegions()) {
if(!region.getWorld().equals(block.getWorld())) {
continue;
}
Location centerLocation = region.getCenter().clone();
Location blockLocation = block.getLocation().clone();
centerLocation.setY(0);
blockLocation.setY(0);
if(blockLocation.distance(centerLocation) <= region.getDiagonal() / 2 + Config.REGION_FLUIDPROTECT.getInt()) {
fluidProtectRegion = region;
break;
}
}
if((fluidProtectRegion != null
&& (!nPlayer.hasGuild()
|| (!fluidProtectRegion.getGuild().isMember(nPlayer)
&& !fluidProtectRegion.getGuild().isAlly(nPlayer.getGuild()))))
|| (RegionManager.get(block) != null
&& (!plugin.getRegionManager().canInteract(player, block)
|| !nPlayer.hasPermission(GuildPermission.BLOCK_PLACE)))) {
event.setCancelled(true);
Message.CHAT_REGION_DENY_INTERACT.send(player);
}
}
示例8: NoBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Checks if a player has permission to empty the contents of a bucket.
*
* @param event that triggered listener.
*/
@EventHandler(priority = EventPriority.LOW)
public void NoBucketEmpty(PlayerBucketEmptyEvent event) {
Player player = event.getPlayer();
// Bucket check
if (!player.hasPermission("antibuild.bypass")) {
if (!player.hasPermission("antibuild.bucket")) {
int bucketType = player.getItemInHand().getTypeId();
if (bucketType == 326
&& !player.hasPermission("antibuild.bucket.water")) {
event.setCancelled(true);
PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
} else if (bucketType == 327
&& !player.hasPermission("antibuild.bucket.lava")) {
event.setCancelled(true);
PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
}
}
}
// // World lock check
// if (!event.isCancelled() && plugin.isUsingLock()) {
// if (plugin.isLockedWorld(player.getWorld().getName())
// && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
// "." + player.getWorld().getName())) {
// event.setCancelled(true);
// messageHandler(plugin.getLockedWorldMessage(), player);
// }
// }
}
示例9: onPlayerBucket
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true)
public void onPlayerBucket(PlayerBucketEmptyEvent event)
{
Player player = event.getPlayer();
if (player.getItemInHand().getTypeId() == Material.LAVA_BUCKET.getId()) {
if (!(player.hasPermission("suppression.use"))) {
Main.getPlugin().getLogger().info("[Suppression INFO]: " + player.getDisplayName() + " lava bucket place cancelled.");
player.sendMessage("You don't have permission to use a lava bucket.");
alertOperators(player, "lava bucket");
event.setCancelled(true);
}
}
}
示例10: onPlayerBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
private void onPlayerBucketEmpty(PlayerBucketEmptyEvent evt){
Player player = evt.getPlayer();
MCWarClanPlayer mcPlayer = _tc.getPlayer(player.getName());
if(mcPlayer != null){
Base currentBaseLocation = _tc.getBase(evt.getBlockClicked().getLocation());
if(currentBaseLocation != null && currentBaseLocation.get_team().isEnemyToTeam(mcPlayer.get_team())){
evt.setCancelled(true);
player.updateInventory();
Messages.sendMessage("You cannot place block (except TNT, Ladders, and Levers...) in an enemy base !", Messages.messageType.INGAME, player);
}
}
else
Messages.sendMessage("Error, please ask an admin to be add to a team !", Messages.messageType.INGAME, player);
}
示例11: onPlayerBucketEmptyEvent
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) {
Player p = event.getPlayer();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
// TODO: Is the player allowed to place down water
// Is the current player playing
if(am.isInArena(p)) {
ArenaPlayer ap = am.getPlayer(p);
// Is the player in the lobby of the arena
if(ap.isInLobby()) {
// Has the player a arena spawn assigned
if(ap.hasAssignedAreanSpawn()) {
// Cancel the event and send a status message
event.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You may not flood the lobby in the lobby of an arena!");
}
}
// Is the player an spectators
if(ap.isSpectator()) {
event.setCancelled(true);
ap.sendMessage(ChatColor.DARK_RED + "You can't use buckets while spectating!");
}
}
}
示例12: onPlayerBucketEmptyEvent
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Checks the player is allowed to empty the bucket.
*
* @param event event being handled
*/
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) {
final Player player = event.getPlayer();
final Block block = event.getBlockClicked();
if (!canBuild(player, block)) {
final Town town = plugin.getTown(block.getChunk());
if (town == null) {
player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_CANNOT_BUILD_HERE));
} else {
player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_ONLY_TOWN_MEMBERS_CAN_PLACE_BLOCKS, town.getName()));
}
event.setCancelled(true);
}
}
示例13: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Prevents emptying of buckets outside of island space
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (Util.inWorld(e.getPlayer())) {
Player p = e.getPlayer();
if (e.getBlockClicked() != null) {
// This is where the water or lava actually will be dumped
Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace());
if (actionAllowed(p, dumpBlock.getLocation(), SettingsFlag.BUCKET)) {
// Check if biome is Nether and then allow water placement but fizz the water
if (e.getBlockClicked().getBiome().equals(Biome.HELL)) {
if (plugin.getServer().getVersion().contains("(MC: 1.8") || plugin.getServer().getVersion().contains("(MC: 1.7")) {
if (e.getPlayer().getItemInHand().getType().equals(Material.WATER_BUCKET)) {
e.setCancelled(true);
e.getPlayer().getItemInHand().setType(Material.BUCKET);
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.valueOf("FIZZ"), 1F, 2F);
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
}
} else {
if (Util.playerIsHolding(e.getPlayer(), Material.WATER_BUCKET)) {
e.setCancelled(true);
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
e.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.BUCKET));
} else if (e.getPlayer().getInventory().getItemInOffHand().getType() == Material.WATER_BUCKET) {
e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.BUCKET));
}
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F);
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
}
}
}
return;
}
// Not allowed
Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
e.setCancelled(true);
}
}
}
示例14: onBucketEmpty
import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
* Prevents emptying of buckets outside of island space
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (inWorld(e.getPlayer())) {
Player p = e.getPlayer();
if (e.getBlockClicked() != null) {
// This is where the water or lava actually will be dumped
Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace());
if (actionAllowed(p, dumpBlock.getLocation(), SettingsFlag.BUCKET)) {
// Check if biome is Nether and then allow water placement but fizz the water
if (e.getBlockClicked().getBiome().equals(Biome.HELL)) {
if (plugin.getServer().getVersion().contains("(MC: 1.8") || plugin.getServer().getVersion().contains("(MC: 1.7")) {
if (e.getPlayer().getItemInHand().getType().equals(Material.WATER_BUCKET)) {
e.setCancelled(true);
e.getPlayer().getItemInHand().setType(Material.BUCKET);
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.valueOf("FIZZ"), 1F, 2F);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).biomeSet.replace("[biome]", "Nether"));
}
} else {
if (Util.playerIsHolding(e.getPlayer(), Material.WATER_BUCKET)) {
e.setCancelled(true);
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
e.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.BUCKET));
} else if (e.getPlayer().getInventory().getItemInOffHand().getType() == Material.WATER_BUCKET) {
e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.BUCKET));
}
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).biomeSet.replace("[biome]", "Nether"));
}
}
}
return;
}
// Not allowed
Util.sendMessage(p, ChatColor.RED + plugin.myLocale(p.getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
}