diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-12-31 02:28:52 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-12-31 02:28:52 +0000 |
commit | 86619275992b4b29bfac91897986b10f2ef863cb (patch) | |
tree | c46ac4dd7fb3a7d7dde90d508e3b123efd09def7 /EssentialsXMPP | |
parent | a6b83ca260386fbafb24473aca5f95dc2d5c284b (diff) | |
download | Essentials-86619275992b4b29bfac91897986b10f2ef863cb.tar Essentials-86619275992b4b29bfac91897986b10f2ef863cb.tar.gz Essentials-86619275992b4b29bfac91897986b10f2ef863cb.tar.lz Essentials-86619275992b4b29bfac91897986b10f2ef863cb.tar.xz Essentials-86619275992b4b29bfac91897986b10f2ef863cb.zip |
Merge gravy's pull and reformat code
Diffstat (limited to 'EssentialsXMPP')
-rw-r--r-- | EssentialsXMPP/pom.xml | 87 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java | 2 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java | 4 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java | 13 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java | 2 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java | 2 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/UserManager.java | 2 | ||||
-rw-r--r-- | EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java | 102 |
8 files changed, 107 insertions, 107 deletions
diff --git a/EssentialsXMPP/pom.xml b/EssentialsXMPP/pom.xml index 1d2a6fe0a..dc75b7470 100644 --- a/EssentialsXMPP/pom.xml +++ b/EssentialsXMPP/pom.xml @@ -1,50 +1,49 @@ - <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsXMPP</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>jivesoftware</groupId> - <artifactId>smack</artifactId> - <version>3.1.0</version> - </dependency> - </dependencies> + <artifactId>EssentialsXMPP</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>jivesoftware</groupId> + <artifactId>smack</artifactId> + <version>3.1.0</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>1.7</version> - <executions> - <execution> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <artifactSet> - <includes> - <include>jivesoftware:smack</include> - </includes> - </artifactSet> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <artifactSet> + <includes> + <include>jivesoftware:smack</include> + </includes> + </artifactSet> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java index 68609207d..05106145e 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java @@ -1,9 +1,9 @@ package net.ess3.xmpp; +import org.bukkit.command.CommandSender; import net.ess3.Console; import net.ess3.commands.EssentialsCommand; import net.ess3.commands.NotEnoughArgumentsException; -import org.bukkit.command.CommandSender; public class Commandxmpp extends EssentialsCommand diff --git a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java index ca78962f6..0be64d91a 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java @@ -1,10 +1,10 @@ package net.ess3.xmpp; import java.util.List; -import net.ess3.commands.EssentialsCommand; -import net.ess3.commands.NotEnoughArgumentsException; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import net.ess3.commands.EssentialsCommand; +import net.ess3.commands.NotEnoughArgumentsException; public class Commandxmppspy extends EssentialsCommand diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java index b8e7545e6..d7241d57b 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java @@ -1,20 +1,19 @@ package net.ess3.xmpp; +import static net.ess3.I18n._; import java.util.List; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; -import static net.ess3.I18n._; -import net.ess3.api.ICommandHandler; -import net.ess3.api.IEssentials; -import net.ess3.api.IPlugin; -import net.ess3.api.IUser; -import net.ess3.commands.EssentialsCommandHandler; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.command.TabExecutor; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.command.TabExecutor; +import net.ess3.api.IEssentials; +import net.ess3.api.IPlugin; +import net.ess3.api.IUser; +import net.ess3.commands.EssentialsCommandHandler; public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java index 647ff6ac3..c2cd8428d 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java @@ -1,12 +1,12 @@ package net.ess3.xmpp; -import net.ess3.api.IEssentials; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import net.ess3.api.IEssentials; class EssentialsXMPPPlayerListener implements Listener diff --git a/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java index 789ccddc9..a464dc398 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java @@ -1,9 +1,9 @@ package net.ess3.xmpp; import java.util.List; -import net.ess3.api.IUser; import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; +import net.ess3.api.IUser; public interface IEssentialsXMPP extends Plugin diff --git a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java index c80680445..56da0d7e7 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; -import net.ess3.api.IReload; import org.bukkit.configuration.file.YamlConfiguration; +import net.ess3.api.IReload; public class UserManager implements IReload diff --git a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java index bf88aad8b..ac6dddff6 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java @@ -6,11 +6,11 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; import net.ess3.api.IReload; import net.ess3.api.IUser; import net.ess3.utils.FormatUtil; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; import org.jivesoftware.smack.*; import org.jivesoftware.smack.Roster.SubscriptionMode; import org.jivesoftware.smack.packet.Message; @@ -234,68 +234,70 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM private void startLoggerThread() { - loggerThread = new Thread(new Runnable() - { - @Override - public void run() - { - final Set<LogRecord> copy = new HashSet<LogRecord>(); - final Set<String> failedUsers = new HashSet<String>(); - while (threadrunning) + loggerThread = new Thread( + new Runnable() { - synchronized (logrecords) - { - if (!logrecords.isEmpty()) - { - copy.addAll(logrecords); - logrecords.clear(); - } - } - if (!copy.isEmpty()) + @Override + public void run() { - for (String user : logUsers) + final Set<LogRecord> copy = new HashSet<LogRecord>(); + final Set<String> failedUsers = new HashSet<String>(); + while (threadrunning) { - try + synchronized (logrecords) + { + if (!logrecords.isEmpty()) + { + copy.addAll(logrecords); + logrecords.clear(); + } + } + if (!copy.isEmpty()) { - XMPPManager.this.startChat(user); - for (LogRecord logRecord : copy) + for (String user : logUsers) { - final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters()); - if (!XMPPManager.this.sendMessage(user, message)) + try + { + XMPPManager.this.startChat(user); + for (LogRecord logRecord : copy) + { + final String message = String.format( + "[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters()); + if (!XMPPManager.this.sendMessage(user, message)) + { + failedUsers.add(user); + break; + } + + } + } + catch (XMPPException ex) { failedUsers.add(user); - break; + LOGGER.removeHandler(XMPPManager.this); + LOGGER.log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex); } - } + logUsers.removeAll(failedUsers); + if (logUsers.isEmpty()) + { + LOGGER.removeHandler(XMPPManager.this); + threadrunning = false; + } + copy.clear(); } - catch (XMPPException ex) + try { - failedUsers.add(user); - LOGGER.removeHandler(XMPPManager.this); - LOGGER.log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex); + Thread.sleep(2000); + } + catch (InterruptedException ex) + { + threadrunning = false; } } - logUsers.removeAll(failedUsers); - if (logUsers.isEmpty()) - { - LOGGER.removeHandler(XMPPManager.this); - threadrunning = false; - } - copy.clear(); - } - try - { - Thread.sleep(2000); + LOGGER.removeHandler(XMPPManager.this); } - catch (InterruptedException ex) - { - threadrunning = false; - } - } - LOGGER.removeHandler(XMPPManager.this); - } - }); + }); loggerThread.start(); } |