mirror of
https://github.com/JEFF-Media-GbR/BetterTridents.git
synced 2024-09-27 19:52:35 +02:00
Merge pull request #6 from Cazcez/master
Fixes DISABLE_LOYALTY_PORTALS doesn't work and issue #4
This commit is contained in:
commit
1300762753
@ -44,6 +44,7 @@ public class Main extends JavaPlugin {
|
|||||||
Bukkit.getPluginManager().registerEvents(new ImpalingListener(), this);
|
Bukkit.getPluginManager().registerEvents(new ImpalingListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new OffhandListener(), this);
|
Bukkit.getPluginManager().registerEvents(new OffhandListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new TridentThrowListener(), this);
|
Bukkit.getPluginManager().registerEvents(new TridentThrowListener(), this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new PortalListener(), this);
|
||||||
getCommand("bettertridents").setExecutor(new ReloadCommand());
|
getCommand("bettertridents").setExecutor(new ReloadCommand());
|
||||||
@SuppressWarnings("unused") Metrics metrics = new Metrics(this, 11460);
|
@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(!main.getConfig().getBoolean(Config.DISABLE_LOYALTY_PORTALS)) return;
|
||||||
if(event.getEntityType() != EntityType.TRIDENT) return;
|
if(event.getEntityType() != EntityType.TRIDENT) return;
|
||||||
Trident trident = (Trident) event.getEntity();
|
Trident trident = (Trident) event.getEntity();
|
||||||
if(EnchantmentUtils.getLoyalty(trident)>0) {
|
if(EnchantmentUtils.getLoyalty(trident)) {
|
||||||
main.debug("Prevented loyalty trident from travelling through portqal");
|
main.debug("Prevented loyalty trident from travelling through portal");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ public class EnchantmentUtils {
|
|||||||
trident.getPersistentDataContainer().set(Main.IMPALING_TAG, PersistentDataType.INTEGER, level);
|
trident.getPersistentDataContainer().set(Main.IMPALING_TAG, PersistentDataType.INTEGER, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLoyalty(Trident trident) {
|
public static boolean getLoyalty(Trident trident) {
|
||||||
return trident.getPersistentDataContainer().getOrDefault(Main.LOYALTY_TAG, PersistentDataType.INTEGER, 0);
|
return trident.getItem().getEnchantments().containsKey(Enchantment.LOYALTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerLoyalty(Trident trident, int level) {
|
public static void registerLoyalty(Trident trident, int level) {
|
||||||
|
Loading…
Reference in New Issue
Block a user