How do i make withers only shoot players

I am running an anarchy server and there are a lot of withers. When i load chunks with withers and water, I see that withers are constantly shooting a lot of skulls underwater(target is probably some underwater entity) which makes tps go down. Is there any plugin what will make withers target players only? I am using version 1.19.4.
13 Replies
Admincraft Meta
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by zedamc#0
Discount Milk
Discount Milk2y ago
Not sure if any plugins exist that do it already But seems can be possible using the bukkit api https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityTargetLivingEntityEvent.html
EntityTargetLivingEntityEvent (Spigot-API 1.20.1-R0.1-SNAPSHOT API)
declaration: package: org.bukkit.event.entity, class: EntityTargetLivingEntityEvent
Discount Milk
Discount Milk2y ago
Get the target, if the target isn't the player cancel the event
Zeda
ZedaOP2y ago
That doesn't work, i already tried before to do that: public void onEntityTarget(EntityTargetLivingEntityEvent event) { EntityType entity = event.getEntityType(); LivingEntity target = event.getTarget(); System.out.println("Entity " + entity + " Attacked " + target); } it doesn't even say anything in console
ProGamingDk
ProGamingDk2y ago
Why are u using println Also did u remember to implement listener and use eventhandler
Zeda
ZedaOP2y ago
println prints in console
ProGamingDk
ProGamingDk2y ago
So does getLogger() And u won't get yelled at for using println
Zeda
ZedaOP2y ago
getServer().getPluginManager().registerEvents(this, this); i have listener already
ProGamingDk
ProGamingDk2y ago
Show entire cofr Code
Zeda
ZedaOP2y ago
package org.zedanarchy.toolbox; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.plugin.java.JavaPlugin; public final class ZedaAnarchyToolbox extends JavaPlugin implements Listener { @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); System.out.println("[Toolbox] Plugin was enabled!"); this.saveDefaultConfig(); } @Override public void onDisable() { System.out.println("[Toolbox] Plugin was disabled!"); } FileConfiguration Config = getConfig(); String prefix = Config.getString("messages.prefix"); @EventHandler public void onEntityEvent(ExplosionPrimeEvent event) { String wither = Config.getString("withers.enable"); if(wither.equals("true")) { EntityType entity = event.getEntityType(); if (entity.equals(EntityType.WITHER_SKULL)) { event.setCancelled(true); } } } public void onEntityTarget(EntityTargetLivingEntityEvent event) { EntityType entity = event.getEntityType(); LivingEntity target = event.getTarget(); System.out.println("Entity " + entity + " Attacked " + target); } This is part of code but it shows everything important
ProGamingDk
ProGamingDk2y ago
Ur missing eventhandler Also use getLogger in the future
Zeda
ZedaOP2y ago
Ok i forgot about that lol im dumb lol it's working now !solved
Admincraft Meta
post closed!
The post/thread has been closed!
Requested by zedamc#0

Did you find this page helpful?