mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
Fix potential issue with wrong disguise parameter
This commit is contained in:
parent
f1653c0bb0
commit
e9a968fe7b
@ -563,7 +563,8 @@ public abstract class Disguise {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public Disguise setWatcher(FlagWatcher newWatcher) {
|
public Disguise setWatcher(FlagWatcher newWatcher) {
|
||||||
if (!getType().getWatcherClass().isInstance(newWatcher)) {
|
if (!getType().getWatcherClass().isInstance(newWatcher)) {
|
||||||
throw new IllegalArgumentException(newWatcher.getClass().getSimpleName() + " is not a instance of " +
|
throw new IllegalArgumentException(
|
||||||
|
(newWatcher == null ? "null" : newWatcher.getClass().getSimpleName()) + " is not a instance of " +
|
||||||
getType().getWatcherClass().getSimpleName() + " for DisguiseType " + getType().name());
|
getType().getWatcherClass().getSimpleName() + " for DisguiseType " + getType().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ public class FlagWatcher {
|
|||||||
FlagWatcher cloned;
|
FlagWatcher cloned;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise());
|
cloned = getClass().getConstructor(Disguise.class).newInstance(owningDisguise);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
cloned = new FlagWatcher(getDisguise());
|
cloned = new FlagWatcher(owningDisguise);
|
||||||
}
|
}
|
||||||
|
|
||||||
cloned.entityValues = (HashMap<Integer, Object>) entityValues.clone();
|
cloned.entityValues = (HashMap<Integer, Object>) entityValues.clone();
|
||||||
|
Loading…
Reference in New Issue
Block a user