check if player can build worldguardapi

Discussion in 'Spigot Plugin Development' started by William029, May 28, 2017.

  1. i tried to check if a user can build in that region but i get
    Code (Text):

    rg.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:298) ~[craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:412) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.EntityPlayer.die(EntityPlayer.java:420) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.EntityLiving.damageEntity(EntityLiving.java:923) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.EntityHuman.damageEntity(EntityHuman.java:782) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.EntityPlayer.damageEntity(EntityPlayer.java:505) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.EntityLiving.Q(EntityLiving.java:118) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.CommandKill.execute(SourceFile:35) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.command.VanillaCommandWrapper.dispatchVanillaCommand(VanillaCommandWrapper.java:109) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.command.VanillaCommandWrapper.execute(VanillaCommandWrapper.java:38) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:629) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1295) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1155) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(SourceFile:37) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(SourceFile:9) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_121]
            at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:695) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:360) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:650) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:554) [craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    Caused by: java.lang.IllegalArgumentException: Can't use build flag with allows()
            at com.sk89q.worldguard.protection.AbstractRegionSet.allows(AbstractRegionSet.java:69) ~[?:?]
            at me.bukkit.OutaLuck.listener.playerDeath.onDeath(playerDeath.java:53) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:296) ~[craftbukkit-1.11.2.jar:git-Bukkit-6e3cec8]
     
    line 53 if(WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation()).allows(DefaultFlag.BUILD)){ the .allows has a black cross threw it
     
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    The error is pretty self explanatory. You aren't allowed to use the build flag with allows().
    Maybe if you could tell us what you're trying to do you'd find an alternative?
     
  3. check if they are allowed to build there
     
  4. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    You can use WorldGuardPlugin.canBuild(Block, Player) I believe. I've never used the WG API, but that's what I found via Google.
     
  5. thats not working for me
     
  6. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

  7. ive been looking around for like 30mins ive had enough of searching the internet