Fixes and applied changes from the Core
This commit is contained in:
parent
b95b9092f5
commit
e7963e4f9a
6 changed files with 13 additions and 11 deletions
|
@ -11,11 +11,8 @@ public class DiscordPlayer extends ChromaGamerBase {
|
|||
}
|
||||
|
||||
public String getDiscordID() {
|
||||
return did;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
if (did == null)
|
||||
did = plugindata.getString(getFolder() + "_id");
|
||||
return did;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
||||
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
||||
TBMCCoreAPI.RegisterUserClass(DiscordPlayer.class);
|
||||
new Thread(() -> AnnouncementGetterThreadMethod()).start();
|
||||
setupProviders();
|
||||
TBMCCoreAPI.SendUnsentExceptions();
|
||||
|
|
|
@ -21,6 +21,8 @@ public class CommandListener {
|
|||
final IChannel channel = event.getMessage().getChannel();
|
||||
if (!channel.getID().equals(DiscordPlugin.botchannel.getID()) && !channel.isPrivate())
|
||||
return;
|
||||
if (channel.getID().equals(DiscordPlugin.chatchannel.getID()))
|
||||
return; // The chat code already handles this - Right now while testing botchannel is the same as chatchannel
|
||||
runCommand(event.getMessage(), true);
|
||||
}
|
||||
}, new IListener<MessageReceivedEvent>() {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
|||
TBMCPlayer p = dp.getAs(TBMCPlayer.class);
|
||||
if (!UnconnectedSenders.containsKey(author.getID()))
|
||||
UnconnectedSenders.put(author.getID(), new DiscordSender(author, event.getMessage().getChannel(),
|
||||
p == null ? null : p.getPlayerName())); // Display the playername, if found
|
||||
p == null ? null : p.PlayerName().get())); // Display the playername, if found
|
||||
dsender = UnconnectedSenders.get(author.getID());
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ public class MCListener implements Listener {
|
|||
if (DiscordPlugin.SafeMode)
|
||||
return;
|
||||
DiscordPlayer dp = e.getPlayer().getAs(DiscordPlayer.class);
|
||||
/*System.out.println("dp: " + dp);
|
||||
if (dp != null)
|
||||
System.out.println("dp.did: " + dp.getDiscordID());*/
|
||||
if (dp == null || dp.getDiscordID() == null || dp.getDiscordID() == "")
|
||||
return;
|
||||
IUser user = DiscordPlugin.dc.getUserByID(dp.getDiscordID());
|
||||
|
@ -73,8 +76,7 @@ public class MCListener implements Listener {
|
|||
DiscordPlugin.Restart = !e.getCommand().equalsIgnoreCase("stop"); // The variable is always true except if stopped
|
||||
}
|
||||
|
||||
/*@EventHandler
|
||||
public void onPlayerMute(MuteStatusChangeEvent e) {
|
||||
e.getAffected()
|
||||
}*/
|
||||
/*
|
||||
* @EventHandler public void onPlayerMute(MuteStatusChangeEvent e) { e.getAffected() }
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AcceptMCCommand extends DiscordMCCommandBase {
|
|||
}
|
||||
DiscordPlayer dp = ChromaGamerBase.getUser(did, DiscordPlayer.class);
|
||||
TBMCPlayer mcp = TBMCPlayerBase.getPlayer(((Player) sender).getUniqueId(), TBMCPlayer.class);
|
||||
dp.connectWith(mcp); // TODO: Fix null.yml and empty playerinfos
|
||||
dp.connectWith(mcp);
|
||||
dp.save();
|
||||
mcp.save();
|
||||
ConnectCommand.WaitingToConnect.remove(sender.getName());
|
||||
|
|
Loading…
Reference in a new issue