Connect accept WIP, refactoring again...
This commit is contained in:
parent
267555848c
commit
d30964bec8
3 changed files with 71 additions and 0 deletions
11
src/main/java/buttondevteam/discordplugin/DiscordPlayer.java
Normal file
11
src/main/java/buttondevteam/discordplugin/DiscordPlayer.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package buttondevteam.discordplugin;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
|
||||||
|
public class DiscordPlayer {
|
||||||
|
private TBMCPlayer player;
|
||||||
|
|
||||||
|
public String getDiscordID() {
|
||||||
|
return null; // TODO: Return player.getData("discordid") or similar
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package buttondevteam.discordplugin.mccommands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.DiscordPlayer;
|
||||||
|
import buttondevteam.discordplugin.commands.ConnectCommand;
|
||||||
|
|
||||||
|
public class AcceptMCCommand extends DiscordMCCommandBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetDiscordCommandPath() {
|
||||||
|
return "connect";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[] { //
|
||||||
|
"§6---- Accept Discord connection ----", //
|
||||||
|
"Accept a pending connection between your Discord and Minecraft account.", //
|
||||||
|
"To start the connection process, do §b@ChromaBot connect <MCname>§r in the #bot channel on Discord", //
|
||||||
|
"Usage: /" + alias + " accept" //
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
String did = ConnectCommand.WaitingToConnect.get(sender.getName());
|
||||||
|
if (did == null) {
|
||||||
|
sender.sendMessage("§cYou don't have a pending connection to Discord.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
new DiscordPlayer(did); // TODO: Add to player storage
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package buttondevteam.discordplugin.mccommands;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
public abstract class DiscordMCCommandBase extends TBMCCommandBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "discord/" + GetDiscordCommandPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String GetDiscordCommandPath();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue