Add custom data accessibility to disguise for other plugins to easily manage disguises
This commit is contained in:
parent
33b5b77207
commit
2c5301eb6c
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<!-- A good example on why temporary names for project identification shouldn't be used -->
|
<!-- A good example on why temporary names for project identification shouldn't be used -->
|
||||||
<groupId>LibsDisguises</groupId>
|
<groupId>LibsDisguises</groupId>
|
||||||
<artifactId>LibsDisguises</artifactId>
|
<artifactId>LibsDisguises</artifactId>
|
||||||
<version>10.0.2</version>
|
<version>10.0.2-SNAPSHOT</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>exec:java clean install</defaultGoal>
|
<defaultGoal>exec:java clean install</defaultGoal>
|
||||||
|
@ -80,11 +80,27 @@ public abstract class Disguise {
|
|||||||
* If set, how long before disguise expires
|
* If set, how long before disguise expires
|
||||||
*/
|
*/
|
||||||
private long disguiseExpires;
|
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) {
|
public Disguise(DisguiseType disguiseType) {
|
||||||
this.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
|
@Override
|
||||||
public abstract Disguise clone();
|
public abstract Disguise clone();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user