<commit_before>package com.alecgorge.minecraft.jsonapi.adminium;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.json.simple.JSONObject;

import com.alecgorge.java.http.HttpRequest;
import com.alecgorge.minecraft.jsonapi.JSONAPI;
import com.alecgorge.minecraft.jsonapi.api.APIMethodName;
import com.alecgorge.minecraft.jsonapi.api.JSONAPICallHandler;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStream;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStreamListener;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStreamMessage;
import com.alecgorge.minecraft.jsonapi.streams.ConnectionMessage;

public class PushNotificationDaemon implements JSONAPIStreamListener, JSONAPICallHandler {
	YamlConfiguration deviceConfig = new YamlConfiguration();
	File configFile;
	
	List<String> devices;
	Map<String, Boolean> settings = new HashMap<String, Boolean>();
	
	private final String APNS_PUSH_ENDPOINT = "http://alecgorge.com:25132/push";
	
	private JSONAPI api;
	public boolean init = false;
	
	public boolean doTrace = true;
	
	private Logger mcLog = Logger.getLogger("Minecraft");
	
	private void trace(Object ... args) {		
		if(doTrace) {
			String[] na = new String[args.length];
			for(int i = 0; i < args.length; i++)
				na[i] = args[i] == null ? "NULL_VALUE" : args[i].toString();
			
			mcLog.info("'" + api.join(Arrays.asList(na), "' '") + "'");
		}
	}
	
	private List<String> pushTypes = new ArrayList<String>();
	private List<String> pushTypeDescriptions;
	
	public PushNotificationDaemon(File configFile, JSONAPI api) throws FileNotFoundException, IOException, InvalidConfigurationException {
		this.configFile = configFile;
		this.api = api;
		<commit_msg>fixed #99. fixed #100. both were fixed a few commits ago but i forgot to log that<commit_after>package com.alecgorge.minecraft.jsonapi.adminium;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.json.simple.JSONObject;

import com.alecgorge.java.http.HttpRequest;
import com.alecgorge.minecraft.jsonapi.JSONAPI;
import com.alecgorge.minecraft.jsonapi.api.APIMethodName;
import com.alecgorge.minecraft.jsonapi.api.JSONAPICallHandler;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStream;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStreamListener;
import com.alecgorge.minecraft.jsonapi.api.JSONAPIStreamMessage;
import com.alecgorge.minecraft.jsonapi.streams.ConnectionMessage;

public class PushNotificationDaemon implements JSONAPIStreamListener, JSONAPICallHandler {
	YamlConfiguration deviceConfig = new YamlConfiguration();
	File configFile;
	
	List<String> devices;
	Map<String, Boolean> settings = new HashMap<String, Boolean>();
	
	private final String APNS_PUSH_ENDPOINT = "http://alecgorge.com:25132/push";
	
	private JSONAPI api;
	public boolean init = false;
	
	public boolean doTrace = false;
	
	private Logger mcLog = Logger.getLogger("Minecraft");
	
	private void trace(Object ... args) {		
		if(doTrace) {
			String[] na = new String[args.length];
			for(int i = 0; i < args.length; i++)
				na[i] = args[i] == null ? "NULL_VALUE" : args[i].toString();
			
			mcLog.info("'" + api.join(Arrays.asList(na), "' '") + "'");
		}
	}
	
	private List<String> pushTypes = new ArrayList<String>();
	private List<String> pushTypeDescriptions;
	
	public PushNotificationDaemon(File configFile, JSONAPI api) throws FileNotFoundException, IOException, InvalidConfigurationException {
		this.configFile = configFile;
		this.api = api;
		
{'fraction_non_alphanumeric': 0.111729356777209, 'fraction_numerical': 0.0037836634765190296, 'mean_word_length': 5.599118942731278, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '3404600', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1393, 'n_words': 290}