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 (Text):
    1. 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. 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 (Text):
    1. public void onPlayerMove(PlayerMoveEvent event) {
    2.     Player player = event.getPlayer();
    3.     Location loc = event.getFrom();
    4.     World world = player.getWorld();
    5.     world.playEffect(loc, Effect.ENDER_SIGNAL, 1);
    6. }
    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 (Text):
    1.  
    2.     public void onEnable(){
    3.         setupConfig();
    4.  
    5.  
    6.         PluginDescriptionFile pdfFile = this.getDescription();
    7.         // Display message on server bootup (Plugin Name Version Number Enabled)
    8.         this.logger.info( pdfFile.getName() + " Version " + pdfFile.getVersion() + " enabled!");
    9.  
    10.  
    11.  
    12. this.getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN,
    13.                 new PlayerListener() {
    14.  
    15.                     @Override
    16.                     public void onPlayerJoin(PlayerJoinEvent event) {
    17.  
    18.                         Player player = event.getPlayer();
    19.                         Location Head = player.getEyeLocation();
    20.  
    21.  
    22.  if(Ender== true){
    23.  
    24.       // play ender effect.
    25.      player.getWorld().playEffect(player.getLocation(),Effect.Ender_Signal,1);
    26.  
    27. }
    28.                     }
    29.                 },
    30.                 Priority.Normal,
    31.                 this);
    32.     }
    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. 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. 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