How do i use particles?

Discussion in 'Plugin Development' started by alzan12, Dec 10, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    alzan12

    How do i get particle effects for my plugin? The only one i know how to do is smoke.

    Code:
    player.getWorld().playEffect(player.getLocation(),Effect.SMOKE,4);
    I'm looking for stuff like fire and portal particles.
    I've tryed looking on the wiki and other forum post but i cant find anything.
     
  2. Offline

    DomovoiButler

    maybe its not implemented yet?
     
  3. Offline

    Kierrow

    The actual player position is at it's feet.
    Maybe you have just not noticed the smoke.
    Where did you put that code snippet, what triggers it?
     
  4. Offline

    DomovoiButler

    you didnt read his post right....he said
    he wants to know how to spawn or create particles like the portal particles
     
  5. Offline

    Kierrow

    Yeah I got that.
    I think you got me wrong.

    What I meant is that, with the method he is calling,
    the smoke particles would be generated at the player's feet,
    which means he is unlikely to see them as they would go
    through his model character's head.

    Otherwise, regarding how to actually spawn them, I'd guess he's using the correct method.
     
  6. Offline

    darkmage0252

    im pretty sure you have to send certain packets to the players you want to see them.
     
  7. Offline

    Kierrow

    well, but if you want everybody to see them, wouldn't you have to spawn them in the world?
     
  8. Offline

    DomovoiButler

    so your response is not really about the question asked, im sure he knows what his doing and like to have smoke in his feet not on the head
    the way you say your response is that you really dont understand what his asking and just posted right away
     
  9. Offline

    Kierrow

  10. Offline

    alzan12

    Thanks. The only one on the list that works without errors is the smoke effect. I'm looking for effects that other players will see. like fire or portal particles rising from the ground.
    Edit: Now only smoke works and all the others don't do anything.
     
  11. Offline

    Kierrow

    Why aren't they working.
    Are they just not showing or is there an error log in console?
    If so, please post it.
     
  12. Offline

    alzan12

    They don't do anything.
     
  13. Offline

    DirtyStarfish

    They do work.

    For example, the Ender_Signal effect will create the effect when the eye of the ender breaks.

    Code:
    public void onPlayerMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location loc = event.getFrom();
        World world = player.getWorld();
        world.playEffect(loc, Effect.ENDER_SIGNAL, 1);
    }
    I just tried the code above to see what Ender_Signal was. It definitely works.
     
    ArcheCane likes this.
  14. Offline

    alzan12

    unable to pass PlayerJoined to OnJoin
    NoSuchFieldError : Ender_Signal
     
  15. Offline

    DirtyStarfish

    Post the code for your onPlayerJoin event
     
  16. Offline

    alzan12

    This is just part of it. The full event is 248 lines long.

    Code:
    	public void onEnable(){
    		setupConfig();
    
    
    		PluginDescriptionFile pdfFile = this.getDescription();
    		// Display message on server bootup (Plugin Name Version Number Enabled)
    		this.logger.info( pdfFile.getName() + " Version " + pdfFile.getVersion() + " enabled!");
    
    
    
    this.getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN,
                    new PlayerListener() {
    
                        @Override
                        public void onPlayerJoin(PlayerJoinEvent event) {
    
                            Player player = event.getPlayer();
                            Location Head = player.getEyeLocation();
    
    
     if(Ender== true){
    
          // play ender effect.
         player.getWorld().playEffect(player.getLocation(),Effect.Ender_Signal,1);
    
    }
                        }
                    },
                    Priority.Normal,
                    this);
    	}
    The values are set before this part of the code.
     
  17. Offline

    alzan12

    Solved! The effects are not supported by CB 1.0.0. I upgraded to 1.0.1 and now it works.
     
  18. Offline

    user_43347

    Since the server code is a modified version of the client, things like playEffect() are in there, even though they are not used much and are mostly limited/useless.
     
  19. Offline

    Chiller

    I love using this in my plugin I have it so they can switch out witch one they want such as FIRE and GHAST SCREAM and so on... It is fun to play around with!
     
  20. Offline

    alzan12

    Thanks for the help.
    I don't know if i can post a link to my plugin here or not. So to stay safe i'm not going to.
    My plugin name is OnJoin
     
Thread Status:
Not open for further replies.

Share This Page