I'm new to programming in general. I figured out how to make a custom leave and join message but beyond that I am lost. I want to cancel players from being able to place blocks unless they have the permission node. How do I achieve this?
There is a BlockPlaceEvent that you can use. You can use Player#hasPermission(String permissionNode) to test if a player has the permission. If they don't, you can use BlockPlaceEvent#setCancelled(true) to cancel the event.
Note that not all events can be cancelled, only those implementing Cancellable. You can view all of which apply, here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/Cancellable.html
Qhucy is prettymuch spot on, without giving you copy/paste-able code. I assume that you're learning via YouTube? (That's how I learned at least.) If so, you should continue through the series (Or however you were learning,) as it will most likely cover this later on. A good youtuber I used is {TheSourceCode}. As FrostedSnowman said, not all events are cancellable. An example of this is InventoryClose. If you wish to 'cancel' this you have to reopen the inventory a tick (or so) later.
Thank you. I've been watching YouTube videos and just kind of copying their code, but I think its better for me to just test things out and use different resources such as this rather than just copy code.
You're right. I've been watching a lot of YouTube videos about it. I have watched the {TheSourceCode} (I'm subscribed in fact!), and also Kody Simpson. Mostly I've been copying their code, which is ok for a little bit, but I want to move a little faster and I feel like trying to do a little more advanced stuff, and I feel like figuring things out myself and using resources like this will help me better understand what I'm coding instead of just copying code.
If you ever get stuck somewhere or want to see examples on how to use something to learn more about them, I recommend using this website https://www.programcreek.com/java-api-examples/?action=search you just search for the class path for example "org.bukkit.event.block.BlockBreakEvent" will return these examples https://www.programcreek.com/java-api-examples/index.php?api=org.bukkit.event.block.BlockBreakEvent
Also, you need to register your event using Bukkit.getPluginManager().registerEvents(<your class implementing Listener>, this); in your onEnable() method. Also, make sure that your method for the event is below a @EventHandler line and that the class of your event is implement the class Listener from Bukkit.
I don't tested it! Code (Java): @EventHandler public void onBlockPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); if(!player.hasPermission("build.bypass") || !player.hasPermission("*")) { if(!event.isCancelled()) { event.setCancelled(true); player.sendMessage(ChatColor.RED+"You can't build without permission!"); } } }
You're way better off to take the time to learn and understand the code you copy so you can fix things. You aren't learning shit just grabbing someone else's code and dumping it into your project. You don't need to test for permission wildcards, that's the job of the permissions manager.