Development Assistance PacketPlayOutWorldParticles Changed?

Discussion in 'Plugin Help/Development/Requests' started by Godbrandont, May 20, 2015.

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

    Godbrandont

    Hey could someone help me, I've tried using PacketPlayOutWorldParticles for particles, but the arguments I give don't work anymore and I think it was changed in 1.8 or something, could someone give me the correct use for it, I've tried looking it up for like an hour but to no avail. I've tried several combinations but it doesn't work. For example: [​IMG]
    Any help would be appreciated. Thanks.

    Full code:
    Code:
    package me.Godbrandont.Retribution;
    
    
    import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles;
    
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.Sound;
    import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
    import org.bukkit.entity.Arrow;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.ItemStack;
    
    
    public class Events implements Listener{
      
        public enum Effects{
            explode("explode"),
            hugeexplode("hugeexplosion");
          
          
            private String name;
          
            Effects(String name)
            {
                this.name = name;
            }
          
        }
      
        static Main plugin;
      
        public Events(Main pl) {
            plugin = pl;
        }
    
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent e)
        {
            Player p = e.getPlayer();
            p.getInventory().setContents(null);
            p.getInventory().addItem(new ItemStack(Material.BONE, 1));
        }
      
        @EventHandler
        public void onPlayerInteract(PlayerInteractEvent e)
        {
            Player p = e.getPlayer();
            if((e.getAction() == Action.RIGHT_CLICK_AIR)||(e.getAction() == Action.RIGHT_CLICK_BLOCK))
            {
                if(e.getItem().getType() == Material.BONE)
                {
                    Arrow a = p.launchProjectile(Arrow.class);
                    a.setVelocity(p.getLocation().getDirection().multiply(4D)); // <-- lol 1D
                    a.getWorld().playSound(a.getLocation(), Sound.EXPLODE, 10, 1);
                    ParticleEffects.sendToLocation(ParticleEffects.EXPLODE, p.getLocation(), 0, 0, 0, 1, 10);
                    releaseParticle(p.getLocation(), Effects.hugeexplode);
                }
            }
        }
      
        public void releaseParticle(Location location, Effects effect){
          
            for(Player p : location.getWorld().getPlayers()){
              
                float x = (float) location.getX();
                float y = (float) location.getY();
                float z = (float) location.getZ();
              
                PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(effect.name, x, y, z, 1, 1, 1, 1, 1);
                ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
            }
        }
      
    }
    
     
    Last edited: May 20, 2015
  2. Offline

    VortexGmer

    For Particles you could use @DarkBladee12 's ParticleEffect Util.
     
  3. Offline

    RingOfStorms

    Simply hover your mouse over the error and eclipse will tell you what parameter is wrong, then fix it accordingly. The fact you are asking this means you've probably just copy pasted the code and don't actually understand any of it, so I would recommend using a library like DarkBladee12's as it will be much easier to understand for a newer developer.
     
  4. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  5. Offline

    Godbrandont

    Excuse me, please do not assume just to have an excuse to have a go at someone. If you actually bothered to try this for yourself you'll see that it doesn't tell me which parameter is wrong. Also I have a substantial amount of experience in programming for your information. If you're not going to be helpful, don't be so rude and don't say anything at all.

    Oh and also, DarkBladee12's Particle Library also doesn't work because of what I believe is the same error. So yeah.

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: May 21, 2015
  6. Offline

    RingOfStorms

    For the record, I wasn't really having a go at you in that post, I assumed you were new because your post shows you have little experience or know how when it comes to NMS and the protocol of minecraft, but hey, if you want me to attack then sure I can add some attitude below.

    Hovering the mouse will tell you that your parameters don't match. I personally use intellij now but I did use eclipse and it tells the same information as intellij when you hover over errors. Since you know so much about programming and all the internals of NMS then you should know how to look at the source code of the packet and read the new parameters (or simply hover/have eclipse auto fill the parameters).

    If you do look at the source you will see that the constructor changed a lot since the 1.7 protocol (which you are currently using). I would also assume that with your substantial programming knowledge and experience that you've discovered the one and best resource for looking at the protocol of NMS packets which can be found here. With that link and your awesome skills I think you can probably figure out what to change to fix it.
     
  7. Offline

    Godbrandont

    Requesting thread to be deleted. Thanks.
     
Thread Status:
Not open for further replies.

Share This Page