1.8.8 How to NPC hit you faster? In citizens API {code=java}

Discussion in 'Spigot Plugin Development' started by Quark09, Jun 26, 2021.

  1. Yes I tried attackDelayTicks (2); but it gives errors



    my main class is:
    Code (Java):

    package npc.main;
    import java.util.logging.Logger;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Main extends JavaPlugin{
        Logger log = Logger.getLogger("Minecraft");
     
     
        [USER=32110]@Override[/USER]
        public void onEnable() {
            Commands commands = new Commands();
            getCommand("reducebotcreate").setExecutor(new Commands());
            PluginManager pm = getServer().getPluginManager();
            Handler listener = new Handler(this);
            pm.registerEvents(listener, this);
       
       
       
        }
    }



    [code=java]
     
    #1 Quark09, Jun 26, 2021
    Last edited: Jun 26, 2021
  2. Before everything, please use {code=java} ... {/code} (with [] instead of {}), because otherwise it's unreadable. Also could you elaborate on what do you mean by "How to NPC hit you faster?"
     
  3. I mean what npc hit player very slow but i know what is ways for creating this
     
  4. and my commands class is
    Code (Java):

    package npc.main;
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import net.citizensnpcs.api.CitizensAPI;
    import net.citizensnpcs.api.npc.NPC;
    public class Commands implements CommandExecutor{
        @SuppressWarnings("deprecation")
        [USER=32110]@Override[/USER]
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (!(sender instanceof Player)) {
                return true;
                }
       
        Player player = (Player) sender;
        if (cmd.getName().equalsIgnoreCase("reducebotcreate")) {
            NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "ReduceBot");
            npc.spawn(player.getLocation());
            npc.getNavigator().setTarget(player, true);
            npc.getNavigator().getDefaultParameters().useNewPathfinder(true);
        }




        return true;
         
        }
    }
     
  5. sorry im never posted a post on this forum
     
  6. Thanks, now it's much more readable,I am going to take a look.