mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 10:33:43 +01:00 
			
		
		
		
	Use equalsIgnoreCase() instead of equals(), and use == for compaing
worlds. Fixes #815
This commit is contained in:
		@@ -104,7 +104,7 @@ public class PartyCommand implements CommandExecutor {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Party leader commands
 | 
			
		||||
        if (!mcMMOPlayer.getParty().getLeader().equals(player.getName())) {
 | 
			
		||||
        if (!mcMMOPlayer.getParty().getLeader().equalsIgnoreCase(player.getName())) {
 | 
			
		||||
            sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ public class PartyInfoCommand implements CommandExecutor {
 | 
			
		||||
        StringBuilder memberList = new StringBuilder();
 | 
			
		||||
 | 
			
		||||
        for (OfflinePlayer member : playerParty.getMembers()) {
 | 
			
		||||
            if (playerParty.getLeader().equals(member.getName())) {
 | 
			
		||||
            if (playerParty.getLeader().equalsIgnoreCase(member.getName())) {
 | 
			
		||||
                memberList.append(ChatColor.GOLD).append(member.getName()).append(" ");
 | 
			
		||||
            }
 | 
			
		||||
            else if (member.isOnline()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ public class PartyRenameCommand implements CommandExecutor {
 | 
			
		||||
                        return true;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (!member.getName().equals(leaderName)) {
 | 
			
		||||
                    if (!member.getName().equalsIgnoreCase(leaderName)) {
 | 
			
		||||
                        member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ public class PlayerProfile {
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            for (HudType type : HudType.values()) {
 | 
			
		||||
                if (type.toString().equals(huds.get(1).get(0))) {
 | 
			
		||||
                if (type.toString().equalsIgnoreCase(huds.get(1).get(0))) {
 | 
			
		||||
                    hudType = type;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -186,7 +186,7 @@ public class PlayerProfile {
 | 
			
		||||
                // Find if the line contains the player we want.
 | 
			
		||||
                String[] character = line.split(":");
 | 
			
		||||
 | 
			
		||||
                if (!character[0].equals(playerName)) {
 | 
			
		||||
                if (!character[0].equalsIgnoreCase(playerName)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@@ -400,7 +400,7 @@ public class PlayerProfile {
 | 
			
		||||
                // While not at the end of the file
 | 
			
		||||
                while ((line = in.readLine()) != null) {
 | 
			
		||||
                    // Read the line in and copy it to the output it's not the player we want to edit
 | 
			
		||||
                    if (!line.split(":")[0].equals(playerName)) {
 | 
			
		||||
                    if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
 | 
			
		||||
                        writer.append(line).append("\r\n");
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ public final class PartyManager {
 | 
			
		||||
        List<Player> nearMembers = new ArrayList<Player>();
 | 
			
		||||
        if (party != null) {
 | 
			
		||||
            for (Player member : party.getOnlineMembers()) {
 | 
			
		||||
                if (!player.getName().equals(member.getName()) && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
 | 
			
		||||
                if (!player.getName().equalsIgnoreCase(member.getName()) && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
 | 
			
		||||
                    nearMembers.add(member);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -150,7 +150,7 @@ public final class PartyManager {
 | 
			
		||||
    public static Party getPlayerParty(String playerName) {
 | 
			
		||||
        for (Party party : parties) {
 | 
			
		||||
            for (OfflinePlayer member : party.getMembers()) {
 | 
			
		||||
                if (member.getName().equals(playerName)) {
 | 
			
		||||
                if (member.getName().equalsIgnoreCase(playerName)) {
 | 
			
		||||
                    return party;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -184,7 +184,7 @@ public final class PartyManager {
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            // If the leaving player was the party leader, appoint a new leader from the party members
 | 
			
		||||
            if (party.getLeader().equals(player.getName())) {
 | 
			
		||||
            if (party.getLeader().equalsIgnoreCase(player.getName())) {
 | 
			
		||||
                String newLeader = members.get(0).getName();
 | 
			
		||||
                party.setLeader(newLeader);
 | 
			
		||||
            }
 | 
			
		||||
@@ -374,10 +374,10 @@ public final class PartyManager {
 | 
			
		||||
        String leaderName = party.getLeader();
 | 
			
		||||
 | 
			
		||||
        for (Player member : party.getOnlineMembers()) {
 | 
			
		||||
            if (member.getName().equals(playerName)) {
 | 
			
		||||
            if (member.getName().equalsIgnoreCase(playerName)) {
 | 
			
		||||
                member.sendMessage(LocaleLoader.getString("Party.Owner.Player"));
 | 
			
		||||
            }
 | 
			
		||||
            else if (member.getName().equals(leaderName)) {
 | 
			
		||||
            else if (member.getName().equalsIgnoreCase(leaderName)) {
 | 
			
		||||
                member.sendMessage(LocaleLoader.getString("Party.Owner.NotLeader"));
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
@@ -396,7 +396,7 @@ public final class PartyManager {
 | 
			
		||||
     * @return true if the player can invite
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean canInvite(Player player, Party party) {
 | 
			
		||||
        if (party.isLocked() && !party.getLeader().equals(player.getName())) {
 | 
			
		||||
        if (party.isLocked() && !party.getLeader().equalsIgnoreCase(player.getName())) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ public class MctopCommandAsyncTask implements Runnable {
 | 
			
		||||
        mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                if (query.equals("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
 | 
			
		||||
                if (query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
 | 
			
		||||
                    sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ public class SQLConversionTask implements Runnable {
 | 
			
		||||
                playerName = character[0];
 | 
			
		||||
 | 
			
		||||
                // Check for things we don't want put in the DB
 | 
			
		||||
                if (playerName == null || playerName.equals("null") || playerName.equals("#Storage place for user information")) {
 | 
			
		||||
                if (playerName == null || playerName.equalsIgnoreCase("null") || playerName.equalsIgnoreCase("#Storage place for user information")) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ public class ArcheryManager extends SkillManager {
 | 
			
		||||
        Location shooterLocation = player.getLocation();
 | 
			
		||||
        Location targetLocation = target.getLocation();
 | 
			
		||||
 | 
			
		||||
        if (!shooterLocation.getWorld().equals(targetLocation.getWorld())) {
 | 
			
		||||
        if (shooterLocation.getWorld() != targetLocation.getWorld()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ public final class Misc {
 | 
			
		||||
     * @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean isNear(Location first, Location second, double maxDistance) {
 | 
			
		||||
        if (!first.getWorld().equals(second.getWorld())) {
 | 
			
		||||
        if (first.getWorld() != second.getWorld()) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user