Refuse /start-game if already active
This commit is contained in:
parent
c0751511a5
commit
bb4b47e84a
1 changed files with 5 additions and 0 deletions
|
@ -11,12 +11,17 @@ import org.bukkit.potion.PotionEffect;
|
|||
import gent.zeus.mc13dtl.MC13DTL;
|
||||
import io.papermc.paper.command.brigadier.BasicCommand;
|
||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class GameStateCommand implements BasicCommand {
|
||||
@Override
|
||||
public void execute(CommandSourceStack stack, String[] args) {
|
||||
World world = Bukkit.getWorld("world");
|
||||
NamespacedKey key = new NamespacedKey(MC13DTL.instance, "game-state");
|
||||
if (!world.getPersistentDataContainer().get(key, PersistentDataType.STRING).equals("lobby")) {
|
||||
stack.getSender().sendMessage(ChatColor.RED + "Game is already active");
|
||||
return;
|
||||
}
|
||||
world.getPersistentDataContainer().set(key, PersistentDataType.STRING, "active");
|
||||
GameStateUtil.loadWorld(world);
|
||||
for (OfflinePlayer i : Bukkit.getOfflinePlayers()) {
|
||||
|
|
Loading…
Reference in a new issue