first beta
This commit is contained in:
1 parent
8ecb02ac4b
commit
c07b90b919
10 files changed
+193
-96
No files matched your search
+4
-2
@@ -1,9 +1,11 @@
|
||||
**0.9.0:**
|
||||
|
||||
- Leaving Splegg now returns players to the exact main-SMP location they were at before joining, preserving overworld/nether/end context while still crossing back out of Splegg inventory isolation.
|
||||
|
||||
**0.8.9:**
|
||||
|
||||
- Re-keyed all per-player runtime state (match roster, shovel selections, money tracking, egg-launch flags) from player names to UUIDs so name changes, duplicate names, and offline-player lookups no longer corrupt match state.
|
||||
|
||||
- Moved the static Splegg listener state to thread-safe sets and added a reset on plugin disable, preventing state leaks across reloads.
|
||||
|
||||
- Fixed a NullPointerException in the egg-landing handler that could fire when the ray trace produced no candidate block.
|
||||
|
||||
- Fixed the lobby-entry and match-exit flows that reset `FallDistance` to 1 instead of 0, leaving players with a one-block fall penalty after Splegg transitions.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Splegg-OG BETA
|
||||
# Splegg-OG 0.9.0 BETA
|
||||
|
||||

|
||||
|
||||
@@ -18,6 +18,8 @@ Dependencies: WorldEdit, DiamondBank-OG, Essentials-OG, and MyWorlds.
|
||||
|
||||
`/splegg setlobby my-map` Set a lobby area for the map during the voting/warm-up period.
|
||||
|
||||
`/splegg setlobby` Set the global Splegg queue-lobby fallback used when a map-specific lobby is not configured.
|
||||
|
||||
`//wand` Summon a wand with WorldEdit and then use it to select two points on a one-dimensional plane. The points you select will represent parallel corners of your floor.
|
||||
|
||||
`/splegg addfloor my-map` Add the area you just selected with WorldEdit as a floor. You can add as many as you like.
|
||||
@@ -36,12 +38,18 @@ Dependencies: WorldEdit, DiamondBank-OG, Essentials-OG, and MyWorlds.
|
||||
|
||||
[Original Bukkit Page](https://dev.bukkit.org/projects/splegg-minigame).
|
||||
|
||||
*The current Gradle build target is Purpur 1.19.4 on GraalVM CE 17.*
|
||||
*The current Gradle build target is Purpur 1.19.4 on GraalVM CE 17 / Java 17.*
|
||||
|
||||
**To Build:**
|
||||
|
||||
`./bootstrap.sh`
|
||||
|
||||
`export JAVA_HOME=/path/to/java-17`
|
||||
|
||||
`./gradlew build`
|
||||
|
||||
Gradle must run on Java 17 or newer, and the git submodules under `libs/` must be initialized before the build.
|
||||
|
||||
The resulting .jar file will be in build/libs/
|
||||
|
||||
**Planned Features:**
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Fetch all submodule content.
|
||||
git submodule sync --recursive
|
||||
git submodule update --force --recursive --init
|
||||
+1
-1
@@ -27,7 +27,7 @@ kotlin { jvmToolchain(17) }
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "net.trueog.splegg-og" // Declare bundle identifier.
|
||||
|
||||
version = "0.8.9" // Declare plugin version (will be in .jar).
|
||||
version = "0.9.0" // Declare plugin version (will be in .jar).
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
|
||||
+14
-6
@@ -1,13 +1,21 @@
|
||||
rootProject.name = "Splegg-OG"
|
||||
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
val requiredLibraries = listOf("DiamondBank-OG", "GxUI-OG", "Utilities-OG")
|
||||
val missingLibraries = requiredLibraries.filter { libraryName -> !file("libs/$libraryName/build.gradle.kts").exists() }
|
||||
|
||||
if (missingLibraries.isNotEmpty()) {
|
||||
throw GradleException(
|
||||
"Missing initialized git submodules: ${missingLibraries.joinToString(", ")}. " +
|
||||
"Run ./bootstrap.sh or `git submodule update --init --recursive` before building."
|
||||
)
|
||||
}
|
||||
|
||||
file("libs")
|
||||
.listFiles()
|
||||
?.filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
?.forEach { dir ->
|
||||
include(":libs:${dir.name}")
|
||||
project(":libs:${dir.name}").projectDir = dir
|
||||
?.filter { directory ->
|
||||
directory.isDirectory && !directory.name.startsWith(".") && file("${directory.path}/build.gradle.kts").exists()
|
||||
}
|
||||
?.forEach { directory ->
|
||||
include(":libs:${directory.name}")
|
||||
project(":libs:${directory.name}").projectDir = directory
|
||||
}
|
||||
@@ -85,7 +85,17 @@ public class SpleggCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
if (u.getGame() != null && u.isAlive() && u.getGame().getLobbyCount() > 0) {
|
||||
|
||||
player.teleport(u.getGame().getMap().getLobby());
|
||||
final Location queueLobby = u.getGame().getQueueLobbyLocation();
|
||||
if (queueLobby != null && queueLobby.getWorld() != null) {
|
||||
|
||||
player.teleport(queueLobby);
|
||||
|
||||
} else {
|
||||
|
||||
Utils.spleggOGMessage(player,
|
||||
"&cERROR: This map has no valid Splegg lobby configured right now.");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -203,7 +213,7 @@ public class SpleggCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
SpleggOG.getPlugin().config.setLobby(player.getLocation());
|
||||
|
||||
Utils.spleggOGMessage(player, "&aThe lobby has been set.");
|
||||
Utils.spleggOGMessage(player, "&aThe global Splegg queue lobby has been set.");
|
||||
|
||||
} else {
|
||||
|
||||
@@ -667,6 +677,7 @@ public class SpleggCommand implements CommandExecutor, TabCompleter {
|
||||
sendUsage(player, tag, "create <map>", "Create a new map (disabled until floor + spawn exist).");
|
||||
sendUsage(player, tag, "delete <map>", "Delete a map.");
|
||||
sendUsage(player, tag, "info <map>", "Show map setup status (spawns, floors, lobby).");
|
||||
sendUsage(player, tag, "setlobby", "Set the global Splegg queue lobby fallback.");
|
||||
sendUsage(player, tag, "setspawn <map> [next|#]", "Add or update a spawn point.");
|
||||
sendUsage(player, tag, "setlobby <map>", "Set the lobby teleport point.");
|
||||
sendUsage(player, tag, "addfloor <map>", "Add a WorldEdit selection as a floor.");
|
||||
|
||||
@@ -2,8 +2,6 @@ package main;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -195,6 +193,14 @@ public class SpleggOG extends JavaPlugin {
|
||||
// Enable world-based inventory isolation.
|
||||
myWorlds.setUseWorldInventories(true);
|
||||
|
||||
// Create inventory group for main-network worlds.
|
||||
List<String> mainWorlds = getMainWorlds();
|
||||
if (!mainWorlds.isEmpty()) {
|
||||
|
||||
createInventoryGroup(mainWorlds, "main");
|
||||
|
||||
}
|
||||
|
||||
// Create inventory group for lobby worlds.
|
||||
List<String> lobbyWorlds = getLobbyWorlds();
|
||||
if (!lobbyWorlds.isEmpty()) {
|
||||
@@ -215,45 +221,14 @@ public class SpleggOG extends JavaPlugin {
|
||||
|
||||
private void createInventoryGroup(List<String> worlds, String groupType) {
|
||||
|
||||
try {
|
||||
final WorldInventory inventory = WorldInventory.create(myWorlds, worlds.get(0));
|
||||
for (int i = 1; i < worlds.size(); i++) {
|
||||
|
||||
final Object inventory = createWorldInventory(worlds.get(0));
|
||||
final Method addMethod = inventory.getClass().getMethod("add", String.class);
|
||||
|
||||
for (int i = 1; i < worlds.size(); i++) {
|
||||
|
||||
addMethod.invoke(inventory, worlds.get(i));
|
||||
|
||||
}
|
||||
|
||||
this.getLogger().info("Created MyWorlds inventory group for " + groupType + " worlds: " + worlds);
|
||||
|
||||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException exception) {
|
||||
|
||||
throw new IllegalStateException(
|
||||
"Failed to configure MyWorlds inventory group for " + groupType + " worlds: " + worlds, exception);
|
||||
inventory.add(worlds.get(i));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Object createWorldInventory(String worldName)
|
||||
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
final Method createMethod = WorldInventory.class.getMethod("create", MyWorlds.class, String.class);
|
||||
|
||||
return createMethod.invoke(null, myWorlds, worldName);
|
||||
|
||||
} catch (NoSuchMethodException ignored) {
|
||||
|
||||
final Method createMethod = WorldInventory.class.getMethod("create", String.class);
|
||||
|
||||
return createMethod.invoke(null, worldName);
|
||||
|
||||
}
|
||||
this.getLogger().info("Created MyWorlds inventory group for " + groupType + " worlds: " + worlds);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -215,6 +216,12 @@ public class Game {
|
||||
public void joinGame(UtilPlayer playerWhoIsJoining) {
|
||||
|
||||
final Player player = playerWhoIsJoining.getPlayer();
|
||||
if (splegg.isMainWorld(player.getWorld())) {
|
||||
|
||||
playerWhoIsJoining.setLastMainSmpLocation(player.getLocation());
|
||||
|
||||
}
|
||||
|
||||
if (playerWhoIsJoining.getGame() != null) {
|
||||
|
||||
Utils.spleggOGMessage(player, config.getString("Messages.AlreadyInGame"));
|
||||
@@ -242,16 +249,7 @@ public class Game {
|
||||
Listeners.launchEggs.add(player.getUniqueId());
|
||||
this.players.put(player.getUniqueId(), sp);
|
||||
playerWhoIsJoining.setGame(this.splegg.games.getGame(this.name));
|
||||
|
||||
if (this.map.lobbySet()) {
|
||||
|
||||
player.teleport(this.map.getLobby());
|
||||
|
||||
} else {
|
||||
|
||||
player.teleport(this.splegg.config.getLobby(player));
|
||||
|
||||
}
|
||||
teleportToQueueLobby(player);
|
||||
|
||||
preparePlayerForLobby(player);
|
||||
Listeners.manager.add(player.getUniqueId());
|
||||
@@ -287,16 +285,7 @@ public class Game {
|
||||
|
||||
players.put(player.getUniqueId(), sp);
|
||||
playerWhoIsJoining.setGame(splegg.games.getGame(name));
|
||||
|
||||
if (map.lobbySet()) {
|
||||
|
||||
player.teleport(this.map.getLobby());
|
||||
|
||||
} else {
|
||||
|
||||
player.teleport(splegg.config.getLobby(player));
|
||||
|
||||
}
|
||||
teleportToQueueLobby(player);
|
||||
|
||||
preparePlayerForLobby(player);
|
||||
|
||||
@@ -354,6 +343,52 @@ public class Game {
|
||||
|
||||
}
|
||||
|
||||
public Location getQueueLobbyLocation() {
|
||||
|
||||
if (this.map.lobbySet()) {
|
||||
|
||||
final Location mapLobby = this.map.getLobby();
|
||||
if (mapLobby != null && mapLobby.getWorld() != null) {
|
||||
|
||||
return mapLobby;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final Location globalQueueLobby = this.splegg.config.getLobby(null);
|
||||
if (globalQueueLobby != null && globalQueueLobby.getWorld() != null) {
|
||||
|
||||
return globalQueueLobby;
|
||||
|
||||
}
|
||||
|
||||
if (this.map.getSpawnCount() > 0) {
|
||||
|
||||
final Location firstSpawn = this.map.getSpawn(1);
|
||||
if (firstSpawn != null && firstSpawn.getWorld() != null) {
|
||||
|
||||
return firstSpawn;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private void teleportToQueueLobby(Player player) {
|
||||
|
||||
final Location queueLobby = getQueueLobbyLocation();
|
||||
if (queueLobby != null && queueLobby.getWorld() != null) {
|
||||
|
||||
player.teleport(queueLobby);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLobbyInv(Player player) {
|
||||
|
||||
final int[] slotsDeclaredInConfigFile = new int[42];
|
||||
@@ -455,13 +490,24 @@ public class Game {
|
||||
LobbyScoreboard.detach(player);
|
||||
LobbyScoreboard.refreshGame(game);
|
||||
|
||||
if (u.getGame().getMap().lobbySet()) {
|
||||
final Location returnLocation = u.getLastMainSmpLocation();
|
||||
if (returnLocation != null && returnLocation.getWorld() != null) {
|
||||
|
||||
player.teleport(u.getGame().getMap().getLobby());
|
||||
player.teleport(returnLocation);
|
||||
|
||||
} else {
|
||||
|
||||
player.teleport(this.splegg.config.getLobby(player));
|
||||
final List<String> mainWorlds = this.splegg.getMainWorlds();
|
||||
if (!mainWorlds.isEmpty()) {
|
||||
|
||||
final org.bukkit.World mainWorld = Bukkit.getWorld(mainWorlds.get(0));
|
||||
if (mainWorld != null) {
|
||||
|
||||
player.teleport(mainWorld.getSpawnLocation());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import managers.Game;
|
||||
@@ -11,6 +12,7 @@ public class UtilPlayer {
|
||||
boolean alive;
|
||||
Game game;
|
||||
InvStore store;
|
||||
Location lastMainSmpLocation;
|
||||
|
||||
public UtilPlayer(Player player) {
|
||||
|
||||
@@ -19,6 +21,7 @@ public class UtilPlayer {
|
||||
this.name = player.getName();
|
||||
this.alive = false;
|
||||
this.store = new InvStore(player);
|
||||
this.lastMainSmpLocation = null;
|
||||
|
||||
}
|
||||
|
||||
@@ -64,4 +67,16 @@ public class UtilPlayer {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public Location getLastMainSmpLocation() {
|
||||
|
||||
return this.lastMainSmpLocation != null ? this.lastMainSmpLocation.clone() : null;
|
||||
|
||||
}
|
||||
|
||||
public void setLastMainSmpLocation(Location location) {
|
||||
|
||||
this.lastMainSmpLocation = location != null ? location.clone() : null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,34 +106,63 @@ public class Utils {
|
||||
|
||||
public void setLobby(Location l) {
|
||||
|
||||
int x = l.getBlockX();
|
||||
int y = l.getBlockY();
|
||||
int z = l.getBlockZ();
|
||||
float yaw = l.getYaw();
|
||||
float pitch = l.getPitch();
|
||||
String worldName = l.getWorld().getName();
|
||||
|
||||
this.config.set("Spawns.lobby.world", worldName);
|
||||
this.config.set("Spawns.lobby.x", x);
|
||||
this.config.set("Spawns.lobby.y", y);
|
||||
this.config.set("Spawns.lobby.z", z);
|
||||
this.config.set("Spawns.lobby.pitch", pitch);
|
||||
this.config.set("Spawns.lobby.yaw", yaw);
|
||||
|
||||
saveSpawns();
|
||||
setSpawn("Spawns.lobby", l);
|
||||
|
||||
}
|
||||
|
||||
public Location getLobby(Player player) {
|
||||
|
||||
int x = this.config.getInt("Spawns.lobby.x");
|
||||
int y = this.config.getInt("Spawns.lobby.y");
|
||||
int z = this.config.getInt("Spawns.lobby.z");
|
||||
return getSpawn("Spawns.lobby");
|
||||
|
||||
float yaw = (float) this.config.getInt("Spawns.lobby.yaw");
|
||||
float pitch = (float) this.config.getInt("Spawns.lobby.pitch");
|
||||
}
|
||||
|
||||
World worldName = Bukkit.getWorld(this.config.getString("Spawns.lobby.world"));
|
||||
private void setSpawn(String path, Location location) {
|
||||
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
float yaw = location.getYaw();
|
||||
float pitch = location.getPitch();
|
||||
String worldName = location.getWorld().getName();
|
||||
|
||||
this.config.set(path + ".world", worldName);
|
||||
this.config.set(path + ".x", x);
|
||||
this.config.set(path + ".y", y);
|
||||
this.config.set(path + ".z", z);
|
||||
this.config.set(path + ".pitch", pitch);
|
||||
this.config.set(path + ".yaw", yaw);
|
||||
|
||||
saveSpawns();
|
||||
|
||||
}
|
||||
|
||||
private boolean hasSpawn(String path) {
|
||||
|
||||
return this.config.isString(path + ".world");
|
||||
|
||||
}
|
||||
|
||||
private Location getSpawn(String path) {
|
||||
|
||||
if (!hasSpawn(path)) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
int x = this.config.getInt(path + ".x");
|
||||
int y = this.config.getInt(path + ".y");
|
||||
int z = this.config.getInt(path + ".z");
|
||||
|
||||
float yaw = (float) this.config.getInt(path + ".yaw");
|
||||
float pitch = (float) this.config.getInt(path + ".pitch");
|
||||
|
||||
World worldName = Bukkit.getWorld(this.config.getString(path + ".world"));
|
||||
if (worldName == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
return new Location(worldName, (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, yaw, pitch);
|
||||
|
||||
|
||||
Reference in new issue
Block a user