<commit_before>package game;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;

import alignments.Alignment;
import net.dv8tion.jda.core.entities.User;
import roles.Role;

public class Player {
	
	private User user;
	private Role role;
	private String identifier;
	private List<String> results = new LinkedList<String>();
	private Alignment alignment;
	private boolean isAlive = true;
	private boolean hooked = false;
	
	public Player(User u){
		user = u;
		identifier = u.getName()+"#"+u.getDiscriminator();
	}
	
	public void setRole(Role r){
		role = r;
	}
	
	public Role getRole(){
		return role;
	}
	
	public User getUser(){
		return user;
	}
	
	public String getNightMessage(Game g){
		return role.roleMessageForThisNight(g);
	}
	
	public void setAlignment(Alignment a){
		alignment = a;
	}
	
	public String getIdentifier(){
		return identifier;
	}
	
	public boolean isAlive(){
		return isAlive;
	}
	
	public boolean isHooked(){
		return hooked;
	}
	
	public Alignment getAlignment(){
		return alignment;
	}
	
	public boolean isCop(){
		return alignment.equals(Alignment.getAlignment("cops"));
	}
	
	public CompletableFuture<Boolean> privateMessage(String s){
		if(s.equals("")){
			return CompletableFuture.completedFuture(true);
		}
		CompletableFuture<Boolean> future = new CompletableFuture<Boolean>();
		user.openPrivateChannel().queue(
			channel -> channel.sendMessage(s).queue(
				x -> future.complete(true),
				t -> future.completeExceptionally(new CompletionException(new Exception("Could not send message.")))),
			x -> future.completeExceptionally(new CompletionException(new Exception("Could not get private channel."))));
		return future;
	}
	
	public void appendResult(String s){
		results.add(s);
	}
	
	public void resetResults(){
		results.clear();
	}
	
	public String getResultsMessage(){
		return String.join("\n", results);
	}
	
	public void kill(){
		isAlive = false;
	}
	
	public void hook(){
		hooked = true;
	}
	
	public void nightReset(){
		hooked = false;
		role.resetTarget();
	}
}<commit_msg>Fix issue where results were sent more than once.<commit_after>package game;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;

import alignments.Alignment;
import net.dv8tion.jda.core.entities.User;
import roles.Role;

public class Player {
	
	private User user;
	private Role role;
	private String identifier;
	private List<String> results = new LinkedList<String>();
	private Alignment alignment;
	private boolean isAlive = true;
	private boolean hooked = false;
	
	public Player(User u){
		user = u;
		identifier = u.getName()+"#"+u.getDiscriminator();
	}
	
	public void setRole(Role r){
		role = r;
	}
	
	public Role getRole(){
		return role;
	}
	
	public User getUser(){
		return user;
	}
	
	public String getNightMessage(Game g){
		return role.roleMessageForThisNight(g);
	}
	
	public void setAlignment(Alignment a){
		alignment = a;
	}
	
	public String getIdentifier(){
		return identifier;
	}
	
	public boolean isAlive(){
		return isAlive;
	}
	
	public boolean isHooked(){
		return hooked;
	}
	
	public Alignment getAlignment(){
		return alignment;
	}
	
	public boolean isCop(){
		return alignment.equals(Alignment.getAlignment("cops"));
	}
	
	public CompletableFuture<Boolean> privateMessage(String s){
		if(s.equals("")){
			return CompletableFuture.completedFuture(true);
		}
		CompletableFuture<Boolean> future = new CompletableFuture<Boolean>();
		user.openPrivateChannel().queue(
			channel -> channel.sendMessage(s).queue(
				x -> future.complete(true),
				t -> future.completeExceptionally(new CompletionException(new Exception("Could not send message.")))),
			x -> future.completeExceptionally(new CompletionException(new Exception("Could not get private channel."))));
		return future;
	}
	
	public void appendResult(String s){
		results.add(s);
	}
	
	public void resetResults(){
		results.clear();
	}
	
	public String getResultsMessage(){
		return String.join("\n", results);
	}
	
	public void kill(){
		isAlive = false;
	}
	
	public void hook(){
		hooked = true;
	}
	
	public void nightReset(){
		hooked = false;
		role.resetTarget();
		resetResults();
	}
}
{'fraction_non_alphanumeric': 0.11802973977695168, 'fraction_numerical': 0.00046468401486988845, 'mean_word_length': 4.387984981226533, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '6052213', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1288, 'n_words': 345}