<commit_before>package org.mcsg.double0negative.supercraftbros.event;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.mcsg.double0negative.supercraftbros.Game;
import org.mcsg.double0negative.supercraftbros.GameManager;
import org.mcsg.double0negative.supercraftbros.Message;
import org.mcsg.double0negative.supercraftbros.SuperCraftBros;

public class SignEvents implements Listener{

    @EventHandler(priority = EventPriority.HIGHEST)
    public void clickHandler(PlayerInteractEvent e){
    	Player p = e.getPlayer();
        if(!(e.getAction()==Action.RIGHT_CLICK_BLOCK || e.getAction()==Action.LEFT_CLICK_BLOCK)) return;        
        Block clickedBlock = e.getClickedBlock(); 
        if(!(clickedBlock.getType()==Material.SIGN || clickedBlock.getType()==Material.SIGN_POST || clickedBlock.getType()==Material.WALL_SIGN)) return;
        Sign s = (Sign) clickedBlock.getState();
        if(ChatColor.stripColor(s.getLine(0)).equalsIgnoreCase("[SCB]")){
        	if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("class")){
            	String cl = ChatColor.stripColor(s.getLine(2));
            	Game g = GameManager.getInstance().getGame(GameManager.getInstance().getPlayerGameId(e.getPlayer()));
            	try{
            		g.setPlayerClass(e.getPlayer(), GameManager.getInstance().classList.get(cl.toLowerCase()).newInstance(e.getPlayer()));
            		g.getPlayerClass(e.getPlayer()).PlayerSpawn();
            	}catch(NullPointerException ex){
            		Message.send(e.getPlayer(), ChatColor.RED + "That class doesn't exist!");
            	}
            }
            else if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("join")){
            	int game = Integer.parseInt(ChatColor.stripColor(s.getLine(2)));
            	p.chat("/scb join " + game);
            }
            else if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("leave")){
            	p.chat("/scb leave");
            }
        }	
	}
    
    @EventHandler
	public void Place(SignChangeEvent e){
		if(ChatColor.stripColor(e.getLine(0)).equalsIgnoreCase("[SCB]")){
			e.setLine(0, ChatColor.GOLD + "[" + ChatColor.YELLOW + "SCB" + ChatColor.GOLD + "]");
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("join")){
				e.setLine(1, ChatColor.GOLD + "Join");
				int gameint = Integer.parseInt(ChatColor.stripColor(e.getLine(2)));
				SuperCraftBros.joinSigns.put(e.getBlock().getLocation(), gameint);
				GameManager.getInstance().getGame(gameint).updateSigns();
			}
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("class")){
				e.setLine(1, ChatColor.GOLD + "Class");
			}
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("leave")){
				e.setLine(1, ChatColor.GOLD + "Leave");
			}
			e.setLine(2, ChatColor.YELLOW + ChatColor.stripColor(e.getLine(2)));
		}
	}
    <commit_msg>Check if player is in-game for class signs<commit_after>package org.mcsg.double0negative.supercraftbros.event;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.mcsg.double0negative.supercraftbros.Game;
import org.mcsg.double0negative.supercraftbros.GameManager;
import org.mcsg.double0negative.supercraftbros.Message;
import org.mcsg.double0negative.supercraftbros.SuperCraftBros;

public class SignEvents implements Listener{

    @EventHandler(priority = EventPriority.HIGHEST)
    public void clickHandler(PlayerInteractEvent e){
    	Player p = e.getPlayer();
        if(!(e.getAction()==Action.RIGHT_CLICK_BLOCK || e.getAction()==Action.LEFT_CLICK_BLOCK)) return;        
        Block clickedBlock = e.getClickedBlock(); 
        if(!(clickedBlock.getType()==Material.SIGN || clickedBlock.getType()==Material.SIGN_POST || clickedBlock.getType()==Material.WALL_SIGN)) return;
        Sign s = (Sign) clickedBlock.getState();
        if(ChatColor.stripColor(s.getLine(0)).equalsIgnoreCase("[SCB]")){
        	if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("class")){
            	String cl = ChatColor.stripColor(s.getLine(2));
            	Game g = GameManager.getInstance().getGame(GameManager.getInstance().getPlayerGameId(e.getPlayer()));
            	int id = GameManager.getInstance().getPlayerGameId(p);
        		if(id != -1){
        			try{
        				g.setPlayerClass(e.getPlayer(), GameManager.getInstance().classList.get(cl.toLowerCase()).newInstance(e.getPlayer()));
        				g.getPlayerClass(e.getPlayer()).PlayerSpawn();
        			}catch(NullPointerException ex){
        				Message.send(e.getPlayer(), ChatColor.RED + "That class doesn't exist!");
        			}
        		}	
            }
            else if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("join")){
            	int game = Integer.parseInt(ChatColor.stripColor(s.getLine(2)));
            	p.chat("/scb join " + game);
            }
            else if(ChatColor.stripColor(s.getLine(1)).equalsIgnoreCase("leave")){
            	p.chat("/scb leave");
            }
        }	
	}
    
    @EventHandler
	public void Place(SignChangeEvent e){
		if(ChatColor.stripColor(e.getLine(0)).equalsIgnoreCase("[SCB]")){
			e.setLine(0, ChatColor.GOLD + "[" + ChatColor.YELLOW + "SCB" + ChatColor.GOLD + "]");
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("join")){
				e.setLine(1, ChatColor.GOLD + "Join");
				int gameint = Integer.parseInt(ChatColor.stripColor(e.getLine(2)));
				SuperCraftBros.joinSigns.put(e.getBlock().getLocation(), gameint);
				GameManager.getInstance().getGame(gameint).updateSigns();
			}
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("class")){
				e.setLine(1, ChatColor.GOLD + "Class");
			}
			if(ChatColor.stripColor(e.getLine(1)).equalsIgnoreCase("leave")){
				e.setLine(1, ChatColor.GOLD + "Leave");
			}
			e.setLine(2, ChatColor.YELLOW + ChatColor.stripColor(e.getLine(2)));
		}
	}
    
{'fraction_non_alphanumeric': 0.1485419198055893, 'fraction_numerical': 0.006834750911300122, 'mean_word_length': 3.785610465116279, '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': '2279229', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2161, 'n_words': 264}