Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CTEventManager.register<MCLivingEntityUseItemEvent>((event) => {
- val entity = event.entityLiving as MCLivingEntity;
- if (entity is MCPlayerEntity) {
- var itemStack = event.item as IItemStack;
- var duration = event.duration as int;
- if (itemStack.commandString.startsWith('<item:minecraft:potion') && duration == 0 && itemStack.hasTag && itemStack.hasEffect) {
- val activeEffectsOnPlaayer = entity.getActivePotionMap();
- if !(activeEffectsOnPlaayer.isEmpty) {
- for playerPotionEffect, playerEffectInstance in activeEffectsOnPlaayer {
- entity.removePotionEffect(playerPotionEffect);
- }
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment