Changed method signature for PlayerExpGainEvent#setExperience(int)

This commit is contained in:
Jules 2024-10-24 17:27:47 +02:00
parent 177ea5014e
commit be373b65f8

View File

@ -1,72 +1,76 @@
package net.Indyuce.mmocore.api.event; package net.Indyuce.mmocore.api.event;
import javax.annotation.Nullable;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.EXPSource;
import net.Indyuce.mmocore.experience.Profession;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import net.Indyuce.mmocore.experience.Profession; import javax.annotation.Nullable;
public class PlayerExperienceGainEvent extends PlayerDataEvent implements Cancellable { public class PlayerExperienceGainEvent extends PlayerDataEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
// if null, this is main experience // if null, this is main experience
private final Profession profession; private final Profession profession;
private final EXPSource source; private final EXPSource source;
private double experience; private double experience;
private boolean cancelled; private boolean cancelled;
public PlayerExperienceGainEvent(PlayerData player, double experience, EXPSource source) { public PlayerExperienceGainEvent(PlayerData player, double experience, EXPSource source) {
this(player, null, experience, source); this(player, null, experience, source);
} }
public PlayerExperienceGainEvent(PlayerData player, @Nullable Profession profession, double experience, EXPSource source) { public PlayerExperienceGainEvent(PlayerData player, @Nullable Profession profession, double experience, EXPSource source) {
super(player); super(player);
this.profession = profession; this.profession = profession;
this.experience = experience; this.experience = experience;
this.source = source; this.source = source;
} }
public double getExperience() { public double getExperience() {
return experience; return experience;
} }
public void setExperience(int experience) { @Deprecated
this.experience = experience; public void setExperience(int experience) {
} setExperience((double) experience);
}
@Override public void setExperience(double experience) {
public boolean isCancelled() { this.experience = experience;
return cancelled; }
}
@Override @Override
public void setCancelled(boolean cancelled) { public boolean isCancelled() {
this.cancelled = cancelled; return cancelled;
} }
public boolean hasProfession() { @Override
return profession != null; public void setCancelled(boolean cancelled) {
} this.cancelled = cancelled;
}
public Profession getProfession() { public boolean hasProfession() {
return profession; return profession != null;
} }
public EXPSource getSource() { public Profession getProfession() {
return source; return profession;
} }
@Override public EXPSource getSource() {
public HandlerList getHandlers() { return source;
return handlers; }
}
public static HandlerList getHandlerList() { @Override
return handlers; public HandlerList getHandlers() {
} return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }