mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-06-26 07:40:37 +00:00
e6d3dc6b12
* TFGuilds rewrite almost completed (FS-164 FS-133 FS-244) The rewrite is nearing completion - few modifications to TFGuilds and TFM and it will be ready for production * Finalise few things * Code cleanup * Use empty list instead and true instead of false
57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package me.totalfreedom.tfguilds.command;
|
|
|
|
import me.totalfreedom.tfguilds.Common;
|
|
import me.totalfreedom.tfguilds.guild.Guild;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public class HomeSubCommand extends Common implements SubCommand
|
|
{
|
|
|
|
@Override
|
|
public void execute(CommandSender sender, Player playerSender, String[] args)
|
|
{
|
|
if (!(sender instanceof Player))
|
|
{
|
|
sender.sendMessage(IN_GAME_ONLY);
|
|
return;
|
|
}
|
|
|
|
if (args.length > 2)
|
|
{
|
|
sender.sendMessage(USAGE + "/g home [set]");
|
|
return;
|
|
}
|
|
|
|
Guild guild = Guild.getGuild(playerSender);
|
|
if (guild == null)
|
|
{
|
|
sender.sendMessage(NOT_IN_GUILD);
|
|
return;
|
|
}
|
|
|
|
if (args.length == 2)
|
|
{
|
|
if (args[1].equalsIgnoreCase("set"))
|
|
{
|
|
if (!guild.isModerator(playerSender))
|
|
{
|
|
sender.sendMessage(PREFIX + "Only guild moderators can set guild's home location");
|
|
return;
|
|
}
|
|
|
|
guild.setHome(playerSender.getLocation());
|
|
sender.sendMessage(PREFIX + "Successfully set guild's home to your location");
|
|
}
|
|
else
|
|
{
|
|
sender.sendMessage(USAGE + "/g home [set]");
|
|
}
|
|
return;
|
|
}
|
|
|
|
playerSender.teleport(guild.getHome());
|
|
sender.sendMessage(PREFIX + "Teleported to your guild's home!");
|
|
}
|
|
}
|