mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 07:55:03 +00:00
add guild teleportation
This commit is contained in:
parent
110963efc7
commit
20ab49ae8d
5 changed files with 63 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>me.totalfreedom</groupId>
|
||||
<artifactId>TFGuilds</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<version>0.0.9</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>TFGuilds</name>
|
||||
|
|
|
@ -42,6 +42,7 @@ public final class TFGuilds extends JavaPlugin
|
|||
this.getCommand("guildtag").setExecutor(new GuildTagCommand());
|
||||
this.getCommand("guildchat").setExecutor(new GuildChatCommand());
|
||||
this.getCommand("disbandguild").setExecutor(new DisbandGuildCommand());
|
||||
this.getCommand("guildteleport").setExecutor(new GuildTeleportCommand());
|
||||
}
|
||||
|
||||
private void enableListeners()
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package me.totalfreedom.tfguilds.command;
|
||||
|
||||
import me.totalfreedom.tfguilds.util.GUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class GuildTeleportCommand implements CommandExecutor
|
||||
{
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GUtil.isConsole(sender))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "You are not allowed to run this command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String guild = GUtil.getGuild((Player) sender);
|
||||
if (guild == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Player not found.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!GUtil.isGuildMember(target, GUtil.getGuild((Player) sender)))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "That player isn't in your guild.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location targetLoc = target.getLocation();
|
||||
((Player) sender).teleport(targetLoc);
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Teleported to " + target.getName() + " successfully.");
|
||||
target.sendMessage(ChatColor.GREEN + sender.getName() + " has teleported to you.");
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ public class TfGuildsCommand extends GBase implements CommandExecutor
|
|||
sender.sendMessage(GUtil.color("&aTFGuilds &2is a plugin which allows for players to make their own guilds, providing guild chat, guild teleportation, and more."));
|
||||
sender.sendMessage(String.format(GUtil.color("&2Version &av%s"), plugin.getDescription().getVersion()));
|
||||
sender.sendMessage(GUtil.color("&2Developed by &aspeednt & supernt"));
|
||||
sender.sendMessage(GUtil.color("&2https://github.com/speedxx/TFGuilds"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,4 +25,8 @@ commands:
|
|||
disbandguild:
|
||||
description: Deletes your guild
|
||||
usage: /<command>
|
||||
aliases: [deleteguild]
|
||||
aliases: [deleteguild]
|
||||
guildteleport:
|
||||
description: Teleport to other guild members
|
||||
usage: /<command> <player>
|
||||
aliases: [guildtp, tpguild]
|
Loading…
Reference in a new issue