mirror of
https://github.com/JEFF-Media-GbR/BetterTridents.git
synced 2024-12-28 03:17:45 +01:00
Fixes DISABLE_LOYALTY_PORTALS doesn't work
This commit is contained in:
parent
2606f39e81
commit
e62949e132
@ -44,6 +44,7 @@ public class Main extends JavaPlugin {
|
||||
Bukkit.getPluginManager().registerEvents(new ImpalingListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new OffhandListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new TridentThrowListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PortalListener(), this);
|
||||
getCommand("bettertridents").setExecutor(new ReloadCommand());
|
||||
@SuppressWarnings("unused") Metrics metrics = new Metrics(this, 11460);
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ public class PortalListener implements Listener {
|
||||
if(!main.getConfig().getBoolean(Config.DISABLE_LOYALTY_PORTALS)) return;
|
||||
if(event.getEntityType() != EntityType.TRIDENT) return;
|
||||
Trident trident = (Trident) event.getEntity();
|
||||
if(EnchantmentUtils.getLoyalty(trident)>0) {
|
||||
main.debug("Prevented loyalty trident from travelling through portqal");
|
||||
if(EnchantmentUtils.getLoyalty(trident)) {
|
||||
main.debug("Prevented loyalty trident from travelling through portal");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class EnchantmentUtils {
|
||||
trident.getPersistentDataContainer().set(Main.IMPALING_TAG, PersistentDataType.INTEGER, level);
|
||||
}
|
||||
|
||||
public static int getLoyalty(Trident trident) {
|
||||
return trident.getPersistentDataContainer().getOrDefault(Main.LOYALTY_TAG, PersistentDataType.INTEGER, 0);
|
||||
public static boolean getLoyalty(Trident trident) {
|
||||
return trident.getItem().getEnchantments().containsKey(Enchantment.LOYALTY);
|
||||
}
|
||||
|
||||
public static void registerLoyalty(Trident trident, int level) {
|
||||
|
Loading…
Reference in New Issue
Block a user