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() {
|
public String getDiscordID() {
|
||||||
return did;
|
if (did == null)
|
||||||
}
|
did = plugindata.getString(getFolder() + "_id");
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFileName() {
|
|
||||||
return did;
|
return did;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
|
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
||||||
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
||||||
|
TBMCCoreAPI.RegisterUserClass(DiscordPlayer.class);
|
||||||
new Thread(() -> AnnouncementGetterThreadMethod()).start();
|
new Thread(() -> AnnouncementGetterThreadMethod()).start();
|
||||||
setupProviders();
|
setupProviders();
|
||||||
TBMCCoreAPI.SendUnsentExceptions();
|
TBMCCoreAPI.SendUnsentExceptions();
|
||||||
|
|
|
@ -21,6 +21,8 @@ public class CommandListener {
|
||||||
final IChannel channel = event.getMessage().getChannel();
|
final IChannel channel = event.getMessage().getChannel();
|
||||||
if (!channel.getID().equals(DiscordPlugin.botchannel.getID()) && !channel.isPrivate())
|
if (!channel.getID().equals(DiscordPlugin.botchannel.getID()) && !channel.isPrivate())
|
||||||
return;
|
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);
|
runCommand(event.getMessage(), true);
|
||||||
}
|
}
|
||||||
}, new IListener<MessageReceivedEvent>() {
|
}, new IListener<MessageReceivedEvent>() {
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
||||||
TBMCPlayer p = dp.getAs(TBMCPlayer.class);
|
TBMCPlayer p = dp.getAs(TBMCPlayer.class);
|
||||||
if (!UnconnectedSenders.containsKey(author.getID()))
|
if (!UnconnectedSenders.containsKey(author.getID()))
|
||||||
UnconnectedSenders.put(author.getID(), new DiscordSender(author, event.getMessage().getChannel(),
|
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());
|
dsender = UnconnectedSenders.get(author.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ public class MCListener implements Listener {
|
||||||
if (DiscordPlugin.SafeMode)
|
if (DiscordPlugin.SafeMode)
|
||||||
return;
|
return;
|
||||||
DiscordPlayer dp = e.getPlayer().getAs(DiscordPlayer.class);
|
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() == "")
|
if (dp == null || dp.getDiscordID() == null || dp.getDiscordID() == "")
|
||||||
return;
|
return;
|
||||||
IUser user = DiscordPlugin.dc.getUserByID(dp.getDiscordID());
|
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
|
DiscordPlugin.Restart = !e.getCommand().equalsIgnoreCase("stop"); // The variable is always true except if stopped
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@EventHandler
|
/*
|
||||||
public void onPlayerMute(MuteStatusChangeEvent e) {
|
* @EventHandler public void onPlayerMute(MuteStatusChangeEvent e) { e.getAffected() }
|
||||||
e.getAffected()
|
*/
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class AcceptMCCommand extends DiscordMCCommandBase {
|
||||||
}
|
}
|
||||||
DiscordPlayer dp = ChromaGamerBase.getUser(did, DiscordPlayer.class);
|
DiscordPlayer dp = ChromaGamerBase.getUser(did, DiscordPlayer.class);
|
||||||
TBMCPlayer mcp = TBMCPlayerBase.getPlayer(((Player) sender).getUniqueId(), TBMCPlayer.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();
|
dp.save();
|
||||||
mcp.save();
|
mcp.save();
|
||||||
ConnectCommand.WaitingToConnect.remove(sender.getName());
|
ConnectCommand.WaitingToConnect.remove(sender.getName());
|
||||||
|
|
Loading…
Reference in a new issue