add guildchatspy

& add codestyle to project for proper code formatting
This commit is contained in:
speedxx 2020-07-29 17:03:05 -04:00
parent 5ad6403f8f
commit 27859eddac
42 changed files with 438 additions and 68 deletions

5
.gitignore vendored
View file

@ -1,3 +1,6 @@
.idea/ /.idea/artifacts
/.idea/libraries
/.idea/workspace.xml
/.idea/modules.xml
target/ target/
out/ out/

View file

@ -0,0 +1,28 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

16
.idea/compiler.xml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="TFGuilds" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="TFGuilds" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

7
.idea/encodings.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

16
.idea/misc.xml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -25,7 +25,7 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" /> <orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" /> <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.16-R0.2" level="project" /> <orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" name="Maven: com.github.TFPatches:TotalFreedomMod:server-2ca57c9b39-1" level="project" /> <orderEntry type="library" name="Maven: com.github.TFPatches:TotalFreedomMod:server-2ca57c9b39-1" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.10" level="project" /> <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />

View file

@ -6,7 +6,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>TFGuilds</artifactId> <artifactId>TFGuilds</artifactId>
<version>0.2.4</version> <version>0.2.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TFGuilds</name> <name>TFGuilds</name>

View file

@ -22,6 +22,7 @@ public class Common
public static Map<Player, Guild> INVITES = new HashMap<>(); public static Map<Player, Guild> INVITES = new HashMap<>();
public static List<Player> IN_GUILD_CHAT = new ArrayList<>(); public static List<Player> IN_GUILD_CHAT = new ArrayList<>();
public static List<Player> CHAT_SPY = new ArrayList<>();
public static String tl(String in) public static String tl(String in)
{ {

View file

@ -2,6 +2,7 @@ package me.totalfreedom.tfguilds;
import me.totalfreedom.tfguilds.bridge.TFMBridge; import me.totalfreedom.tfguilds.bridge.TFMBridge;
import me.totalfreedom.tfguilds.command.GuildChatCommand; import me.totalfreedom.tfguilds.command.GuildChatCommand;
import me.totalfreedom.tfguilds.command.GuildChatSpyCommand;
import me.totalfreedom.tfguilds.command.GuildCommand; import me.totalfreedom.tfguilds.command.GuildCommand;
import me.totalfreedom.tfguilds.command.TFGuildsCommand; import me.totalfreedom.tfguilds.command.TFGuildsCommand;
import me.totalfreedom.tfguilds.config.Config; import me.totalfreedom.tfguilds.config.Config;
@ -49,6 +50,7 @@ public final class TFGuilds extends JavaPlugin
this.getCommand("guild").setExecutor(new GuildCommand()); this.getCommand("guild").setExecutor(new GuildCommand());
this.getCommand("guildchat").setExecutor(new GuildChatCommand()); this.getCommand("guildchat").setExecutor(new GuildChatCommand());
this.getCommand("tfguilds").setExecutor(new TFGuildsCommand()); this.getCommand("tfguilds").setExecutor(new TFGuildsCommand());
this.getCommand("guildchatspy").setExecutor(new GuildChatSpyCommand());
} }
private void loadListeners() private void loadListeners()

View file

@ -26,7 +26,7 @@ public class TFMBridge
final Plugin tfm = plugin.getServer().getPluginManager().getPlugin("TotalFreedomMod"); final Plugin tfm = plugin.getServer().getPluginManager().getPlugin("TotalFreedomMod");
if (tfm != null && tfm instanceof TotalFreedomMod) if (tfm != null && tfm instanceof TotalFreedomMod)
{ {
tfmPlugin = (TotalFreedomMod) tfm; tfmPlugin = (TotalFreedomMod)tfm;
} }
} }
catch (Exception ex) catch (Exception ex)

View file

@ -17,7 +17,10 @@ public class AddModSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length == 1 || args.length > 3) if (args.length == 1 || args.length > 3)
{
return false; return false;
}
if (args.length == 3) if (args.length == 3)
{ {
if (!plugin.bridge.isAdmin(sender)) if (!plugin.bridge.isAdmin(sender))
@ -25,77 +28,91 @@ public class AddModSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild(args[1]); Guild guild = Guild.getGuild(args[1]);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
Player player = Bukkit.getPlayer(args[2]); Player player = Bukkit.getPlayer(args[2]);
if (player == null) if (player == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(player.getName())) if (!guild.hasMember(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!"); sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!");
return true; return true;
} }
if (guild.getOwner().equals(player.getName())) if (guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "No need to make the owner a moderator!"); sender.sendMessage(ChatColor.RED + "No need to make the owner a moderator!");
return true; return true;
} }
if (guild.hasModerator(player.getName())) if (guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This member is already a moderator for this guild!"); sender.sendMessage(ChatColor.RED + "This member is already a moderator for this guild!");
return true; return true;
} }
guild.addModerator(player.getName()); guild.addModerator(player.getName());
sender.sendMessage(tl(PREFIX + "Added %s%" + player.getName() + "%p% as a moderator for %s%" + GUtil.colorize(guild.getName()) + "%p%.")); sender.sendMessage(tl(PREFIX + "Added %s%" + player.getName() + "%p% as a moderator for %s%" + GUtil.colorize(guild.getName()) + "%p%."));
guild.broadcast(tl("%s%" + player.getName() + " %p%has been made a moderator of your guild.")); guild.broadcast(tl("%s%" + player.getName() + " %p%has been made a moderator of your guild."));
guild.save(); guild.save();
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change who is a moderator in your guild!"); sender.sendMessage(ChatColor.RED + "You can't change who is a moderator in your guild!");
return true; return true;
} }
Player n = Bukkit.getPlayer(args[1]); Player n = Bukkit.getPlayer(args[1]);
if (n == null) if (n == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (guild.getOwner().equals(n.getName())) if (guild.getOwner().equals(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "No need to make yourself a moderator!"); sender.sendMessage(ChatColor.RED + "No need to make yourself a moderator!");
return true; return true;
} }
if (!guild.hasMember(n.getName())) if (!guild.hasMember(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in your guild!"); sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true; return true;
} }
if (guild.hasModerator(n.getName())) if (guild.hasModerator(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This member is already a moderator for your guild!"); sender.sendMessage(ChatColor.RED + "This member is already a moderator for your guild!");
return true; return true;
} }
guild.addModerator(n.getName()); guild.addModerator(n.getName());
sender.sendMessage(tl(PREFIX + "Added %s%" + n.getName() + "%p% as a moderator for your guild.")); sender.sendMessage(tl(PREFIX + "Added %s%" + n.getName() + "%p% as a moderator for your guild."));
guild.broadcast(tl("%s%" + n.getName() + " %p%has been made a moderator of your guild.")); guild.broadcast(tl("%s%" + n.getName() + " %p%has been made a moderator of your guild."));

