From ed0e17e2a012ebd6a20871c7ec642dc552e2bf79 Mon Sep 17 00:00:00 2001 From: Driftay Date: Sun, 15 Sep 2019 03:48:25 -0400 Subject: [PATCH] Missions Fix --- .../listeners/FactionsPlayerListener.java | 1 + .../factions/missions/MissionHandler.java | 21 +------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 918b5e77..7f5c8ae2 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -824,6 +824,7 @@ public class FactionsPlayerListener implements Listener { return; } } + if (event.getItem() == null) return; if (!playerCanUseItemHere(player, block.getLocation(), event.getItem().getType(), false)) { event.setCancelled(true); diff --git a/src/main/java/com/massivecraft/factions/missions/MissionHandler.java b/src/main/java/com/massivecraft/factions/missions/MissionHandler.java index cc8d348f..c756c14e 100644 --- a/src/main/java/com/massivecraft/factions/missions/MissionHandler.java +++ b/src/main/java/com/massivecraft/factions/missions/MissionHandler.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FactionsPlugin; import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -25,26 +26,6 @@ public class MissionHandler implements Listener { this.plugin = plugin; } - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onEntityBreed(EntityBreedEvent event) { - if (event.getEntity() == null) { - return; - } - FPlayer fPlayer = FPlayers.getInstance().getByPlayer(event.getEntity().getKiller()); - if (fPlayer == null) { - return; - } - List missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("breed")).collect(Collectors.toList()); - for (Mission mission2 : missions) { - ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName()); - if (!event.getEntityType().toString().equals(section.getConfigurationSection("Mission").getString("EntityType"))) { - continue; - } - mission2.incrementProgress(); - checkIfDone(fPlayer, mission2, section); - } - } - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDeath(EntityDeathEvent event) { if (event.getEntity() == null || event.getEntity().getKiller() == null) {