exclude rocket players from intro book + fix randomspawning on first join + rockets ignore spectators

This commit is contained in:
okx-code
2026-06-25 05:14:15 +01:00
parent 0dc9e83382
commit 00eb104313
5 changed files with 21 additions and 5 deletions

View File

@@ -23,8 +23,8 @@ import org.bukkit.persistence.PersistentDataType;
*/
public class JoinListener implements Listener {
private static final NamespacedKey ZORWETH_ROCKET_JOIN = new NamespacedKey("zorweth", "rocket_join");
private static final NamespacedKey ZORWETH_OTT_JOIN = new NamespacedKey("zorweth", "ott_join");
private static final NamespacedKey ZORWETH_ROCKET_JOIN = new NamespacedKey("zorweth", "no_starter_kit");
private static final NamespacedKey ZORWETH_OTT_JOIN = new NamespacedKey("zorweth", "no_ott");
RandomSpawn plugin;

View File

@@ -10,6 +10,7 @@ import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -24,6 +25,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.persistence.PersistentDataType;
/**
* Simple Hack that handles gifting introbooks if enabled. Handles respawns as well
@@ -33,6 +35,8 @@ import org.bukkit.inventory.meta.BookMeta;
*/
public class Introbook extends SimpleHack<IntrobookConfig> implements Listener, CommandExecutor {
private static final NamespacedKey ZORWETH_ROCKET_JOIN = new NamespacedKey("zorweth", "no_starter_kit");
public static final String NAME = "Introbook";
private static long bookGiftCount = 0l;
@@ -128,6 +132,8 @@ public class Introbook extends SimpleHack<IntrobookConfig> implements Listener,
UUID puid = alive.getUniqueId();
if (puid == null) return;
if (alive.getPersistentDataContainer().has(ZORWETH_ROCKET_JOIN, PersistentDataType.BOOLEAN)) return;
if (!alive.hasPlayedBefore() || this.hasBook.contains(puid)) {
this.hasBook.remove(puid);
Inventory inv = alive.getInventory();

View File

@@ -5,6 +5,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BlockState;
import io.papermc.paper.event.player.AsyncPlayerSpawnLocationEvent;
import isaac.bastion.Bastion;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
@@ -13,7 +14,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.logging.Level;
import isaac.bastion.Bastion;
import net.civmc.zorweth.flight.FlightComputer;
import net.civmc.zorweth.transfer.DestinationRocketTransfer;
import net.civmc.zorweth.transfer.RocketBlockPosition;
@@ -77,8 +77,11 @@ public final class DestinationTransferListener implements Listener {
if (rocketBlockPosition == null) {
CompletableFuture<DestinationRocketTransfer> existing = futures.putIfAbsent(transfer.transferId(), success);
if (existing != null) {
success.complete(existing.join());
DestinationRocketTransfer join = existing.join();
plugin.getLogger().log(Level.INFO, "Routing player " + event.getName() + " to existing transfer #" + join.transferId() + ": " + join.destinationOrigin());
success.complete(join);
} else {
plugin.getLogger().log(Level.INFO, "Determining rocket position for player " + event.getName() + " for transfer #" + transfer.transferId() + ": " + transfer.requestedX() + " " + transfer.requestedZ());
Bukkit.getScheduler().runTask(plugin, () -> updateRocketPosition(transfer, success));
}
} else {

View File

@@ -28,6 +28,7 @@ import net.civmc.zorweth.transfer.RocketPassengerTransfer;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -91,6 +92,9 @@ public class LaunchHandler {
if (!seated.getWorld().equals(origin.getWorld())) {
continue;
}
if (seated.getGameMode() == GameMode.SPECTATOR) {
continue;
}
final Location location = seated.getLocation();
final BlockVector3 relative = BlockVector3.at(
location.getBlockX() - origin.getX(),
@@ -218,6 +222,9 @@ public class LaunchHandler {
if (!seated.getWorld().equals(origin.getWorld())) {
continue;
}
if (seated.getGameMode() == GameMode.SPECTATOR) {
continue;
}
final Location location = seated.getLocation();
final BlockVector3 relative = BlockVector3.at(
location.getBlockX() - origin.getX(),