View file

@ -20,25 +20,29 @@ public class ChatSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (args.length >= 2) if (args.length >= 2)
{ {
String message = StringUtils.join(args, " ", 1, args.length); String message = StringUtils.join(args, " ", 1, args.length);
guild.chat(player.getName(), message); guild.chat(player.getName(), message);
return true; return true;
} }
if (IN_GUILD_CHAT.contains(player)) if (IN_GUILD_CHAT.contains(player))
{ {
IN_GUILD_CHAT.remove(player); IN_GUILD_CHAT.remove(player);
sender.sendMessage(tl("%p%Guild chat toggled off.")); sender.sendMessage(tl("%p%Guild chat toggled off."));
return true; return true;
} }
IN_GUILD_CHAT.add(player); IN_GUILD_CHAT.add(player);
sender.sendMessage(tl("%p%Guild chat toggled on.")); sender.sendMessage(tl("%p%Guild chat toggled on."));
return true; return true;

View file

@ -2,7 +2,6 @@ package me.totalfreedom.tfguilds.command;
import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.guild.Guild;
import me.totalfreedom.tfguilds.util.GUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -21,26 +20,33 @@ public class CreateRankSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length < 2) if (args.length < 2)
{
return false; return false;
Player player = (Player) sender; }
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't create ranks for your guild!"); sender.sendMessage(ChatColor.RED + "You can't create ranks for your guild!");
return true; return true;
} }
String rank = StringUtils.join(args, " ", 1, args.length); String rank = StringUtils.join(args, " ", 1, args.length);
if (guild.hasRank(rank)) if (guild.hasRank(rank))
{ {
sender.sendMessage(ChatColor.RED + "A rank of that name already exists in the guild!"); sender.sendMessage(ChatColor.RED + "A rank of that name already exists in the guild!");
return true; return true;
} }
guild.addRank(rank); guild.addRank(rank);
sender.sendMessage(tl(PREFIX + "Created a new rank named %s%" + rank + "%p% for your guild.")); sender.sendMessage(tl(PREFIX + "Created a new rank named %s%" + rank + "%p% for your guild."));
guild.save(); guild.save();

View file

@ -27,9 +27,11 @@ public class CreateSubcommand extends Common implements CommandExecutor
} }
if (args.length < 2) if (args.length < 2)
{
return false; return false;
}
Player player = (Player) sender; Player player = (Player)sender;
String name = StringUtils.join(args, " ", 1, args.length); String name = StringUtils.join(args, " ", 1, args.length);
String identifier = GUtil.flatten(name); String identifier = GUtil.flatten(name);
@ -77,4 +79,4 @@ public class CreateSubcommand extends Common implements CommandExecutor
Bukkit.broadcastMessage(GUtil.colorize(tl("%p%" + sender.getName() + " has created guild %p%&l" + name))); Bukkit.broadcastMessage(GUtil.colorize(tl("%p%" + sender.getName() + " has created guild %p%&l" + name)));
return true; return true;
} }
} }

View file

@ -20,26 +20,33 @@ public class DeleteRankSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length < 2) if (args.length < 2)
{
return false; return false;
Player player = (Player) sender; }
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't delete ranks from your guild!"); sender.sendMessage(ChatColor.RED + "You can't delete ranks from your guild!");
return true; return true;
} }
String rank = StringUtils.join(args, " ", 1, args.length); String rank = StringUtils.join(args, " ", 1, args.length);
if (!guild.hasRank(rank)) if (!guild.hasRank(rank))
{ {
sender.sendMessage(ChatColor.RED + "A rank of that name does not exist in the guild!"); sender.sendMessage(ChatColor.RED + "A rank of that name does not exist in the guild!");
return true; return true;
} }
guild.removeRank(rank); guild.removeRank(rank);
sender.sendMessage(tl(PREFIX + "Deleted the rank named %s%" + rank + "%p% in your guild.")); sender.sendMessage(tl(PREFIX + "Deleted the rank named %s%" + rank + "%p% in your guild."));
guild.save(); guild.save();

View file

@ -18,8 +18,10 @@ public class DisbandSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length > 2) if (args.length > 2)
{
return false; return false;
}
if (args.length == 2) if (args.length == 2)
{ {
if (!plugin.bridge.isAdmin(sender)) if (!plugin.bridge.isAdmin(sender))
@ -49,7 +51,7 @@ public class DisbandSubcommand extends Common implements CommandExecutor
return true; return true;
} }
Player player = (Player) sender; Player player = (Player)sender;
if (!Guild.isInGuild(player)) if (!Guild.isInGuild(player))
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");

View file

@ -20,25 +20,29 @@ public class GuildChatCommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (args.length >= 1) if (args.length >= 1)
{ {
String message = StringUtils.join(args, " ", 0, args.length); String message = StringUtils.join(args, " ", 0, args.length);
guild.chat(player.getName(), message); guild.chat(player.getName(), message);
return true; return true;
} }
if (IN_GUILD_CHAT.contains(player)) if (IN_GUILD_CHAT.contains(player))
{ {
IN_GUILD_CHAT.remove(player); IN_GUILD_CHAT.remove(player);
sender.sendMessage(tl("%p%Guild chat toggled off.")); sender.sendMessage(tl("%p%Guild chat toggled off."));
return true; return true;
} }
IN_GUILD_CHAT.add(player); IN_GUILD_CHAT.add(player);
sender.sendMessage(tl("%p%Guild chat toggled on.")); sender.sendMessage(tl("%p%Guild chat toggled on."));
return true; return true;

View file

@ -0,0 +1,39 @@
package me.totalfreedom.tfguilds.command;
import me.totalfreedom.tfguilds.Common;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
public class GuildChatSpyCommand extends Common implements CommandExecutor
{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if (sender instanceof ConsoleCommandSender)
{
sender.sendMessage(NO_PERMS);
return true;
}
if (!plugin.bridge.isAdmin(sender))
{
sender.sendMessage(NO_PERMS);
return true;
}
Player player = (Player)sender;
if (CHAT_SPY.contains(player))
{
CHAT_SPY.remove(player);
sender.sendMessage(tl(PREFIX + "%p%Global guild chat spy disabled."));
return true;
}
CHAT_SPY.add(player);
sender.sendMessage(tl(PREFIX + "%p%Global guild chat spy enabled."));
return true;
}
}

