|
11 | 11 | import java.util.function.Consumer; |
12 | 12 | import java.util.logging.Level; |
13 | 13 |
|
| 14 | +import nl.rutgerkok.blocklocker.*; |
14 | 15 | import nl.rutgerkok.blocklocker.impl.event.*; |
15 | 16 | import org.bukkit.Bukkit; |
16 | 17 | import org.bukkit.block.Block; |
|
24 | 25 | import com.google.common.base.Charsets; |
25 | 26 | import com.google.common.base.Preconditions; |
26 | 27 |
|
27 | | -import nl.rutgerkok.blocklocker.BlockLockerPlugin; |
28 | | -import nl.rutgerkok.blocklocker.ChestSettings; |
29 | | -import nl.rutgerkok.blocklocker.ProtectionCache; |
30 | | -import nl.rutgerkok.blocklocker.ProfileFactory; |
31 | | -import nl.rutgerkok.blocklocker.ProtectableBlocksSettings; |
32 | | -import nl.rutgerkok.blocklocker.ProtectionFinder; |
33 | | -import nl.rutgerkok.blocklocker.ProtectionUpdater; |
34 | | -import nl.rutgerkok.blocklocker.SignParser; |
35 | | -import nl.rutgerkok.blocklocker.Translator; |
36 | 28 | import nl.rutgerkok.blocklocker.group.CombinedGroupSystem; |
37 | 29 | import nl.rutgerkok.blocklocker.group.GroupSystem; |
38 | 30 | import nl.rutgerkok.blocklocker.impl.blockfinder.BlockFinder; |
@@ -246,7 +238,18 @@ private void registerEvents() { |
246 | 238 | plugins.registerEvents(new BlockDestroyListener(this), this); |
247 | 239 | plugins.registerEvents(new BlockPlaceListener(this), this); |
248 | 240 | plugins.registerEvents(new InteractListener(this), this); |
249 | | - plugins.registerEvents(new GolemListener(this), this); |
| 241 | + |
| 242 | + // Copper golem listener is not available on Spigot & older Minecraft versions |
| 243 | + try { |
| 244 | + Class.forName("io.papermc.paper.event.entity.ItemTransportingEntityValidateTargetEvent"); |
| 245 | + plugins.registerEvents(new GolemListener(this), this); |
| 246 | + } catch (ClassNotFoundException e) { |
| 247 | + if (!config.allowDestroyBy(AttackType.GOLEM)) { |
| 248 | + getLogger().warning("Failed to register copper golem listener. Paper 1.21.10+ is required for this" + |
| 249 | + " to function. Add GOLEM to allowDestroyBy in the config.yml to disable this warning."); |
| 250 | + } |
| 251 | + } |
| 252 | + |
250 | 253 | plugins.registerEvents(new SignChangeListener(this), this); |
251 | 254 | getCommand(getName().toLowerCase(Locale.ROOT)).setExecutor(new BlockLockerCommand(this)); |
252 | 255 | } |
|
0 commit comments