Don't allow them to set the watcher willy nilly without verifiying it

This commit is contained in:
libraryaddict 2014-05-05 19:59:47 +12:00
parent 19f895667a
commit c9b9710a78

View File

@ -632,6 +632,10 @@ public abstract class Disguise {
}
public void setWatcher(FlagWatcher newWatcher) {
if (!getType().getWatcherClass().isInstance(newWatcher)) {
throw new IllegalArgumentException(newWatcher.getClass().getSimpleName() + " is not a instance of "
+ getType().getWatcherClass().getSimpleName() + " for DisguiseType " + getType().name());
}
watcher = newWatcher;
}
}