View file

@ -14,29 +14,52 @@ public class GuildCommand extends Common implements CommandExecutor
{ {
switch (args[0].toLowerCase()) switch (args[0].toLowerCase())
{ {
case "list": return new ListSubcommand().onCommand(sender, command, label, args); case "list":
case "help": return new HelpSubcommand().onCommand(sender, command, label, args); return new ListSubcommand().onCommand(sender, command, label, args);
case "create": return new CreateSubcommand().onCommand(sender, command, label, args); case "help":
case "disband": return new DisbandSubcommand().onCommand(sender, command, label, args); return new HelpSubcommand().onCommand(sender, command, label, args);
case "invite": return new InviteSubcommand().onCommand(sender, command, label, args); case "create":
case "addmod": return new AddModSubcommand().onCommand(sender, command, label, args); return new CreateSubcommand().onCommand(sender, command, label, args);
case "removemod": return new RemoveModSubcommand().onCommand(sender, command, label, args); case "disband":
case "setowner": return new SetOwnerSubcommand().onCommand(sender, command, label, args); return new DisbandSubcommand().onCommand(sender, command, label, args);
case "setstate": return new SetStateSubcommand().onCommand(sender, command, label, args); case "invite":
case "kick": return new KickSubcommand().onCommand(sender, command, label, args); return new InviteSubcommand().onCommand(sender, command, label, args);
case "leave": return new LeaveSubcommand().onCommand(sender, command, label, args); case "addmod":
case "tp": return new TPSubcommand().onCommand(sender, command, label, args); return new AddModSubcommand().onCommand(sender, command, label, args);
case "info": return new InfoSubcommand().onCommand(sender, command, label, args); case "removemod":
case "tag": return new TagSubcommand().onCommand(sender, command, label, args); return new RemoveModSubcommand().onCommand(sender, command, label, args);
case "chat": return new ChatSubcommand().onCommand(sender, command, label, args); case "setowner":
case "join": return new JoinSubcommand().onCommand(sender, command, label, args); return new SetOwnerSubcommand().onCommand(sender, command, label, args);
case "rename": return new RenameSubcommand().onCommand(sender, command, label, args); case "setstate":
case "createrank": return new CreateRankSubcommand().onCommand(sender, command, label, args); return new SetStateSubcommand().onCommand(sender, command, label, args);
case "deleterank": return new DeleteRankSubcommand().onCommand(sender, command, label, args); case "kick":
case "setrank": return new SetRankSubcommand().onCommand(sender, command, label, args); return new KickSubcommand().onCommand(sender, command, label, args);
case "motd": return new MOTDSubcommand().onCommand(sender, command, label, args); case "leave":
case "home": return new HomeSubcommand().onCommand(sender, command, label, args); return new LeaveSubcommand().onCommand(sender, command, label, args);
case "roster": return new RosterSubcommand().onCommand(sender, command, label, args); case "tp":
return new TPSubcommand().onCommand(sender, command, label, args);
case "info":
return new InfoSubcommand().onCommand(sender, command, label, args);
case "tag":
return new TagSubcommand().onCommand(sender, command, label, args);
case "chat":
return new ChatSubcommand().onCommand(sender, command, label, args);
case "join":
return new JoinSubcommand().onCommand(sender, command, label, args);
case "rename":
return new RenameSubcommand().onCommand(sender, command, label, args);
case "createrank":
return new CreateRankSubcommand().onCommand(sender, command, label, args);
case "deleterank":
return new DeleteRankSubcommand().onCommand(sender, command, label, args);
case "setrank":
return new SetRankSubcommand().onCommand(sender, command, label, args);
case "motd":
return new MOTDSubcommand().onCommand(sender, command, label, args);
case "home":
return new HomeSubcommand().onCommand(sender, command, label, args);
case "roster":
return new RosterSubcommand().onCommand(sender, command, label, args);
} }
return false; return false;
} }

View file

@ -17,19 +17,24 @@ public class HomeSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length > 2) if (args.length > 2)
{
return false; return false;
}
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (args.length == 2) if (args.length == 2)
{ {
if (args[1].equalsIgnoreCase("set")) if (args[1].equalsIgnoreCase("set"))
@ -39,6 +44,7 @@ public class HomeSubcommand extends Common implements CommandExecutor
sender.sendMessage(ChatColor.RED + "You can't modify your guild's home!"); sender.sendMessage(ChatColor.RED + "You can't modify your guild's home!");
return true; return true;
} }
guild.setHome(player.getLocation()); guild.setHome(player.getLocation());
guild.save(); guild.save();
sender.sendMessage(tl(PREFIX + "Set your current location as the new home of your guild%p%.")); sender.sendMessage(tl(PREFIX + "Set your current location as the new home of your guild%p%."));
@ -46,11 +52,13 @@ public class HomeSubcommand extends Common implements CommandExecutor
} }
return false; return false;
} }
if (!guild.hasHome()) if (!guild.hasHome())
{ {
sender.sendMessage(ChatColor.RED + "Your guild doesn't have a home!"); sender.sendMessage(ChatColor.RED + "Your guild doesn't have a home!");
return true; return true;
} }
player.teleport(guild.getHome()); player.teleport(guild.getHome());
sender.sendMessage(tl("%p%Teleported you to your guild's home!")); sender.sendMessage(tl("%p%Teleported you to your guild's home!"));
return true; return true;

View file

@ -29,26 +29,31 @@ public class InfoSubcommand extends Common implements CommandExecutor
return true; return true;
} }
} }
Guild guild = Guild.getGuild(GUtil.flatten(StringUtils.join(args, " ", 1, args.length))); Guild guild = Guild.getGuild(GUtil.flatten(StringUtils.join(args, " ", 1, args.length)));
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
sender.sendMessage(guild.getInformation()); sender.sendMessage(guild.getInformation());
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild((Player) sender);
Guild guild = Guild.getGuild((Player)sender);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
sender.sendMessage(guild.getInformation()); sender.sendMessage(guild.getInformation());
return true; return true;
} }

View file

