Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

This commit is contained in:
nossr50 2012-04-03 14:13:57 -07:00
commit e8817ec9ea
9 changed files with 253 additions and 165 deletions

View File

@ -5,6 +5,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -93,13 +94,7 @@ public class Users {
* @return the player's profile * @return the player's profile
*/ */
public static PlayerProfile getProfile(Player player) { public static PlayerProfile getProfile(Player player) {
if(players.get(player.getName().toLowerCase()) != null) { return getProfile(player.getName());
return players.get(player.getName().toLowerCase());
}
else {
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
return players.get(player.getName().toLowerCase());
}
} }
/** /**
@ -118,6 +113,16 @@ public class Users {
} }
} }
/**
* Get the profile of an offline player.
*
* @param player The player whose profile to retrieve
* @return the player's profile
*/
public static PlayerProfile getOfflineProfile(OfflinePlayer player) {
return getOfflineProfile(player.getName());
}
/** /**
* Get the profile of an offline player. * Get the profile of an offline player.
* *

View File

@ -0,0 +1,138 @@
package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class CommandHelper {
/**
* Checks for command permissions.
*
* @param sender The command sender
* @param permission The permission to check
* @return true if the sender is a player without permissions, false otherwise
*/
public static boolean noCommandPermissions(CommandSender sender, String permission) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (player != null && !mcPermissions.getInstance().permission(player, permission)) {
player.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
}
return false;
}
/**
* Print out details on Gathering skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printGatheringSkills(Player inspect, CommandSender display) {
if (Skills.hasGatheringSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.GatheringHeader"));
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) }));
}
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) }));
}
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) }));
}
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) }));
}
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) }));
}
}
}
public static void printGatheringSkills(Player player) {
printGatheringSkills(player, player);
}
/**
* Print out details on Combat skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printCombatSkills(Player inspect, CommandSender display) {
if (Skills.hasCombatSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.CombatHeader"));
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) }));
}
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) }));
}
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) }));
}
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) }));
}
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) }));
}
}
}
public static void printCombatSkills(Player player) {
printCombatSkills(player, player);
}
/**
* Print out details on Misc skills. Only for online players.
*
* @param inspect The player to retrieve stats for
* @param display The sender to display stats to
* @param online true if the player to retrieve stats for is online, false otherwise
*/
public static void printMiscSkills(Player inspect, CommandSender display) {
if (Skills.hasMiscSkills(inspect)) {
PlayerProfile PP = Users.getProfile(inspect);
display.sendMessage(mcLocale.getString("Stats.MiscHeader"));
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) }));
}
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) }));
}
}
}
public static void printMiscSkills(Player player) {
printMiscSkills(player, player);
}
}

View File

@ -9,9 +9,8 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
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.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
public class AddlevelsCommand implements CommandExecutor{ public class AddlevelsCommand implements CommandExecutor{
@ -23,20 +22,15 @@ public class AddlevelsCommand 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) {
Player sendingPlayer;
Player modifiedPlayer; Player modifiedPlayer;
int levels; int levels;
SkillType skill; SkillType skill;
String skillName; String skillName;
String usage = ChatColor.RED + "Proper usage is /addlevels <playername> <skillname> <levels>"; //TODO: Needs more locale.
if (sender instanceof Player) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
sendingPlayer = (Player) sender;
if (sendingPlayer != null && !mcPermissions.getInstance().mmoedit(sendingPlayer)) {
sendingPlayer.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission"));
return true; return true;
} }
}
switch (args.length) { switch (args.length) {
case 2: case 2:
@ -58,7 +52,7 @@ public class AddlevelsCommand implements CommandExecutor{
} }
} }
else { else {
System.out.println("Usage is /addlevels playername skillname levels"); //TODO: Needs more locale. sender.sendMessage(usage);
} }
return true; return true;
@ -70,36 +64,27 @@ public class AddlevelsCommand implements CommandExecutor{
if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) { if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) {
levels = Integer.valueOf(args[2]); levels = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]); skill = Skills.getSkillType(args[1]);
String message;
if (skill.equals(SkillType.ALL)) {
skillName = "all skills";
}
else {
skillName = m.getCapitalized(skill.toString());
}
Users.getProfile(modifiedPlayer).addLevels(skill, levels); Users.getProfile(modifiedPlayer).addLevels(skill, levels);
if (sender instanceof Player) { if (skill.equals(SkillType.ALL)) {
sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + playerName + "."); //TODO: Use locale skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
} }
else { else {
System.out.println(skillName + " has been modified for " + playerName + "."); //TODO: Use locale skillName = m.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
} }
sender.sendMessage(message);
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale. modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + levels + " levels in " + skillName + "!"); //TODO: Needs more locale.
} }
return true; return true;
default: default:
if (sender instanceof Player) { sender.sendMessage(usage);
sender.sendMessage(ChatColor.RED + "Usage is /addlevels playername skillname levels"); //TODO: Needs more locale.
}
else {
System.out.println("Usage is /addlevels playername skillname levels"); //TODO: Needs more locale.
}
return true; return true;
} }
} }

