Cleanup, locale, & party improvements.

This commit is contained in:
GJ 2012-04-22 02:55:58 -04:00
parent c45cd56c78
commit efc63b5230
17 changed files with 544 additions and 414 deletions

View File

@ -33,6 +33,7 @@ Version 1.3.06-dev
! Changed /mcrefresh to work from console ! Changed /mcrefresh to work from console
! Changed /mcrefresh to work for offline players ! Changed /mcrefresh to work for offline players
! Changed UpdateXPBar function to hopefully avoid errors ! Changed UpdateXPBar function to hopefully avoid errors
! Changed /party to show offline party members
Version 1.3.05 Version 1.3.05
+ Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%) + Added Skill Shot to Archery which increases damage dealt by 10% every 50 skill levels (caps at 200%)

View File

@ -89,15 +89,15 @@ public class PartyAPI {
} }
/** /**
* Get a list of all players in this player's party. * Get a list of all online players in this player's party.
* </br> * </br>
* This function is designed for API usage. * This function is designed for API usage.
* *
* @param player The player to check * @param player The player to check
* @return all the players in the player's party * @return all online players in the player's party
*/ */
public ArrayList<Player> getPartyMembers(Player player) { public ArrayList<Player> getOnlineMembers(Player player) {
return Party.getInstance().getPartyMembers(player); return Party.getInstance().getOnlineMembers(player);
} }
/** /**
@ -122,4 +122,40 @@ public class PartyAPI {
public void removeFromParty(Player player) { public void removeFromParty(Player player) {
Party.getInstance().removeFromParty(player, Users.getProfile(player)); Party.getInstance().removeFromParty(player, Users.getProfile(player));
} }
/**
* Get the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The party name
* @return the leader of the party
*/
public Player getPartyLeader(String partyName) {
return Party.getInstance().getPartyLeader(partyName);
}
/**
* Set the leader of a party.
* </br>
* This function is designed for API usage.
*
* @param partyName The name of the party to set the leader of
* @param player The player to set as leader
*/
public void setPartyLeader(String partyName, String player) {
Party.getInstance().setPartyLeader(partyName, player);
}
/**
* Get a list of all players in this player's party.
* </br>
* This function is designed for API usage.
*
* @param player The player to check
* @return all the players in the player's party
*/
public ArrayList<Player> getAllMembers(Player player) {
return Party.getInstance().getAllMembers(player);
}
} }

View File

