Skip to content

Commit 200dbda

Browse files
committed
Merge branch '2.x' of github.com:essentials/Essentials into 2.x
2 parents 3538728 + 5724c0c commit 200dbda

File tree

176 files changed

+1032
-1028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+1032
-1028
lines changed

Essentials/src/com/earth2me/essentials/Backup.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.earth2me.essentials;
22

3-
import static com.earth2me.essentials.I18n._;
3+
import static com.earth2me.essentials.I18n.tl;
44
import java.io.BufferedReader;
55
import java.io.IOException;
66
import java.io.InputStreamReader;
@@ -86,7 +86,7 @@ public void run()
8686
active = false;
8787
return;
8888
}
89-
LOGGER.log(Level.INFO, _("backupStarted"));
89+
LOGGER.log(Level.INFO, tl("backupStarted"));
9090
final CommandSender cs = server.getConsoleSender();
9191
server.dispatchCommand(cs, "save-all");
9292
server.dispatchCommand(cs, "save-off");
@@ -157,7 +157,7 @@ public void run()
157157
stopTask();
158158
}
159159
active = false;
160-
LOGGER.log(Level.INFO, _("backupFinished"));
160+
LOGGER.log(Level.INFO, tl("backupFinished"));
161161
}
162162
});
163163
}

Essentials/src/com/earth2me/essentials/Essentials.java

+22-24
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
package com.earth2me.essentials;
1919

20-
import static com.earth2me.essentials.I18n._;
20+
import static com.earth2me.essentials.I18n.tl;
2121
import com.earth2me.essentials.commands.EssentialsCommand;
2222
import com.earth2me.essentials.commands.IEssentialsCommand;
2323
import com.earth2me.essentials.commands.NoChargeException;
@@ -58,9 +58,7 @@
5858
import org.bukkit.command.Command;
5959
import org.bukkit.command.CommandSender;
6060
import org.bukkit.command.PluginCommand;
61-
import org.bukkit.command.SimpleCommandMap;
6261
import org.bukkit.command.TabCompleter;
63-
import org.bukkit.command.defaults.VanillaCommand;
6462
import org.bukkit.entity.Player;
6563
import org.bukkit.event.EventHandler;
6664
import org.bukkit.event.EventPriority;
@@ -100,7 +98,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
10098
private transient I18n i18n;
10199
private transient Metrics metrics;
102100
private transient EssentialsTimer timer;
103-
private transient List<String> vanishedPlayers = new ArrayList<String>();
101+
private final transient List<String> vanishedPlayers = new ArrayList<String>();
104102

105103
public Essentials()
106104
{
@@ -131,7 +129,7 @@ public void setupForTesting(final Server server) throws IOException, InvalidDesc
131129
}
132130
i18n = new I18n(this);
133131
i18n.onEnable();
134-
LOGGER.log(Level.INFO, _("usingTempFolderForTesting"));
132+
LOGGER.log(Level.INFO, tl("usingTempFolderForTesting"));
135133
LOGGER.log(Level.INFO, dataFolder.toString());
136134
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
137135
settings = new Settings(this);
@@ -159,7 +157,7 @@ public void onEnable()
159157
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion())
160158
&& !plugin.getDescription().getName().equals("EssentialsAntiCheat"))
161159
{
162-
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
160+
LOGGER.log(Level.WARNING, tl("versionMismatch", plugin.getDescription().getName()));
163161
}
164162
}
165163
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()
175173
}
176174
else
177175
{
178-
LOGGER.log(Level.INFO, _("bukkitFormatChanged"));
176+
LOGGER.log(Level.INFO, tl("bukkitFormatChanged"));
179177
LOGGER.log(Level.INFO, getServer().getVersion());
180178
LOGGER.log(Level.INFO, getServer().getBukkitVersion());
181179
}
@@ -211,11 +209,11 @@ public void onEnable()
211209
{
212210
if (pm.getPlugin("EssentialsUpdate") != null)
213211
{
214-
LOGGER.log(Level.SEVERE, _("essentialsHelp2"));
212+
LOGGER.log(Level.SEVERE, tl("essentialsHelp2"));
215213
}
216214
else
217215
{
218-
LOGGER.log(Level.SEVERE, _("essentialsHelp1"));
216+
LOGGER.log(Level.SEVERE, tl("essentialsHelp1"));
219217
}
220218
handleCrash(exception);
221219
return;
@@ -244,7 +242,7 @@ else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false
244242
final String timeroutput = execTimer.end();
245243
if (getSettings().isDebug())
246244
{
247-
LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
245+
LOGGER.log(Level.INFO, "Essentials load {0}", timeroutput);
248246
}
249247
}
250248
catch (NumberFormatException ex)
@@ -312,7 +310,7 @@ public void onDisable()
312310
if (user.isVanished())
313311
{
314312
user.setVanished(false);
315-
user.sendMessage(_("unvanishedReload"));
313+
user.sendMessage(tl("unvanishedReload"));
316314
}
317315
}
318316
cleanupOpenInventories();
@@ -441,7 +439,7 @@ else if (user == null)
441439
final List<String> mail = user.getMails();
442440
if (mail != null && !mail.isEmpty())
443441
{
444-
user.sendMessage(_("youHaveNewMail", mail.size()));
442+
user.sendMessage(tl("youHaveNewMail", mail.size()));
445443
}
446444
}
447445