@ -23,11 +23,13 @@ public class InviteSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length != 2) if (args.length != 2)
{
return false; return false;
}
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
Player invitee = Bukkit.getPlayer(args[1]); Player invitee = Bukkit.getPlayer(args[1]);
if (invitee == null) if (invitee == null)
@ -35,37 +37,37 @@ public class InviteSubcommand extends Common implements CommandExecutor
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (Guild.getGuild(invitee) != null) if (Guild.getGuild(invitee) != null)
{ {
sender.sendMessage(ChatColor.RED + "This player is already in another guild!"); sender.sendMessage(ChatColor.RED + "This player is already in another guild!");
return true; return true;
} }
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (guild.getState() == GuildState.CLOSED) if (guild.getState() == GuildState.CLOSED)
{ {
sender.sendMessage(ChatColor.RED + "The guild is currently closed!"); sender.sendMessage(ChatColor.RED + "The guild is currently closed!");
return true; return true;
} }
if (guild.getState() == GuildState.OPEN) if (guild.getState() == GuildState.OPEN)
{ {
sender.sendMessage(ChatColor.RED + "The guild is open! Tell your friend to join using \"/g join\"!"); sender.sendMessage(ChatColor.RED + "The guild is open! Tell your friend to join using \"/g join\"!");
return true; return true;
} }
if (INVITES.containsKey(invitee)) if (INVITES.containsKey(invitee))
{ {
sender.sendMessage(ChatColor.RED + "They have already been invited to your guild!"); sender.sendMessage(ChatColor.RED + "They have already been invited to your guild!");
return true; return true;
} }
INVITES.put(invitee, guild); INVITES.put(invitee, guild);
invitee.sendMessage(tl("%p%You have been invited to join %s%" + GUtil.colorize(guild.getName()) + "%p% through %s%" + player.getName() + "%p%'s invite!")); invitee.sendMessage(tl("%p%You have been invited to join %s%" + GUtil.colorize(guild.getName()) + "%p% through %s%" + player.getName() + "%p%'s invite!"));
invitee.sendMessage(tl("%p%Do %s%/g join " + ChatColor.stripColor(GUtil.colorize(guild.getName())) + "%p% to join!")); invitee.sendMessage(tl("%p%Do %s%/g join " + ChatColor.stripColor(GUtil.colorize(guild.getName())) + "%p% to join!"));
@ -76,7 +78,9 @@ public class InviteSubcommand extends Common implements CommandExecutor
public void run() public void run()
{ {
if (!INVITES.containsKey(invitee)) if (!INVITES.containsKey(invitee))
{
return; return;
}
INVITES.remove(player); INVITES.remove(player);
invitee.sendMessage(ChatColor.RED + "Invite expired."); invitee.sendMessage(ChatColor.RED + "Invite expired.");
sender.sendMessage(ChatColor.RED + "Invite expired."); sender.sendMessage(ChatColor.RED + "Invite expired.");
@ -84,4 +88,4 @@ public class InviteSubcommand extends Common implements CommandExecutor
}.runTaskLater(plugin, 20 * 90); }.runTaskLater(plugin, 20 * 90);
return true; return true;
} }
} }

View file

@ -22,25 +22,32 @@ public class JoinSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length < 2) if (args.length < 2)
{
return false; return false;
Player player = (Player) sender; }
Player player = (Player)sender;
if (Guild.getGuild(player) != null) if (Guild.getGuild(player) != null)
{ {
sender.sendMessage(ChatColor.RED + "You are already in a guild!"); sender.sendMessage(ChatColor.RED + "You are already in a guild!");
return true; return true;
} }
Guild guild = Guild.getGuild(GUtil.flatten(StringUtils.join(args, " ", 1, args.length))); Guild guild = Guild.getGuild(GUtil.flatten(StringUtils.join(args, " ", 1, args.length)));
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
if (guild.getState() == GuildState.CLOSED) if (guild.getState() == GuildState.CLOSED)
{ {
sender.sendMessage(ChatColor.RED + "That guild is currently closed!"); sender.sendMessage(ChatColor.RED + "That guild is currently closed!");
return true; return true;
} }
if (guild.getState() == GuildState.INVITE_ONLY) if (guild.getState() == GuildState.INVITE_ONLY)
{ {
if (!INVITES.containsKey(player)) if (!INVITES.containsKey(player))
@ -50,6 +57,7 @@ public class JoinSubcommand extends Common implements CommandExecutor
} }
INVITES.remove(player); INVITES.remove(player);
} }
guild.addMember(player.getName()); guild.addMember(player.getName());
guild.broadcast(tl("%s%" + player.getName() + " %p%has joined your guild!")); guild.broadcast(tl("%s%" + player.getName() + " %p%has joined your guild!"));
guild.save(); guild.save();

View file

@ -17,7 +17,10 @@ public class KickSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length > 3) if (args.length > 3)
{
return false; return false;
}
if (args.length == 3) if (args.length == 3)
{ {
if (!plugin.bridge.isAdmin(sender)) if (!plugin.bridge.isAdmin(sender))
@ -25,28 +28,33 @@ public class KickSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild(args[1]); Guild guild = Guild.getGuild(args[1]);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
Player player = Bukkit.getPlayer(args[2]); Player player = Bukkit.getPlayer(args[2]);
if (player == null) if (player == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(player.getName())) if (!guild.hasMember(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!"); sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!");
return true; return true;
} }
if (guild.getOwner().equals(player.getName()) || guild.hasModerator(player.getName())) if (guild.getOwner().equals(player.getName()) || guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You cannot kick the owner/moderator(s) of a guild!"); sender.sendMessage(ChatColor.RED + "You cannot kick the owner/moderator(s) of a guild!");
return true; return true;
} }
guild.removeMember(player.getName()); guild.removeMember(player.getName());
sender.sendMessage(tl(PREFIX + "Kicked %s%" + player.getName() + "%p% from %s%" + GUtil.colorize(guild.getName()) + "%p%.")); sender.sendMessage(tl(PREFIX + "Kicked %s%" + player.getName() + "%p% from %s%" + GUtil.colorize(guild.getName()) + "%p%."));
player.sendMessage(tl("%s%You have been kicked from your guild.")); player.sendMessage(tl("%s%You have been kicked from your guild."));
@ -54,44 +62,52 @@ public class KickSubcommand extends Common implements CommandExecutor
guild.save(); guild.save();
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.hasModerator(player.getName())) if (!guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't kick people from your guild!"); sender.sendMessage(ChatColor.RED + "You can't kick people from your guild!");
return true; return true;
} }
Player n = Bukkit.getPlayer(args[1]); Player n = Bukkit.getPlayer(args[1]);
if (n == null) if (n == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (guild.getOwner().equals(n.getName())) if (guild.getOwner().equals(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "No need to make yourself a moderator!"); sender.sendMessage(ChatColor.RED + "No need to make yourself a moderator!");
return true; return true;
} }
if (!guild.hasMember(n.getName())) if (!guild.hasMember(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in your guild!"); sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true; 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!"); sender.sendMessage(ChatColor.RED + "You cannot kick the owner/moderator(s) of a guild!");
return true; return true;
} }
guild.removeMember(n.getName()); guild.removeMember(n.getName());
sender.sendMessage(tl(PREFIX + "Kicked %s%" + n.getName() + "%p% from your guild.")); sender.sendMessage(tl(PREFIX + "Kicked %s%" + n.getName() + "%p% from your guild."));
n.sendMessage(tl("%s%You have been kicked from your guild.")); n.sendMessage(tl("%s%You have been kicked from your guild."));

