Fix errors for console

This commit is contained in:
kosgan10 2013-12-30 15:36:35 +02:00
parent c184667a26
commit 93ba9b3a3e

View File

@ -1,16 +1,15 @@
package net.md_5.bungee.command;
import com.google.common.base.Joiner;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.chat.ComponentSerializer;
import java.util.Arrays;
import com.google.common.base.Joiner;
public class CommandAlertRaw extends Command
{
@ -34,6 +33,8 @@ public class CommandAlertRaw extends Command
{
ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) );
} catch ( Exception e )
{
if ( sender instanceof ProxiedPlayer )
{
sender.sendMessage(
new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ).
@ -41,6 +42,10 @@ public class CommandAlertRaw extends Command
event( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder( e.getMessage() ).color( ChatColor.RED ).create() ) ).
create() );
} else
{
sender.sendMessage(ChatColor.RED + "An error occurred while parsing your message. " + e.getMessage());
}
}
}
}