forked from Upstream/mmocore
added exp tables to classes
This commit is contained in:
parent
333ecf93da
commit
77fd7892ef
@ -580,6 +580,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
new SmallParticleEffect(getPlayer(), Particle.SPELL_INSTANT);
|
new SmallParticleEffect(getPlayer(), Particle.SPELL_INSTANT);
|
||||||
}
|
}
|
||||||
getStats().updateStats();
|
getStats().updateStats();
|
||||||
|
|
||||||
|
// Apply class experience table
|
||||||
|
if (getProfess().hasExperienceTable())
|
||||||
|
getProfess().getExperienceTable().claim(this, level, getProfess());
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshVanillaExp();
|
refreshVanillaExp();
|
||||||
|
@ -245,9 +245,14 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
|||||||
return expCurve;
|
return expCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@NotNull
|
||||||
public ExperienceTable getExperienceTable() {
|
public ExperienceTable getExperienceTable() {
|
||||||
return expTable;
|
return Objects.requireNonNull(expTable, "Class has no exp table");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasExperienceTable() {
|
||||||
|
return expTable != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getIcon() {
|
public ItemStack getIcon() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.experience;
|
package net.Indyuce.mmocore.experience;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -24,6 +25,8 @@ public interface ExperienceObject {
|
|||||||
/**
|
/**
|
||||||
* @return Table read when leveling up
|
* @return Table read when leveling up
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@NotNull
|
||||||
ExperienceTable getExperienceTable();
|
ExperienceTable getExperienceTable();
|
||||||
|
|
||||||
|
boolean hasExperienceTable();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import net.Indyuce.mmocore.experience.provider.ProfessionExperienceDispenser;
|
|||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -113,10 +114,12 @@ public class Profession extends PostLoadObject implements ExperienceObject {
|
|||||||
return experience;
|
return experience;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasExperienceTable() {
|
public boolean hasExperienceTable() {
|
||||||
return expTable != null;
|
return expTable != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public ExperienceTable getExperienceTable() {
|
public ExperienceTable getExperienceTable() {
|
||||||
return Objects.requireNonNull(expTable, "Profession has no exp table");
|
return Objects.requireNonNull(expTable, "Profession has no exp table");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user