|
6 | 6 | import com.dre.brewery.MCBarrel; |
7 | 7 | import com.dre.brewery.P; |
8 | 8 | import com.dre.brewery.api.events.ConfigLoadEvent; |
| 9 | +import com.dre.brewery.integration.barrel.BlocklockerBarrel; |
9 | 10 | import com.dre.brewery.integration.barrel.WGBarrel; |
10 | 11 | import com.dre.brewery.integration.barrel.WGBarrel5; |
11 | 12 | import com.dre.brewery.integration.barrel.WGBarrel6; |
@@ -50,6 +51,7 @@ public class BConfig { |
50 | 51 | public static boolean useLB; //LogBlock |
51 | 52 | public static boolean useGP; //GriefPrevention |
52 | 53 | public static boolean useTowny; //Towny |
| 54 | + public static boolean useBlocklocker; //LockBlocker |
53 | 55 | public static boolean hasVault; // Vault |
54 | 56 | public static boolean useCitadel; // CivCraft/DevotedMC Citadel |
55 | 57 | public static boolean useGMInventories; // GamemodeInventories |
@@ -199,31 +201,13 @@ public static void readConfig(FileConfiguration config) { |
199 | 201 |
|
200 | 202 | // Third-Party |
201 | 203 | useWG = config.getBoolean("useWorldGuard", true) && plMan.isPluginEnabled("WorldGuard"); |
202 | | - |
203 | | - if (useWG) { |
204 | | - Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldEdit"); |
205 | | - if (plugin != null) { |
206 | | - String wgv = plugin.getDescription().getVersion(); |
207 | | - if (wgv.startsWith("6.")) { |
208 | | - wg = new WGBarrel6(); |
209 | | - } else if (wgv.startsWith("5.")) { |
210 | | - wg = new WGBarrel5(); |
211 | | - } else { |
212 | | - wg = new WGBarrel7(); |
213 | | - } |
214 | | - } |
215 | | - if (wg == null) { |
216 | | - P.p.errorLog("Failed loading WorldGuard Integration! Opening Barrels will NOT work!"); |
217 | | - P.p.errorLog("Brewery was tested with version 5.8, 6.1 and 7.0 of WorldGuard!"); |
218 | | - P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload"); |
219 | | - } |
220 | | - } |
221 | 204 | useLWC = config.getBoolean("useLWC", true) && plMan.isPluginEnabled("LWC"); |
222 | 205 | useTowny = config.getBoolean("useTowny", true) && plMan.isPluginEnabled("Towny"); |
223 | 206 | useGP = config.getBoolean("useGriefPrevention", true) && plMan.isPluginEnabled("GriefPrevention"); |
224 | 207 | useLB = config.getBoolean("useLogBlock", false) && plMan.isPluginEnabled("LogBlock"); |
225 | 208 | useGMInventories = config.getBoolean("useGMInventories", false); |
226 | 209 | useCitadel = config.getBoolean("useCitadel", false) && plMan.isPluginEnabled("Citadel"); |
| 210 | + useBlocklocker = config.getBoolean("useBlockLocker", false) && plMan.isPluginEnabled("BlockLocker"); |
227 | 211 | virtualChestPerms = config.getBoolean("useVirtualChestPerms", false); |
228 | 212 | // The item util has been removed in Vault 1.7+ |
229 | 213 | hasVault = plMan.isPluginEnabled("Vault") |
@@ -376,6 +360,33 @@ public static void readConfig(FileConfiguration config) { |
376 | 360 | } |
377 | 361 | } |
378 | 362 |
|
| 363 | + if (useWG) { |
| 364 | + Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldEdit"); |
| 365 | + if (plugin != null) { |
| 366 | + String wgv = plugin.getDescription().getVersion(); |
| 367 | + if (wgv.startsWith("6.")) { |
| 368 | + wg = new WGBarrel6(); |
| 369 | + } else if (wgv.startsWith("5.")) { |
| 370 | + wg = new WGBarrel5(); |
| 371 | + } else { |
| 372 | + wg = new WGBarrel7(); |
| 373 | + } |
| 374 | + } |
| 375 | + if (wg == null) { |
| 376 | + P.p.errorLog("Failed loading WorldGuard Integration! Opening Barrels will NOT work!"); |
| 377 | + P.p.errorLog("Brewery was tested with version 5.8, 6.1 and 7.0 of WorldGuard!"); |
| 378 | + P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload"); |
| 379 | + } |
| 380 | + } |
| 381 | + if (useBlocklocker) { |
| 382 | + try { |
| 383 | + Class.forName("nl.rutgerkok.blocklocker.BlockLockerAPIv2"); |
| 384 | + BlocklockerBarrel.registerBarrelAsProtectable(); |
| 385 | + } catch (ClassNotFoundException e) { |
| 386 | + useBlocklocker = false; |
| 387 | + } |
| 388 | + } |
| 389 | + |
379 | 390 | // init SQL |
380 | 391 | if (sqlSync != null) { |
381 | 392 | try { |
|
0 commit comments