Exemplo n.º 1
0
 // ----------------------------------------------------------------------------------------------------------------
 @EventHandler
 public void onPlayerDropItem(PlayerDropItemEvent e) {
   if (e.getPlayer() instanceof Player) {
     Player p = e.getPlayer();
     e.setCancelled(true);
   }
 }
Exemplo n.º 2
0
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void onItemDrop(PlayerDropItemEvent event) {
    if (!isInDropOffArea(event.getPlayer().getLocation())) return;

    ItemStack stack = event.getItemDrop().getItemStack();
    if (!isAllowedToDrop(stack.getType())) {
      event.setCancelled(true);
      return;
    }
    if (!isScoringItemType(stack.getType())) return;

    FarmTeamInfo team = (FarmTeamInfo) getTeam(event.getPlayer());
    int teamNum = indexOfTeam(team);
    long dropScore = 0;

    for (int i = 0; i < stack.getAmount(); i++)
      dropScore += getScoreForItem(stack.getType(), teamNum);

    event.getPlayer().sendMessage(stack.getType().name() + ": score +" + dropScore);
    team.addScore(dropScore);

    event
        .getItemDrop()
        .remove(); // don't actually DROP the item ... should we schedule a brief delay here?
  }
  /**
   * Called when a player attempts to drop an item
   *
   * @param event Relevant event details
   */
  @Override
  public void onPlayerDropItem(PlayerDropItemEvent event) {

    if (event.isCancelled()) {
      return;
    }

    GlobalConfiguration cfg = plugin.getGlobalConfiguration();
    WorldConfiguration wcfg = cfg.getWorldConfig(event.getPlayer().getWorld().getName());

    if (wcfg.getBlacklist() != null) {
      Item ci = event.getItemDrop();

      if (!wcfg.getBlacklist()
          .check(
              new ItemDropBlacklistEvent(
                  BukkitPlayer.wrapPlayer(plugin, event.getPlayer()),
                  toVector(ci.getLocation()),
                  ci.getItemStack().getTypeId()),
              false,
              false)) {
        event.setCancelled(true);
        return;
      }
    }
  }
Exemplo n.º 4
0
  @EventHandler(priority = EventPriority.LOW)
  public void onPlayerDropItem(PlayerDropItemEvent event) {
    if (event == null) return;
    if (event.getPlayer() == null) event.setCancelled(true);

    if (validateAuthorizer(event.getPlayer())) event.setCancelled(true);
    else if (validateClickAuth(event.getPlayer(), null)) event.setCancelled(true);
  }
  public void onPlayerDropItem(PlayerDropItemEvent event) {

    String eventplayer = event.getPlayer().getName();
    if (admin.freeze.contains(eventplayer)) {
      // cancel here
      event.setCancelled(true);
      event.getPlayer().sendMessage(ChatColor.RED + "Can't do that while frozen!");
    }
  }
Exemplo n.º 6
0
 @EventHandler
 public void onDrop(PlayerDropItemEvent event) {
   if (isFilly(event.getPlayer())) {
     ItemStack is = event.getItemDrop().getItemStack();
     if (is.getType() == Material.WRITTEN_BOOK) {
       BookMeta bm = (BookMeta) is.getItemMeta();
       if ((bm.hasAuthor() && bm.getAuthor().equals("TheQueenOfPink"))
           && (bm.hasTitle() && bm.getTitle().equals("MineLittlePony.se Handbook"))) {
         event.getItemDrop().remove();
       }
       if (PonyManager.getGroup(event.getPlayer()).equals("filly")) {
         event.getPlayer().getInventory().addItem(getFillyHandbook());
       }
     }
   }
 }
 @EventHandler
 public void onDrop(PlayerDropItemEvent e) {
   if (!Config.separateInv) return;
   Player p = e.getPlayer();
   if (getWorldGroup(p.getWorld()) == null) return;
   saveInventory(p, p.getInventory());
 }
Exemplo n.º 8
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onPlayerDropsItem(PlayerDropItemEvent event) {
   plugin
       .getServer()
       .getScheduler()
       .runTask(plugin, new ResetIgnoreSleepTask(plugin, event.getPlayer().getName()));
 }
 @EventHandler
 public void onSoulboundDrop(PlayerDropItemEvent e) {
   if (isSoulbound(e.getItemDrop().getItemStack())) {
     Player p = e.getPlayer();
     SoundManager.playSoundForPlayer(p, Sound.BLAZE_HIT, 1F, 0.25F, 0.5F);
     e.getItemDrop().remove();
   }
 }
Exemplo n.º 10
0
  @EventHandler
  public void onItemDrop(PlayerDropItemEvent e) {
    Player p = e.getPlayer();

    if (adminMode.contains(p.getName())) {
      e.setCancelled(true);
    }
  }
