|
21 | 21 | package com.dre.brewery.integration; |
22 | 22 |
|
23 | 23 | import com.dre.brewery.BreweryPlugin; |
| 24 | +import com.dre.brewery.configuration.ConfigManager; |
| 25 | +import com.dre.brewery.configuration.files.Lang; |
24 | 26 | import com.dre.brewery.utility.BUtil; |
| 27 | +import com.dre.brewery.utility.Logging; |
25 | 28 | import me.angeschossen.lands.api.LandsIntegration; |
26 | 29 | import me.angeschossen.lands.api.flags.enums.FlagTarget; |
27 | 30 | import me.angeschossen.lands.api.flags.enums.RoleFlagCategory; |
|
34 | 37 |
|
35 | 38 | public class LandsHook extends Hook { |
36 | 39 |
|
37 | | - public static LandsHook LANDS = new LandsHook("Lands", config.isUseLands()); |
| 40 | + public static LandsHook LANDS; |
| 41 | + public static void load() { |
| 42 | + LANDS = new LandsHook("Lands", config.isUseLands()); |
| 43 | + } |
38 | 44 |
|
39 | 45 | private LandsIntegration landsApi; |
40 | 46 | private RoleFlag barrelAccessFlag; |
41 | 47 |
|
42 | 48 | public LandsHook(String name, boolean enabled) { |
43 | 49 | super(name, enabled); |
44 | 50 |
|
45 | | - if (!this.isEnabled()) return; |
| 51 | + // J, if you're reading this, please note that Lands isn't enabled |
| 52 | + // at this point, so we can't use your Hook#isEnabled method here |
| 53 | + if (!enabled) return; |
| 54 | + |
| 55 | + Lang lang = ConfigManager.getConfig(Lang.class); |
| 56 | + String flag_title = lang.getEntry("Etc_LandsFlag_Title"); |
| 57 | + String[] flag_description = lang.getEntry("Etc_LandsFlag_Description").split("\\\\n"); |
| 58 | + |
46 | 59 | this.landsApi = LandsIntegration.of(BreweryPlugin.getInstance()); |
47 | 60 | this.barrelAccessFlag = RoleFlag.of(landsApi, FlagTarget.PLAYER, RoleFlagCategory.ACTION, "barrel_access") |
48 | | - .setDisplayName("Barrel Access") |
49 | | - .setDescription(BUtil.colorArray("&r&7Allows opening", "&r&7BreweryX barrels.")) |
| 61 | + .setDisplayName(BUtil.color(flag_title)) |
| 62 | + .setDescription(BUtil.colorArray(flag_description)) |
50 | 63 | .setIcon(new ItemStack(Material.BARREL)) |
51 | 64 | .setDisplay(true); |
52 | 65 | } |
|
0 commit comments