View file

@ -15,24 +15,30 @@ public class LeaveSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length > 1) if (args.length > 1)
{
return false; return false;
}
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (guild.getOwner().equals(player.getName())) if (guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You cannot leave as you are the owner!"); sender.sendMessage(ChatColor.RED + "You cannot leave as you are the owner!");
return true; return true;
} }
guild.removeModerator(player.getName()); guild.removeModerator(player.getName());
guild.removeMember(player.getName()); guild.removeMember(player.getName());
guild.save(); guild.save();

View file

@ -2,10 +2,8 @@ package me.totalfreedom.tfguilds.command;
import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.guild.Guild;
import me.totalfreedom.tfguilds.guild.GuildRank;
import me.totalfreedom.tfguilds.util.GUtil; import me.totalfreedom.tfguilds.util.GUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -19,24 +17,30 @@ public class MOTDSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length == 1) if (args.length == 1)
{
return false; return false;
}
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.hasModerator(player.getName())) if (!guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't modify your guild's MOTD!"); sender.sendMessage(ChatColor.RED + "You can't modify your guild's MOTD!");
return true; return true;
} }
if (args.length >= 3) if (args.length >= 3)
{ {
if (args[1].equalsIgnoreCase("set")) if (args[1].equalsIgnoreCase("set"))
@ -49,8 +53,12 @@ public class MOTDSubcommand extends Common implements CommandExecutor
} }
return false; return false;
} }
if (!args[1].equalsIgnoreCase("clear")) if (!args[1].equalsIgnoreCase("clear"))
{
return false; return false;
}
guild.setMotd(null); guild.setMotd(null);
guild.save(); guild.save();
sender.sendMessage(tl(PREFIX + "Cleared your guild's MOTD.")); sender.sendMessage(tl(PREFIX + "Cleared your guild's MOTD."));

View file

@ -17,7 +17,10 @@ public class RemoveModSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length == 1 || args.length > 3) if (args.length == 1 || args.length > 3)
{
return false; return false;
}
if (args.length == 3) if (args.length == 3)
{ {
if (!plugin.bridge.isAdmin(sender)) if (!plugin.bridge.isAdmin(sender))
@ -25,67 +28,79 @@ public class RemoveModSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild(args[1]); Guild guild = Guild.getGuild(args[1]);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
Player player = Bukkit.getPlayer(args[2]); Player player = Bukkit.getPlayer(args[2]);
if (player == null) if (player == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(player.getName())) if (!guild.hasMember(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!"); sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!");
return true; return true;
} }
if (!guild.hasModerator(player.getName())) if (!guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This member is not a moderator for this guild!"); sender.sendMessage(ChatColor.RED + "This member is not a moderator for this guild!");
return true; return true;
} }
guild.removeModerator(player.getName()); guild.removeModerator(player.getName());
sender.sendMessage(tl(PREFIX + "Removed %s%" + player.getName() + "%p% as a moderator for %s%" + GUtil.colorize(guild.getName()) + "%p%.")); sender.sendMessage(tl(PREFIX + "Removed %s%" + player.getName() + "%p% as a moderator for %s%" + GUtil.colorize(guild.getName()) + "%p%."));
guild.broadcast(tl("%s%" + player.getName() + " %p%has been made a member of your guild.")); guild.broadcast(tl("%s%" + player.getName() + " %p%has been made a member of your guild."));
guild.save(); guild.save();
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change who is a moderator in your guild!"); sender.sendMessage(ChatColor.RED + "You can't change who is a moderator in your guild!");
return true; return true;
} }
Player n = Bukkit.getPlayer(args[1]); Player n = Bukkit.getPlayer(args[1]);
if (n == null) if (n == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(n.getName())) if (!guild.hasMember(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in your guild!"); sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true; return true;
} }
if (!guild.hasModerator(n.getName())) if (!guild.hasModerator(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This member is not a moderator for your guild!"); sender.sendMessage(ChatColor.RED + "This member is not a moderator for your guild!");
return true; return true;
} }
guild.removeModerator(n.getName()); guild.removeModerator(n.getName());
sender.sendMessage(tl(PREFIX + "Removed %s%" + n.getName() + "%p% as a moderator for your guild.")); sender.sendMessage(tl(PREFIX + "Removed %s%" + n.getName() + "%p% as a moderator for your guild."));
guild.broadcast(tl("%s%" + n.getName() + " %p%has been made a member of your guild.")); guild.broadcast(tl("%s%" + n.getName() + " %p%has been made a member of your guild."));

View file

@ -20,13 +20,17 @@ public class RenameSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length < 2) if (args.length < 2)
{
return false; return false;
}
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
String newName = StringUtils.join(args, " ", 1, args.length); String newName = StringUtils.join(args, " ", 1, args.length);
String identifier = GUtil.flatten(newName); String identifier = GUtil.flatten(newName);
@ -35,6 +39,7 @@ public class RenameSubcommand extends Common implements CommandExecutor
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change the name of your guild!"); sender.sendMessage(ChatColor.RED + "You can't change the name of your guild!");
@ -67,6 +72,7 @@ public class RenameSubcommand extends Common implements CommandExecutor
} }
} }
} }
guild.disband(); guild.disband();
guild.setIdentifier(GUtil.flatten(newName)); guild.setIdentifier(GUtil.flatten(newName));
guild.setName(newName); guild.setName(newName);

View file

@ -47,7 +47,7 @@ public class RosterSubcommand extends Common implements CommandExecutor
return true; return true;
} }
Guild guild = Guild.getGuild((Player) sender); Guild guild = Guild.getGuild((Player)sender);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");

