mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
Networking rework, further refactoring
This commit is contained in:
1 parent
1cebdac9b8
commit
4c90e5498c
88 files changed
+1116
-1364
No files matched your search
@@ -6,7 +6,7 @@ import de.bluecolored.bluemap.api.BlueMapWorld;
|
||||
import de.bluecolored.bluemap.api.markers.MarkerSet;
|
||||
import de.bluecolored.bluemap.api.markers.POIMarker;
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.User;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.position.World;
|
||||
@@ -74,9 +74,9 @@ public class BlueMapHook extends MapHook {
|
||||
blueMapAPI -> getBlueMapWorld(blueMapAPI, home.getWorld())).ifPresent(blueMapWorld -> blueMapWorld.getMaps()
|
||||
.forEach(blueMapMap -> blueMapMap.getMarkerSets()
|
||||
.computeIfPresent(blueMapWorld.getId() + ":" + PUBLIC_HOMES_MARKER_SET_ID, (s, markerSet) -> {
|
||||
markerSet.getMarkers().put(home.getOwner().uuid + ":" + home.getUuid(),
|
||||
markerSet.getMarkers().put(home.getOwner().getUuid() + ":" + home.getUuid(),
|
||||
POIMarker.toBuilder()
|
||||
.label("/phome" + home.getOwner().username + "." + home.getMeta().getName())
|
||||
.label("/phome" + home.getOwner().getUsername() + "." + home.getMeta().getName())
|
||||
.position((int) home.getX(), (int) home.getY(), (int) home.getZ())
|
||||
.icon(publicHomeMarkerIconPath, Vector2i.from(25, 25))
|
||||
.maxDistance(5000)
|
||||
@@ -92,7 +92,7 @@ public class BlueMapHook extends MapHook {
|
||||
BlueMapAPI.getInstance().flatMap(blueMapAPI -> getBlueMapWorld(blueMapAPI, home.getWorld()))
|
||||
.ifPresent(blueMapWorld -> blueMapWorld.getMaps().forEach(blueMapMap -> blueMapMap.getMarkerSets()
|
||||
.computeIfPresent(blueMapWorld.getId() + ":" + PUBLIC_HOMES_MARKER_SET_ID, (s, markerSet) -> {
|
||||
markerSet.getMarkers().remove(home.getOwner().uuid + ":" + home.getUuid());
|
||||
markerSet.getMarkers().remove(home.getOwner().getUuid() + ":" + home.getUuid());
|
||||
return markerSet;
|
||||
})));
|
||||
return CompletableFuture.completedFuture(null);
|
||||
@@ -104,7 +104,7 @@ public class BlueMapHook extends MapHook {
|
||||
.forEach(blueMapWorld -> blueMapWorld.getMaps()
|
||||
.forEach(blueMapMap -> blueMapMap.getMarkerSets()
|
||||
.computeIfPresent(blueMapWorld.getId() + ":" + PUBLIC_HOMES_MARKER_SET_ID, (s, markerSet) -> {
|
||||
markerSet.getMarkers().keySet().removeIf(key -> key.startsWith(user.uuid.toString()));
|
||||
markerSet.getMarkers().keySet().removeIf(key -> key.startsWith(user.getUuid().toString()));
|
||||
return markerSet;
|
||||
}))));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.OnlineUser;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -37,4 +37,26 @@ public abstract class EconomyHook extends PluginHook {
|
||||
*/
|
||||
public abstract String formatCurrency(final double amount);
|
||||
|
||||
/**
|
||||
* Identifies actions that incur an economic cost if economy is enabled
|
||||
*/
|
||||
public enum EconomyAction {
|
||||
ADDITIONAL_HOME_SLOT(100.00, "economy_action_additional_home_slot"),
|
||||
MAKE_HOME_PUBLIC(50.00, "economy_action_make_home_public"),
|
||||
RANDOM_TELEPORT(25.00, "economy_action_random_teleport"),
|
||||
BACK_COMMAND(0.00, "economy_action_back_command");
|
||||
|
||||
private final double defaultCost;
|
||||
@NotNull
|
||||
public final String confirmationLocaleId;
|
||||
|
||||
EconomyAction(final double defaultCost, @NotNull String confirmationLocaleId) {
|
||||
this.defaultCost = defaultCost;
|
||||
this.confirmationLocaleId = confirmationLocaleId;
|
||||
}
|
||||
|
||||
public double getDefaultCost() {
|
||||
return defaultCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.User;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.SavedPosition;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
@@ -113,4 +113,18 @@ public abstract class MapHook extends PluginHook {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies types of supported Map plugins
|
||||
*/
|
||||
public enum MappingPlugin {
|
||||
DYNMAP("Dynmap"),
|
||||
BLUEMAP("BlueMap");
|
||||
|
||||
@NotNull
|
||||
public final String displayName;
|
||||
|
||||
MappingPlugin(@NotNull String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.djrapitops.plan.extension.annotation.*;
|
||||
import com.djrapitops.plan.extension.icon.Color;
|
||||
import com.djrapitops.plan.extension.icon.Family;
|
||||
import net.william278.huskhomes.database.Database;
|
||||
import net.william278.huskhomes.player.UserData;
|
||||
import net.william278.huskhomes.user.UserData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
Reference in new issue
Block a user