Development Assistance Need help with Custom Protection

Discussion in 'Plugin Help/Development/Requests' started by XtrmePlaya, Jul 6, 2016.

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

    XtrmePlaya

    Now before you say this looks horrible, I know, My coding skills are horrible, and I am just doing this to try it out.
    What i am trying to do is get a placed sign (with metadata) and when it is placed run console commands from worldguard guard and world edit to protect a region.

    Code:
    package mine.tyler.protection.events;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.block.Block;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockPlaceEvent;
    
    public class ProtectChunk implements Listener {
    
        @EventHandler
        public void onBlockPlace(BlockPlaceEvent event) {
            Player player = event.getPlayer();
    
            Block block = event.getBlock();
            Material material = block.getType();
    
            if (material == Material.SIGN_POST) {
                player.sendMessage(ChatColor.RED + "Region Protected!");
              
            }
        }
    }
    
    I do not know how to get the if statement to read metadata from SIGN_POST. Also how can i make it choose from any type of sign. Either SIGN, SIGN_POST, or WALL_SIGN. Also how to select and protect a cuboid region around the sign and set the player who placed the sign as the region owner. If i could get help that would amazing. Thank you
     
Thread Status:
Not open for further replies.

Share This Page