Spigot Help

Discussion in 'Spigot Plugin Development' started by Angeles, Jun 2, 2017.

  1. Hello users im working on a custom spigot version for a server i am owning and im trying to make my asyncpot in there but everytime i put PluginManager manager = ....; it doesnt let allow me to compile becuase of an error
     
    • Optimistic Optimistic x 1
  2. Sorry, what are you trying to make in your server? And what is your error?
     
  3. Basically im working on a spigot.jar and im trying to add a listener
     
  4. Can you post a chunk of code and/or the error you are getting?
     
  5. Posting code would be helpful.... We are not mindreaders.. And welcome back Mr. Decompiler ;) Back at it again?
     
  6. PluginManager manager = getServer().getPluginManager();
    manager.registerEvents(LISTENERCLASS.class, MAINCLASS.class);
     
  7. In the Bukkit.class in the setServer method would be the main
     
  8. Than get the instance of the Main ....
     
  9. Sir you cant do that [​IMG] upload_2017-6-3_12-19-32.png
     
  10. So you are trying to make a custom spigot server without even the knowledge on how to make a command? You clearly have no knowledge on what you are doing here...
     
  11. I know how to make a command lmao i just dont know how to add PluginManager to it because when i do it wont let me compile with maven
     
  12. And why would you need pluginManager for this? DO you even understand it?
     
  13. To add a listener

    Code (Text):
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Projectile;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PotionSplashEvent;
    import org.bukkit.event.entity.ProjectileLaunchEvent;
    import org.bukkit.util.Vector;

    public class PotListener implements Listener {
        double speed = 1.0;

        @EventHandler
        public void onProjectileLaunch(ProjectileLaunchEvent e) {
            if(e.getEntityType() == EntityType.SPLASH_POTION) {
                Projectile projectile = e.getEntity();

                if(projectile.getShooter() instanceof Player && ((Player) projectile.getShooter()).isSprinting()) {
                    Vector velocity = projectile.getVelocity();

                    velocity.setY(velocity.getY() - speed);
                    projectile.setVelocity(velocity);
                }
            }
        }

        @EventHandler
        public void onPotionSplash(PotionSplashEvent e) {
            if(e.getEntity().getShooter() instanceof Player) {
                Player p = (Player) e.getEntity().getShooter();

                if(p.isSprinting() && e.getIntensity(p) > 0.5D) {
                    e.setIntensity(p, 1.0D);
                }
            }
        }
     

  14. Thats what the issue is
     
    1. What exactly is your aspirational end result here?
    2. What is the error you're getting?
     
  15. He is trying to make a custom spigot jar but he has no knowledge in Java and Bukkit/Spigot.
     
  16. Right basically im making a custom spigot server jar and im trying to figure out if i can register listeners anywhere in the spigot server so i can add my async Pot listener
     
  17. AFAIK, you can't register a Listener in the Server JAR. This is done in a plugin.. And you don't have the knowledge to understand.
     
  18. Im pretty sure there is a way
     
  19. I'm pretty sure you don't have the knowledge... Try it with a plugin.
     
    • Agree Agree x 1