mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-27 08:24:44 +02:00
Switch to the new I18n class and format cleanup of all classes
This commit is contained in:
@@ -28,6 +28,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
||||
@@ -36,6 +37,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||
|
@@ -22,6 +22,6 @@ public class Commandsetxmpp extends EssentialsCommand
|
||||
}
|
||||
|
||||
EssentialsXMPP.getInstance().setAddress(user, args[0]);
|
||||
user.sendMessage("XMPP address set to "+args[0]);
|
||||
user.sendMessage("XMPP address set to " + args[0]);
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,8 @@ public class Commandxmpp extends EssentialsCommand
|
||||
final String message = getFinalArg(args, 1);
|
||||
final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
|
||||
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
|
||||
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message)) {
|
||||
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
|
||||
{
|
||||
sender.sendMessage("§cError sending message.");
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.IUser;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -22,7 +23,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
private transient UserManager users;
|
||||
private transient XMPPManager xmpp;
|
||||
private transient IEssentials ess;
|
||||
|
||||
|
||||
public static IEssentialsXMPP getInstance()
|
||||
{
|
||||
return instance;
|
||||
@@ -39,7 +40,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "Failed to load Essentials before EssentialsXMPP");
|
||||
}
|
||||
|
||||
|
||||
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
|
||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
|
||||
pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
|
||||
@@ -53,9 +54,9 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
|
||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
|
||||
LOGGER.log(Level.WARNING, _("versionMismatchAll"));
|
||||
}
|
||||
LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,7 +74,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
@Override
|
||||
public void setAddress(final Player user, final String address)
|
||||
{
|
||||
final String username = user.getName().toLowerCase();
|
||||
final String username = user.getName().toLowerCase(Locale.ENGLISH);
|
||||
instance.users.setAddress(username, address);
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
@Override
|
||||
public boolean toggleSpy(final Player user)
|
||||
{
|
||||
final String username = user.getName().toLowerCase();
|
||||
final String username = user.getName().toLowerCase(Locale.ENGLISH);
|
||||
final boolean spy = !instance.users.isSpy(username);
|
||||
instance.users.setSpy(username, spy);
|
||||
return spy;
|
||||
|
@@ -3,10 +3,7 @@ package com.earth2me.essentials.xmpp;
|
||||
import com.earth2me.essentials.EssentialsConf;
|
||||
import com.earth2me.essentials.IConf;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class UserManager implements IConf
|
||||
@@ -24,26 +21,27 @@ public class UserManager implements IConf
|
||||
|
||||
public final boolean isSpy(final String username)
|
||||
{
|
||||
return users.getBoolean(username.toLowerCase() + "." + SPY, false);
|
||||
return users.getBoolean(username.toLowerCase(Locale.ENGLISH) + "." + SPY, false);
|
||||
}
|
||||
|
||||
public void setSpy(final String username, final boolean spy)
|
||||
{
|
||||
setUser(username.toLowerCase(), getAddress(username), spy);
|
||||
setUser(username.toLowerCase(Locale.ENGLISH), getAddress(username), spy);
|
||||
}
|
||||
|
||||
public final String getAddress(final String username)
|
||||
{
|
||||
return users.getString(username.toLowerCase() + "." + ADDRESS, null);
|
||||
return users.getString(username.toLowerCase(Locale.ENGLISH) + "." + ADDRESS, null);
|
||||
}
|
||||
|
||||
|
||||
public final String getUserByAddress(final String search)
|
||||
{
|
||||
final List<String> usernames = users.getKeys(null);
|
||||
for (String username : usernames)
|
||||
{
|
||||
final String address = users.getString(username + "." + ADDRESS, null);
|
||||
if (address != null && search.equalsIgnoreCase(address)) {
|
||||
if (address != null && search.equalsIgnoreCase(address))
|
||||
{
|
||||
return username;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +50,7 @@ public class UserManager implements IConf
|
||||
|
||||
public void setAddress(final String username, final String address)
|
||||
{
|
||||
setUser(username.toLowerCase(), address, isSpy(username));
|
||||
setUser(username.toLowerCase(Locale.ENGLISH), address, isSpy(username));
|
||||
}
|
||||
|
||||
public List<String> getSpyUsers()
|
||||
|
@@ -56,7 +56,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||
}
|
||||
if (chat != null)
|
||||
{
|
||||
if (!connection.isConnected()) {
|
||||
if (!connection.isConnected())
|
||||
{
|
||||
disconnect();
|
||||
connect();
|
||||
}
|
||||
@@ -90,7 +91,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||
break;
|
||||
default:
|
||||
final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant()));
|
||||
parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message, StringUtils.parseBareAddress(chat.getParticipant()));
|
||||
parent.broadcastMessage(sender, "=" + sender.getDisplayName() + ": " + message, StringUtils.parseBareAddress(chat.getParticipant()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user