mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
Add more unit tests
This commit is contained in:
8 files changed
+368
-18
No files matched your search
@@ -35,10 +35,12 @@ public class Manager {
|
||||
|
||||
// Update caches on all servers
|
||||
protected void propagateCacheUpdate() {
|
||||
plugin.getOnlineUsers().stream().findAny().ifPresent(user -> Message.builder()
|
||||
.type(Message.Type.UPDATE_CACHES)
|
||||
.scope(Message.Scope.SERVER)
|
||||
.target(Message.TARGET_ALL)
|
||||
.build().send(plugin.getMessenger(), user));
|
||||
if (plugin.getSettings().isCrossServer()) {
|
||||
plugin.getOnlineUsers().stream().findAny().ifPresent(user -> Message.builder()
|
||||
.type(Message.Type.UPDATE_CACHES)
|
||||
.scope(Message.Scope.SERVER)
|
||||
.target(Message.TARGET_ALL)
|
||||
.build().send(plugin.getMessenger(), user));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,16 +137,16 @@ public class WarpsManager {
|
||||
this.cacheWarp(warp, true);
|
||||
}
|
||||
|
||||
public void renameWarp(@NotNull String name, @NotNull String newName) throws ValidationException {
|
||||
public void setWarpName(@NotNull String name, @NotNull String newName) throws ValidationException {
|
||||
final Optional<Warp> optionalWarp = plugin.getDatabase().getWarp(name);
|
||||
if (optionalWarp.isEmpty()) {
|
||||
throw new ValidationException(ValidationException.Type.NOT_FOUND);
|
||||
}
|
||||
|
||||
this.renameWarp(optionalWarp.get(), newName);
|
||||
this.setWarpName(optionalWarp.get(), newName);
|
||||
}
|
||||
|
||||
public void renameWarp(@NotNull Warp warp, @NotNull String newName) throws ValidationException {
|
||||
public void setWarpName(@NotNull Warp warp, @NotNull String newName) throws ValidationException {
|
||||
if (!plugin.getValidator().isValidName(newName)) {
|
||||
throw new ValidationException(ValidationException.Type.NAME_INVALID);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user