mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
New lists via PagineDown, update edithome locales
This commit is contained in:
1 parent
3651e1ea90
commit
423f18b2c3
20 files changed
+170
-413
No files matched your search
@@ -1,16 +1,9 @@
|
||||
package net.william278.huskhomes.position;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import net.william278.huskhomes.config.Locales;
|
||||
import net.william278.huskhomes.player.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Represents a home set by a {@link User}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* Represents a persistently-saved {@link Position}
|
||||
*/
|
||||
public abstract class SavedPosition extends Position {
|
||||
public abstract class SavedPosition extends Position implements Comparable<SavedPosition> {
|
||||
|
||||
/**
|
||||
* Metadata about this position (name, description)
|
||||
@@ -42,4 +42,9 @@ public abstract class SavedPosition extends Position {
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
// Compare based on names for alphabetical sorting
|
||||
@Override
|
||||
public int compareTo(@NotNull SavedPosition o) {
|
||||
return this.meta.name.compareTo(o.meta.name);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class SavedPositionManager {
|
||||
final Home home = new Home(position, homeMeta, homeOwner);
|
||||
cache.homes.putIfAbsent(home.owner.uuid, new ArrayList<>());
|
||||
cache.homes.get(home.owner.uuid).add(home.meta.name);
|
||||
cache.positionLists.clear();
|
||||
cache.privateHomeLists.remove(home.owner.uuid);
|
||||
return database.setHome(home).thenApply(value ->
|
||||
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(home))).join();
|
||||
}
|
||||
@@ -72,7 +72,8 @@ public class SavedPositionManager {
|
||||
homeNames.remove(home.meta.name);
|
||||
return homeNames;
|
||||
});
|
||||
cache.positionLists.clear();
|
||||
cache.privateHomeLists.remove(home.owner.uuid);
|
||||
cache.publicHomeLists.clear();
|
||||
return true;
|
||||
}).join();
|
||||
}
|
||||
@@ -118,7 +119,8 @@ public class SavedPositionManager {
|
||||
cache.homes.get(home.owner.uuid).remove(existingHomeName);
|
||||
cache.homes.get(home.owner.uuid).add(newHomeMeta.name);
|
||||
}
|
||||
cache.positionLists.clear();
|
||||
cache.privateHomeLists.remove(home.owner.uuid);
|
||||
cache.publicHomeLists.clear();
|
||||
return database.setHome(home).thenApply(value ->
|
||||
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(home))).join();
|
||||
});
|
||||
@@ -197,7 +199,8 @@ public class SavedPositionManager {
|
||||
} else if (cache.publicHomes.containsKey(home.owner.username)) {
|
||||
cache.publicHomes.get(home.owner.username).remove(home.meta.name);
|
||||
}
|
||||
cache.positionLists.clear();
|
||||
cache.privateHomeLists.remove(home.owner.uuid);
|
||||
cache.publicHomeLists.clear();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -216,7 +219,7 @@ public class SavedPositionManager {
|
||||
if (optionalWarp.isEmpty()) {
|
||||
final Warp warp = new Warp(position, warpMeta);
|
||||
cache.warps.add(warp.meta.name);
|
||||
cache.positionLists.clear();
|
||||
cache.warpLists.clear();
|
||||
return database.setWarp(warp).thenApply(ignored ->
|
||||
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(warp))).join();
|
||||
}
|
||||
@@ -237,7 +240,7 @@ public class SavedPositionManager {
|
||||
final Warp warp = optionalWarp.get();
|
||||
return database.deleteWarp(warp.uuid).thenApply(ignored -> {
|
||||
cache.warps.remove(warp.meta.name);
|
||||
cache.positionLists.clear();
|
||||
cache.warpLists.clear();
|
||||
return true;
|
||||
}).join();
|
||||
}
|
||||
@@ -282,7 +285,7 @@ public class SavedPositionManager {
|
||||
cache.warps.remove(existingWarpName);
|
||||
cache.warps.add(newWarpMeta.name);
|
||||
}
|
||||
cache.positionLists.clear();
|
||||
cache.warpLists.clear();
|
||||
return database.setWarp(warp).thenApply(value ->
|
||||
new SaveResult(SaveResult.ResultType.SUCCESS, Optional.of(warp))).join();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user