Enforce the species blacklist

This commit is contained in:
Sollace 2018-09-13 12:45:24 +02:00
parent f413e92223
commit 3d3409730e

View file

@ -50,6 +50,7 @@ class PlayerCapabilities implements IPlayer, ICaster<EntityPlayer> {
if (getOwner() == null) { if (getOwner() == null) {
return Race.HUMAN; return Race.HUMAN;
} }
return Race.fromId(getOwner().getDataManager().get(PLAYER_RACE)); return Race.fromId(getOwner().getDataManager().get(PLAYER_RACE));
} }
@ -57,6 +58,10 @@ class PlayerCapabilities implements IPlayer, ICaster<EntityPlayer> {
public void setPlayerSpecies(Race race) { public void setPlayerSpecies(Race race) {
EntityPlayer self = getOwner(); EntityPlayer self = getOwner();
if (!PlayerSpeciesList.instance().speciesPermitted(race)) {
race = Race.HUMAN;
}
if (self != null) { if (self != null) {
getOwner().getDataManager().set(PLAYER_RACE, race.ordinal()); getOwner().getDataManager().set(PLAYER_RACE, race.ordinal());