Ensure they use the right disguise for the disguisetype
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| package me.libraryaddict.disguise.disguisetypes; | ||||
|  | ||||
| import java.security.InvalidParameterException; | ||||
| import java.util.Random; | ||||
|  | ||||
| import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher; | ||||
| @@ -42,6 +43,10 @@ public class MiscDisguise extends TargetedDisguise { | ||||
|     } | ||||
|  | ||||
|     public MiscDisguise(DisguiseType disguiseType, int id, int data) { | ||||
|         if (!disguiseType.isMisc()) { | ||||
|             throw new InvalidParameterException("Expected a non-living DisguiseType while constructing MiscDisguise. Received " | ||||
|                     + disguiseType + " instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MobDisguise") + " instead"); | ||||
|         } | ||||
|         createDisguise(disguiseType); | ||||
|         switch (disguiseType) { | ||||
|         // The only disguises which should use a custom data. | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
| package me.libraryaddict.disguise.disguisetypes; | ||||
|  | ||||
| import java.security.InvalidParameterException; | ||||
|  | ||||
| import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher; | ||||
| import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher; | ||||
|  | ||||
| @@ -14,6 +16,10 @@ public class MobDisguise extends TargetedDisguise { | ||||
|     } | ||||
|  | ||||
|     public MobDisguise(DisguiseType disguiseType, boolean isAdult) { | ||||
|         if (!disguiseType.isMob()) { | ||||
|             throw new InvalidParameterException("Expected a living DisguiseType while constructing MobDisguise. Received " | ||||
|                     + disguiseType + " instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MiscDisguise") + " instead"); | ||||
|         } | ||||
|         this.isAdult = isAdult; | ||||
|         createDisguise(disguiseType); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user