Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.nitexx3.zitcrafttpa.commands;
- import me.nitexx3.zitcrafttpa.Main;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class TpacceptCommand implements CommandExecutor {
- Main plugin;
- public TpacceptCommand(Main plugin){
- this.plugin = plugin;
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
- if((sender instanceof Player)){
- Player p = (Player)sender;
- if(args.length == 0){
- Player other = (Player)this.plugin.tpaManager.getLastSenderByReceiver.get(p);
- if (other != null){
- if ((System.currentTimeMillis() - ((Long)this.plugin.tpaManager.lastSenderRequestTime.get(other)).longValue()) / 1000L <= 60L){
- this.plugin.tpaManager.acceptRequest(other, p);
- String otheraccept = this.plugin.getConfigManager().otheraccept;
- other.sendMessage(otheraccept.replaceAll("&", "§").replaceAll("{PLAYER}", p.getName()));
- String tp = this.plugin.getConfigManager().tp;
- other.sendMessage(tp.replaceAll("&", "§"));
- String tpaccept = this.plugin.getConfigManager().tpaccept;
- p.sendMessage(tpaccept.replaceAll("&", "§").replaceAll("{PLAYER}", other.getName()));
- this.plugin.TeleportPlayerWithDelay(other, p.getLocation());
- return true;
- }else{
- String notfound = this.plugin.getConfigManager().notfound;
- p.sendMessage(notfound.replaceAll("&", "§"));
- }
- }else{
- String notfound = this.plugin.getConfigManager().notfound;
- p.sendMessage(notfound.replaceAll("&", "§"));
- }
- }else{
- String tpacceptussage = this.plugin.getConfigManager().tpacceptussage;
- p.sendMessage(tpacceptussage.replaceAll("&", "§"));
- }
- }else{
- String noconsole = this.plugin.getConfigManager().noconsole;
- CommandSender console = this.plugin.getServer().getConsoleSender();
- console.sendMessage(noconsole.replaceAll("&", "§"));
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment