Started converting command classes

This commit is contained in:
Norbi Peti 2017-04-23 02:13:51 +02:00
parent 7751defc9f
commit db37482134
25 changed files with 46 additions and 234 deletions

View file

@ -8,7 +8,7 @@ import buttondevteam.chat.ChatPlayer;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCPlayer;
public final class ChatonlyCommand extends TBMCCommandBase {
public final class ChatonlyCommand extends TBMCCommandBase { //TODO: Add annotation
@Override
public String[] GetHelpText(String alias) {
@ -29,19 +29,4 @@ public final class ChatonlyCommand extends TBMCCommandBase {
return true;
}
@Override
public String GetCommandPath() {
return "chatonly";
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -5,8 +5,10 @@ import java.net.URLEncoder;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
@CommandClass(modOnly = false)
public class MWikiCommand extends TBMCCommandBase {
@Override
@ -37,19 +39,4 @@ public class MWikiCommand extends TBMCCommandBase {
return true;
}
@Override
public String GetCommandPath() {
return "mwiki";
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -4,10 +4,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.chat.ChatPlayer;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.PlayerCommandBase;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCPlayer;
public final class OOCCommand extends TBMCCommandBase {
@CommandClass(modOnly = false)
public final class OOCCommand extends PlayerCommandBase {
@Override
public String[] GetHelpText(String alias) {
@ -17,8 +20,7 @@ public final class OOCCommand extends TBMCCommandBase {
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
Player player = (Player) sender;
public boolean OnCommand(Player player, String alias, String[] args) {
if (args.length == 0) {
return false;
} else {
@ -33,19 +35,4 @@ public final class OOCCommand extends TBMCCommandBase {
return true;
}
@Override
public String GetCommandPath() {
return "ooc";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -6,8 +6,10 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
@CommandClass(modOnly = false)
public final class UnlolCommand extends TBMCCommandBase {
public static CommandSender Lastlol = null;
@ -35,19 +37,4 @@ public final class UnlolCommand extends TBMCCommandBase {
}
return true;
}
@Override
public String GetCommandPath() {
return "unlol";
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -4,20 +4,26 @@ import java.util.Arrays;
import java.util.stream.Collectors;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import buttondevteam.chat.ChatPlayer;
import buttondevteam.chat.listener.PlayerListener;
import buttondevteam.lib.chat.Channel;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCPlayer;
@CommandClass(modOnly = false)
public class WaitWhatCommand extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
Channel channel;
if (sender instanceof Player && ((Player) sender).isOnline())
channel = TBMCPlayer.getPlayer(((Player) sender).getUniqueId(), ChatPlayer.class).CurrentChannel;
else if (sender instanceof ConsoleCommandSender)
channel = PlayerListener.ConsoleChannel;
else
channel = Channel.GlobalChat;
final String message;
@ -36,14 +42,4 @@ public class WaitWhatCommand extends TBMCCommandBase {
"Wait what" //
};
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -4,9 +4,11 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCYEEHAWEvent;
@CommandClass(modOnly = false)
public class YeehawCommand extends TBMCCommandBase {
@Override
@ -26,19 +28,4 @@ public class YeehawCommand extends TBMCCommandBase {
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
return true;
}
@Override
public String GetCommandPath() {
return "yeehaw";
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -6,10 +6,12 @@ import org.bukkit.entity.Player;
import buttondevteam.chat.ChatPlayer;
import buttondevteam.chat.listener.PlayerListener;
import buttondevteam.lib.chat.Channel;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.player.TBMCPlayer;
@CommandClass(modOnly = false)
public abstract class AppendTextCommandBase extends TBMCCommandBase {
public abstract String[] GetHelpText(String alias);
@ -31,14 +33,4 @@ public abstract class AppendTextCommandBase extends TBMCCommandBase {
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, sender, msg);
return true;
}
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -4,10 +4,10 @@ public final class ShrugCommand extends AppendTextCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- Shrug ----",
"This command appends a shrug after your message",
"Or just makes you shrug",
"Use either /" + alias + " <message> or just /" + alias };
return new String[] { "§6---- Shrug ----", //
"This command appends a shrug after your message", //
"Or just makes you shrug", //
"Use either /" + alias + " <message> or just /" + alias }; //
}
@Override
@ -15,9 +15,4 @@ public final class ShrugCommand extends AppendTextCommandBase {
return "¯\\\\\\_(ツ)\\_/¯";
}
@Override
public String GetCommandPath() {
return "shrug";
}
}

View file

@ -4,9 +4,9 @@ public final class TableflipCommand extends AppendTextCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- Tableflip ----",
"This command appends a tableflip after your message",
"Or just makes you tableflip",
return new String[] { "§6---- Tableflip ----", //
"This command appends a tableflip after your message", //
"Or just makes you tableflip", //
"Use either /" + alias + " <message> or just /" + alias };
}
@ -14,9 +14,4 @@ public final class TableflipCommand extends AppendTextCommandBase {
public String GetAppendedText() {
return "(╯°□°)╯︵ ┻━┻";
}
@Override
public String GetCommandPath() {
return "tableflip";
}
}

View file

@ -4,9 +4,9 @@ public final class UnflipCommand extends AppendTextCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- Unflip ----",
"This command appends an unflip after your message",
"Or just unflips as you",
return new String[] { "§6---- Unflip ----", //
"This command appends an unflip after your message", //
"Or just unflips as you", //
"Use either /" + alias + " <message> or just /" + alias };
}
@ -15,9 +15,4 @@ public final class UnflipCommand extends AppendTextCommandBase {
return "┬─┬ ( ゜-゜ノ)";
}
@Override
public String GetCommandPath() {
return "unflip";
}
}

View file

@ -10,8 +10,12 @@ import buttondevteam.chat.FlairStates;
import buttondevteam.chat.PlayerJoinTimerTask;
import buttondevteam.chat.PluginMain;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
import buttondevteam.lib.player.TBMCPlayer;
@CommandClass(modOnly = false)
@OptionallyPlayerCommandClass(playerOnly = false)
public class AcceptCommand extends UCommandBase {
@Override
@ -92,9 +96,4 @@ public class AcceptCommand extends UCommandBase {
return true;
}
@Override
public String GetUCommandPath() {
return "accept";
}
}

View file

@ -54,9 +54,4 @@ public class CCommand extends UCommandBase {
return true;
}
@Override
public String GetUCommandPath() {
return "c";
}
}

View file

@ -1,25 +1,13 @@
package buttondevteam.chat.commands.ucmds;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.OptionallyPlayerCommandBase;
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
public abstract class UCommandBase extends TBMCCommandBase {
@CommandClass(modOnly = false, path = "u")
@OptionallyPlayerCommandClass(playerOnly = false)
public abstract class UCommandBase extends OptionallyPlayerCommandBase {
public abstract String[] GetHelpText(String alias);
@Override
public String GetCommandPath() {
return "u " + GetUCommandPath();
}
public abstract String GetUCommandPath();
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,25 +1,11 @@
package buttondevteam.chat.commands.ucmds.admin;
import buttondevteam.chat.commands.ucmds.UCommandBase;
import buttondevteam.lib.chat.CommandClass;
@CommandClass(modOnly = true)
public abstract class AdminCommandBase extends UCommandBase {
public abstract String[] GetHelpText(String alias);
@Override
public String GetUCommandPath() {
return "admin " + GetAdminCommandPath();
}
@Override
public boolean GetPlayerOnly() {
return false; // Allow admin commands in console
}
public abstract String GetAdminCommandPath();
@Override
public boolean GetModOnly() {
return true;
}
}

View file

@ -13,11 +13,6 @@ public class DebugCommand extends AdminCommandBase {
"Toggles debug mode, which prints debug messages to the console." };
}
@Override
public String GetAdminCommandPath() {
return "debug";
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
sender.sendMessage("§eDebug mode " + ((DebugMode = !DebugMode) ? "§aenabled." : "§cdisabled."));

View file

@ -40,9 +40,4 @@ public class PlayerInfoCommand extends AdminCommandBase {
return true;
}
@Override
public String GetAdminCommandPath() {
return "playerinfo";
}
}

View file

@ -20,9 +20,4 @@ public class SaveCommand extends AdminCommandBase {
return true;
}
@Override
public String GetAdminCommandPath() {
return "save";
}
}

View file

@ -68,9 +68,4 @@ public class SetFlairCommand extends AdminCommandBase {
return true;
}
@Override
public String GetAdminCommandPath() {
return "setflair";
}
}

View file

@ -39,9 +39,4 @@ public class UpdatePlugin extends AdminCommandBase {
}
}
@Override
public String GetAdminCommandPath() {
return "updateplugin";
}
}

View file

@ -34,9 +34,4 @@ public class AddCommand extends AnnounceCommandBase {
return true;
}
@Override
public String GetAnnounceCommandPath() {
return "add";
}
}

View file

@ -1,25 +1,13 @@
package buttondevteam.chat.commands.ucmds.announce;
import buttondevteam.chat.commands.ucmds.UCommandBase;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
@CommandClass(modOnly = true)
@OptionallyPlayerCommandClass(playerOnly = false)
public abstract class AnnounceCommandBase extends UCommandBase {
public abstract String[] GetHelpText(String alias);
@Override
public String GetUCommandPath() {
return "announce " + GetAnnounceCommandPath();
}
public abstract String GetAnnounceCommandPath();
@Override
public boolean GetPlayerOnly() {
return false;
}
@Override
public boolean GetModOnly() {
return true;
}
}

View file

@ -42,9 +42,4 @@ public class EditCommand extends AnnounceCommandBase {
return true;
}
@Override
public String GetAnnounceCommandPath() {
return "edit";
}
}

View file

@ -25,9 +25,4 @@ public class ListCommand extends AnnounceCommandBase {
return true;
}
@Override
public String GetAnnounceCommandPath() {
return "list";
}
}

View file

@ -27,9 +27,4 @@ public class RemoveCommand extends AnnounceCommandBase {
return true;
}
@Override
public String GetAnnounceCommandPath() {
return "remove";
}
}

View file

@ -30,9 +30,4 @@ public class SetTimeCommand extends AnnounceCommandBase {
return true;
}
@Override
public String GetAnnounceCommandPath() {
return "settime";
}
}