From 2c5301eb6c99de5820e9fafb89c818589caee5cd Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 7 Apr 2020 14:40:38 +1200 Subject: [PATCH] Add custom data accessibility to disguise for other plugins to easily manage disguises --- pom.xml | 2 +- .../disguise/disguisetypes/Disguise.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8ac9a7d3..88cc5699 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ LibsDisguises LibsDisguises - 10.0.2 + 10.0.2-SNAPSHOT exec:java clean install diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index ac117cea..adb0fb10 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -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 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();