本文整理汇总了Java中org.bukkit.event.player.PlayerPickupItemEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerPickupItemEvent.setCancelled方法的具体用法?Java PlayerPickupItemEvent.setCancelled怎么用?Java PlayerPickupItemEvent.setCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerPickupItemEvent
的用法示例。
在下文中一共展示了PlayerPickupItemEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
private void onPlayerPickupItem(PlayerPickupItemEvent event)
{
if (event.getItem().getItemStack() != null && event.getItem().getItemStack().getItemMeta() != null && event.getItem().getItemStack().getItemMeta().getDisplayName() != null)
{
if (this.alive && event.getItem().getItemStack().getItemMeta().getDisplayName().equals(this.uuid.toString()))
{
event.setCancelled(true);
HandlerList.unregisterAll(this);
this.remove(true);
this.parent.onPickup(event.getPlayer());
}
}
}
示例2: onPickUp
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickUp(PlayerPickupItemEvent e) {
Player p = e.getPlayer();
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Disable")) {
if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.World.All_World")) {
if (WorldUtils.getWItemPickUp().contains(p.getWorld().getName())) {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
} else {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
}
}
示例3: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
void onPlayerPickupItem(PlayerPickupItemEvent event)
{
Player player = event.getPlayer();
if(!player.isSneaking() && PhantomAdmin.instance.isInvisible(player))
{
event.setCancelled(true);
PlayerData data = PlayerData.FromPlayer(player);
if(!data.gotItemPickupInfo)
{
PhantomAdmin.sendMessage(player, TextMode.Warn, Messages.NoItemPickupWhileInvisible);
data.gotItemPickupInfo = true;
}
return;
}
}
示例4: onItemPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
if (e.isCancelled()) {
return;
}
ItemStack item = e.getItem().getItemStack();
if (item.getType().equals(Material.WRITTEN_BOOK)) {
BookMeta meta = (BookMeta) item.getItemMeta();
if (meta.getTitle().equals("Quest Log")) {
e.getItem().remove();
e.setCancelled(true);
QuestManagerPlugin.questManagerPlugin.getPlayerManager().getPlayer(
e.getPlayer().getUniqueId()).addQuestBook();
}
}
}
示例5: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent ppie) {
Player player = ppie.getPlayer();
Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);
if (game == null) {
game = BedwarsRel.getInstance().getGameManager().getGameByLocation(player.getLocation());
if (game == null) {
return;
}
}
if (game.getState() != GameState.WAITING && game.isInGame(player)) {
return;
}
ppie.setCancelled(true);
}
示例6: PickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
/**
* Checks if player has proper permission to pickup items.
*
* @param event that triggers listener.
*/
@EventHandler(priority = EventPriority.LOW)
private void PickupItem(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
// Pickup item check.
if (player != null && !player.hasPermission("antibuild.bypass")) {
if (!player.hasPermission("antibuild.pickupitems")) {
event.setCancelled(true);
// We can't message the player here or it spams.
}
}
// // World 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);
// // We can't message the player here or it spams.
// }
// }
}
示例7: onVisitorPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVisitorPickup(final PlayerPickupItemEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (!IslandGuard.inWorld(e.getPlayer())) {
return;
}
Island island = plugin.getGrid().getIslandAt(e.getItem().getLocation());
if ((island != null && island.getIgsFlag(SettingsFlag.VISITOR_ITEM_PICKUP))
|| e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|| plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) {
return;
}
e.setCancelled(true);
}
示例8: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
final Player user = event.getPlayer();
final ItemStack item = event.getItem().getItemStack();
if (antib.getSettings().getData().isDisableUse() && !Permissions.BUILD.isAuthorized(user))
{
if (!Permissions.PICKUP.isAuthorized(user, item.getType(), item.getData()))
{
event.setCancelled(true);
event.getItem().setPickupDelay(50);
}
}
}
示例9: onPlayerPickupItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerPickupItem(final PlayerPickupItemEvent event) {
this.plugin.entering(this.getClass(), "onPlayerPickupItem");
final Item i = event.getItem();
if (this.itemMap.containsKey(i)) {
this.plugin.debug("Item is handled by an Altar");
final String playerName = event.getPlayer().getName();
final String awaitedPlayerName = this.itemMap.get(i);
if (!playerName.equals(awaitedPlayerName)) {
if (this.plugin.isDebugEnabled()) {
this.plugin.debug("Not the right player (" + playerName + "), cancel pickup. Awaited '" + awaitedPlayerName + '\'');
}
event.setCancelled(true);
} else {
this.plugin.debug("Right player, allow pickup");
this.itemMap.remove(i);
final Altar altar = this.plugin.getAltars().get(new ChunkCoord(i.getLocation().getChunk()));
if (altar != null) {
this.plugin.getItemProvidedToLockedTransition().doTransition(altar);
}
}
}
this.plugin.exiting(this.getClass(), "onPlayerPickupItem");
}
示例10: onItemPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
Game bw = io.github.bedwarsrel.BedwarsRel.Main.getInstance()
.getGameManager().getGameOfPlayer(e.getPlayer());
if (bw == null) {
return;
}
if (!Config.isGameEnabledXP(bw.getName())) {
return;
}
Player p = e.getPlayer();
Item entity = e.getItem();
ItemStack stack = entity.getItemStack();
int count = Res.convertResToXP(stack);
if (count == 0) {
return;
}
e.setCancelled(true);
XPManager.addXP(bw.getName(), p, count);
p.playSound(p.getLocation(),
SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
10.0F, 1.0F);
if (!Config.Message.equals("")) {
ActionBarUtils.sendActionBar(p,
Config.Message.replaceAll("%xp%", Integer.toString(count)));
/*
* if (!ActionBarUtils.works) {
* p.sendMessage(Config.Message.replaceAll("%xp%",
* Integer.toString(count))); }
*/
}
entity.remove();
}
示例11: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent e)
{
Player staff = e.getPlayer();
if (modMode.contains(staff.getName())) {
e.setCancelled(true);
}
}
示例12: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent event) {
Profile profile = Chambers.getInstance().getProfileManager().getProfileByUuid(event.getPlayer().getUniqueId());
if (profile.getProfileStatus() != ProfileStatus.PLAYING) {
event.setCancelled(true);
}
}
示例13: onPlayerPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerPickup(PlayerPickupItemEvent event){
Material type = event.getItem().getItemStack().getType();
if(type == Material.STONE || type == Material.COBBLESTONE){
if(disabled.contains(event.getPlayer())){
event.setCancelled(true);
}
}
}
示例14: onPlayerDropItem
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerPickupItemEvent event) {
Gamer g = Gamer.get(event.getPlayer());
event.setCancelled(true);
if (g.getVariable("edit") != null) {
if ((boolean) g.getVariable("edit"))
event.setCancelled(false);
}
}
示例15: onPickup
import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent e) {
if (e.getItem().hasMetadata("no_pickup")) e.setCancelled(true);
else if (!e.getItem().hasMetadata("no_pickup") && e.getItem().getItemStack().hasItemMeta() && e.getItem().getItemStack().getItemMeta().hasDisplayName() && e.getItem().getItemStack().getItemMeta().getDisplayName().startsWith("&5&dALTAR &3Probe - &e")) {
e.setCancelled(true);
e.getItem().remove();
}
}