Showing Dropping Anvil Something (Ignore)

This commit is contained in:
Driftay 2019-09-15 05:08:00 -04:00
parent 978bcbbb3b
commit e07dc303ef
285 changed files with 28181 additions and 28161 deletions

View File

@ -4,15 +4,15 @@ 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.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityBreedEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.player.PlayerFishEvent;
import java.util.List;
@ -26,6 +26,26 @@ public class MissionHandler implements Listener {
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerTame(EntityTameEvent event) {
if (!(event.getOwner() instanceof Player)) {
return;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer((Player) event.getOwner());
if (fPlayer == null) {
return;
}
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("tame")).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")) && !section.getConfigurationSection("Mission").getString("EntityType").equalsIgnoreCase("ALL")) {
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) {