mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
API: Add methods for setting and editing meta tags
This commit is contained in:
1 parent
f3d6f86568
commit
4ebbba730c
3 files changed
+111
No files matched your search
@@ -11,6 +11,7 @@ import net.william278.huskhomes.util.ValidationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
@@ -175,4 +176,19 @@ public class WarpsManager {
|
||||
this.cacheWarp(warp, true);
|
||||
}
|
||||
|
||||
public void setWarpMetaTags(@NotNull String name, @NotNull Map<String, String> tags) throws ValidationException {
|
||||
final Optional<Warp> optionalWarp = plugin.getDatabase().getWarp(name);
|
||||
if (optionalWarp.isEmpty()) {
|
||||
throw new ValidationException(ValidationException.Type.NOT_FOUND);
|
||||
}
|
||||
|
||||
this.setWarpMetaTags(optionalWarp.get(), tags);
|
||||
}
|
||||
|
||||
public void setWarpMetaTags(@NotNull Warp warp, @NotNull Map<String, String> tags) {
|
||||
warp.getMeta().setTags(tags);
|
||||
plugin.getDatabase().saveWarp(warp);
|
||||
this.cacheWarp(warp, true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user