mirror of
https://github.com/darksaid98/EntityBingo.git
synced 2026-12-01 15:58:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fcbf28d88 |
No files matched your search
@@ -9,6 +9,7 @@ import java.nio.file.Files;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages file IO & Deletion for other data classes.
|
* Manages file IO & Deletion for other data classes.
|
||||||
@@ -39,7 +40,7 @@ public class DataManager {
|
|||||||
try {
|
try {
|
||||||
writer = new PrintWriter(file);
|
writer = new PrintWriter(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Bukkit.getLogger().info("Encountered error when creating PrintWriter for " + filePath);
|
EntityBingo.getInstance().getLogger().log(Level.WARNING, "Encountered error when creating PrintWriter for " + filePath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class DataManager {
|
|||||||
*/
|
*/
|
||||||
public static HashMap<String, Object> getData(File file) {
|
public static HashMap<String, Object> getData(File file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
Bukkit.getLogger().info("Attempted to retrieve non-existant file: " + file.getPath());
|
EntityBingo.getInstance().getLogger().log(Level.WARNING, "Attempted to retrieve non-existant file: " + file.getPath());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ public class DataManager {
|
|||||||
try {
|
try {
|
||||||
inputStream = new FileInputStream(file);
|
inputStream = new FileInputStream(file);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Bukkit.getLogger().info("Encountered error when creating FileInputStream for " + file.getPath());
|
EntityBingo.getInstance().getLogger().log(Level.WARNING, "Encountered error when creating FileInputStream for " + file.getPath());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Yaml yaml = new Yaml();
|
Yaml yaml = new Yaml();
|
||||||
@@ -90,7 +91,7 @@ public class DataManager {
|
|||||||
try {
|
try {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Bukkit.getLogger().info(e.getMessage());
|
EntityBingo.getInstance().getLogger().log(Level.SEVERE, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -106,7 +107,7 @@ public class DataManager {
|
|||||||
File file = getFile(filePath);
|
File file = getFile(filePath);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
Bukkit.getLogger().info("Attempted to retrieve non-existant file: " + filePath + ".yml");
|
EntityBingo.getInstance().getLogger().log(Level.WARNING, "Attempted to retrieve non-existant file: " + filePath + ".yml");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ public class DataManager {
|
|||||||
try {
|
try {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Bukkit.getLogger().info("Encountered error when creating file - " + path);
|
EntityBingo.getInstance().getLogger().log(Level.WARNING, "Encountered error when creating file - " + path);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ChatListener implements Listener {
|
|||||||
Bukkit.broadcastMessage(Helper.chatLabel() + "Entity Bingo has begun! Type a number to enter!");
|
Bukkit.broadcastMessage(Helper.chatLabel() + "Entity Bingo has begun! Type a number to enter!");
|
||||||
EntityBingo.getInstance().getLogger().info(Helper.chatLabel() + "Entity Bingo has begun! Type a number to enter!");
|
EntityBingo.getInstance().getLogger().info(Helper.chatLabel() + "Entity Bingo has begun! Type a number to enter!");
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getLogger().info(Helper.chatLabel() + "Event Started too recently, ignoring Bingo attempt!");
|
Bukkit.broadcastMessage(Helper.chatLabel() + "Event Started too recently, ignoring Bingo attempt!");
|
||||||
EntityBingo.getInstance().getLogger().info(Helper.chatLabel() + "Event Started too recently, ignoring Bingo attempt!");
|
EntityBingo.getInstance().getLogger().info(Helper.chatLabel() + "Event Started too recently, ignoring Bingo attempt!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,8 +155,6 @@ public class ChatListener implements Listener {
|
|||||||
EntityBingo.getCurrentEvent().setDone();
|
EntityBingo.getCurrentEvent().setDone();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Bukkit.getLogger().info("Match not found for any part");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +165,6 @@ public class ChatListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onChat(AsyncPlayerChatEvent e) {
|
public void onChat(AsyncPlayerChatEvent e) {
|
||||||
//Entry detection
|
//Entry detection
|
||||||
Bukkit.getLogger().info(Helper.chatLabel() + "comparing: " + "\"" + e.getMessage() + "\"");
|
|
||||||
if (EntityBingo.getCurrentEvent() != null) {
|
if (EntityBingo.getCurrentEvent() != null) {
|
||||||
if(EntityBingo.getCurrentEvent().isDone()) {
|
if(EntityBingo.getCurrentEvent().isDone()) {
|
||||||
return;
|
return;
|
||||||
@@ -175,10 +172,8 @@ public class ChatListener implements Listener {
|
|||||||
String str = e.getMessage();
|
String str = e.getMessage();
|
||||||
//remove all color codes from this message
|
//remove all color codes from this message
|
||||||
str = ChatColor.stripColor(str);
|
str = ChatColor.stripColor(str);
|
||||||
Bukkit.getLogger().info(Helper.chatLabel() + "purges codes for: " + "\"" + str + "\"");
|
|
||||||
//remove all text other than numbers
|
//remove all text other than numbers
|
||||||
str = str.replaceAll("[^0-9.]", "");
|
str = str.replaceAll("[^0-9.]", "");
|
||||||
Bukkit.getLogger().info(Helper.chatLabel() + "numbers only: " + "\"" + str + "\"");
|
|
||||||
if(!str.isEmpty()) {
|
if(!str.isEmpty()) {
|
||||||
int guess;
|
int guess;
|
||||||
//we need to check if the guess exists as an int
|
//we need to check if the guess exists as an int
|
||||||
|
|||||||
Reference in new issue
Block a user