Solved Partials at a player

Discussion in 'Spigot Plugin Development' started by Steven627, May 15, 2016.

  1. Hello, I am a new plugin Developer and I would like to make a plugin so when a player dose a command like /partical smoke then some smoke particals go off around the player, dose anyone have any idea how this could be done here is my code -

    package me.steven.particals;

    import org.bukkit.Effect;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;

    import net.minecraft.server.v1_8_R3.Material;

    public class pp extends JavaPlugin {

    @Override
    public void onEnable() {
    getLogger().info("Particals Plugin is working");
    }

    @Override
    public void onDisable() {

    }

    public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {

    if (cmd.getName().equalsIgnoreCase("partical")) {

    Player player = (Player) sender;
    player.getWorld().playEffect(player.getLocation(),Effect.EXPLOSION_HUGE,Material.LAVA);

    return true;

    }
    return false;
    }
    }
     
  2. I suggest you to use this API https://bukkit.org/threads/1-8-particleeffect-v1-7.154406/ and spawn the particles using
    Code (Text):
    ParticleEffect.NAME.display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range);

    NAME: the name of the particle
    float offsetX: how many to X goes the particles
    float offsetY: how many to Y goes the particles
    float offsetZ: how many to Z goes the particles
    float speed: the speed of the particles
    int amount: the amount of the particles
    Location center: the location center of the particles
    double range: from how far can other players see these particles, I suggest you to use 16
    This will spawn the particles very short. If you want to spawn the particles every X seconds, I suggest you to use a BukkitRunnable.
     
    • Like Like x 1
    • Agree Agree x 1
    • Informative Informative x 1