org.bukkit.event.player.PlayerFishEvent Java Examples

The following examples show how to use org.bukkit.event.player.PlayerFishEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KrakenEvent.java    From EliteMobs with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onFishingStart(PlayerFishEvent event) {

    if (event.isCancelled()) return;
    if (!currentVersionIsUnder(13, 0)) return;
    if (!EliteMobs.validWorldList.contains(event.getPlayer().getWorld())) return;
    if (!event.getPlayer().hasPermission("elitemobs.events.kraken")) return;
    if (event.getPlayer().getGameMode() == GameMode.CREATIVE || event.getPlayer().getGameMode() == GameMode.SPECTATOR)
        return;
    if (event.getHook().getLocation().getBlock().isEmpty() || !event.getHook().getLocation().getBlock().isEmpty() &&
            !event.getHook().getLocation().getBlock().getType().equals(Material.WATER)) return;
    if (ThreadLocalRandom.current().nextDouble() > ConfigValues.eventsConfig.getDouble(EventsConfig.KRAKEN_CHANCE_ON_FISH))
        return;

    Kraken.spawnKraken(event.getHook().getLocation());

}
 
Example #2
Source File: Scout.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.NORMAL)
	public void Grappler(PlayerFishEvent event)
	{
		Player player = event.getPlayer();
		if(event.getState() == State.IN_GROUND)
		{
			AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
			if(p != null && p.getKit().equals(this))
			{
				if(isGrappleItem(player.getItemInHand()))
				{
					//event.getHook().
					Location playerloc = player.getLocation();
					Location loc = event.getHook().getLocation();
					if (playerloc.distance(loc) < 3.0D) 
				        pullPlayerSlightly(player, loc);
				    else 
				        pullEntityToLocation(player, loc);
//					Vector vec = playerloc.toVector();
//					Vector vec2 = loc.toVector();
//					player.setVelocity(vec2.subtract(vec).normalize().multiply(1));
					player.getItemInHand().setDurability((short)0);
				}
			}
		}
	}
 
Example #3
Source File: PlayerFishListener.java    From IridiumSkyblock with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler
public void onPlayerFish(PlayerFishEvent event) {
    try {
        final Player player = event.getPlayer();
        final Location location = player.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        if (!islandManager.isIslandWorld(location)) return;

        if (event.getState() != PlayerFishEvent.State.CAUGHT_FISH) return;

        final User user = User.getUser(player);
        final Island island = user.getIsland();
        if (island == null) return;

        for (Mission mission : IridiumSkyblock.getMissions().missions) {
            final Map<String, Integer> levels = island.getMissionLevels();
            levels.putIfAbsent(mission.name, 1);

            final MissionData level = mission.levels.get(levels.get(mission.name));
            if (level.type == MissionType.FISH_CATCH)
                island.addMission(mission.name, 1);
        }
    } catch (Exception e) {
        IridiumSkyblock.getInstance().sendErrorMessage(e);
    }
}
 
Example #4
Source File: CustomItemFish.java    From AdditionsAPI with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onCustomItemFishLowest(CustomItemFishEvent customEvent) {
	if (customEvent.isCancelled())
		return;

	CustomItem cItem = customEvent.getCustomItem();

	if (!(cItem.getPermissions() instanceof FishingRodPermissions))
		return;
	FishingRodPermissions perm = (FishingRodPermissions) cItem.getPermissions();

	PlayerFishEvent event = customEvent.getPlayerFishEvent();

	if (!PermissionUtils.allowedAction(event.getPlayer(), perm.getType(), perm.getReel()))
		event.setCancelled(true);
}
 
Example #5
Source File: PlayerFish.java    From AdditionsAPI with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerFishEvent(PlayerFishEvent event) {
	PlayerInventory inv = event.getPlayer().getInventory();
	ItemStack item = inv.getItemInMainHand();
	if (ItemType.getItemType(item) != ItemType.FISHING_ROD) {
		item = inv.getItemInOffHand();
		if (ItemType.getItemType(item) != ItemType.FISHING_ROD)
			return;
	}
	if (AdditionsAPI.isCustomItem(item))
		Bukkit.getServer().getPluginManager().callEvent(new CustomItemFishEvent(event, new CustomItemStack(item)));
}
 
