mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 11:15:47 +01:00
commit
28c8bf47ff
@ -1,16 +1,15 @@
|
|||||||
package net.md_5.bungee.command;
|
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.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
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.api.plugin.Command;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import com.google.common.base.Joiner;
|
||||||
|
|
||||||
public class CommandAlertRaw extends Command
|
public class CommandAlertRaw extends Command
|
||||||
{
|
{
|
||||||
@ -35,12 +34,23 @@ public class CommandAlertRaw extends Command
|
|||||||
ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) );
|
ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) );
|
||||||
} catch ( Exception e )
|
} catch ( Exception e )
|
||||||
{
|
{
|
||||||
sender.sendMessage(
|
Throwable error = e;
|
||||||
new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ).
|
while ( error.getCause() != null )
|
||||||
color( ChatColor.RED ).underlined( true ).
|
{
|
||||||
event( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
|
error = error.getCause();
|
||||||
new ComponentBuilder( e.getMessage() ).color( ChatColor.RED ).create() ) ).
|
}
|
||||||
create() );
|
if ( sender instanceof ProxiedPlayer )
|
||||||
|
{
|
||||||
|
sender.sendMessage(
|
||||||
|
new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ).
|
||||||
|
color( ChatColor.RED ).underlined( true ).
|
||||||
|
event( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
|
||||||
|
new ComponentBuilder( error.getMessage() ).color( ChatColor.RED ).create() ) ).
|
||||||
|
create() );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
sender.sendMessage(new ComponentBuilder( "An error occurred while parsing your message: " ).color( ChatColor.RED ).append( error.getMessage() ).create() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user