@ -24,7 +24,7 @@ public class CommandHelper {
Player player = (Player) sender; Player player = (Player) sender;
if (player != null && !mcPermissions.getInstance().permission(player, permission)) { if (player != null && !mcPermissions.getInstance().permission(player, permission)) {
player.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission")); player.sendMessage(mcLocale.getString("mcMMO.NoPermission"));
return true; return true;
} }
} }
@ -52,26 +52,26 @@ public class CommandHelper {
if (Skills.hasGatheringSkills(inspect)) { if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect); PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.GatheringHeader")); display.sendMessage(mcLocale.getString("Stats.Header.Gathering"));
if (mcPermissions.getInstance().excavation(inspect)) { if (mcPermissions.getInstance().excavation(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
} }
if (mcPermissions.getInstance().fishing(inspect)) { if (mcPermissions.getInstance().fishing(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
} }
if (mcPermissions.getInstance().herbalism(inspect)) { if (mcPermissions.getInstance().herbalism(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
} }
if (mcPermissions.getInstance().mining(inspect)) { if (mcPermissions.getInstance().mining(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
} }
if (mcPermissions.getInstance().woodcutting(inspect)) { if (mcPermissions.getInstance().woodcutting(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
} }
} }
} }
@ -91,26 +91,26 @@ public class CommandHelper {
if (Skills.hasCombatSkills(inspect)) { if (Skills.hasCombatSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect); PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.CombatHeader")); display.sendMessage(mcLocale.getString("Stats.Header.Combat"));
if (mcPermissions.getInstance().axes(inspect)) { if (mcPermissions.getInstance().axes(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
} }
if (mcPermissions.getInstance().archery(inspect)) { if (mcPermissions.getInstance().archery(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
} }
if (mcPermissions.getInstance().swords(inspect)) { if (mcPermissions.getInstance().swords(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
} }
if (mcPermissions.getInstance().taming(inspect)) { if (mcPermissions.getInstance().taming(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
} }
if (mcPermissions.getInstance().unarmed(inspect)) { if (mcPermissions.getInstance().unarmed(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
} }
} }
} }
@ -129,14 +129,14 @@ public class CommandHelper {
public static void printMiscSkills(Player inspect, CommandSender display) { public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) { if (Skills.hasMiscSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect); PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.MiscHeader")); display.sendMessage(mcLocale.getString("Stats.Header.Misc"));
if (mcPermissions.getInstance().acrobatics(inspect)) { if (mcPermissions.getInstance().acrobatics(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
} }
if (mcPermissions.getInstance().repair(inspect)) { if (mcPermissions.getInstance().repair(inspect)) {
display.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
} }
} }
} }

View File

@ -27,7 +27,7 @@ public class AddxpCommand implements CommandExecutor {
int xp; int xp;
SkillType skill; SkillType skill;
String skillName; String skillName;
String usage = ChatColor.RED + "Proper usage is /addxp [player] <skill> <xp>"; //TODO: Needs more locale. String usage = ChatColor.RED + "Proper usage is /addxp [playername] <skill> <xp>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true; return true;

View File

@ -25,7 +25,7 @@ public class InspectCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
OfflinePlayer target; OfflinePlayer target;
PlayerProfile PP; PlayerProfile PP;
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale. String usage = "Proper usage is /inspect <playername>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
return true; return true;

View File

@ -30,7 +30,7 @@ public class MmoeditCommand implements CommandExecutor {
int newValue; int newValue;
SkillType skill; SkillType skill;
String skillName; String skillName;
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <level>"; //TODO: Needs more locale. String usage = ChatColor.RED + "Proper usage is /mmoedit [playername] <skill> <level>"; //TODO: Needs more locale.
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true; return true;

View File

@ -22,9 +22,9 @@ public class XprateCommand 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) {
String usage1 = mcLocale.getString("Commands.xprate.proper"); String usage1 = mcLocale.getString("Commands.xprate.proper.0");
String usage2 = mcLocale.getString("Commands.xprate.proper2"); String usage2 = mcLocale.getString("Commands.xprate.proper.1");
String usage3 = mcLocale.getString("Commands.xprate.proper3"); String usage3 = mcLocale.getString("Commands.xprate.proper.2");
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true; return true;
@ -69,8 +69,8 @@ public class XprateCommand implements CommandExecutor {
if (xpevent) { if (xpevent) {
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.started")); x.sendMessage(mcLocale.getString("Commands.xprate.started.0"));
x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier})); x.sendMessage(mcLocale.getString("Commands.xprate.started.1", new Object[] {LoadProperties.xpGainMultiplier}));
} }
} }
else { else {

View File

@ -16,10 +16,7 @@ public class McmmoCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String description = mcLocale.getString("mcMMO.Description"); String description = mcLocale.getString("mcMMO.Description");
String[] mcSplit = description.split(","); String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit);
for (String x : mcSplit) {
sender.sendMessage(x);
}
if (LoadProperties.donateMessage) { if (LoadProperties.donateMessage) {
if (LoadProperties.spoutEnabled && sender instanceof SpoutPlayer) { if (LoadProperties.spoutEnabled && sender instanceof SpoutPlayer) {

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
@ -22,72 +23,74 @@ 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 PP;
String usage = ChatColor.RED + "Proper usage is /a [message]"; //TODO: Needs more locale.
// Console message? if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
if (!(sender instanceof Player) && args.length >= 1) {
String aMessage = args[0];
for (int i = 1; i <= args.length - 1; i++) {
aMessage = aMessage + " " + args[i];
}
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", aMessage);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return true;
aMessage = chatEvent.getMessage();
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<*Console*> " + aMessage);
for (Player herp : plugin.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
herp.sendMessage(aPrefix + aMessage);
}
return true; return true;
} }
Player player = null; switch (args.length) {
if (sender instanceof Player) { case 0:
player = (Player) sender; if (sender instanceof Player) {
} PP = Users.getProfile((Player) sender);
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) { if (PP.getPartyChatMode()) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); PP.togglePartyChat();
return true; }
}
// Not a toggle, a message PP.toggleAdminChat();
if (args.length >= 1) { if (PP.getAdminChatMode()) {
String aMessage = args[0]; sender.sendMessage(mcLocale.getString("Commands.AdminChat.On"));
for (int i = 1; i <= args.length - 1; i++) { }
aMessage = aMessage + " " + args[i]; else {
sender.sendMessage(mcLocale.getString("Commands.AdminChat.Off"));
}
}
else {
sender.sendMessage(usage);
} }
Users.getProfile(player).toggleAdminChat(); return true;
player.chat(aMessage);
Users.getProfile(player).toggleAdminChat(); default:
String message = args[0];
for (int i = 1; i < args.length; i++) {
message = message + " " + args [i];
}
if (sender instanceof Player) {
Player player = (Player) sender;
PP = Users.getProfile(player);
PP.toggleAdminChat();
player.chat(message);
PP.toggleAdminChat();
}
else {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
message = chatEvent.getMessage();
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<*Console*> " + message);
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(player) || player.isOp()) {
player.sendMessage(prefix + message);
}
}
}
return true; return true;
} }
if(player != null)
{
PlayerProfile PP = Users.getProfile(player);
if (PP.getPartyChatMode())
PP.togglePartyChat();
PP.toggleAdminChat();
if (PP.getAdminChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
}
}
return true;
} }
} }

View File