Example #6
Source File: PlayerListenerTest.java    From AuthMeReloaded with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void shouldHandleSimpleCancelableEvents() {
    withServiceMock(listenerService)
        .check(listener::onPlayerShear, PlayerShearEntityEvent.class)
        .check(listener::onPlayerFish, PlayerFishEvent.class)
        .check(listener::onPlayerBedEnter, PlayerBedEnterEvent.class)
        .check(listener::onPlayerDropItem, PlayerDropItemEvent.class)
        .check(listener::onPlayerHitPlayerEvent, EntityDamageByEntityEvent.class)
        .check(listener::onPlayerConsumeItem, PlayerItemConsumeEvent.class)
        .check(listener::onPlayerInteract, PlayerInteractEvent.class)
        .check(listener::onPlayerPickupItem, PlayerPickupItemEvent.class)
        .check(listener::onPlayerInteractEntity, PlayerInteractEntityEvent.class)
        .check(listener::onPlayerHeldItem, PlayerItemHeldEvent.class);
}
 
Example #7
Source File: IslandGuard1_9.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onRodDamage(final PlayerFishEvent e) {
    if (e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
        return;
    }
    if (!IslandGuard.inWorld(e.getPlayer().getLocation())) {
        return;
    }
    Player p = e.getPlayer();
    if (e.getCaught() != null && (e.getCaught().getType().equals(EntityType.ARMOR_STAND) || e.getCaught().getType().equals(EntityType.ENDER_CRYSTAL))) {
        if (p.isOp() || VaultHelper.checkPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        // Check if on island
        if (plugin.getGrid().playerIsOnIsland(p)) {
            return;
        }
        // Check island
        Island island = plugin.getGrid().getIslandAt(e.getCaught().getLocation());
        if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        if (island != null && island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        Util.sendMessage(p, ChatColor.RED + plugin.myLocale(p.getUniqueId()).islandProtected);
        e.getHook().remove();
        e.setCancelled(true);
    }
}
 
Example #8
Source File: ItemsCaughtListener.java    From Statz with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFishCaught(final PlayerFishEvent event) {

    final PlayerStat stat = PlayerStat.ITEMS_CAUGHT;

    // Get player
    final Player player = event.getPlayer();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    Entity entity;
    ItemStack item;

    String materialName = null;

    if (event.getCaught() != null) {
        entity = event.getCaught();

        if (!(entity instanceof Item)) {
            return; // Did not catch an item
        }

        item = ((Item) entity).getItemStack();

        materialName = item.getType().name();
    } else {
        // Did not catch anything.
        return;
    }

    PlayerStatSpecification specification = new ItemsCaughtSpecification(player.getUniqueId(), item.getAmount(),
            player.getWorld().getName(), item.getType());

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, specification.constructQuery());

}
 
Example #9
Source File: InhumanReactionPattern.java    From AACAdditionPro with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected int process(User user, PlayerFishEvent event)
{
    switch (event.getState()) {
        case CAUGHT_FISH:
            // Too few time has passed since the fish bit.
            if (user.getTimestampMap().recentlyUpdated(TimestampKey.LAST_FISH_BITE, fishingMilliseconds)) {

                // Get the correct amount of vl.
                // vl 6 is the maximum.
                // Points = {{0, 1}, {8, 0}}
                // Function: 1 - 0.125x
                for (byte b = 5; b > 0; b--) {
                    if (user.getTimestampMap().recentlyUpdated(TimestampKey.LAST_FISH_BITE, (long) (1 - 0.125 * b) * fishingMilliseconds)) {
                        // Flag for vl = b + 1 because there would otherwise be a "0-vl"
                        message = "AutoFish-Verbose | Player " + user.getPlayer().getName() + " failed inhuman reaction";
                        return b + 1;
                    }
                }
            }

            // Reset the bite-timestamp to be ready for the next one
            user.getTimestampMap().nullifyTimeStamp(TimestampKey.LAST_FISH_BITE);
            break;
        case BITE:
            user.getTimestampMap().updateTimeStamp(TimestampKey.LAST_FISH_BITE);
            break;
        default:
            break;
    }
    return 0;
}
 
Example #10
Source File: AutoFish.java    From AACAdditionPro with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void on(final PlayerFishEvent event)
{
    final User user = UserManager.getUser(event.getPlayer().getUniqueId());

    // User valid and not bypassed
    if (User.isUserInvalid(user, this.getModuleType())) {
        return;
    }

    vlManager.flag(event.getPlayer(),
                   this.consistencyPattern.apply(user, event) + this.inhumanReactionPattern.apply(user, event),
                   cancelVl,
                   () -> event.setCancelled(true), () -> {});
}
 
Example #11
Source File: EvtExperienceSpawn.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private static void registerExecutor() {
	if (registeredExecutor)
		return;
	for (final Class<? extends Event> c : new Class[] {BlockExpEvent.class, EntityDeathEvent.class, ExpBottleEvent.class, PlayerFishEvent.class})
		Bukkit.getPluginManager().registerEvent(c, new Listener() {}, SkriptConfig.defaultEventPriority.value(), executor, Skript.getInstance(), true);
	registeredExecutor = true;
}
 
Example #12
Source File: CustomItemFish.java    From AdditionsAPI with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void onCustomItemFish(CustomItemFishEvent customEvent) {
	if (customEvent.isCancelled())
		return;
	CustomItem cItem = customEvent.getCustomItem();
	PlayerFishEvent event = customEvent.getPlayerFishEvent();
	Player player = event.getPlayer();
	if (cItem.getDurabilityMechanics() instanceof FishingRodDurability) {
		ItemStack item = customEvent.getCustomItemStack().getItemStack();
		State state = event.getState();
		FishingRodDurability mechanics = (FishingRodDurability) cItem.getDurabilityMechanics();
		PlayerCustomItemDamageEvent damageEvent = new PlayerCustomItemDamageEvent(player, item, 0, cItem);

		switch (state) {
		case CAUGHT_ENTITY:
			if (event.getCaught().getType() == EntityType.DROPPED_ITEM) {
				damageEvent.setDamage(mechanics.getItemReel());
			} else {
				damageEvent.setDamage(mechanics.getEntityReel());
			}
			break;
		case CAUGHT_FISH:
			damageEvent.setDamage(mechanics.getFishCatch());
			break;
		case IN_GROUND:
			damageEvent.setDamage(mechanics.getBlockReel());
			break;
		default:
			break;
		}

		if (damageEvent.getDamage() != 0)
			Bukkit.getServer().getPluginManager().callEvent(damageEvent);
	}
}
 
Example #13
Source File: LifeskillingListener.java    From EnchantmentsEnhance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Fishing gives enhancement stone.
 *
 * @param e
 */
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onFishing(PlayerFishEvent e) {
    // If the fishing is successful
    if (e.getState().equals(State.CAUGHT_FISH)) {
        Player player = e.getPlayer();
        if (DropManager.fishingChance > random.nextDouble()) {
            DropManager.randomDrop(player, DropManager.fishingLootTable);
        }
    }
}
 
Example #14
Source File: PGMListener.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler
public void nerfFishing(PlayerFishEvent event) {
    if (Config.Fishing.disableTreasure() && event.getCaught() instanceof Item) {
        Item caught = (Item) event.getCaught();
        if (caught.getItemStack().getType() != Material.RAW_FISH) {
            caught.setItemStack(new ItemStack(Material.RAW_FISH));
        }
    }
}
 
Example #15
Source File: CitizensNpcFactory.java    From helper with MIT License 5 votes vote down vote up
private void init() {
    // create npc registry
    this.npcRegistry = CitizensAPI.createNamedNPCRegistry("helper", new MemoryNPCDataStore());

    // ensure our trait is registered
    registerTrait();

    // handle click events
    Events.merge(NPCClickEvent.class, NPCRightClickEvent.class, NPCLeftClickEvent.class)
            .handler(e -> handleClick(e.getNPC(), e.getClicker())).bindWith(this.registry);

    // don't let players move npcs
    Events.subscribe(PlayerFishEvent.class)
            .filter(e -> e.getCaught() != null)
            .filter(e -> e.getCaught().hasMetadata("NPC"))
            .handler(e -> e.setCancelled(true))
            .bindWith(this.registry);

    /* Events.subscribe(ProjectileCollideEvent.class)
            .filter(e -> e.getCollidedWith() != null)
            .filter(e -> e.getCollidedWith().hasMetadata("NPC"))
            .handler(e -> e.setCancelled(true))
            .bindWith(this.registry); */

    Events.subscribe(EntityDamageByEntityEvent.class)
            .filter(e -> e.getEntity().hasMetadata("NPC"))
            .handler(e -> e.setCancelled(true))
            .bindWith(this.registry);

    // update npcs every 10 ticks
    Schedulers.sync().runRepeating(this::tickNpcs, 10L, 10L).bindWith(this.registry);
}
 
Example #16
Source File: DisplayProtectionListener.java    From QuickShop-Reremake with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void player(PlayerFishEvent event) {
    if (DisplayItem.getNowUsing() != DisplayType.REALITEM) {
        return;
    }
    if (event.getState() != State.CAUGHT_ENTITY) {
        return;
    }
    if (event.getCaught() == null) {
        return;
    }
    if (event.getCaught().getType() != EntityType.DROPPED_ITEM) {
        return;
    }
    final Item item = (Item) event.getCaught();
    final ItemStack is = item.getItemStack();
    if (!DisplayItem.checkIsGuardItemStack(is)) {
        return;
    }
    // item.remove();
    event.getHook().remove();
    // event.getCaught().remove();
    event.setCancelled(true);
    sendAlert(
            "[DisplayGuard] Player "
                    + event.getPlayer().getName()
                    + " trying hook item use Fishing Rod, QuickShop already removed it.");
    Util.inventoryCheck(event.getPlayer().getInventory());
}
 
Example #17
Source File: PGMListener.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler
public void nerfFishing(PlayerFishEvent event) {
  if (event.getCaught() instanceof Item) {
    Item caught = (Item) event.getCaught();
    if (caught.getItemStack().getType() != Material.RAW_FISH) {
      caught.setItemStack(new ItemStack(Material.RAW_FISH));
    }
  }
}
 
Example #18
Source File: CustomItemFishEvent.java    From AdditionsAPI with MIT License 4 votes vote down vote up
public PlayerFishEvent getPlayerFishEvent() {
	return playerFishEvent;
}
 
Example #19
Source File: ConsistencyPattern.java    From AACAdditionPro with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected int process(User user, PlayerFishEvent event)
{
    switch (event.getState()) {
        case FISHING:
            // Not too many failed attempts in between (afk fish farm false positives)
            // Negative maximum_fails indicate not allowing afk fishing farms.
            if ((maximumFails < 0 || user.getFishingData().failedCounter <= maximumFails) &&
                // If the last attempt was a fail do not check (false positives)
                user.getTimestampMap().getTimeStamp(TimestampKey.AUTOFISH_DETECTION) != 0 &&
                // Add the delta to the consistencyBuffer of the user.
                user.getFishingData().bufferConsistencyData())
            {
                // Enough data, now checking
                final DoubleStatistics consistencyStatistics = user.getFishingData().getStatistics();

                // Calculate the maximum offset.
                final double maxOffset = Math.max(MathUtils.offset(consistencyStatistics.getMin(), consistencyStatistics.getAverage()), MathUtils.offset(consistencyStatistics.getMax(), consistencyStatistics.getAverage()));

                // Ceil in order to make sure that the result is at least 1
                final double flagOffset = Math.ceil((violationOffset - maxOffset) * 0.5D);

                message = "AutoFish-Verbose | Player " +
                          user.getPlayer().getName() +
                          " failed consistency | average time: " +
                          StringUtils.limitStringLength(String.valueOf(consistencyStatistics.getAverage()), 7) +
                          " | maximum offset: " +
                          StringUtils.limitStringLength(String.valueOf(maxOffset), 7) +
                          " | flag offset: " +
                          StringUtils.limitStringLength(String.valueOf(flagOffset), 7);

                user.getFishingData().getStatistics().reset();

                // Has the player violated the check?
                return (int) Math.max(flagOffset, 0);
            }

            // Reset the fail counter as just now there was a fishing success.
            user.getFishingData().failedCounter = 0;
            break;
        // No consistency when not fishing / failed fishing
        case IN_GROUND:
        case FAILED_ATTEMPT:
            user.getTimestampMap().nullifyTimeStamp(TimestampKey.AUTOFISH_DETECTION);
            user.getFishingData().failedCounter++;
            break;
        case CAUGHT_FISH:
            // CAUGHT_FISH covers all forms of items from the water.
            user.getTimestampMap().updateTimeStamp(TimestampKey.AUTOFISH_DETECTION);
            break;
        default:
            break;
    }
    return 0;
}
 
Example #20
Source File: CustomItemFishEvent.java    From AdditionsAPI with MIT License 4 votes vote down vote up
public CustomItemFishEvent(PlayerFishEvent event, CustomItemStack cStack) {
	super(cStack);
	this.playerFishEvent = event;
}
 
Example #21
Source File: FishingTaskType.java    From Quests with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onFishCaught(PlayerFishEvent event) {
        if (event.getState() != PlayerFishEvent.State.CAUGHT_FISH) {
            return;
        }

//        Location hookLocation = event.getHook().getLocation().add(0, -1, 0);
//        if (!(hookLocation.getBlock().getType() == Material.WATER)) {
//            return;
//        }
        
        Player player = event.getPlayer();

        QPlayer qPlayer = QuestsAPI.getPlayerManager().getPlayer(player.getUniqueId(), true);
        QuestProgressFile questProgressFile = qPlayer.getQuestProgressFile();

        for (Quest quest : super.getRegisteredQuests()) {
            if (questProgressFile.hasStartedQuest(quest)) {
                QuestProgress questProgress = questProgressFile.getQuestProgress(quest);

                for (Task task : quest.getTasksOfType(super.getType())) {
                    TaskProgress taskProgress = questProgress.getTaskProgress(task.getId());

                    if (taskProgress.isCompleted()) {
                        continue;
                    }

                    int catchesNeeded = (int) task.getConfigValue("amount");

                    int progressCatches;
                    if (taskProgress.getProgress() == null) {
                        progressCatches = 0;
                    } else {
                        progressCatches = (int) taskProgress.getProgress();
                    }

                    taskProgress.setProgress(progressCatches + 1);

                    if (((int) taskProgress.getProgress()) >= catchesNeeded) {
                        taskProgress.setCompleted(true);
                    }
                }
            }
        }
    }
 
Example #22
Source File: IslandGuard.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onFishing(final PlayerFishEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("Player fish event " + e.getEventName());
        plugin.getLogger().info("Player fish event " + e.getCaught());
    }
    if (e.getCaught() == null)
        return;
    Player p = e.getPlayer();
    if (!inWorld(p)) {
        return;
    }
    if (p.isOp() || VaultHelper.checkPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
        // You can do anything if you are Op of have the bypass
        return;
    }
    // Handle rods
    Island island = plugin.getGrid().getProtectedIslandAt(e.getCaught().getLocation());
    // PVP check
    if (e.getCaught() instanceof Player) {
        // Check if this is the player who is holding the rod
        if (e.getCaught().equals(e.getPlayer())) {
            if (DEBUG)
                plugin.getLogger().info("DEBUG: player cught themselves!");
            return;
        }
        if (island == null
                && (e.getCaught().getWorld().getEnvironment().equals(Environment.NORMAL)
                        && !Settings.defaultWorldSettings.get(SettingsFlag.PVP))
                || ((e.getCaught().getWorld().getEnvironment().equals(Environment.NETHER)
                        && !Settings.defaultWorldSettings.get(SettingsFlag.NETHER_PVP)))) {
            Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).targetInNoPVPArea);
            e.setCancelled(true);
            e.getHook().remove();
            return;
        }
        if (island != null && ((e.getCaught().getWorld().getEnvironment().equals(Environment.NORMAL) && !island.getIgsFlag(SettingsFlag.PVP))
                || (e.getCaught().getWorld().getEnvironment().equals(Environment.NETHER) && !island.getIgsFlag(SettingsFlag.NETHER_PVP)))) {
            Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).targetInNoPVPArea);
            e.setCancelled(true);
            e.getHook().remove();
            return;
        }
    }
    if (!plugin.getGrid().playerIsOnIsland(e.getPlayer())) {
        if (e.getCaught() instanceof Animals) {
            if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.HURT_MOBS)) {
                Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                e.setCancelled(true);
                e.getHook().remove();
                return;
            }
            if (island != null) {
                if ((!island.getIgsFlag(SettingsFlag.HURT_MOBS) && !island.getMembers().contains(p.getUniqueId()))) {
                    Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                    e.setCancelled(true);
                    e.getHook().remove();
                    return;
                }
            }
        }
        // Monster protection
        if (e.getCaught() instanceof Monster || e.getCaught() instanceof Squid || e.getCaught() instanceof Slime) {
            if (island == null && !Settings.defaultWorldSettings.get(SettingsFlag.HURT_MONSTERS)) {
                Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                e.setCancelled(true);
                e.getHook().remove();
                return;
            }
            if (island != null) {
                if ((!island.getIgsFlag(SettingsFlag.HURT_MONSTERS) && !island.getMembers().contains(p.getUniqueId()))) {
                    Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                    e.setCancelled(true);
                    e.getHook().remove();
                }
            }
        }
    }
}
 
Example #23
Source File: PlayerListener.java    From AuthMeReloaded with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerFish(PlayerFishEvent event) {
    if (listenerService.shouldCancelEvent(event)) {
        event.setCancelled(true);
    }
}