Răsfoiți Sursa

Fixed some small mistakes in CommandUtils

TfT_02 11 ani în urmă
părinte
comite
d5bd9a1693

+ 1 - 0
Changelog.txt

@@ -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 the "Dodge" DamageModifier wasn't being read from advanced.yml
  = Fixed a bug where squid were not awarding XP.
  = 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 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 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**
  ! 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.
  ! Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla.

+ 1 - 1
src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java

@@ -19,7 +19,7 @@ public class PartyInviteCommand implements CommandExecutor {
         switch (args.length) {
         switch (args.length) {
             case 2:
             case 2:
                 String targetName = Misc.getMatchedPlayerName(args[1]);
                 String targetName = Misc.getMatchedPlayerName(args[1]);
-                McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
+                McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
 
 
                 if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
                 if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
                     return false;
                     return false;

+ 13 - 3
src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java

@@ -2,6 +2,7 @@ package com.gmail.nossr50.util.commands;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import org.bukkit.OfflinePlayer;
 import org.bukkit.command.CommandSender;
 import org.bukkit.command.CommandSender;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 
 
@@ -72,7 +73,7 @@ public final class CommandUtils {
         return true;
         return true;
     }
     }
 
 
-    public static boolean isOffline(CommandSender sender, Player player) {
+    public static boolean isOffline(CommandSender sender, OfflinePlayer player) {
         if (player.isOnline()) {
         if (player.isOnline()) {
             return false;
             return false;
         }
         }
@@ -81,6 +82,15 @@ public final class CommandUtils {
         return true;
         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) {
     public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
         if (mcMMOPlayer != null) {
         if (mcMMOPlayer != null) {
             return true;
             return true;
@@ -92,7 +102,7 @@ public final class CommandUtils {
             return false;
             return false;
         }
         }
 
 
-        sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
+        sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
         return false;
         return false;
     }
     }
 
 
@@ -101,7 +111,7 @@ public final class CommandUtils {
             return false;
             return false;
         }
         }
 
 
-        sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
+        sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
         return true;
         return true;
     }
     }