Worldguard Custom flags

Discussion in 'Plugin Development' started by mike0631, Jun 26, 2013.

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

    mike0631

    Hello,

    I have little knowledge about the worldguard api, but I want to make something to cancel interaction with specific items if the flag is "deny".

    How would I do this?

    This is my current code:
    Code:java
    1. package com.mcavengers.WGJordiFlag;
    2.  
    3. import org.bukkit.event.EventHandler;
    4. import org.bukkit.event.player.PlayerInteractEvent;
    5. import org.bukkit.plugin.Plugin;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. import com.mewin.WGCustomFlags.WGCustomFlagsPlugin;
    9. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    10. import com.sk89q.worldguard.protection.flags.StateFlag;
    11.  
    12. public class main extends JavaPlugin {
    13.  
    14. public static StateFlag JordiFlag = new StateFlag("JordiFlag", true);
    15.  
    16. @Override
    17. public void onEnable() {
    18. getWGCustomFlags().addCustomFlag(JordiFlag);
    19. }
    20.  
    21. @Override
    22. public void onDisable() {
    23.  
    24. }
    25.  
    26. @EventHandler
    27. public void onBuild(PlayerInteractEvent e){
    28. //?
    29. }
    30.  
    31. private WorldGuardPlugin getWorldGuard() {
    32. Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
    33.  
    34. if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
    35. return null;
    36. }
    37.  
    38. return (WorldGuardPlugin) plugin;
    39. }
    40.  
    41. private WGCustomFlagsPlugin getWGCustomFlags() {
    42. Plugin plugin = getServer().getPluginManager().getPlugin("WGCustomFlags");
    43.  
    44. if (plugin == null || !(plugin instanceof WGCustomFlagsPlugin)) {
    45. return null;
    46. }
    47.  
    48. return (WGCustomFlagsPlugin) plugin;
    49. }
    50.  
    51. }
    52.  
     
Thread Status:
Not open for further replies.

Share This Page