@ -8,59 +8,62 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
public class InviteCommand implements CommandExecutor { public class InviteCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
public InviteCommand(mcMMO instance) { public InviteCommand(mcMMO instance) {
this.plugin = instance; this.plugin = instance;
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = ChatColor.RED + "Proper usage is /invite <playername>"; //TODO: Needs more locale.
if (!(sender instanceof Player)) { if (CommandHelper.noConsoleUsage(sender)) {
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale. return true;
return true; }
}
Player player = (Player) sender; if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
PlayerProfile PP = Users.getProfile(player); return true;
}
if (!mcPermissions.getInstance().party(player)) { switch (args.length) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); case 1:
return true; Player player = (Player) sender;
} PlayerProfile PP = Users.getProfile(player);
Party Pinstance = Party.getInstance(); Party partyInstance = Party.getInstance();
if (!PP.inParty()) { if (!PP.inParty()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.NotInParty")); player.sendMessage(mcLocale.getString("Commands.Party.None"));
return true; return true;
} }
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>"); //TODO: Needs more locale.
return true;
}
if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
if (Pinstance.canInvite(player, PP)) {
Player target = plugin.getServer().getPlayer(args[0]);
PlayerProfile PPt = Users.getProfile(target);
PPt.modifyInvite(PP.getParty());
player.sendMessage(mcLocale.getString("mcPlayerListener.InviteSuccess")); Player target = plugin.getServer().getPlayer(args[0]);
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() }));
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "accept" }));
} else {
player.sendMessage(mcLocale.getString("Party.Locked"));
return true;
}
}
return true; if (target != null) {
} if (partyInstance.canInvite(player, PP)) {
PlayerProfile PPt = Users.getProfile(target);
PPt.modifyInvite(PP.getParty());
player.sendMessage(mcLocale.getString("Commands.Invite.Success"));
target.sendMessage(mcLocale.getString("Commands.Party.Invite.0", new Object[] { PPt.getInvite(), player.getName() }));
target.sendMessage(mcLocale.getString("Commands.Party.Invite.1"));
}
else {
player.sendMessage(mcLocale.getString("Party.Locked"));
return true;
}
}
default:
sender.sendMessage(usage);
return true;
}
}
} }

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
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;
@ -22,254 +22,252 @@ public class PartyCommand implements CommandExecutor {
this.plugin = plugin; this.plugin = plugin;
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) { if (CommandHelper.noConsoleUsage(sender)) {
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale. return true;
return true; }
}
Player player = (Player) sender; if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
PlayerProfile PP = Users.getProfile(player); return true;
}
if (!mcPermissions.getInstance().party(player)) { Player player = (Player) sender;
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); String playerName = player.getName();
return true; PlayerProfile PP = Users.getProfile(player);
}
Party Pinstance = Party.getInstance(); Party partyInstance = Party.getInstance();
boolean inParty = PP.inParty();
String partyName = PP.getParty();
boolean isLeader = partyInstance.isPartyLeader(playerName, partyName);
if (PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) { if (PP.inParty() && (!partyInstance.isParty(PP.getParty()) || !partyInstance.isInParty(player, PP))) {
Pinstance.addToParty(player, PP, PP.getParty(), false, null); partyInstance.addToParty(player, PP, PP.getParty(), false, null);
} }
if (args.length == 0 && !PP.inParty()) { switch (args.length) {
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "party "})); case 0:
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "party "})); if (!inParty) {
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "party " })); player.sendMessage(mcLocale.getString("Party.Help.0"));
return true; player.sendMessage(mcLocale.getString("Party.Help.1"));
} else if (args.length == 0 && PP.inParty()) { player.sendMessage(mcLocale.getString("Party.Help.2"));
String tempList = ""; }
int x = 0; else {
for (Player p : plugin.getServer().getOnlinePlayers()) { String tempList = "";
if (PP.getParty().equals(Users.getProfile(p).getParty())) {
if (p != null && x + 1 >= Pinstance.partyCount(player)) {
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName();
x++;
} else {
tempList += ChatColor.WHITE + p.getName();
x++;
}
}
if (p != null && x < Pinstance.partyCount(player)) {
if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) {
tempList += ChatColor.GOLD + p.getName() + ", ";
x++;
} else {
tempList += ChatColor.WHITE + p.getName() + ", ";
x++;
}
}
}
}
player.sendMessage(mcLocale.getString("mcPlayerListener.YouAreInParty", new Object[] { PP.getParty() }));
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers") + " (" + tempList + ChatColor.GREEN + ")");
//Master Apprentice Stuff for (Player p : partyInstance.getAllMembers(player)) {
//Show the player all their bonuses when they type /party if (p.equals(partyInstance.getPartyLeader(partyName))) {
tempList = ChatColor.GOLD + p.getName();
/* }
for(Player a : Party.getInstance().getPartyMembers(player)) else {
{ tempList = ChatColor.WHITE + p.getName();
if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && !a.getName().equals(player.getName())) }
{
PlayerProfile LP = Users.getProfile(a);
for(SkillType type : SkillType.values())
{
//Skip this one
if(type == SkillType.ALL)
continue;
if(LP.getSkillLevel(type) > PP.getSkillLevel(type))
{
//Tell them what their skill bonus is for this skill
int leaderLevel = LP.getSkillLevel(type);
int difference = leaderLevel - PP.getSkillLevel(type);
double bonusModifier = (difference*0.75D)/100D;
double trueBonus = bonusModifier * 100;
player.sendMessage("You get "+trueBonus+"% more XP from "+type.toString());
//double percent = (trueBonus/100)*100;
} else
{
//Tell them they have no bonus.. or not
}
}
} else if(Party.getInstance().isPartyLeader(a.getName(), PP.getParty()) && a.getName().equals(player.getName()))
{
//Tell them they are providing bonuses
}
}
*/
return true;
} else if (args.length == 1) {
if (args[0].equals("q") && PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), null, EventReason.LEFT_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
} }
Pinstance.removeFromParty(player, PP); if (isLeader) {
player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); tempList += ChatColor.GOLD + playerName;
return true; }
else {
tempList += ChatColor.WHITE + playerName;
}
} else if (args[0].equalsIgnoreCase("?")) { player.sendMessage(mcLocale.getString("Commands.Party.InParty", new Object[] { partyName }));
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "party " })); player.sendMessage(mcLocale.getString("Commands.Party.Members", new Object[] { tempList }));
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "party " })); }
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "party " }));
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "party " }));
} else if (args[0].equalsIgnoreCase("lock")) {
if (PP.inParty()) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
Pinstance.lockParty(PP.getParty());
player.sendMessage(mcLocale.getString("Party.Locked"));
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
player.sendMessage(mcLocale.getString("Party.InvalidName"));
}
} else if (args[0].equalsIgnoreCase("unlock")) {
if (PP.inParty()) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
Pinstance.unlockParty(PP.getParty());
player.sendMessage(mcLocale.getString("Party.Unlocked"));
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else {
player.sendMessage(mcLocale.getString("Party.InvalidName"));
}
// Party debugging command.
// } else if (args[0].equalsIgnoreCase("dump")) {
// Pinstance.dump(player);
} else {
if (PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { return true;
return true;
}
Pinstance.removeFromParty(player, PP); case 1:
} if (args[0].equalsIgnoreCase("q")) {
else { if (inParty) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.LEFT_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
player.sendMessage(mcLocale.getString("Commands.Party.Leave"));
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equals("?")) {
player.sendMessage(mcLocale.getString("Party.Help.3"));
player.sendMessage(mcLocale.getString("Party.Help.1"));
player.sendMessage(mcLocale.getString("Party.Help.4"));
player.sendMessage(mcLocale.getString("Party.Help.5"));
player.sendMessage(mcLocale.getString("Party.Help.6"));
player.sendMessage(mcLocale.getString("Party.Help.7"));
}
else if (args[0].equalsIgnoreCase("lock")) {
if (inParty) {
if (isLeader) {
if (partyInstance.isPartyLocked(partyName)) {
player.sendMessage(mcLocale.getString("Party.IsLocked"));
}
else {
partyInstance.lockParty(partyName);
player.sendMessage(mcLocale.getString("Party.Locked"));
}
}
else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else if (args[0].equalsIgnoreCase("unlock")) {
if (inParty) {
if (isLeader) {
if (!partyInstance.isPartyLocked(partyName)) {
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
}
else {
partyInstance.unlockParty(partyName);
player.sendMessage(mcLocale.getString("Party.Unlocked"));
}
}
else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
}
else {
player.sendMessage("Commands.Party.None");
}
}
else {
if (inParty) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY); McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return true; return true;
} }
} }
Pinstance.addToParty(player, PP, args[0], false, null);
return true;
}
} else if (args.length == 2 && PP.inParty()) {
if (args[0].equalsIgnoreCase("password")) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
if (Pinstance.isPartyLocked(PP.getParty())) {
Pinstance.setPartyPassword(PP.getParty(), args[1]);
player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] }));
} else {
player.sendMessage(mcLocale.getString("Party.IsntLocked"));
}
} else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
} else if (args[0].equalsIgnoreCase("kick")) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
if (Pinstance.isPartyLocked(PP.getParty())) {
Player tPlayer = null;
if (plugin.getServer().getPlayer(args[1]) != null)
tPlayer = plugin.getServer().getPlayer(args[1]);
if (tPlayer == null) {
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
}
if (!Pinstance.inSameParty(player, tPlayer)) {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { tPlayer.getName() }));
} else {
// Not an admin
if (!mcPermissions.getInstance().admin(player)) {
// Can't kick an admin
if (mcPermissions.getInstance().admin(tPlayer)) {
player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { tPlayer.getName() }));
}
}
PlayerProfile tPP = Users.getProfile(tPlayer);
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, tPP.getParty(), null, EventReason.KICKED_FROM_PARTY); partyInstance.addToParty(player, PP, args[0], false, null);
plugin.getServer().getPluginManager().callEvent(event); }
if (event.isCancelled()) { return true;
return true;
}
Pinstance.removeFromParty(tPlayer, tPP); case 2:
if (PP.inParty()) {
if (args[0].equalsIgnoreCase("password")) {
if (isLeader) {
if (!partyInstance.isPartyLocked(partyName)) {
partyInstance.lockParty(partyName);
}
tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); partyInstance.setPartyPassword(partyName, args[1]);
} player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] }));
} else { }
player.sendMessage(mcLocale.getString("Party.IsntLocked")); else {
} player.sendMessage(mcLocale.getString("Party.NotOwner"));
} else { }
player.sendMessage(mcLocale.getString("Party.NotOwner")); }
} else if (args[0].equalsIgnoreCase("kick")) {
} else if (args[0].equalsIgnoreCase("owner")) { if (isLeader) {
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { Player target = plugin.getServer().getPlayer(args[1]);
Player tPlayer = null;
if (plugin.getServer().getPlayer(args[1]) != null) if (target == null) {
tPlayer = plugin.getServer().getPlayer(args[1]); player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] }));
if (tPlayer == null) { return true;
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] })); }
}
if (!Pinstance.inSameParty(player, tPlayer)) { PlayerProfile PPt = Users.getProfile(target);
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { tPlayer.getName() })); String targetName = target.getName();
} else {
Pinstance.setPartyLeader(PP.getParty(), tPlayer.getName()); if (!partyInstance.inSameParty(player, (Player) target)) {
} player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { targetName }));
} else { return true;
player.sendMessage(mcLocale.getString("Party.NotOwner")); }
}
} else { else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, PP.getParty(), args[0], EventReason.CHANGED_PARTIES); McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(target, PPt);
target.sendMessage(mcLocale.getString("Commands.Party.Kick", new Object[] { partyName }));
}
}
else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
}
else if (args[0].equalsIgnoreCase("owner")) {
if (isLeader) {
Player target = plugin.getServer().getPlayer(args[1]);
if (target == null) {
player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner"));
return true;
}
String targetName = target.getName();
if (!partyInstance.inSameParty(player, (Player) target)) {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { targetName }));
return true;
}
else {
partyInstance.setPartyLeader(partyName, targetName);
}
}
else {
player.sendMessage(mcLocale.getString("Party.NotOwner"));
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, args[0], EventReason.CHANGED_PARTIES);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
partyInstance.removeFromParty(player, PP);
partyInstance.addToParty(player, PP, args[0], false, args[1]);
}
}
else {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return true; return true;
} }
Pinstance.removeFromParty(player, PP);
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}
} else if (args.length == 2 && !PP.inParty()) {
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, null, args[0], EventReason.JOINED_PARTY);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { partyInstance.addToParty(player, PP, args[0], false, args[1]);
return true;
} }
Pinstance.addToParty(player, PP, args[0], false, args[1]);
}
return true; return true;
}
default:
player.sendMessage(mcLocale.getString("Party.Help.0"));
player.sendMessage(mcLocale.getString("Party.Help.1"));
player.sendMessage(mcLocale.getString("Party.Help.2"));
return true;
}
}
} }