View file

@ -17,7 +17,10 @@ public class SetOwnerSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length == 1 || args.length > 3) if (args.length == 1 || args.length > 3)
{
return false; return false;
}
if (args.length == 3) if (args.length == 3)
{ {
if (!plugin.bridge.isAdmin(sender)) if (!plugin.bridge.isAdmin(sender))
@ -25,23 +28,27 @@ public class SetOwnerSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild(args[1]); Guild guild = Guild.getGuild(args[1]);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
Player player = Bukkit.getPlayer(args[2]); Player player = Bukkit.getPlayer(args[2]);
if (player == null) if (player == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(player.getName())) if (!guild.hasMember(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!"); sender.sendMessage(ChatColor.RED + "This player is not in the specified guild!");
return true; return true;
} }
guild.removeModerator(player.getName()); guild.removeModerator(player.getName());
guild.setOwner(player.getName()); guild.setOwner(player.getName());
sender.sendMessage(tl(PREFIX + "Ownership has been transferred to %s%" + player.getName() + "%p% in %s%" + GUtil.colorize(guild.getName()) + "%p%.")); sender.sendMessage(tl(PREFIX + "Ownership has been transferred to %s%" + player.getName() + "%p% in %s%" + GUtil.colorize(guild.getName()) + "%p%."));
@ -49,34 +56,40 @@ public class SetOwnerSubcommand extends Common implements CommandExecutor
guild.save(); guild.save();
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change who is the owner of your guild!"); sender.sendMessage(ChatColor.RED + "You can't change who is the owner of your guild!");
return true; return true;
} }
Player n = Bukkit.getPlayer(args[1]); Player n = Bukkit.getPlayer(args[1]);
if (n == null) if (n == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(n.getName())) if (!guild.hasMember(n.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in your guild!"); sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true; return true;
} }
guild.removeModerator(n.getName()); guild.removeModerator(n.getName());
guild.setOwner(n.getName()); guild.setOwner(n.getName());
sender.sendMessage(tl(PREFIX + "Ownership has been transferred to %s%" + n.getName() + "%p% in your guild.")); sender.sendMessage(tl(PREFIX + "Ownership has been transferred to %s%" + n.getName() + "%p% in your guild."));

View file

@ -18,55 +18,71 @@ public class SetRankSubcommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length == 1) if (args.length == 1)
{
return false; return false;
}
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.hasModerator(player.getName())) if (!guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change the ranks of your guild members!"); sender.sendMessage(ChatColor.RED + "You can't change the ranks of your guild members!");
return true; return true;
} }
Player r = Bukkit.getPlayer(args[1]); Player r = Bukkit.getPlayer(args[1]);
if (r == null) if (r == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.hasMember(r.getName())) if (!guild.hasMember(r.getName()))
{ {
sender.sendMessage(ChatColor.RED + "This player is not in your guild!"); sender.sendMessage(ChatColor.RED + "This player is not in your guild!");
return true; return true;
} }
String name = StringUtils.join(args, " ", 2, args.length); String name = StringUtils.join(args, " ", 2, args.length);
if (name.toLowerCase().equals("members") || if (name.toLowerCase().equals("members") ||
name.toLowerCase().equals("member") || name.toLowerCase().equals("member") ||
name.toLowerCase().equals("none")) name.toLowerCase().equals("none"))
{ {
for (GuildRank gr : guild.getRanks()) for (GuildRank gr : guild.getRanks())
{
gr.getMembers().remove(r.getName()); gr.getMembers().remove(r.getName());
}
sender.sendMessage(tl(PREFIX + "Removed the rank of %s%" + r.getName() + "%p% in your guild.")); sender.sendMessage(tl(PREFIX + "Removed the rank of %s%" + r.getName() + "%p% in your guild."));
r.sendMessage(tl("%p%Your rank in your guild has been removed.")); r.sendMessage(tl("%p%Your rank in your guild has been removed."));
guild.save(); guild.save();
return true; return true;
} }
GuildRank rank = guild.getRank(name); GuildRank rank = guild.getRank(name);
if (rank == null) if (rank == null)
{ {
sender.sendMessage(ChatColor.RED + "A rank of that name does not exist in the guild!"); sender.sendMessage(ChatColor.RED + "A rank of that name does not exist in the guild!");
return true; return true;
} }
for (GuildRank gr : guild.getRanks()) for (GuildRank gr : guild.getRanks())
{
gr.getMembers().remove(r.getName()); gr.getMembers().remove(r.getName());
}
rank.getMembers().add(r.getName()); rank.getMembers().add(r.getName());
sender.sendMessage(tl(PREFIX + "Set the rank of %s%" + r.getName() + "%p% in your guild to %s%" + rank.getName() + "%p%.")); sender.sendMessage(tl(PREFIX + "Set the rank of %s%" + r.getName() + "%p% in your guild to %s%" + rank.getName() + "%p%."));
r.sendMessage(tl("%p%Your rank in your guild has been set to %s%" + rank.getName() + "%p%.")); r.sendMessage(tl("%p%Your rank in your guild has been set to %s%" + rank.getName() + "%p%."));

View file

@ -23,47 +23,55 @@ public class SetStateSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Guild guild = Guild.getGuild(args[1]); Guild guild = Guild.getGuild(args[1]);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "That guild doesn't exist!"); sender.sendMessage(ChatColor.RED + "That guild doesn't exist!");
return true; return true;
} }
GuildState state = GuildState.findState(args[2]); GuildState state = GuildState.findState(args[2]);
if (state == null) if (state == null)
{ {
sender.sendMessage(ChatColor.RED + "That is not a valid state!"); sender.sendMessage(ChatColor.RED + "That is not a valid state!");
return true; return true;
} }
guild.setState(state); guild.setState(state);
sender.sendMessage(tl(PREFIX + "Set the guild state to %s%" + state.getDisplay().toLowerCase() + "%p% in %s%" + GUtil.colorize(guild.getName()) + "%p%.")); sender.sendMessage(tl(PREFIX + "Set the guild state to %s%" + state.getDisplay().toLowerCase() + "%p% in %s%" + GUtil.colorize(guild.getName()) + "%p%."));
guild.broadcast(tl("%p%The guild is now %s%" + state.getDisplay().toLowerCase() + "%p%.")); guild.broadcast(tl("%p%The guild is now %s%" + state.getDisplay().toLowerCase() + "%p%."));
guild.save(); guild.save();
return true; return true;
} }
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
Player player = (Player) sender;
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.hasModerator(player.getName())) if (!guild.hasModerator(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't change the state of the guild!"); sender.sendMessage(ChatColor.RED + "You can't change the state of the guild!");
return true; return true;
} }
GuildState state = GuildState.findState(args[1]); GuildState state = GuildState.findState(args[1]);
if (state == null) if (state == null)
{ {
sender.sendMessage(ChatColor.RED + "That is not a valid state!"); sender.sendMessage(ChatColor.RED + "That is not a valid state!");
return true; return true;
} }
guild.setState(state); guild.setState(state);
sender.sendMessage(tl(PREFIX + "Set the guild state to %s%" + state.getDisplay().toLowerCase() + "%p% in your guild.")); sender.sendMessage(tl(PREFIX + "Set the guild state to %s%" + state.getDisplay().toLowerCase() + "%p% in your guild."));
guild.broadcast(tl("%p%The guild is now %s%" + state.getDisplay().toLowerCase() + "%p%.")); guild.broadcast(tl("%p%The guild is now %s%" + state.getDisplay().toLowerCase() + "%p%."));

