本文整理汇总了Java中org.bukkit.event.player.PlayerDropItemEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerDropItemEvent.setCancelled方法的具体用法?Java PlayerDropItemEvent.setCancelled怎么用?Java PlayerDropItemEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerDropItemEvent
的用法示例。
在下文中一共展示了PlayerDropItemEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: on
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void on(PlayerDropItemEvent event) {
ItemStack item = event.getItemDrop().getItemStack();
if (item == null) {
return;
}
if (!item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) {
return;
}
String name = item.getItemMeta().getDisplayName();
if (name.equals("§4§lBlocked Slot")) {
event.setCancelled(true);
}
}
示例2: onDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent e) {
Player p = e.getPlayer();
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Disable")) {
if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.World.All_World")) {
if (WorldUtils.getWItemDrop().contains(p.getWorld().getName())) {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
} else {
if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) {
if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) {
e.setCancelled(true);
}
} else {
e.setCancelled(true);
}
}
}
}
示例3: onPlayerDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
void onPlayerDropItem(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
if(!player.isSneaking() && PhantomAdmin.instance.isInvisible(player))
{
event.setCancelled(true);
PlayerData data = PlayerData.FromPlayer(player);
if(!data.gotItemDropInfo)
{
PhantomAdmin.sendMessage(player, TextMode.Warn, Messages.NoItemDropWhileInvisible);
data.gotItemDropInfo = true;
}
return;
}
}
示例4: onItemDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onItemDrop(PlayerDropItemEvent event) {
if (!cratesPlus.getConfigHandler().isDisableKeySwapping())
return;
String title;
ItemStack item = event.getItemDrop().getItemStack();
for (Map.Entry<String, Crate> crate : cratesPlus.getConfigHandler().getCrates().entrySet()) {
if (!(crate.getValue() instanceof KeyCrate)) {
continue;
}
KeyCrate keyCrate = (KeyCrate) crate.getValue();
Key key = keyCrate.getKey();
if (key == null)
continue;
title = key.getName();
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains(title)) {
event.getPlayer().sendMessage(cratesPlus.getPluginPrefix() + cratesPlus.getMessageHandler().getMessage("Cant Drop", event.getPlayer(), crate.getValue(), null));
event.setCancelled(true);
return;
}
}
}
示例5: onPlayerDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent e) {
Player p = e.getPlayer();
if (e.getItemDrop().getItemStack().getItemMeta().hasLore()) {
if (e.getItemDrop().getItemStack().getItemMeta().getLore().get(0)
.equals("Fury")
|| e.getItemDrop().getItemStack().getItemMeta().getLore()
.get(0).equals("Sheild")
|| e.getItemDrop().getItemStack().getItemMeta().getLore()
.get(0).equals("Sprint")
|| e.getItemDrop().getItemStack().getItemMeta().getLore()
.get(0).equals("Regen")) {
e.setCancelled(true);
p.sendMessage(ChatColor.DARK_RED + "You can't drop this item!");
}
}
}
示例6: onDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDropItem(PlayerDropItemEvent e) {
if (Main.WaitingPlayers.contains(e.getPlayer()) || Main.PlayingPlayers.contains(e.getPlayer())) {
if (!(e.getPlayer().hasPermission("cod.dropitem"))) {
e.setCancelled(true);
}
}
if (CreateArenaCommand.creatingArena.get(e.getPlayer()) == true) {
e.setCancelled(true);
}
if (CreateGunCommand.gunBuilder.get(e.getPlayer()) == true) {
if (CreateGunCommand.gunBuilderStep.get(e.getPlayer()) >= 7) {
e.setCancelled(true);
return;
}
}
}
示例7: onItemDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemDrop(PlayerDropItemEvent event)
{
RacerHandler racerHandler = plugin.getRacerHandler();
Racer racer = racerHandler.getRacer(event.getPlayer());
for (Powerup powerup : plugin.getPowerupsRegistry().getPowerups())
{
if (powerup.getItem().getType() == event.getItemDrop().getItemStack().getType() && powerup.getItem().getDurability() == event.getItemDrop().getItemStack().getDurability() && !racer.inventoryIsSpinning())
{
powerup.doOnDrop(racerHandler.getRacer(event.getPlayer()), event.getItemDrop());
if (powerup.cancelledEvents().contains(Powerup.ActionType.DROP) || powerup.cancelledEvents().contains(Powerup.ActionType.ALL))
{
event.setCancelled(true);
}
else
{
event.getItemDrop().setMetadata("whoDropped", new FixedMetadataValue(plugin, event.getPlayer().getUniqueId().toString()));
}
return;
}
else if (racer.inventoryIsSpinning())
{
event.setCancelled(true);
}
}
}
示例8: onDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent event)
{
BytecraftPlayer player = plugin.getPlayer(event.getPlayer());
Location loc = player.getLocation();
ZoneWorld world = plugin.getWorld(loc.getWorld());
Zone zone = world.findZone(loc);
if(zone == null)return;
if(zone.hasFlag(Flag.CREATIVE)){
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You can't drop items in a creative zone.");
}
}
示例9: onVisitorDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVisitorDrop(final PlayerDropItemEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (!IslandGuard.inWorld(e.getPlayer())) {
return;
}
Island island = plugin.getGrid().getIslandAt(e.getItemDrop().getLocation());
if ((island != null && island.getIgsFlag(SettingsFlag.VISITOR_ITEM_DROP))
|| e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|| plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) {
return;
}
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
示例10: DropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
/**
* Checks if player has proper permission to drop items.
*
* @param event that triggers listener.
*/
@EventHandler(priority = EventPriority.LOW)
private void DropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
// Drop item check.
if (player != null && !player.hasPermission("antibuild.bypass")) {
if (!player.hasPermission("antibuild.dropitems")) {
event.setCancelled(true);
PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoDropItemsMessage(), player);
}
}
// // 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);
// messageHandler(plugin.getLockedWorldMessage(), player);
// }
// }
}
示例11: onPlayerDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(final PlayerDropItemEvent ev) {
if (ev.getPlayer().hasMetadata("itemtrader-exit-timestamp")) {
List<MetadataValue> timestamps = ev.getPlayer().getMetadata("itemtrader-exit-timestamp");
long timestamp = Long.MIN_VALUE;
for (MetadataValue value : timestamps) {
if (value.getOwningPlugin().equals(plugin))
timestamp = value.asLong();
}
ev.getPlayer().removeMetadata("itemtrader-exit-timestamp", plugin);
if (System.currentTimeMillis() <= timestamp + 1000L) {
ev.setCancelled(true);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
ev.getPlayer().updateInventory();
}
}, 1);
}
}
}
示例12: onPlayerDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDropItem(PlayerDropItemEvent event)
{
Item dropped = event.getItemDrop();
GunPlayer gp = plugin.getGunPlayer(event.getPlayer());
ItemStack lastHold = gp.getLastHeldItem();
if (lastHold != null)
{
Gun gun = gp.getGun(dropped.getItemStack());
if (gun != null)
{
if (lastHold.getType() == dropped.getItemStack().getType())
{
if (gun.isHasClip() && gun.isChanged() && gun.isReloadGunOnDrop())
{
gun.reloadGun();
event.setCancelled(true);
}
}
}
}
}
示例13: onDropWithItemVisibility
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onDropWithItemVisibility(PlayerDropItemEvent e) {
Player p = e.getPlayer();
if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Enable")) {
if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Option.Ultimate-Protection-Of-The-Items")) {
if ((p.getItemInHand().getItemMeta().getDisplayName() == Check) || (p.getItemInHand().getItemMeta().getDisplayName() == CheckTwo)) {
e.setCancelled(true);
}
}
}
}
示例14: onPlayerDropItem
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
Gamer g = Gamer.get(event.getPlayer());
event.setCancelled(true);
if (g.getVariable("edit") != null) {
if ((boolean) g.getVariable("edit"))
event.setCancelled(false);
}
}
示例15: onDrop
import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent event) {
if (isSoulbound(event.getItemDrop().getItemStack())) {
event.getPlayer().sendMessage(ChatColor.RED + "You cannot drop Soulbound items!");
event.setCancelled(true);
}
}