mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 19:45:21 +01:00
StoredEntityData#remove
This commit is contained in:
parent
d36d5d6def
commit
8df48bc378
@ -51,6 +51,15 @@ public interface StoredEntityData {
|
||||
*/
|
||||
@Nullable <T> T get(Class<T> objectClass);
|
||||
|
||||
/**
|
||||
* Removes and returns an object from the storage if present.
|
||||
*
|
||||
* @param objectClass class of the object to remove
|
||||
* @param <T> object type
|
||||
* @return removed object if present
|
||||
*/
|
||||
@Nullable <T> T remove(Class<T> objectClass);
|
||||
|
||||
/**
|
||||
* Stores an object based on its class.
|
||||
*
|
||||
|
@ -42,6 +42,11 @@ public final class StoredEntityImpl implements StoredEntityData {
|
||||
return (T) storedObjects.get(objectClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> @Nullable T remove(Class<T> objectClass) {
|
||||
return (T) storedObjects.remove(objectClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(Class<?> objectClass) {
|
||||
return storedObjects.containsKey(objectClass);
|
||||
|
Loading…
Reference in New Issue
Block a user