View file

@ -16,7 +16,10 @@ public class TFGuildsCommand extends Common implements CommandExecutor
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length > 1) if (args.length > 1)
{
return false; return false;
}
if (args.length == 1) if (args.length == 1)
{ {
if (args[0].toLowerCase().equals("reload")) if (args[0].toLowerCase().equals("reload"))
@ -26,6 +29,7 @@ public class TFGuildsCommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
try try
{ {
plugin.config.load(); plugin.config.load();
@ -40,8 +44,8 @@ public class TFGuildsCommand extends Common implements CommandExecutor
} }
return true; return true;
} }
} }
sender.sendMessage(tl("%p%TFGuilds %s%is a plugin which allows for players to make their own guilds, providing guild chat, guild teleportation, and more.")); sender.sendMessage(tl("%p%TFGuilds %s%is a plugin which allows for players to make their own guilds, providing guild chat, guild teleportation, and more."));
sender.sendMessage(tl("%s%Version %p%v" + plugin.getDescription().getVersion())); sender.sendMessage(tl("%s%Version %p%v" + plugin.getDescription().getVersion()));
OfflinePlayer sp = Bukkit.getOfflinePlayer(UUID.fromString("d018f2b8-ce60-4672-a45f-e580e0331299")); OfflinePlayer sp = Bukkit.getOfflinePlayer(UUID.fromString("d018f2b8-ce60-4672-a45f-e580e0331299"));

View file

@ -20,26 +20,33 @@ public class TPSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length != 2) if (args.length != 2)
{
return false; return false;
Player player = (Player) sender; }
Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
Player to = Bukkit.getPlayer(args[1]); Player to = Bukkit.getPlayer(args[1]);
if (to == null) if (to == null)
{ {
sender.sendMessage(PNF); sender.sendMessage(PNF);
return true; return true;
} }
if (!guild.getMembers().contains(to.getName())) if (!guild.getMembers().contains(to.getName()))
{ {
sender.sendMessage(ChatColor.RED + "That player is not in your guild."); sender.sendMessage(ChatColor.RED + "That player is not in your guild.");
return true; return true;
} }
player.teleport(to.getLocation()); player.teleport(to.getLocation());
sender.sendMessage(tl("%p%Teleported to %s%" + to.getName() + "%p%.")); sender.sendMessage(tl("%p%Teleported to %s%" + to.getName() + "%p%."));
to.sendMessage(tl("%s%" + sender.getName() + " %p%has teleported to you.")); to.sendMessage(tl("%s%" + sender.getName() + " %p%has teleported to you."));

View file

