Showing Dropping Anvil Something (Ignore)
This commit is contained in:
parent
978bcbbb3b
commit
e07dc303ef
@ -328,14 +328,14 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBannerBreak(BlockBreakEvent e){
|
public void onBannerBreak(BlockBreakEvent e) {
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
if (FactionsPlugin.getInstance().mc17) {
|
if (FactionsPlugin.getInstance().mc17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bannerLocations.containsValue(e.getBlock().getLocation())){
|
if (bannerLocations.containsValue(e.getBlock().getLocation())) {
|
||||||
if(e.getBlock().getType().name().contains("BANNER")) {
|
if (e.getBlock().getType().name().contains("BANNER")) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
fme.msg(TL.BANNER_CANNOT_BREAK);
|
fme.msg(TL.BANNER_CANNOT_BREAK);
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,15 @@ import com.massivecraft.factions.FPlayer;
|
|||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityBreedEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTameEvent;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -26,6 +26,26 @@ public class MissionHandler implements Listener {
|
|||||||
this.plugin = plugin;
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
if (event.getEntity() == null || event.getEntity().getKiller() == null) {
|
if (event.getEntity() == null || event.getEntity().getKiller() == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user