diff --git a/.editorconfig b/.editorconfig index c2692bb..ac9e93a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,14 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true -indent_style = tab -indent_size = 4 -trim_trailing_whitespace = true - -[*.yml] -indent_style = spaces -indent_size = 2 -trim_trailing_whitespace = true - +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 4 +trim_trailing_whitespace = true + +[*.yml] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + diff --git a/.gitignore b/.gitignore index 99fb244..c9a19de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,28 @@ -# Eclipse stuff -/.classpath -/.project -/.settings - -# NetBeans -/nbproject -/build.xml - -# vim -.*.sw[a-p] - -# IntelliJ -/.idea -/*.iml - -# various other potential build files -/build -/bin -/dist -/*.jardesc - -# Mac filesystem dust -.DS_Store - -# maven -/target +# Eclipse stuff +/.classpath +/.project +/.settings + +# NetBeans +/nbproject +/build.xml + +# vim +.*.sw[a-p] + +# IntelliJ +/.idea +/*.iml + +# various other potential build files +/build +/bin +/dist +/*.jardesc + +# Mac filesystem dust +.DS_Store + +# maven +/target +/dependency-reduced-pom.xml diff --git a/pom.xml b/pom.xml index 8c82f9a..c43a925 100644 --- a/pom.xml +++ b/pom.xml @@ -87,14 +87,16 @@ http://maven.sk89q.com/repo/ + jitpack.io https://jitpack.io - dre2n-rpo - http://erethon.de/repo/ + brewery-repo + https://zebradrive.de/maven/ + devoted-repo https://build.devotedmc.com/plugin/repository/everything/ @@ -212,13 +214,13 @@ com.github.TechFortress GriefPrevention - 16.9 + 16.11.5 provided de.diddiz logblock - 1.13.1-SNAPSHOT + 1.13.2-SNAPSHOT-391 provided @@ -234,4 +236,11 @@ compile + + + + file-repo + file:///var/tmp/MavenRepo + + diff --git a/resources/plugin.yml b/resources/plugin.yml index 6ece640..b024677 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,5 +1,5 @@ name: Brewery -version: 1.7 +version: 1.7.1 main: com.dre.brewery.P softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault, Citadel] authors: [Milan Albrecht, Frank Baumann, ProgrammerDan, Daniel Saukel] diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java index c01b9a2..f9a997c 100644 --- a/src/com/dre/brewery/Barrel.java +++ b/src/com/dre/brewery/Barrel.java @@ -126,7 +126,7 @@ public class Barrel implements InventoryHolder { } } catch (Throwable e) { P.p.errorLog("Failed to Check WorldGuard for Barrel Open Permissions!"); - P.p.errorLog("Brewery was tested with version 5.8 to 6.1 of WorldGuard!"); + P.p.errorLog("Brewery was tested with version 5.8, 6.1 to 7.0 of WorldGuard!"); P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload"); e.printStackTrace(); P.p.msg(player, "&cError opening Barrel, please report to an Admin!"); @@ -143,7 +143,7 @@ public class Barrel implements InventoryHolder { } } catch (Throwable e) { P.p.errorLog("Failed to Check GriefPrevention for Barrel Open Permissions!"); - P.p.errorLog("Brewery was tested with GriefPrevention 14.5.4"); + P.p.errorLog("Brewery was tested with GriefPrevention v14.5 - v16.9"); P.p.errorLog("Disable the GriefPrevention support in the config and do /brew reload"); e.printStackTrace(); P.p.msg(player, "&cError opening Barrel, please report to an Admin!"); diff --git a/src/com/dre/brewery/integration/WGBarrel7.java b/src/com/dre/brewery/integration/WGBarrel7.java index 83b1d23..7c2ef25 100644 --- a/src/com/dre/brewery/integration/WGBarrel7.java +++ b/src/com/dre/brewery/integration/WGBarrel7.java @@ -17,13 +17,38 @@ import com.sk89q.worldguard.internal.platform.WorldGuardPlatform; import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.regions.RegionQuery; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + public class WGBarrel7 implements WGBarrel { + private Method getWorldByName; + + public WGBarrel7() { + try { + getWorldByName = WorldGuardPlatform.class.getDeclaredMethod("getWorldByName", String.class); + } catch (NoSuchMethodException e) { + getWorldByName = null; + } + } + public boolean checkAccess(Player player, Block spigot, Plugin plugin) { WorldGuardPlugin wg = (WorldGuardPlugin) plugin; WorldGuardPlatform platform = WorldGuard.getInstance().getPlatform(); - World world = platform.getMatcher().getWorldByName(spigot.getWorld().getName()); + World world; + if (getWorldByName == null) { + world = platform.getMatcher().getWorldByName(spigot.getWorld().getName()); + } else { + // Workaround for an older Beta Version of WorldGuard 7.0 + try { + world = ((World) getWorldByName.invoke(platform, spigot.getWorld().getName())); + } catch (IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + P.p.msg(player, "Error in WorldGuard"); + return false; + } + } if (!platform.getGlobalStateManager().get(world).useRegions) return true; // Region support disabled WorldEditPlugin we = JavaPlugin.getPlugin(WorldEditPlugin.class); if (new RegionPermissionModel(we.wrapPlayer(player)).mayIgnoreRegionProtection(world)) return true; // Whitelisted cause diff --git a/src/com/dre/brewery/integration/WGBarrelOld.java b/src/com/dre/brewery/integration/WGBarrelOld.java index 0b4af35..8699a7a 100644 --- a/src/com/dre/brewery/integration/WGBarrelOld.java +++ b/src/com/dre/brewery/integration/WGBarrelOld.java @@ -30,7 +30,7 @@ public class WGBarrelOld implements WGBarrel { getApplicableRegions = RegionManager.class.getMethod("getApplicableRegions", Location.class); } catch (NoSuchMethodException e) { P.p.errorLog("Failed to Hook WorldGuard for Barrel Open Permissions! Opening Barrels will NOT work!"); - P.p.errorLog("Brewery was tested with version 5.8 to 6.1 of WorldGuard!"); + P.p.errorLog("Brewery was tested with version 5.8, 6.1 to 7.0 of WorldGuard!"); P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload"); e.printStackTrace(); }