mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Add plot metadata
This commit is contained in:
parent
d46475261a
commit
0d9b6fa6ff
@ -25,6 +25,7 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -109,6 +110,11 @@ public class Plot {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public int temp;
|
public int temp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session only plot metadata (session is until the server stops)
|
||||||
|
*/
|
||||||
|
private ConcurrentHashMap<String, Object> meta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a new plot
|
* Constructor for a new plot
|
||||||
*
|
*
|
||||||
@ -166,6 +172,42 @@ public class Plot {
|
|||||||
this.temp = temp;
|
this.temp = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set some session only metadata for the plot
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
public void setMeta(String key, Object value) {
|
||||||
|
if (this.meta == null) {
|
||||||
|
this.meta = new ConcurrentHashMap<String, Object>();
|
||||||
|
}
|
||||||
|
this.meta.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the metadata for a key
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object getMeta(String key) {
|
||||||
|
if (this.meta != null) {
|
||||||
|
return this.meta.get(key);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the metadata for a key<br>
|
||||||
|
* - metadata is session only
|
||||||
|
* - deleting other plugin's metadata may cause issues
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
public void deleteMeta(String key) {
|
||||||
|
if (this.meta != null) {
|
||||||
|
this.meta.remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the players currently inside this plot
|
* Get the players currently inside this plot
|
||||||
* @return
|
* @return
|
||||||
|
Loading…
Reference in New Issue
Block a user