Add custom data accessibility to disguise for other plugins to easily manage disguises

This commit is contained in:
libraryaddict 2020-04-07 14:40:38 +12:00
parent 33b5b77207
commit 2c5301eb6c
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 17 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<!-- A good example on why temporary names for project identification shouldn't be used -->
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>10.0.2</version>
<version>10.0.2-SNAPSHOT</version>
<build>
<defaultGoal>exec:java clean install</defaultGoal>

View File

@ -80,11 +80,27 @@ public abstract class Disguise {
* If set, how long before disguise expires
*/
private long disguiseExpires;
@Getter
/**
* For when plugins may want to assign custom data to a disguise, such as who owns it
*/ private final HashMap<String, Object> customData = new HashMap<>();
public Disguise(DisguiseType disguiseType) {
this.disguiseType = disguiseType;
}
public void addCustomData(String key, Object data) {
customData.put(key, data);
}
public boolean hasCustomData(String key) {
return customData.containsKey(key);
}
public Object getCustomData(String key) {
return customData.get(key);
}
@Override
public abstract Disguise clone();