Good morning, I've wrote a code, which will teleport a player to sender and will check if the sender was a player and if requested player is online, but I can't figure out, how can a requested player allow/disallow to teleport him to sender. For example: sender is sending a /tpall someplayernickname Someplayernickname get a message in which is explained to him, that someone wan't to teleport him and he need to decide allow or not for example /tpall allow and /tpall disallow if allow - he will be teleported, if not - he won't. And I can't find a solution. This is my main class (and the only one): (I've put '//' where I tried to make something, but I'm pretty sure that it's wrong) (oh, and sorry for messages to players in this code, I'm just consolidating my knowledge so this plugin only for my learning purpose, not public) PHP: package zb.zebrasblak.tp; import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.Player;import org.bukkit.plugin.java.JavaPlugin; public class main extends JavaPlugin { public void onEnable(){ getLogger().info("F**k was given."); } public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ Player player = null; if (args.length > 1){ sender.sendMessage("I***t, too many arguments!"); return true; } if (args.length == 0){ sender.sendMessage("Are you f**king kidding me? Enter the f**king name!"); return true; } if (args.length == 1){ if(sender instanceof Player){ player = (Player) sender; } if(cmd.getName().equalsIgnoreCase("tpall")){ if (player == null){ sender.sendMessage("You must be a f**king player to use this command"); } else { Player other = getServer().getPlayer(args[0]); if (other != null){ // boolean onCommand(CommandSender sendera, Command cmda, String commandLabela, String[] argsa){// if(cmd.getName().equalsIgnoreCase("tpy")){ other.teleport(player); player.sendMessage("That bastard was teleported to you!"); other.sendMessage("You were teleported to that m***erf**ker.");// return true;// } // return false;// } } else { player.sendMessage("Player isn't currently online!"); return true; } return true; } } } return false; } public void onDisable(){ getLogger().info("F**k was taken."); } } Thank you for reading, ZebrasBlak.
When someone does /tpall then store all relevant player names In a Hashtable<String, String> field. Where the key is the player name that will be teleported and the value is the player name to teleport to. When someone types "/tpall accept" then using that Hashtable field get the target players location and teleport him.