<commit_before>package com.crossge.necessities.Commands;

import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.UUID;

public class CmdGamemode extends Cmd {
    public boolean commandUse(CommandSender sender, String[] args) {
        if (args.length == 0) {
            sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "Must enter a gamemode.");
            return true;
        }
        if (sender instanceof Player && args.length == 1) {
            GameMode gamemode = getGM(args[0]);
            ((Player) sender).setGameMode(gamemode);
            sender.sendMessage(var.getMessages() + "Set gamemode to " + var.getObj() + gamemode.toString().toLowerCase());
            return true;
        }
        UUID uuid = get.getID(args[0]);
        if (uuid == null) {
            sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "Invalid player.");
            return true;
        }
        Player p = sender.getServer().getPlayer(uuid);
        GameMode gamemode = getGM(args[1]);
        p.setGameMode(gamemode);
        sender.sendMessage(var.getMessages() + "Set gamemode for " + var.getObj() + p.getDisplayName() + var.getMessages() + " to " + var.getObj() +
                gamemode.toString().toLowerCase());
        return true;
    }

    private GameMode getGM(String message) {
        if (message.equalsIgnoreCase("adventure") || message.equalsIgnoreCase("2") || message.equalsIgnoreCase("adv"))
            return GameMode.ADVENTURE;
        if (message.equalsIgnoreCase("creative") || message.equalsIgnoreCase("1") || message.equalsIgnoreCase("c"))
            return GameMode.CREATIVE;
        if (message.equalsIgnoreCase("spectator") || message.equalsIgnoreCase("3"))
            return GameMode.CREATIVE;
        return GameMode.SURVIVAL;
    }<commit_msg>Fix spectator gamemode<commit_after>package com.crossge.necessities.Commands;

import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.UUID;

public class CmdGamemode extends Cmd {
    public boolean commandUse(CommandSender sender, String[] args) {
        if (args.length == 0) {
            sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "Must enter a gamemode.");
            return true;
        }
        if (sender instanceof Player && args.length == 1) {
            GameMode gamemode = getGM(args[0]);
            ((Player) sender).setGameMode(gamemode);
            sender.sendMessage(var.getMessages() + "Set gamemode to " + var.getObj() + gamemode.toString().toLowerCase());
            return true;
        }
        UUID uuid = get.getID(args[0]);
        if (uuid == null) {
            sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "Invalid player.");
            return true;
        }
        Player p = sender.getServer().getPlayer(uuid);
        GameMode gamemode = getGM(args[1]);
        p.setGameMode(gamemode);
        sender.sendMessage(var.getMessages() + "Set gamemode for " + var.getObj() + p.getDisplayName() + var.getMessages() + " to " + var.getObj() +
                gamemode.toString().toLowerCase());
        return true;
    }

    private GameMode getGM(String message) {
        if (message.equalsIgnoreCase("adventure") || message.equalsIgnoreCase("2") || message.equalsIgnoreCase("adv"))
            return GameMode.ADVENTURE;
        if (message.equalsIgnoreCase("creative") || message.equalsIgnoreCase("1") || message.equalsIgnoreCase("c"))
            return GameMode.CREATIVE;
        if (message.equalsIgnoreCase("spectator") || message.equalsIgnoreCase("3"))
            return GameMode.SPECTATOR;
        return GameMode.SURVIVAL;
    }
{'fraction_non_alphanumeric': 0.13721302722904433, 'fraction_numerical': 0.004271222637479978, 'mean_word_length': 2.728358208955224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6021726', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1114, 'n_words': 216}