Added commands
This commit is contained in:
parent
d30964bec8
commit
e6829fb7c9
4 changed files with 106 additions and 7 deletions
|
@ -2,10 +2,12 @@ package buttondevteam.discordplugin;
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCPlayer;
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
|
||||||
public class DiscordPlayer {
|
public class DiscordPlayer extends TBMCPlayer {
|
||||||
private TBMCPlayer player;
|
|
||||||
|
|
||||||
public String getDiscordID() {
|
public String getDiscordID() {
|
||||||
return null; // TODO: Return player.getData("discordid") or similar
|
return getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDiscrodID(String id) {
|
||||||
|
setData(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package buttondevteam.discordplugin.mccommands;
|
package buttondevteam.discordplugin.mccommands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.discordplugin.DiscordPlayer;
|
import buttondevteam.discordplugin.DiscordPlayer;
|
||||||
import buttondevteam.discordplugin.commands.ConnectCommand;
|
import buttondevteam.discordplugin.commands.ConnectCommand;
|
||||||
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
|
||||||
public class AcceptMCCommand extends DiscordMCCommandBase {
|
public class AcceptMCCommand extends DiscordMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetDiscordCommandPath() {
|
public String GetDiscordCommandPath() {
|
||||||
return "connect";
|
return "accept";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,9 +39,9 @@ public class AcceptMCCommand extends DiscordMCCommandBase {
|
||||||
String did = ConnectCommand.WaitingToConnect.get(sender.getName());
|
String did = ConnectCommand.WaitingToConnect.get(sender.getName());
|
||||||
if (did == null) {
|
if (did == null) {
|
||||||
sender.sendMessage("§cYou don't have a pending connection to Discord.");
|
sender.sendMessage("§cYou don't have a pending connection to Discord.");
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
new DiscordPlayer(did); // TODO: Add to player storage
|
TBMCPlayer.getPlayerAs((Player) sender, DiscordPlayer.class).setDiscrodID(did);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package buttondevteam.discordplugin.mccommands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.DiscordPlayer;
|
||||||
|
import buttondevteam.discordplugin.commands.ConnectCommand;
|
||||||
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
|
||||||
|
public class DeclineMCCommand extends DiscordMCCommandBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetDiscordCommandPath() {
|
||||||
|
return "decline";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[] { //
|
||||||
|
"§6---- Decline Discord connection ----", //
|
||||||
|
"Decline 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 + " decline" //
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.remove(sender.getName());
|
||||||
|
if (did == null) {
|
||||||
|
sender.sendMessage("§cYou don't have a pending connection to Discord.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package buttondevteam.discordplugin.mccommands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.DiscordPlayer;
|
||||||
|
import buttondevteam.discordplugin.commands.ConnectCommand;
|
||||||
|
import buttondevteam.lib.TBMCPlayer;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
public class DiscordMCCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "discord";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[] { // TODO
|
||||||
|
"§6---- Decline Discord connection ----", //
|
||||||
|
"Decline 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 + " decline" //
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.remove(sender.getName());
|
||||||
|
if (did == null) {
|
||||||
|
sender.sendMessage("§cYou don't have a pending connection to Discord.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue