Catch any exception for custom worldguard flag register (#993)

## Misc. Changes
* Changes exception for WorldGuard bending flag
* Skip jukeboxes for TempBlocks to prevent invalid record type when trying to revert them
This commit is contained in:
Josh 2019-07-03 13:08:41 -04:00 committed by Christopher Martin
parent 0faa8b6398
commit e1c977ca7d
2 changed files with 3 additions and 4 deletions

View file

@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.hooks;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
import com.projectkorra.projectkorra.ProjectKorra;
@ -12,8 +11,8 @@ public class WorldGuardFlag {
final FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
try {
registry.register(new StateFlag("bending", false));
} catch (final FlagConflictException e) {
ProjectKorra.log.severe("unable to register bending WorldGuard Flag");
} catch (final Exception e) {
ProjectKorra.log.severe("Unable to register bending WorldGuard Flag");
}
}
}

View file

@ -58,7 +58,7 @@ public class TempBlock {
instances.put(block, temp);
} else {
this.state = block.getState();
if (this.state instanceof Container) {
if (this.state instanceof Container || this.state.getType() == Material.JUKEBOX) {
return;
}
instances.put(block, this);