mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
refactor: Move to ConfigLib, use lombok (#563)
* refactor: move to configlib, adjust config structure * fix: huskclaims typos * fix: don't generate `server.yml` in local mode * fix: NPE with server name
This commit is contained in:
1 parent
c55631a30d
commit
1723aa44fc
84 files changed
+4334
-4832
No files matched your search
@@ -20,6 +20,7 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.config.Settings;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.SavedPosition;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
@@ -47,12 +48,13 @@ public abstract class MapHook extends Hook {
|
||||
* Populate the map with public homes and warps.
|
||||
*/
|
||||
protected void populateMap() {
|
||||
if (plugin.getSettings().doPublicHomesOnMap()) {
|
||||
final Settings.MapHookSettings settings = plugin.getSettings().getMapHook();
|
||||
if (settings.isShowPublicHomes()) {
|
||||
plugin.getDatabase()
|
||||
.getLocalPublicHomes(plugin)
|
||||
.forEach(this::updateHome);
|
||||
}
|
||||
if (plugin.getSettings().doWarpsOnMap()) {
|
||||
if (settings.isShowWarps()) {
|
||||
plugin.getDatabase()
|
||||
.getLocalWarps(plugin)
|
||||
.forEach(this::updateWarp);
|
||||
@@ -121,14 +123,16 @@ public abstract class MapHook extends Hook {
|
||||
*/
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
protected final boolean isValidPosition(@NotNull SavedPosition position) {
|
||||
if (position instanceof Warp && !plugin.getSettings().doWarpsOnMap()) {
|
||||
final Settings.MapHookSettings settings = plugin.getSettings().getMapHook();
|
||||
if (position instanceof Warp && !settings.isShowWarps()) {
|
||||
return false;
|
||||
}
|
||||
if (position instanceof Home && !plugin.getSettings().doPublicHomesOnMap()) {
|
||||
if (position instanceof Home && !settings.isShowPublicHomes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !plugin.getSettings().doCrossServer() || position.getServer().equals(plugin.getServerName());
|
||||
return !plugin.getSettings().getCrossServer().isEnabled()
|
||||
|| position.getServer().equals(plugin.getServerName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -172,22 +176,20 @@ public abstract class MapHook extends Hook {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static DynmapHook.MarkerInformationPopup warp(@NotNull Warp warp, @NotNull String thumbnail,
|
||||
@NotNull HuskHomes plugin) {
|
||||
protected static DynmapHook.MarkerInformationPopup warp(@NotNull Warp warp, @NotNull String thumbnail) {
|
||||
return MarkerInformationPopup.create(warp.getName())
|
||||
.thumbnail(thumbnail)
|
||||
.field("Description", plugin.getLocales().wrapText(warp.getMeta().getDescription(), 60))
|
||||
.field("Description", warp.getMeta().getDescription())
|
||||
.field("Location", warp.toString())
|
||||
.field("Command", "/warp " + warp.getSafeIdentifier());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static DynmapHook.MarkerInformationPopup publicHome(@NotNull Home home, @NotNull String thumbnail,
|
||||
@NotNull HuskHomes plugin) {
|
||||
protected static DynmapHook.MarkerInformationPopup publicHome(@NotNull Home home, @NotNull String thumbnail) {
|
||||
return MarkerInformationPopup.create(home.getName())
|
||||
.thumbnail(thumbnail)
|
||||
.field("Owner", home.getOwner().getUsername())
|
||||
.field("Description", plugin.getLocales().wrapText(home.getMeta().getDescription(), 60))
|
||||
.field("Description", home.getMeta().getDescription())
|
||||
.field("Location", home.toString())
|
||||
.field("Command", "/phome " + home.getSafeIdentifier());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user