@@ -18,10 +18,8 @@ public enum M {
1818
1919 private static boolean debugMode = false ;
2020 private static String language = "default" ;
21- private static boolean saveLanguage = false ;
22- private static char c1 = 'a' ;
23- private static char c2 = '2' ;
24- private static String pluginName ;
21+ private static final char c1 = 'a' ;
22+ private static final char c2 = '2' ;
2523
2624
2725 public static String colorize (String text ) {
@@ -39,7 +37,7 @@ public static String colorize(String text) {
3937 public static void BC (Object ... s ) {
4038 if (!debugMode ) return ;
4139 if (s .length == 0 ) return ;
42- StringBuilder sb = new StringBuilder ("&3[" ). append ( pluginName ). append ( " ]&f " );
40+ StringBuilder sb = new StringBuilder ("&3[DbLib ]&f " );
4341 for (Object str : s )
4442 sb .append (str .toString ()).append (" " );
4543
@@ -172,10 +170,10 @@ public String getText(Object... keys) {
172170 int count = 1 ;
173171 int c = 0 ;
174172 DecimalFormat fmt = new DecimalFormat ("####0.##" );
175- for (int i = 0 ; i < keys . length ; i ++ ) {
176- String s = messenger .toString (keys [ i ] , fullFloat );//keys[i].toString();
177- if (c < 2 && keys [ i ] instanceof Character ) {
178- colors [c ] = (Character ) keys [ i ] ;
173+ for (Object key : keys ) {
174+ String s = messenger .toString (key , fullFloat );//keys[i].toString();
175+ if (c < 2 && key instanceof Character ) {
176+ colors [c ] = (Character ) key ;
179177 c ++;
180178 continue ;
181179 } else if (s .startsWith ("prefix:" )) {
@@ -190,12 +188,12 @@ public String getText(Object... keys) {
190188 } else if (s .equals ("FULLFLOAT" )) {
191189 fullFloat = true ;
192190 continue ;
193- } else if (keys [ i ] instanceof Double || keys [ i ] instanceof Float ) {
194- if (!fullFloat ) s = fmt .format ((Double ) keys [ i ] );
191+ } else if (key instanceof Double || key instanceof Float ) {
192+ if (!fullFloat ) s = fmt .format ((Double ) key );
195193 }
196194
197- String from = ( new StringBuilder ( "%" ). append ( count ). append ( "%" )). toString () ;
198- String to = skipDefaultColors ? s : ( new StringBuilder ( "&" ). append ( colors [1 ]). append ( s ). append ( "&" ). append ( colors [0 ])). toString () ;
195+ String from = "%" + count + "%" ;
196+ String to = skipDefaultColors ? s : "&" + colors [1 ] + s + "&" + colors [0 ];
199197 str = str .replace (from , to );
200198 count ++;
201199 }
@@ -213,8 +211,8 @@ private void initMessage(String message) {
213211 }
214212
215213 private String message ;
216- private Character color1 ;
217- private Character color2 ;
214+ private final Character color1 ;
215+ private final Character color2 ;
218216
219217 M (String msg ) {
220218 message = msg ;
@@ -245,9 +243,8 @@ public static void init(String pluginName, Messenger mess, String lang, boolean
245243 messenger = mess ;
246244 language = lang .equalsIgnoreCase ("default" ) ? "eng" : lang ;
247245 debugMode = debug ;
248- saveLanguage = save ;
249246 initMessages ();
250- if (saveLanguage ) saveMessages ();
247+ if (save ) saveMessages ();
251248 LNG_CONFIG .debug (M .values ().length , language , true , debugMode );
252249 }
253250
@@ -268,16 +265,17 @@ public static boolean isDebug() {
268265 private static void initMessages () {
269266 Map <String , String > lng = messenger .load (language );
270267 for (M key : M .values ()) {
271- if (lng .containsKey (key .name ().toLowerCase ())) {
272- key .initMessage (lng .get (key .name ().toLowerCase ()));
268+ String keyLow = key .name ().toLowerCase (Locale .ROOT );
269+ if (lng .containsKey (keyLow )) {
270+ key .initMessage (lng .get (keyLow ));
273271 }
274272 }
275273 }
276274
277275 private static void saveMessages () {
278- Map <String , String > messages = new LinkedHashMap <String , String >();
276+ Map <String , String > messages = new LinkedHashMap <>();
279277 for (M msg : M .values ()) {
280- messages .put (msg .name ().toLowerCase (), msg .message );
278+ messages .put (msg .name ().toLowerCase (Locale . ROOT ), msg .message );
281279 }
282280 messenger .save (language , messages );
283281 }
@@ -325,7 +323,7 @@ public static void printPage(Object sender, List<String> lines, M title, int pag
325323
326324 public static void printPage (Object sender , List <String > lines , M title , M footer , int pageNum , int linesPerPage ) {
327325 if (lines == null || lines .isEmpty ()) return ;
328- List <String > page = new ArrayList <String >();
326+ List <String > page = new ArrayList <>();
329327 if (title != null ) page .add (title .message );
330328
331329 int pageCount = lines .size () / linesPerPage + 1 ;
0 commit comments