@@ -467,28 +465,28 @@ else if (user == null)
467465
}
468466
catch (Exception ex)
469467
{
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);
472470
return true;
473471
}
474472

475473
// Check authorization
476474
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
477475
{
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"));
480478
return true;
481479
}
482480

483481
if (user != null && user.isJailed() && !user.isAuthorized(cmd, "essentials.jail.allow."))
484482
{
485483
if (user.getJailTimeout() > 0)
486484
{
487-
user.sendMessage(_("playerJailedFor", user.getName(), DateUtil.formatDateDiff(user.getJailTimeout())));
485+
user.sendMessage(tl("playerJailedFor", user.getName(), DateUtil.formatDateDiff(user.getJailTimeout())));
488486
}
489487
else
490488
{
491-
user.sendMessage(_("jailMessage"));
489+
user.sendMessage(tl("jailMessage"));
492490
}
493491
return true;
494492
}
@@ -532,7 +530,7 @@ else if (user == null)
532530
}
533531
catch (Throwable ex)
534532
{
535-
LOGGER.log(Level.SEVERE, _("commandFailed", commandLabel), ex);
533+
LOGGER.log(Level.SEVERE, tl("commandFailed", commandLabel), ex);
536534
return true;
537535
}
538536
}
@@ -560,18 +558,18 @@ public void cleanupOpenInventories()
560558
@Override
561559
public void showError(final CommandSource sender, final Throwable exception, final String commandLabel)
562560
{
563-
sender.sendMessage(_("errorWithMessage", exception.getMessage()));
561+
sender.sendMessage(tl("errorWithMessage", exception.getMessage()));
564562
if (getSettings().isDebug())
565563
{
566-
LOGGER.log(Level.WARNING, _("errorCallingCommand", commandLabel), exception);
564+
LOGGER.log(Level.WARNING, tl("errorCallingCommand", commandLabel), exception);
567565
}
568566
}
569567

570568
public static void wrongVersion()
571569
{
572570
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)));
575573
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
576574
}
577575

@@ -672,7 +670,7 @@ public User getUser(final Player base)
672670
{
673671
if (getSettings().isDebug())
674672
{
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());
676674
}
677675
user = new User(base, this);
678676
}

Essentials/src/com/earth2me/essentials/EssentialsConf.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.earth2me.essentials;
22

3-
import static com.earth2me.essentials.I18n._;
3+
import static com.earth2me.essentials.I18n.tl;
44
import com.google.common.io.Files;
55
import java.io.*;
66
import java.math.BigDecimal;
@@ -50,14 +50,14 @@ public synchronized void load()
5050
{
5151
if (pendingDiskWrites.get() != 0)
5252
{
53-
LOGGER.log(Level.INFO, "File " + configFile + " not read, because it's not yet written to disk.");
53+
LOGGER.log(Level.INFO, "File {0} not read, because it''s not yet written to disk.", configFile);
5454
return;
5555
}
5656
if (!configFile.getParentFile().exists())
5757
{
5858
if (!configFile.getParentFile().mkdirs())
5959
{
60-
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
60+
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()));
6161
}
6262
}
6363
// This will delete files where the first character is 0. In most cases they are broken.
@@ -100,7 +100,7 @@ public synchronized void load()
100100
{
101101
if (templateName != null)
102102
{
103-
LOGGER.log(Level.INFO, _("creatingConfigFromTemplate", configFile.toString()));
103+
LOGGER.log(Level.INFO, tl("creatingConfigFromTemplate", configFile.toString()));
104104
createFromTemplate();
105105
}
106106
else
@@ -189,7 +189,7 @@ private void createFromTemplate()
189189
istr = resourceClass.getResourceAsStream(templateName);
190190
if (istr == null)
191191
{
192-
LOGGER.log(Level.SEVERE, _("couldNotFindTemplate", templateName));
192+
LOGGER.log(Level.SEVERE, tl("couldNotFindTemplate", templateName));
193193
return;
194194
}
195195
ostr = new FileOutputStream(configFile);
@@ -204,7 +204,7 @@ private void createFromTemplate()
204204
}
205205
catch (IOException ex)
206206
{
207-
LOGGER.log(Level.SEVERE, _("failedToWriteConfig", configFile.toString()), ex);
207+
LOGGER.log(Level.SEVERE, tl("failedToWriteConfig", configFile.toString()), ex);
208208
}
209209
finally
210210
{
@@ -228,7 +228,7 @@ private void createFromTemplate()
228228
}
229229
catch (IOException ex)
230230
{
231-
LOGGER.log(Level.SEVERE, _("failedToCloseConfig", configFile.toString()), ex);
231+
LOGGER.log(Level.SEVERE, tl("failedToCloseConfig", configFile.toString()), ex);
232232
}
233233
}
234234
}
@@ -352,16 +352,16 @@ public void run()
352352
{
353353
try
354354
{
355-
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
355+
LOGGER.log(Level.INFO, tl("creatingEmptyConfig", configFile.toString()));
356356
if (!configFile.createNewFile())
357357
{
358-
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
358+
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()));
359359
return;
360360
}
361361
}
362362
catch (IOException ex)
363363
{
364-
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
364+
LOGGER.log(Level.SEVERE, tl("failedToCreateConfig", configFile.toString()), ex);
365365
return;
366366
}
367367
}

Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.earth2me.essentials;
22

