1.16.5 Command

Discussion in 'Spigot Plugin Development' started by Johnacek, Jul 13, 2021.

Thread Status:
Not open for further replies.
  1. Hello, I have this code and I need to add command, which will have permission that if I execute the / toogleautomsg command, the players will stop automsg, and if he executes the command again, they will walk again. Maybe someone will understand me. Thank you

    package johnacek.automsg;

    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scheduler.BukkitRunnable;
    import org.bukkit.scheduler.BukkitTask;

    public class Automsg extends JavaPlugin {
    Automsg plugin;

    @Override
    public void onEnable() {
    plugin = this;
    BukkitTask task = new BukkitRunnable() {
    public void run() {
    Bukkit.broadcastMessage("každých 5 sec asi");
    }
    }.runTaskTimer(plugin,100,100);
    }
    }
     
  2. simple way are to create List or Set where you will store who activate your command, if player exist at that list\set - player already used that command and you need to remove player from list\set and set him walking
     
  3. Hmm, I can try it, but i'm not sure.
     
  4. I don't know how :(
     
  5. Google how to use an arraylist in java. We're not gonna spoon-feed code.
     
Thread Status:
Not open for further replies.