Exemplo n.º 11
0
	@EventHandler
	public void onItemDrop(PlayerDropItemEvent e) {
		SpleefPlayer player = HeavySpleef.getInstance().getSpleefPlayer(e.getPlayer());

		if (!player.isActive())
			return;

		e.setCancelled(true);
	}
Exemplo n.º 12
0
 @EventHandler
 public void onPlayerDropItem(PlayerDropItemEvent e) {
   Player player = e.getPlayer();
   if (!player.hasPermission("spawn.interact")
       && Util.getConfig()
           .getStringList("inventory_interact_worlds")
           .contains(player.getWorld().getName())) {
     e.setCancelled(true);
   }
 }
 @EventHandler(priority = EventPriority.NORMAL)
 public void onPlayerDropItem(PlayerDropItemEvent event) {
   if (TotalFreedomMod.autoEntityWipe) {
     if (event.getPlayer().getWorld().getEntities().size() > 750) {
       event.setCancelled(true);
     } else {
       event.getItemDrop().remove();
     }
   }
 }
 @EventHandler(priority = EventPriority.NORMAL)
 public void onPlayerDropItem(PlayerDropItemEvent event) {
   if (TFM_ConfigEntry.AUTO_ENTITY_WIPE.getBoolean()) {
     if (event.getPlayer().getWorld().getEntities().size() > 750) {
       event.setCancelled(true);
     } else {
       event.getItemDrop().remove();
     }
   }
 }
Exemplo n.º 15
0
 @EventHandler
 public void onPlayerDropItem(PlayerDropItemEvent event) {
   if (event.getPlayer() == player) {
     if (step == 2) {
       long v = getAbsoluteLong();
       if (v != -1) {
         dropItemTime = v;
       }
     }
   }
 }
Exemplo n.º 16
0
 @EventHandler
 public void onPlayerDropItem(PlayerDropItemEvent e) {
   Player p = e.getPlayer();
   if (p.getLocation()
       .getWorld()
       .getName()
       .equals(settings.getConfig().getString("spawn.world"))) {
     if (!p.hasPermission("hub.editinventory")) {
       e.setCancelled(true);
     }
   }
 }
Exemplo n.º 17
0
 /**
  * Cancel players from dropping the hat in their inventory.
  *
  * @param event
  */
 @EventHandler
 public void cancelHatDropping(PlayerDropItemEvent event) {
   ItemStack item = event.getItemDrop().getItemStack().clone();
   if (item != null
       && item.hasItemMeta()
       && item.getItemMeta().hasDisplayName()
       && item.getItemMeta().getDisplayName().equals("§8§oHat")) {
     event.getItemDrop().remove();
     event.getPlayer().closeInventory();
     event.getPlayer().updateInventory();
   }
 }
Exemplo n.º 18
0
 @EventHandler
 public void SpectatorDrops(PlayerDropItemEvent event) {
   Player p = event.getPlayer();
   String pname = p.getName();
   for (i = 0; i < plugin.Watching.size(); i++) {
     if (plugin.Watching.get(i) != null) {
       if (plugin.Watching.get(i).contains(pname)) {
         event.setCancelled(true);
         p.sendMessage(ChatColor.RED + "You are spectating, you can't interfere with the game!");
       }
     }
   }
 }
Exemplo n.º 19
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onDropEvent(PlayerDropItemEvent event) {
   Player player = event.getPlayer();
   if (!plugin.isSkyWorld(player.getWorld())) {
     return;
   }
   if (!visitorsCanDrop && !plugin.playerIsOnIsland(player) && !plugin.playerIsInSpawn(player)) {
     event.setCancelled(true);
     plugin.notifyPlayer(player, "\u00a7eVisitors can't drop items!");
     return;
   }
   addDropInfo(player, event.getItemDrop().getItemStack());
 }
Exemplo n.º 20
0
 /**
  * Handles item dropping.<br>
  * If the player is in an arena, the game's onItemDrop method is called.<br>
  * If the player is spectating an arena, the event is cancelled.
  */
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onItemDrop(PlayerDropItemEvent event) {
   String playerName = event.getPlayer().getName();
   if (ultimateGames.getPlayerManager().isPlayerInArena(playerName)) {
     Arena arena = ultimateGames.getPlayerManager().getPlayerArena(playerName);
     if (arena.getStatus() == ArenaStatus.RUNNING) {
       arena.getGame().getGamePlugin().onItemDrop(arena, event);
     } else {
       event.setCancelled(true);
     }
   } else if (ultimateGames.getPlayerManager().isPlayerSpectatingArena(playerName)) {
     event.setCancelled(true);
   }
 }
Exemplo n.º 21
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onItemDrop(PlayerDropItemEvent event) {
   Player player = event.getPlayer();
   ItemStack item = event.getItemDrop().getItemStack();
   int amount = item.getAmount();
   if (!player.hasPermission("antihax.check.dropinv")) {
     if (amount > 64) {
       event.setCancelled(true);
       tellPlayer(
           player,
           "[" + ChatColor.RED + "AntiHax" + ChatColor.RESET + "] You dropped items too fast!");
     }
   }
 }