3-
import static com.earth2me.essentials.I18n._;
3+
import static com.earth2me.essentials.I18n.tl;
44
import java.util.List;
55
import java.util.logging.Level;
66
import java.util.logging.Logger;
@@ -151,7 +151,7 @@ public void onPlayerDeathEvent(final PlayerDeathEvent event)
151151
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
152152
{
153153
user.setLastLocation();
154-
user.sendMessage(_("backAfterDeath"));
154+
user.sendMessage(tl("backAfterDeath"));
155155
}
156156
if (!ess.getSettings().areDeathMessagesEnabled())
157157
{

Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.earth2me.essentials;
22

3-
import static com.earth2me.essentials.I18n._;
3+
import static com.earth2me.essentials.I18n.tl;
44
import com.earth2me.essentials.textreader.IText;
55
import com.earth2me.essentials.textreader.KeywordReplacer;
66
import com.earth2me.essentials.textreader.TextInput;
@@ -63,8 +63,8 @@ public void onPlayerChat(final AsyncPlayerChatEvent event)
6363
if (user.isMuted())
6464
{
6565
event.setCancelled(true);
66-
user.sendMessage(_("voiceSilenced"));
67-
LOGGER.info(_("mutedUserSpeaks", user.getName()));
66+
user.sendMessage(tl("voiceSilenced"));
67+
LOGGER.info(tl("mutedUserSpeaks", user.getName()));
6868
}
6969
try
7070
{
@@ -295,11 +295,11 @@ else if (ess.getSettings().allowSilentJoinQuit())
295295
final List<String> mail = user.getMails();
296296
if (mail.isEmpty())
297297
{
298-
user.sendMessage(_("noNewMail"));
298+
user.sendMessage(tl("noNewMail"));
299299
}
300300
else
301301
{
302-
user.sendMessage(_("youHaveNewMail", mail.size()));
302+
user.sendMessage(tl("youHaveNewMail", mail.size()));
303303
}
304304
}
305305

@@ -310,7 +310,7 @@ else if (ess.getSettings().allowSilentJoinQuit())
310310
{
311311
user.setAllowFlight(true);
312312
user.setFlying(true);
313-
user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
313+
user.sendMessage(tl("flyMode", tl("enabled"), user.getDisplayName()));
314314
}
315315
}
316316
user.setFlySpeed(0.1f);
@@ -346,7 +346,7 @@ public void onPlayerLogin2(final PlayerLoginEvent event)
346346
return;
347347
}
348348

349-
final String banReason = _("banFormat", _("defaultBanReason"), "Console");
349+
final String banReason = tl("banFormat", tl("defaultBanReason"), "Console");
350350
event.disallow(Result.KICK_BANNED, banReason);
351351
}
352352

@@ -386,7 +386,7 @@ public void onPlayerLogin(final PlayerLoginEvent event)
386386

387387
if (event.getResult() == Result.KICK_FULL && !user.isAuthorized("essentials.joinfullserver"))
388388
{
389-
event.disallow(Result.KICK_FULL, _("serverFull"));
389+
event.disallow(Result.KICK_FULL, tl("serverFull"));
390390
return;
391391
}
392392
event.allow();
@@ -510,12 +510,12 @@ public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
510510
updateCompass(user);
511511
if (ess.getSettings().getNoGodWorlds().contains(newWorld) && user.isGodModeEnabledRaw())
512512
{
513-
user.sendMessage(_("noGodWorldWarning"));
513+
user.sendMessage(tl("noGodWorldWarning"));
514514
}
515515

516516
if (!user.getWorld().getName().equals(newWorld))
517517
{
518-
user.sendMessage(_("currentWorld", newWorld));
518+
user.sendMessage(tl("currentWorld", newWorld));
519519
}
520520
if (user.isVanished())
521521
{
@@ -535,7 +535,7 @@ public void onPlayerInteract(final PlayerInteractEvent event)
535535
if (player.isAuthorized("essentials.sethome.bed"))
536536
{
537537
player.setBedSpawnLocation(event.getClickedBlock().getLocation());
538-
player.sendMessage(_("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
538+
player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
539539
}
540540
}
541541
break;

0 commit comments

Comments
 (0)