Dont call the plugin every time tl() is used

This commit is contained in:
Telesphoreo 2022-01-27 15:38:44 -06:00
parent c2d0746d49
commit 9043005d62
3 changed files with 6 additions and 6 deletions

View File

@ -2,5 +2,5 @@ package dev.plex;
public class PlexBase public class PlexBase
{ {
protected static Plex plugin = Plex.get(); protected final static Plex plugin = Plex.get();
} }

View File

@ -1,12 +1,12 @@
package dev.plex.util; package dev.plex.util;
import dev.plex.Plex; import dev.plex.PlexBase;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class PlexLog public class PlexLog extends PlexBase
{ {
private static final boolean debugEnabled = Plex.get().config.getBoolean("debug"); private static final boolean debugEnabled = plugin.config.getBoolean("debug");
public static void log(String message) public static void log(String message)
{ {

View File

@ -1,6 +1,7 @@
package dev.plex.util; package dev.plex.util;
import dev.plex.Plex; import dev.plex.Plex;
import dev.plex.PlexBase;
import dev.plex.config.Config; import dev.plex.config.Config;
import dev.plex.storage.StorageType; import dev.plex.storage.StorageType;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -33,7 +34,7 @@ import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException; import org.json.simple.parser.ParseException;
public class PlexUtils public class PlexUtils extends PlexBase
{ {
public static Map<String, ChatColor> CHAT_COLOR_NAMES; public static Map<String, ChatColor> CHAT_COLOR_NAMES;
public static List<ChatColor> CHAT_COLOR_POOL; public static List<ChatColor> CHAT_COLOR_POOL;
@ -114,7 +115,6 @@ public class PlexUtils
// if you think the name of this method is dumb feel free to change it i just thought it'd be cool // if you think the name of this method is dumb feel free to change it i just thought it'd be cool
public static String tl(String s, Object... objects) public static String tl(String s, Object... objects)
{ {
Plex plugin = Plex.get();
if (s.equals("baseColor") || s.equals("errorColor") || s.equals("broadcastColor")) if (s.equals("baseColor") || s.equals("errorColor") || s.equals("broadcastColor"))
{ {
return getChatColorFromConfig(plugin.messages, ChatColor.WHITE, s).toString(); return getChatColorFromConfig(plugin.messages, ChatColor.WHITE, s).toString();