View File

@ -9,9 +9,8 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
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.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
public class AddxpCommand implements CommandExecutor { public class AddxpCommand implements CommandExecutor {
@ -23,20 +22,15 @@ public class AddxpCommand 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) {
Player sendingPlayer;
Player modifiedPlayer; Player modifiedPlayer;
int xp; int xp;
SkillType skill; SkillType skill;
String skillName; String skillName;
String usage = ChatColor.RED + "Proper usage is /addxp <playername> <skillname> <xp>"; //TODO: Needs more locale.
if (sender instanceof Player) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
sendingPlayer = (Player) sender;
if (sendingPlayer != null && !mcPermissions.getInstance().mmoedit(sendingPlayer)) {
sendingPlayer.sendMessage(mcLocale.getString("mcPlayerListener.NoPermission"));
return true; return true;
} }
}
switch (args.length) { switch (args.length) {
case 2: case 2:
@ -66,7 +60,7 @@ public class AddxpCommand implements CommandExecutor {
} }
} }
else { else {
System.out.println("Usage is /addxp playername skillname xp"); //TODO: Needs more locale. sender.sendMessage(usage);
} }
return true; return true;
@ -78,23 +72,20 @@ public class AddxpCommand implements CommandExecutor {
if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) { if (modifiedPlayer != null && m.isInt(args[2]) && Skills.isSkill(args[1])) {
xp = Integer.valueOf(args[2]); xp = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]); skill = Skills.getSkillType(args[1]);
String message;
Users.getProfile(modifiedPlayer).addXPOverride(skill, xp); Users.getProfile(modifiedPlayer).addXPOverride(skill, xp);
if (skill.equals(SkillType.ALL)) { if (skill.equals(SkillType.ALL)) {
skillName = "all skills"; skillName = "all skills";
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = m.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
} }
if (sender instanceof Player) { sender.sendMessage(message);
sender.sendMessage(ChatColor.RED + skillName + " has been modified for " + playerName + "."); //TODO: Use locale
}
else {
System.out.println(skillName + " has been modified for " + playerName + "."); //TODO: Use locale
}
modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale. modifiedPlayer.sendMessage(ChatColor.GREEN + "You were awarded " + xp + " experience in " + skillName + "!"); //TODO: Needs more locale.
if (skill.equals(SkillType.ALL)) { if (skill.equals(SkillType.ALL)) {
@ -108,13 +99,7 @@ public class AddxpCommand implements CommandExecutor {
return true; return true;
default: default:
if (sender instanceof Player) { sender.sendMessage(usage);
sender.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp"); //TODO: Needs more locale.
}
else {
System.out.println("Usage is /addxp playername skillname xp"); //TODO: Needs more locale.
}
return true; return true;
} }
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.general; package com.gmail.nossr50.commands.general;
import org.bukkit.ChatColor;
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;
@ -9,11 +8,10 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
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.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class InspectCommand implements CommandExecutor { public class InspectCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -24,103 +22,71 @@ public class InspectCommand 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) {
Player target;
PlayerProfile PP;
String usage = "Proper usage is /inspect <playername>"; //TODO: Needs more locale.
Player player = null; if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
if (sender instanceof Player) {
player = (Player) sender;
}
if (sender instanceof Player && !mcPermissions.getInstance().inspect(player)) {
sender.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true; return true;
} }
if (args.length < 1) { switch (args.length) {
sender.sendMessage(ChatColor.RED + "Proper usage is /inspect <playername>"); //TODO: Needs more locale. case 1:
target = plugin.getServer().getPlayer(args[0]);
if (target != null) {
PP = Users.getProfile(target);
if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0)) {
sender.sendMessage(mcLocale.getString("Inspect.TooFar"));
return true; return true;
} }
// if split[1] is an online player sender.sendMessage(mcLocale.getString("Inspect.Stats", new Object[] { target.getName() }));
if (plugin.getServer().getPlayer(args[0]) != null) CommandHelper.printGatheringSkills(target, sender);
{ CommandHelper.printCombatSkills(target, sender);
Player target = plugin.getServer().getPlayer(args[0]); CommandHelper.printMiscSkills(target, sender);
PlayerProfile PPt = Users.getProfile(target); sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel", new Object[] { PP.getPowerLevel() }));
//If they are not an Op they have to be close
if(sender instanceof Player && !player.isOp() && !m.isNear(player.getLocation(), target.getLocation(), 5.0))
{
sender.sendMessage("You are too far away to inspect that player!"); //TODO: Needs more locale.
} }
else {
PP = Users.getOfflineProfile(args[0]);
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName()); //TODO: Needs more locale. if (sender instanceof Player && !sender.isOp()) {
sender.sendMessage(mcLocale.getString("Inspect.Offline"));
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-"); //TODO: Needs more locale.
if (mcPermissions.getInstance().excavation(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION)));
if (mcPermissions.getInstance().fishing(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING)));
if (mcPermissions.getInstance().herbalism(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM)));
if (mcPermissions.getInstance().mining(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING)));
if (mcPermissions.getInstance().woodcutting(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING)));
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-"); //TODO: Needs more locale.
if (mcPermissions.getInstance().axes(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES)));
if (mcPermissions.getInstance().archery(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY)));
if (mcPermissions.getInstance().swords(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS)));
if (mcPermissions.getInstance().taming(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING)));
if (mcPermissions.getInstance().unarmed(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED)));
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-"); //TODO: Needs more locale.
if (mcPermissions.getInstance().acrobatics(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS)));
if (mcPermissions.getInstance().repair(target))
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (PPt.getPowerLevel()));
} else {
if(sender instanceof Player && !player.isOp())
{
sender.sendMessage("That player is offline, inspecting offline players is limited to Ops!"); //TODO: Needs more locale.
return true; return true;
} }
PlayerProfile PPt = Users.getOfflineProfile(args[0]); if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Inspect.DoesNotExist"));
if(!PPt.isLoaded())
{
sender.sendMessage("Player does not exist in the database!"); //TODO: Needs more locale.
return true; return true;
} }
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for Offline Player " + ChatColor.YELLOW + args[0]); //TODO: Needs more locale. sender.sendMessage(mcLocale.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-"); //TODO: Needs more locale. sender.sendMessage(mcLocale.getString("Stats.GatheringHeader"));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-"); //TODO: Needs more locale. sender.sendMessage(mcLocale.getString("Stats.CombatHeader"));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-"); //TODO: Needs more locale. sender.sendMessage(mcLocale.getString("Stats.MiscHeader"));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); sender.sendMessage(mcLocale.getString("m.SkillStats", new Object[] { mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
} }
return true; return true;
default:
sender.sendMessage(usage);
return true;
}
} }
} }

