mirror of
https://github.com/essentials/Essentials.git
synced 2025-10-01 00:26:48 +02:00
Switch to the new I18n class and format cleanup of all classes
This commit is contained in:
@@ -13,13 +13,15 @@ public abstract class AbstractWorkListener
|
||||
private final transient Plugin plugin;
|
||||
private final transient VersionInfo newVersionInfo;
|
||||
|
||||
public final void onWorkAbort() {
|
||||
public final void onWorkAbort()
|
||||
{
|
||||
onWorkAbort(null);
|
||||
}
|
||||
|
||||
|
||||
public abstract void onWorkAbort(String message);
|
||||
|
||||
public final void onWorkDone() {
|
||||
|
||||
public final void onWorkDone()
|
||||
{
|
||||
onWorkDone(null);
|
||||
}
|
||||
|
||||
|
@@ -1,13 +1,6 @@
|
||||
package com.earth2me.essentials.update;
|
||||
|
||||
import com.earth2me.essentials.update.chat.Command;
|
||||
import com.earth2me.essentials.update.chat.ConfigCommand;
|
||||
import com.earth2me.essentials.update.chat.ErrorsCommand;
|
||||
import com.earth2me.essentials.update.chat.HelpCommand;
|
||||
import com.earth2me.essentials.update.chat.IrcBot;
|
||||
import com.earth2me.essentials.update.chat.ListCommand;
|
||||
import com.earth2me.essentials.update.chat.StartupCommand;
|
||||
import com.earth2me.essentials.update.chat.UsernameUtil;
|
||||
import com.earth2me.essentials.update.chat.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.earth2me.essentials.update;
|
||||
|
||||
import com.earth2me.essentials.update.UpdateCheck.CheckResult;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -16,7 +15,8 @@ public class EssentialsUpdate extends JavaPlugin
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
if (!getDataFolder().exists() && !getDataFolder().mkdirs() ) {
|
||||
if (!getDataFolder().exists() && !getDataFolder().mkdirs())
|
||||
{
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath());
|
||||
}
|
||||
essentialsHelp = new EssentialsHelp(this);
|
||||
|
@@ -1,10 +1,6 @@
|
||||
package com.earth2me.essentials.update;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
|
@@ -15,8 +15,8 @@ import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class UpdateFile
|
||||
@@ -66,7 +66,7 @@ public class UpdateFile
|
||||
getFile = new GetFile(UPDATE_URL);
|
||||
getFile.saveTo(file);
|
||||
plugin.getConfig().set("lastupdate", System.currentTimeMillis());
|
||||
plugin.getConfig().save(new File(plugin.getDataFolder(),"config.yml"));
|
||||
plugin.getConfig().save(new File(plugin.getDataFolder(), "config.yml"));
|
||||
return true;
|
||||
}
|
||||
catch (IOException ex)
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.earth2me.essentials.update;
|
||||
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
|
||||
|
||||
public class VersionInfo
|
||||
|
@@ -1,11 +1,7 @@
|
||||
package com.earth2me.essentials.update.chat;
|
||||
|
||||
import com.earth2me.essentials.update.PastieUpload;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
@@ -26,12 +26,16 @@ public class ConfigCommand extends AbstractFileCommand implements Command
|
||||
do
|
||||
{
|
||||
final String line = page.readLine();
|
||||
if (line == null) {
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
input.append(line).append("\n");
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
page.close();
|
||||
final String message = "Essentials config.yml: " + uploadToPastie(input);
|
||||
player.sendMessage("§6" + ircBot.getNick() + ": §7" + message);
|
||||
|
@@ -26,9 +26,8 @@ public abstract class AbstractState
|
||||
catch (Exception ex)
|
||||
{
|
||||
/*
|
||||
* This should never happen.
|
||||
* All states that are added to the map automatically,
|
||||
* have to have a Constructor that accepts the StateMap.
|
||||
* This should never happen. All states, that are added to the map automatically, have to have a
|
||||
* Constructor that accepts the StateMap.
|
||||
*/
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
@@ -8,5 +8,5 @@ public class InstallationFinishedEvent extends Event
|
||||
public InstallationFinishedEvent()
|
||||
{
|
||||
super(Type.CUSTOM_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.earth2me.essentials.update.states;
|
||||
|
||||
import com.earth2me.essentials.update.UpdateCheck;
|
||||
import com.earth2me.essentials.update.AbstractWorkListener;
|
||||
import com.earth2me.essentials.update.UpdateCheck;
|
||||
import java.util.Iterator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -8,17 +8,18 @@ public class UpdateOrInstallation extends AbstractState
|
||||
{
|
||||
private final transient UpdateCheck updateCheck;
|
||||
private transient boolean update = false;
|
||||
|
||||
|
||||
public UpdateOrInstallation(final StateMap stateMap, final UpdateCheck updateCheck)
|
||||
{
|
||||
super(stateMap);
|
||||
this.updateCheck = updateCheck;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean guessAnswer()
|
||||
{
|
||||
if (getUpdateCheck().isEssentialsInstalled()) {
|
||||
if (getUpdateCheck().isEssentialsInstalled())
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
return update;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package com.earth2me.essentials.update.tasks;
|
||||
|
||||
import com.earth2me.essentials.update.AbstractWorkListener;
|
||||
import com.earth2me.essentials.update.GetFile;
|
||||
import com.earth2me.essentials.update.ModuleInfo;
|
||||
import com.earth2me.essentials.update.VersionInfo;
|
||||
import com.earth2me.essentials.update.AbstractWorkListener;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
|
@@ -43,8 +43,8 @@ public class SelfUpdate extends AbstractWorkListener implements Task, Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), new Runnable() {
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
@@ -52,6 +52,4 @@ public class SelfUpdate extends AbstractWorkListener implements Task, Runnable
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -15,8 +15,8 @@ found at http://www.jibble.org/licenses/
|
||||
package org.jibble.pircbot;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.net.Socket;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* A Thread which reads lines from the IRC server. It then
|
||||
|
@@ -14,8 +14,7 @@ found at http://www.jibble.org/licenses/
|
||||
|
||||
package org.jibble.pircbot;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.io.BufferedWriter;
|
||||
|
||||
/**
|
||||
* A Thread which is responsible for sending messages to the IRC server.
|
||||
|
@@ -15,7 +15,8 @@ found at http://www.jibble.org/licenses/
|
||||
package org.jibble.pircbot;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -2558,7 +2559,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
* @see #onUserList(String,User[]) onUserList
|
||||
*/
|
||||
public final User[] getUsers(String channel) {
|
||||
channel = channel.toLowerCase();
|
||||
channel = channel.toLowerCase(Locale.ENGLISH);
|
||||
User[] userArray = new User[0];
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
@@ -2631,7 +2632,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
* Overwrite the existing entry if it exists.
|
||||
*/
|
||||
private final void addUser(String channel, User user) {
|
||||
channel = channel.toLowerCase();
|
||||
channel = channel.toLowerCase(Locale.ENGLISH);
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
if (users == null) {
|
||||
@@ -2647,7 +2648,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
* Remove a user from the specified channel in our memory.
|
||||
*/
|
||||
private final User removeUser(String channel, String nick) {
|
||||
channel = channel.toLowerCase();
|
||||
channel = channel.toLowerCase(Locale.ENGLISH);
|
||||
User user = new User("", nick);
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
@@ -2695,7 +2696,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
* Removes an entire channel from our memory of users.
|
||||
*/
|
||||
private final void removeChannel(String channel) {
|
||||
channel = channel.toLowerCase();
|
||||
channel = channel.toLowerCase(Locale.ENGLISH);
|
||||
synchronized (_channels) {
|
||||
_channels.remove(channel);
|
||||
}
|
||||
@@ -2713,7 +2714,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
|
||||
|
||||
private final void updateUser(String channel, int userMode, String nick) {
|
||||
channel = channel.toLowerCase();
|
||||
channel = channel.toLowerCase(Locale.ENGLISH);
|
||||
synchronized (_channels) {
|
||||
Hashtable users = (Hashtable) _channels.get(channel);
|
||||
User newUser = null;
|
||||
|
@@ -13,6 +13,8 @@ found at http://www.jibble.org/licenses/
|
||||
|
||||
package org.jibble.pircbot;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class is used to represent a user on an IRC server.
|
||||
* Instances of this class are returned by the getUsers method
|
||||
@@ -38,7 +40,7 @@ public class User {
|
||||
User(String prefix, String nick) {
|
||||
_prefix = prefix;
|
||||
_nick = nick;
|
||||
_lowerNick = nick.toLowerCase();
|
||||
_lowerNick = nick.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +111,7 @@ public class User {
|
||||
* @return true if the nicks are identical (case insensitive).
|
||||
*/
|
||||
public boolean equals(String nick) {
|
||||
return nick.toLowerCase().equals(_lowerNick);
|
||||
return nick.toLowerCase(Locale.ENGLISH).equals(_lowerNick);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user