From b8a07c0281b5e2b37851ecd8659c423bedbb487a Mon Sep 17 00:00:00 2001
From: speedxx <43330808+speedxx@users.noreply.github.com>
Date: Mon, 10 Aug 2020 20:37:05 -0400
Subject: [PATCH] gonna do the thing i was supposed to do in another commit
---
.gitignore | 1 +
.idea/jarRepositories.xml | 35 +++++++++++++++++++
.idea/misc.xml | 2 +-
TFGuilds.iml | 24 ++++++-------
.../tfguilds/command/GuildCommand.java | 9 ++++-
.../tfguilds/command/KickSubcommand.java | 8 +----
.../tfguilds/command/TagSubcommand.java | 6 ++--
.../me/totalfreedom/tfguilds/guild/Guild.java | 17 +++++----
src/main/resources/plugin.yml | 2 +-
9 files changed, 72 insertions(+), 32 deletions(-)
create mode 100644 .idea/jarRepositories.xml
diff --git a/.gitignore b/.gitignore
index 6a87f9d..89a26f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,6 @@
/.idea/libraries
/.idea/workspace.xml
/.idea/modules.xml
+/.idea/uiDesigner.xml
target/
out/
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..442ab44
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 90ad631..cffed5d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -12,5 +12,5 @@
-
+
\ No newline at end of file
diff --git a/TFGuilds.iml b/TFGuilds.iml
index b342fbd..4e9b967 100644
--- a/TFGuilds.iml
+++ b/TFGuilds.iml
@@ -23,18 +23,18 @@
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/totalfreedom/tfguilds/command/GuildCommand.java b/src/main/java/me/totalfreedom/tfguilds/command/GuildCommand.java
index ae9b27b..d32ebc4 100644
--- a/src/main/java/me/totalfreedom/tfguilds/command/GuildCommand.java
+++ b/src/main/java/me/totalfreedom/tfguilds/command/GuildCommand.java
@@ -138,10 +138,17 @@ public class GuildCommand extends Common implements CommandExecutor, TabComplete
return Guild.getGuildList();
}
+ case "kick":
+ {
+ if (guild.hasModerator(sender.getName()))
+ {
+ return guild.getOnlyMembers();
+ }
+ }
+
case "removemod":
case "addmod":
case "setowner":
- case "kick":
{
if (guild.getOwner().equals(sender.getName()))
{
diff --git a/src/main/java/me/totalfreedom/tfguilds/command/KickSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/KickSubcommand.java
index 5536269..7f4fd81 100644
--- a/src/main/java/me/totalfreedom/tfguilds/command/KickSubcommand.java
+++ b/src/main/java/me/totalfreedom/tfguilds/command/KickSubcommand.java
@@ -90,19 +90,13 @@ public class KickSubcommand extends Common implements CommandExecutor
return true;
}
- if (guild.getOwner().equals(n.getName()))
- {
- sender.sendMessage(ChatColor.RED + "No need to make yourself a moderator!");
- return true;
- }
-
if (!guild.hasMember(n.getName()))
{
sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true;
}
- if ((guild.getOwner().equals(n.getName()) || guild.hasModerator(n.getName())) && !guild.getOwner().equals(player.getName()))
+ if (guild.getOwner().equals(n.getName()) || guild.hasModerator(n.getName()) && !guild.getOwner().equals(player.getName()))
{
sender.sendMessage(ChatColor.RED + "You cannot kick the owner/moderator(s) of a guild!");
return true;
diff --git a/src/main/java/me/totalfreedom/tfguilds/command/TagSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/TagSubcommand.java
index fe49087..4f916b4 100644
--- a/src/main/java/me/totalfreedom/tfguilds/command/TagSubcommand.java
+++ b/src/main/java/me/totalfreedom/tfguilds/command/TagSubcommand.java
@@ -43,7 +43,7 @@ public class TagSubcommand extends Common implements CommandExecutor
if (args.length >= 3)
{
- if (args[1].toLowerCase().equals("set"))
+ if (args[1].equalsIgnoreCase("set"))
{
String tag = StringUtils.join(args, " ", 2, args.length);
@@ -69,13 +69,13 @@ public class TagSubcommand extends Common implements CommandExecutor
guild.setTag(tag);
guild.save();
- sender.sendMessage(tl("%p%Your guild tag has been changed to be \"" + GUtil.colorize(tag).replace("%rank%", ChatColor.GOLD +"Guild Owner") + "%p%\"."));
+ sender.sendMessage(tl("%p%Your guild tag has been changed to be \"" + GUtil.colorize(tag).replace("%rank%", "Guild Owner") + "%p%\"."));
return true;
}
return false;
}
- if (args[1].toLowerCase().equals("clear"))
+ if (args[1].equalsIgnoreCase("clear"))
{
guild.setTag(null);
guild.save();
diff --git a/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java b/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java
index ff46903..c8152cb 100644
--- a/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java
+++ b/src/main/java/me/totalfreedom/tfguilds/guild/Guild.java
@@ -20,7 +20,7 @@ import org.bukkit.entity.Player;
public class Guild
{
- private static TFGuilds plugin = TFGuilds.getPlugin();
+ private static final TFGuilds plugin = TFGuilds.getPlugin();
@Getter
@Setter
@@ -35,10 +35,10 @@ public class Guild
private String owner;
@Getter
- private List moderators;
+ private final List moderators;
@Getter
- private List members;
+ private final List members;
@Getter
@Setter
@@ -49,7 +49,7 @@ public class Guild
private GuildState state;
@Getter
- private List ranks;
+ private final List ranks;
@Getter
@Setter
@@ -248,13 +248,16 @@ public class Guild
public String getRoster()
{
- String list = Common.PREFIX + "Guild Roster for " + name + "\n" +
+ StringBuilder list = new StringBuilder(Common.PREFIX + "Guild Roster for " + name + "\n" +
"%s%Owner%p% - " + owner + "\n" +
- "%s%Moderators%p% - " + StringUtils.join(moderators, ", ") + "\n";
+ "%s%Moderators%p% - " + StringUtils.join(moderators, ", ") + "\n");
for (GuildRank rank : ranks)
{
- list += "%s%" + rank.getName() + "%p% - " + StringUtils.join(rank.getMembers(), ", ") + "\n";
+ list.append("%s%")
+ .append(rank.getName()).append("%p% - ")
+ .append(StringUtils.join(rank.getMembers(), ", "))
+ .append("\n");
}
return Common.tl(list +
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 37cc75e..f329dae 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -7,7 +7,7 @@ description: A guilds plugin for the TotalFreedom server.
commands:
guild:
description: The main command of TFGuilds.
- usage: / [list [guild] | help | create | disband [name] | invite | addmod | player> | removemod | name> | createrole | setowner | player> | kick | player> | leave | setstate | state> | tp | info [guild] | tag | clear> | join | chat [message] | saveconfig | rename | createrank | deleterank | setrank motd | clear> | home [set] | chat [message]]
+ usage: / [list | help | create | disband [name] | invite | addmod | player> | removemod | name> | createrank | setowner | player> | kick | player> | leave | setstate | state> | tp | info [guild | player] | tag | clear> | join | chat [message] | roster [guild] | rename | createrank | deleterank | setrank motd | clear> | home [set] | chat [message]]
aliases: [g]
guildchat:
description: Talk in chat with your guild.