View File

@ -175,7 +175,7 @@ public class mcEntityListener implements Listener {
* *
* @param event The event to monitor * @param event The event to monitor
*/ */
@EventHandler (priority = EventPriority.LOW) @EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) { public void onExplosionPrime(ExplosionPrimeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
@ -197,7 +197,7 @@ public class mcEntityListener implements Listener {
* *
* @param event The event to monitor * @param event The event to monitor
*/ */
@EventHandler (priority = EventPriority.LOW) @EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEnitityExplode(EntityExplodeEvent event) { public void onEnitityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();

View File

@ -30,7 +30,7 @@ public class mcPermissions {
} }
public boolean arcaneBypass(Player player) { public boolean arcaneBypass(Player player) {
return player.hasPermission(("mcmmo.repair.arcanebypass")); return player.hasPermission(("mcmmo.bypass.arcanebypass"));
} }
/* /*

View File

@ -427,10 +427,10 @@ public class Repair {
short newDurability = getRepairAmount(item, player); short newDurability = getRepairAmount(item, player);
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
McMMOPlayerRepairCheckEvent preEvent = new McMMOPlayerRepairCheckEvent(player, (short) (initialDurability - newDurability), repairMaterial, item); McMMOPlayerRepairCheckEvent event = new McMMOPlayerRepairCheckEvent(player, (short) (initialDurability - newDurability), repairMaterial, item);
Bukkit.getPluginManager().callEvent(preEvent); Bukkit.getPluginManager().callEvent(event);
if (preEvent.isCancelled()) { if (event.isCancelled()) {
return; return;
} }

View File

@ -229,7 +229,7 @@ mcPlayerListener.AdminChatOn=Admin Chat only [[GREEN]]On
mcPlayerListener.AdminChatOff=Admin Chat only [[RED]]Off mcPlayerListener.AdminChatOff=Admin Chat only [[RED]]Off
mcPlayerListener.MOTD=[[BLUE]]This server is running mcMMO {0} type [[YELLOW]]/{1}[[BLUE]] for help. mcPlayerListener.MOTD=[[BLUE]]This server is running mcMMO {0} type [[YELLOW]]/{1}[[BLUE]] for help.
mcPlayerListener.WIKI=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki mcPlayerListener.WIKI=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki
mcPlayerListener.PowerLevel=[[DARK_RED]]POWER LEVEL: mcPlayerListener.PowerLevel=[[DARK_RED]]POWER LEVEL: [[GREEN]]{0}
mcPlayerListener.PowerLevelLeaderboard=[[YELLOW]]--mcMMO[[BLUE]] Power Level [[YELLOW]]Leaderboard-- mcPlayerListener.PowerLevelLeaderboard=[[YELLOW]]--mcMMO[[BLUE]] Power Level [[YELLOW]]Leaderboard--
mcPlayerListener.SkillLeaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard-- mcPlayerListener.SkillLeaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Leaderboard--
mcPlayerListener.RepairSkill=Repair: mcPlayerListener.RepairSkill=Repair:
@ -431,3 +431,12 @@ Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
m.EffectsTaming7_1=Summon an animal to your side m.EffectsTaming7_1=Summon an animal to your side
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones/Fish in hand m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones/Fish in hand
m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots
m.SkillStats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
Inspect.TooFar=[[RED]]You are too far away to inspect that player!
Inspect.Offline = [[RED]]That player is offline, inspecting offline players is limited to Ops!
Inspect.DoesNotExist = [[RED]]Player does not exist in the database!
Inspect.Stats=[[GREEN]]mcMMO Stats for [[YELLOW]]{0}
Inspect.OfflineStats=mcMMO Stats for Offline Player [[YELLOW]]{0}
Stats.GatheringHeader=[[GOLD]]-=GATHERING SKILLS=-
Stats.CombatHeader=[[GOLD]]-=COMBAT SKILLS=-
Stats.MiscHeader=[[GOLD]]-=MISC SKILLS=-