mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
exclude rocket players from intro book + fix randomspawning on first join + rockets ignore spectators
This commit is contained in:
Submodule PrivateConfig updated: c76697cec3...9251218c82
@@ -23,8 +23,8 @@ import org.bukkit.persistence.PersistentDataType;
|
|||||||
*/
|
*/
|
||||||
public class JoinListener implements Listener {
|
public class JoinListener implements Listener {
|
||||||
|
|
||||||
private static final NamespacedKey ZORWETH_ROCKET_JOIN = new NamespacedKey("zorweth", "rocket_join");
|
private static final NamespacedKey ZORWETH_ROCKET_JOIN = new NamespacedKey("zorweth", "no_starter_kit");
|
||||||
private static final NamespacedKey ZORWETH_OTT_JOIN = new NamespacedKey("zorweth", "ott_join");
|
private static final NamespacedKey ZORWETH_OTT_JOIN = new NamespacedKey("zorweth", "no_ott");
|
||||||
|
|
||||||
RandomSpawn plugin;
|
RandomSpawn plugin;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.UUID;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -24,6 +25,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple Hack that handles gifting introbooks if enabled. Handles respawns as well
|
* 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 {
|
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";
|
public static final String NAME = "Introbook";
|
||||||
private static long bookGiftCount = 0l;
|
private static long bookGiftCount = 0l;
|
||||||
|
|
||||||
@@ -128,6 +132,8 @@ public class Introbook extends SimpleHack<IntrobookConfig> implements Listener,
|
|||||||
UUID puid = alive.getUniqueId();
|
UUID puid = alive.getUniqueId();
|
||||||
if (puid == null) return;
|
if (puid == null) return;
|
||||||
|
|
||||||
|
if (alive.getPersistentDataContainer().has(ZORWETH_ROCKET_JOIN, PersistentDataType.BOOLEAN)) return;
|
||||||
|
|
||||||
if (!alive.hasPlayedBefore() || this.hasBook.contains(puid)) {
|
if (!alive.hasPlayedBefore() || this.hasBook.contains(puid)) {
|
||||||
this.hasBook.remove(puid);
|
this.hasBook.remove(puid);
|
||||||
Inventory inv = alive.getInventory();
|
Inventory inv = alive.getInventory();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import io.papermc.paper.event.player.AsyncPlayerSpawnLocationEvent;
|
import io.papermc.paper.event.player.AsyncPlayerSpawnLocationEvent;
|
||||||
|
import isaac.bastion.Bastion;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -13,7 +14,6 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import isaac.bastion.Bastion;
|
|
||||||
import net.civmc.zorweth.flight.FlightComputer;
|
import net.civmc.zorweth.flight.FlightComputer;
|
||||||
import net.civmc.zorweth.transfer.DestinationRocketTransfer;
|
import net.civmc.zorweth.transfer.DestinationRocketTransfer;
|
||||||
import net.civmc.zorweth.transfer.RocketBlockPosition;
|
import net.civmc.zorweth.transfer.RocketBlockPosition;
|
||||||
@@ -77,8 +77,11 @@ public final class DestinationTransferListener implements Listener {
|
|||||||
if (rocketBlockPosition == null) {
|
if (rocketBlockPosition == null) {
|
||||||
CompletableFuture<DestinationRocketTransfer> existing = futures.putIfAbsent(transfer.transferId(), success);
|
CompletableFuture<DestinationRocketTransfer> existing = futures.putIfAbsent(transfer.transferId(), success);
|
||||||
if (existing != null) {
|
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 {
|
} 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));
|
Bukkit.getScheduler().runTask(plugin, () -> updateRocketPosition(transfer, success));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import net.civmc.zorweth.transfer.RocketPassengerTransfer;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -91,6 +92,9 @@ public class LaunchHandler {
|
|||||||
if (!seated.getWorld().equals(origin.getWorld())) {
|
if (!seated.getWorld().equals(origin.getWorld())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (seated.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final Location location = seated.getLocation();
|
final Location location = seated.getLocation();
|
||||||
final BlockVector3 relative = BlockVector3.at(
|
final BlockVector3 relative = BlockVector3.at(
|
||||||
location.getBlockX() - origin.getX(),
|
location.getBlockX() - origin.getX(),
|
||||||
@@ -218,6 +222,9 @@ public class LaunchHandler {
|
|||||||
if (!seated.getWorld().equals(origin.getWorld())) {
|
if (!seated.getWorld().equals(origin.getWorld())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (seated.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final Location location = seated.getLocation();
|
final Location location = seated.getLocation();
|
||||||
final BlockVector3 relative = BlockVector3.at(
|
final BlockVector3 relative = BlockVector3.at(
|
||||||
location.getBlockX() - origin.getX(),
|
location.getBlockX() - origin.getX(),
|
||||||
|
|||||||
Reference in New Issue
Block a user