@ -23,9 +23,11 @@ public class TagSubcommand extends Common implements CommandExecutor
} }
if (args.length < 2) if (args.length < 2)
{
return false; return false;
}
Player player = (Player) sender; Player player = (Player)sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{ {

View file

@ -95,7 +95,9 @@ public class Guild
plugin.guilds.set(identifier + ".tag", tag); plugin.guilds.set(identifier + ".tag", tag);
plugin.guilds.set(identifier + ".state", state.name()); plugin.guilds.set(identifier + ".state", state.name());
for (GuildRank rank : ranks) for (GuildRank rank : ranks)
{
rank.set(); rank.set();
}
plugin.guilds.set(identifier + ".motd", motd); plugin.guilds.set(identifier + ".motd", motd);
plugin.guilds.set(identifier + ".home", home); plugin.guilds.set(identifier + ".home", home);
plugin.guilds.set(identifier + ".creation", creation); plugin.guilds.set(identifier + ".creation", creation);
@ -111,7 +113,10 @@ public class Guild
{ {
Player player = Bukkit.getPlayer(name); Player player = Bukkit.getPlayer(name);
if (player != null) if (player != null)
{
Common.IN_GUILD_CHAT.remove(player); Common.IN_GUILD_CHAT.remove(player);
}
members.remove(name); members.remove(name);
moderators.remove(name); moderators.remove(name);
} }
@ -134,7 +139,10 @@ public class Guild
public boolean hasModerator(String name) public boolean hasModerator(String name)
{ {
if (owner.equals(name)) if (owner.equals(name))
{
return true; return true;
}
return moderators.contains(name); return moderators.contains(name);
} }
@ -149,10 +157,16 @@ public class Guild
for (GuildRank rank : ranks) for (GuildRank rank : ranks)
{ {
if (GUtil.flatten(name).equals(rank.getIdentifier())) if (GUtil.flatten(name).equals(rank.getIdentifier()))
{
remove = rank; remove = rank;
}
} }
if (remove == null) if (remove == null)
{
return; return;
}
remove.delete(); remove.delete();
ranks.remove(remove); ranks.remove(remove);
} }
@ -162,7 +176,9 @@ public class Guild
for (GuildRank rank : ranks) for (GuildRank rank : ranks)
{ {
if (GUtil.flatten(name).equals(rank.getIdentifier())) if (GUtil.flatten(name).equals(rank.getIdentifier()))
{
return true; return true;
}
} }
return false; return false;
} }
@ -172,7 +188,9 @@ public class Guild
for (GuildRank rank : ranks) for (GuildRank rank : ranks)
{ {
if (GUtil.flatten(name).equals(rank.getIdentifier())) if (GUtil.flatten(name).equals(rank.getIdentifier()))
{
return rank; return rank;
}
} }
return null; return null;
} }
@ -209,7 +227,9 @@ public class Guild
for (String member : members) for (String member : members)
{ {
if (member.equals(owner) || moderators.contains(member)) if (member.equals(owner) || moderators.contains(member))
{
continue; continue;
}
only.add(member); only.add(member);
} }
return only; return only;
@ -219,7 +239,9 @@ public class Guild
{ {
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
for (GuildRank rank : ranks) for (GuildRank rank : ranks)
{
names.add(rank.getName()); names.add(rank.getName());
}
return names; return names;
} }
@ -267,6 +289,14 @@ public class Guild
{ {
broadcast(Common.tl("%s%[%p%Guild Chat %s%| %p%" + GUtil.colorize(name) + "%s%] %p%" + as + ChatColor.WHITE + ": %p%" + msg)); broadcast(Common.tl("%s%[%p%Guild Chat %s%| %p%" + GUtil.colorize(name) + "%s%] %p%" + as + ChatColor.WHITE + ": %p%" + msg));
GLog.info(Common.tl("%s%[%p%Guild Chat %s%| %p%" + GUtil.colorize(name) + "%s%] %p%" + as + ChatColor.WHITE + ": %p%" + msg)); GLog.info(Common.tl("%s%[%p%Guild Chat %s%| %p%" + GUtil.colorize(name) + "%s%] %p%" + as + ChatColor.WHITE + ": %p%" + msg));
for (Player player : Bukkit.getOnlinePlayers())
{
if (Common.CHAT_SPY.contains(player))
{
player.sendMessage(GUtil.colorize("&7[GUILD CHAT SPY | " + GUtil.colorize(name) + "] " + as + ": " + msg));
}
}
} }
public void disband() public void disband()
@ -275,7 +305,9 @@ public class Guild
{ {
Player player = Bukkit.getPlayer(member); Player player = Bukkit.getPlayer(member);
if (player == null) if (player == null)
{
continue; continue;
}
Common.IN_GUILD_CHAT.remove(player); Common.IN_GUILD_CHAT.remove(player);
} }
plugin.guilds.set(identifier, null); plugin.guilds.set(identifier, null);
@ -296,7 +328,10 @@ public class Guild
public static Guild createGuild(String identifier, String name, Player owner) public static Guild createGuild(String identifier, String name, Player owner)
{ {
if (plugin.guilds.contains(identifier)) if (plugin.guilds.contains(identifier))
{
return getGuild(identifier); return getGuild(identifier);
}
Guild guild = new Guild(identifier, Guild guild = new Guild(identifier,
name, name,
owner.getName(), owner.getName(),
@ -316,7 +351,10 @@ public class Guild
public static Guild getGuild(String identifier) public static Guild getGuild(String identifier)
{ {
if (!plugin.guilds.contains(identifier)) if (!plugin.guilds.contains(identifier))
{
return null; return null;
}
List<GuildRank> ranks = new ArrayList<>(); List<GuildRank> ranks = new ArrayList<>();
ConfigurationSection rankcs = plugin.guilds.getConfigurationSection(identifier + ".ranks"); ConfigurationSection rankcs = plugin.guilds.getConfigurationSection(identifier + ".ranks");
if (rankcs != null) if (rankcs != null)
@ -327,6 +365,7 @@ public class Guild
plugin.guilds.getStringList(identifier + ".ranks." + key + ".members"))); plugin.guilds.getStringList(identifier + ".ranks." + key + ".members")));
} }
} }
return new Guild(identifier, return new Guild(identifier,
plugin.guilds.getString(identifier + ".name"), plugin.guilds.getString(identifier + ".name"),
plugin.guilds.getString(identifier + ".owner"), plugin.guilds.getString(identifier + ".owner"),
@ -347,7 +386,9 @@ public class Guild
{ {
Guild kg = getGuild(key); Guild kg = getGuild(key);
if (kg.getMembers().contains(player.getName())) if (kg.getMembers().contains(player.getName()))
{
guild = kg; guild = kg;
}
} }
return guild; return guild;
} }
@ -363,7 +404,9 @@ public class Guild
{ {
Guild guild = getGuild(key); Guild guild = getGuild(key);
if (guild.getMembers().contains(player.getName())) if (guild.getMembers().contains(player.getName()))
{
return true; return true;
}
} }
return false; return false;
} }

View file

@ -19,7 +19,10 @@ public enum GuildState
public static GuildState findState(String string) public static GuildState findState(String string)
{ {
if (string == null) if (string == null)
{
return null; return null;
}
switch (string.toLowerCase()) switch (string.toLowerCase())
{ {
case "open": case "open":

View file

@ -18,16 +18,20 @@ public class ChatListener implements Listener
Player player = e.getPlayer(); Player player = e.getPlayer();
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{
return; return;
}
if (Common.IN_GUILD_CHAT.contains(player)) if (Common.IN_GUILD_CHAT.contains(player))
{ {
guild.chat(player.getName(), e.getMessage()); guild.chat(player.getName(), e.getMessage());
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
if (guild.hasTag()) if (guild.hasTag())
{ {
e.setFormat(GUtil.colorize(guild.getTag()) + ChatColor.RESET + " " + e.getFormat()); e.setFormat(GUtil.colorize(guild.getTag()) + ChatColor.RESET + " " + e.getFormat());
} }
} }
} }

View file

@ -15,10 +15,13 @@ public class JoinListener implements Listener
Player player = e.getPlayer(); Player player = e.getPlayer();
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
{
return; return;
}
if (guild.hasMOTD()) if (guild.hasMOTD())
{ {
player.sendMessage(GUtil.colorize(guild.getMotd())); player.sendMessage(GUtil.colorize(guild.getMotd()));
} }
} }
} }

View file

@ -2,7 +2,6 @@ name: TFGuilds
version: ${project.version} version: ${project.version}
main: me.totalfreedom.tfguilds.TFGuilds main: me.totalfreedom.tfguilds.TFGuilds
api-version: 1.16 api-version: 1.16
softdepend: [TotalFreedomMod]
authors: [speed, super] authors: [speed, super]
description: A guilds plugin for the TotalFreedom server. description: A guilds plugin for the TotalFreedom server.
commands: commands:
@ -17,4 +16,8 @@ commands:
tfguilds: tfguilds:
description: Information about the plugin. description: Information about the plugin.
usage: /<command> usage: /<command>
aliases: [tfg] aliases: [tfg]
guildchatspy:
description: An admin only command which allows for spying on guild chat.
usage: /<command>
aliases: [gchatspy, gcs]