Connect accept WIP, refactoring again...

This commit is contained in:
Norbi Peti 2016-10-28 22:19:55 +02:00
parent 267555848c
commit d30964bec8
3 changed files with 71 additions and 0 deletions

View 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
}
}

View file

@ -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;
}
}

View file

@ -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();
}