Profile Events

This commit is contained in:
Kam committed 2025-03-06 01:24:51 -05:00
1 parent b64481dec1
commit 67a1650fb6
4 files changed
+100 -5

No files matched your search

@@ -15,6 +15,7 @@ import noppes.npcs.api.entity.IEntityLivingBase;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.event.IPlayerEvent;
import noppes.npcs.api.handler.data.IPlayerEffect;
import noppes.npcs.api.handler.data.IProfile;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.scripted.NpcAPI;
@@ -1005,4 +1006,73 @@ public class PlayerEvent extends CustomNPCsEvent implements IPlayerEvent {
DEATH
}
}
@Cancelable
public static class ProfileEvent extends PlayerEvent implements IPlayerEvent.ProfileEvent {
public final IProfile profile;
public final int slot;
public ProfileEvent(IPlayer player, IProfile profile, int slot) {
super(player);
this.profile = profile;
this.slot = slot;
}
public String getHookName() {
return EnumScriptType.PROFILE.function;
}
@Override
public IProfile getProfile() {
return this.profile;
}
@Override
public int getSlot() {
return this.slot;
}
@Cancelable
public static class Changed extends PlayerEvent.ProfileEvent implements IPlayerEvent.ProfileEvent.Changed {
public final int prevSlot;
public Changed(IPlayer player, IProfile profile, int slot, int prevSlot) {
super(player, profile, slot);
this.prevSlot = prevSlot;
}
@Override
public int getPrevSlot() {
return this.prevSlot;
}
public String getHookName() {
return EnumScriptType.PROFILE_CHANGE.function;
}
}
@Cancelable
public static class Removed extends PlayerEvent.ProfileEvent implements IPlayerEvent.ProfileEvent.Removed {
public Removed(IPlayer player, IProfile profile, int slot) {
super(player, profile, slot);
}
public String getHookName() {
return EnumScriptType.PROFILE_REMOVE.function;
}
}
@Cancelable
public static class Create extends PlayerEvent.ProfileEvent implements IPlayerEvent.ProfileEvent.Create {
public Create(IPlayer player, IProfile profile, int slot) {
super(player, profile, slot);
}
public String getHookName() {
return EnumScriptType.PROFILE_CREATE.function;
}
}
}
}