mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Moving party stuff from PlayerProfile to McMMOPlayer
This commit is contained in:
		@@ -20,7 +20,7 @@ public final class PartyAPI {
 | 
				
			|||||||
     * @return the name of the player's party
 | 
					     * @return the name of the player's party
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static String getPartyName(Player player) {
 | 
					    public static String getPartyName(Player player) {
 | 
				
			||||||
        return Users.getPlayer(player).getProfile().getParty().getName();
 | 
					        return Users.getPlayer(player).getParty().getName();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -32,7 +32,7 @@ public final class PartyAPI {
 | 
				
			|||||||
     * @return true if the player is in a party, false otherwise
 | 
					     * @return true if the player is in a party, false otherwise
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static boolean inParty(Player player) {
 | 
					    public static boolean inParty(Player player) {
 | 
				
			||||||
        return Users.getPlayer(player).getProfile().inParty();
 | 
					        return Users.getPlayer(player).inParty();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -77,7 +77,7 @@ public final class PartyAPI {
 | 
				
			|||||||
            party.setLeader(playerName);
 | 
					            party.setLeader(playerName);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PartyManager.addToParty(playerName, Users.getPlayer(player).getProfile(), party);
 | 
					        PartyManager.addToParty(playerName, Users.getPlayer(player), party);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -88,7 +88,7 @@ public final class PartyAPI {
 | 
				
			|||||||
     * @param player The player to remove
 | 
					     * @param player The player to remove
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void removeFromParty(Player player) {
 | 
					    public static void removeFromParty(Player player) {
 | 
				
			||||||
        PartyManager.removeFromParty(player.getName(), Users.getPlayer(player).getProfile().getParty());
 | 
					        PartyManager.removeFromParty(player.getName(), Users.getPlayer(player).getParty());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,14 +8,14 @@ import org.bukkit.entity.Player;
 | 
				
			|||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.chat.ChatManager;
 | 
					import com.gmail.nossr50.chat.ChatManager;
 | 
				
			||||||
import com.gmail.nossr50.commands.CommandHelper;
 | 
					import com.gmail.nossr50.commands.CommandHelper;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.util.Users;
 | 
					import com.gmail.nossr50.util.Users;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ACommand implements CommandExecutor {
 | 
					public class ACommand implements CommandExecutor {
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
        PlayerProfile profile;
 | 
					        McMMOPlayer mcMMOPlayer;
 | 
				
			||||||
        String usage = LocaleLoader.getString("Commands.Usage.1", "a", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
 | 
					        String usage = LocaleLoader.getString("Commands.Usage.1", "a", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
 | 
					        if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
 | 
				
			||||||
@@ -25,15 +25,15 @@ public class ACommand implements CommandExecutor {
 | 
				
			|||||||
        switch (args.length) {
 | 
					        switch (args.length) {
 | 
				
			||||||
        case 0:
 | 
					        case 0:
 | 
				
			||||||
            if (sender instanceof Player) {
 | 
					            if (sender instanceof Player) {
 | 
				
			||||||
                profile = Users.getProfile((Player) sender);
 | 
					                mcMMOPlayer = Users.getPlayer((Player) sender);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (profile.getPartyChatMode()) {
 | 
					                if (mcMMOPlayer.getPartyChatMode()) {
 | 
				
			||||||
                    profile.togglePartyChat();
 | 
					                    mcMMOPlayer.togglePartyChat();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                profile.toggleAdminChat();
 | 
					                mcMMOPlayer.toggleAdminChat();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (profile.getAdminChatMode()) {
 | 
					                if (mcMMOPlayer.getAdminChatMode()) {
 | 
				
			||||||
                    sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
 | 
					                    sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
 | 
				
			|||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.chat.ChatManager;
 | 
					import com.gmail.nossr50.chat.ChatManager;
 | 
				
			||||||
import com.gmail.nossr50.commands.CommandHelper;
 | 
					import com.gmail.nossr50.commands.CommandHelper;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.party.Party;
 | 
					import com.gmail.nossr50.party.Party;
 | 
				
			||||||
import com.gmail.nossr50.party.PartyManager;
 | 
					import com.gmail.nossr50.party.PartyManager;
 | 
				
			||||||
@@ -23,7 +23,7 @@ public class PCommand implements CommandExecutor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
        PlayerProfile profile;
 | 
					        McMMOPlayer mcMMOPlayer;
 | 
				
			||||||
        String usage = LocaleLoader.getString("Commands.Usage.2", "p", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
 | 
					        String usage = LocaleLoader.getString("Commands.Usage.2", "p", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
 | 
					        if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
 | 
				
			||||||
@@ -33,15 +33,15 @@ public class PCommand implements CommandExecutor {
 | 
				
			|||||||
        switch (args.length) {
 | 
					        switch (args.length) {
 | 
				
			||||||
        case 0:
 | 
					        case 0:
 | 
				
			||||||
            if (sender instanceof Player) {
 | 
					            if (sender instanceof Player) {
 | 
				
			||||||
                profile = Users.getProfile((Player) sender);
 | 
					                mcMMOPlayer = Users.getPlayer((Player) sender);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (profile.getAdminChatMode()) {
 | 
					                if (mcMMOPlayer.getAdminChatMode()) {
 | 
				
			||||||
                    profile.toggleAdminChat();
 | 
					                    mcMMOPlayer.toggleAdminChat();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                profile.togglePartyChat();
 | 
					                mcMMOPlayer.togglePartyChat();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (profile.getPartyChatMode()) {
 | 
					                if (mcMMOPlayer.getPartyChatMode()) {
 | 
				
			||||||
                    sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
 | 
					                    sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
@@ -57,7 +57,7 @@ public class PCommand implements CommandExecutor {
 | 
				
			|||||||
        default:
 | 
					        default:
 | 
				
			||||||
            if (sender instanceof Player) {
 | 
					            if (sender instanceof Player) {
 | 
				
			||||||
                Player player = (Player) sender;
 | 
					                Player player = (Player) sender;
 | 
				
			||||||
                Party party = Users.getProfile(player).getParty();
 | 
					                Party party = Users.getPlayer(player).getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (party == null) {
 | 
					                if (party == null) {
 | 
				
			||||||
                    player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
					                    player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,12 @@ public class McMMOPlayer {
 | 
				
			|||||||
    private PlayerProfile profile;
 | 
					    private PlayerProfile profile;
 | 
				
			||||||
    private Party party;
 | 
					    private Party party;
 | 
				
			||||||
    private Party invite;
 | 
					    private Party invite;
 | 
				
			||||||
 | 
					    private Player ptpRequest;
 | 
				
			||||||
 | 
					    private boolean ptpEnabled = true;
 | 
				
			||||||
 | 
					    private boolean ptpConfirmRequired = Config.getInstance().getPTPCommandConfirmRequired();
 | 
				
			||||||
 | 
					    private long ptpTimeout;
 | 
				
			||||||
 | 
					    private boolean partyChatMode;
 | 
				
			||||||
 | 
					    private boolean adminChatMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public McMMOPlayer (Player player) {
 | 
					    public McMMOPlayer (Player player) {
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
@@ -204,4 +210,60 @@ public class McMMOPlayer {
 | 
				
			|||||||
    public void removeInvite() {
 | 
					    public void removeInvite() {
 | 
				
			||||||
        invite = null;
 | 
					        invite = null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    public boolean getPtpEnabled() {
 | 
				
			||||||
 | 
					        return ptpEnabled;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void togglePtpUse() {
 | 
				
			||||||
 | 
					        ptpEnabled = !ptpEnabled;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Player getPtpRequest() {
 | 
				
			||||||
 | 
					        return ptpRequest;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setPtpRequest(Player ptpRequest) {
 | 
				
			||||||
 | 
					        this.ptpRequest = ptpRequest;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean hasPtpRequest() {
 | 
				
			||||||
 | 
					        return (ptpRequest != null) ? true : false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void removePtpRequest() {
 | 
				
			||||||
 | 
					        ptpRequest = null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean getPtpConfirmRequired() {
 | 
				
			||||||
 | 
					        return ptpConfirmRequired;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void togglePtpConfirmRequired() {
 | 
				
			||||||
 | 
					        ptpConfirmRequired = !ptpConfirmRequired;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long getPtpTimeout() {
 | 
				
			||||||
 | 
					        return ptpTimeout;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void actualizePtpTimeout() {
 | 
				
			||||||
 | 
					        ptpTimeout = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean getAdminChatMode() {
 | 
				
			||||||
 | 
					        return adminChatMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void toggleAdminChat() {
 | 
				
			||||||
 | 
					        adminChatMode = !adminChatMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean getPartyChatMode() {
 | 
				
			||||||
 | 
					        return partyChatMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void togglePartyChat() {
 | 
				
			||||||
 | 
					        partyChatMode = !partyChatMode;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,13 +7,9 @@ import java.io.FileWriter;
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.config.Config;
 | 
					import com.gmail.nossr50.config.Config;
 | 
				
			||||||
import com.gmail.nossr50.database.Database;
 | 
					import com.gmail.nossr50.database.Database;
 | 
				
			||||||
import com.gmail.nossr50.party.Party;
 | 
					 | 
				
			||||||
import com.gmail.nossr50.party.PartyManager;
 | 
					 | 
				
			||||||
import com.gmail.nossr50.skills.utilities.AbilityType;
 | 
					import com.gmail.nossr50.skills.utilities.AbilityType;
 | 
				
			||||||
import com.gmail.nossr50.skills.utilities.SkillType;
 | 
					import com.gmail.nossr50.skills.utilities.SkillType;
 | 
				
			||||||
import com.gmail.nossr50.skills.utilities.ToolType;
 | 
					import com.gmail.nossr50.skills.utilities.ToolType;
 | 
				
			||||||
@@ -23,25 +19,16 @@ import com.gmail.nossr50.spout.huds.SpoutHud;
 | 
				
			|||||||
import com.gmail.nossr50.util.Misc;
 | 
					import com.gmail.nossr50.util.Misc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PlayerProfile {
 | 
					public class PlayerProfile {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private String playerName;
 | 
					    private String playerName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // HUD
 | 
					    // HUD
 | 
				
			||||||
    private SpoutHud spoutHud;
 | 
					    private SpoutHud spoutHud;
 | 
				
			||||||
    private HudType hudType;
 | 
					    private HudType hudType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Party Stuff
 | 
					 | 
				
			||||||
    private Party party;
 | 
					 | 
				
			||||||
    private Party invite;
 | 
					 | 
				
			||||||
    private Player ptpRequest;
 | 
					 | 
				
			||||||
    private boolean ptpEnabled = true;
 | 
					 | 
				
			||||||
    private boolean ptpConfirmRequired = Config.getInstance().getPTPCommandConfirmRequired();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Toggles
 | 
					    // Toggles
 | 
				
			||||||
    private boolean loaded;
 | 
					    private boolean loaded;
 | 
				
			||||||
    private boolean placedAnvil;
 | 
					    private boolean placedAnvil;
 | 
				
			||||||
    private boolean placedSalvageAnvil;
 | 
					    private boolean placedSalvageAnvil;
 | 
				
			||||||
    private boolean partyChatMode, adminChatMode;
 | 
					 | 
				
			||||||
    private boolean godMode;
 | 
					    private boolean godMode;
 | 
				
			||||||
    private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode;
 | 
					    private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode;
 | 
				
			||||||
    private boolean greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
 | 
					    private boolean greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
 | 
				
			||||||
@@ -53,7 +40,6 @@ public class PlayerProfile {
 | 
				
			|||||||
    // Timestamps
 | 
					    // Timestamps
 | 
				
			||||||
    private long recentlyHurt;
 | 
					    private long recentlyHurt;
 | 
				
			||||||
    private int respawnATS;
 | 
					    private int respawnATS;
 | 
				
			||||||
    private long ptpTimeout;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // mySQL STUFF
 | 
					    // mySQL STUFF
 | 
				
			||||||
    private int userId;
 | 
					    private int userId;
 | 
				
			||||||
@@ -67,7 +53,6 @@ public class PlayerProfile {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public PlayerProfile(String playerName, boolean addNew) {
 | 
					    public PlayerProfile(String playerName, boolean addNew) {
 | 
				
			||||||
        this.playerName = playerName;
 | 
					        this.playerName = playerName;
 | 
				
			||||||
        party = PartyManager.getPlayerParty(playerName);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (mcMMO.spoutEnabled) {
 | 
					        if (mcMMO.spoutEnabled) {
 | 
				
			||||||
            hudType = SpoutConfig.getInstance().defaultHudType;
 | 
					            hudType = SpoutConfig.getInstance().defaultHudType;
 | 
				
			||||||
@@ -546,26 +531,6 @@ public class PlayerProfile {
 | 
				
			|||||||
        this.hudType = hudType;
 | 
					        this.hudType = hudType;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
     * Chat Stuff
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean getAdminChatMode() {
 | 
					 | 
				
			||||||
        return adminChatMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void toggleAdminChat() {
 | 
					 | 
				
			||||||
        adminChatMode = !adminChatMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean getPartyChatMode() {
 | 
					 | 
				
			||||||
        return partyChatMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void togglePartyChat() {
 | 
					 | 
				
			||||||
        partyChatMode = !partyChatMode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Tools
 | 
					     * Tools
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@@ -1172,92 +1137,4 @@ public class PlayerProfile {
 | 
				
			|||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Party Stuff
 | 
					     * Party Stuff
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setInvite(Party invite) {
 | 
					 | 
				
			||||||
        this.invite = invite;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Party getInvite() {
 | 
					 | 
				
			||||||
        return invite;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean hasPartyInvite() {
 | 
					 | 
				
			||||||
        if (invite != null) {
 | 
					 | 
				
			||||||
            return true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setParty(Party party) {
 | 
					 | 
				
			||||||
        this.party = party;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Party getParty() {
 | 
					 | 
				
			||||||
        return party;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean inParty() {
 | 
					 | 
				
			||||||
        if (party != null) {
 | 
					 | 
				
			||||||
            return true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void removeParty() {
 | 
					 | 
				
			||||||
        party = null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void removeInvite() {
 | 
					 | 
				
			||||||
        invite = null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
     * Party Teleportation
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean getPtpEnabled() {
 | 
					 | 
				
			||||||
        return ptpEnabled;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void togglePtpUse() {
 | 
					 | 
				
			||||||
        ptpEnabled = !ptpEnabled;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setPtpRequest(Player ptpRequest) {
 | 
					 | 
				
			||||||
        this.ptpRequest = ptpRequest;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Player getPtpRequest() {
 | 
					 | 
				
			||||||
        return ptpRequest;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean hasPtpRequest() {
 | 
					 | 
				
			||||||
        if (ptpRequest != null) {
 | 
					 | 
				
			||||||
            return true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void removePtpRequest() {
 | 
					 | 
				
			||||||
        ptpRequest = null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean getPtpConfirmRequired() {
 | 
					 | 
				
			||||||
        return ptpConfirmRequired;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void togglePtpConfirmRequired() {
 | 
					 | 
				
			||||||
        ptpConfirmRequired = !ptpConfirmRequired;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public long getPtpTimeout() {
 | 
					 | 
				
			||||||
        return ptpTimeout;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void actualizePtpTimeout() {
 | 
					 | 
				
			||||||
        ptpTimeout = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,15 +63,16 @@ public class PlayerListener implements Listener {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PlayerProfile profile = Users.getPlayer(player).getProfile();
 | 
					        McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
 | 
				
			||||||
 | 
					        PlayerProfile profile = mcMMOPlayer.getProfile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (profile.getGodMode() && !Permissions.mcgod(player)) {
 | 
					        if (profile.getGodMode() && !Permissions.mcgod(player)) {
 | 
				
			||||||
            profile.toggleGodMode();
 | 
					            profile.toggleGodMode();
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (profile.inParty() && !Permissions.party(player)) {
 | 
					        if (mcMMOPlayer.inParty() && !Permissions.party(player)) {
 | 
				
			||||||
            profile.removeParty();
 | 
					            mcMMOPlayer.removeParty();
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -334,10 +335,10 @@ public class PlayerListener implements Listener {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PlayerProfile profile = Users.getPlayer(player).getProfile();
 | 
					        McMMOPlayer mcMMOPlayer = Users.getPlayer(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (profile.getPartyChatMode()) {
 | 
					        if (mcMMOPlayer.getPartyChatMode()) {
 | 
				
			||||||
            Party party = profile.getParty();
 | 
					            Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (party == null) {
 | 
					            if (party == null) {
 | 
				
			||||||
                player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
					                player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
				
			||||||
@@ -347,7 +348,7 @@ public class PlayerListener implements Listener {
 | 
				
			|||||||
            ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), event.getMessage());
 | 
					            ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), event.getMessage());
 | 
				
			||||||
            event.setCancelled(true);
 | 
					            event.setCancelled(true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if (profile.getAdminChatMode()) {
 | 
					        else if (mcMMOPlayer.getAdminChatMode()) {
 | 
				
			||||||
            ChatManager.handleAdminChat(plugin, player.getName(), player.getDisplayName(), event.getMessage());
 | 
					            ChatManager.handleAdminChat(plugin, player.getName(), player.getDisplayName(), event.getMessage());
 | 
				
			||||||
            event.setCancelled(true);
 | 
					            event.setCancelled(true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
 | 
				
			|||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.util.Misc;
 | 
					import com.gmail.nossr50.util.Misc;
 | 
				
			||||||
@@ -27,15 +28,15 @@ public final class PartyManager {
 | 
				
			|||||||
     * @return true if they are in the same party, false otherwise
 | 
					     * @return true if they are in the same party, false otherwise
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static boolean inSameParty(Player firstPlayer, Player secondPlayer) {
 | 
					    public static boolean inSameParty(Player firstPlayer, Player secondPlayer) {
 | 
				
			||||||
        PlayerProfile firstProfile = Users.getProfile(firstPlayer);
 | 
					        McMMOPlayer firstMcMMOPlayer = Users.getPlayer(firstPlayer);
 | 
				
			||||||
        PlayerProfile secondProfile = Users.getProfile(secondPlayer);
 | 
					        McMMOPlayer secondMcMMOPlayer = Users.getPlayer(secondPlayer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (firstProfile == null || secondProfile == null) {
 | 
					        if (firstMcMMOPlayer == null || secondMcMMOPlayer == null) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Party firstParty = firstProfile.getParty();
 | 
					        Party firstParty = firstMcMMOPlayer.getParty();
 | 
				
			||||||
        Party secondParty = secondProfile.getParty();
 | 
					        Party secondParty = secondMcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (firstParty == null || secondParty == null || firstParty != secondParty) {
 | 
					        if (firstParty == null || secondParty == null || firstParty != secondParty) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
@@ -98,7 +99,7 @@ public final class PartyManager {
 | 
				
			|||||||
     * @return all the players in the player's party
 | 
					     * @return all the players in the player's party
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static List<String> getAllMembers(Player player) {
 | 
					    public static List<String> getAllMembers(Player player) {
 | 
				
			||||||
        Party party = Users.getProfile(player).getParty();
 | 
					        Party party = Users.getPlayer(player).getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party == null) {
 | 
					        if (party == null) {
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
@@ -197,10 +198,10 @@ public final class PartyManager {
 | 
				
			|||||||
            informPartyMembersQuit(playerName, party);
 | 
					            informPartyMembersQuit(playerName, party);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PlayerProfile playerProfile = Users.getProfile(playerName);
 | 
					        McMMOPlayer mcMMOPlayer = Users.getPlayer(playerName);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
        if (playerProfile != null) {
 | 
					        if (mcMMOPlayer != null) {
 | 
				
			||||||
            playerProfile.removeParty();
 | 
					            mcMMOPlayer.removeParty();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -213,10 +214,11 @@ public final class PartyManager {
 | 
				
			|||||||
        List<String> members = party.getMembers();
 | 
					        List<String> members = party.getMembers();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (String member : party.getMembers()) {
 | 
					        for (String member : party.getMembers()) {
 | 
				
			||||||
            PlayerProfile playerProfile = Users.getProfile(member);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (playerProfile != null) {
 | 
					            McMMOPlayer mcMMOPlayer = Users.getPlayer(member);
 | 
				
			||||||
                playerProfile.removeParty();
 | 
					
 | 
				
			||||||
 | 
					            if (mcMMOPlayer != null) {
 | 
				
			||||||
 | 
					                mcMMOPlayer.removeParty();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -230,11 +232,11 @@ public final class PartyManager {
 | 
				
			|||||||
     * Create a new party
 | 
					     * Create a new party
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param player The player to add to the party
 | 
					     * @param player The player to add to the party
 | 
				
			||||||
     * @param playerProfile The profile of the player to add to the party
 | 
					     * @param mcMMOPlayer The player to add to the party
 | 
				
			||||||
     * @param partyName The party to add the player to
 | 
					     * @param partyName The party to add the player to
 | 
				
			||||||
     * @param password the password for this party, null if there was no password
 | 
					     * @param password The password for this party, null if there was no password
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void createParty(Player player, PlayerProfile playerProfile, String partyName, String password) {
 | 
					    public static void createParty(Player player, McMMOPlayer mcMMOPlayer, String partyName, String password) {
 | 
				
			||||||
        partyName = partyName.replace(".", "");
 | 
					        partyName = partyName.replace(".", "");
 | 
				
			||||||
        Party party = getParty(partyName);
 | 
					        Party party = getParty(partyName);
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
@@ -260,18 +262,18 @@ public final class PartyManager {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        player.sendMessage(LocaleLoader.getString("Commands.Party.Create", party.getName()));
 | 
					        player.sendMessage(LocaleLoader.getString("Commands.Party.Create", party.getName()));
 | 
				
			||||||
        addToParty(player.getName(), playerProfile, party);
 | 
					        addToParty(player.getName(), mcMMOPlayer, party);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Add a player to a party.
 | 
					     * Add a player to a party.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param player The player to add to the party
 | 
					     * @param player The player to add to the party
 | 
				
			||||||
     * @param playerProfile The profile of the player to add to the party
 | 
					     * @param mcMMOPlayer The player to add to the party
 | 
				
			||||||
     * @param partyName The party to add the player to
 | 
					     * @param partyName The party to add the player to
 | 
				
			||||||
     * @param password the password for this party, null if there was no password
 | 
					     * @param password the password for this party, null if there was no password
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void joinParty(Player player, PlayerProfile playerProfile, String partyName, String password) {
 | 
					    public static void joinParty(Player player, McMMOPlayer mcMMOPlayer, String partyName, String password) {
 | 
				
			||||||
        partyName = partyName.replace(".", "");
 | 
					        partyName = partyName.replace(".", "");
 | 
				
			||||||
        Party party = getParty(partyName);
 | 
					        Party party = getParty(partyName);
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
@@ -294,7 +296,7 @@ public final class PartyManager {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        player.sendMessage(LocaleLoader.getString("Commands.Party.Join", party.getName()));
 | 
					        player.sendMessage(LocaleLoader.getString("Commands.Party.Join", party.getName()));
 | 
				
			||||||
        addToParty(player.getName(), playerProfile, party);
 | 
					        addToParty(player.getName(), mcMMOPlayer, party);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -333,31 +335,31 @@ public final class PartyManager {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Accept a party invitation
 | 
					     * Accept a party invitation
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param player The player to add to the party
 | 
					     * @param Player The plaer to add to the party
 | 
				
			||||||
     * @param playerProfile The profile of the player
 | 
					     * @param mcMMOPlayer The player to add to the party
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void joinInvitedParty(Player player, PlayerProfile playerProfile) {
 | 
					    public static void joinInvitedParty(Player player, McMMOPlayer mcMMOPlayer) {
 | 
				
			||||||
        Party invite = playerProfile.getInvite();
 | 
					        Party invite = mcMMOPlayer.getInvite();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!parties.contains(invite)) {
 | 
					        if (!parties.contains(invite)) {
 | 
				
			||||||
            parties.add(invite);
 | 
					            parties.add(invite);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        player.sendMessage(LocaleLoader.getString("Commands.Invite.Accepted", invite.getName()));
 | 
					        player.sendMessage(LocaleLoader.getString("Commands.Invite.Accepted", invite.getName()));
 | 
				
			||||||
        playerProfile.removeInvite();
 | 
					        mcMMOPlayer.removeInvite();
 | 
				
			||||||
        addToParty(player.getName(), playerProfile, invite);
 | 
					        addToParty(player.getName(), mcMMOPlayer, invite);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Add a player to a party
 | 
					     * Add a player to a party
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param playerName The name of the player to add to a party
 | 
					     * @param playerName The name of the player to add to a party
 | 
				
			||||||
     * @param playerProfile The profile of the player
 | 
					     * @param mcMMOPlayer The player to add to the party
 | 
				
			||||||
     * @param party The party
 | 
					     * @param party The party
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void addToParty(String playerName, PlayerProfile playerProfile, Party party) {
 | 
					    public static void addToParty(String playerName, McMMOPlayer mcMMOPlayer, Party party) {
 | 
				
			||||||
        informPartyMembersJoin(playerName, party);
 | 
					        informPartyMembersJoin(playerName, party);
 | 
				
			||||||
        playerProfile.setParty(party);
 | 
					        mcMMOPlayer.setParty(party);
 | 
				
			||||||
        party.getMembers().add(playerName);
 | 
					        party.getMembers().add(playerName);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -402,14 +404,14 @@ public final class PartyManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Check if a player can invite others to their party.
 | 
					     * Check if a player can invite others to his party.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param player The player to check
 | 
					     * @param player The player to check
 | 
				
			||||||
     * @param playerProfile The profile of the given player
 | 
					     * @param mcMMOPlayer The player to check
 | 
				
			||||||
     * @return true if the player can invite
 | 
					     * @return true if the player can invite
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static boolean canInvite(Player player, PlayerProfile playerProfile) {
 | 
					    public static boolean canInvite(Player player, McMMOPlayer mcMMOPlayer) {
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party == null || (party.isLocked() && !party.getLeader().equals(player.getName()))) {
 | 
					        if (party == null || (party.isLocked() && !party.getLeader().equals(player.getName()))) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
 | 
				
			|||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.commands.CommandHelper;
 | 
					import com.gmail.nossr50.commands.CommandHelper;
 | 
				
			||||||
import com.gmail.nossr50.config.Config;
 | 
					import com.gmail.nossr50.config.Config;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
				
			||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
 | 
					import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
 | 
				
			||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
 | 
					import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
@@ -20,8 +20,8 @@ import com.gmail.nossr50.party.ShareHandler;
 | 
				
			|||||||
import com.gmail.nossr50.util.Users;
 | 
					import com.gmail.nossr50.util.Users;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PartyCommand implements CommandExecutor {
 | 
					public class PartyCommand implements CommandExecutor {
 | 
				
			||||||
 | 
					    private McMMOPlayer mcMMOPlayer;
 | 
				
			||||||
    private Player player;
 | 
					    private Player player;
 | 
				
			||||||
    private PlayerProfile playerProfile;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
@@ -33,8 +33,8 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.player = (Player) sender;
 | 
					        player = (Player) sender;
 | 
				
			||||||
        this.playerProfile = Users.getProfile(player);
 | 
					        mcMMOPlayer = Users.getPlayer(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (args.length < 1 || args[0].equalsIgnoreCase("info")) {
 | 
					        if (args.length < 1 || args[0].equalsIgnoreCase("info")) {
 | 
				
			||||||
            return party();
 | 
					            return party();
 | 
				
			||||||
@@ -53,7 +53,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return printHelp();
 | 
					            return printHelp();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (playerProfile.inParty()) {
 | 
					        if (mcMMOPlayer.inParty()) {
 | 
				
			||||||
            if (args[0].equalsIgnoreCase("quit") || args[0].equalsIgnoreCase("q") || args[0].equalsIgnoreCase("leave")) {
 | 
					            if (args[0].equalsIgnoreCase("quit") || args[0].equalsIgnoreCase("q") || args[0].equalsIgnoreCase("leave")) {
 | 
				
			||||||
                return quit();
 | 
					                return quit();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -104,8 +104,8 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean party() {
 | 
					    private boolean party() {
 | 
				
			||||||
        if (playerProfile.inParty()) {
 | 
					        if (mcMMOPlayer.inParty()) {
 | 
				
			||||||
            Party party = playerProfile.getParty();
 | 
					            Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Server server = mcMMO.p.getServer();
 | 
					            Server server = mcMMO.p.getServer();
 | 
				
			||||||
            String leader = party.getLeader();
 | 
					            String leader = party.getLeader();
 | 
				
			||||||
@@ -174,9 +174,6 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (args.length < 2) {
 | 
					        if (args.length < 2) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.Help.0"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.Help.0"));
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
@@ -189,7 +186,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!Users.getProfile(target).inParty()) {
 | 
					        if (!mcMMOPlayer.inParty()) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", args[1]));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", args[1]));
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -199,7 +196,9 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party != null && party.equals(Users.getProfile(target).getParty())) {
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (party != null && party.equals(Users.getPlayer(target).getParty())) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.Join.Self"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.Join.Self"));
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -210,26 +209,26 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            password = args[2];
 | 
					            password = args[2];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String partyTarget = PartyManager.getPlayerParty(target.getName()).getName();
 | 
					        Party targetParty = Users.getPlayer(target).getParty();
 | 
				
			||||||
        Party newParty = PartyManager.getParty(args[0]);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Check to see if the party exists, and if it does, can the player join it?
 | 
					        // Check to see if the party exists, and if it does, can the player join it?
 | 
				
			||||||
        if (newParty != null && !PartyManager.checkJoinability(player, newParty, null)) {
 | 
					        if (targetParty != null && !PartyManager.checkJoinability(player, targetParty, null)) {
 | 
				
			||||||
            return true; // End before any event is fired.
 | 
					            return true; // End before any event is fired.
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // TODO: We shoudln't fire the event before checking if the password is correct
 | 
				
			||||||
        if (party != null) {
 | 
					        if (party != null) {
 | 
				
			||||||
            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), partyTarget, EventReason.CHANGED_PARTIES);
 | 
					            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), targetParty.getName(), EventReason.CHANGED_PARTIES);
 | 
				
			||||||
            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
					            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (event.isCancelled()) {
 | 
					            if (event.isCancelled()) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PartyManager.removeFromParty(playerName, party);
 | 
					            PartyManager.removeFromParty(player.getName(), party);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, partyTarget, EventReason.JOINED_PARTY);
 | 
					            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, targetParty.getName(), EventReason.JOINED_PARTY);
 | 
				
			||||||
            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
					            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (event.isCancelled()) {
 | 
					            if (event.isCancelled()) {
 | 
				
			||||||
@@ -237,7 +236,8 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PartyManager.joinParty(player, playerProfile, partyTarget, password);
 | 
					        
 | 
				
			||||||
 | 
					        PartyManager.joinParty(player, mcMMOPlayer, targetParty.getName(), password);
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -246,10 +246,10 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (playerProfile.hasPartyInvite()) {
 | 
					        if (mcMMOPlayer.hasPartyInvite()) {
 | 
				
			||||||
            if (playerProfile.inParty()) {
 | 
					            if (mcMMOPlayer.inParty()) {
 | 
				
			||||||
                Party party = playerProfile.getParty();
 | 
					                Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
                McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), playerProfile.getInvite().getName(), EventReason.CHANGED_PARTIES);
 | 
					                McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), mcMMOPlayer.getInvite().getName(), EventReason.CHANGED_PARTIES);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
					                mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -260,7 +260,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
                PartyManager.removeFromParty(player.getName(), party);
 | 
					                PartyManager.removeFromParty(player.getName(), party);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
                McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, playerProfile.getInvite().getName(), EventReason.JOINED_PARTY);
 | 
					                McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, mcMMOPlayer.getInvite().getName(), EventReason.JOINED_PARTY);
 | 
				
			||||||
                mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
					                mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (event.isCancelled()) {
 | 
					                if (event.isCancelled()) {
 | 
				
			||||||
@@ -268,7 +268,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PartyManager.joinInvitedParty(player, playerProfile);
 | 
					            PartyManager.joinInvitedParty(player, mcMMOPlayer);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
 | 
					            player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
 | 
				
			||||||
@@ -283,7 +283,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (args.length < 2) {
 | 
					        if (args.length < 2) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.Help.1"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.Help.1"));
 | 
				
			||||||
@@ -304,7 +304,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (playerProfile.inParty()) {
 | 
					        if (mcMMOPlayer.inParty()) {
 | 
				
			||||||
            String oldPartyName = party.getName();
 | 
					            String oldPartyName = party.getName();
 | 
				
			||||||
            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, oldPartyName, partyname, EventReason.CHANGED_PARTIES);
 | 
					            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, oldPartyName, partyname, EventReason.CHANGED_PARTIES);
 | 
				
			||||||
            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
					            mcMMO.p.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
@@ -314,7 +314,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PartyManager.removeFromParty(playerName, party);
 | 
					            PartyManager.removeFromParty(playerName, party);
 | 
				
			||||||
            PartyManager.createParty(player, playerProfile, partyname, password);
 | 
					            PartyManager.createParty(player, mcMMOPlayer, partyname, password);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, partyname, EventReason.JOINED_PARTY);
 | 
					            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, partyname, EventReason.JOINED_PARTY);
 | 
				
			||||||
@@ -324,7 +324,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PartyManager.createParty(player, playerProfile, partyname, password);
 | 
					            PartyManager.createParty(player, mcMMOPlayer, partyname, password);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -337,7 +337,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party != null) {
 | 
					        if (party != null) {
 | 
				
			||||||
            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), null, EventReason.LEFT_PARTY);
 | 
					            McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), null, EventReason.LEFT_PARTY);
 | 
				
			||||||
@@ -361,15 +361,14 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					 | 
				
			||||||
        PlayerProfile playerProfile = Users.getProfile(player);
 | 
					 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (args.length < 2) {
 | 
					        if (args.length < 2) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[sharemode]"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[sharemode]"));
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String playerName = player.getName();
 | 
				
			||||||
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party.getLeader().equals(playerName)) {
 | 
					        if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
            if (args[1].equalsIgnoreCase("none") || args[1].equalsIgnoreCase("false")) {
 | 
					            if (args[1].equalsIgnoreCase("none") || args[1].equalsIgnoreCase("false")) {
 | 
				
			||||||
                party.setXpShareMode(ShareHandler.XpShareMode.NONE);
 | 
					                party.setXpShareMode(ShareHandler.XpShareMode.NONE);
 | 
				
			||||||
@@ -411,7 +410,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        switch (args.length) {
 | 
					        switch (args.length) {
 | 
				
			||||||
        case 2:
 | 
					        case 2:
 | 
				
			||||||
            if (!playerProfile.inParty()) {
 | 
					            if (!mcMMOPlayer.inParty()) {
 | 
				
			||||||
                player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
					                player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -423,10 +422,11 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
                    player.sendMessage(LocaleLoader.getString("Party.Player.InSameParty"));
 | 
					                    player.sendMessage(LocaleLoader.getString("Party.Player.InSameParty"));
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (PartyManager.canInvite(player, playerProfile)) {
 | 
					 | 
				
			||||||
                    Party party = playerProfile.getParty();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Users.getProfile(target).setInvite(party);
 | 
					                if (PartyManager.canInvite(player, mcMMOPlayer)) {
 | 
				
			||||||
 | 
					                    Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Users.getPlayer(target).setInvite(party);
 | 
				
			||||||
                    player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
 | 
					                    player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
 | 
				
			||||||
                    target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", party.getName(), player.getName()));
 | 
					                    target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", party.getName(), player.getName()));
 | 
				
			||||||
                    target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
 | 
					                    target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
 | 
				
			||||||
@@ -455,7 +455,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party.getLeader().equals(playerName)) {
 | 
					        if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
            if (!party.getMembers().contains(targetName)) {
 | 
					            if (!party.getMembers().contains(targetName)) {
 | 
				
			||||||
@@ -496,7 +496,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party.getLeader().equals(playerName)) {
 | 
					        if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
            for (Player onlineMembers : party.getOnlineMembers()) {
 | 
					            for (Player onlineMembers : party.getOnlineMembers()) {
 | 
				
			||||||
@@ -528,7 +528,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (args.length < 2) {
 | 
					        if (args.length < 2) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
 | 
				
			||||||
@@ -556,7 +556,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party != null) {
 | 
					        if (party != null) {
 | 
				
			||||||
            if (party.getLeader().equals(playerName)) {
 | 
					            if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
@@ -588,7 +588,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party != null) {
 | 
					        if (party != null) {
 | 
				
			||||||
            if (party.getLeader().equals(playerName)) {
 | 
					            if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
@@ -617,7 +617,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!party.getLeader().equals(playerName)) {
 | 
					        if (!party.getLeader().equals(playerName)) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
 | 
				
			||||||
@@ -647,7 +647,7 @@ public class PartyCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String playerName = player.getName();
 | 
					        String playerName = player.getName();
 | 
				
			||||||
        Party party = playerProfile.getParty();
 | 
					        Party party = mcMMOPlayer.getParty();
 | 
				
			||||||
        String leader = party.getLeader();
 | 
					        String leader = party.getLeader();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (party.getLeader().equals(playerName)) {
 | 
					        if (party.getLeader().equals(playerName)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
 | 
				
			|||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.commands.CommandHelper;
 | 
					import com.gmail.nossr50.commands.CommandHelper;
 | 
				
			||||||
import com.gmail.nossr50.config.Config;
 | 
					import com.gmail.nossr50.config.Config;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.datatypes.McMMOPlayer;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
					import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
				
			||||||
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
 | 
					import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
@@ -18,7 +19,7 @@ import com.gmail.nossr50.util.Users;
 | 
				
			|||||||
public class PtpCommand implements CommandExecutor {
 | 
					public class PtpCommand implements CommandExecutor {
 | 
				
			||||||
    private final mcMMO plugin;
 | 
					    private final mcMMO plugin;
 | 
				
			||||||
    private Player player;
 | 
					    private Player player;
 | 
				
			||||||
    private PlayerProfile playerProfile;
 | 
					    private McMMOPlayer mcMMOPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public PtpCommand(mcMMO instance) {
 | 
					    public PtpCommand(mcMMO instance) {
 | 
				
			||||||
        this.plugin = instance;
 | 
					        this.plugin = instance;
 | 
				
			||||||
@@ -38,8 +39,9 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        switch (args.length) {
 | 
					        switch (args.length) {
 | 
				
			||||||
        case 1:
 | 
					        case 1:
 | 
				
			||||||
            this.player = (Player) sender;
 | 
					            player = (Player) sender;
 | 
				
			||||||
            this.playerProfile = Users.getProfile(player);
 | 
					            mcMMOPlayer = Users.getPlayer(player);
 | 
				
			||||||
 | 
					            PlayerProfile playerProfile = mcMMOPlayer.getProfile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (args[0].equalsIgnoreCase("toggle")) {
 | 
					            if (args[0].equalsIgnoreCase("toggle")) {
 | 
				
			||||||
                return togglePartyTeleportation();
 | 
					                return togglePartyTeleportation();
 | 
				
			||||||
@@ -86,15 +88,15 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (PartyManager.inSameParty(player, target)) {
 | 
					        if (PartyManager.inSameParty(player, target)) {
 | 
				
			||||||
            PlayerProfile targetProfile = Users.getProfile(target);
 | 
					            McMMOPlayer targetMcMMOPlayer = Users.getPlayer(target);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!targetProfile.getPtpEnabled()) {
 | 
					            if (!targetMcMMOPlayer.getPtpEnabled()) {
 | 
				
			||||||
                player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", target.getName()));
 | 
					                player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", target.getName()));
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!Users.getProfile(target).getPtpConfirmRequired()) {
 | 
					            if (!targetMcMMOPlayer.getPtpConfirmRequired()) {
 | 
				
			||||||
                McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, playerProfile.getParty().getName());
 | 
					                McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());
 | 
				
			||||||
                plugin.getServer().getPluginManager().callEvent(event);
 | 
					                plugin.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (event.isCancelled()) {
 | 
					                if (event.isCancelled()) {
 | 
				
			||||||
@@ -104,10 +106,10 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
                player.teleport(target);
 | 
					                player.teleport(target);
 | 
				
			||||||
                player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", player.getName()));
 | 
					                player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", player.getName()));
 | 
				
			||||||
                target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", target.getName()));
 | 
					                target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", target.getName()));
 | 
				
			||||||
                playerProfile.setRecentlyHurt(System.currentTimeMillis());
 | 
					                mcMMOPlayer.getProfile().setRecentlyHurt(System.currentTimeMillis());
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                targetProfile.setPtpRequest(player);
 | 
					                targetMcMMOPlayer.setPtpRequest(player);
 | 
				
			||||||
                targetProfile.actualizePtpTimeout();
 | 
					                targetMcMMOPlayer.actualizePtpTimeout();
 | 
				
			||||||
                player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
 | 
					                player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
 | 
					                int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
 | 
				
			||||||
@@ -122,20 +124,20 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean acceptTeleportRequest() {
 | 
					    private boolean acceptTeleportRequest() {
 | 
				
			||||||
        if (!playerProfile.hasPtpRequest()) {
 | 
					        if (!mcMMOPlayer.hasPtpRequest()) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
 | 
					        int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((playerProfile.getPtpTimeout() + ptpRequestExpire) * Misc.TIME_CONVERSION_FACTOR < System.currentTimeMillis()) {
 | 
					        if ((mcMMOPlayer.getPtpTimeout() + ptpRequestExpire) * Misc.TIME_CONVERSION_FACTOR < System.currentTimeMillis()) {
 | 
				
			||||||
            playerProfile.removePtpRequest();
 | 
					            mcMMOPlayer.removePtpRequest();
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Player target = playerProfile.getPtpRequest();
 | 
					        Player target = mcMMOPlayer.getPtpRequest();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (target == null) {
 | 
					        if (target == null) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
 | 
					            player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
 | 
				
			||||||
@@ -147,7 +149,7 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, playerProfile.getParty().getName());
 | 
					        McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());
 | 
				
			||||||
        plugin.getServer().getPluginManager().callEvent(event);
 | 
					        plugin.getServer().getPluginManager().callEvent(event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (event.isCancelled()) {
 | 
					        if (event.isCancelled()) {
 | 
				
			||||||
@@ -157,31 +159,31 @@ public class PtpCommand implements CommandExecutor {
 | 
				
			|||||||
        target.teleport(player);
 | 
					        target.teleport(player);
 | 
				
			||||||
        target.sendMessage(LocaleLoader.getString("Party.Teleport.Player", player.getName()));
 | 
					        target.sendMessage(LocaleLoader.getString("Party.Teleport.Player", player.getName()));
 | 
				
			||||||
        player.sendMessage(LocaleLoader.getString("Party.Teleport.Target", target.getName()));
 | 
					        player.sendMessage(LocaleLoader.getString("Party.Teleport.Target", target.getName()));
 | 
				
			||||||
        playerProfile.setRecentlyHurt(System.currentTimeMillis());
 | 
					        mcMMOPlayer.getProfile().setRecentlyHurt(System.currentTimeMillis());
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean acceptAnyTeleportRequest() {
 | 
					    private boolean acceptAnyTeleportRequest() {
 | 
				
			||||||
        if (playerProfile.getPtpConfirmRequired()) {
 | 
					        if (mcMMOPlayer.getPtpConfirmRequired()) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        playerProfile.togglePtpConfirmRequired();
 | 
					        mcMMOPlayer.togglePtpConfirmRequired();
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private boolean togglePartyTeleportation() {
 | 
					    private boolean togglePartyTeleportation() {
 | 
				
			||||||
        if (playerProfile.getPtpEnabled()) {
 | 
					        if (mcMMOPlayer.getPtpEnabled()) {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            player.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
 | 
					            player.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        playerProfile.togglePtpUse();
 | 
					        mcMMOPlayer.togglePtpUse();
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user