mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-12 01:48:07 +02:00
Ensure they use the right disguise for the disguisetype
This commit is contained in:
parent
8db338f533
commit
3604c83797
@ -1,5 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
|
||||||
@ -42,6 +43,10 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MiscDisguise(DisguiseType disguiseType, int id, int data) {
|
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);
|
createDisguise(disguiseType);
|
||||||
switch (disguiseType) {
|
switch (disguiseType) {
|
||||||
// The only disguises which should use a custom data.
|
// The only disguises which should use a custom data.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
||||||
|
|
||||||
@ -14,6 +16,10 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
|
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;
|
this.isAdult = isAdult;
|
||||||
createDisguise(disguiseType);
|
createDisguise(disguiseType);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user