OtherDrops

226k Downloads

WorldGuard Protection failed

QDaniel opened this issue ยท 9 comments

commented

OtherDrops can't hook into WorldGuard.

Code is failed:

in OtherDrops ::setupWorldGuard

147     if (OtherDrops.worldguardPlugin == null) {

must changed to

147     if (wg == null) {
commented

the if don't check the result correctly.

https://github.com/Zarius/Bukkit-OtherBlocks/blob/v2Refactor/src/com/gmail/zariust/otherdrops/OtherDrops.java

My Problem was when a player break a block the WorldGuard Regions don't check correctly.

I have added this Code too:

in CustomDropEvent:matches ( https://github.com/Zarius/Bukkit-OtherBlocks/blob/v2Refactor/src/com/gmail/zariust/otherdrops/event/CustomDropEvent.java )

between line 129 and 130.

                if(OtherDrops.worldguardPlugin != null)
                {
                    if(!OtherDrops.worldguardPlugin.canBuild(player, drop.getLocation()))
                    {
                        OtherDrops.logInfo("CustomDrop.matches(): WorldGuard.CanBuild failed.",HIGHEST);
                        return false;                   
                    }
                }
commented

@QDaniel

You are quite correct. Not sure why that routine was changed - here's the code from v1.96:

private void setupWorldGuard() {
    OtherBlocks.worldguardPlugin = (WorldGuardPlugin) this.getServer().getPluginManager().getPlugin("WorldGuard");

    if (OtherBlocks.worldguardPlugin == null) {
        OtherBlocks.logInfo("Couldn't load WorldGuard.");
    } else {
        OtherBlocks.logInfo("Hooked into WorldGuard.");         
    }
}

Whereas 2.0 now sets a local variable but then checks the global. Fixed in local build. Will look into your customdropevent change tonight.

commented

And what does that change do?

commented

Additional the log message at OtherDrops:PerformDrop at line 308 ( https://github.com/Zarius/Bukkit-OtherBlocks/blob/v2Refactor/src/com/gmail/zariust/otherdrops/OtherDrops.java#L308 )

should be have a Verbosity Level to prevent too much log entrys.

(Sorry for my bad english i'm german ;-) )

commented

Cool, thanks for that, will fix tonight.

commented

Local i have change the verbosity level of OtherDrops:PerformDrop at line 312 (https://github.com/Zarius/Bukkit-OtherBlocks/blob/v2Refactor/src/com/gmail/zariust/otherdrops/OtherDrops.java#L312) to NORMAL.

Because it can be important to see was dropped to the Player, the Playername should be added and Verbosity should be set to HIGH or NORMAL.

commented

Fixed in b0eb966

Comments mentioned here (unrelated to worldguard issue) have been fixed in cba1178

commented

thanks.

What is with the CustomDropEvent:maches() change to check the build permission correctly?

commented

The reason for changing it to set a local variable was to defer the cast to WorldGuardPlugin until a point at which that class is known to be available. I'm not 100% certain it was necessary, but it feels like good practice to avoid things that might cause a ClassNotFoundException.