mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Fixed some small mistakes in CommandUtils
This commit is contained in:
parent
9b60cd96f9
commit
d5bd9a1693
@ -36,6 +36,7 @@ Version 1.4.07-dev
|
||||
= Fixed a bug where the "Dodge" DamageModifier wasn't being read from advanced.yml
|
||||
= Fixed a bug where squid were not awarding XP.
|
||||
= Fixed a bug where Combat XP was granted within 5 seconds for respawned players
|
||||
= Fixed a bug where wrong feedback messages were being send when using a command on an offline player
|
||||
! Changed format of treasures.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
|
||||
! Changed format of repair.vanilla.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
|
||||
! Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla.
|
||||
|
@ -19,7 +19,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
String targetName = Misc.getMatchedPlayerName(args[1]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -72,7 +73,7 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isOffline(CommandSender sender, Player player) {
|
||||
public static boolean isOffline(CommandSender sender, OfflinePlayer player) {
|
||||
if (player.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
@ -81,6 +82,15 @@ public final class CommandUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there is a valid mcMMOPlayer object.
|
||||
*
|
||||
* @param sender CommandSender who used the command
|
||||
* @param playerName name of the target player
|
||||
* @param mcMMOPlayer mcMMOPlayer object of the target player
|
||||
*
|
||||
* @return true if the player is online and a valid mcMMOPlayer object was found
|
||||
*/
|
||||
public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
|
||||
if (mcMMOPlayer != null) {
|
||||
return true;
|
||||
@ -92,7 +102,7 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -101,7 +111,7 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user