View File

@ -90,6 +90,14 @@ public class PlayerProfile {
lastlogin = ((Long) (System.currentTimeMillis() / 1000)).intValue(); lastlogin = ((Long) (System.currentTimeMillis() / 1000)).intValue();
} }
public String getPlayerName() {
return this.playerName;
}
public Player getPlayer() {
return mcMMO.p.getServer().getPlayer(playerName);
}
public boolean loadMySQL() { public boolean loadMySQL() {
int id = 0; int id = 0;
id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
@ -1168,7 +1176,7 @@ public class PlayerProfile {
Player player = mcMMO.p.getServer().getPlayer(playerName); Player player = mcMMO.p.getServer().getPlayer(playerName);
double bonusModifier = 0.0; double bonusModifier = 0.0;
for (Player x : Party.getInstance().getPartyMembers(player)) { for (Player x : Party.getInstance().getOnlineMembers(player)) {
if (x.isOnline() && !x.getName().equals(player.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) { if (x.isOnline() && !x.getName().equals(player.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) {
if (m.isNear(player.getLocation(), x.getLocation(), 25.0)) { if (m.isNear(player.getLocation(), x.getLocation(), 25.0)) {
PlayerProfile PartyLeader = Users.getProfile(x); PlayerProfile PartyLeader = Users.getProfile(x);

View File

@ -69,7 +69,7 @@ public class mcPlayerListener implements Listener {
if (PP.getGodMode()) { if (PP.getGodMode()) {
if (!mcPermissions.getInstance().mcgod(player)) { if (!mcPermissions.getInstance().mcgod(player)) {
PP.toggleGodMode(); PP.toggleGodMode();
player.sendMessage(mcLocale.getString("GodMode.Forbidden")); player.sendMessage(mcLocale.getString("Commands.GodMode.Forbidden"));
} }
} }
@ -168,8 +168,8 @@ public class mcPlayerListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) { if (mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) {
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "mcmmo"})); player.sendMessage(mcLocale.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()}));
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI")); player.sendMessage(mcLocale.getString("McMMO.Wiki"));
} }
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY //THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY

View File

@ -219,18 +219,18 @@ public class mcMMO extends JavaPlugin {
//Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands) //Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
//Skills commands //Skills commands
aliasMap.put(mcLocale.getString("m.SkillAcrobatics").toLowerCase(), "acrobatics"); aliasMap.put(mcLocale.getString("Acrobatics.SkillName").toLowerCase(), "acrobatics");
aliasMap.put(mcLocale.getString("m.SkillArchery").toLowerCase(), "archery"); aliasMap.put(mcLocale.getString("Archery.SkillName").toLowerCase(), "archery");
aliasMap.put(mcLocale.getString("m.SkillAxes").toLowerCase(), "axes"); aliasMap.put(mcLocale.getString("Axes.SkillName").toLowerCase(), "axes");
aliasMap.put(mcLocale.getString("m.SkillExcavation").toLowerCase(), "excavation"); aliasMap.put(mcLocale.getString("Excavation.SkillName").toLowerCase(), "excavation");
aliasMap.put(mcLocale.getString("m.SkillFishing").toLowerCase(), "fishing"); aliasMap.put(mcLocale.getString("Fishing.SkillName").toLowerCase(), "fishing");
aliasMap.put(mcLocale.getString("m.SkillHerbalism").toLowerCase(), "herbalism"); aliasMap.put(mcLocale.getString("Herbalism.SkillName").toLowerCase(), "herbalism");
aliasMap.put(mcLocale.getString("m.SkillMining").toLowerCase(), "mining"); aliasMap.put(mcLocale.getString("Mining.SkillName").toLowerCase(), "mining");
aliasMap.put(mcLocale.getString("m.SkillRepair").toLowerCase(), "repair"); aliasMap.put(mcLocale.getString("Repair.SkillName").toLowerCase(), "repair");
aliasMap.put(mcLocale.getString("m.SkillSwords").toLowerCase(), "swords"); aliasMap.put(mcLocale.getString("Swords.SkillName").toLowerCase(), "swords");
aliasMap.put(mcLocale.getString("m.SkillTaming").toLowerCase(), "taming"); aliasMap.put(mcLocale.getString("Taming.SkillName").toLowerCase(), "taming");
aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed"); aliasMap.put(mcLocale.getString("Unarmed.SkillName").toLowerCase(), "unarmed");
aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting"); aliasMap.put(mcLocale.getString("WoodCutting.SkillName").toLowerCase(), "woodcutting");
//Register commands //Register commands
//Skills commands //Skills commands

View File

@ -90,13 +90,31 @@ public class Party {
private void informPartyMembers(Player player) { private void informPartyMembers(Player player) {
String playerName = player.getName(); String playerName = player.getName();
if (player != null) {
for (Player p : getOnlineMembers(player)) {
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {playerName}));
}
}
}
/**
* Get a list of all online players in this player's party.
*
* @param player The player to check
* @return all online players in the player's party
*/
public ArrayList<Player> getOnlineMembers(Player player) {
ArrayList<Player> players = new ArrayList<Player>();
for (Player p : plugin.getServer().getOnlinePlayers()) { for (Player p : plugin.getServer().getOnlinePlayers()) {
if (player != null && p != null) { if (player != null && p != null) {
if (inSameParty(player, p) && !p.getName().equals(playerName)) { if (inSameParty(player, p) && !p.getName().equals(player.getName())) {
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {playerName})); players.add(p);
} }
} }
} }
return players;
} }
/** /**
@ -105,16 +123,19 @@ public class Party {
* @param player The player to check * @param player The player to check
* @return all the players in the player's party * @return all the players in the player's party
*/ */
public ArrayList<Player> getPartyMembers(Player player) { public ArrayList<Player> getAllMembers(Player player) {
ArrayList<Player> players = new ArrayList<Player>(); ArrayList<Player> players = new ArrayList<Player>();
HashMap<String, PlayerProfile> profiles = Users.getProfiles();
for (Player p : plugin.getServer().getOnlinePlayers()) { if (player != null) {
if (p.isOnline() && player != null && p != null) { for (String name : profiles.keySet()) {
if (inSameParty(player, p) && !p.getName().equals(player.getName())) { Player p = profiles.get(name).getPlayer();
if (inSameParty(p, player)) {
players.add(p); players.add(p);
} }
} }
} }
return players; return players;
} }
@ -126,11 +147,9 @@ public class Party {
private void informPartyMembersOwnerChange(String newOwnerName) { private void informPartyMembersOwnerChange(String newOwnerName) {
Player newOwner = plugin.getServer().getPlayer(newOwnerName); Player newOwner = plugin.getServer().getPlayer(newOwnerName);
for (Player p : plugin.getServer().getOnlinePlayers()){ if (newOwner != null) {
if (newOwner != null && p != null) { for (Player p : getOnlineMembers(newOwner)) {
if (inSameParty(newOwner, p)) { p.sendMessage(newOwnerName + " is the new party owner."); //TODO: Needs more locale
p.sendMessage(newOwnerName + " is the new party owner."); //TODO: Needs more locale
}
} }
} }
} }
@ -143,11 +162,9 @@ public class Party {
private void informPartyMembersQuit(Player player) { private void informPartyMembersQuit(Player player) {
String playerName = player.getName(); String playerName = player.getName();
for (Player p : plugin.getServer().getOnlinePlayers()){ if (player != null) {
if (player != null && p != null){ for (Player p : getOnlineMembers(player)) {
if (inSameParty(player, p) && !p.getName().equals(playerName)) { p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {playerName}));
p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {playerName}));
}
} }
} }
} }
@ -243,10 +260,10 @@ public class Party {
informPartyMembers(player); informPartyMembers(player);
if (!invite) { if (!invite) {
player.sendMessage(mcLocale.getString("mcPlayerListener.JoinedParty", new Object[]{ newParty })); player.sendMessage(mcLocale.getString("Commands.Party.Join", new Object[]{ newParty }));
} }
else { else {
player.sendMessage(mcLocale.getString("mcPlayerListener.InviteAccepted", new Object[]{ PP.getParty() })); player.sendMessage(mcLocale.getString("Commands.Invite.Accepted", new Object[]{ PP.getParty() }));
} }
} }
@ -308,6 +325,25 @@ public class Party {
savePartyFile(partyPasswordsFile, partyPasswords); savePartyFile(partyPasswordsFile, partyPasswords);
} }
/**
* Get the leader of a party.
*
* @param partyName The party name
* @return the leader of the party
*/
public Player getPartyLeader(String partyName) {
Player leader = null;
for (String name : partyPlayers.get(partyName).keySet()) {
if (partyPlayers.get(partyName).get(name)) {
leader = plugin.getServer().getPlayer(name);
break;
}
}
return leader;
}
/** /**
* Set the leader of a party. * Set the leader of a party.
* *

View File

@ -393,11 +393,12 @@ Commands.Party.Chat.Off=Party Chat only [[RED]]Off
Commands.Party.Chat.On=Party Chat only [[GREEN]]On Commands.Party.Chat.On=Party Chat only [[GREEN]]On
Commands.Party.Commands=[[GREEN]]--PARTY COMMANDS-- Commands.Party.Commands=[[GREEN]]--PARTY COMMANDS--
Commands.Party.Invite.0=[[RED]]ALERT: [[GREEN]]You have received a party invite for {0} from {1} Commands.Party.Invite.0=[[RED]]ALERT: [[GREEN]]You have received a party invite for {0} from {1}
Commands.Party.Invite.1=[[YELLOW]]Type [[GREEN]]/{0}[[YELLOW]] to accept the invite Commands.Party.Invite.1=[[YELLOW]]Type [[GREEN]]/accept[[YELLOW]] to accept the invite
Commands.Party.Invite=<playername> [[RED]]- Send party invite Commands.Party.Invite=<playername> [[RED]]- Send party invite
Commands.Party.Join=Joined Party: {0} Commands.Party.Join=Joined Party: {0}
Commands.Party.Kick=[[RED]]You were kicked from party {0}!
Commands.Party.Leave=[[RED]]You have left that party Commands.Party.Leave=[[RED]]You have left that party
Commands.Party.Members=[[GREEN]]Party Members Commands.Party.Members=[[GREEN]]Party Members: {0}
Commands.Party.None=[[RED]]You are not in a party. Commands.Party.None=[[RED]]You are not in a party.
Commands.Party.Quit=[[RED]]- Leave your current party Commands.Party.Quit=[[RED]]- Leave your current party
Commands.Party.Teleport=<playername> [[RED]]- Teleport to party member Commands.Party.Teleport=<playername> [[RED]]- Teleport to party member
@ -410,30 +411,30 @@ Commands.SkillInfo=/<skillname> [[RED]]- View detailed information about a skill
Commands.Stats.Self=YOUR STATS Commands.Stats.Self=YOUR STATS
Commands.Stats=[[RED]]- View your mcMMO stats Commands.Stats=[[RED]]- View your mcMMO stats
Commands.ToggleAbility=[[RED]]- Toggle ability activation with right click Commands.ToggleAbility=[[RED]]- Toggle ability activation with right click
mcMMO.MOTD=[[BLUE]]This server is running mcMMO {0} type [[YELLOW]]/{1}[[BLUE]] for help. mcMMO.MOTD=[[BLUE]]This server is running mcMMO {0}! Type [[YELLOW]]/mcmmo[[BLUE]] for help.
mcMMO.NoInvites=[[RED]]You have no invites at this time mcMMO.NoInvites=[[RED]]You have no invites at this time
mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions. mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions.
mcMMO.NoSkillNote=[[DARK_GRAY]]If you don't have access to a skill it will not be shown here. mcMMO.NoSkillNote=[[DARK_GRAY]]If you don't have access to a skill it will not be shown here.
mcMMO.Wiki=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki mcMMO.Wiki=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki
##party ##party
Commands.Party.InParty=[[GREEN]]You are in party {0} Commands.Party.InParty=[[GREEN]]Party: {0}
Party.CouldNotKick=[[DARK_RED]]Could not kick player {0} Party.CouldNotKick=[[DARK_RED]]Could not kick player {0} from the party
Party.CouldNotSetOwner=[[DARK_RED]]Could not set owner to {0} Party.CouldNotSetOwner=[[DARK_RED]]Could not set owner to {0}
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions) Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
Party.Help1=[[RED]]Proper usage is [[YELLOW]]/{0} [[WHITE]]<name>[[YELLOW]] or [[WHITE]]'q' [[YELLOW]]to quit Party.Help.0=[[RED]]Proper usage is /party <partyname> to join or /party q to quit
Party.Help2=[[RED]]To join a passworded party use [[YELLOW]]/{0} [[WHITE]]<name> <password> Party.Help.1=[[RED]]To join a passworded party, use /party <partyname> <password>
Party.Help3=[[RED]]Consult /{0} ? for more information Party.Help.2=[[RED]]Consult /party ? for more information
Party.Help4=[[RED]]Use [[YELLOW]]/{0} [[WHITE]]<name> [[YELLOW]]to join a party or [[WHITE]]'q' [[YELLOW]]to quit Party.Help.3=[[RED]]Use /party <partyname> to join or /party q to quit
Party.Help5=[[RED]]To lock your party use [[YELLOW]]/{0} [[WHITE]]lock Party.Help.4=[[RED]]To lock or unlock your party, use /party <lock/unlock>
Party.Help6=[[RED]]To unlock your party use [[YELLOW]]/{0} [[WHITE]]unlock Party.Help.5=[[RED]]To password protect your party, use /party password <password>
Party.Help7=[[RED]]To password protect your party use [[YELLOW]]/{0} [[WHITE]]password <password> Party.Help.6=[[RED]]To kick a player from your party, use /party kick <player>
Party.Help8=[[RED]]To kick a player from your party use [[YELLOW]]/{0} [[WHITE]]kick <player> Party.Help.7=[[RED]]To transfer ownership of your party, use /party owner <player>
Party.Help9=[[RED]]To transfer ownership of your party use [[YELLOW]]/{0} [[WHITE]]owner <player>
Party.InformedOnJoin={0} [[GREEN]] has joined your party Party.InformedOnJoin={0} [[GREEN]] has joined your party
Party.InformedOnQuit={0} [[GREEN]] has left your party Party.InformedOnQuit={0} [[GREEN]] has left your party
Party.InvalidName=[[DARK_RED]]That is not a valid party name Party.InvalidName=[[DARK_RED]]That is not a valid party name
Party.IsntLocked=[[GRAY]]Party is not locked Party.IsLocked=[[RED]]This party is already locked!
Party.IsntLocked=[[RED]]This party is not locked!
Party.Locked=[[RED]]Party is locked, only party leader may invite. Party.Locked=[[RED]]Party is locked, only party leader may invite.
Party.NotInYourParty=[[DARK_RED]]{0} is not in your party Party.NotInYourParty=[[DARK_RED]]{0} is not in your party
Party.NotOwner=[[DARK_RED]]You are not the party owner Party.NotOwner=[[DARK_RED]]You are not the party owner
@ -458,11 +459,11 @@ Commands.xplock.invalid=[[RED]]That is not a valid skillname! Try /xplock mining
Commands.xplock.locked=[[GOLD]]Your XP BAR is now locked to {0}! Commands.xplock.locked=[[GOLD]]Your XP BAR is now locked to {0}!
Commands.xplock.unlocked=[[GOLD]]Your XP BAR is now [[GREEN]]UNLOCKED[[GOLD]]! Commands.xplock.unlocked=[[GOLD]]Your XP BAR is now [[GREEN]]UNLOCKED[[GOLD]]!
Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!! Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!!
Commands.xprate.proper=[[RED]]Proper usage to change the XP rate is /xprate <integer> <true/false> Commands.xprate.proper.0=[[RED]]Proper usage to change the XP rate is /xprate <integer> <true/false>
Commands.xprate.proper2=[[RED]]Proper usage to restore the XP rate to default is /xprate reset Commands.xprate.proper.1=[[RED]]Proper usage to restore the XP rate to default is /xprate reset
Commands.xprate.proper3=[[RED]]Please specify true or false to indicate if this is an xp event or not Commands.xprate.proper.2=[[RED]]Please specify true or false to indicate if this is an xp event or not
Commands.xprate.started=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED!
Commands.xprate.started2=[[GOLD]]mcMMO XP RATE IS NOW {0}x! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x!
XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
#EFFECTS #EFFECTS

View File

@ -1,94 +1,141 @@
name: mcMMO name: mcMMO
website: mcmmo.org
main: com.gmail.nossr50.mcMMO
version: ${project.version}-b${BUILD_NUMBER} version: ${project.version}-b${BUILD_NUMBER}
softdepend: [Spout]
authors:
- nossr50
- NuclearW
- gmcferrin
description: mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience. description: mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
author: nossr50
authors: [NuclearW, gmcferrin]
website: http://forums.bukkit.org/threads/rpg-mech-mcmmo-v1-3-05-rpg-addiction-redefined-multi-lingual-1-2-5-r1-0.68601/
main: com.gmail.nossr50.mcMMO
softdepend: [Spout]
commands: commands:
mchud: mchud:
aliases: []
description: Change your HUD description: Change your HUD
xplock: xplock:
aliases: [mcxplock]
description: Lock your xp bar description: Lock your xp bar
xprate: xprate:
aliases: [mcxprate]
description: Modify the xp rate or start an event description: Modify the xp rate or start an event
mcc: mcc:
aliases: []
description: Lists mcMMO commands description: Lists mcMMO commands
mcmmo: mcmmo:
aliases: []
description: Shows a brief mod description description: Shows a brief mod description
mctop: mctop:
aliases: []
description: Shows leader boards for mcMMO description: Shows leader boards for mcMMO
addxp: addxp:
aliases: []
description: Add XP to a user description: Add XP to a user
permission: mcmmo.tools.mmoedit permission: mcmmo.tools.mmoedit
addlevels: addlevels:
aliases: []
description: Add levels to a user description: Add levels to a user
permission: mcmmo.tools.mmoedit permission: mcmmo.tools.mmoedit
mcability: mcability:
aliases: []
description: Toggle whether or not abilities get readied on right click description: Toggle whether or not abilities get readied on right click
permission: mcmmo.commands.ability permission: mcmmo.commands.ability
mcrefresh: mcrefresh:
aliases: []
description: Refresh all cooldowns for mcMMO description: Refresh all cooldowns for mcMMO
permission: mcmmo.tools.mcrefresh permission: mcmmo.tools.mcrefresh
mcgod: mcgod:
aliases: []
description: Make yourself invulnerable description: Make yourself invulnerable
permission: mcmmo.tools.mcgod permission: mcmmo.tools.mcgod
mcstats: mcstats:
aliases: []
description: Shows your mcMMO stats and xp description: Shows your mcMMO stats and xp
mcremove: mcremove:
aliases: []
description: Remove a user from the database description: Remove a user from the database
permission: mcmmo.tools.mcremove permission: mcmmo.tools.mcremove
mmoedit: mmoedit:
aliases: []
description: Edit the skill values for a user description: Edit the skill values for a user
permission: mcmmo.tools.mmoedit permission: mcmmo.tools.mmoedit
ptp: ptp:
aliases: []
description: Teleport to a party member description: Teleport to a party member
permission: mcmmo.commands.ptp permission: mcmmo.commands.ptp
party: party:
aliases: []
description: Create/join a party description: Create/join a party
permission: mcmmo.commands.party permission: mcmmo.commands.party
inspect: inspect:
aliases: []
description: View mcMMO stats of another player description: View mcMMO stats of another player
invite: invite:
aliases: []
description: Invite a player into your party description: Invite a player into your party
permission: mcmmo.chat.partychat permission: mcmmo.chat.partychat
accept: accept:
aliases: []
description: Accept a party invite description: Accept a party invite
permission: mcmmo.chat.partychat permission: mcmmo.chat.partychat
mmoupdate: mmoupdate:
aliases: []
description: Convert from Flat File to MySQL description: Convert from Flat File to MySQL
permission: mcmmo.admin permission: mcmmo.admin
p: p:
aliases: [pc]
description: Toggle Party chat or send party chat messages description: Toggle Party chat or send party chat messages
permission: mcmmo.chat.partychat permission: mcmmo.chat.partychat
excavation: excavation:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.excavation
herbalism: herbalism:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.herbalism
mining: mining:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.mining
woodcutting: woodcutting:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.woodcutting
axes: axes:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.axes
archery: archery:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.archery
swords: swords:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.swords
taming: taming:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.taming
unarmed: unarmed:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.unarmed
acrobatics: acrobatics:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.acrobatics
repair: repair:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.repair
fishing: fishing:
aliases: []
description: Detailed skill info description: Detailed skill info
permission: mcmmo.skills.fishing
a: a:
aliases: [ac]
description: Toggle Admin chat or send admin chat messages description: Toggle Admin chat or send admin chat messages
permission: mcmmo.chat.adminchat permission: mcmmo.chat.adminchat
permissions: permissions:
@ -118,7 +165,7 @@ permissions:
mcmmo.admin: true mcmmo.admin: true
mcmmo.tools.*: true mcmmo.tools.*: true
mcmmo.admin: mcmmo.admin:
description: Allows access to mmoupdate and other sensitive commands description: All ows access to mmoupdate and other sensitive commands
mcmmo.bypass.arcanebypass: mcmmo.bypass.arcanebypass:
description: Allows user to bypass Arcane Repair so he will never lose enchantments description: Allows user to bypass Arcane Repair so he will never lose enchantments
mcmmo.tools.*: mcmmo.tools.*: