17
17
*/
18
18
package com .earth2me .essentials ;
19
19
20
- import static com .earth2me .essentials .I18n ._ ;
20
+ import static com .earth2me .essentials .I18n .tl ;
21
21
import com .earth2me .essentials .commands .EssentialsCommand ;
22
22
import com .earth2me .essentials .commands .IEssentialsCommand ;
23
23
import com .earth2me .essentials .commands .NoChargeException ;
58
58
import org .bukkit .command .Command ;
59
59
import org .bukkit .command .CommandSender ;
60
60
import org .bukkit .command .PluginCommand ;
61
- import org .bukkit .command .SimpleCommandMap ;
62
61
import org .bukkit .command .TabCompleter ;
63
- import org .bukkit .command .defaults .VanillaCommand ;
64
62
import org .bukkit .entity .Player ;
65
63
import org .bukkit .event .EventHandler ;
66
64
import org .bukkit .event .EventPriority ;
@@ -100,7 +98,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
100
98
private transient I18n i18n ;
101
99
private transient Metrics metrics ;
102
100
private transient EssentialsTimer timer ;
103
- private transient List <String > vanishedPlayers = new ArrayList <String >();
101
+ private final transient List <String > vanishedPlayers = new ArrayList <String >();
104
102
105
103
public Essentials ()
106
104
{
@@ -131,7 +129,7 @@ public void setupForTesting(final Server server) throws IOException, InvalidDesc
131
129
}
132
130
i18n = new I18n (this );
133
131
i18n .onEnable ();
134
- LOGGER .log (Level .INFO , _ ("usingTempFolderForTesting" ));
132
+ LOGGER .log (Level .INFO , tl ("usingTempFolderForTesting" ));
135
133
LOGGER .log (Level .INFO , dataFolder .toString ());
136
134
this .initialize (null , server , new PluginDescriptionFile (new FileReader (new File ("src" + File .separator + "plugin.yml" ))), dataFolder , null , null );
137
135
settings = new Settings (this );
@@ -159,7 +157,7 @@ public void onEnable()
159
157
&& !plugin .getDescription ().getVersion ().equals (this .getDescription ().getVersion ())
160
158
&& !plugin .getDescription ().getName ().equals ("EssentialsAntiCheat" ))
161
159
{
162
- LOGGER .log (Level .WARNING , _ ("versionMismatch" , plugin .getDescription ().getName ()));
160
+ LOGGER .log (Level .WARNING , tl ("versionMismatch" , plugin .getDescription ().getName ()));
163
161
}
164
162
}
165
163
final Matcher versionMatch = Pattern .compile ("git-Bukkit-(?:(?:[0-9]+)\\ .)+[0-9]+-R[\\ .0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*" ).matcher (getServer ().getVersion ());
@@ -175,7 +173,7 @@ public void onEnable()
175
173
}
176
174
else
177
175
{
178
- LOGGER .log (Level .INFO , _ ("bukkitFormatChanged" ));
176
+ LOGGER .log (Level .INFO , tl ("bukkitFormatChanged" ));
179
177
LOGGER .log (Level .INFO , getServer ().getVersion ());
180
178
LOGGER .log (Level .INFO , getServer ().getBukkitVersion ());
181
179
}
@@ -211,11 +209,11 @@ public void onEnable()
211
209
{
212
210
if (pm .getPlugin ("EssentialsUpdate" ) != null )
213
211
{
214
- LOGGER .log (Level .SEVERE , _ ("essentialsHelp2" ));
212
+ LOGGER .log (Level .SEVERE , tl ("essentialsHelp2" ));
215
213
}
216
214
else
217
215
{
218
- LOGGER .log (Level .SEVERE , _ ("essentialsHelp1" ));
216
+ LOGGER .log (Level .SEVERE , tl ("essentialsHelp1" ));
219
217
}
220
218
handleCrash (exception );
221
219
return ;
@@ -244,7 +242,7 @@ else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false
244
242
final String timeroutput = execTimer .end ();
245
243
if (getSettings ().isDebug ())
246
244
{
247
- LOGGER .log (Level .INFO , "Essentials load " + timeroutput );
245
+ LOGGER .log (Level .INFO , "Essentials load {0}" , timeroutput );
248
246
}
249
247
}
250
248
catch (NumberFormatException ex )
@@ -312,7 +310,7 @@ public void onDisable()
312
310
if (user .isVanished ())
313
311
{
314
312
user .setVanished (false );
315
- user .sendMessage (_ ("unvanishedReload" ));
313
+ user .sendMessage (tl ("unvanishedReload" ));
316
314
}
317
315
}
318
316
cleanupOpenInventories ();
@@ -441,7 +439,7 @@ else if (user == null)
441
439
final List <String > mail = user .getMails ();
442
440
if (mail != null && !mail .isEmpty ())
443
441
{
444
- user .sendMessage (_ ("youHaveNewMail" , mail .size ()));
442
+ user .sendMessage (tl ("youHaveNewMail" , mail .size ()));
445
443
}
446
444
}
447
445
@@ -467,28 +465,28 @@ else if (user == null)
467
465
}
468
466
catch (Exception ex )
469
467
{
470
- sender .sendMessage (_ ("commandNotLoaded" , commandLabel ));
471
- LOGGER .log (Level .SEVERE , _ ("commandNotLoaded" , commandLabel ), ex );
468
+ sender .sendMessage (tl ("commandNotLoaded" , commandLabel ));
469
+ LOGGER .log (Level .SEVERE , tl ("commandNotLoaded" , commandLabel ), ex );
472
470
return true ;
473
471
}
474
472
475
473
// Check authorization
476
474
if (user != null && !user .isAuthorized (cmd , permissionPrefix ))
477
475
{
478
- LOGGER .log (Level .INFO , _ ("deniedAccessCommand" , user .getName ()));
479
- user .sendMessage (_ ("noAccessCommand" ));
476
+ LOGGER .log (Level .INFO , tl ("deniedAccessCommand" , user .getName ()));
477
+ user .sendMessage (tl ("noAccessCommand" ));
480
478
return true ;
481
479
}
482
480
483
481
if (user != null && user .isJailed () && !user .isAuthorized (cmd , "essentials.jail.allow." ))
484
482
{
485
483
if (user .getJailTimeout () > 0 )
486
484
{
487
- user .sendMessage (_ ("playerJailedFor" , user .getName (), DateUtil .formatDateDiff (user .getJailTimeout ())));
485
+ user .sendMessage (tl ("playerJailedFor" , user .getName (), DateUtil .formatDateDiff (user .getJailTimeout ())));
488
486
}
489
487
else
490
488
{
491
- user .sendMessage (_ ("jailMessage" ));
489
+ user .sendMessage (tl ("jailMessage" ));
492
490
}
493
491
return true ;
494
492
}
@@ -532,7 +530,7 @@ else if (user == null)
532
530
}
533
531
catch (Throwable ex )
534
532
{
535
- LOGGER .log (Level .SEVERE , _ ("commandFailed" , commandLabel ), ex );
533
+ LOGGER .log (Level .SEVERE , tl ("commandFailed" , commandLabel ), ex );
536
534
return true ;
537
535
}
538
536
}
@@ -560,18 +558,18 @@ public void cleanupOpenInventories()
560
558
@ Override
561
559
public void showError (final CommandSource sender , final Throwable exception , final String commandLabel )
562
560
{
563
- sender .sendMessage (_ ("errorWithMessage" , exception .getMessage ()));
561
+ sender .sendMessage (tl ("errorWithMessage" , exception .getMessage ()));
564
562
if (getSettings ().isDebug ())
565
563
{
566
- LOGGER .log (Level .WARNING , _ ("errorCallingCommand" , commandLabel ), exception );
564
+ LOGGER .log (Level .WARNING , tl ("errorCallingCommand" , commandLabel ), exception );
567
565
}
568
566
}
569
567
570
568
public static void wrongVersion ()
571
569
{
572
570
LOGGER .log (Level .SEVERE , " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *" );
573
- LOGGER .log (Level .SEVERE , _ ("notRecommendedBukkit" ));
574
- LOGGER .log (Level .SEVERE , _ ("requiredBukkit" , Integer .toString (BUKKIT_VERSION )));
571
+ LOGGER .log (Level .SEVERE , tl ("notRecommendedBukkit" ));
572
+ LOGGER .log (Level .SEVERE , tl ("requiredBukkit" , Integer .toString (BUKKIT_VERSION )));
575
573
LOGGER .log (Level .SEVERE , " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *" );
576
574
}
577
575
@@ -672,7 +670,7 @@ public User getUser(final Player base)
672
670
{
673
671
if (getSettings ().isDebug ())
674
672
{
675
- LOGGER .log (Level .INFO , "Constructing new userfile from base player " + base .getName ());
673
+ LOGGER .log (Level .INFO , "Constructing new userfile from base player {0}" , base .getName ());
676
674
}
677
675
user = new User (base , this );
678
676
}
0 commit comments