diff --git a/pom.xml b/pom.xml index 31bab80..f96ce0b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.tf TFGuilds - 0.0.1 + 0.0.3 jar TFGuilds diff --git a/src/main/java/totalfreedom/tfguilds/TFGuilds.java b/src/main/java/totalfreedom/tfguilds/TFGuilds.java index 1a9e06d..73be016 100644 --- a/src/main/java/totalfreedom/tfguilds/TFGuilds.java +++ b/src/main/java/totalfreedom/tfguilds/TFGuilds.java @@ -1,7 +1,8 @@ package totalfreedom.tfguilds; import org.bukkit.plugin.java.JavaPlugin; -import totalfreedom.tfguilds.command.GuildCommand; +import totalfreedom.tfguilds.command.CreateGuildCommand; +import totalfreedom.tfguilds.command.TfGuildsCommand; import totalfreedom.tfguilds.config.Config; import totalfreedom.tfguilds.util.GLog; @@ -31,6 +32,7 @@ public final class TFGuilds extends JavaPlugin private void enableCommands() { - this.getCommand("guild").setExecutor(new GuildCommand()); + this.getCommand("tfguilds").setExecutor(new TfGuildsCommand()); + this.getCommand("createguild").setExecutor(new CreateGuildCommand()); } } diff --git a/src/main/java/totalfreedom/tfguilds/command/CreateGuildCommand.java b/src/main/java/totalfreedom/tfguilds/command/CreateGuildCommand.java new file mode 100644 index 0000000..a91a85f --- /dev/null +++ b/src/main/java/totalfreedom/tfguilds/command/CreateGuildCommand.java @@ -0,0 +1,45 @@ +package totalfreedom.tfguilds.command; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import totalfreedom.tfguilds.util.GBase; +import totalfreedom.tfguilds.util.GUtil; + +public class CreateGuildCommand extends GBase implements CommandExecutor +{ + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) + { + if (args.length == 0) + { + return false; + } + + Player player = (Player) sender; + + if (GUtil.isConsole(player)) + { + sender.sendMessage(ChatColor.RED + "You are not allowed to run this command."); + return true; + } + + // this stupid shit + + /* List members = plugin.guilds.getStringList("guilds." + args[1] + ".members"); + for (String players : members) + { + if (players.contains(player.getName())) + { + player.sendMessage(ChatColor.RED + "You are already in a guild."); + return true; + } + } */ + + GUtil.createGuild(sender, args[1]); + sender.sendMessage(ChatColor.GREEN + "Successfully created a guild named " + args[1]); + return true; + } +} diff --git a/src/main/java/totalfreedom/tfguilds/command/GuildCommand.java b/src/main/java/totalfreedom/tfguilds/command/GuildCommand.java deleted file mode 100644 index 4283f7f..0000000 --- a/src/main/java/totalfreedom/tfguilds/command/GuildCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -package totalfreedom.tfguilds.command; - -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import totalfreedom.tfguilds.util.GBase; -import totalfreedom.tfguilds.util.GUtil; - -public class GuildCommand extends GBase implements CommandExecutor -{ - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) - { - if (args.length != 2) - { - return false; - } - - if (args[0].toLowerCase().equals("create")) - { - if (GUtil.isConsole(sender)) - { - sender.sendMessage(ChatColor.RED + "You are not allowed to run this command."); - return true; - } - - GUtil.createGuild(sender, args[1]); - sender.sendMessage(ChatColor.GREEN + "Successfully created a guild named " + args[1]); - return true; - } - return false; - } -} diff --git a/src/main/java/totalfreedom/tfguilds/command/TfGuildsCommand.java b/src/main/java/totalfreedom/tfguilds/command/TfGuildsCommand.java new file mode 100644 index 0000000..e84ba1f --- /dev/null +++ b/src/main/java/totalfreedom/tfguilds/command/TfGuildsCommand.java @@ -0,0 +1,19 @@ +package totalfreedom.tfguilds.command; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import totalfreedom.tfguilds.util.GBase; +import totalfreedom.tfguilds.util.GUtil; + +public class TfGuildsCommand extends GBase implements CommandExecutor +{ + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) + { + sender.sendMessage(GUtil.color("&aTFGuilds &2is a plugin which allows for players to make their own guilds, providing guild chat and guild teleportation.")); + sender.sendMessage(String.format(GUtil.color("&2Version &av%s"), plugin.getDescription().getVersion())); + sender.sendMessage(GUtil.color("&2Developed by &aspeednt & supernt")); + return true; + } +} diff --git a/src/main/java/totalfreedom/tfguilds/util/GUtil.java b/src/main/java/totalfreedom/tfguilds/util/GUtil.java index 2456729..513760e 100644 --- a/src/main/java/totalfreedom/tfguilds/util/GUtil.java +++ b/src/main/java/totalfreedom/tfguilds/util/GUtil.java @@ -1,6 +1,6 @@ package totalfreedom.tfguilds.util; -import lombok.Getter; +import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import totalfreedom.tfguilds.TFGuilds; @@ -11,9 +11,6 @@ public class GUtil { public static TFGuilds plugin = TFGuilds.plugin; - @Getter - public static String[] guildName; - public static boolean isConsole(CommandSender sender) { return sender instanceof ConsoleCommandSender; @@ -32,4 +29,9 @@ public class GUtil plugin.guilds.save(); GLog.info(owner.getName() + " has created a new guild: " + guildName); } + + public static String color(String s) + { + return ChatColor.translateAlternateColorCodes('&', s); + } } \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ea360be..69d8d5d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,7 +5,11 @@ api-version: 1.13 authors: [speednt] description: Plugin which allows for players to make their own guilds on the server commands: - guild: - description: Main command for TFGuilds, allows for creating your own guild - usage: / - aliases: [g] \ No newline at end of file + tfguilds: + description: Plugin info + usage: / + aliases: [guilds, tfguildsinfo, tfginfo, guildsinfo] + createguild: + description: Creates a guild + usage: / + aliases: [guildcreate] \ No newline at end of file