Exemplo n.º 22
0
  @EventHandler(priority = EventPriority.LOW)
  public void onPlayerDropItems(PlayerDropItemEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);

    if (client.isObserver() || !Rixor.getRotation().getSlot().getMatch().isCurrentlyRunning()) {
      event.setCancelled(true);
      return;
    }

    if (!client.isObserver()) {
      /*Map map = Rixor.getRotation().getSlot().getMap();
       */
    }
  }
  @EventHandler(priority = EventPriority.LOWEST)
  public void onItemDrop(PlayerDropItemEvent event) {
    if (event.isCancelled()) return;

    final Player player = event.getPlayer();
    final Item item = event.getItemDrop();

    if (item == null) return;
    if (player.getWorld() != plugin.getIslandWorld()) return;
    if (player.isOp()) return;
    if (player.hasPermission("islandworld.bypass.island")) return;

    if (!(plugin.canBuildOnLocation(player, item.getLocation()))) event.setCancelled(true);

    plugin.debug("Event :" + event.getEventName() + ", cancelled:" + event.isCancelled());
  }
Exemplo n.º 24
0
  @EventHandler
  public void onDrop(PlayerDropItemEvent die) {
    Player p = die.getPlayer();
    Game g = Main.getInstance().getGameManager().getGameOfPlayer(p);
    if (g == null) {
      return;
    }

    if (g.getState() != GameState.WAITING) {
      if (g.isSpectator(p)) {
        die.setCancelled(true);
      }

      return;
    }

    die.setCancelled(true);
  }
Exemplo n.º 25
0
 public void onPlayerDropItem(PlayerDropItemEvent event) {
   Player p = event.getPlayer();
   // Handle field builder condition
   Builder fb = plugin.getBattlefieldManager().getBuilder(p);
   if (fb != null) {
     if (fb.getTool() != null) {
       fb.getTool().cycleParameters();
       event.setCancelled(true);
     }
   }
   // Handle item drops on battlefield
   TeamMember m = plugin.getBattlefieldManager().getPlayer(p);
   if (m != null) {
     if (m.getTeam().getField().isActive()) {
       p.sendMessage(Format.errorTag + "Dropping items is disallowed on the battlefield.");
       event.setCancelled(true);
     }
   }
 }
Exemplo n.º 26
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerDropItem(PlayerDropItemEvent event) {

    final Player p = event.getPlayer();
    final Item item = event.getItemDrop();

    if (isWorld(item.getWorld())) {

      new BukkitRunnable() {
        @Override
        public void run() {

          if (item.isDead()) {
            cancel();
            return;
          }

          List<Entity> ents = EntityChecker.getNearbyEntities(item, 2);
          for (Entity ent : ents) {

            MetadataValue meta;
            if (ent instanceof ArmorStand
                && (meta = EntityChecker.getMeta(ent, "isFireplace")) != null
                && meta.asBoolean()) {

              ItemStack result = item.getItemStack();
              item.remove();

              Material type = result.getType();
              switch (type) {
                case RAW_CHICKEN:
                  result.setType(Material.COOKED_CHICKEN);
                  break;
                case RAW_BEEF:
                  result.setType(Material.COOKED_BEEF);
                  break;
                case RAW_FISH:
                  result.setType(Material.COOKED_FISH);
                  break;
                case PORK:
                  result.setType(Material.GRILLED_PORK);
                  break;
                case POTATO_ITEM:
                  result.setType(Material.BAKED_POTATO);
                  break;
                default:
                  break;
              }

              cancel();

              if (p.isOnline()) {
                p.getWorld().dropItem(p.getLocation(), result).setPickupDelay(0);
              } else {
                p.getWorld().dropItem(item.getLocation(), result).setPickupDelay(0);
              }

              break;
            }
          }
        }
      }.runTaskTimer(getCraftZ(), 10, 10);
    }
  }
Exemplo n.º 27
0
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void onDropItem(PlayerDropItemEvent event) {
   if (plugin.noInteract(event.getPlayer())) {
     event.setCancelled(true);
   }
 }
Exemplo n.º 28
0
 @EventHandler
 public void onItemDrop(PlayerDropItemEvent event) {
   if (um.isSpectator(event.getPlayer().getName())) event.setCancelled(true);
 }
Exemplo n.º 29
0
 @EventHandler
 public void DropEvent(PlayerDropItemEvent e) {
   if (e.getPlayer().getGameMode() == GameMode.CREATIVE) {
     e.setCancelled(true);
   }
 }
Exemplo n.º 30
0
 @EventHandler
 public void drop(PlayerDropItemEvent event) {
   if (!event.getPlayer().getWorld().getName().equals(getName())) return;
   event.setCancelled(true);
 }