mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Have PtpCommand use getPlayerExact to check for offline
This commit is contained in:
parent
eb10db5b06
commit
92fa2782d0
@ -9,8 +9,6 @@ import com.gmail.nossr50.datatypes.party.Party;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
public class PartyJoinCommand implements CommandExecutor {
|
public class PartyJoinCommand implements CommandExecutor {
|
||||||
|
@ -88,7 +88,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendTeleportRequest(sender, player, Misc.getMatchedPlayerName(args[0]));
|
sendTeleportRequest(player, Misc.getMatchedPlayerName(args[0]));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -113,8 +113,8 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendTeleportRequest(CommandSender sender, Player player, String targetName) {
|
private void sendTeleportRequest(Player player, String targetName) {
|
||||||
if (!canTeleport(sender, player, targetName)) {
|
if (!canTeleport(player, targetName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,20 +132,21 @@ public class PtpCommand implements TabExecutor {
|
|||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
protected static boolean canTeleport(Player player, String targetName) {
|
||||||
mcMMOTarget = UserManager.getPlayer(targetName);
|
target = mcMMO.p.getServer().getPlayerExact(targetName);
|
||||||
|
|
||||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
if (target == null) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = mcMMOTarget.getPlayer();
|
|
||||||
|
|
||||||
if (player.equals(target)) {
|
if (player.equals(target)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self"));
|
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mcMMOTarget = UserManager.getPlayer(target);
|
||||||
|
|
||||||
if (!PartyManager.inSameParty(player, target)) {
|
if (!PartyManager.inSameParty(player, target)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user