Hello, I am making a plugin which does not contain a command; this is a plugin which fires a firework in the air when a player logs in; but I am attempting to create a permission node. I have created the node in the yaml; it's bang.* but I require assistance in adding it into my code. I know what to do; but I do not know where... if(player.hasPermission("bang.*"){ } Which I think is right... Someone help on where to put this :3 Thanks. Here is my code: Code:java package me.Schnel.EnterWithABang; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.entity.Firework; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.meta.FireworkMeta; public class Main extends JavaPlugin implements Listener { public void onEnable(){ Bukkit.getServer().getPluginManager().registerEvents(this, this); getLogger().info("Plugin Enabled"); } public void onDisable(){ getLogger().info("Plugin Disabled"); } @EventHandler public void onPlayerJoin (final PlayerJoinEvent pje) { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){ public void run(){ Firework f = (Firework) pje.getPlayer().getWorld().spawn(pje.getPlayer().getLocation(), Firework.class); FireworkMeta fm = f.getFireworkMeta(); fm.addEffect(FireworkEffect.builder() .flicker(true) .trail(true) .with(Type.BALL) .with(Type.BALL_LARGE) .with(Type.STAR) .with(Type.BURST) .withColor(Color.OLIVE) .withColor(Color.FUCHSIA) .withFade(Color.LIME) .withFade(Color.ORANGE) .build()); fm.setPower(1); f.setFireworkMeta(fm); } }, 10); } } So in summary, I would like it so that it only fires the firework if the player has the permission node 'bang.*'
You should really have it as a specific node (bang.login-firework, etc), and then make that node a child node of bang.* in your plugin.yml As for checking, it's just Player#hasPermission("string");