mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Use player objects instead of names - should be more efficient and less
buggy.
This commit is contained in:
parent
b0eb4b93a8
commit
0ba4bc25c7
@ -7,6 +7,7 @@ import java.util.Set;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -29,7 +30,7 @@ public class KrakenCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserManager.getPlayer(sender.getName()).getFishingManager().unleashTheKraken();
|
UserManager.getPlayer((Player) sender).getFishingManager().unleashTheKraken();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -17,7 +18,7 @@ public class McnotifyCommand implements TabExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
||||||
mcMMOPlayer.toggleChatNotifications();
|
mcMMOPlayer.toggleChatNotifications();
|
||||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
@ -38,7 +39,7 @@ public class MobhealthCommand implements TabExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
PlayerProfile playerProfile = UserManager.getPlayer(sender.getName()).getProfile();
|
PlayerProfile playerProfile = UserManager.getPlayer((Player) sender).getProfile();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MobHealthbarType type = MobHealthbarType.valueOf(args[0].toUpperCase().trim());
|
MobHealthbarType type = MobHealthbarType.valueOf(args[0].toUpperCase().trim());
|
||||||
|
@ -33,8 +33,8 @@ public abstract class ToggleCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
applyCommandAction();
|
applyCommandAction();
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gmail.nossr50.chat.ChatMode;
|
import com.gmail.nossr50.chat.ChatMode;
|
||||||
@ -32,7 +33,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
if (chatMode.isEnabled(mcMMOPlayer)) {
|
if (chatMode.isEnabled(mcMMOPlayer)) {
|
||||||
disableChatMode(sender);
|
disableChatMode(sender);
|
||||||
@ -49,7 +50,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
enableChatMode(sender);
|
enableChatMode(sender);
|
||||||
return true;
|
return true;
|
||||||
@ -60,7 +61,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
|
|
||||||
disableChatMode(sender);
|
disableChatMode(sender);
|
||||||
return true;
|
return true;
|
||||||
|
@ -46,8 +46,8 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
editValues();
|
editValues();
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
@ -39,8 +40,8 @@ public class SkillresetCommand extends ExperienceCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
profile = mcMMOPlayer.getProfile();
|
profile = mcMMOPlayer.getProfile();
|
||||||
|
|
||||||
editValues();
|
editValues();
|
||||||
|
@ -15,8 +15,8 @@ public class PartyAcceptCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (!mcMMOPlayer.hasPartyInvite()) {
|
if (!mcMMOPlayer.hasPartyInvite()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
|
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -14,7 +15,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
if (!playerParty.getMembers().contains(args[1])) {
|
if (!playerParty.getMembers().contains(args[1])) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", args[1]));
|
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", args[1]));
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -13,7 +14,7 @@ public class PartyChangePasswordCommand 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) {
|
||||||
playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -70,8 +70,8 @@ public class PartyCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
if (!mcMMOPlayer.inParty()) {
|
if (!mcMMOPlayer.inParty()) {
|
||||||
|
@ -19,8 +19,8 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
case 3:
|
case 3:
|
||||||
Party newParty = PartyManager.getParty(args[1]);
|
Party newParty = PartyManager.getParty(args[1]);
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
// Check to see if the party exists, and if it does cancel creating a new party
|
// Check to see if the party exists, and if it does cancel creating a new party
|
||||||
if (PartyManager.checkPartyExistence(player, newParty, args[1])) {
|
if (PartyManager.checkPartyExistence(player, newParty, args[1])) {
|
||||||
|
@ -16,7 +16,7 @@ public class PartyDisbandCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
String partyName = playerParty.getName();
|
String partyName = playerParty.getName();
|
||||||
|
|
||||||
for (Player member : playerParty.getOnlineMembers()) {
|
for (Player member : playerParty.getOnlineMembers()) {
|
||||||
|
@ -26,7 +26,7 @@ public class PartyExpShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
||||||
handleChangingShareMode(ShareMode.NONE);
|
handleChangingShareMode(ShareMode.NONE);
|
||||||
|
@ -25,8 +25,8 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
playerParty = mcMMOPlayer.getParty();
|
playerParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
displayPartyHeader();
|
displayPartyHeader();
|
||||||
|
@ -24,8 +24,8 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (player.equals(target)) {
|
if (player.equals(target)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
|
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
|
||||||
|
@ -26,7 +26,7 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase());
|
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase());
|
||||||
|
|
||||||
if (mode == null) {
|
if (mode == null) {
|
||||||
@ -38,7 +38,7 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
boolean toggle = false;
|
boolean toggle = false;
|
||||||
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||||
|
@ -77,8 +77,8 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
playerParty = mcMMOPlayer.getParty();
|
playerParty = mcMMOPlayer.getParty();
|
||||||
targetParty = mcMMOTarget.getParty();
|
targetParty = mcMMOTarget.getParty();
|
||||||
|
@ -18,7 +18,7 @@ public class PartyKickCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
Party playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(args[1]);
|
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(args[1]);
|
||||||
|
|
||||||
if (!playerParty.getMembers().contains(target.getName())) {
|
if (!playerParty.getMembers().contains(target.getName())) {
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.party;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -15,7 +16,7 @@ public class PartyLockCommand 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) {
|
||||||
playerParty = UserManager.getPlayer(sender.getName()).getParty();
|
playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -17,7 +17,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
Party playerParty = mcMMOPlayer.getParty();
|
Party playerParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
String oldPartyName = playerParty.getName();
|
String oldPartyName = playerParty.getName();
|
||||||
|
@ -18,8 +18,8 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer.getPtpConfirmRequired()) {
|
if (mcMMOPlayer.getPtpConfirmRequired()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||||
|
@ -21,8 +21,8 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (!mcMMOPlayer.hasPtpRequest()) {
|
if (!mcMMOPlayer.hasPtpRequest()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
|
||||||
|
@ -51,8 +51,8 @@ public class PtpCommand implements TabExecutor {
|
|||||||
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
|
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||||
|
@ -18,8 +18,8 @@ public class PtpToggleCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (mcMMOPlayer.getPtpEnabled()) {
|
if (mcMMOPlayer.getPtpEnabled()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||||
|
@ -24,8 +24,8 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
Player player = (Player) sender;
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (Config.getInstance().getMcstatsScoreboardsEnabled()) {
|
if (Config.getInstance().getMcstatsScoreboardsEnabled()) {
|
||||||
ScoreboardManager.setupPlayerScoreboard(player.getName());
|
ScoreboardManager.setupPlayerScoreboard(player.getName());
|
||||||
|
@ -56,8 +56,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
player = (Player) sender;
|
||||||
player = mcMMOPlayer.getPlayer();
|
mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.spout;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||||
@ -27,7 +28,7 @@ public abstract class SpoutCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerProfile = UserManager.getPlayer(sender.getName()).getProfile();
|
playerProfile = UserManager.getPlayer((Player) sender).getProfile();
|
||||||
spoutHud = playerProfile.getSpoutHud();
|
spoutHud = playerProfile.getSpoutHud();
|
||||||
|
|
||||||
if (spoutHud == null) {
|
if (spoutHud == null) {
|
||||||
|
@ -73,9 +73,11 @@ public final class UserManager {
|
|||||||
*/
|
*/
|
||||||
public static McMMOPlayer getPlayer(String playerName) {
|
public static McMMOPlayer getPlayer(String playerName) {
|
||||||
List<Player> matches = mcMMO.p.getServer().matchPlayer(playerName);
|
List<Player> matches = mcMMO.p.getServer().matchPlayer(playerName);
|
||||||
|
|
||||||
if (matches.size() == 1) {
|
if (matches.size() == 1) {
|
||||||
playerName = matches.get(0).getName();
|
playerName = matches.get(0).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
return players.get(playerName);
|
return players.get(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user