fix issues

This commit is contained in:
lax1dude 2024-05-09 22:53:10 -07:00
parent 40167877e3
commit cdce32ca49
5 changed files with 22 additions and 10 deletions

View File

@ -276,7 +276,7 @@ public class EaglerMOTDConfiguration {
}
private static int optInt(JsonElement el, int def) {
if(el != null && !el.isJsonPrimitive()) {
if(el != null && el.isJsonPrimitive()) {
JsonPrimitive prim = el.getAsJsonPrimitive();
return prim.isNumber() ? prim.getAsInt() : def;
}else {
@ -285,7 +285,7 @@ public class EaglerMOTDConfiguration {
}
private static boolean optBoolean(JsonElement el, boolean def) {
if(el != null && !el.isJsonPrimitive()) {
if(el != null && el.isJsonPrimitive()) {
JsonPrimitive prim = el.getAsJsonPrimitive();
return prim.isBoolean() ? prim.getAsBoolean() : def;
}else {
@ -294,7 +294,7 @@ public class EaglerMOTDConfiguration {
}
private static float optFloat(JsonElement el, float def) {
if(el != null && !el.isJsonPrimitive()) {
if(el != null && el.isJsonPrimitive()) {
JsonPrimitive prim = el.getAsJsonPrimitive();
return prim.isNumber() ? prim.getAsFloat() : def;
}else {
@ -303,7 +303,7 @@ public class EaglerMOTDConfiguration {
}
private static String optString(JsonElement el, String def) {
if(el != null && !el.isJsonPrimitive()) {
if(el != null && el.isJsonPrimitive()) {
JsonPrimitive prim = el.getAsJsonPrimitive();
return prim.isString() ? prim.getAsString() : def;
}else {

View File

@ -83,6 +83,7 @@ public class EaglerMOTDConnectionUpdater {
public boolean tick() {
ageTimer++;
if(this.motd.isClosed()) {
System.out.println("dead");
return false;
}
if(ageTimer > conf.close_socket_after) {

View File

@ -92,7 +92,7 @@ public class QueryType {
}else if(dataTextFile != null) {
String txt = QueryCache.getStringFile(dataTextFile);
if(txt == null) {
query.errorResponse("Error: could not load text file '" + dataJSONFile + "' for query '" + type + "'");
query.errorResponse("Error: could not load text file '" + dataTextFile + "' for query '" + type + "'");
return;
}else {
query.stringResponse(type, txt);

View File

@ -8,6 +8,7 @@ import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.command.ConsoleCommandSender;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
@ -41,24 +42,32 @@ public class CommandMOTDReloadBungee extends Command {
@Override
public void info(String msg) {
CommandMOTDReloadBungee.this.plugin.getLogger().info(msg);
arg0.sendMessage(new TextComponent(ChatColor.GREEN + "[EaglerMOTD] " + msg));
if(!(arg0 instanceof ConsoleCommandSender)) {
arg0.sendMessage(new TextComponent(ChatColor.GREEN + "[EaglerMOTD] " + msg));
}
}
@Override
public void warn(String msg) {
CommandMOTDReloadBungee.this.plugin.getLogger().warning(msg);
arg0.sendMessage(new TextComponent(ChatColor.YELLOW + "[EaglerMOTD] " + msg));
if(!(arg0 instanceof ConsoleCommandSender)) {
arg0.sendMessage(new TextComponent(ChatColor.YELLOW + "[EaglerMOTD] " + msg));
}
}
@Override
public void error(String msg) {
CommandMOTDReloadBungee.this.plugin.getLogger().severe(msg);
arg0.sendMessage(new TextComponent(ChatColor.RED + "[EaglerMOTD] " + msg));
if(!(arg0 instanceof ConsoleCommandSender)) {
arg0.sendMessage(new TextComponent(ChatColor.RED + "[EaglerMOTD] " + msg));
}
}
}, plugin.getListenerNames());
plugin.installQueryHandlers();
}catch(Throwable ex) {
arg0.sendMessage(new TextComponent(ChatColor.RED + "[EaglerMOTD] Failed to reload! " + ex.toString()));
if(!(arg0 instanceof ConsoleCommandSender)) {
arg0.sendMessage(new TextComponent(ChatColor.RED + "[EaglerMOTD] Failed to reload! " + ex.toString()));
}
plugin.getLogger().log(Level.SEVERE, "Exception thrown while reloading config!", ex);
}
}

View File

@ -1,5 +1,7 @@
name: EaglerMOTD
main: net.lax1dude.eaglercraft.v1_8.plugin.eaglermotd.bungee.EaglerMOTDPluginBungee
version: 1.0.0
description: Plugin to add an animated MOTDs to your EaglercraftXBungee server
author: lax1dude
description: Plugin to add an animated MOTDs to your EaglercraftXBungee server
depends:
- EaglercraftXBungee