Fixes & fromcmd
- Exception handling got extra parenthesis - Async player join event handling - Added fromcmd check (shows /tableflip and similar)
This commit is contained in:
parent
aabdd3a914
commit
b350be608a
3 changed files with 25 additions and 23 deletions
|
@ -23,8 +23,8 @@ public class ExceptionListener implements Listener {
|
||||||
return;
|
return;
|
||||||
if (lastthrown.stream()
|
if (lastthrown.stream()
|
||||||
.anyMatch(ex -> Arrays.equals(e.getException().getStackTrace(), ex.getStackTrace())
|
.anyMatch(ex -> Arrays.equals(e.getException().getStackTrace(), ex.getStackTrace())
|
||||||
&& e.getException().getMessage() == null ? ex.getMessage() == null
|
&& (e.getException().getMessage() == null ? ex.getMessage() == null
|
||||||
: e.getException().getMessage().equals(ex.getMessage())) // e.Exception.Message==ex.Message
|
: e.getException().getMessage().equals(ex.getMessage()))) // e.Exception.Message==ex.Message
|
||||||
&& lastsourcemsg.contains(e.getSourceMessage()))
|
&& lastsourcemsg.contains(e.getSourceMessage()))
|
||||||
return;
|
return;
|
||||||
SendException(e.getException(), e.getSourceMessage());
|
SendException(e.getException(), e.getSourceMessage());
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
|| ((DiscordSenderBase) e.getSender()).getChannel().getLongID() != ch.getLongID();
|
|| ((DiscordSenderBase) e.getSender()).getChannel().getLongID() != ch.getLongID();
|
||||||
|
|
||||||
if ((e.getChannel() == Channel.GlobalChat || e.getChannel().ID.equals("rp"))
|
if ((e.getChannel() == Channel.GlobalChat || e.getChannel().ID.equals("rp"))
|
||||||
&& isdifferentchannel.test(DiscordPlugin.chatchannel))
|
&& (!e.isFromcmd() || isdifferentchannel.test(DiscordPlugin.chatchannel)))
|
||||||
doit.accept(lastmsgdata == null
|
doit.accept(lastmsgdata == null
|
||||||
? lastmsgdata = new LastMsgData(DiscordPlugin.chatchannel, null, null)
|
? lastmsgdata = new LastMsgData(DiscordPlugin.chatchannel, null, null)
|
||||||
: lastmsgdata);
|
: lastmsgdata);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class MCListener implements Listener {
|
||||||
public void onPlayerJoin(TBMCPlayerJoinEvent e) {
|
public void onPlayerJoin(TBMCPlayerJoinEvent e) {
|
||||||
if (e.getPlayer() instanceof DiscordConnectedPlayer)
|
if (e.getPlayer() instanceof DiscordConnectedPlayer)
|
||||||
return; // Don't show the joined message for the fake player
|
return; // Don't show the joined message for the fake player
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(DiscordPlugin.plugin, () -> {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
DiscordPlayer dp = e.GetPlayer().getAs(DiscordPlayer.class);
|
DiscordPlayer dp = e.GetPlayer().getAs(DiscordPlayer.class);
|
||||||
if (dp != null) {
|
if (dp != null) {
|
||||||
|
@ -65,6 +66,7 @@ public class MCListener implements Listener {
|
||||||
MCChatListener.sendSystemMessageToChat(e.GetPlayer().PlayerName().get() + " joined the game");
|
MCChatListener.sendSystemMessageToChat(e.GetPlayer().PlayerName().get() + " joined the game");
|
||||||
MCChatListener.ListC = 0;
|
MCChatListener.ListC = 0;
|
||||||
ChromaBot.getInstance().updatePlayerList();
|
ChromaBot.getInstance().updatePlayerList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
|
Loading…
Reference in a new issue