commit
c5192f5873
7 changed files with 632 additions and 572 deletions
1
lombok.config
Normal file
1
lombok.config
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lombok.var.flagUsage = ALLOW
|
|
@ -57,6 +57,16 @@ public class ChromaBot {
|
||||||
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, embed));
|
MCChatListener.forAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, embed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message to the chat channels, private chats and custom chats.
|
||||||
|
*
|
||||||
|
* @param message The message to send, duh
|
||||||
|
* @param embed Custom fancy stuff, use {@link EmbedBuilder} to create one
|
||||||
|
*/
|
||||||
|
public void sendMessageCustomAsWell(String message, EmbedObject embed) {
|
||||||
|
MCChatListener.forCustomAndAllMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message, embed));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to an arbitrary channel. This will not send it to the private chats.
|
* Send a message to an arbitrary channel. This will not send it to the private chats.
|
||||||
*
|
*
|
||||||
|
|
|
@ -158,17 +158,17 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
|
|
||||||
DiscordCommandBase.registerCommands();
|
DiscordCommandBase.registerCommands();
|
||||||
if (ResetMCCommand.resetting)
|
if (ResetMCCommand.resetting)
|
||||||
ChromaBot.getInstance().sendMessage("", new EmbedBuilder().withColor(Color.CYAN)
|
ChromaBot.getInstance().sendMessageCustomAsWell("", new EmbedBuilder().withColor(Color.CYAN)
|
||||||
.withTitle("Discord plugin restarted - chat connected.").build()); //Really important to note the chat, hmm
|
.withTitle("Discord plugin restarted - chat connected.").build()); //Really important to note the chat, hmm
|
||||||
else if (getConfig().getBoolean("serverup", false)) {
|
else if (getConfig().getBoolean("serverup", false)) {
|
||||||
ChromaBot.getInstance().sendMessage("", new EmbedBuilder().withColor(Color.YELLOW)
|
ChromaBot.getInstance().sendMessageCustomAsWell("", new EmbedBuilder().withColor(Color.YELLOW)
|
||||||
.withTitle("Server recovered from a crash - chat connected.").build());
|
.withTitle("Server recovered from a crash - chat connected.").build());
|
||||||
val thr = new Throwable(
|
val thr = new Throwable(
|
||||||
"The server shut down unexpectedly. See the log of the previous run for more details.");
|
"The server shut down unexpectedly. See the log of the previous run for more details.");
|
||||||
thr.setStackTrace(new StackTraceElement[0]);
|
thr.setStackTrace(new StackTraceElement[0]);
|
||||||
TBMCCoreAPI.SendException("The server crashed!", thr);
|
TBMCCoreAPI.SendException("The server crashed!", thr);
|
||||||
} else
|
} else
|
||||||
ChromaBot.getInstance().sendMessage("", new EmbedBuilder().withColor(Color.GREEN)
|
ChromaBot.getInstance().sendMessageCustomAsWell("", new EmbedBuilder().withColor(Color.GREEN)
|
||||||
.withTitle("Server started - chat connected.").build());
|
.withTitle("Server started - chat connected.").build());
|
||||||
|
|
||||||
ResetMCCommand.resetting = false; //This is the last event handling this flag
|
ResetMCCommand.resetting = false; //This is the last event handling this flag
|
||||||
|
@ -242,7 +242,8 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
stop = true;
|
stop = true;
|
||||||
for (val entry : MCChatListener.ConnectedSenders.entrySet())
|
for (val entry : MCChatListener.ConnectedSenders.entrySet())
|
||||||
MCListener.callEventExcludingSome(new PlayerQuitEvent(entry.getValue(), ""));
|
for (val valueEntry : entry.getValue().entrySet())
|
||||||
|
MCListener.callEventExcludingSome(new PlayerQuitEvent(valueEntry.getValue(), ""));
|
||||||
MCChatListener.ConnectedSenders.clear();
|
MCChatListener.ConnectedSenders.clear();
|
||||||
getConfig().set("lastannouncementtime", lastannouncementtime);
|
getConfig().set("lastannouncementtime", lastannouncementtime);
|
||||||
getConfig().set("lastseentime", lastseentime);
|
getConfig().set("lastseentime", lastseentime);
|
||||||
|
@ -261,7 +262,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
MCChatListener.forAllMCChat(ch -> {
|
MCChatListener.forCustomAndAllMCChat(ch -> {
|
||||||
try {
|
try {
|
||||||
if (ResetMCCommand.resetting)
|
if (ResetMCCommand.resetting)
|
||||||
DiscordPlugin.sendMessageToChannelWait(ch, "",
|
DiscordPlugin.sendMessageToChannelWait(ch, "",
|
||||||
|
|
|
@ -2,10 +2,7 @@ package buttondevteam.discordplugin.listeners;
|
||||||
|
|
||||||
import buttondevteam.discordplugin.*;
|
import buttondevteam.discordplugin.*;
|
||||||
import buttondevteam.discordplugin.playerfaker.VanillaCommandListener;
|
import buttondevteam.discordplugin.playerfaker.VanillaCommandListener;
|
||||||
import buttondevteam.lib.TBMCChatEvent;
|
import buttondevteam.lib.*;
|
||||||
import buttondevteam.lib.TBMCChatPreprocessEvent;
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import buttondevteam.lib.chat.ChatMessage;
|
import buttondevteam.lib.chat.ChatMessage;
|
||||||
import buttondevteam.lib.chat.ChatRoom;
|
import buttondevteam.lib.chat.ChatRoom;
|
||||||
|
@ -15,8 +12,10 @@ import com.vdurmont.emoji.EmojiParser;
|
||||||
import io.netty.util.collection.LongObjectHashMap;
|
import io.netty.util.collection.LongObjectHashMap;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.experimental.var;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -227,11 +226,11 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
val op = Bukkit.getOfflinePlayer(mcp.getUUID());
|
val op = Bukkit.getOfflinePlayer(mcp.getUUID());
|
||||||
if (start) {
|
if (start) {
|
||||||
val sender = new DiscordConnectedPlayer(user, channel, mcp.getUUID(), op.getName());
|
val sender = new DiscordConnectedPlayer(user, channel, mcp.getUUID(), op.getName());
|
||||||
ConnectedSenders.put(user.getStringID(), sender);
|
addSender(ConnectedSenders, user, sender);
|
||||||
if (p == null)// Player is offline - If the player is online, that takes precedence
|
if (p == null)// Player is offline - If the player is online, that takes precedence
|
||||||
MCListener.callEventExcludingSome(new PlayerJoinEvent(sender, ""));
|
MCListener.callEventExcludingSome(new PlayerJoinEvent(sender, ""));
|
||||||
} else {
|
} else {
|
||||||
val sender = ConnectedSenders.remove(user.getStringID());
|
val sender = removeSender(ConnectedSenders, channel, user);
|
||||||
if (p == null)// Player is offline - If the player is online, that takes precedence
|
if (p == null)// Player is offline - If the player is online, that takes precedence
|
||||||
MCListener.callEventExcludingSome(new PlayerQuitEvent(sender, ""));
|
MCListener.callEventExcludingSome(new PlayerQuitEvent(sender, ""));
|
||||||
}
|
}
|
||||||
|
@ -243,6 +242,37 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
: lastmsgPerUser.removeIf(lmd -> lmd.channel.getLongID() == channel.getLongID());
|
: lastmsgPerUser.removeIf(lmd -> lmd.channel.getLongID() == channel.getLongID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T extends DiscordSenderBase> T addSender(HashMap<String, HashMap<IChannel, T>> senders,
|
||||||
|
IUser user, T sender) {
|
||||||
|
return addSender(senders, user.getStringID(), sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends DiscordSenderBase> T addSender(HashMap<String, HashMap<IChannel, T>> senders,
|
||||||
|
String did, T sender) {
|
||||||
|
var map = senders.get(did);
|
||||||
|
if (map == null)
|
||||||
|
map = new HashMap<>();
|
||||||
|
map.put(sender.getChannel(), sender);
|
||||||
|
senders.put(did, map);
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends DiscordSenderBase> T getSender(HashMap<String, HashMap<IChannel, T>> senders,
|
||||||
|
IChannel channel, IUser user) {
|
||||||
|
var map = senders.get(user.getStringID());
|
||||||
|
if (map != null)
|
||||||
|
return map.get(channel);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends DiscordSenderBase> T removeSender(HashMap<String, HashMap<IChannel, T>> senders,
|
||||||
|
IChannel channel, IUser user) {
|
||||||
|
var map = senders.get(user.getStringID());
|
||||||
|
if (map != null)
|
||||||
|
return map.remove(channel);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// ......................DiscordSender....DiscordConnectedPlayer.DiscordPlayerSender
|
// ......................DiscordSender....DiscordConnectedPlayer.DiscordPlayerSender
|
||||||
// Offline public chat......x............................................
|
// Offline public chat......x............................................
|
||||||
// Online public chat.......x...........................................x
|
// Online public chat.......x...........................................x
|
||||||
|
@ -255,8 +285,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
// The maps may not contain the senders for UnconnectedSenders
|
// The maps may not contain the senders for UnconnectedSenders
|
||||||
|
|
||||||
public static boolean isMinecraftChatEnabled(DiscordPlayer dp) {
|
public static boolean isMinecraftChatEnabled(DiscordPlayer dp) {
|
||||||
return lastmsgPerUser.stream().anyMatch(
|
return isMinecraftChatEnabled(dp.getDiscordID());
|
||||||
lmd -> ((IPrivateChannel) lmd.channel).getRecipient().getStringID().equals(dp.getDiscordID()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMinecraftChatEnabled(String did) { // Don't load the player data just for this
|
public static boolean isMinecraftChatEnabled(String did) { // Don't load the player data just for this
|
||||||
|
@ -289,12 +318,12 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
/**
|
/**
|
||||||
* May contain P<DiscordID> as key for public chat
|
* May contain P<DiscordID> as key for public chat
|
||||||
*/
|
*/
|
||||||
public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>();
|
public static final HashMap<String, HashMap<IChannel, DiscordSender>> UnconnectedSenders = new HashMap<>();
|
||||||
public static final HashMap<String, DiscordConnectedPlayer> ConnectedSenders = new HashMap<>();
|
public static final HashMap<String, HashMap<IChannel, DiscordConnectedPlayer>> ConnectedSenders = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* May contain P<DiscordID> as key for public chat
|
* May contain P<DiscordID> as key for public chat
|
||||||
*/
|
*/
|
||||||
public static final HashMap<String, DiscordPlayerSender> OnlineSenders = new HashMap<>();
|
public static final HashMap<String, HashMap<IChannel, DiscordPlayerSender>> OnlineSenders = new HashMap<>();
|
||||||
public static short ListC = 0;
|
public static short ListC = 0;
|
||||||
|
|
||||||
public static void resetLastMessage() {
|
public static void resetLastMessage() {
|
||||||
|
@ -330,9 +359,22 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
action.accept(DiscordPlugin.chatchannel);
|
action.accept(DiscordPlugin.chatchannel);
|
||||||
for (LastMsgData data : lastmsgPerUser)
|
for (LastMsgData data : lastmsgPerUser)
|
||||||
action.accept(data.channel);
|
action.accept(data.channel);
|
||||||
|
// lastmsgCustom.forEach(cc -> action.accept(cc.channel)); - Only send relevant messages to custom chat
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void forCustomAndAllMCChat(Consumer<IChannel> action) {
|
||||||
|
forAllMCChat(action);
|
||||||
lastmsgCustom.forEach(cc -> action.accept(cc.channel));
|
lastmsgCustom.forEach(cc -> action.accept(cc.channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void forAllowedCustomMCChat(Consumer<IChannel> action, CommandSender sender) {
|
||||||
|
lastmsgCustom.stream().filter(clmd -> {
|
||||||
|
//new TBMCChannelConnectFakeEvent(sender, clmd.mcchannel).shouldSendTo(clmd.dcp) - Thought it was this simple hehe - Wait, it *should* be this simple
|
||||||
|
val e = new TBMCChannelConnectFakeEvent(sender, clmd.mcchannel);
|
||||||
|
return clmd.groupID.equals(e.getGroupID(sender));
|
||||||
|
}).forEach(cc -> action.accept(cc.channel)); //TODO: Use getScore and getGroupID in fake event constructor - This should also send error messages on channel connect
|
||||||
|
}
|
||||||
|
|
||||||
private static void forAllowedMCChat(Consumer<IChannel> action, TBMCSystemChatEvent event) {
|
private static void forAllowedMCChat(Consumer<IChannel> action, TBMCSystemChatEvent event) {
|
||||||
if (Channel.GlobalChat.ID.equals(event.getChannel().ID))
|
if (Channel.GlobalChat.ID.equals(event.getChannel().ID))
|
||||||
action.accept(DiscordPlugin.chatchannel);
|
action.accept(DiscordPlugin.chatchannel);
|
||||||
|
@ -596,14 +638,13 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
* This method will find the best sender to use: if the player is online, use that, if not but connected then use that etc.
|
* This method will find the best sender to use: if the player is online, use that, if not but connected then use that etc.
|
||||||
*/
|
*/
|
||||||
private static DiscordSenderBase getSender(IChannel channel, final IUser author) {
|
private static DiscordSenderBase getSender(IChannel channel, final IUser author) {
|
||||||
val key = (channel.isPrivate() ? "" : "P") + author.getStringID();
|
val key = author.getStringID();
|
||||||
return Stream.<Supplier<Optional<DiscordSenderBase>>>of( // https://stackoverflow.com/a/28833677/2703239
|
return Stream.<Supplier<Optional<DiscordSenderBase>>>of( // https://stackoverflow.com/a/28833677/2703239
|
||||||
() -> Optional.ofNullable(OnlineSenders.get(key)), // Find first non-null
|
() -> Optional.ofNullable(getSender(OnlineSenders, channel, author)), // Find first non-null
|
||||||
() -> Optional.ofNullable(ConnectedSenders.get(key)), // This doesn't support the public chat, but it'll always return null for it
|
() -> Optional.ofNullable(getSender(ConnectedSenders, channel, author)), // This doesn't support the public chat, but it'll always return null for it
|
||||||
() -> Optional.ofNullable(UnconnectedSenders.get(key)), () -> {
|
() -> Optional.ofNullable(getSender(OnlineSenders, channel, author)), () -> {
|
||||||
val dsender = new DiscordSender(author, channel);
|
return Optional.of(addSender(UnconnectedSenders, author,
|
||||||
UnconnectedSenders.put(key, dsender);
|
new DiscordSender(author, channel)));
|
||||||
return Optional.of(dsender);
|
|
||||||
}).map(Supplier::get).filter(Optional::isPresent).map(Optional::get).findFirst().get();
|
}).map(Supplier::get).filter(Optional::isPresent).map(Optional::get).findFirst().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class MCListener implements Listener {
|
||||||
public void onPlayerLogin(PlayerLoginEvent e) {
|
public void onPlayerLogin(PlayerLoginEvent e) {
|
||||||
if (e.getResult() != Result.ALLOWED)
|
if (e.getResult() != Result.ALLOWED)
|
||||||
return;
|
return;
|
||||||
MCChatListener.ConnectedSenders.values().stream()
|
MCChatListener.ConnectedSenders.values().stream().flatMap(v -> v.values().stream()) //Only private mcchat should be in ConnectedSenders
|
||||||
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
|
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
|
||||||
.ifPresent(dcp -> callEventExcludingSome(new PlayerQuitEvent(dcp, "")));
|
.ifPresent(dcp -> callEventExcludingSome(new PlayerQuitEvent(dcp, "")));
|
||||||
}
|
}
|
||||||
|
@ -50,10 +50,10 @@ public class MCListener implements Listener {
|
||||||
DiscordPlayer dp = e.GetPlayer().getAs(DiscordPlayer.class);
|
DiscordPlayer dp = e.GetPlayer().getAs(DiscordPlayer.class);
|
||||||
if (dp != null) {
|
if (dp != null) {
|
||||||
val user = DiscordPlugin.dc.getUserByID(Long.parseLong(dp.getDiscordID()));
|
val user = DiscordPlugin.dc.getUserByID(Long.parseLong(dp.getDiscordID()));
|
||||||
MCChatListener.OnlineSenders.put(dp.getDiscordID(),
|
MCChatListener.addSender(MCChatListener.OnlineSenders, dp.getDiscordID(),
|
||||||
new DiscordPlayerSender(user, user.getOrCreatePMChannel(), p));
|
new DiscordPlayerSender(user, user.getOrCreatePMChannel(), p));
|
||||||
MCChatListener.OnlineSenders.put("P" + dp.getDiscordID(),
|
MCChatListener.addSender(MCChatListener.OnlineSenders, dp.getDiscordID(),
|
||||||
new DiscordPlayerSender(user, DiscordPlugin.chatchannel, p));
|
new DiscordPlayerSender(user, DiscordPlugin.chatchannel, p)); //Stored per-channel
|
||||||
}
|
}
|
||||||
if (ConnectCommand.WaitingToConnect.containsKey(e.GetPlayer().PlayerName().get())) {
|
if (ConnectCommand.WaitingToConnect.containsKey(e.GetPlayer().PlayerName().get())) {
|
||||||
IUser user = DiscordPlugin.dc
|
IUser user = DiscordPlugin.dc
|
||||||
|
@ -62,8 +62,10 @@ public class MCListener implements Listener {
|
||||||
+ " do /discord accept");
|
+ " do /discord accept");
|
||||||
p.sendMessage("§bIf it wasn't you, do /discord decline");
|
p.sendMessage("§bIf it wasn't you, do /discord decline");
|
||||||
}
|
}
|
||||||
|
final String message = e.GetPlayer().PlayerName().get() + " joined the game";
|
||||||
if (!DiscordPlugin.hooked)
|
if (!DiscordPlugin.hooked)
|
||||||
MCChatListener.sendSystemMessageToChat(e.GetPlayer().PlayerName().get() + " joined the game");
|
MCChatListener.sendSystemMessageToChat(message);
|
||||||
|
MCChatListener.forAllowedCustomMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message), e.getPlayer());
|
||||||
MCChatListener.ListC = 0;
|
MCChatListener.ListC = 0;
|
||||||
ChromaBot.getInstance().updatePlayerList();
|
ChromaBot.getInstance().updatePlayerList();
|
||||||
});
|
});
|
||||||
|
@ -74,13 +76,17 @@ public class MCListener implements Listener {
|
||||||
if (e.getPlayer() instanceof DiscordConnectedPlayer)
|
if (e.getPlayer() instanceof DiscordConnectedPlayer)
|
||||||
return; // Only care about real users
|
return; // Only care about real users
|
||||||
MCChatListener.OnlineSenders.entrySet()
|
MCChatListener.OnlineSenders.entrySet()
|
||||||
.removeIf(entry -> entry.getValue().getUniqueId().equals(e.getPlayer().getUniqueId()));
|
.removeIf(entry -> entry.getValue().entrySet().stream().anyMatch(p -> p.getValue().getUniqueId().equals(e.getPlayer().getUniqueId())));
|
||||||
Bukkit.getScheduler().runTask(DiscordPlugin.plugin,
|
Bukkit.getScheduler().runTask(DiscordPlugin.plugin,
|
||||||
() -> MCChatListener.ConnectedSenders.values().stream()
|
() -> MCChatListener.ConnectedSenders.values().stream().flatMap(v -> v.values().stream())
|
||||||
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
|
.filter(s -> s.getUniqueId().equals(e.getPlayer().getUniqueId())).findAny()
|
||||||
.ifPresent(dcp -> callEventExcludingSome(new PlayerJoinEvent(dcp, ""))));
|
.ifPresent(dcp -> callEventExcludingSome(new PlayerJoinEvent(dcp, ""))));
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin,
|
Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin,
|
||||||
ChromaBot.getInstance()::updatePlayerList, 5);
|
ChromaBot.getInstance()::updatePlayerList, 5);
|
||||||
|
final String message = e.GetPlayer().PlayerName().get() + " left the game";
|
||||||
|
if (!DiscordPlugin.hooked)
|
||||||
|
MCChatListener.sendSystemMessageToChat(message); //TODO: Probably double sends if kicked and unhooked
|
||||||
|
MCChatListener.forAllowedCustomMCChat(ch -> DiscordPlugin.sendMessageToChannel(ch, message), e.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
@ -111,7 +117,7 @@ public class MCListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerAFK(AfkStatusChangeEvent e) {
|
public void onPlayerAFK(AfkStatusChangeEvent e) { //TODO: Add AFK to custom chats?
|
||||||
if (e.isCancelled() || !e.getAffected().getBase().isOnline())
|
if (e.isCancelled() || !e.getAffected().getBase().isOnline())
|
||||||
return;
|
return;
|
||||||
MCChatListener.sendSystemMessageToChat(DPUtils.sanitizeString(e.getAffected().getBase().getDisplayName())
|
MCChatListener.sendSystemMessageToChat(DPUtils.sanitizeString(e.getAffected().getBase().getDisplayName())
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class AcceptMCCommand extends DiscordMCCommandBase {
|
||||||
dp.save();
|
dp.save();
|
||||||
mcp.save();
|
mcp.save();
|
||||||
ConnectCommand.WaitingToConnect.remove(player.getName());
|
ConnectCommand.WaitingToConnect.remove(player.getName());
|
||||||
MCChatListener.UnconnectedSenders.remove(did);
|
MCChatListener.UnconnectedSenders.remove(did); //Remove all unconnected, will be recreated where needed
|
||||||
player.sendMessage("§bAccounts connected.");
|
player.sendMessage("§bAccounts connected.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import sx.blah.discord.handle.obj.IUser;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
|
||||||
protected DiscordFakePlayer(IUser user, IChannel channel, int entityId, UUID uuid, String mcname) {
|
protected DiscordFakePlayer(IUser user, IChannel channel, int entityId, UUID uuid, String mcname) {
|
||||||
super(user, channel, entityId, uuid);
|
super(user, channel, entityId, uuid);
|
||||||
|
|
Loading…
Reference in a new issue