Refactor ALL THE THINGS!

This commit is contained in:
nossr50 2012-04-27 02:47:11 -07:00
parent ac35f002f1
commit 47b7780c96
84 changed files with 3503 additions and 3501 deletions

View File

@ -3,11 +3,11 @@ package com.gmail.nossr50.api;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ChatAPI { public class ChatAPI {
/** /**
@ -61,7 +61,7 @@ public class ChatAPI {
mcMMO.p.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage()); mcMMO.p.getLogger().info("[A]<" + chatEvent.getSender() + "> " + chatEvent.getMessage());
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(player) || player.isOp()) if (Permissions.getInstance().adminChat(player) || player.isOp())
player.sendMessage(aPrefix + chatEvent.getMessage()); player.sendMessage(aPrefix + chatEvent.getMessage());
} }
} }

View File

@ -2,9 +2,9 @@ package com.gmail.nossr50.api;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Users;
public class ExperienceAPI { public class ExperienceAPI {

View File

@ -4,8 +4,8 @@ import java.util.ArrayList;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PartyAPI { public class PartyAPI {

View File

@ -3,12 +3,12 @@ package com.gmail.nossr50.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; 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.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class CommandHelper { public class CommandHelper {
@ -23,8 +23,8 @@ public class CommandHelper {
if (sender instanceof Player) { if (sender instanceof Player) {
Player player = (Player) sender; Player player = (Player) sender;
if (player != null && !mcPermissions.getInstance().permission(player, permission)) { if (player != null && !Permissions.getInstance().permission(player, permission)) {
player.sendMessage(mcLocale.getString("mcMMO.NoPermission")); player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true; return true;
} }
} }
@ -34,7 +34,7 @@ public class CommandHelper {
public static boolean noConsoleUsage(CommandSender sender) { public static boolean noConsoleUsage(CommandSender sender) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage(mcLocale.getString("Commands.NoConsole")); sender.sendMessage(LocaleLoader.getString("Commands.NoConsole"));
return true; return true;
} }
@ -51,26 +51,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.Header.Gathering")); display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
if (mcPermissions.getInstance().excavation(inspect)) { if (Permissions.getInstance().excavation(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
} }
if (mcPermissions.getInstance().fishing(inspect)) { if (Permissions.getInstance().fishing(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
} }
if (mcPermissions.getInstance().herbalism(inspect)) { if (Permissions.getInstance().herbalism(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
} }
if (mcPermissions.getInstance().mining(inspect)) { if (Permissions.getInstance().mining(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
} }
if (mcPermissions.getInstance().woodcutting(inspect)) { if (Permissions.getInstance().woodcutting(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
} }
} }
} }
@ -89,26 +89,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.Header.Combat")); display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
if (mcPermissions.getInstance().axes(inspect)) { if (Permissions.getInstance().axes(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
} }
if (mcPermissions.getInstance().archery(inspect)) { if (Permissions.getInstance().archery(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
} }
if (mcPermissions.getInstance().swords(inspect)) { if (Permissions.getInstance().swords(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
} }
if (mcPermissions.getInstance().taming(inspect)) { if (Permissions.getInstance().taming(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
} }
if (mcPermissions.getInstance().unarmed(inspect)) { if (Permissions.getInstance().unarmed(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
} }
} }
} }
@ -126,14 +126,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.Header.Misc")); display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
if (mcPermissions.getInstance().acrobatics(inspect)) { if (Permissions.getInstance().acrobatics(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
} }
if (mcPermissions.getInstance().repair(inspect)) { if (Permissions.getInstance().repair(inspect)) {
display.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); display.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
} }
} }
} }

View File

@ -7,14 +7,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.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.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class AddlevelsCommand implements CommandExecutor{ public class AddlevelsCommand implements CommandExecutor{
private final mcMMO plugin; private final mcMMO plugin;
@ -40,11 +40,11 @@ public class AddlevelsCommand implements CommandExecutor{
case 2: case 2:
if (sender instanceof Player) { if (sender instanceof Player) {
if (!Skills.isSkill(args[0])) { if (!Skills.isSkill(args[0])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[1])) { if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender; modifiedPlayer = (Player) sender;
levels = Integer.valueOf(args[1]); levels = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]); skill = Skills.getSkillType(args[0]);
@ -54,7 +54,7 @@ public class AddlevelsCommand implements CommandExecutor{
skillName = "all skills"; skillName = "all skills";
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
} }
PP.addLevels(skill, levels); PP.addLevels(skill, levels);
@ -73,16 +73,16 @@ public class AddlevelsCommand implements CommandExecutor{
PP = Users.getProfile(modifiedPlayer); PP = Users.getProfile(modifiedPlayer);
if (!PP.isLoaded()) { if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;
} }
if (!Skills.isSkill(args[1])) { if (!Skills.isSkill(args[1])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[2])) { if (Misc.isInt(args[2])) {
levels = Integer.valueOf(args[2]); levels = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]); skill = Skills.getSkillType(args[1]);
String message; String message;
@ -94,7 +94,7 @@ public class AddlevelsCommand implements CommandExecutor{
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
} }

View File

@ -6,13 +6,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
//TODO: Any way we can make this work for offline use? //TODO: Any way we can make this work for offline use?
public class AddxpCommand implements CommandExecutor { public class AddxpCommand implements CommandExecutor {
@ -38,11 +38,11 @@ public class AddxpCommand implements CommandExecutor {
case 2: case 2:
if (sender instanceof Player) { if (sender instanceof Player) {
if (!Skills.isSkill(args[1])) { if (!Skills.isSkill(args[1])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[1])) { if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender; modifiedPlayer = (Player) sender;
xp = Integer.valueOf(args[1]); xp = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]); skill = Skills.getSkillType(args[0]);
@ -53,7 +53,7 @@ public class AddxpCommand implements CommandExecutor {
skillName = "all skills"; skillName = "all skills";
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
} }
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.
@ -80,16 +80,16 @@ public class AddxpCommand implements CommandExecutor {
String playerName = modifiedPlayer.getName(); String playerName = modifiedPlayer.getName();
if (!Users.getProfile(modifiedPlayer).isLoaded()) { if (!Users.getProfile(modifiedPlayer).isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;
} }
if (!Skills.isSkill(args[1])) { if (!Skills.isSkill(args[1])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[2])) { if (Misc.isInt(args[2])) {
xp = Integer.valueOf(args[2]); xp = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]); skill = Skills.getSkillType(args[1]);
String message; String message;
@ -101,7 +101,7 @@ public class AddxpCommand implements CommandExecutor {
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
} }

View File

@ -6,14 +6,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
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.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.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class InspectCommand implements CommandExecutor { public class InspectCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -40,49 +40,49 @@ public class InspectCommand implements CommandExecutor {
if (target.isOnline()) { if (target.isOnline()) {
Player player = (Player) target; Player player = (Player) target;
if (sender instanceof Player && !sender.isOp() && !m.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0) && !mcPermissions.getInstance().inspectDistanceBypass((Player) sender)) { if (sender instanceof Player && !sender.isOp() && !Misc.isNear(((Player) sender).getLocation(), player.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
sender.sendMessage(mcLocale.getString("Inspect.TooFar")); sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true; return true;
} }
sender.sendMessage(mcLocale.getString("Inspect.Stats", new Object[] { target.getName() })); sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
CommandHelper.printGatheringSkills(player, sender); CommandHelper.printGatheringSkills(player, sender);
CommandHelper.printCombatSkills(player, sender); CommandHelper.printCombatSkills(player, sender);
CommandHelper.printMiscSkills(player, sender); CommandHelper.printMiscSkills(player, sender);
sender.sendMessage(mcLocale.getString("Commands.PowerLevel", new Object[] { PP.getPowerLevel() })); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { PP.getPowerLevel() }));
return true; return true;
} }
else { else {
if (sender instanceof Player && !sender.isOp() && !mcPermissions.getInstance().inspectOfflineBypass((Player) sender)) { if (sender instanceof Player && !sender.isOp() && !Permissions.getInstance().inspectOfflineBypass((Player) sender)) {
sender.sendMessage(mcLocale.getString("Inspect.Offline")); sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true; return true;
} }
if (!PP.isLoaded()) { if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;
} }
sender.sendMessage(mcLocale.getString("Inspect.OfflineStats", new Object[] { args[0] })); sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(mcLocale.getString("Stats.Header.Gathering")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(mcLocale.getString("Stats.Header.Combat")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(mcLocale.getString("Stats.Header.Misc")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(mcLocale.getString("Skills.Stats", new Object[] { mcLocale.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
return true; return true;
} }

View File

@ -5,10 +5,10 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McstatsCommand implements CommandExecutor { public class McstatsCommand implements CommandExecutor {
@ -21,14 +21,14 @@ public class McstatsCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("Stats.Own.Stats")); player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(mcLocale.getString("mcMMO.NoSkillNote")); player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
CommandHelper.printGatheringSkills(player); CommandHelper.printGatheringSkills(player);
CommandHelper.printCombatSkills(player); CommandHelper.printCombatSkills(player);
CommandHelper.printMiscSkills(player); CommandHelper.printMiscSkills(player);
player.sendMessage(mcLocale.getString("Commands.PowerLevel", new Object[] { String.valueOf(PP.getPowerLevel()) })); player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { String.valueOf(PP.getPowerLevel()) }));
return true; return true;
} }

View File

@ -7,14 +7,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.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.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class MmoeditCommand implements CommandExecutor { public class MmoeditCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -40,11 +40,11 @@ public class MmoeditCommand implements CommandExecutor {
case 2: case 2:
if (sender instanceof Player) { if (sender instanceof Player) {
if (!Skills.isSkill(args[0])) { if (!Skills.isSkill(args[0])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[1])) { if (Misc.isInt(args[1])) {
modifiedPlayer = (Player) sender; modifiedPlayer = (Player) sender;
newValue = Integer.valueOf(args[1]); newValue = Integer.valueOf(args[1]);
skill = Skills.getSkillType(args[0]); skill = Skills.getSkillType(args[0]);
@ -54,7 +54,7 @@ public class MmoeditCommand implements CommandExecutor {
skillName = "all skills"; skillName = "all skills";
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
} }
PP.modifySkill(skill, newValue); PP.modifySkill(skill, newValue);
@ -76,16 +76,16 @@ public class MmoeditCommand implements CommandExecutor {
PP = Users.getProfile(modifiedPlayer); PP = Users.getProfile(modifiedPlayer);
if (!PP.isLoaded()) { if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;
} }
if (!Skills.isSkill(args[1])) { if (!Skills.isSkill(args[1])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[2])) { if (Misc.isInt(args[2])) {
newValue = Integer.valueOf(args[2]); newValue = Integer.valueOf(args[2]);
skill = Skills.getSkillType(args[1]); skill = Skills.getSkillType(args[1]);
String message; String message;
@ -97,7 +97,7 @@ public class MmoeditCommand implements CommandExecutor {
message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + "All skills have been modified for " + playerName + "."; //TODO: Use locale
} }
else { else {
skillName = m.getCapitalized(skill.toString()); skillName = Misc.getCapitalized(skill.toString());
message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale message = ChatColor.RED + skillName + " has been modified for " + playerName + "."; //TODO: Use locale
} }

View File

@ -6,11 +6,11 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.runnables.SQLConversionTask; import com.gmail.nossr50.runnables.SQLConversionTask;
import com.gmail.nossr50.util.Users;
public class MmoupdateCommand implements CommandExecutor { public class MmoupdateCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;

View File

@ -5,11 +5,11 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
public class XprateCommand implements CommandExecutor { public class XprateCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -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.0"); String usage1 = LocaleLoader.getString("Commands.xprate.proper.0");
String usage2 = mcLocale.getString("Commands.xprate.proper.1"); String usage2 = LocaleLoader.getString("Commands.xprate.proper.1");
String usage3 = mcLocale.getString("Commands.xprate.proper.2"); String usage3 = LocaleLoader.getString("Commands.xprate.proper.2");
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
return true; return true;
@ -35,7 +35,7 @@ public class XprateCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("reset")) { if (args[0].equalsIgnoreCase("reset")) {
if (xpevent) { if (xpevent) {
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.over")); x.sendMessage(LocaleLoader.getString("Commands.xprate.over"));
} }
xpevent = !xpevent; xpevent = !xpevent;
@ -45,7 +45,7 @@ public class XprateCommand implements CommandExecutor {
Config.getInstance().xpGainMultiplier = oldrate; Config.getInstance().xpGainMultiplier = oldrate;
} }
} }
else if (m.isInt(args[0])) { else if (Misc.isInt(args[0])) {
sender.sendMessage(usage3); sender.sendMessage(usage3);
} }
else { else {
@ -55,7 +55,7 @@ public class XprateCommand implements CommandExecutor {
return true; return true;
case 2: case 2:
if (m.isInt(args[0])) { if (Misc.isInt(args[0])) {
oldrate = Config.getInstance().xpGainMultiplier; oldrate = Config.getInstance().xpGainMultiplier;
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) { if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
@ -65,12 +65,12 @@ public class XprateCommand implements CommandExecutor {
sender.sendMessage(usage3); sender.sendMessage(usage3);
} }
Config.getInstance().xpGainMultiplier = m.getInt(args[0]); Config.getInstance().xpGainMultiplier = Misc.getInt(args[0]);
if (xpevent) { if (xpevent) {
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
x.sendMessage(mcLocale.getString("Commands.xprate.started.0")); x.sendMessage(LocaleLoader.getString("Commands.xprate.started.0"));
x.sendMessage(mcLocale.getString("Commands.xprate.started.1", new Object[] {Config.getInstance().xpGainMultiplier})); x.sendMessage(LocaleLoader.getString("Commands.xprate.started.1", new Object[] {Config.getInstance().xpGainMultiplier}));
} }
} }
else { else {

View File

@ -5,10 +5,10 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McabilityCommand implements CommandExecutor { public class McabilityCommand implements CommandExecutor {
@ -25,10 +25,10 @@ public class McabilityCommand implements CommandExecutor {
PlayerProfile PP = Users.getProfile((Player) sender); PlayerProfile PP = Users.getProfile((Player) sender);
if (PP.getAbilityUse()) { if (PP.getAbilityUse()) {
sender.sendMessage(mcLocale.getString("Commands.Ability.Off")); sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Ability.On")); sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
} }
PP.toggleAbilityUse(); PP.toggleAbilityUse();

View File

@ -6,9 +6,9 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
//TODO: Rework this whole thing. It's ugly. Also is missing all the admin & spout commands. //TODO: Rework this whole thing. It's ugly. Also is missing all the admin & spout commands.
public class MccCommand implements CommandExecutor { public class MccCommand implements CommandExecutor {
@ -23,49 +23,49 @@ public class MccCommand implements CommandExecutor {
player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); //TODO: Needs more locale. player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); //TODO: Needs more locale.
if (mcPermissions.getInstance().party(player)) { if (Permissions.getInstance().party(player)) {
player.sendMessage(mcLocale.getString("Commands.Party.Commands")); player.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
player.sendMessage("/party " + mcLocale.getString("Commands.Party")); player.sendMessage("/party " + LocaleLoader.getString("Commands.Party"));
player.sendMessage("/party q " + mcLocale.getString("Commands.Party.Quit")); player.sendMessage("/party q " + LocaleLoader.getString("Commands.Party.Quit"));
if (mcPermissions.getInstance().partyChat(player)) { if (Permissions.getInstance().partyChat(player)) {
player.sendMessage("/p " + mcLocale.getString("Commands.Party.Toggle")); player.sendMessage("/p " + LocaleLoader.getString("Commands.Party.Toggle"));
} }
player.sendMessage("/invite " + mcLocale.getString("Commands.Party.Invite")); player.sendMessage("/invite " + LocaleLoader.getString("Commands.Party.Invite"));
player.sendMessage("/accept " + mcLocale.getString("Commands.Party.Accept")); player.sendMessage("/accept " + LocaleLoader.getString("Commands.Party.Accept"));
if (mcPermissions.getInstance().partyTeleport(player)) { if (Permissions.getInstance().partyTeleport(player)) {
player.sendMessage("/ptp " + mcLocale.getString("Commands.Party.Teleport")); player.sendMessage("/ptp " + LocaleLoader.getString("Commands.Party.Teleport"));
} }
} }
player.sendMessage(mcLocale.getString("Commands.Other")); player.sendMessage(LocaleLoader.getString("Commands.Other"));
player.sendMessage("/mcstats " + mcLocale.getString("Commands.Stats")); player.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
player.sendMessage("/mctop " + mcLocale.getString("m.mccLeaderboards")); player.sendMessage("/mctop " + LocaleLoader.getString("m.mccLeaderboards"));
if (mcPermissions.getInstance().mcAbility(player)) { if (Permissions.getInstance().mcAbility(player)) {
player.sendMessage("/mcability " + mcLocale.getString("Commands.ToggleAbility")); player.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
} }
if (mcPermissions.getInstance().adminChat(player)) { if (Permissions.getInstance().adminChat(player)) {
player.sendMessage("/a " + mcLocale.getString("Commands.AdminToggle")); player.sendMessage("/a " + LocaleLoader.getString("Commands.AdminToggle"));
} }
if (mcPermissions.getInstance().inspect(player)) { if (Permissions.getInstance().inspect(player)) {
player.sendMessage("/inspect " + mcLocale.getString("Commands.Inspect")); player.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
} }
if (mcPermissions.getInstance().mmoedit(player)) { if (Permissions.getInstance().mmoedit(player)) {
player.sendMessage("/mmoedit " + mcLocale.getString("Commands.mmoedit")); player.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
} }
if (mcPermissions.getInstance().mcgod(player)) { if (Permissions.getInstance().mcgod(player)) {
player.sendMessage("/mcgod " + mcLocale.getString("Commands.mcgod")); player.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
} }
player.sendMessage(mcLocale.getString("Commands.SkillInfo")); player.sendMessage(LocaleLoader.getString("Commands.SkillInfo"));
player.sendMessage("/mcmmo " + mcLocale.getString("Commands.ModDescription")); player.sendMessage("/mcmmo " + LocaleLoader.getString("Commands.ModDescription"));
return true; return true;
} }

View File

@ -5,10 +5,10 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McgodCommand implements CommandExecutor { public class McgodCommand implements CommandExecutor {
@ -25,10 +25,10 @@ public class McgodCommand implements CommandExecutor {
PlayerProfile PP = Users.getProfile((Player) sender); PlayerProfile PP = Users.getProfile((Player) sender);
if (PP.getGodMode()) { if (PP.getGodMode()) {
sender.sendMessage(mcLocale.getString("Commands.GodMode.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.GodMode.Enabled")); sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
} }
PP.toggleGodMode(); PP.toggleGodMode();

View File

@ -8,13 +8,13 @@ import org.bukkit.command.CommandSender;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
public class McmmoCommand implements CommandExecutor { public class McmmoCommand 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 description = mcLocale.getString("mcMMO.Description"); String description = LocaleLoader.getString("mcMMO.Description");
String[] mcSplit = description.split(","); String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit); sender.sendMessage(mcSplit);

View File

@ -7,11 +7,11 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McrefreshCommand implements CommandExecutor { public class McrefreshCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -48,7 +48,7 @@ public class McrefreshCommand implements CommandExecutor {
String playerName = player.getName(); String playerName = player.getName();
if (!PP.isLoaded()) { if (!PP.isLoaded()) {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true; return true;
} }
@ -67,7 +67,7 @@ public class McrefreshCommand implements CommandExecutor {
PP.resetAbilityMode(); PP.resetAbilityMode();
if (player.isOnline()) { if (player.isOnline()) {
((Player) player).sendMessage(mcLocale.getString("Ability.Generic.Refresh")); ((Player) player).sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
} }
return true; return true;

View File

@ -10,11 +10,11 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class McremoveCommand implements CommandExecutor { public class McremoveCommand implements CommandExecutor {
private final String location = mcMMO.usersFile; private final String location = mcMMO.usersFile;
@ -82,7 +82,7 @@ public class McremoveCommand implements CommandExecutor {
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
} }
} }
else { else {
@ -90,7 +90,7 @@ public class McremoveCommand implements CommandExecutor {
sender.sendMessage(success); sender.sendMessage(success);
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
} }
} }

View File

@ -7,12 +7,12 @@ 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;
import com.gmail.nossr50.Leaderboard;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Misc;
public class MctopCommand implements CommandExecutor { public class MctopCommand implements CommandExecutor {
@ -28,25 +28,25 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
case 1: case 1:
if (m.isInt(args[0])) { if (Misc.isInt(args[0])) {
flatfileDisplay(Integer.valueOf(args[0]), "ALL", sender); flatfileDisplay(Integer.valueOf(args[0]), "ALL", sender);
} }
else if (Skills.isSkill(args[0])) { else if (Skills.isSkill(args[0])) {
flatfileDisplay(1, args[0].toUpperCase(), sender); flatfileDisplay(1, args[0].toUpperCase(), sender);
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
} }
return true; return true;
case 2: case 2:
if (!Skills.isSkill(args[0])) { if (!Skills.isSkill(args[0])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[1])) { if (Misc.isInt(args[1])) {
flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender); flatfileDisplay(Integer.valueOf(args[1]), args[0].toUpperCase(), sender);
} }
else { else {
@ -69,25 +69,25 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
case 1: case 1:
if (m.isInt(args[0])) { if (Misc.isInt(args[0])) {
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender); sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
} }
else if (Skills.isSkill(args[0])) { else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender); sqlDisplay(1, args[0].toLowerCase(), sender);
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
} }
return true; return true;
case 2: case 2:
if (!Skills.isSkill(args[0])) { if (!Skills.isSkill(args[0])) {
sender.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }
if (m.isInt(args[1])) { if (Misc.isInt(args[1])) {
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender); sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
} }
else { else {
@ -107,10 +107,10 @@ public class MctopCommand implements CommandExecutor {
String[] info = Leaderboard.retrieveInfo(skill, page); String[] info = Leaderboard.retrieveInfo(skill, page);
if (skill == "ALL") { if (skill == "ALL") {
sender.sendMessage(mcLocale.getString("Commands.PowerLevel.Leaderboard")); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Skill.Leaderboard", new Object[] { m.getCapitalized(skill) })); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(skill) }));
} }
int n = (page * 10) - 9; // Position int n = (page * 10) - 9; // Position
@ -136,10 +136,10 @@ public class MctopCommand implements CommandExecutor {
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC "); HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC ");
if (query == "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing") { if (query == "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing") {
sender.sendMessage(mcLocale.getString("Commands.PowerLevel.Leaderboard")); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Skill.Leaderboard", new Object[] { m.getCapitalized(query) })); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", new Object[] { Misc.getCapitalized(query) }));
} }
for (int i = (page * 10) - 9; i <= (page * 10); i++) { for (int i = (page * 10) - 9; i <= (page * 10); i++) {

View File

@ -6,13 +6,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
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.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.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ACommand implements CommandExecutor { public class ACommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -42,10 +42,10 @@ public class ACommand implements CommandExecutor {
PP.toggleAdminChat(); PP.toggleAdminChat();
if (PP.getAdminChatMode()) { if (PP.getAdminChatMode()) {
sender.sendMessage(mcLocale.getString("Commands.AdminChat.On")); sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.AdminChat.Off")); sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
} }
} }
else { else {
@ -88,7 +88,7 @@ public class ACommand implements CommandExecutor {
plugin.getLogger().info("[A]<*Console*> " + message); plugin.getLogger().info("[A]<*Console*> " + message);
for (Player player : plugin.getServer().getOnlinePlayers()) { for (Player player : plugin.getServer().getOnlinePlayers()) {
if (mcPermissions.getInstance().adminChat(player) || player.isOp()) { if (Permissions.getInstance().adminChat(player) || player.isOp()) {
player.sendMessage(prefix + message); player.sendMessage(prefix + message);
} }
} }

View File

@ -5,14 +5,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.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;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class AcceptCommand implements CommandExecutor { public class AcceptCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -60,7 +60,7 @@ public class AcceptCommand implements CommandExecutor {
} }
else { else {
player.sendMessage(mcLocale.getString("mcMMO.NoInvites")); player.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
} }
return true; return true;

View File

@ -6,12 +6,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
//TODO: Make this work from console. //TODO: Make this work from console.
public class InviteCommand implements CommandExecutor { public class InviteCommand implements CommandExecutor {
@ -41,7 +41,7 @@ public class InviteCommand implements CommandExecutor {
Party partyInstance = Party.getInstance(); Party partyInstance = Party.getInstance();
if (!PP.inParty()) { if (!PP.inParty()) {
player.sendMessage(mcLocale.getString("Commands.Party.None")); player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true; return true;
} }
@ -52,19 +52,19 @@ public class InviteCommand implements CommandExecutor {
PlayerProfile PPt = Users.getProfile(target); PlayerProfile PPt = Users.getProfile(target);
PPt.modifyInvite(PP.getParty()); PPt.modifyInvite(PP.getParty());
player.sendMessage(mcLocale.getString("Commands.Invite.Success")); player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(mcLocale.getString("Commands.Party.Invite.0", new Object[] { PPt.getInvite(), player.getName() })); target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", new Object[] { PPt.getInvite(), player.getName() }));
target.sendMessage(mcLocale.getString("Commands.Party.Invite.1")); target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true; return true;
} }
else { else {
player.sendMessage(mcLocale.getString("Party.Locked")); player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true; return true;
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Party.Player.Invalid")); player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
} }

View File

@ -6,13 +6,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PCommand implements CommandExecutor { public class PCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -43,10 +43,10 @@ public class PCommand implements CommandExecutor {
PP.togglePartyChat(); PP.togglePartyChat();
if (PP.getPartyChatMode()) { if (PP.getPartyChatMode()) {
sender.sendMessage(mcLocale.getString("Commands.Party.Chat.On")); sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
} }
else { else {
sender.sendMessage(mcLocale.getString("Commands.Party.Chat.Off")); sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
} }
} }
else { else {
@ -61,7 +61,7 @@ public class PCommand implements CommandExecutor {
PP = Users.getProfile(player); PP = Users.getProfile(player);
if (!PP.inParty()) { if (!PP.inParty()) {
player.sendMessage(mcLocale.getString("Commands.Party.None")); player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true; return true;
} }
@ -87,7 +87,7 @@ public class PCommand implements CommandExecutor {
} }
if (!Party.getInstance().isParty(args[0])) { if (!Party.getInstance().isParty(args[0])) {
sender.sendMessage(mcLocale.getString("Party.InvalidName")); sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return true; return true;
} }

View File

@ -6,14 +6,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.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;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PartyCommand implements CommandExecutor { public class PartyCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -48,9 +48,9 @@ public class PartyCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
if (!inParty) { if (!inParty) {
player.sendMessage(mcLocale.getString("Party.Help.0")); player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(mcLocale.getString("Party.Help.1")); player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(mcLocale.getString("Party.Help.2")); player.sendMessage(LocaleLoader.getString("Party.Help.2"));
} }
else { else {
String tempList = ""; String tempList = "";
@ -71,8 +71,8 @@ public class PartyCommand implements CommandExecutor {
tempList += ChatColor.WHITE + playerName; tempList += ChatColor.WHITE + playerName;
} }
player.sendMessage(mcLocale.getString("Commands.Party.InParty", new Object[] { partyName })); player.sendMessage(LocaleLoader.getString("Commands.Party.InParty", new Object[] { partyName }));
player.sendMessage(mcLocale.getString("Commands.Party.Members", new Object[] { tempList })); player.sendMessage(LocaleLoader.getString("Commands.Party.Members", new Object[] { tempList }));
} }
return true; return true;
@ -88,33 +88,33 @@ public class PartyCommand implements CommandExecutor {
} }
partyInstance.removeFromParty(player, PP); partyInstance.removeFromParty(player, PP);
player.sendMessage(mcLocale.getString("Commands.Party.Leave")); player.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
} }
else { else {
player.sendMessage("Commands.Party.None"); player.sendMessage("Commands.Party.None");
} }
} }
else if (args[0].equals("?")) { else if (args[0].equals("?")) {
player.sendMessage(mcLocale.getString("Party.Help.3")); player.sendMessage(LocaleLoader.getString("Party.Help.3"));
player.sendMessage(mcLocale.getString("Party.Help.1")); player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(mcLocale.getString("Party.Help.4")); player.sendMessage(LocaleLoader.getString("Party.Help.4"));
player.sendMessage(mcLocale.getString("Party.Help.5")); player.sendMessage(LocaleLoader.getString("Party.Help.5"));
player.sendMessage(mcLocale.getString("Party.Help.6")); player.sendMessage(LocaleLoader.getString("Party.Help.6"));
player.sendMessage(mcLocale.getString("Party.Help.7")); player.sendMessage(LocaleLoader.getString("Party.Help.7"));
} }
else if (args[0].equalsIgnoreCase("lock")) { else if (args[0].equalsIgnoreCase("lock")) {
if (inParty) { if (inParty) {
if (isLeader) { if (isLeader) {
if (partyInstance.isPartyLocked(partyName)) { if (partyInstance.isPartyLocked(partyName)) {
player.sendMessage(mcLocale.getString("Party.IsLocked")); player.sendMessage(LocaleLoader.getString("Party.IsLocked"));
} }
else { else {
partyInstance.lockParty(partyName); partyInstance.lockParty(partyName);
player.sendMessage(mcLocale.getString("Party.Locked")); player.sendMessage(LocaleLoader.getString("Party.Locked"));
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
} }
else { else {
@ -125,15 +125,15 @@ public class PartyCommand implements CommandExecutor {
if (inParty) { if (inParty) {
if (isLeader) { if (isLeader) {
if (!partyInstance.isPartyLocked(partyName)) { if (!partyInstance.isPartyLocked(partyName)) {
player.sendMessage(mcLocale.getString("Party.IsntLocked")); player.sendMessage(LocaleLoader.getString("Party.IsntLocked"));
} }
else { else {
partyInstance.unlockParty(partyName); partyInstance.unlockParty(partyName);
player.sendMessage(mcLocale.getString("Party.Unlocked")); player.sendMessage(LocaleLoader.getString("Party.Unlocked"));
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
} }
else { else {
@ -167,7 +167,7 @@ public class PartyCommand implements CommandExecutor {
case 2: case 2:
if (!partyInstance.isParty(args[0])) { if (!partyInstance.isParty(args[0])) {
sender.sendMessage(mcLocale.getString("Party.InvalidName")); sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return true; return true;
} }
@ -179,10 +179,10 @@ public class PartyCommand implements CommandExecutor {
} }
partyInstance.setPartyPassword(partyName, args[1]); partyInstance.setPartyPassword(partyName, args[1]);
player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] })); player.sendMessage(LocaleLoader.getString("Party.PasswordSet", new Object[] { args[1] }));
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
} }
else if (args[0].equalsIgnoreCase("kick")) { else if (args[0].equalsIgnoreCase("kick")) {
@ -190,7 +190,7 @@ public class PartyCommand implements CommandExecutor {
Player target = plugin.getServer().getPlayer(args[1]); Player target = plugin.getServer().getPlayer(args[1]);
if (target == null) { if (target == null) {
player.sendMessage(mcLocale.getString("Party.Player.Invalid")); player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
} }
@ -198,7 +198,7 @@ public class PartyCommand implements CommandExecutor {
String targetName = target.getName(); String targetName = target.getName();
if (!partyInstance.inSameParty(player, (Player) target)) { if (!partyInstance.inSameParty(player, (Player) target)) {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { targetName })); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
return true; return true;
} }
@ -211,11 +211,11 @@ public class PartyCommand implements CommandExecutor {
} }
partyInstance.removeFromParty(target, PPt); partyInstance.removeFromParty(target, PPt);
target.sendMessage(mcLocale.getString("Commands.Party.Kick", new Object[] { partyName })); target.sendMessage(LocaleLoader.getString("Commands.Party.Kick", new Object[] { partyName }));
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
} }
else if (args[0].equalsIgnoreCase("owner")) { else if (args[0].equalsIgnoreCase("owner")) {
@ -223,14 +223,14 @@ public class PartyCommand implements CommandExecutor {
Player target = plugin.getServer().getPlayer(args[1]); Player target = plugin.getServer().getPlayer(args[1]);
if (target == null) { if (target == null) {
player.sendMessage(mcLocale.getString("Party.Player.Invalid")); player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
} }
String targetName = target.getName(); String targetName = target.getName();
if (!partyInstance.inSameParty(player, (Player) target)) { if (!partyInstance.inSameParty(player, (Player) target)) {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { targetName })); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { targetName }));
return true; return true;
} }
@ -239,7 +239,7 @@ public class PartyCommand implements CommandExecutor {
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
} }
else { else {
@ -268,9 +268,9 @@ public class PartyCommand implements CommandExecutor {
return true; return true;
default: default:
player.sendMessage(mcLocale.getString("Party.Help.0")); player.sendMessage(LocaleLoader.getString("Party.Help.0"));
player.sendMessage(mcLocale.getString("Party.Help.1")); player.sendMessage(LocaleLoader.getString("Party.Help.1"));
player.sendMessage(mcLocale.getString("Party.Help.2")); player.sendMessage(LocaleLoader.getString("Party.Help.2"));
return true; return true;
} }
} }

View File

@ -6,14 +6,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent; import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Users;
public class PtpCommand implements CommandExecutor { public class PtpCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -40,12 +40,12 @@ public class PtpCommand implements CommandExecutor {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if (!Party.getInstance().isInParty(player, PP)) { if (!Party.getInstance().isInParty(player, PP)) {
player.sendMessage(mcLocale.getString("Commands.Party.None")); player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return true; return true;
} }
if (PP.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) { if (PP.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) {
player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() })); player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() }));
return true; return true;
} }
@ -57,12 +57,12 @@ public class PtpCommand implements CommandExecutor {
} }
if (target == null) { if (target == null) {
player.sendMessage(mcLocale.getString("Party.Teleport.Invalid")); player.sendMessage(LocaleLoader.getString("Party.Teleport.Invalid"));
return true; return true;
} }
if (target.isDead()) { if (target.isDead()) {
player.sendMessage(mcLocale.getString("Party.Teleport.Dead")); player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead"));
return true; return true;
} }
@ -75,11 +75,11 @@ public class PtpCommand implements CommandExecutor {
} }
player.teleport(target); player.teleport(target);
player.sendMessage(mcLocale.getString("Party.Teleport.Player", new Object[] { target.getName() })); player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", new Object[] { target.getName() }));
target.sendMessage(mcLocale.getString("Party.Teleport.Target", new Object[] { player.getName() })); target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", new Object[] { player.getName() }));
} }
else { else {
player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { target.getName() })); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] { target.getName() }));
return true; return true;
} }

View File

@ -5,13 +5,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class AcrobaticsCommand implements CommandExecutor { public class AcrobaticsCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -40,40 +40,40 @@ public class AcrobaticsCommand implements CommandExecutor {
dataCalculations(skillValue); dataCalculations(skillValue);
permissionsCheck(player); permissionsCheck(player);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Acrobatics.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Acrobatics.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Acrobatics") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Acrobatics") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
if (canDodge || canGracefulRoll || canRoll) { if (canDodge || canGracefulRoll || canRoll) {
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
} }
if (canRoll) { if (canRoll) {
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.0"), mcLocale.getString("Acrobatics.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.0"), LocaleLoader.getString("Acrobatics.Effect.1") }));
} }
if (canGracefulRoll) { if (canGracefulRoll) {
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.2"), mcLocale.getString("Acrobatics.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.2"), LocaleLoader.getString("Acrobatics.Effect.3") }));
} }
if (canDodge) { if (canDodge) {
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.4"), mcLocale.getString("Acrobatics.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Acrobatics.Effect.4"), LocaleLoader.getString("Acrobatics.Effect.5") }));
} }
if (canDodge || canGracefulRoll || canRoll) { if (canDodge || canGracefulRoll || canRoll) {
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
} }
if (canRoll) { if (canRoll) {
player.sendMessage(mcLocale.getString("Acrobatics.Roll.Chance", new Object[] { rollChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
} }
if (canGracefulRoll) { if (canGracefulRoll) {
player.sendMessage(mcLocale.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
} }
if (canDodge) { if (canDodge) {
player.sendMessage(mcLocale.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
} }
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args); Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
@ -105,7 +105,7 @@ public class AcrobaticsCommand implements CommandExecutor {
} }
private void permissionsCheck(Player player) { private void permissionsCheck(Player player) {
mcPermissions permInstance = mcPermissions.getInstance(); Permissions permInstance = Permissions.getInstance();
canDodge = permInstance.dodge(player); canDodge = permInstance.dodge(player);
canRoll = permInstance.roll(player); canRoll = permInstance.roll(player);
canGracefulRoll = permInstance.gracefulRoll(player); canGracefulRoll = permInstance.gracefulRoll(player);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class ArcheryCommand implements CommandExecutor { public class ArcheryCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -34,19 +34,19 @@ public class ArcheryCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.ARCHERY); skillValue = (float) PP.getSkillLevel(SkillType.ARCHERY);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Archery.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Archery.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Archery") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Archery") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Archery.Effect.0"), mcLocale.getString("Archery.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.0"), LocaleLoader.getString("Archery.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Archery.Effect.2"), mcLocale.getString("Archery.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Archery.Effect.4"), mcLocale.getString("Archery.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Archery.Effect.4"), LocaleLoader.getString("Archery.Effect.5") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus })); player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
player.sendMessage(mcLocale.getString("Archery.Combat.DazeChance", new Object[] { dazeChance })); player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
player.sendMessage(mcLocale.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance })); player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args); Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);

View File

@ -5,11 +5,11 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class AxesCommand implements CommandExecutor { public class AxesCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -35,23 +35,23 @@ public class AxesCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.AXES); skillValue = (float) PP.getSkillLevel(SkillType.AXES);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Axes.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Axes.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Axes") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Axes") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Axes.Effect.0"), mcLocale.getString("Axes.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.0"), LocaleLoader.getString("Axes.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Axes.Effect.2"), mcLocale.getString("Axes.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Axes.Effect.4"), mcLocale.getString("Axes.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Axes.Effect.6"), mcLocale.getString("Axes.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.6"), LocaleLoader.getString("Axes.Effect.7") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Axes.Effect.8"), mcLocale.getString("Axes.Effect.9") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Axes.Effect.8"), LocaleLoader.getString("Axes.Effect.9") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Axes.Combat.CritChance", new Object[] { critChance })); player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }));
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Axes.Ability.Bonus.0"), mcLocale.getString("Axes.Ability.Bonus.1", new Object[] {bonusDamage}) })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", new Object[] {bonusDamage}) }));
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Axes.Ability.Bonus.2"), mcLocale.getString("Axes.Ability.Bonus.3", new Object[] {impactDamage}) })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", new Object[] {impactDamage}) }));
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Axes.Ability.Bonus.4"), mcLocale.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
player.sendMessage(mcLocale.getString("Axes.Combat.SS.Length", new Object[] { skullSplitterLength })); player.sendMessage(LocaleLoader.getString("Axes.Combat.SS.Length", new Object[] { skullSplitterLength }));
return true; return true;
} }

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class ExcavationCommand implements CommandExecutor { public class ExcavationCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -32,16 +32,16 @@ public class ExcavationCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.EXCAVATION); skillValue = (float) PP.getSkillLevel(SkillType.EXCAVATION);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Excavation.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Excavation.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Excavation") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Excavation") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Excavation.Effect.0"), mcLocale.getString("Excavation.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.0"), LocaleLoader.getString("Excavation.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Excavation.Effect.2"), mcLocale.getString("Excavation.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Excavation.Effect.2"), LocaleLoader.getString("Excavation.Effect.3") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Excavation.Effect.Length", new Object[] { gigaDrillBreakerLength })); player.sendMessage(LocaleLoader.getString("Excavation.Effect.Length", new Object[] { gigaDrillBreakerLength }));
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args); Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);

View File

@ -5,13 +5,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.skills.Fishing; import com.gmail.nossr50.skills.Fishing;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class FishingCommand implements CommandExecutor { public class FishingCommand implements CommandExecutor {
@Override @Override
@ -27,25 +27,25 @@ public class FishingCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Fishing.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Fishing.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Fishing") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Fishing") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Fishing.Effect.0"), mcLocale.getString("Fishing.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.0"), LocaleLoader.getString("Fishing.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Fishing.Effect.2"), mcLocale.getString("Fishing.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.2"), LocaleLoader.getString("Fishing.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Fishing.Effect.4"), mcLocale.getString("Fishing.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Fishing.Ability.Rank", new Object[] { Fishing.getFishingLootTier(PP) })); player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", new Object[] { Fishing.getFishingLootTier(PP) }));
player.sendMessage(mcLocale.getString("Fishing.Ability.Info")); player.sendMessage(LocaleLoader.getString("Fishing.Ability.Info"));
//TODO: Do we really need to display this twice? Not like there are any associated stats. //TODO: Do we really need to display this twice? Not like there are any associated stats.
if (PP.getSkillLevel(SkillType.FISHING) < 150) { if (PP.getSkillLevel(SkillType.FISHING) < 150) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Fishing.Ability.Locked.0") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Fishing.Ability.Locked.0") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Fishing.Ability.Shake")); player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake"));
} }
Page.grabGuidePageForSkill(SkillType.FISHING, player, args); Page.grabGuidePageForSkill(SkillType.FISHING, player, args);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class HerbalismCommand implements CommandExecutor { public class HerbalismCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -36,23 +36,23 @@ public class HerbalismCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.HERBALISM); skillValue = (float) PP.getSkillLevel(SkillType.HERBALISM);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Herbalism.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Herbalism.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Herbalism") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Herbalism") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Herbalism.Effect.0"), mcLocale.getString("Herbalism.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Herbalism.Effect.2"), mcLocale.getString("Herbalism.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Herbalism.Effect.4"), mcLocale.getString("Herbalism.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Herbalism.Effect.6"), mcLocale.getString("Herbalism.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Herbalism.Effect.8"), mcLocale.getString("Herbalism.Effect.9") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength })); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
player.sendMessage(mcLocale.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance })); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
player.sendMessage(mcLocale.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage })); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
player.sendMessage(mcLocale.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } )); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
player.sendMessage(mcLocale.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance })); player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args); Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class MiningCommand implements CommandExecutor { public class MiningCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -36,40 +36,40 @@ public class MiningCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.MINING); skillValue = (float) PP.getSkillLevel(SkillType.MINING);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Mining.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Mining.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Mining") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Mining") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Mining.Effect.0"), mcLocale.getString("Mining.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Mining.Effect.2"), mcLocale.getString("Mining.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Mining.Effect.4"), mcLocale.getString("Mining.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Mining.Effect.6"), mcLocale.getString("Mining.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Mining.Effect.8"), mcLocale.getString("Mining.Effect.9") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance })); player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
player.sendMessage(mcLocale.getString("Mining.Ability.Length", new Object[] { superBreakerLength })); player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
if (PP.getSkillLevel(SkillType.MINING) < 125) { if (PP.getSkillLevel(SkillType.MINING) < 125) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Mining.Ability.Locked.0") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, mcLocale.getString("Mining.Blast.Effect." + (blastMiningRank - 1)) })); player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (blastMiningRank - 1)) }));
} }
if (PP.getSkillLevel(SkillType.MINING) < 250) { if (PP.getSkillLevel(SkillType.MINING) < 250) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Mining.Ability.Locked.1") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1") }));
} }
else { else {
player.sendMessage(mcLocale.getString("m.MiningBiggerBombs", new Object[] { blastRadiusIncrease })); player.sendMessage(LocaleLoader.getString("m.MiningBiggerBombs", new Object[] { blastRadiusIncrease }));
} }
if (PP.getSkillLevel(SkillType.MINING) < 500) { if (PP.getSkillLevel(SkillType.MINING) < 500) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Mining.Ability.Locked.2") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2") }));
} }
else { else {
player.sendMessage(mcLocale.getString("m.MiningDemolitionsExpertDamageDecrease", new Object[] { blastDamageDecrease })); player.sendMessage(LocaleLoader.getString("m.MiningDemolitionsExpertDamageDecrease", new Object[] { blastDamageDecrease }));
} }
Page.grabGuidePageForSkill(SkillType.MINING, player, args); Page.grabGuidePageForSkill(SkillType.MINING, player, args);

View File

@ -5,14 +5,14 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Repair; import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class RepairCommand implements CommandExecutor { public class RepairCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -37,23 +37,23 @@ public class RepairCommand implements CommandExecutor {
int arcaneForgingRank = Repair.getArcaneForgingRank(PP); int arcaneForgingRank = Repair.getArcaneForgingRank(PP);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Repair.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Repair.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Repair") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Repair") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.0"), mcLocale.getString("Repair.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.0"), LocaleLoader.getString("Repair.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.2"), mcLocale.getString("Repair.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.2"), LocaleLoader.getString("Repair.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.4"), mcLocale.getString("Repair.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.4"), LocaleLoader.getString("Repair.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.getInstance().getRepairDiamondLevelRequirement() }), mcLocale.getString("Repair.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.6", new Object[] { Config.getInstance().getRepairDiamondLevelRequirement() }), LocaleLoader.getString("Repair.Effect.7") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.8"), mcLocale.getString("Repair.Effect.9") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Repair.Skills.Mastery", new Object[] { repairMasteryBonus })); player.sendMessage(LocaleLoader.getString("Repair.Skills.Mastery", new Object[] { repairMasteryBonus }));
player.sendMessage(mcLocale.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance })); player.sendMessage(LocaleLoader.getString("Repair.Skills.Super.Chance", new Object[] { superRepairChance }));
player.sendMessage(mcLocale.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank })); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", new Object[] { arcaneForgingRank }));
player.sendMessage(mcLocale.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) })); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", new Object[] { Repair.getEnchantChance(arcaneForgingRank) }));
player.sendMessage(mcLocale.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) })); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", new Object[] { Repair.getDowngradeChance(arcaneForgingRank) }));
Page.grabGuidePageForSkill(SkillType.REPAIR, player, args); Page.grabGuidePageForSkill(SkillType.REPAIR, player, args);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class SwordsCommand implements CommandExecutor { public class SwordsCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -35,22 +35,22 @@ public class SwordsCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.SWORDS); skillValue = (float) PP.getSkillLevel(SkillType.SWORDS);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Swords.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Swords.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Swords") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Swords") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Swords.Effect.0"), mcLocale.getString("Swords.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Swords.Effect.2"), mcLocale.getString("Swords.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Swords.Effect.4"), mcLocale.getString("Swords.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Swords.Effect.6"), mcLocale.getString("Swords.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance })); player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
player.sendMessage(mcLocale.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength })); player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
player.sendMessage(mcLocale.getString("Swords.Combat.Bleed.Note")); player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
player.sendMessage(mcLocale.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance })); player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
player.sendMessage(mcLocale.getString("Swords.SS.Length", new Object[] { serratedStrikesLength })); player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args); Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);

View File

@ -5,13 +5,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class TamingCommand implements CommandExecutor { public class TamingCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -33,60 +33,60 @@ public class TamingCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.TAMING); skillValue = (float) PP.getSkillLevel(SkillType.TAMING);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Taming.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Taming.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Taming") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Taming") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.0"), mcLocale.getString("Taming.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.2"), mcLocale.getString("Taming.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.4"), mcLocale.getString("Taming.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.6"), mcLocale.getString("Taming.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.8"), mcLocale.getString("Taming.Effect.9") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.10"), mcLocale.getString("Taming.Effect.11") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.12"), mcLocale.getString("Taming.Effect.13") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.16"), mcLocale.getString("Taming.Effect.17") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() })); player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() }));
player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() })); player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
if (PP.getSkillLevel(SkillType.TAMING) < 100) { if (PP.getSkillLevel(SkillType.TAMING) < 100) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Taming.Ability.Locked.0") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Taming.Ability.Bonus.0"), mcLocale.getString("Taming.Ability.Bonus.1") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 250) { if (PP.getSkillLevel(SkillType.TAMING) < 250) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Taming.Ability.Locked.1") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Taming.Ability.Bonus.2"), mcLocale.getString("Taming.Ability.Bonus.3") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 500) { if (PP.getSkillLevel(SkillType.TAMING) < 500) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Taming.Ability.Locked.2") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Taming.Ability.Bonus.4"), mcLocale.getString("Taming.Ability.Bonus.5") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 750) { if (PP.getSkillLevel(SkillType.TAMING) < 750) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Taming.Ability.Locked.3") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Taming.Ability.Bonus.6"), mcLocale.getString("Taming.Ability.Bonus.7") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 50) { if (PP.getSkillLevel(SkillType.TAMING) < 50) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Taming.Ability.Locked.4") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Taming.Ability.Bonus.8"), mcLocale.getString("Taming.Ability.Bonus.9 ") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9 ") }));
} }
player.sendMessage(mcLocale.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance })); player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
Page.grabGuidePageForSkill(SkillType.TAMING, player, args); Page.grabGuidePageForSkill(SkillType.TAMING, player, args);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class UnarmedCommand implements CommandExecutor { public class UnarmedCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -35,21 +35,21 @@ public class UnarmedCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.UNARMED); skillValue = (float) PP.getSkillLevel(SkillType.UNARMED);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Unarmed.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Unarmed.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Unarmed") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Unarmed") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Unarmed.Effect.0"), mcLocale.getString("Unarmed.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Unarmed.Effect.2"), mcLocale.getString("Unarmed.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Unarmed.Effect.4"), mcLocale.getString("Unarmed.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Unarmed.Effect.6"), mcLocale.getString("Unarmed.Effect.7") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Unarmed.Effect.6"), LocaleLoader.getString("Unarmed.Effect.7") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Unarmed.Ability.Bonus.0"), mcLocale.getString("Unarmed.Ability.Bonus.1", new Object[] {ironArmBonus}) })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", new Object[] {ironArmBonus}) }));
player.sendMessage(mcLocale.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance })); player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", new Object[] { deflectChance }));
player.sendMessage(mcLocale.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance })); player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", new Object[] { disarmChance }));
player.sendMessage(mcLocale.getString("Unarmed.Ability.Berserk.Length", new Object[] { berserkLength })); player.sendMessage(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", new Object[] { berserkLength }));
Page.grabGuidePageForSkill(SkillType.UNARMED, player, args); Page.grabGuidePageForSkill(SkillType.UNARMED, player, args);

View File

@ -5,12 +5,12 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.commands.CommandHelper; 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.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Users;
public class WoodcuttingCommand implements CommandExecutor { public class WoodcuttingCommand implements CommandExecutor {
private float skillValue; private float skillValue;
@ -33,26 +33,26 @@ public class WoodcuttingCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.UNARMED); skillValue = (float) PP.getSkillLevel(SkillType.UNARMED);
dataCalculations(skillValue); dataCalculations(skillValue);
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("WoodCutting.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("WoodCutting.SkillName") }));
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.WoodCutting") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.WoodCutting") }));
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Woodcutting.Effect.0"), mcLocale.getString("Woodcutting.Effect.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.0"), LocaleLoader.getString("Woodcutting.Effect.1") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Woodcutting.Effect.2"), mcLocale.getString("Woodcutting.Effect.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.2"), LocaleLoader.getString("Woodcutting.Effect.3") }));
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Woodcutting.Effect.4"), mcLocale.getString("Woodcutting.Effect.5") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5") }));
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100) { if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100) {
player.sendMessage(mcLocale.getString("Ability.Generic.Template.Lock", new Object[] { mcLocale.getString("Woodcutting.Ability.Locked.0") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Woodcutting.Ability.Locked.0") }));
} }
else { else {
player.sendMessage(mcLocale.getString("Ability.Generic.Template", new Object[] { mcLocale.getString("Woodcutting.Ability.0"), mcLocale.getString("Woodcutting.Ability.1") })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1") }));
} }
player.sendMessage(mcLocale.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance })); player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", new Object[] { doubleDropChance }));
player.sendMessage(mcLocale.getString("Woodcutting.Ability.Length", new Object[] { treeFellerLength })); player.sendMessage(LocaleLoader.getString("Woodcutting.Ability.Length", new Object[] { treeFellerLength }));
Page.grabGuidePageForSkill(SkillType.WOODCUTTING, player, args); Page.grabGuidePageForSkill(SkillType.WOODCUTTING, player, args);

View File

@ -6,15 +6,15 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class MchudCommand implements CommandExecutor { public class MchudCommand implements CommandExecutor {
private final mcMMO plugin; private final mcMMO plugin;
@ -33,7 +33,7 @@ public class MchudCommand implements CommandExecutor {
} }
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled()) { if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled()) {
sender.sendMessage(mcLocale.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }

View File

@ -6,16 +6,16 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class XplockCommand implements CommandExecutor { public class XplockCommand implements CommandExecutor {
@Override @Override
@ -27,7 +27,7 @@ public class XplockCommand implements CommandExecutor {
} }
if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) { if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(mcLocale.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }
@ -38,7 +38,7 @@ public class XplockCommand implements CommandExecutor {
case 0: case 0:
if (PP.getXpBarLocked()) { if (PP.getXpBarLocked()) {
PP.toggleXpBarLocked(); PP.toggleXpBarLocked();
player.sendMessage(mcLocale.getString("Commands.xplock.unlocked")); player.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
return true; return true;
} }
@ -47,27 +47,27 @@ public class XplockCommand implements CommandExecutor {
if (lastGained != null) { if (lastGained != null) {
PP.toggleXpBarLocked(); PP.toggleXpBarLocked();
PP.setSkillLock(lastGained); PP.setSkillLock(lastGained);
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(lastGained.toString()) })); player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(lastGained.toString()) }));
return true; return true;
} }
case 1: case 1:
if (Skills.isSkill(args[0])) { if (Skills.isSkill(args[0])) {
if (mcPermissions.getInstance().permission(player, "mcmmo.skills." + args[0].toLowerCase())) { if (Permissions.getInstance().permission(player, "mcmmo.skills." + args[0].toLowerCase())) {
PP.setXpBarLocked(true); PP.setXpBarLocked(true);
PP.setSkillLock(Skills.getSkillType(args[0])); PP.setSkillLock(Skills.getSkillType(args[0]));
SpoutStuff.updateXpBar(player); SpoutStuff.updateXpBar(player);
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(args[0]) })); player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(args[0]) }));
return true; return true;
} }
else { else {
player.sendMessage(mcLocale.getString("mcMMO.NoPermission")); player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
return true; return true;
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Commands.Skill.Invalid")); player.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true; return true;
} }

View File

@ -3,12 +3,12 @@ package com.gmail.nossr50.datatypes;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Excavation; import com.gmail.nossr50.skills.Excavation;
import com.gmail.nossr50.skills.Herbalism; import com.gmail.nossr50.skills.Herbalism;
import com.gmail.nossr50.skills.Mining; import com.gmail.nossr50.skills.Mining;
import com.gmail.nossr50.util.Permissions;
public enum AbilityType { public enum AbilityType {
BERSERK( BERSERK(
@ -104,23 +104,23 @@ public enum AbilityType {
} }
public String getAbilityOn() { public String getAbilityOn() {
return mcLocale.getString(this.abilityOn); return LocaleLoader.getString(this.abilityOn);
} }
public String getAbilityOff() { public String getAbilityOff() {
return mcLocale.getString(this.abilityOff); return LocaleLoader.getString(this.abilityOff);
} }
public String getAbilityPlayer(Player player) { public String getAbilityPlayer(Player player) {
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()}); return LocaleLoader.getString(this.abilityPlayer, new Object[] {player.getName()});
} }
public String getAbilityPlayerOff(Player player) { public String getAbilityPlayerOff(Player player) {
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()}); return LocaleLoader.getString(this.abilityPlayerOff, new Object[] {player.getName()});
} }
public String getAbilityRefresh() { public String getAbilityRefresh() {
return mcLocale.getString(this.abilityRefresh); return LocaleLoader.getString(this.abilityRefresh);
} }
/** /**
@ -132,31 +132,31 @@ public enum AbilityType {
public boolean getPermissions(Player player) { public boolean getPermissions(Player player) {
switch (this) { switch (this) {
case BERSERK: case BERSERK:
return mcPermissions.getInstance().berserk(player); return Permissions.getInstance().berserk(player);
case BLAST_MINING: case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player); return Permissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return mcPermissions.getInstance().gigaDrillBreaker(player); return Permissions.getInstance().gigaDrillBreaker(player);
case GREEN_TERRA: case GREEN_TERRA:
return mcPermissions.getInstance().greenTerra(player); return Permissions.getInstance().greenTerra(player);
case LEAF_BLOWER: case LEAF_BLOWER:
return mcPermissions.getInstance().leafBlower(player); return Permissions.getInstance().leafBlower(player);
case SERRATED_STRIKES: case SERRATED_STRIKES:
return mcPermissions.getInstance().serratedStrikes(player); return Permissions.getInstance().serratedStrikes(player);
case SKULL_SPLIITER: case SKULL_SPLIITER:
return mcPermissions.getInstance().skullSplitter(player); return Permissions.getInstance().skullSplitter(player);
case SUPER_BREAKER: case SUPER_BREAKER:
return mcPermissions.getInstance().superBreaker(player); return Permissions.getInstance().superBreaker(player);
case TREE_FELLER: case TREE_FELLER:
return mcPermissions.getInstance().treeFeller(player); return Permissions.getInstance().treeFeller(player);
default: default:
return false; return false;

View File

@ -9,11 +9,11 @@ import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget; import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class HUDmmo { public class HUDmmo {
private int center_x = 427 / 2; private int center_x = 427 / 2;
@ -286,7 +286,7 @@ public class HUDmmo {
return; return;
} }
((GenericTexture) xpicon).setUrl(m.getCapitalized(theType.toString()) + ".png"); ((GenericTexture) xpicon).setUrl(Misc.getCapitalized(theType.toString()) + ".png");
xpicon.setDirty(true); xpicon.setDirty(true);
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD))); ((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
@ -314,7 +314,7 @@ public class HUDmmo {
Color color = getRetroColor(theType); Color color = getRetroColor(theType);
xpicon.setUrl(m.getCapitalized(theType.toString()) + "_r.png"); xpicon.setUrl(Misc.getCapitalized(theType.toString()) + "_r.png");
xpfill.setBottomColor(color); xpfill.setBottomColor(color);
xpfill.setTopColor(color); xpfill.setTopColor(color);

View File

@ -13,8 +13,8 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent; import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.Users; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.m; import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
public class PlayerProfile { public class PlayerProfile {
@ -205,53 +205,53 @@ public class PlayerProfile {
if(!character[0].equals(playerName)){continue;} if(!character[0].equals(playerName)){continue;}
//Get Mining //Get Mining
if(character.length > 1 && m.isInt(character[1])) if(character.length > 1 && Misc.isInt(character[1]))
skills.put(SkillType.MINING, Integer.valueOf(character[1])); skills.put(SkillType.MINING, Integer.valueOf(character[1]));
//Party //Party
if(character.length > 3) if(character.length > 3)
party = character[3]; party = character[3];
//Mining XP //Mining XP
if(character.length > 4 && m.isInt(character[4])) if(character.length > 4 && Misc.isInt(character[4]))
skillsXp.put(SkillType.MINING, Integer.valueOf(character[4])); skillsXp.put(SkillType.MINING, Integer.valueOf(character[4]));
if(character.length > 5 && m.isInt(character[5])) if(character.length > 5 && Misc.isInt(character[5]))
skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[5])); skills.put(SkillType.WOODCUTTING, Integer.valueOf(character[5]));
if(character.length > 6 && m.isInt(character[6])) if(character.length > 6 && Misc.isInt(character[6]))
skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(character[6])); skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(character[6]));
if(character.length > 7 && m.isInt(character[7])) if(character.length > 7 && Misc.isInt(character[7]))
skills.put(SkillType.REPAIR, Integer.valueOf(character[7])); skills.put(SkillType.REPAIR, Integer.valueOf(character[7]));
if(character.length > 8 && m.isInt(character[8])) if(character.length > 8 && Misc.isInt(character[8]))
skills.put(SkillType.UNARMED, Integer.valueOf(character[8])); skills.put(SkillType.UNARMED, Integer.valueOf(character[8]));
if(character.length > 9 && m.isInt(character[9])) if(character.length > 9 && Misc.isInt(character[9]))
skills.put(SkillType.HERBALISM, Integer.valueOf(character[9])); skills.put(SkillType.HERBALISM, Integer.valueOf(character[9]));
if(character.length > 10 && m.isInt(character[10])) if(character.length > 10 && Misc.isInt(character[10]))
skills.put(SkillType.EXCAVATION, Integer.valueOf(character[10])); skills.put(SkillType.EXCAVATION, Integer.valueOf(character[10]));
if(character.length > 11 && m.isInt(character[11])) if(character.length > 11 && Misc.isInt(character[11]))
skills.put(SkillType.ARCHERY, Integer.valueOf(character[11])); skills.put(SkillType.ARCHERY, Integer.valueOf(character[11]));
if(character.length > 12 && m.isInt(character[12])) if(character.length > 12 && Misc.isInt(character[12]))
skills.put(SkillType.SWORDS, Integer.valueOf(character[12])); skills.put(SkillType.SWORDS, Integer.valueOf(character[12]));
if(character.length > 13 && m.isInt(character[13])) if(character.length > 13 && Misc.isInt(character[13]))
skills.put(SkillType.AXES, Integer.valueOf(character[13])); skills.put(SkillType.AXES, Integer.valueOf(character[13]));
if(character.length > 14 && m.isInt(character[14])) if(character.length > 14 && Misc.isInt(character[14]))
skills.put(SkillType.ACROBATICS, Integer.valueOf(character[14])); skills.put(SkillType.ACROBATICS, Integer.valueOf(character[14]));
if(character.length > 15 && m.isInt(character[15])) if(character.length > 15 && Misc.isInt(character[15]))
skillsXp.put(SkillType.REPAIR, Integer.valueOf(character[15])); skillsXp.put(SkillType.REPAIR, Integer.valueOf(character[15]));
if(character.length > 16 && m.isInt(character[16])) if(character.length > 16 && Misc.isInt(character[16]))
skillsXp.put(SkillType.UNARMED, Integer.valueOf(character[16])); skillsXp.put(SkillType.UNARMED, Integer.valueOf(character[16]));
if(character.length > 17 && m.isInt(character[17])) if(character.length > 17 && Misc.isInt(character[17]))
skillsXp.put(SkillType.HERBALISM, Integer.valueOf(character[17])); skillsXp.put(SkillType.HERBALISM, Integer.valueOf(character[17]));
if(character.length > 18 && m.isInt(character[18])) if(character.length > 18 && Misc.isInt(character[18]))
skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(character[18])); skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(character[18]));
if(character.length > 19 && m.isInt(character[19])) if(character.length > 19 && Misc.isInt(character[19]))
skillsXp.put(SkillType.ARCHERY, Integer.valueOf(character[19])); skillsXp.put(SkillType.ARCHERY, Integer.valueOf(character[19]));
if(character.length > 20 && m.isInt(character[20])) if(character.length > 20 && Misc.isInt(character[20]))
skillsXp.put(SkillType.SWORDS, Integer.valueOf(character[20])); skillsXp.put(SkillType.SWORDS, Integer.valueOf(character[20]));
if(character.length > 21 && m.isInt(character[21])) if(character.length > 21 && Misc.isInt(character[21]))
skillsXp.put(SkillType.AXES, Integer.valueOf(character[21])); skillsXp.put(SkillType.AXES, Integer.valueOf(character[21]));
if(character.length > 22 && m.isInt(character[22])) if(character.length > 22 && Misc.isInt(character[22]))
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(character[22])); skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(character[22]));
if(character.length > 24 && m.isInt(character[24])) if(character.length > 24 && Misc.isInt(character[24]))
skills.put(SkillType.TAMING, Integer.valueOf(character[24])); skills.put(SkillType.TAMING, Integer.valueOf(character[24]));
if(character.length > 25 && m.isInt(character[25])) if(character.length > 25 && Misc.isInt(character[25]))
skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25])); skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25]));
if(character.length > 26) if(character.length > 26)
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[26])); skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[26]));
@ -1176,7 +1176,7 @@ public class PlayerProfile {
String memberName = x.getName(); String memberName = x.getName();
if (!memberName.equals(playerName) && Party.getInstance().isPartyLeader(memberName, getParty())) { if (!memberName.equals(playerName) && Party.getInstance().isPartyLeader(memberName, getParty())) {
if (m.isNear(player.getLocation(), x.getLocation(), 25.0)) { if (Misc.isNear(player.getLocation(), x.getLocation(), 25.0)) {
PlayerProfile PartyLeader = Users.getProfile(x); PlayerProfile PartyLeader = Users.getProfile(x);
int leaderSkill = PartyLeader.getSkillLevel(skillType); int leaderSkill = PartyLeader.getSkillLevel(skillType);
int playerSkill = getSkillLevel(skillType); int playerSkill = getSkillLevel(skillType);

View File

@ -2,9 +2,9 @@ package com.gmail.nossr50.datatypes;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public enum SkillType { public enum SkillType {
ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()), ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()),
@ -75,40 +75,40 @@ public enum SkillType {
public boolean getPermissions(Player player) { public boolean getPermissions(Player player) {
switch (this) { switch (this) {
case ACROBATICS: case ACROBATICS:
return mcPermissions.getInstance().acrobatics(player); return Permissions.getInstance().acrobatics(player);
case ARCHERY: case ARCHERY:
return mcPermissions.getInstance().archery(player); return Permissions.getInstance().archery(player);
case AXES: case AXES:
return mcPermissions.getInstance().axes(player); return Permissions.getInstance().axes(player);
case EXCAVATION: case EXCAVATION:
return mcPermissions.getInstance().excavation(player); return Permissions.getInstance().excavation(player);
case FISHING: case FISHING:
return mcPermissions.getInstance().fishing(player); return Permissions.getInstance().fishing(player);
case HERBALISM: case HERBALISM:
return mcPermissions.getInstance().herbalism(player); return Permissions.getInstance().herbalism(player);
case MINING: case MINING:
return mcPermissions.getInstance().mining(player); return Permissions.getInstance().mining(player);
case REPAIR: case REPAIR:
return mcPermissions.getInstance().repair(player); return Permissions.getInstance().repair(player);
case SWORDS: case SWORDS:
return mcPermissions.getInstance().swords(player); return Permissions.getInstance().swords(player);
case TAMING: case TAMING:
return mcPermissions.getInstance().taming(player); return Permissions.getInstance().taming(player);
case UNARMED: case UNARMED:
return mcPermissions.getInstance().unarmed(player); return Permissions.getInstance().unarmed(player);
case WOODCUTTING: case WOODCUTTING:
return mcPermissions.getInstance().woodcutting(player); return Permissions.getInstance().woodcutting(player);
default: default:
return false; return false;

View File

@ -3,16 +3,16 @@ package com.gmail.nossr50.datatypes;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.ItemChecks; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.util.ItemChecks;
public enum ToolType { public enum ToolType {
AXE(mcLocale.getString("Axes.Ability.Lower"), mcLocale.getString("Axes.Ability.Ready")), AXE(LocaleLoader.getString("Axes.Ability.Lower"), LocaleLoader.getString("Axes.Ability.Ready")),
FISTS(mcLocale.getString("Unarmed.Ability.Lower"), mcLocale.getString("Unarmed.Ability.Ready")), FISTS(LocaleLoader.getString("Unarmed.Ability.Lower"), LocaleLoader.getString("Unarmed.Ability.Ready")),
HOE(mcLocale.getString("Herbalism.Ability.Lower"), mcLocale.getString("Herbalism.Ability.Ready")), HOE(LocaleLoader.getString("Herbalism.Ability.Lower"), LocaleLoader.getString("Herbalism.Ability.Ready")),
PICKAXE(mcLocale.getString("Mining.Ability.Lower"), mcLocale.getString("Mining.Ability.Ready")), PICKAXE(LocaleLoader.getString("Mining.Ability.Lower"), LocaleLoader.getString("Mining.Ability.Ready")),
SHOVEL(mcLocale.getString("Excavation.Ability.Lower"), mcLocale.getString("Excavation.Ability.Ready")), SHOVEL(LocaleLoader.getString("Excavation.Ability.Lower"), LocaleLoader.getString("Excavation.Ability.Ready")),
SWORD(mcLocale.getString("Swords.Ability.Lower"), mcLocale.getString("Swords.Ability.Ready")); SWORD(LocaleLoader.getString("Swords.Ability.Lower"), LocaleLoader.getString("Swords.Ability.Ready"));
private String lowerTool; private String lowerTool;
private String raiseTool; private String raiseTool;

View File

@ -2,11 +2,7 @@ package com.gmail.nossr50.listeners;
import java.util.List; import java.util.List;
import com.gmail.nossr50.BlockChecks;
import com.gmail.nossr50.ItemChecks;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -19,6 +15,10 @@ import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.WoodCutting; import com.gmail.nossr50.skills.WoodCutting;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
@ -145,7 +145,7 @@ public class BlockListener implements Listener {
*/ */
/* Green Terra */ /* Green Terra */
if (PP.getToolPreparationMode(ToolType.HOE) && mcPermissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) { if (PP.getToolPreparationMode(ToolType.HOE) && Permissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM); Skills.abilityCheck(player, SkillType.HERBALISM);
} }
@ -154,7 +154,7 @@ public class BlockListener implements Listener {
Herbalism.herbalismProcCheck(block, player, event, plugin); Herbalism.herbalismProcCheck(block, player, event, plugin);
} }
if (mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(mat)) { if (Permissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(mat)) {
Herbalism.herbalismProcCheck(block, player, event, plugin); Herbalism.herbalismProcCheck(block, player, event, plugin);
} }
@ -162,7 +162,7 @@ public class BlockListener implements Listener {
* MINING * MINING
*/ */
if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) { if (Permissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) {
if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) {
Mining.miningBlockCheck(player, block); Mining.miningBlockCheck(player, block);
} }
@ -175,7 +175,7 @@ public class BlockListener implements Listener {
* WOOD CUTTING * WOOD CUTTING
*/ */
if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) { if (Permissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) {
WoodCutting.woodcuttingBlockCheck(player, block); WoodCutting.woodcuttingBlockCheck(player, block);
} }
@ -184,7 +184,7 @@ public class BlockListener implements Listener {
} }
} }
if (PP.getAbilityMode(AbilityType.TREE_FELLER) && mcPermissions.getInstance().treeFeller(player)) { if (PP.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.getInstance().treeFeller(player)) {
WoodCutting.treeFeller(event); WoodCutting.treeFeller(event);
} }
@ -192,7 +192,7 @@ public class BlockListener implements Listener {
* EXCAVATION * EXCAVATION
*/ */
if (Excavation.canBeGigaDrillBroken(mat) && mcPermissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) { if (Excavation.canBeGigaDrillBroken(mat) && Permissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) {
if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) {
Excavation.excavationProcCheck(block, player); Excavation.excavationProcCheck(block, player);
} }
@ -229,7 +229,7 @@ public class BlockListener implements Listener {
if (PP.getToolPreparationMode(ToolType.HOE) && (Herbalism.canBeGreenTerra(mat) || Herbalism.makeMossy(mat))) { if (PP.getToolPreparationMode(ToolType.HOE) && (Herbalism.canBeGreenTerra(mat) || Herbalism.makeMossy(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM); Skills.abilityCheck(player, SkillType.HERBALISM);
} }
else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && mcPermissions.getInstance().treeFeller(player)) { //Why are we checking the permissions here? else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && Permissions.getInstance().treeFeller(player)) { //Why are we checking the permissions here?
Skills.abilityCheck(player, SkillType.WOODCUTTING); Skills.abilityCheck(player, SkillType.WOODCUTTING);
} }
else if (PP.getToolPreparationMode(ToolType.PICKAXE) && Mining.canBeSuperBroken(mat)) { else if (PP.getToolPreparationMode(ToolType.PICKAXE) && Mining.canBeSuperBroken(mat)) {
@ -251,7 +251,7 @@ public class BlockListener implements Listener {
/* /*
* ABILITY TRIGGER CHECKS * ABILITY TRIGGER CHECKS
*/ */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && mcPermissions.getInstance().greenTerra(player) && Herbalism.makeMossy(mat)) { if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Permissions.getInstance().greenTerra(player) && Herbalism.makeMossy(mat)) {
Herbalism.greenTerra(player, block); Herbalism.greenTerra(player, block);
} }
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) { else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {

View File

@ -22,23 +22,23 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
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.events.fake.FakeEntityDamageByEntityEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.mcBleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.skills.Acrobatics; import com.gmail.nossr50.skills.Acrobatics;
import com.gmail.nossr50.skills.Archery; import com.gmail.nossr50.skills.Archery;
import com.gmail.nossr50.skills.BlastMining; import com.gmail.nossr50.skills.BlastMining;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming; import com.gmail.nossr50.skills.Taming;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class EntityListener implements Listener { public class EntityListener implements Listener {
private final mcMMO plugin; private final mcMMO plugin;
@ -76,7 +76,7 @@ public class EntityListener implements Listener {
if (defender instanceof LivingEntity) { if (defender instanceof LivingEntity) {
LivingEntity livingDefender = (LivingEntity)defender; LivingEntity livingDefender = (LivingEntity)defender;
if (!m.isInvincible(livingDefender, event)) { if (!Misc.isInvincible(livingDefender, event)) {
Combat.combatChecks(event, plugin); Combat.combatChecks(event, plugin);
} }
} }
@ -109,11 +109,11 @@ public class EntityListener implements Listener {
return; return;
} }
if (!m.isInvincible(player, event)) { if (!Misc.isInvincible(player, event)) {
if (cause == DamageCause.FALL && mcPermissions.getInstance().acrobatics(player)) { if (cause == DamageCause.FALL && Permissions.getInstance().acrobatics(player)) {
Acrobatics.acrobaticsCheck(player, event); Acrobatics.acrobaticsCheck(player, event);
} }
else if (cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().demolitionsExpertise(player)) { else if (cause == DamageCause.BLOCK_EXPLOSION && Permissions.getInstance().demolitionsExpertise(player)) {
BlastMining.demolitionsExpertise(player, event); BlastMining.demolitionsExpertise(player, event);
} }
@ -126,7 +126,7 @@ public class EntityListener implements Listener {
case WOLF: case WOLF:
Wolf wolf = (Wolf) entity; Wolf wolf = (Wolf) entity;
if ((!m.isInvincible(wolf, event)) && wolf.isTamed() && (wolf.getOwner() instanceof Player)) { if ((!Misc.isInvincible(wolf, event)) && wolf.isTamed() && (wolf.getOwner() instanceof Player)) {
Taming.preventDamage(event); Taming.preventDamage(event);
} }
break; break;
@ -147,7 +147,7 @@ public class EntityListener implements Listener {
x.setFireTicks(0); x.setFireTicks(0);
/* Remove bleed track */ /* Remove bleed track */
mcBleedTimer.remove(x); BleedTimer.remove(x);
Archery.arrowRetrievalCheck(x, plugin); Archery.arrowRetrievalCheck(x, plugin);
@ -185,7 +185,7 @@ public class EntityListener implements Listener {
if (plugin.tntTracker.containsKey(id)) { if (plugin.tntTracker.containsKey(id)) {
Player player = plugin.tntTracker.get(id); Player player = plugin.tntTracker.get(id);
if (mcPermissions.getInstance().biggerBombs(player)) { if (Permissions.getInstance().biggerBombs(player)) {
BlastMining.biggerBombs(player, event); BlastMining.biggerBombs(player, event);
} }
} }
@ -292,7 +292,7 @@ public class EntityListener implements Listener {
public void onEntityTame(EntityTameEvent event) { public void onEntityTame(EntityTameEvent event) {
Player player = (Player) event.getOwner(); Player player = (Player) event.getOwner();
if (mcPermissions.getInstance().taming(player) && !event.getEntity().hasMetadata("mcmmoSummoned")) { if (Permissions.getInstance().taming(player) && !event.getEntity().hasMetadata("mcmmoSummoned")) {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
EntityType type = event.getEntityType(); EntityType type = event.getEntityType();
int xp = 0; int xp = 0;

View File

@ -24,13 +24,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.BlockChecks;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Item;
import com.gmail.nossr50.ItemChecks;
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.general.XprateCommand; import com.gmail.nossr50.commands.general.XprateCommand;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask; import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask;
@ -40,7 +34,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.BlastMining; import com.gmail.nossr50.skills.BlastMining;
import com.gmail.nossr50.skills.Fishing; import com.gmail.nossr50.skills.Fishing;
@ -48,6 +42,12 @@ import com.gmail.nossr50.skills.Herbalism;
import com.gmail.nossr50.skills.Repair; import com.gmail.nossr50.skills.Repair;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming; import com.gmail.nossr50.skills.Taming;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Item;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
private final mcMMO plugin; private final mcMMO plugin;
@ -67,16 +67,16 @@ public class PlayerListener implements Listener {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if (PP.getGodMode()) { if (PP.getGodMode()) {
if (!mcPermissions.getInstance().mcgod(player)) { if (!Permissions.getInstance().mcgod(player)) {
PP.toggleGodMode(); PP.toggleGodMode();
player.sendMessage(mcLocale.getString("Commands.GodMode.Forbidden")); player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
} }
} }
if (PP.inParty()) { if (PP.inParty()) {
if (!mcPermissions.getInstance().party(player)) { if (!Permissions.getInstance().party(player)) {
PP.removeParty(); PP.removeParty();
player.sendMessage(mcLocale.getString("Party.Forbidden")); player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
} }
} }
} }
@ -90,7 +90,7 @@ public class PlayerListener implements Listener {
public void onPlayerFish(PlayerFishEvent event) { public void onPlayerFish(PlayerFishEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (mcPermissions.getInstance().fishing(player)) { if (Permissions.getInstance().fishing(player)) {
State state = event.getState(); State state = event.getState();
switch (state) { switch (state) {
@ -99,7 +99,7 @@ public class PlayerListener implements Listener {
break; break;
case CAUGHT_ENTITY: case CAUGHT_ENTITY:
if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && mcPermissions.getInstance().shakeMob(player)) { if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && Permissions.getInstance().shakeMob(player)) {
Fishing.shakeMob(event); Fishing.shakeMob(event);
} }
break; break;
@ -167,14 +167,14 @@ public class PlayerListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (mcPermissions.getInstance().motd(player) && Config.getInstance().getMOTDEnabled()) { if (Permissions.getInstance().motd(player) && Config.getInstance().getMOTDEnabled()) {
player.sendMessage(mcLocale.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()})); player.sendMessage(LocaleLoader.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()}));
player.sendMessage(mcLocale.getString("mcMMO.Wiki")); player.sendMessage(LocaleLoader.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
if (XprateCommand.xpevent) { if (XprateCommand.xpevent) {
player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier})); player.sendMessage(LocaleLoader.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier}));
} }
} }
@ -204,7 +204,7 @@ public class PlayerListener implements Listener {
case RIGHT_CLICK_BLOCK: case RIGHT_CLICK_BLOCK:
/* REPAIR CHECKS */ /* REPAIR CHECKS */
if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.getInstance().getRepairAnvilId() && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { if (Permissions.getInstance().repair(player) && block.getTypeId() == Config.getInstance().getRepairAnvilId() && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) {
Repair.repairCheck(player, is); Repair.repairCheck(player, is);
event.setCancelled(true); event.setCancelled(true);
player.updateInventory(); player.updateInventory();
@ -225,7 +225,7 @@ public class PlayerListener implements Listener {
} }
/* GREEN THUMB CHECK */ /* GREEN THUMB CHECK */
if (mcPermissions.getInstance().greenThumbBlocks(player) && Herbalism.makeMossy(mat) && is.getType().equals(Material.SEEDS)) { if (Permissions.getInstance().greenThumbBlocks(player) && Herbalism.makeMossy(mat) && is.getType().equals(Material.SEEDS)) {
Herbalism.greenThumbBlocks(is, player, block); Herbalism.greenThumbBlocks(is, player, block);
} }
@ -235,7 +235,7 @@ public class PlayerListener implements Listener {
} }
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) { if (Permissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) {
BlastMining.remoteDetonation(player, plugin); BlastMining.remoteDetonation(player, plugin);
} }
@ -258,7 +258,7 @@ public class PlayerListener implements Listener {
Item.itemchecks(player); Item.itemchecks(player);
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) { if (Permissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) {
BlastMining.remoteDetonation(player, plugin); BlastMining.remoteDetonation(player, plugin);
} }
@ -268,7 +268,7 @@ public class PlayerListener implements Listener {
case LEFT_CLICK_BLOCK: case LEFT_CLICK_BLOCK:
/* CALL OF THE WILD CHECKS */ /* CALL OF THE WILD CHECKS */
if (player.isSneaking() && mcPermissions.getInstance().taming(player)) { if (player.isSneaking() && Permissions.getInstance().taming(player)) {
if (is.getType().equals(Material.RAW_FISH)) { if (is.getType().equals(Material.RAW_FISH)) {
Taming.animalSummon(EntityType.OCELOT, player, plugin); Taming.animalSummon(EntityType.OCELOT, player, plugin);
} }
@ -334,7 +334,7 @@ public class PlayerListener implements Listener {
event.setMessage(chatEvent.getMessage()); event.setMessage(chatEvent.getMessage());
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
if (x.isOp() || mcPermissions.getInstance().adminChat(x)) { if (x.isOp() || Permissions.getInstance().adminChat(x)) {
intendedRecipients.add(x); intendedRecipients.add(x);
} }
} }

View File

@ -6,10 +6,10 @@ import org.getspout.spoutapi.event.input.KeyPressedEvent;
import org.getspout.spoutapi.gui.ScreenType; import org.getspout.spoutapi.gui.ScreenType;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutInputListener implements Listener { public class SpoutInputListener implements Listener {
private mcMMO plugin; private mcMMO plugin;

View File

@ -6,12 +6,12 @@ import org.bukkit.event.Listener;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent; import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutListener implements Listener { public class SpoutListener implements Listener {
//Why do we have this here? We never use it... //Why do we have this here? We never use it...

View File

@ -6,7 +6,6 @@ import org.getspout.spoutapi.event.screen.ButtonClickEvent;
import org.getspout.spoutapi.event.screen.ScreenCloseEvent; import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
@ -16,6 +15,7 @@ import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle; import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Users;
public class SpoutScreenListener implements Listener { public class SpoutScreenListener implements Listener {
//Why do we have this here? We never use it... //Why do we have this here? We never use it...

View File

@ -1,81 +1,81 @@
package com.gmail.nossr50.locale; package com.gmail.nossr50.locale;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
public class mcLocale { public class LocaleLoader {
private static final String BUNDLE_NAME = "com.gmail.nossr50.locale.locale"; private static final String BUNDLE_NAME = "com.gmail.nossr50.locale.locale";
private static ResourceBundle RESOURCE_BUNDLE = null; private static ResourceBundle RESOURCE_BUNDLE = null;
public static String getString(String key) { public static String getString(String key) {
return getString(key, null); return getString(key, null);
} }
/** /**
* Gets the appropriate string from the Locale files. * Gets the appropriate string from the Locale files.
* *
* @param key The key to look up the string with * @param key The key to look up the string with
* @param messageArguments Any arguments to be added to the string * @param messageArguments Any arguments to be added to the string
* @return The properly formatted locale string * @return The properly formatted locale string
*/ */
public static String getString(String key, Object[] messageArguments) { public static String getString(String key, Object[] messageArguments) {
try { try {
if (RESOURCE_BUNDLE == null) { if (RESOURCE_BUNDLE == null) {
Locale.setDefault(new Locale("en", "US")); Locale.setDefault(new Locale("en", "US"));
Locale locale = null; Locale locale = null;
String[] myLocale = Config.getInstance().getLocale().split("[-_ ]"); String[] myLocale = Config.getInstance().getLocale().split("[-_ ]");
if (myLocale.length == 1) { if (myLocale.length == 1) {
locale = new Locale(myLocale[0]); locale = new Locale(myLocale[0]);
} }
else if (myLocale.length >= 2) { else if (myLocale.length >= 2) {
locale = new Locale(myLocale[0], myLocale[1]); locale = new Locale(myLocale[0], myLocale[1]);
} }
RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, locale); RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, locale);
} }
String output = RESOURCE_BUNDLE.getString(key); String output = RESOURCE_BUNDLE.getString(key);
if (messageArguments != null) { if (messageArguments != null) {
MessageFormat formatter = new MessageFormat(""); MessageFormat formatter = new MessageFormat("");
formatter.applyPattern(output); formatter.applyPattern(output);
output = formatter.format(messageArguments); output = formatter.format(messageArguments);
} }
output = addColors(output); output = addColors(output);
return output; return output;
} }
catch (MissingResourceException e) { catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} }
} }
private static String addColors(String input) { private static String addColors(String input) {
input = input.replaceAll("\\Q[[BLACK]]\\E", ChatColor.BLACK.toString()); input = input.replaceAll("\\Q[[BLACK]]\\E", ChatColor.BLACK.toString());
input = input.replaceAll("\\Q[[DARK_BLUE]]\\E", ChatColor.DARK_BLUE.toString()); input = input.replaceAll("\\Q[[DARK_BLUE]]\\E", ChatColor.DARK_BLUE.toString());
input = input.replaceAll("\\Q[[DARK_GREEN]]\\E", ChatColor.DARK_GREEN.toString()); input = input.replaceAll("\\Q[[DARK_GREEN]]\\E", ChatColor.DARK_GREEN.toString());
input = input.replaceAll("\\Q[[DARK_AQUA]]\\E", ChatColor.DARK_AQUA.toString()); input = input.replaceAll("\\Q[[DARK_AQUA]]\\E", ChatColor.DARK_AQUA.toString());
input = input.replaceAll("\\Q[[DARK_RED]]\\E", ChatColor.DARK_RED.toString()); input = input.replaceAll("\\Q[[DARK_RED]]\\E", ChatColor.DARK_RED.toString());
input = input.replaceAll("\\Q[[DARK_PURPLE]]\\E", ChatColor.DARK_PURPLE.toString()); input = input.replaceAll("\\Q[[DARK_PURPLE]]\\E", ChatColor.DARK_PURPLE.toString());
input = input.replaceAll("\\Q[[GOLD]]\\E", ChatColor.GOLD.toString()); input = input.replaceAll("\\Q[[GOLD]]\\E", ChatColor.GOLD.toString());
input = input.replaceAll("\\Q[[GRAY]]\\E", ChatColor.GRAY.toString()); input = input.replaceAll("\\Q[[GRAY]]\\E", ChatColor.GRAY.toString());
input = input.replaceAll("\\Q[[DARK_GRAY]]\\E", ChatColor.DARK_GRAY.toString()); input = input.replaceAll("\\Q[[DARK_GRAY]]\\E", ChatColor.DARK_GRAY.toString());
input = input.replaceAll("\\Q[[BLUE]]\\E", ChatColor.BLUE.toString()); input = input.replaceAll("\\Q[[BLUE]]\\E", ChatColor.BLUE.toString());
input = input.replaceAll("\\Q[[GREEN]]\\E", ChatColor.GREEN.toString()); input = input.replaceAll("\\Q[[GREEN]]\\E", ChatColor.GREEN.toString());
input = input.replaceAll("\\Q[[AQUA]]\\E", ChatColor.AQUA.toString()); input = input.replaceAll("\\Q[[AQUA]]\\E", ChatColor.AQUA.toString());
input = input.replaceAll("\\Q[[RED]]\\E", ChatColor.RED.toString()); input = input.replaceAll("\\Q[[RED]]\\E", ChatColor.RED.toString());
input = input.replaceAll("\\Q[[LIGHT_PURPLE]]\\E", ChatColor.LIGHT_PURPLE.toString()); input = input.replaceAll("\\Q[[LIGHT_PURPLE]]\\E", ChatColor.LIGHT_PURPLE.toString());
input = input.replaceAll("\\Q[[YELLOW]]\\E", ChatColor.YELLOW.toString()); input = input.replaceAll("\\Q[[YELLOW]]\\E", ChatColor.YELLOW.toString());
input = input.replaceAll("\\Q[[WHITE]]\\E", ChatColor.WHITE.toString()); input = input.replaceAll("\\Q[[WHITE]]\\E", ChatColor.WHITE.toString());
return input; return input;
} }
} }

View File

@ -8,10 +8,14 @@ import com.gmail.nossr50.commands.party.*;
import com.gmail.nossr50.commands.general.*; import com.gmail.nossr50.commands.general.*;
import com.gmail.nossr50.config.*; import com.gmail.nossr50.config.*;
import com.gmail.nossr50.runnables.*; import com.gmail.nossr50.runnables.*;
import com.gmail.nossr50.util.Database;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Metrics;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.listeners.BlockListener; import com.gmail.nossr50.listeners.BlockListener;
import com.gmail.nossr50.listeners.EntityListener; import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.PlayerListener; import com.gmail.nossr50.listeners.PlayerListener;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -106,11 +110,11 @@ public class mcMMO extends JavaPlugin {
//Schedule Spout Activation 1 second after start-up //Schedule Spout Activation 1 second after start-up
scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20); scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
//Periodic save timer (Saves every 10 minutes) //Periodic save timer (Saves every 10 minutes)
scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, Config.getInstance().getSaveInterval() * 1200); scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(this), 0, Config.getInstance().getSaveInterval() * 1200);
//Regen & Cooldown timer (Runs every second) //Regen & Cooldown timer (Runs every second)
scheduler.scheduleSyncRepeatingTask(this, new mcTimer(this), 0, 20); scheduler.scheduleSyncRepeatingTask(this, new SkillMonitor(this), 0, 20);
//Bleed timer (Runs every two seconds) //Bleed timer (Runs every two seconds)
scheduler.scheduleSyncRepeatingTask(this, new mcBleedTimer(this), 0, 40); scheduler.scheduleSyncRepeatingTask(this, new BleedTimer(this), 0, 40);
registerCommands(); registerCommands();
@ -183,18 +187,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("Acrobatics.SkillName").toLowerCase(), "acrobatics"); aliasMap.put(LocaleLoader.getString("Acrobatics.SkillName").toLowerCase(), "acrobatics");
aliasMap.put(mcLocale.getString("Archery.SkillName").toLowerCase(), "archery"); aliasMap.put(LocaleLoader.getString("Archery.SkillName").toLowerCase(), "archery");
aliasMap.put(mcLocale.getString("Axes.SkillName").toLowerCase(), "axes"); aliasMap.put(LocaleLoader.getString("Axes.SkillName").toLowerCase(), "axes");
aliasMap.put(mcLocale.getString("Excavation.SkillName").toLowerCase(), "excavation"); aliasMap.put(LocaleLoader.getString("Excavation.SkillName").toLowerCase(), "excavation");
aliasMap.put(mcLocale.getString("Fishing.SkillName").toLowerCase(), "fishing"); aliasMap.put(LocaleLoader.getString("Fishing.SkillName").toLowerCase(), "fishing");
aliasMap.put(mcLocale.getString("Herbalism.SkillName").toLowerCase(), "herbalism"); aliasMap.put(LocaleLoader.getString("Herbalism.SkillName").toLowerCase(), "herbalism");
aliasMap.put(mcLocale.getString("Mining.SkillName").toLowerCase(), "mining"); aliasMap.put(LocaleLoader.getString("Mining.SkillName").toLowerCase(), "mining");
aliasMap.put(mcLocale.getString("Repair.SkillName").toLowerCase(), "repair"); aliasMap.put(LocaleLoader.getString("Repair.SkillName").toLowerCase(), "repair");
aliasMap.put(mcLocale.getString("Swords.SkillName").toLowerCase(), "swords"); aliasMap.put(LocaleLoader.getString("Swords.SkillName").toLowerCase(), "swords");
aliasMap.put(mcLocale.getString("Taming.SkillName").toLowerCase(), "taming"); aliasMap.put(LocaleLoader.getString("Taming.SkillName").toLowerCase(), "taming");
aliasMap.put(mcLocale.getString("Unarmed.SkillName").toLowerCase(), "unarmed"); aliasMap.put(LocaleLoader.getString("Unarmed.SkillName").toLowerCase(), "unarmed");
aliasMap.put(mcLocale.getString("WoodCutting.SkillName").toLowerCase(), "woodcutting"); aliasMap.put(LocaleLoader.getString("WoodCutting.SkillName").toLowerCase(), "woodcutting");
//Register commands //Register commands
//Skills commands //Skills commands

View File

@ -16,10 +16,10 @@ import java.util.Map;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class Party { public class Party {
public static String pluginPath; public static String pluginPath;
@ -92,7 +92,7 @@ public class Party {
if (player != null) { if (player != null) {
for (Player p : getOnlineMembers(player)) { for (Player p : getOnlineMembers(player)) {
if (p.getName() != playerName) { if (p.getName() != playerName) {
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {playerName})); p.sendMessage(LocaleLoader.getString("Party.InformedOnJoin", new Object[] {playerName}));
} }
} }
} }
@ -226,7 +226,7 @@ public class Party {
if (player != null) { if (player != null) {
for (Player p : getOnlineMembers(player)) { for (Player p : getOnlineMembers(player)) {
if (p.getName() != playerName) { if (p.getName() != playerName) {
p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {playerName})); p.sendMessage(LocaleLoader.getString("Party.InformedOnQuit", new Object[] {playerName}));
} }
} }
} }
@ -323,10 +323,10 @@ public class Party {
informPartyMembers(player); informPartyMembers(player);
if (!invite) { if (!invite) {
player.sendMessage(mcLocale.getString("Commands.Party.Join", new Object[]{ newParty })); player.sendMessage(LocaleLoader.getString("Commands.Party.Join", new Object[]{ newParty }));
} }
else { else {
player.sendMessage(mcLocale.getString("Commands.Invite.Accepted", new Object[]{ PP.getParty() })); player.sendMessage(LocaleLoader.getString("Commands.Invite.Accepted", new Object[]{ PP.getParty() }));
} }
} }

View File

@ -5,13 +5,13 @@ import java.util.HashSet;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Users;
public class mcBleedTimer implements Runnable { public class BleedTimer implements Runnable {
private final mcMMO plugin; private final mcMMO plugin;
private static HashSet<LivingEntity> bleedList = new HashSet<LivingEntity>(); private static HashSet<LivingEntity> bleedList = new HashSet<LivingEntity>();
@ -20,7 +20,7 @@ public class mcBleedTimer implements Runnable {
private static boolean lock = false; private static boolean lock = false;
public mcBleedTimer(final mcMMO plugin) { public BleedTimer(final mcMMO plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@ -54,7 +54,7 @@ public class mcBleedTimer implements Runnable {
PP.decreaseBleedTicks(); PP.decreaseBleedTicks();
if (PP.getBleedTicks() == 0) { if (PP.getBleedTicks() == 0) {
player.sendMessage(mcLocale.getString("Swords.Combat.Bleeding.Stopped")); player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped"));
} }
} }
} }

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.runnables; package com.gmail.nossr50.runnables;
import com.gmail.nossr50.Users; import com.gmail.nossr50.util.Users;
public class RemoveProfileFromMemoryTask implements Runnable { public class RemoveProfileFromMemoryTask implements Runnable {
private String playerName = null; private String playerName = null;

View File

@ -3,9 +3,9 @@ package com.gmail.nossr50.runnables;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.Misc;
public class SQLConversionTask implements Runnable { public class SQLConversionTask implements Runnable {
private final mcMMO plugin; private final mcMMO plugin;
@ -179,34 +179,34 @@ public class SQLConversionTask implements Runnable {
mcMMO.database.write("UPDATE " mcMMO.database.write("UPDATE "
+ tablePrefix + tablePrefix
+ "skills SET " + "skills SET "
+ " taming = taming+" + m.getInt(taming) + " taming = taming+" + Misc.getInt(taming)
+ ", mining = mining+" + m.getInt(mining) + ", mining = mining+" + Misc.getInt(mining)
+ ", repair = repair+" + m.getInt(repair) + ", repair = repair+" + Misc.getInt(repair)
+ ", woodcutting = woodcutting+" + m.getInt(woodcutting) + ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
+ ", unarmed = unarmed+" + m.getInt(unarmed) + ", unarmed = unarmed+" + Misc.getInt(unarmed)
+ ", herbalism = herbalism+" + m.getInt(herbalism) + ", herbalism = herbalism+" + Misc.getInt(herbalism)
+ ", excavation = excavation+" + m.getInt(excavation) + ", excavation = excavation+" + Misc.getInt(excavation)
+ ", archery = archery+" + m.getInt(archery) + ", archery = archery+" + Misc.getInt(archery)
+ ", swords = swords+" + m.getInt(swords) + ", swords = swords+" + Misc.getInt(swords)
+ ", axes = axes+" + m.getInt(axes) + ", axes = axes+" + Misc.getInt(axes)
+ ", acrobatics = acrobatics+" + m.getInt(acrobatics) + ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
+ ", fishing = fishing+" + m.getInt(fishing) + ", fishing = fishing+" + Misc.getInt(fishing)
+ " WHERE user_id = " + id); + " WHERE user_id = " + id);
mcMMO.database.write("UPDATE " mcMMO.database.write("UPDATE "
+ tablePrefix + tablePrefix
+ "experience SET " + "experience SET "
+ " taming = " + m.getInt(tamingXP) + " taming = " + Misc.getInt(tamingXP)
+ ", mining = " + m.getInt(miningXP) + ", mining = " + Misc.getInt(miningXP)
+ ", repair = " + m.getInt(repairXP) + ", repair = " + Misc.getInt(repairXP)
+ ", woodcutting = " + m.getInt(woodCuttingXP) + ", woodcutting = " + Misc.getInt(woodCuttingXP)
+ ", unarmed = " + m.getInt(unarmedXP) + ", unarmed = " + Misc.getInt(unarmedXP)
+ ", herbalism = " + m.getInt(herbalismXP) + ", herbalism = " + Misc.getInt(herbalismXP)
+ ", excavation = " + m.getInt(excavationXP) + ", excavation = " + Misc.getInt(excavationXP)
+ ", archery = " + m.getInt(archeryXP) + ", archery = " + Misc.getInt(archeryXP)
+ ", swords = " + m.getInt(swordsXP) + ", swords = " + Misc.getInt(swordsXP)
+ ", axes = " + m.getInt(axesXP) + ", axes = " + Misc.getInt(axesXP)
+ ", acrobatics = " + m.getInt(acrobaticsXP) + ", acrobatics = " + Misc.getInt(acrobaticsXP)
+ ", fishing = " + m.getInt(fishingXP) + ", fishing = " + Misc.getInt(fishingXP)
+ " WHERE user_id = " + id); + " WHERE user_id = " + id);
} }
else { else {
@ -241,34 +241,34 @@ public class SQLConversionTask implements Runnable {
mcMMO.database.write("UPDATE " mcMMO.database.write("UPDATE "
+ tablePrefix + tablePrefix
+ "skills SET " + "skills SET "
+ " taming = taming+" + m.getInt(taming) + " taming = taming+" + Misc.getInt(taming)
+ ", mining = mining+" + m.getInt(mining) + ", mining = mining+" + Misc.getInt(mining)
+ ", repair = repair+" + m.getInt(repair) + ", repair = repair+" + Misc.getInt(repair)
+ ", woodcutting = woodcutting+" + m.getInt(woodcutting) + ", woodcutting = woodcutting+" + Misc.getInt(woodcutting)
+ ", unarmed = unarmed+" + m.getInt(unarmed) + ", unarmed = unarmed+" + Misc.getInt(unarmed)
+ ", herbalism = herbalism+" + m.getInt(herbalism) + ", herbalism = herbalism+" + Misc.getInt(herbalism)
+ ", excavation = excavation+" + m.getInt(excavation) + ", excavation = excavation+" + Misc.getInt(excavation)
+ ", archery = archery+" + m.getInt(archery) + ", archery = archery+" + Misc.getInt(archery)
+ ", swords = swords+" + m.getInt(swords) + ", swords = swords+" + Misc.getInt(swords)
+ ", axes = axes+" + m.getInt(axes) + ", axes = axes+" + Misc.getInt(axes)
+ ", acrobatics = acrobatics+" + m.getInt(acrobatics) + ", acrobatics = acrobatics+" + Misc.getInt(acrobatics)
+ ", fishing = fishing+" + m.getInt(fishing) + ", fishing = fishing+" + Misc.getInt(fishing)
+ " WHERE user_id = " + id); + " WHERE user_id = " + id);
mcMMO.database.write("UPDATE " mcMMO.database.write("UPDATE "
+ tablePrefix + tablePrefix
+ "experience SET " + "experience SET "
+ " taming = " + m.getInt(tamingXP) + " taming = " + Misc.getInt(tamingXP)
+ ", mining = " + m.getInt(miningXP) + ", mining = " + Misc.getInt(miningXP)
+ ", repair = " + m.getInt(repairXP) + ", repair = " + Misc.getInt(repairXP)
+ ", woodcutting = " + m.getInt(woodCuttingXP) + ", woodcutting = " + Misc.getInt(woodCuttingXP)
+ ", unarmed = " + m.getInt(unarmedXP) + ", unarmed = " + Misc.getInt(unarmedXP)
+ ", herbalism = " + m.getInt(herbalismXP) + ", herbalism = " + Misc.getInt(herbalismXP)
+ ", excavation = " + m.getInt(excavationXP) + ", excavation = " + Misc.getInt(excavationXP)
+ ", archery = " + m.getInt(archeryXP) + ", archery = " + Misc.getInt(archeryXP)
+ ", swords = " + m.getInt(swordsXP) + ", swords = " + Misc.getInt(swordsXP)
+ ", axes = " + m.getInt(axesXP) + ", axes = " + Misc.getInt(axesXP)
+ ", acrobatics = " + m.getInt(acrobaticsXP) + ", acrobatics = " + Misc.getInt(acrobaticsXP)
+ ", fishing = " + m.getInt(fishingXP) + ", fishing = " + Misc.getInt(fishingXP)
+ " WHERE user_id = " + id); + " WHERE user_id = " + id);
} }
} }

View File

@ -2,10 +2,10 @@ package com.gmail.nossr50.runnables;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Database;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.util.Database;
import com.gmail.nossr50.util.Users;
public class SQLReconnect implements Runnable { public class SQLReconnect implements Runnable {
private final mcMMO plugin; private final mcMMO plugin;

View File

@ -2,13 +2,13 @@ package com.gmail.nossr50.runnables;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Users;
public class mcSaveTimer implements Runnable { public class SaveTimer implements Runnable {
private final mcMMO plugin; private final mcMMO plugin;
public mcSaveTimer(final mcMMO plugin) { public SaveTimer(final mcMMO plugin) {
this.plugin = plugin; this.plugin = plugin;
} }

View File

@ -1,53 +1,46 @@
package com.gmail.nossr50.runnables; package com.gmail.nossr50.runnables;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.AbilityType; 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.skills.Skills;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.util.Users;
public class mcTimer implements Runnable { public class SkillMonitor implements Runnable {
private final mcMMO plugin; private final mcMMO plugin;
public mcTimer(final mcMMO plugin) { public SkillMonitor(final mcMMO plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@Override @Override
public void run() { public void run() {
long curTime = System.currentTimeMillis(); long curTime = System.currentTimeMillis();
for (Player player : plugin.getServer().getOnlinePlayers()) { for (Player player : plugin.getServer().getOnlinePlayers()) {
if (player == null) { //Is this even possible?
continue; PlayerProfile PP = Users.getProfile(player);
}
/*
PlayerProfile PP = Users.getProfile(player); * MONITOR SKILLS
*/
if (PP == null) { //Is this even possible? for (SkillType skill : SkillType.values()) {
continue; if (skill.getTool() != null && skill.getAbility() != null) {
} Skills.monitorSkill(player, PP, curTime, skill);
}
/* }
* MONITOR SKILLS
*/ /*
for (SkillType skill : SkillType.values()) { * COOLDOWN MONITORING
if (skill.getTool() != null && skill.getAbility() != null) { */
Skills.monitorSkill(player, PP, curTime, skill); for (AbilityType ability : AbilityType.values()) {
} if (ability.getCooldown() > 0 ) {
} Skills.watchCooldown(player, PP, curTime, ability);
}
/* }
* COOLDOWN MONITORING }
*/ }
for (AbilityType ability : AbilityType.values()) { }
if (ability.getCooldown() > 0 ) {
Skills.watchCooldown(player, PP, curTime, ability);
}
}
}
}
}

View File

@ -6,13 +6,13 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
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.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Acrobatics { public class Acrobatics {
@ -35,7 +35,7 @@ public class Acrobatics {
int damage = event.getDamage(); int damage = event.getDamage();
int health = player.getHealth(); int health = player.getHealth();
if (!mcPermissions.getInstance().gracefulRoll(player)) { if (!Permissions.getInstance().gracefulRoll(player)) {
gracefulRoll = false; gracefulRoll = false;
} }
@ -43,7 +43,7 @@ public class Acrobatics {
acrovar = acrovar * 2; acrovar = acrovar * 2;
} }
if ((acrovar > MAX_BONUS_LEVEL || random.nextInt(1000) <= acrovar) && mcPermissions.getInstance().roll(player)) { if ((acrovar > MAX_BONUS_LEVEL || random.nextInt(1000) <= acrovar) && Permissions.getInstance().roll(player)) {
int threshold = 7; int threshold = 7;
if (gracefulRoll) { if (gracefulRoll) {
@ -68,10 +68,10 @@ public class Acrobatics {
} }
if (gracefulRoll) { if (gracefulRoll) {
player.sendMessage(mcLocale.getString("Acrobatics.Ability.Proc")); player.sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
} }
else { else {
player.sendMessage(mcLocale.getString("Acrobatics.Roll.Text")); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
} }
} }
} }
@ -103,12 +103,12 @@ public class Acrobatics {
} }
} }
if (mcPermissions.getInstance().acrobatics(defender)) { if (Permissions.getInstance().acrobatics(defender)) {
int skillLevel = PPd.getSkillLevel(SkillType.ACROBATICS); int skillLevel = PPd.getSkillLevel(SkillType.ACROBATICS);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(4000) <= skillCheck && mcPermissions.getInstance().dodge(defender)) { if (random.nextInt(4000) <= skillCheck && Permissions.getInstance().dodge(defender)) {
defender.sendMessage(mcLocale.getString("Acrobatics.Combat.Proc")); defender.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) { if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) {
PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER); PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER);

View File

@ -8,14 +8,14 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
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.LocaleLoader;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Archery { public class Archery {
@ -52,7 +52,7 @@ public class Archery {
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY); int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
Location loc = defender.getLocation(); Location loc = defender.getLocation();
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(10) > 5) { if (random.nextInt(10) > 5) {
loc.setPitch(90); loc.setPitch(90);
@ -61,11 +61,11 @@ public class Archery {
loc.setPitch(-90); loc.setPitch(-90);
} }
if (random.nextInt(2000) <= skillCheck && mcPermissions.getInstance().daze(attacker)) { if (random.nextInt(2000) <= skillCheck && Permissions.getInstance().daze(attacker)) {
defender.teleport(loc); defender.teleport(loc);
Combat.dealDamage(defender, 4); Combat.dealDamage(defender, 4);
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
} }
} }
@ -77,7 +77,7 @@ public class Archery {
*/ */
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) { public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) {
if (plugin.arrowTracker.containsKey(entity)) { if (plugin.arrowTracker.containsKey(entity)) {
m.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.arrowTracker.get(entity)); Misc.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.arrowTracker.get(entity));
} }
plugin.arrowTracker.remove(entity); plugin.arrowTracker.remove(entity);

View File

@ -11,12 +11,12 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
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.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class Axes { public class Axes {
@ -72,7 +72,7 @@ public class Axes {
PlayerProfile PPa = Users.getProfile(attacker); PlayerProfile PPa = Users.getProfile(attacker);
int skillLevel = PPa.getSkillLevel(SkillType.AXES); int skillLevel = PPa.getSkillLevel(SkillType.AXES);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(2000) <= skillCheck && !entity.isDead()){ if (random.nextInt(2000) <= skillCheck && !entity.isDead()){
int damage = event.getDamage(); int damage = event.getDamage();
@ -80,12 +80,12 @@ public class Axes {
if (entity instanceof Player){ if (entity instanceof Player){
event.setDamage((int) (damage * PVP_MODIFIER)); event.setDamage((int) (damage * PVP_MODIFIER));
Player player = (Player) entity; Player player = (Player) entity;
player.sendMessage(mcLocale.getString("Axes.Combat.CritStruck")); player.sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
} }
else { else {
event.setDamage(damage * PVE_MODIFIER); event.setDamage(damage * PVE_MODIFIER);
} }
attacker.sendMessage(mcLocale.getString("Axes.Combat.CriticalHit")); attacker.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
} }
} }
@ -138,7 +138,7 @@ public class Axes {
if (random.nextInt(100) <= GREATER_IMPACT_CHANCE) { if (random.nextInt(100) <= GREATER_IMPACT_CHANCE) {
event.setDamage(event.getDamage() + 2); event.setDamage(event.getDamage() + 2);
target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER)); target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER));
attacker.sendMessage(mcLocale.getString("Axes.Combat.GI.Proc")); attacker.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
} }
} }

View File

@ -15,14 +15,14 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import com.gmail.nossr50.BlockChecks;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.AbilityType;
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.LocaleLoader;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class BlastMining { public class BlastMining {
@ -256,24 +256,24 @@ public class BlastMining {
Block block = player.getTargetBlock(transparent, BLOCKS_AWAY); Block block = player.getTargetBlock(transparent, BLOCKS_AWAY);
if (block.getType().equals(Material.TNT) && m.blockBreakSimulate(block, player, true) && PP.getSkillLevel(SkillType.MINING) >= 125) { if (block.getType().equals(Material.TNT) && Misc.blockBreakSimulate(block, player, true) && PP.getSkillLevel(SkillType.MINING) >= 125) {
final double MAX_DISTANCE_AWAY = 10.0; final double MAX_DISTANCE_AWAY = 10.0;
AbilityType ability = AbilityType.BLAST_MINING; AbilityType ability = AbilityType.BLAST_MINING;
/* Check Cooldown */ /* Check Cooldown */
if(!Skills.cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) { if(!Skills.cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
return; return;
} }
/* Send message to nearby players */ /* Send message to nearby players */
for(Player y : player.getWorld().getPlayers()) { for(Player y : player.getWorld().getPlayers()) {
if(y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) { if(y != player && Misc.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
y.sendMessage(ability.getAbilityPlayer(player)); y.sendMessage(ability.getAbilityPlayer(player));
} }
} }
player.sendMessage(mcLocale.getString("Mining.Blast.Boom")); player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
/* Create the TNT entity */ /* Create the TNT entity */
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);

View File

@ -11,10 +11,10 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.Users; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.m; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.LoadTreasures; import com.gmail.nossr50.config.LoadTreasures;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -68,7 +68,7 @@ public class Excavation {
int xp = Config.getInstance().getExcavationBaseXP(); int xp = Config.getInstance().getExcavationBaseXP();
if (mcPermissions.getInstance().excavationTreasures(player)) { if (Permissions.getInstance().excavationTreasures(player)) {
switch (type) { switch (type) {
case DIRT: case DIRT:
treasures = LoadTreasures.excavationFromDirt; treasures = LoadTreasures.excavationFromDirt;
@ -114,7 +114,7 @@ public class Excavation {
//Drop items //Drop items
for (ItemStack x : is) { for (ItemStack x : is) {
if (x != null) { if (x != null) {
m.mcDropItem(loc, x); Misc.mcDropItem(loc, x);
} }
} }
} }

View File

@ -17,16 +17,16 @@ import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Wool; import org.bukkit.material.Wool;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.ItemChecks;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.LoadTreasures; import com.gmail.nossr50.config.LoadTreasures;
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.datatypes.treasure.FishingTreasure; import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class Fishing { public class Fishing {
@ -136,7 +136,7 @@ public class Fishing {
boolean enchanted = false; boolean enchanted = false;
ItemStack fishingResults = theCatch.getItemStack(); ItemStack fishingResults = theCatch.getItemStack();
player.sendMessage(mcLocale.getString("Fishing.ItemFound")); player.sendMessage(LocaleLoader.getString("Fishing.ItemFound"));
if (ItemChecks.isArmor(fishingResults) || ItemChecks.isTool(fishingResults)) { if (ItemChecks.isArmor(fishingResults) || ItemChecks.isTool(fishingResults)) {
if (random.nextInt(100) <= ENCHANTMENT_CHANCE) { if (random.nextInt(100) <= ENCHANTMENT_CHANCE) {
for (Enchantment newEnchant : Enchantment.values()) { for (Enchantment newEnchant : Enchantment.values()) {
@ -166,7 +166,7 @@ public class Fishing {
} }
if (enchanted) { if (enchanted) {
player.sendMessage(mcLocale.getString("Fishing.MagicFound")); player.sendMessage(LocaleLoader.getString("Fishing.MagicFound"));
} }
} }
} }
@ -185,91 +185,91 @@ public class Fishing {
switch (type) { switch (type) {
case BLAZE: case BLAZE:
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD)); Misc.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD));
break; break;
case CAVE_SPIDER: case CAVE_SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE)); Misc.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.STRING)); Misc.mcDropItem(loc, new ItemStack(Material.STRING));
} }
break; break;
case CHICKEN: case CHICKEN:
if (DROP_NUMBER > 66) { if (DROP_NUMBER > 66) {
m.mcDropItem(loc, new ItemStack(Material.FEATHER)); Misc.mcDropItem(loc, new ItemStack(Material.FEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN)); Misc.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.EGG)); Misc.mcDropItem(loc, new ItemStack(Material.EGG));
} }
break; break;
case COW: case COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET)); Misc.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 50) { else if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.LEATHER)); Misc.mcDropItem(loc, new ItemStack(Material.LEATHER));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF)); Misc.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
} }
break; break;
case CREEPER: case CREEPER:
m.mcDropItem(loc, new ItemStack(Material.SULPHUR)); Misc.mcDropItem(loc, new ItemStack(Material.SULPHUR));
break; break;
case ENDERMAN: case ENDERMAN:
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL)); Misc.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL));
break; break;
case GHAST: case GHAST:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SULPHUR)); Misc.mcDropItem(loc, new ItemStack(Material.SULPHUR));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR)); Misc.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR));
} }
break; break;
case MAGMA_CUBE: case MAGMA_CUBE:
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM)); Misc.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM));
break; break;
case MUSHROOM_COW: case MUSHROOM_COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET)); Misc.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 98) { else if (DROP_NUMBER > 98) {
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP)); Misc.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
} }
else if (DROP_NUMBER > 66) { else if (DROP_NUMBER > 66) {
m.mcDropItem(loc, new ItemStack(Material.LEATHER)); Misc.mcDropItem(loc, new ItemStack(Material.LEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF)); Misc.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
} }
else { else {
m.mcDropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3); Misc.mcDropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
} }
break; break;
case PIG: case PIG:
m.mcDropItem(loc, new ItemStack(Material.PORK)); Misc.mcDropItem(loc, new ItemStack(Material.PORK));
break; break;
case PIG_ZOMBIE: case PIG_ZOMBIE:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH)); Misc.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET)); Misc.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET));
} }
break; break;
@ -283,48 +283,48 @@ public class Fishing {
ItemStack theWool = wool.toItemStack(); ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6)); theWool.setAmount(1 + random.nextInt(6));
m.mcDropItem(loc, theWool); Misc.mcDropItem(loc, theWool);
sheep.setSheared(true); sheep.setSheared(true);
} }
break; break;
case SKELETON: case SKELETON:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.BONE)); Misc.mcDropItem(loc, new ItemStack(Material.BONE));
} }
else { else {
m.mcDropItems(loc, new ItemStack(Material.ARROW), 3); Misc.mcDropItems(loc, new ItemStack(Material.ARROW), 3);
} }
break; break;
case SLIME: case SLIME:
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL)); Misc.mcDropItem(loc, new ItemStack(Material.SLIME_BALL));
break; break;
case SNOWMAN: case SNOWMAN:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN)); Misc.mcDropItem(loc, new ItemStack(Material.PUMPKIN));
} }
else { else {
m.mcDropItems(loc, new ItemStack(Material.SNOW_BALL), 5); Misc.mcDropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
} }
break; break;
case SPIDER: case SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE)); Misc.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.STRING)); Misc.mcDropItem(loc, new ItemStack(Material.STRING));
} }
break; break;
case SQUID: case SQUID:
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); Misc.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0));
break; break;
case ZOMBIE: case ZOMBIE:
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH)); Misc.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
break; break;
default: default:

View File

@ -11,16 +11,16 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.AbilityType;
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.LocaleLoader;
import com.gmail.nossr50.runnables.GreenThumbTimer; import com.gmail.nossr50.runnables.GreenThumbTimer;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Herbalism { public class Herbalism {
@ -44,7 +44,7 @@ public class Herbalism {
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory(); player.updateInventory();
if (m.blockBreakSimulate(block, player, false)) { if (Misc.blockBreakSimulate(block, player, false)) {
if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) {
block.setData((byte) 0x1); //Set type of the brick to mossy block.setData((byte) 0x1); //Set type of the brick to mossy
} }
@ -156,7 +156,7 @@ public class Herbalism {
mat = Material.WHEAT; mat = Material.WHEAT;
xp = Config.getInstance().getHerbalismXPWheat(); xp = Config.getInstance().getHerbalismXPWheat();
if (Config.getInstance().getHerbalismWheatRegrowth() && mcPermissions.getInstance().greenThumbWheat(player)) { if (Config.getInstance().getHerbalismWheatRegrowth() && Permissions.getInstance().greenThumbWheat(player)) {
greenThumbWheat(block, player, event, plugin); greenThumbWheat(block, player, event, plugin);
} }
} }
@ -227,26 +227,26 @@ public class Herbalism {
if (mat == null) { if (mat == null) {
return; return;
} else if (mcPermissions.getInstance().herbalismDoubleDrops(player)) { } else if (Permissions.getInstance().herbalismDoubleDrops(player)) {
ItemStack is = new ItemStack(mat); ItemStack is = new ItemStack(mat);
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
if (type.equals(Material.CACTUS)) { if (type.equals(Material.CACTUS)) {
m.mcDropItems(loc, is, catciDrops); Misc.mcDropItems(loc, is, catciDrops);
} }
else if (type.equals(Material.MELON_BLOCK)) { else if (type.equals(Material.MELON_BLOCK)) {
m.mcDropItems(loc, is, 3); Misc.mcDropItems(loc, is, 3);
m.mcRandomDropItems(loc, is, 50, 4); Misc.mcRandomDropItems(loc, is, 50, 4);
} }
else if (type.equals(Material.NETHER_WARTS)) { else if (type.equals(Material.NETHER_WARTS)) {
m.mcDropItems(loc, is, 2); Misc.mcDropItems(loc, is, 2);
m.mcRandomDropItems(loc, is, 50, 3); Misc.mcRandomDropItems(loc, is, 50, 3);
} }
else if (type.equals(Material.SUGAR_CANE_BLOCK)) { else if (type.equals(Material.SUGAR_CANE_BLOCK)) {
m.mcDropItems(loc, is, caneDrops); Misc.mcDropItems(loc, is, caneDrops);
} }
else { else {
m.mcDropItem(loc, is); Misc.mcDropItem(loc, is);
} }
} }
} }
@ -275,8 +275,8 @@ public class Herbalism {
if (hasSeeds && PP.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= herbLevel)) { if (hasSeeds && PP.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= herbLevel)) {
event.setCancelled(true); event.setCancelled(true);
m.mcDropItem(loc, new ItemStack(Material.WHEAT)); Misc.mcDropItem(loc, new ItemStack(Material.WHEAT));
m.mcRandomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3); Misc.mcRandomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1);
@ -305,7 +305,7 @@ public class Herbalism {
greenTerra(player, block); greenTerra(player, block);
} }
else { else {
player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumbFail")); player.sendMessage(LocaleLoader.getString("mcPlayerListener.GreenThumbFail"));
} }
} }
} }

View File

@ -11,11 +11,11 @@ import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.sound.SoundEffect; import org.getspout.spoutapi.sound.SoundEffect;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
@ -38,40 +38,40 @@ public class Mining {
switch (type) { switch (type) {
case COAL_ORE: case COAL_ORE:
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData()); item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
m.mcDropItem(loc, item); Misc.mcDropItem(loc, item);
break; break;
case DIAMOND_ORE: case DIAMOND_ORE:
item = new ItemStack(Material.DIAMOND); item = new ItemStack(Material.DIAMOND);
m.mcDropItem(loc, item); Misc.mcDropItem(loc, item);
break; break;
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
case REDSTONE_ORE: case REDSTONE_ORE:
item = new ItemStack(Material.REDSTONE); item = new ItemStack(Material.REDSTONE);
m.mcDropItems(loc, item, 4); Misc.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50); Misc.mcRandomDropItem(loc, item, 50);
break; break;
case GLOWSTONE: case GLOWSTONE:
item = new ItemStack(Material.GLOWSTONE_DUST); item = new ItemStack(Material.GLOWSTONE_DUST);
m.mcDropItems(loc, item, 2); Misc.mcDropItems(loc, item, 2);
m.mcRandomDropItems(loc, item, 50, 2); Misc.mcRandomDropItems(loc, item, 50, 2);
break; break;
case LAPIS_ORE: case LAPIS_ORE:
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4); item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
m.mcDropItems(loc, item, 4); Misc.mcDropItems(loc, item, 4);
m.mcRandomDropItems(loc, item, 50, 4); Misc.mcRandomDropItems(loc, item, 50, 4);
break; break;
case STONE: case STONE:
item = new ItemStack(Material.COBBLESTONE); item = new ItemStack(Material.COBBLESTONE);
m.mcDropItem(loc, item); Misc.mcDropItem(loc, item);
break; break;
default: default:
m.mcDropItem(loc, item); Misc.mcDropItem(loc, item);
break; break;
} }
} }
@ -167,9 +167,9 @@ public class Mining {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && mcPermissions.getInstance().miningDoubleDrops(player)) { if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().miningDoubleDrops(player)) {
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
m.mcDropItem(block.getLocation(), new ItemStack(block.getType())); Misc.mcDropItem(block.getLocation(), new ItemStack(block.getType()));
} }
else { else {
miningDrops(block); miningDrops(block);
@ -215,7 +215,7 @@ public class Mining {
*/ */
public static void SuperBreakerBlockCheck(Player player, Block block) { public static void SuperBreakerBlockCheck(Player player, Block block) {
Material type = block.getType(); Material type = block.getType();
int tier = m.getTier(player.getItemInHand()); int tier = Misc.getTier(player.getItemInHand());
int durabilityLoss = Config.getInstance().getAbilityToolDamage(); int durabilityLoss = Config.getInstance().getAbilityToolDamage();
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);

View File

@ -14,17 +14,17 @@ import org.bukkit.inventory.PlayerInventory;
import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.ItemChecks;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
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.events.skills.McMMOPlayerRepairCheckEvent; import com.gmail.nossr50.events.skills.McMMOPlayerRepairCheckEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
public class Repair { public class Repair {
@ -47,20 +47,20 @@ public class Repair {
/* /*
* REPAIR ARMOR * REPAIR ARMOR
*/ */
if (ItemChecks.isArmor(is) && Config.getInstance().getRepairArmorAllowed() && mcPermissions.getInstance().armorRepair(player)) { if (ItemChecks.isArmor(is) && Config.getInstance().getRepairArmorAllowed() && Permissions.getInstance().armorRepair(player)) {
if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && Permissions.getInstance().diamondRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial()));
xpHandler(player, PP, is, durabilityBefore, 6, true); xpHandler(player, PP, is, durabilityBefore, 6, true);
} }
else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && Permissions.getInstance().ironRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial()));
xpHandler(player, PP, is, durabilityBefore, 2, true); xpHandler(player, PP, is, durabilityBefore, 2, true);
} }
else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && Permissions.getInstance().goldRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial()));
xpHandler(player, PP, is, durabilityBefore, 4, true); xpHandler(player, PP, is, durabilityBefore, 4, true);
} }
else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.getInstance().getRepairLeatherMaterial()) && mcPermissions.getInstance().leatherRepair(player)) { else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.getInstance().getRepairLeatherMaterial()) && Permissions.getInstance().leatherRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairLeatherMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairLeatherMaterial()));
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
@ -72,28 +72,28 @@ public class Repair {
/* /*
* REPAIR TOOLS * REPAIR TOOLS
*/ */
else if (ItemChecks.isTool(is) && Config.getInstance().getRepairToolsAllowed() && mcPermissions.getInstance().toolRepair(player)) { else if (ItemChecks.isTool(is) && Config.getInstance().getRepairToolsAllowed() && Permissions.getInstance().toolRepair(player)) {
if (ItemChecks.isStoneTool(is) && inventory.contains(Config.getInstance().getRepairStoneMaterial()) && skillLevel >= Config.getInstance().getRepairStoneLevelRequirement() && mcPermissions.getInstance().stoneRepair(player)) { if (ItemChecks.isStoneTool(is) && inventory.contains(Config.getInstance().getRepairStoneMaterial()) && skillLevel >= Config.getInstance().getRepairStoneLevelRequirement() && Permissions.getInstance().stoneRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairStoneMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairStoneMaterial()));
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.getInstance().getRepairWoodMaterial()) && mcPermissions.getInstance().woodRepair(player)) { else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.getInstance().getRepairWoodMaterial()) && Permissions.getInstance().woodRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairWoodMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairWoodMaterial()));
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
else if (ItemChecks.isIronTool(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { else if (ItemChecks.isIronTool(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && Permissions.getInstance().ironRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial()));
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && Permissions.getInstance().diamondRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial()));
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && Permissions.getInstance().goldRepair(player)) {
repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial()));
xpHandler(player, PP, is, durabilityBefore, 8, true); xpHandler(player, PP, is, durabilityBefore, 8, true);
} }
else if (ItemChecks.isStringTool(is) && inventory.contains(Config.getInstance().getRepairStringMaterial()) && skillLevel >= Config.getInstance().getRepairStringLevelRequirement() && mcPermissions.getInstance().stringRepair(player)){ else if (ItemChecks.isStringTool(is) && inventory.contains(Config.getInstance().getRepairStringMaterial()) && skillLevel >= Config.getInstance().getRepairStringLevelRequirement() && Permissions.getInstance().stringRepair(player)){
repairItem(player, is, new ItemStack(Config.getInstance().getRepairStringMaterial())); repairItem(player, is, new ItemStack(Config.getInstance().getRepairStringMaterial()));
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
@ -103,7 +103,7 @@ public class Repair {
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Repair.Skills.FullDurability")); player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
} }
} }
@ -188,11 +188,11 @@ public class Repair {
int rank = getArcaneForgingRank(Users.getProfile(player)); int rank = getArcaneForgingRank(Users.getProfile(player));
if (rank == 0 || !mcPermissions.getInstance().arcaneForging(player)) { if (rank == 0 || !Permissions.getInstance().arcaneForging(player)) {
for (Enchantment x : enchants.keySet()) { for (Enchantment x : enchants.keySet()) {
is.removeEnchantment(x); is.removeEnchantment(x);
} }
player.sendMessage(mcLocale.getString("Repair.Arcane.Lost")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Lost"));
return; return;
} }
@ -219,13 +219,13 @@ public class Repair {
Map<Enchantment, Integer> newEnchants = is.getEnchantments(); Map<Enchantment, Integer> newEnchants = is.getEnchantments();
if (newEnchants.isEmpty()) { if (newEnchants.isEmpty()) {
player.sendMessage(mcLocale.getString("Repair.Arcane.Fail")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Fail"));
} }
else if (downgraded || newEnchants.size() < enchants.size()) { else if (downgraded || newEnchants.size() < enchants.size()) {
player.sendMessage(mcLocale.getString("Repair.Arcane.Downgrade")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Downgrade"));
} }
else { else {
player.sendMessage(mcLocale.getString("Repair.Arcane.Perfect")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
} }
} }
@ -352,49 +352,49 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
if (is.getAmount() != 1) { if (is.getAmount() != 1) {
player.sendMessage(mcLocale.getString("Repair.Skills.StackedItems")); player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
} }
else { else {
if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) { if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) {
if (skillLevel < Config.getInstance().getRepairDiamondLevelRequirement()) { if (skillLevel < Config.getInstance().getRepairDiamondLevelRequirement()) {
player.sendMessage(mcLocale.getString("Repair.Skills.AdeptDiamond")); player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptDiamond"));
} }
else { else {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.getInstance().getRepairDiamondMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.BLUE + Misc.prettyItemString(Config.getInstance().getRepairDiamondMaterial()));
} }
} }
else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) { else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) {
if (skillLevel < Config.getInstance().getRepairIronLevelRequirement()) { if (skillLevel < Config.getInstance().getRepairIronLevelRequirement()) {
player.sendMessage(mcLocale.getString("Repair.Skills.AdeptIron")); player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptIron"));
} }
else { else {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getRepairIronMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getRepairIronMaterial()));
} }
} }
else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) { else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) {
if (skillLevel < Config.getInstance().getRepairGoldLevelRequirement()) { if (skillLevel < Config.getInstance().getRepairGoldLevelRequirement()) {
player.sendMessage(mcLocale.getString("Repair.Skills.AdeptGold")); player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptGold"));
} }
else { else {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.getInstance().getRepairGoldMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GOLD + Misc.prettyItemString(Config.getInstance().getRepairGoldMaterial()));
} }
} }
else if (ItemChecks.isStoneTool(is)) { else if (ItemChecks.isStoneTool(is)) {
if (skillLevel < Config.getInstance().getRepairStoneLevelRequirement()) { if (skillLevel < Config.getInstance().getRepairStoneLevelRequirement()) {
player.sendMessage(mcLocale.getString("Repair.Skills.AdeptStone")); player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptStone"));
} }
else { else {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getRepairStoneMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getRepairStoneMaterial()));
} }
} }
else if (ItemChecks.isWoodTool(is)) { else if (ItemChecks.isWoodTool(is)) {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.getInstance().getRepairWoodMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + Misc.prettyItemString(Config.getInstance().getRepairWoodMaterial()));
} }
else if (ItemChecks.isLeatherArmor(is)) { else if (ItemChecks.isLeatherArmor(is)) {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getInstance().getRepairLeatherMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + Misc.prettyItemString(Config.getInstance().getRepairLeatherMaterial()));
} }
else if (ItemChecks.isStringTool(is)) { else if (ItemChecks.isStringTool(is)) {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getInstance().getRepairStringMaterial())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + Misc.prettyItemString(Config.getInstance().getRepairStringMaterial()));
} }
} }
} }
@ -410,8 +410,8 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && mcPermissions.getInstance().repairBonus(player)) { if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().repairBonus(player)) {
player.sendMessage(mcLocale.getString("Repair.Skills.FeltEasy")); player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true; return true;
} }
@ -445,7 +445,7 @@ public class Repair {
} }
/* Handle the enchants */ /* Handle the enchants */
if (Config.getInstance().getArcaneForgingEnchantLossEnabled() && !mcPermissions.getInstance().arcaneBypass(player)) { if (Config.getInstance().getArcaneForgingEnchantLossEnabled() && !Permissions.getInstance().arcaneBypass(player)) {
addEnchants(player, item); addEnchants(player, item);
} }
@ -470,7 +470,7 @@ public class Repair {
} }
} }
else { else {
player.sendMessage(mcLocale.getString("Repair.Listener.Anvil")); player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil"));
} }
PP.togglePlacedAnvil(); PP.togglePlacedAnvil();

View File

@ -9,20 +9,20 @@ import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Leaderboard;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.PlayerStat; import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.ToolType; import com.gmail.nossr50.datatypes.ToolType;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent; import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
public class Skills { public class Skills {
@ -106,7 +106,7 @@ public class Skills {
if (ability.getPermissions(player) && tool.inHand(inHand) && !PP.getToolPreparationMode(tool)) { if (ability.getPermissions(player) && tool.inHand(inHand) && !PP.getToolPreparationMode(tool)) {
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) { if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) { if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
return; return;
} }
} }
@ -146,7 +146,7 @@ public class Skills {
player.sendMessage(ability.getAbilityOff()); player.sendMessage(ability.getAbilityOff());
for (Player y : player.getWorld().getPlayers()) { for (Player y : player.getWorld().getPlayers()) {
if (y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) { if (y != player && Misc.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
y.sendMessage(ability.getAbilityPlayerOff(player)); y.sendMessage(ability.getAbilityPlayerOff(player));
} }
} }
@ -188,7 +188,7 @@ public class Skills {
if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (m.getPowerLevelCap() >= PP.getPowerLevel() + 1)) { if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (Misc.getPowerLevelCap() >= PP.getPowerLevel() + 1)) {
PP.removeXP(skillType, PP.getXpToLevel(skillType)); PP.removeXP(skillType, PP.getXpToLevel(skillType));
skillups++; skillups++;
PP.skillUp(skillType, 1); PP.skillUp(skillType, 1);
@ -206,7 +206,7 @@ public class Skills {
ProcessLeaderboardUpdate(SkillType.ALL, player); ProcessLeaderboardUpdate(SkillType.ALL, player);
} }
String capitalized = m.getCapitalized(skillType.toString()); String capitalized = Misc.getCapitalized(skillType.toString());
/* Spout Stuff */ /* Spout Stuff */
if (Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) { if (Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) {
@ -225,11 +225,11 @@ public class Skills {
} }
} }
else { else {
player.sendMessage(mcLocale.getString(capitalized + ".Skillup", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)})); player.sendMessage(LocaleLoader.getString(capitalized + ".Skillup", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
} }
} }
else { else {
player.sendMessage(mcLocale.getString(capitalized + ".Skillup", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)})); player.sendMessage(LocaleLoader.getString(capitalized + ".Skillup", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
} }
} }
@ -296,11 +296,11 @@ public class Skills {
* @return true if the player has combat skills, false otherwise * @return true if the player has combat skills, false otherwise
*/ */
public static boolean hasCombatSkills(Player player) { public static boolean hasCombatSkills(Player player) {
if (mcPermissions.getInstance().axes(player) if (Permissions.getInstance().axes(player)
|| mcPermissions.getInstance().archery(player) || Permissions.getInstance().archery(player)
|| mcPermissions.getInstance().swords(player) || Permissions.getInstance().swords(player)
|| mcPermissions.getInstance().taming(player) || Permissions.getInstance().taming(player)
|| mcPermissions.getInstance().unarmed(player)) { || Permissions.getInstance().unarmed(player)) {
return true; return true;
} }
else { else {
@ -315,11 +315,11 @@ public class Skills {
* @return true if the player has gathering skills, false otherwise * @return true if the player has gathering skills, false otherwise
*/ */
public static boolean hasGatheringSkills(Player player) { public static boolean hasGatheringSkills(Player player) {
if (mcPermissions.getInstance().excavation(player) if (Permissions.getInstance().excavation(player)
|| mcPermissions.getInstance().fishing(player) || Permissions.getInstance().fishing(player)
|| mcPermissions.getInstance().herbalism(player) || Permissions.getInstance().herbalism(player)
|| mcPermissions.getInstance().mining(player) || Permissions.getInstance().mining(player)
|| mcPermissions.getInstance().woodcutting(player)) { || Permissions.getInstance().woodcutting(player)) {
return true; return true;
} }
else { else {
@ -334,7 +334,7 @@ public class Skills {
* @return true if the player has misc skills, false otherwise * @return true if the player has misc skills, false otherwise
*/ */
public static boolean hasMiscSkills(Player player) { public static boolean hasMiscSkills(Player player) {
if (mcPermissions.getInstance().acrobatics(player) || mcPermissions.getInstance().repair(player)) { if (Permissions.getInstance().acrobatics(player) || Permissions.getInstance().repair(player)) {
return true; return true;
} }
else { else {
@ -377,7 +377,7 @@ public class Skills {
*/ */
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) { if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) { if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
return; return;
} }
} }
@ -388,7 +388,7 @@ public class Skills {
player.sendMessage(ability.getAbilityOn()); player.sendMessage(ability.getAbilityOn());
for (Player y : player.getWorld().getPlayers()) { for (Player y : player.getWorld().getPlayers()) {
if (y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) { if (y != player && Misc.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
y.sendMessage(ability.getAbilityPlayer(player)); y.sendMessage(ability.getAbilityPlayer(player));
} }
} }
@ -420,7 +420,7 @@ public class Skills {
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
case SUPER_BREAKER: case SUPER_BREAKER:
case LEAF_BLOWER: case LEAF_BLOWER:
if (!m.blockBreakSimulate(block, player, true)) { if (!Misc.blockBreakSimulate(block, player, true)) {
activate = false; activate = false;
break; break;
} }

View File

@ -9,17 +9,17 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.ItemChecks;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
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.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.mcBleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Swords { public class Swords {
@ -54,7 +54,7 @@ public class Swords {
PlayerProfile PPa = Users.getProfile(attacker); PlayerProfile PPa = Users.getProfile(attacker);
int skillLevel = PPa.getSkillLevel(SkillType.SWORDS); int skillLevel = PPa.getSkillLevel(SkillType.SWORDS);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(1000) <= skillCheck && !entity.isDead()) { if (random.nextInt(1000) <= skillCheck && !entity.isDead()) {
if (entity instanceof Player) { if (entity instanceof Player) {
@ -71,9 +71,9 @@ public class Swords {
Users.getProfile(target).addBleedTicks(bleedTicks); Users.getProfile(target).addBleedTicks(bleedTicks);
} }
else { else {
mcBleedTimer.add(entity); BleedTimer.add(entity);
} }
attacker.sendMessage(mcLocale.getString("Swords.Combat.Bleeding")); attacker.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
} }
} }
@ -95,19 +95,19 @@ public class Swords {
Player defender = (Player) target; Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender); PlayerProfile PPd = Users.getProfile(defender);
if (ItemChecks.isSword(defender.getItemInHand()) && mcPermissions.getInstance().counterAttack(defender)) { if (ItemChecks.isSword(defender.getItemInHand()) && Permissions.getInstance().counterAttack(defender)) {
final int MAX_BONUS_LEVEL = 600; final int MAX_BONUS_LEVEL = 600;
final int COUNTER_ATTACK_MODIFIER = 2; final int COUNTER_ATTACK_MODIFIER = 2;
int skillLevel = PPd.getSkillLevel(SkillType.SWORDS); int skillLevel = PPd.getSkillLevel(SkillType.SWORDS);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(2000) <= skillCheck) { if (random.nextInt(2000) <= skillCheck) {
Combat.dealDamage((LivingEntity) attacker, event.getDamage() / COUNTER_ATTACK_MODIFIER); Combat.dealDamage((LivingEntity) attacker, event.getDamage() / COUNTER_ATTACK_MODIFIER);
defender.sendMessage(mcLocale.getString("Swords.Combat.Countered")); defender.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
if (attacker instanceof Player) { if (attacker instanceof Player) {
((Player) attacker).sendMessage(mcLocale.getString("Swords.Combat.Counter.Hit")); ((Player) attacker).sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Hit"));
} }
} }
} }

View File

@ -18,15 +18,15 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
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.LocaleLoader;
import com.gmail.nossr50.runnables.mcBleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Taming { public class Taming {
@ -94,14 +94,14 @@ public class Taming {
if (entity instanceof Player) { if (entity instanceof Player) {
Player target = (Player) entity; Player target = (Player) entity;
target.sendMessage(mcLocale.getString("Combat.StruckByGore")); target.sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
Users.getProfile(target).addBleedTicks(2); Users.getProfile(target).addBleedTicks(2);
} }
else { else {
mcBleedTimer.add((LivingEntity) entity); BleedTimer.add((LivingEntity) entity);
} }
master.sendMessage(mcLocale.getString("Combat.Gore")); master.sendMessage(LocaleLoader.getString("Combat.Gore"));
} }
} }
@ -147,20 +147,20 @@ public class Taming {
case CONTACT: case CONTACT:
case LAVA: case LAVA:
case FIRE: case FIRE:
if (mcPermissions.getInstance().environmentallyAware(master)) { if (Permissions.getInstance().environmentallyAware(master)) {
if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) { if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) {
if (event.getDamage() >= wolf.getHealth()) { if (event.getDamage() >= wolf.getHealth()) {
return; return;
} }
wolf.teleport(master.getLocation()); wolf.teleport(master.getLocation());
master.sendMessage(mcLocale.getString("Taming.Listener.Wolf")); master.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
} }
} }
break; break;
case FALL: case FALL:
if (mcPermissions.getInstance().environmentallyAware(master)) { if (Permissions.getInstance().environmentallyAware(master)) {
if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) { if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -169,7 +169,7 @@ public class Taming {
/* Thick Fur */ /* Thick Fur */
case FIRE_TICK: case FIRE_TICK:
if (mcPermissions.getInstance().thickFur(master)) { if (Permissions.getInstance().thickFur(master)) {
if(skillLevel >= THICK_FUR_LEVEL) { if(skillLevel >= THICK_FUR_LEVEL) {
wolf.setFireTicks(0); wolf.setFireTicks(0);
} }
@ -178,7 +178,7 @@ public class Taming {
case ENTITY_ATTACK: case ENTITY_ATTACK:
case PROJECTILE: case PROJECTILE:
if (mcPermissions.getInstance().thickFur(master)) { if (Permissions.getInstance().thickFur(master)) {
if (skillLevel >= THICK_FUR_LEVEL) { if (skillLevel >= THICK_FUR_LEVEL) {
event.setDamage(event.getDamage() / THICK_FUR_MODIFIER); event.setDamage(event.getDamage() / THICK_FUR_MODIFIER);
} }
@ -188,7 +188,7 @@ public class Taming {
/* Shock Proof */ /* Shock Proof */
case ENTITY_EXPLOSION: case ENTITY_EXPLOSION:
case BLOCK_EXPLOSION: case BLOCK_EXPLOSION:
if (mcPermissions.getInstance().shockProof(master)) { if (Permissions.getInstance().shockProof(master)) {
if (skillLevel >= SHOCK_PROOF_LEVEL) { if (skillLevel >= SHOCK_PROOF_LEVEL) {
event.setDamage(event.getDamage() / SHOCK_PROOF_MODIFIER); event.setDamage(event.getDamage() / SHOCK_PROOF_MODIFIER);
} }
@ -232,11 +232,11 @@ public class Taming {
if (x.getType().equals(type)) { if (x.getType().equals(type)) {
switch (type) { switch (type) {
case WOLF: case WOLF:
player.sendMessage(mcLocale.getString("Taming.Summon.Fail.Wolf")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Wolf"));
return; return;
case OCELOT: case OCELOT:
player.sendMessage(mcLocale.getString("Taming.Summon.Fail.Ocelot")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
return; return;
default: default:
@ -258,10 +258,10 @@ public class Taming {
} }
player.setItemInHand(new ItemStack(summonItem, item.getAmount() - summonAmount)); player.setItemInHand(new ItemStack(summonItem, item.getAmount() - summonAmount));
player.sendMessage(mcLocale.getString("Taming.Summon.Complete")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
} }
else { else {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(summonItem.getId())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(summonItem.getId()));
} }
} }
} }
@ -276,15 +276,15 @@ public class Taming {
public static void beastLore(EntityDamageByEntityEvent event, LivingEntity target, Player inspector) { public static void beastLore(EntityDamageByEntityEvent event, LivingEntity target, Player inspector) {
if (target instanceof Tameable) { if (target instanceof Tameable) {
Tameable beast = (Tameable) target; Tameable beast = (Tameable) target;
String message = mcLocale.getString("Combat.BeastLore") + " "; String message = LocaleLoader.getString("Combat.BeastLore") + " ";
int health = target.getHealth(); int health = target.getHealth();
event.setCancelled(true); event.setCancelled(true);
if (beast.isTamed()) { if (beast.isTamed()) {
message = message.concat(mcLocale.getString("Combat.BeastLoreOwner", new Object[] {getOwnerName(beast)}) + " "); message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", new Object[] {getOwnerName(beast)}) + " ");
} }
message = message.concat(mcLocale.getString("Combat.BeastLoreHealth", new Object[] {health, target.getMaxHealth()})); message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", new Object[] {health, target.getMaxHealth()}));
inspector.sendMessage(message); inspector.sendMessage(message);
} }
} }

View File

@ -8,12 +8,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
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.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class Unarmed { public class Unarmed {
@ -49,15 +49,15 @@ public class Unarmed {
PlayerProfile PPa = Users.getProfile(attacker); PlayerProfile PPa = Users.getProfile(attacker);
int skillLevel = PPa.getSkillLevel(SkillType.UNARMED); int skillLevel = PPa.getSkillLevel(SkillType.UNARMED);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
ItemStack inHand = defender.getItemInHand(); ItemStack inHand = defender.getItemInHand();
if (!inHand.getType().equals(Material.AIR)) { if (!inHand.getType().equals(Material.AIR)) {
if (random.nextInt(3000) <= skillCheck && ironGrip(defender, attacker)) { if (random.nextInt(3000) <= skillCheck && ironGrip(defender, attacker)) {
defender.sendMessage(mcLocale.getString("Skills.Disarmed")); defender.sendMessage(LocaleLoader.getString("Skills.Disarmed"));
m.mcDropItem(defender.getLocation(), inHand); Misc.mcDropItem(defender.getLocation(), inHand);
defender.setItemInHand(new ItemStack(Material.AIR)); defender.setItemInHand(new ItemStack(Material.AIR));
} }
} }
@ -73,11 +73,11 @@ public class Unarmed {
final int MAX_BONUS_LEVEL = 1000; final int MAX_BONUS_LEVEL = 1000;
int skillLevel = Users.getProfile(defender).getSkillLevel(SkillType.UNARMED); int skillLevel = Users.getProfile(defender).getSkillLevel(SkillType.UNARMED);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(2000) <= skillCheck && mcPermissions.getInstance().deflect(defender)) { if (random.nextInt(2000) <= skillCheck && Permissions.getInstance().deflect(defender)) {
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); defender.sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
} }
} }
@ -86,7 +86,7 @@ public class Unarmed {
PlayerProfile PPd = Users.getProfile(defender); PlayerProfile PPd = Users.getProfile(defender);
int skillLevel = PPd.getSkillLevel(SkillType.UNARMED); int skillLevel = PPd.getSkillLevel(SkillType.UNARMED);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(1000) <= skillCheck) { if (random.nextInt(1000) <= skillCheck) {
defender.sendMessage(ChatColor.GREEN + "Your iron grip kept you from being disarmed!"); //TODO: Use locale defender.sendMessage(ChatColor.GREEN + "Your iron grip kept you from being disarmed!"); //TODO: Use locale

View File

@ -11,17 +11,17 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Tree; import org.bukkit.material.Tree;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
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.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
import org.getspout.spoutapi.sound.SoundEffect; import org.getspout.spoutapi.sound.SoundEffect;
@ -54,7 +54,7 @@ public class WoodCutting {
*/ */
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) { private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) {
if (toBeFelled.size() >= Config.getInstance().getTreeFellerThreshold()) { if (toBeFelled.size() >= Config.getInstance().getTreeFellerThreshold()) {
player.sendMessage(mcLocale.getString("Woodcutting.Skills.TreeFellerThreshold")); player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFellerThreshold"));
return; return;
} }
@ -67,7 +67,7 @@ public class WoodCutting {
/* This is to prevent using wood axes everytime you tree fell */ /* This is to prevent using wood axes everytime you tree fell */
if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) { if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) {
player.sendMessage(mcLocale.getString("Woodcutting.Skills.TreeFeller.Splinter")); player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter"));
int health = player.getHealth(); int health = player.getHealth();
@ -85,7 +85,7 @@ public class WoodCutting {
ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData()); ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData());
for (Block x : toBeFelled) { for (Block x : toBeFelled) {
if (m.blockBreakSimulate(x, player, true)) { if (Misc.blockBreakSimulate(x, player, true)) {
if (x.getType() == Material.LOG) { if (x.getType() == Material.LOG) {
Tree tree = (Tree) x.getState().getData(); Tree tree = (Tree) x.getState().getData();
TreeSpecies species = tree.getSpecies(); TreeSpecies species = tree.getSpecies();
@ -141,13 +141,13 @@ public class WoodCutting {
x.setType(Material.AIR); x.setType(Material.AIR);
/* Drop the block */ /* Drop the block */
m.mcDropItem(x.getLocation(), item); Misc.mcDropItem(x.getLocation(), item);
} }
else if (x.getType() == Material.LEAVES) { else if (x.getType() == Material.LEAVES) {
final int SAPLING_DROP_CHANCE = 10; final int SAPLING_DROP_CHANCE = 10;
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling
m.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE); Misc.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
//Remove the block //Remove the block
x.setData((byte) 0); x.setData((byte) 0);
@ -258,9 +258,9 @@ public class WoodCutting {
byte type = block.getData(); byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if ((skillLevel > MAX_SKILL_LEVEL || random.nextInt(1000) <= skillLevel) && mcPermissions.getInstance().woodcuttingDoubleDrops(player)) { if ((skillLevel > MAX_SKILL_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().woodcuttingDoubleDrops(player)) {
ItemStack item = new ItemStack(mat, 1, (short) 0, type); ItemStack item = new ItemStack(mat, 1, (short) 0, type);
m.mcDropItem(block.getLocation(), item); Misc.mcDropItem(block.getLocation(), item);
} }
} }

View File

@ -20,8 +20,6 @@ import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.keyboard.Keyboard; import org.getspout.spoutapi.keyboard.Keyboard;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
@ -30,6 +28,8 @@ import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.listeners.SpoutInputListener; import com.gmail.nossr50.listeners.SpoutInputListener;
import com.gmail.nossr50.listeners.SpoutListener; import com.gmail.nossr50.listeners.SpoutListener;
import com.gmail.nossr50.listeners.SpoutScreenListener; import com.gmail.nossr50.listeners.SpoutScreenListener;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class SpoutStuff { public class SpoutStuff {
private static mcMMO plugin = mcMMO.p; private static mcMMO plugin = mcMMO.p;
@ -118,8 +118,8 @@ public class SpoutStuff {
continue; continue;
} }
String standardFileName = m.getCapitalized(y.toString())+".png"; String standardFileName = Misc.getCapitalized(y.toString())+".png";
String retroFileName = m.getCapitalized(y.toString())+"_r.png"; String retroFileName = Misc.getCapitalized(y.toString())+"_r.png";
writeFile(standardFileName, hudStandardDirectory); writeFile(standardFileName, hudStandardDirectory);
writeFile(retroFileName, hudRetroDirectory); writeFile(retroFileName, hudRetroDirectory);
@ -179,8 +179,8 @@ public class SpoutStuff {
continue; continue;
} }
files.add(new File(hudStandardDirectory + m.getCapitalized(y.toString()) + ".png")); files.add(new File(hudStandardDirectory + Misc.getCapitalized(y.toString()) + ".png"));
files.add(new File(hudRetroDirectory + m.getCapitalized(y.toString()) + "_r.png")); files.add(new File(hudRetroDirectory + Misc.getCapitalized(y.toString()) + "_r.png"));
} }
/* Blank icons */ /* Blank icons */
@ -544,7 +544,7 @@ public class SpoutStuff {
} }
//TODO: Use Locale //TODO: Use Locale
sPlayer.sendNotification(ChatColor.GREEN + "Level Up!", ChatColor.YELLOW + m.getCapitalized(skillType.toString()) + ChatColor.DARK_AQUA + " (" + ChatColor.GREEN + PP.getSkillLevel(skillType) + ChatColor.DARK_AQUA + ")", mat); sPlayer.sendNotification(ChatColor.GREEN + "Level Up!", ChatColor.YELLOW + Misc.getCapitalized(skillType.toString()) + ChatColor.DARK_AQUA + " (" + ChatColor.GREEN + PP.getSkillLevel(skillType) + ChatColor.DARK_AQUA + ")", mat);
SpoutSounds.playLevelUpNoise(sPlayer, plugin); SpoutSounds.playLevelUpNoise(sPlayer, plugin);
} }

View File

@ -1,119 +1,119 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import org.bukkit.Material; import org.bukkit.Material;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
public class BlockChecks { public class BlockChecks {
/** /**
* Checks to see if a block type awards XP. * Checks to see if a block type awards XP.
* *
* @param material The type of Block to check * @param material The type of Block to check
* @return true if the block type awards XP, false otherwise * @return true if the block type awards XP, false otherwise
*/ */
public static boolean shouldBeWatched(Material material) { public static boolean shouldBeWatched(Material material) {
switch (material) { switch (material) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: case CACTUS:
case CLAY: case CLAY:
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case DIRT: case DIRT:
case ENDER_STONE: case ENDER_STONE:
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
case GLOWSTONE: case GLOWSTONE:
case GOLD_ORE: case GOLD_ORE:
case GRASS: case GRASS:
case GRAVEL: case GRAVEL:
case IRON_ORE: case IRON_ORE:
case JACK_O_LANTERN: case JACK_O_LANTERN:
case LAPIS_ORE: case LAPIS_ORE:
case LOG: case LOG:
case MELON_BLOCK: case MELON_BLOCK:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case MYCEL: case MYCEL:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case PUMPKIN: case PUMPKIN:
case RED_MUSHROOM: case RED_MUSHROOM:
case RED_ROSE: case RED_ROSE:
case REDSTONE_ORE: case REDSTONE_ORE:
case SAND: case SAND:
case SANDSTONE: case SANDSTONE:
case SOUL_SAND: case SOUL_SAND:
case STONE: case STONE:
case SUGAR_CANE_BLOCK: case SUGAR_CANE_BLOCK:
case VINE: case VINE:
case WATER_LILY: case WATER_LILY:
case YELLOW_FLOWER: case YELLOW_FLOWER:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Check if a block should allow for the activation of abilities. * Check if a block should allow for the activation of abilities.
* *
* @param material The type of Block to check * @param material The type of Block to check
* @return true if the block should allow ability activation, false otherwise * @return true if the block should allow ability activation, false otherwise
*/ */
public static boolean abilityBlockCheck(Material material) { public static boolean abilityBlockCheck(Material material) {
switch (material) { switch (material) {
case BED_BLOCK: case BED_BLOCK:
case BREWING_STAND: case BREWING_STAND:
case BOOKSHELF: case BOOKSHELF:
case BURNING_FURNACE: case BURNING_FURNACE:
case CAKE_BLOCK: case CAKE_BLOCK:
case CHEST: case CHEST:
case DISPENSER: case DISPENSER:
case ENCHANTMENT_TABLE: case ENCHANTMENT_TABLE:
case FENCE_GATE: case FENCE_GATE:
case FURNACE: case FURNACE:
case IRON_DOOR_BLOCK: case IRON_DOOR_BLOCK:
case JUKEBOX: case JUKEBOX:
case LEVER: case LEVER:
case NOTE_BLOCK: case NOTE_BLOCK:
case STONE_BUTTON: case STONE_BUTTON:
case TRAP_DOOR: case TRAP_DOOR:
case WALL_SIGN: case WALL_SIGN:
case WOODEN_DOOR: case WOODEN_DOOR:
case WORKBENCH: case WORKBENCH:
return false; return false;
default: default:
break; break;
} }
if (Material.getMaterial(Config.getInstance().getRepairAnvilId()).equals(material)) { if (Material.getMaterial(Config.getInstance().getRepairAnvilId()).equals(material)) {
return false; return false;
} }
else { else {
return true; return true;
} }
} }
/** /**
* Check if a block type is an ore. * Check if a block type is an ore.
* *
* @param material The type of Block to check * @param material The type of Block to check
* @return true if the Block is an ore, false otherwise * @return true if the Block is an ore, false otherwise
*/ */
public static boolean isOre(Material material) { public static boolean isOre(Material material) {
switch (material) { switch (material) {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
case GOLD_ORE: case GOLD_ORE:
case IRON_ORE: case IRON_ORE:
case LAPIS_ORE: case LAPIS_ORE:
case REDSTONE_ORE: case REDSTONE_ORE:
return true; return true;
default: default:
return false; return false;
} }
} }
} }

View File

@ -1,486 +1,487 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.IronGolem; import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.ToolType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; import com.gmail.nossr50.datatypes.ToolType;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.GainXp; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.mcBleedTimer; import com.gmail.nossr50.runnables.GainXp;
import com.gmail.nossr50.skills.Acrobatics; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.skills.Archery; import com.gmail.nossr50.skills.Acrobatics;
import com.gmail.nossr50.skills.Axes; import com.gmail.nossr50.skills.Archery;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Axes;
import com.gmail.nossr50.skills.Swords; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming; import com.gmail.nossr50.skills.Swords;
import com.gmail.nossr50.skills.Unarmed; import com.gmail.nossr50.skills.Taming;
import com.gmail.nossr50.skills.Unarmed;
public class Combat {
public class Combat {
/**
* Apply combat modifiers and process and XP gain. /**
* * Apply combat modifiers and process and XP gain.
* @param event The event to run the combat checks on. *
* @param plugin mcMMO plugin instance * @param event The event to run the combat checks on.
*/ * @param plugin mcMMO plugin instance
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO plugin) { */
if (event.getDamage() == 0 || event.getEntity().isDead()) { public static void combatChecks(EntityDamageByEntityEvent event, mcMMO plugin) {
return; if (event.getDamage() == 0 || event.getEntity().isDead()) {
} return;
}
Entity damager = event.getDamager();
LivingEntity target = (LivingEntity) event.getEntity(); Entity damager = event.getDamager();
EntityType damagerType = damager.getType(); LivingEntity target = (LivingEntity) event.getEntity();
EntityType targetType = target.getType(); EntityType damagerType = damager.getType();
EntityType targetType = target.getType();
switch (damagerType) {
case PLAYER: switch (damagerType) {
Player attacker = (Player) event.getDamager(); case PLAYER:
ItemStack itemInHand = attacker.getItemInHand(); Player attacker = (Player) event.getDamager();
PlayerProfile PPa = Users.getProfile(attacker); ItemStack itemInHand = attacker.getItemInHand();
PlayerProfile PPa = Users.getProfile(attacker);
combatAbilityChecks(attacker);
combatAbilityChecks(attacker);
if (ItemChecks.isSword(itemInHand) && mcPermissions.getInstance().swords(attacker)) {
if (!mcBleedTimer.contains(target) && mcPermissions.getInstance().swordsBleed(attacker)) { if (ItemChecks.isSword(itemInHand) && Permissions.getInstance().swords(attacker)) {
Swords.bleedCheck(attacker, target, plugin); if (!BleedTimer.contains(target) && Permissions.getInstance().swordsBleed(attacker)) {
} Swords.bleedCheck(attacker, target, plugin);
}
if (PPa.getAbilityMode(AbilityType.SERRATED_STRIKES) && mcPermissions.getInstance().serratedStrikes(attacker)) {
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.SWORDS); if (PPa.getAbilityMode(AbilityType.SERRATED_STRIKES) && Permissions.getInstance().serratedStrikes(attacker)) {
} applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.SWORDS);
}
startGainXp(attacker, PPa, target, SkillType.SWORDS, plugin);
} startGainXp(attacker, PPa, target, SkillType.SWORDS, plugin);
else if (ItemChecks.isAxe(itemInHand) && mcPermissions.getInstance().axes(attacker)) { }
if (mcPermissions.getInstance().axeBonus(attacker)) { else if (ItemChecks.isAxe(itemInHand) && Permissions.getInstance().axes(attacker)) {
Axes.axesBonus(attacker, event); if (Permissions.getInstance().axeBonus(attacker)) {
} Axes.axesBonus(attacker, event);
}
if (mcPermissions.getInstance().criticalHit(attacker)) {
Axes.axeCriticalCheck(attacker, event); if (Permissions.getInstance().criticalHit(attacker)) {
} Axes.axeCriticalCheck(attacker, event);
}
if (mcPermissions.getInstance().impact(attacker)) {
Axes.impact(attacker, target, event); if (Permissions.getInstance().impact(attacker)) {
} Axes.impact(attacker, target, event);
}
if (PPa.getAbilityMode(AbilityType.SKULL_SPLIITER) && mcPermissions.getInstance().skullSplitter(attacker)) {
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.AXES); if (PPa.getAbilityMode(AbilityType.SKULL_SPLIITER) && Permissions.getInstance().skullSplitter(attacker)) {
} applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.AXES);
}
startGainXp(attacker, PPa, target, SkillType.AXES, plugin);
} startGainXp(attacker, PPa, target, SkillType.AXES, plugin);
else if (itemInHand.getType().equals(Material.AIR) && mcPermissions.getInstance().unarmed(attacker)) { }
if (mcPermissions.getInstance().unarmedBonus(attacker)) { else if (itemInHand.getType().equals(Material.AIR) && Permissions.getInstance().unarmed(attacker)) {
Unarmed.unarmedBonus(PPa, event); if (Permissions.getInstance().unarmedBonus(attacker)) {
} Unarmed.unarmedBonus(PPa, event);
}
if (PPa.getAbilityMode(AbilityType.BERSERK) && mcPermissions.getInstance().berserk(attacker)) {
event.setDamage((int) (event.getDamage() * 1.5)); if (PPa.getAbilityMode(AbilityType.BERSERK) && Permissions.getInstance().berserk(attacker)) {
} event.setDamage((int) (event.getDamage() * 1.5));
}
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) {
Unarmed.disarmProcCheck(attacker, (Player) target); if (targetType.equals(EntityType.PLAYER) && Permissions.getInstance().disarm(attacker)) {
} Unarmed.disarmProcCheck(attacker, (Player) target);
}
startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
} startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
else if (itemInHand.getType().equals(Material.BONE) && mcPermissions.getInstance().beastLore(attacker)) { }
Taming.beastLore(event, target, attacker); else if (itemInHand.getType().equals(Material.BONE) && Permissions.getInstance().beastLore(attacker)) {
} Taming.beastLore(event, target, attacker);
break; }
break;
case WOLF:
Wolf wolf = (Wolf) damager; case WOLF:
Wolf wolf = (Wolf) damager;
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
Player master = (Player) wolf.getOwner(); if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
PlayerProfile PPo = Users.getProfile(master); Player master = (Player) wolf.getOwner();
PlayerProfile PPo = Users.getProfile(master);
if (mcPermissions.getInstance().taming(master)) {
if (mcPermissions.getInstance().fastFoodService(master)) { if (Permissions.getInstance().taming(master)) {
Taming.fastFoodService(PPo, wolf, event); if (Permissions.getInstance().fastFoodService(master)) {
} Taming.fastFoodService(PPo, wolf, event);
}
if (mcPermissions.getInstance().sharpenedclaws(master)) {
Taming.sharpenedClaws(PPo, event); if (Permissions.getInstance().sharpenedclaws(master)) {
} Taming.sharpenedClaws(PPo, event);
}
if (mcPermissions.getInstance().gore(master)) {
Taming.gore(PPo, event, master, plugin); if (Permissions.getInstance().gore(master)) {
} Taming.gore(PPo, event, master, plugin);
}
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
} startGainXp(master, PPo, target, SkillType.TAMING, plugin);
} }
break; }
break;
case ARROW:
archeryCheck((EntityDamageByEntityEvent) event, plugin); case ARROW:
break; archeryCheck((EntityDamageByEntityEvent) event, plugin);
break;
default:
break; default:
} break;
}
if (targetType.equals(EntityType.PLAYER)) {
Swords.counterAttackChecks(event); if (targetType.equals(EntityType.PLAYER)) {
Acrobatics.dodgeChecks(event); Swords.counterAttackChecks(event);
} Acrobatics.dodgeChecks(event);
} }
}
/**
* Process combat abilities based on weapon preparation modes. /**
* * Process combat abilities based on weapon preparation modes.
* @param attacker The player attacking *
*/ * @param attacker The player attacking
public static void combatAbilityChecks(Player attacker) { */
PlayerProfile PPa = Users.getProfile(attacker); public static void combatAbilityChecks(Player attacker) {
PlayerProfile PPa = Users.getProfile(attacker);
if (PPa.getToolPreparationMode(ToolType.AXE)) {
Skills.abilityCheck(attacker, SkillType.AXES); if (PPa.getToolPreparationMode(ToolType.AXE)) {
} Skills.abilityCheck(attacker, SkillType.AXES);
else if (PPa.getToolPreparationMode(ToolType.SWORD)) { }
Skills.abilityCheck(attacker, SkillType.SWORDS); else if (PPa.getToolPreparationMode(ToolType.SWORD)) {
} Skills.abilityCheck(attacker, SkillType.SWORDS);
else if (PPa.getToolPreparationMode(ToolType.FISTS)) { }
Skills.abilityCheck(attacker, SkillType.UNARMED); else if (PPa.getToolPreparationMode(ToolType.FISTS)) {
} Skills.abilityCheck(attacker, SkillType.UNARMED);
} }
}
/**
* Process archery abilities. /**
* * Process archery abilities.
* @param event The event to run the archery checks on. *
* @param pluginx mcMMO plugin instance * @param event The event to run the archery checks on.
*/ * @param pluginx mcMMO plugin instance
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx) { */
Arrow arrow = (Arrow) event.getDamager(); public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx) {
LivingEntity shooter = arrow.getShooter(); Arrow arrow = (Arrow) event.getDamager();
LivingEntity target = (LivingEntity) event.getEntity(); LivingEntity shooter = arrow.getShooter();
LivingEntity target = (LivingEntity) event.getEntity();
if (target instanceof Player) {
Player defender = (Player) target; if (target instanceof Player) {
Player defender = (Player) target;
if (mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
Unarmed.deflectCheck(defender, event); if (Permissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
} Unarmed.deflectCheck(defender, event);
} }
}
if (shooter instanceof Player) {
Player attacker = (Player) shooter; if (shooter instanceof Player) {
PlayerProfile PPa = Users.getProfile(attacker); Player attacker = (Player) shooter;
int damage = event.getDamage(); PlayerProfile PPa = Users.getProfile(attacker);
int damage = event.getDamage();
if (mcPermissions.getInstance().archery(attacker) && damage > 0) {
if (Permissions.getInstance().archery(attacker) && damage > 0) {
/*Archery needs a damage bonus to be viable in PVP*/
int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY); /*Archery needs a damage bonus to be viable in PVP*/
double dmgBonusPercent = ((skillLvl / 50) * 0.1D); int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
double dmgBonusPercent = ((skillLvl / 50) * 0.1D);
/* Cap maximum bonus at 200% */
if(dmgBonusPercent > 2) /* Cap maximum bonus at 200% */
dmgBonusPercent = 2; if(dmgBonusPercent > 2)
dmgBonusPercent = 2;
/* Every 100 skill levels Archery gains 20% damage bonus, set that here */
//TODO: Work in progress for balancing out Archery, will work on it more later... /* Every 100 skill levels Archery gains 20% damage bonus, set that here */
//TODO: Right now this is calculating a 10% bonus every 50 levels, not 20% every 100. Is this intended? //TODO: Work in progress for balancing out Archery, will work on it more later...
int archeryBonus = (int)(event.getDamage() * dmgBonusPercent); //TODO: Right now this is calculating a 10% bonus every 50 levels, not 20% every 100. Is this intended?
event.setDamage(event.getDamage() + archeryBonus); int archeryBonus = (int)(event.getDamage() * dmgBonusPercent);
event.setDamage(event.getDamage() + archeryBonus);
if (mcPermissions.getInstance().trackArrows(attacker)) {
Archery.trackArrows(pluginx, target, PPa); if (Permissions.getInstance().trackArrows(attacker)) {
} Archery.trackArrows(pluginx, target, PPa);
}
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
if (target instanceof Player) {
Player defender = (Player) target; if (target instanceof Player) {
PlayerProfile PPd = Users.getProfile(defender); Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender);
if (PPa.inParty() && PPd.inParty() && Party.getInstance().inSameParty(defender, attacker)) {
event.setCancelled(true); if (PPa.inParty() && PPd.inParty() && Party.getInstance().inSameParty(defender, attacker)) {
return; event.setCancelled(true);
} return;
}
Archery.dazeCheck(defender, attacker);
} Archery.dazeCheck(defender, attacker);
} }
} }
} }
}
/**
* Attempt to damage target for value dmg with reason CUSTOM /**
* * Attempt to damage target for value dmg with reason CUSTOM
* @param target LivingEntity which to attempt to damage *
* @param dmg Amount of damage to attempt to do * @param target LivingEntity which to attempt to damage
*/ * @param dmg Amount of damage to attempt to do
public static void dealDamage(LivingEntity target, int dmg) { */
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM); public static void dealDamage(LivingEntity target, int dmg) {
} dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
}
/**
* Attempt to damage target for value dmg with reason cause /**
* * Attempt to damage target for value dmg with reason cause
* @param target LivingEntity which to attempt to damage *
* @param dmg Amount of damage to attempt to do * @param target LivingEntity which to attempt to damage
* @param cause DamageCause to pass to damage event * @param dmg Amount of damage to attempt to do
*/ * @param cause DamageCause to pass to damage event
private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) { */
if (Config.getInstance().getEventCallbackEnabled()) { private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg); if (Config.getInstance().getEventCallbackEnabled()) {
mcMMO.p.getServer().getPluginManager().callEvent(ede); EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
mcMMO.p.getServer().getPluginManager().callEvent(ede);
if (ede.isCancelled()) {
return; if (ede.isCancelled()) {
} return;
}
target.damage(ede.getDamage());
} target.damage(ede.getDamage());
else { }
target.damage(dmg); else {
} target.damage(dmg);
} }
}
/**
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker /**
* * Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
* @param target LivingEntity which to attempt to damage *
* @param dmg Amount of damage to attempt to do * @param target LivingEntity which to attempt to damage
* @param attacker Player to pass to event as damager * @param dmg Amount of damage to attempt to do
*/ * @param attacker Player to pass to event as damager
private static void dealDamage(LivingEntity target, int dmg, Player attacker) { */
if (Config.getInstance().getEventCallbackEnabled()) { private static void dealDamage(LivingEntity target, int dmg, Player attacker) {
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg); if (Config.getInstance().getEventCallbackEnabled()) {
mcMMO.p.getServer().getPluginManager().callEvent(ede); EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
mcMMO.p.getServer().getPluginManager().callEvent(ede);
if (ede.isCancelled()) {
return; if (ede.isCancelled()) {
} return;
}
target.damage(ede.getDamage());
} target.damage(ede.getDamage());
else { }
target.damage(dmg); else {
} target.damage(dmg);
} }
}
/**
* Apply Area-of-Effect ability actions. /**
* * Apply Area-of-Effect ability actions.
* @param attacker The attacking player *
* @param target The defending entity * @param attacker The attacking player
* @param damage The initial damage amount * @param target The defending entity
* @param plugin mcMMO plugin instance * @param damage The initial damage amount
* @param type The type of skill being used * @param plugin mcMMO plugin instance
*/ * @param type The type of skill being used
private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, mcMMO plugin, SkillType type) { */
int numberOfTargets = m.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, mcMMO plugin, SkillType type) {
int damageAmount = 0; int numberOfTargets = Misc.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
int damageAmount = 0;
if (type.equals(SkillType.AXES)) {
damageAmount = damage / 2; if (type.equals(SkillType.AXES)) {
} damageAmount = damage / 2;
else if (type.equals(SkillType.SWORDS)) { }
damageAmount = damage / 4; else if (type.equals(SkillType.SWORDS)) {
} damageAmount = damage / 4;
}
if (damageAmount < 1) {
damageAmount = 1; if (damageAmount < 1) {
} damageAmount = 1;
}
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
EntityType entityType = entity.getType(); for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
EntityType entityType = entity.getType();
if (entityType.equals(EntityType.WOLF)) {
Wolf wolf = (Wolf) entity; if (entityType.equals(EntityType.WOLF)) {
AnimalTamer tamer = wolf.getOwner(); Wolf wolf = (Wolf) entity;
AnimalTamer tamer = wolf.getOwner();
if (tamer instanceof Player) {
Player owner = (Player) tamer; if (tamer instanceof Player) {
Player owner = (Player) tamer;
if (owner.equals(attacker) || Party.getInstance().inSameParty(attacker, owner)) {
continue; if (owner.equals(attacker) || Party.getInstance().inSameParty(attacker, owner)) {
} continue;
} }
} }
}
if (entity instanceof LivingEntity && numberOfTargets >= 1) {
if (entityType.equals(EntityType.PLAYER)) { if (entity instanceof LivingEntity && numberOfTargets >= 1) {
Player defender = (Player) entity; if (entityType.equals(EntityType.PLAYER)) {
PlayerProfile PP = Users.getProfile(defender); Player defender = (Player) entity;
PlayerProfile PP = Users.getProfile(defender);
//Reasons why the target shouldn't be hit
if (PP.getGodMode()) { //Reasons why the target shouldn't be hit
continue; if (PP.getGodMode()) {
} continue;
}
if (defender.getName().equals(attacker.getName())) { //Is this even possible?
continue; if (defender.getName().equals(attacker.getName())) { //Is this even possible?
} continue;
}
if (Party.getInstance().inSameParty(attacker, defender)) {
continue; if (Party.getInstance().inSameParty(attacker, defender)) {
} continue;
}
if (defender.isDead()) {
continue; if (defender.isDead()) {
} continue;
}
//Apply effect to players only if PVP is enabled
if (target.getWorld().getPVP()) { //Apply effect to players only if PVP is enabled
String message = ""; if (target.getWorld().getPVP()) {
String message = "";
if (type.equals(SkillType.AXES)) {
message = mcLocale.getString("Axes.Combat.Cleave.Struck"); if (type.equals(SkillType.AXES)) {
} message = LocaleLoader.getString("Axes.Combat.Cleave.Struck");
else if (type.equals(SkillType.SWORDS)) { }
message = mcLocale.getString("Swords.Combat.SS.Struck"); else if (type.equals(SkillType.SWORDS)) {
} message = LocaleLoader.getString("Swords.Combat.SS.Struck");
}
dealDamage(defender, damageAmount, attacker);
defender.sendMessage(message); dealDamage(defender, damageAmount, attacker);
defender.sendMessage(message);
if (type.equals(SkillType.SWORDS)) {
PP.addBleedTicks(5); if (type.equals(SkillType.SWORDS)) {
} PP.addBleedTicks(5);
}
numberOfTargets--;
} numberOfTargets--;
} }
else { }
LivingEntity livingEntity = (LivingEntity) entity; else {
LivingEntity livingEntity = (LivingEntity) entity;
if (type.equals(SkillType.SWORDS)) {
mcBleedTimer.add(livingEntity); if (type.equals(SkillType.SWORDS)) {
} BleedTimer.add(livingEntity);
}
dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--; dealDamage(livingEntity, damageAmount, attacker);
} numberOfTargets--;
} }
} }
} }
}
/**
* Start the task that gives combat XP. /**
* * Start the task that gives combat XP.
* @param attacker The attacking player *
* @param PP The player's PlayerProfile * @param attacker The attacking player
* @param target The defending entity * @param PP The player's PlayerProfile
* @param skillType The skill being used * @param target The defending entity
* @param plugin mcMMO plugin instance * @param skillType The skill being used
*/ * @param plugin mcMMO plugin instance
public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType, mcMMO pluginx) { */
double baseXP = 0; public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType, mcMMO pluginx) {
double baseXP = 0;
if (target instanceof Player) {
if (!Config.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) { if (target instanceof Player) {
return; if (!Config.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) {
} return;
}
Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender); Player defender = (Player) target;
PlayerProfile PPd = Users.getProfile(defender);
if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) {
baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP(); if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) {
} baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP();
} }
else if (!target.hasMetadata("mcmmoFromMobSpawner")) { }
if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) { else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
baseXP = Config.getInstance().getAnimalsXP(); if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) {
} baseXP = Config.getInstance().getAnimalsXP();
else { }
EntityType type = target.getType(); else {
EntityType type = target.getType();
switch (type) {
case BLAZE: switch (type) {
baseXP = Config.getInstance().getBlazeXP(); case BLAZE:
break; baseXP = Config.getInstance().getBlazeXP();
break;
case CAVE_SPIDER:
baseXP = Config.getInstance().getCaveSpiderXP(); case CAVE_SPIDER:
break; baseXP = Config.getInstance().getCaveSpiderXP();
break;
case CREEPER:
baseXP = Config.getInstance().getCreeperXP(); case CREEPER:
break; baseXP = Config.getInstance().getCreeperXP();
break;
case ENDER_DRAGON:
baseXP = Config.getInstance().getEnderDragonXP(); case ENDER_DRAGON:
break; baseXP = Config.getInstance().getEnderDragonXP();
break;
case ENDERMAN:
baseXP = Config.getInstance().getEndermanXP(); case ENDERMAN:
break; baseXP = Config.getInstance().getEndermanXP();
break;
case GHAST:
baseXP = Config.getInstance().getGhastXP(); case GHAST:
break; baseXP = Config.getInstance().getGhastXP();
break;
case MAGMA_CUBE:
baseXP = Config.getInstance().getMagmaCubeXP(); case MAGMA_CUBE:
break; baseXP = Config.getInstance().getMagmaCubeXP();
break;
case IRON_GOLEM:
if (!((IronGolem) target).isPlayerCreated()) case IRON_GOLEM:
baseXP = Config.getInstance().getIronGolemXP(); if (!((IronGolem) target).isPlayerCreated())
break; baseXP = Config.getInstance().getIronGolemXP();
break;
case PIG_ZOMBIE:
baseXP = Config.getInstance().getPigZombieXP(); case PIG_ZOMBIE:
break; baseXP = Config.getInstance().getPigZombieXP();
break;
case SILVERFISH:
baseXP = Config.getInstance().getSilverfishXP(); case SILVERFISH:
break; baseXP = Config.getInstance().getSilverfishXP();
break;
case SKELETON:
baseXP = Config.getInstance().getSkeletonXP(); case SKELETON:
break; baseXP = Config.getInstance().getSkeletonXP();
break;
case SLIME:
baseXP = Config.getInstance().getSlimeXP(); case SLIME:
break; baseXP = Config.getInstance().getSlimeXP();
break;
case SPIDER:
baseXP = Config.getInstance().getSpiderXP(); case SPIDER:
break; baseXP = Config.getInstance().getSpiderXP();
break;
case ZOMBIE:
baseXP = Config.getInstance().getZombieXP(); case ZOMBIE:
break; baseXP = Config.getInstance().getZombieXP();
break;
default:
break; default:
} break;
} }
}
baseXP *= 10;
} baseXP *= 10;
}
if (baseXP != 0) {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(pluginx, new GainXp(attacker, PP, skillType, baseXP, target), 0); if (baseXP != 0) {
} mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(pluginx, new GainXp(attacker, PP, skillType, baseXP, target), 0);
} }
} }
}

View File

@ -1,294 +1,295 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.util.HashMap; import java.util.HashMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.DatabaseUpdate; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.runnables.SQLReconnect; import com.gmail.nossr50.datatypes.DatabaseUpdate;
import com.gmail.nossr50.runnables.SQLReconnect;
public class Database {
public class Database {
private static String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName() + "?user=" + Config.getInstance().getMySQLUserName() + "&password=" + Config.getInstance().getMySQLUserPassword();
private static String tablePrefix = Config.getInstance().getMySQLTablePrefix(); private static String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName() + "?user=" + Config.getInstance().getMySQLUserName() + "&password=" + Config.getInstance().getMySQLUserPassword();
private static Connection conn = null; private static String tablePrefix = Config.getInstance().getMySQLTablePrefix();
private static mcMMO plugin = null; private static Connection conn = null;
private static long reconnectTimestamp = 0; private static mcMMO plugin = null;
private static long reconnectTimestamp = 0;
public Database(mcMMO instance) {
plugin = instance; public Database(mcMMO instance) {
connect(); //Connect to MySQL plugin = instance;
connect(); //Connect to MySQL
// Load the driver instance
try { // Load the driver instance
Class.forName("com.mysql.jdbc.Driver"); try {
DriverManager.getConnection(connectionString); Class.forName("com.mysql.jdbc.Driver");
} DriverManager.getConnection(connectionString);
catch (ClassNotFoundException e) { }
plugin.getLogger().warning(e.getLocalizedMessage()); catch (ClassNotFoundException e) {
} plugin.getLogger().warning(e.getLocalizedMessage());
catch (SQLException ex) { }
plugin.getLogger().warning(ex.getLocalizedMessage()); catch (SQLException ex) {
printErrors(ex); plugin.getLogger().warning(ex.getLocalizedMessage());
} printErrors(ex);
} }
}
/**
* Attempt to connect to the mySQL database. /**
*/ * Attempt to connect to the mySQL database.
public static void connect() { */
try { public static void connect() {
System.out.println("[mcMMO] Attempting connection to MySQL..."); try {
Properties conProperties = new Properties(); System.out.println("[mcMMO] Attempting connection to MySQL...");
conProperties.put("autoReconnect", "false"); Properties conProperties = new Properties();
conProperties.put("maxReconnects", "0"); conProperties.put("autoReconnect", "false");
conn = DriverManager.getConnection(connectionString, conProperties); conProperties.put("maxReconnects", "0");
System.out.println("[mcMMO] Connection to MySQL was a success!"); conn = DriverManager.getConnection(connectionString, conProperties);
} System.out.println("[mcMMO] Connection to MySQL was a success!");
catch (SQLException ex) { }
System.out.println("[mcMMO] Connection to MySQL failed!"); catch (SQLException ex) {
ex.printStackTrace(); System.out.println("[mcMMO] Connection to MySQL failed!");
printErrors(ex); ex.printStackTrace();
} printErrors(ex);
} }
}
/**
* Attempt to create the database structure. /**
*/ * Attempt to create the database structure.
public void createStructure() { */
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL," public void createStructure() {
+ "`hudtype` varchar(50) NOT NULL DEFAULT ''," write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + "`hudtype` varchar(50) NOT NULL DEFAULT '',"
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
+ "`user` varchar(40) NOT NULL," write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
+ "`lastlogin` int(32) unsigned NOT NULL," + "`user` varchar(40) NOT NULL,"
+ "`party` varchar(100) NOT NULL DEFAULT ''," + "`lastlogin` int(32) unsigned NOT NULL,"
+ "PRIMARY KEY (`id`)," + "`party` varchar(100) NOT NULL DEFAULT '',"
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"); + "PRIMARY KEY (`id`),"
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL," + "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0'," write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL,"
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0'," + "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0'," + "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0'," + "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0'," + "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0'," + "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0'," + "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0'," + "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0'," + "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0'," + "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0'," write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL,"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0'," + "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," + "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0'," + "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0'," + "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0'," + "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0'," + "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0'," + "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0'," write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL,"
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0'," + "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," + "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0'," + "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0'," + "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0'," + "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0'," + "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0'," + "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
checkDatabaseStructure(DatabaseUpdate.FISHING);
checkDatabaseStructure(DatabaseUpdate.BLAST_MINING); checkDatabaseStructure(DatabaseUpdate.FISHING);
} checkDatabaseStructure(DatabaseUpdate.BLAST_MINING);
}
/**
* Check database structure for missing values. /**
* * Check database structure for missing values.
* @param update Type of data to check updates for *
*/ * @param update Type of data to check updates for
public void checkDatabaseStructure(DatabaseUpdate update) { */
String sql = null; public void checkDatabaseStructure(DatabaseUpdate update) {
ResultSet rs = null; String sql = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>(); ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
switch (update) {
case BLAST_MINING: switch (update) {
sql = "SELECT * FROM `"+tablePrefix+"cooldowns` ORDER BY `"+tablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30"; case BLAST_MINING:
break; sql = "SELECT * FROM `"+tablePrefix+"cooldowns` ORDER BY `"+tablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
case FISHING: break;
sql = "SELECT * FROM `"+tablePrefix+"experience` ORDER BY `"+tablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30"; case FISHING:
break; sql = "SELECT * FROM `"+tablePrefix+"experience` ORDER BY `"+tablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
default: break;
break; default:
} break;
}
try {
PreparedStatement stmt = conn.prepareStatement(sql); try {
if (stmt.executeQuery() != null) { PreparedStatement stmt = conn.prepareStatement(sql);
stmt.executeQuery(); if (stmt.executeQuery() != null) {
rs = stmt.getResultSet(); stmt.executeQuery();
while (rs.next()) { rs = stmt.getResultSet();
ArrayList<String> Col = new ArrayList<String>(); while (rs.next()) {
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { ArrayList<String> Col = new ArrayList<String>();
Col.add(rs.getString(i)); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
} Col.add(rs.getString(i));
Rows.put(rs.getRow(), Col); }
} Rows.put(rs.getRow(), Col);
} }
} }
catch (SQLException ex) { }
if (update.equals(DatabaseUpdate.BLAST_MINING)) { catch (SQLException ex) {
System.out.println("Updating mcMMO MySQL tables for Blast Mining..."); if (update.equals(DatabaseUpdate.BLAST_MINING)) {
write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;"); System.out.println("Updating mcMMO MySQL tables for Blast Mining...");
} write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
else if (update.equals(DatabaseUpdate.FISHING)) { }
System.out.println("Updating mcMMO MySQL tables for Fishing..."); else if (update.equals(DatabaseUpdate.FISHING)) {
write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); System.out.println("Updating mcMMO MySQL tables for Fishing...");
write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
} write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
} }
} }
}
/**
* Attempt to write the SQL query. /**
* * Attempt to write the SQL query.
* @param sql Query to write. *
* @return true if the query was successfully written, false otherwise. * @param sql Query to write.
*/ * @return true if the query was successfully written, false otherwise.
public boolean write(String sql) { */
if (isConnected()) { public boolean write(String sql) {
try { if (isConnected()) {
PreparedStatement stmt = conn.prepareStatement(sql); try {
stmt.executeUpdate(); PreparedStatement stmt = conn.prepareStatement(sql);
return true; stmt.executeUpdate();
} return true;
catch (SQLException ex) { }
printErrors(ex); catch (SQLException ex) {
return false; printErrors(ex);
} return false;
} }
else { }
attemptReconnect(); else {
} attemptReconnect();
return false; }
} return false;
}
/**
* Get the Integer. Only return first row / first field. /**
* * Get the Integer. Only return first row / first field.
* @param sql SQL query to execute *
* @return the value in the first row / first field * @param sql SQL query to execute
*/ * @return the value in the first row / first field
public Integer getInt(String sql) { */
ResultSet rs = null; public Integer getInt(String sql) {
Integer result = 0; ResultSet rs = null;
Integer result = 0;
if (isConnected()) {
try { if (isConnected()) {
PreparedStatement stmt = conn.prepareStatement(sql); try {
stmt = conn.prepareStatement(sql); PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) { stmt = conn.prepareStatement(sql);
stmt.executeQuery(); if (stmt.executeQuery() != null) {
rs = stmt.getResultSet(); stmt.executeQuery();
if (rs.next()) { rs = stmt.getResultSet();
result = rs.getInt(1); if (rs.next()) {
} result = rs.getInt(1);
else { }
result = 0; else {
} result = 0;
} }
} }
catch (SQLException ex) { }
printErrors(ex); catch (SQLException ex) {
} printErrors(ex);
} }
else { }
attemptReconnect(); else {
} attemptReconnect();
return result; }
} return result;
}
/**
* Get connection status /**
* * Get connection status
* @return the boolean value for whether or not we are connected *
*/ * @return the boolean value for whether or not we are connected
public static boolean isConnected() { */
if(conn == null) public static boolean isConnected() {
return false; if(conn == null)
return false;
try {
return conn.isValid(3); try {
} catch (SQLException e) { return conn.isValid(3);
return false; } catch (SQLException e) {
} return false;
} }
}
/**
* Schedules a Sync Delayed Task with the Bukkit Scheduler to attempt reconnection after a minute has elapsed /**
* This will check for a connection being present or not to prevent unneeded reconnection attempts * Schedules a Sync Delayed Task with the Bukkit Scheduler to attempt reconnection after a minute has elapsed
*/ * This will check for a connection being present or not to prevent unneeded reconnection attempts
public static void attemptReconnect() { */
if(reconnectTimestamp + 60000 < System.currentTimeMillis()) { public static void attemptReconnect() {
System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds..."); //Only reconnect if another attempt hasn't been made recently if(reconnectTimestamp + 60000 < System.currentTimeMillis()) {
reconnectTimestamp = System.currentTimeMillis(); System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds..."); //Only reconnect if another attempt hasn't been made recently
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new SQLReconnect(plugin), 1200); reconnectTimestamp = System.currentTimeMillis();
} plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new SQLReconnect(plugin), 1200);
} }
}
/**
* Read SQL query. /**
* * Read SQL query.
* @param sql SQL query to read *
* @return the rows in this SQL query * @param sql SQL query to read
*/ * @return the rows in this SQL query
public HashMap<Integer, ArrayList<String>> read(String sql) { */
ResultSet rs = null; public HashMap<Integer, ArrayList<String>> read(String sql) {
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>(); ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
if (isConnected()) {
try { if (isConnected()) {
PreparedStatement stmt = conn.prepareStatement(sql); try {
if (stmt.executeQuery() != null) { PreparedStatement stmt = conn.prepareStatement(sql);
stmt.executeQuery(); if (stmt.executeQuery() != null) {
rs = stmt.getResultSet(); stmt.executeQuery();
while (rs.next()) { rs = stmt.getResultSet();
ArrayList<String> Col = new ArrayList<String>(); while (rs.next()) {
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { ArrayList<String> Col = new ArrayList<String>();
Col.add(rs.getString(i)); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
} Col.add(rs.getString(i));
Rows.put(rs.getRow(), Col); }
} Rows.put(rs.getRow(), Col);
} }
} }
catch (SQLException ex) { }
printErrors(ex); catch (SQLException ex) {
} printErrors(ex);
} }
else { }
attemptReconnect(); else {
} attemptReconnect();
return Rows; }
} return Rows;
}
private static void printErrors(SQLException ex) {
System.out.println("SQLException: " + ex.getMessage()); private static void printErrors(SQLException ex) {
System.out.println("SQLState: " + ex.getSQLState()); System.out.println("SQLException: " + ex.getMessage());
System.out.println("VendorError: " + ex.getErrorCode()); System.out.println("SQLState: " + ex.getSQLState());
} System.out.println("VendorError: " + ex.getErrorCode());
}
} }

View File

@ -1,64 +1,64 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
public class Item { public class Item {
/** /**
* Check for item usage. * Check for item usage.
* *
* @param player Player whose item usage to check * @param player Player whose item usage to check
*/ */
public static void itemchecks(Player player) { public static void itemchecks(Player player) {
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
if (Config.getInstance().getChimaeraEnabled() && inhand.getTypeId() == Config.getInstance().getChimaeraItemId()) { if (Config.getInstance().getChimaeraEnabled() && inhand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
chimaerawing(player); chimaerawing(player);
} }
} }
private static void chimaerawing(Player player) { private static void chimaerawing(Player player) {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
int amount = is.getAmount(); int amount = is.getAmount();
if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.getInstance().getChimaeraItemId()) { if (Permissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.getInstance().getChimaeraItemId()) {
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) { if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) {
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost())); player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) { for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) { if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
player.sendMessage(mcLocale.getString("Item.ChimaeraWing.Fail")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.teleport(block.getRelative(0, y - 1, 0).getLocation()); player.teleport(block.getRelative(0, y - 1, 0).getLocation());
return; return;
} }
} }
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) { if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) {
player.teleport(player.getBedSpawnLocation()); player.teleport(player.getBedSpawnLocation());
} }
else { else {
player.teleport(player.getWorld().getSpawnLocation()); player.teleport(player.getWorld().getSpawnLocation());
} }
player.sendMessage(mcLocale.getString("Item.ChimaeraWing.Pass")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
} }
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.getInstance().getChimaeraCost()) { else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.getInstance().getChimaeraCost()) {
player.sendMessage(mcLocale.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)})); player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
} }
else if (is.getAmount() <= Config.getInstance().getChimaeraCost()) { else if (is.getAmount() <= Config.getInstance().getChimaeraCost()) {
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getChimaeraItemId())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getChimaeraItemId()));
} }
} }
} }
} }

View File

@ -1,398 +1,398 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class ItemChecks { public class ItemChecks {
/** /**
* Checks if the item is a sword. * Checks if the item is a sword.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a sword, false otherwise * @return true if the item is a sword, false otherwise
*/ */
public static boolean isSword(ItemStack is) { public static boolean isSword(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_SWORD: case DIAMOND_SWORD:
case GOLD_SWORD: case GOLD_SWORD:
case IRON_SWORD: case IRON_SWORD:
case STONE_SWORD: case STONE_SWORD:
case WOOD_SWORD: case WOOD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a hoe. * Checks if the item is a hoe.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a hoe, false otherwise * @return true if the item is a hoe, false otherwise
*/ */
public static boolean isHoe(ItemStack is) { public static boolean isHoe(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_HOE: case DIAMOND_HOE:
case GOLD_HOE: case GOLD_HOE:
case IRON_HOE: case IRON_HOE:
case STONE_HOE: case STONE_HOE:
case WOOD_HOE: case WOOD_HOE:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a shovel. * Checks if the item is a shovel.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a shovel, false otherwise * @return true if the item is a shovel, false otherwise
*/ */
public static boolean isShovel(ItemStack is) { public static boolean isShovel(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_SPADE: case DIAMOND_SPADE:
case GOLD_SPADE: case GOLD_SPADE:
case IRON_SPADE: case IRON_SPADE:
case STONE_SPADE: case STONE_SPADE:
case WOOD_SPADE: case WOOD_SPADE:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is an axe. * Checks if the item is an axe.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is an axe, false otherwise * @return true if the item is an axe, false otherwise
*/ */
public static boolean isAxe(ItemStack is) { public static boolean isAxe(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_AXE: case DIAMOND_AXE:
case GOLD_AXE: case GOLD_AXE:
case IRON_AXE: case IRON_AXE:
case STONE_AXE: case STONE_AXE:
case WOOD_AXE: case WOOD_AXE:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a pickaxe. * Checks if the item is a pickaxe.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a pickaxe, false otherwise * @return true if the item is a pickaxe, false otherwise
*/ */
public static boolean isMiningPick(ItemStack is) { public static boolean isMiningPick(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_PICKAXE: case DIAMOND_PICKAXE:
case GOLD_PICKAXE: case GOLD_PICKAXE:
case IRON_PICKAXE: case IRON_PICKAXE:
case STONE_PICKAXE: case STONE_PICKAXE:
case WOOD_PICKAXE: case WOOD_PICKAXE:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a helmet. * Checks if the item is a helmet.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a helmet, false otherwise * @return true if the item is a helmet, false otherwise
*/ */
public static boolean isHelmet(ItemStack is) { public static boolean isHelmet(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_HELMET: case DIAMOND_HELMET:
case GOLD_HELMET: case GOLD_HELMET:
case IRON_HELMET: case IRON_HELMET:
case LEATHER_HELMET: case LEATHER_HELMET:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a chestplate. * Checks if the item is a chestplate.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a chestplate, false otherwise * @return true if the item is a chestplate, false otherwise
*/ */
public static boolean isChestplate(ItemStack is) { public static boolean isChestplate(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_CHESTPLATE: case DIAMOND_CHESTPLATE:
case GOLD_CHESTPLATE: case GOLD_CHESTPLATE:
case IRON_CHESTPLATE: case IRON_CHESTPLATE:
case LEATHER_CHESTPLATE: case LEATHER_CHESTPLATE:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a pair of pants. * Checks if the item is a pair of pants.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a pair of pants, false otherwise * @return true if the item is a pair of pants, false otherwise
*/ */
public static boolean isPants(ItemStack is) { public static boolean isPants(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_LEGGINGS: case DIAMOND_LEGGINGS:
case GOLD_LEGGINGS: case GOLD_LEGGINGS:
case IRON_LEGGINGS: case IRON_LEGGINGS:
case LEATHER_LEGGINGS: case LEATHER_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks if the item is a pair of boots. * Checks if the item is a pair of boots.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a pair of boots, false otherwise * @return true if the item is a pair of boots, false otherwise
*/ */
public static boolean isBoots(ItemStack is) { public static boolean isBoots(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_BOOTS: case DIAMOND_BOOTS:
case GOLD_BOOTS: case GOLD_BOOTS:
case IRON_BOOTS: case IRON_BOOTS:
case LEATHER_BOOTS: case LEATHER_BOOTS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a wearable armor piece. * Checks to see if an item is a wearable armor piece.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is armor, false otherwise * @return true if the item is armor, false otherwise
*/ */
public static boolean isArmor(ItemStack is) { public static boolean isArmor(ItemStack is) {
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is); return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
} }
/** /**
* Checks to see if an item is a leather armor piece. * Checks to see if an item is a leather armor piece.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is leather armor, false otherwise * @return true if the item is leather armor, false otherwise
*/ */
public static boolean isLeatherArmor(ItemStack is) { public static boolean isLeatherArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case LEATHER_BOOTS: case LEATHER_BOOTS:
case LEATHER_CHESTPLATE: case LEATHER_CHESTPLATE:
case LEATHER_HELMET: case LEATHER_HELMET:
case LEATHER_LEGGINGS: case LEATHER_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a gold armor piece. * Checks to see if an item is a gold armor piece.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is gold armor, false otherwise * @return true if the item is gold armor, false otherwise
*/ */
public static boolean isGoldArmor(ItemStack is) { public static boolean isGoldArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case GOLD_BOOTS: case GOLD_BOOTS:
case GOLD_CHESTPLATE: case GOLD_CHESTPLATE:
case GOLD_HELMET: case GOLD_HELMET:
case GOLD_LEGGINGS: case GOLD_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is an iron armor piece. * Checks to see if an item is an iron armor piece.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is iron armor, false otherwise * @return true if the item is iron armor, false otherwise
*/ */
public static boolean isIronArmor(ItemStack is) { public static boolean isIronArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case IRON_BOOTS: case IRON_BOOTS:
case IRON_CHESTPLATE: case IRON_CHESTPLATE:
case IRON_HELMET: case IRON_HELMET:
case IRON_LEGGINGS: case IRON_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a diamond armor piece. * Checks to see if an item is a diamond armor piece.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is diamond armor, false otherwise * @return true if the item is diamond armor, false otherwise
*/ */
public static boolean isDiamondArmor(ItemStack is) { public static boolean isDiamondArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_BOOTS: case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE: case DIAMOND_CHESTPLATE:
case DIAMOND_HELMET: case DIAMOND_HELMET:
case DIAMOND_LEGGINGS: case DIAMOND_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a tool. * Checks to see if an item is a tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a tool, false otherwise * @return true if the item is a tool, false otherwise
*/ */
public static boolean isTool(ItemStack is) { public static boolean isTool(ItemStack is) {
return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is); return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is);
} }
/** /**
* Checks to see if an item is a stone tool. * Checks to see if an item is a stone tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a stone tool, false otherwise * @return true if the item is a stone tool, false otherwise
*/ */
public static boolean isStoneTool(ItemStack is) { public static boolean isStoneTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case STONE_AXE: case STONE_AXE:
case STONE_HOE: case STONE_HOE:
case STONE_PICKAXE: case STONE_PICKAXE:
case STONE_SPADE: case STONE_SPADE:
case STONE_SWORD: case STONE_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a wooden tool. * Checks to see if an item is a wooden tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a wooden tool, false otherwise * @return true if the item is a wooden tool, false otherwise
*/ */
public static boolean isWoodTool(ItemStack is) { public static boolean isWoodTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case WOOD_AXE: case WOOD_AXE:
case WOOD_HOE: case WOOD_HOE:
case WOOD_PICKAXE: case WOOD_PICKAXE:
case WOOD_SPADE: case WOOD_SPADE:
case WOOD_SWORD: case WOOD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a string tool. * Checks to see if an item is a string tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a string tool, false otherwise * @return true if the item is a string tool, false otherwise
*/ */
public static boolean isStringTool(ItemStack is) { public static boolean isStringTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case BOW: case BOW:
case FISHING_ROD: case FISHING_ROD:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a gold tool. * Checks to see if an item is a gold tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a stone tool, false otherwise * @return true if the item is a stone tool, false otherwise
*/ */
public static boolean isGoldTool(ItemStack is) { public static boolean isGoldTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case GOLD_AXE: case GOLD_AXE:
case GOLD_HOE: case GOLD_HOE:
case GOLD_PICKAXE: case GOLD_PICKAXE:
case GOLD_SPADE: case GOLD_SPADE:
case GOLD_SWORD: case GOLD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is an iron tool. * Checks to see if an item is an iron tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is an iron tool, false otherwise * @return true if the item is an iron tool, false otherwise
*/ */
public static boolean isIronTool(ItemStack is) { public static boolean isIronTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case IRON_AXE: case IRON_AXE:
case IRON_HOE: case IRON_HOE:
case IRON_PICKAXE: case IRON_PICKAXE:
case IRON_SPADE: case IRON_SPADE:
case IRON_SWORD: case IRON_SWORD:
case SHEARS: case SHEARS:
return true; return true;
default: default:
return false; return false;
} }
} }
/** /**
* Checks to see if an item is a diamond tool. * Checks to see if an item is a diamond tool.
* *
* @param is Item to check * @param is Item to check
* @return true if the item is a diamond tool, false otherwise * @return true if the item is a diamond tool, false otherwise
*/ */
public static boolean isDiamondTool(ItemStack is) { public static boolean isDiamondTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_AXE: case DIAMOND_AXE:
case DIAMOND_HOE: case DIAMOND_HOE:
case DIAMOND_PICKAXE: case DIAMOND_PICKAXE:
case DIAMOND_SPADE: case DIAMOND_SPADE:
case DIAMOND_SWORD: case DIAMOND_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
} }

View File

@ -1,300 +1,301 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerStat; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.Tree; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.Tree;
public class Leaderboard {
private static String leaderboardsDirectory = mcMMO.leaderboardDirectory; public class Leaderboard {
private static String location = mcMMO.usersFile; private static String leaderboardsDirectory = mcMMO.leaderboardDirectory;
private static mcMMO plugin = mcMMO.p; private static String location = mcMMO.usersFile;
private static mcMMO plugin = mcMMO.p;
/**
* Create the leaderboards. /**
*/ * Create the leaderboards.
public static void makeLeaderboards() { */
//Make Trees public static void makeLeaderboards() {
Tree Mining = new Tree(); //Make Trees
Tree WoodCutting = new Tree(); Tree Mining = new Tree();
Tree Herbalism = new Tree(); Tree WoodCutting = new Tree();
Tree Excavation = new Tree(); Tree Herbalism = new Tree();
Tree Acrobatics = new Tree(); Tree Excavation = new Tree();
Tree Repair = new Tree(); Tree Acrobatics = new Tree();
Tree Swords = new Tree(); Tree Repair = new Tree();
Tree Axes = new Tree(); Tree Swords = new Tree();
Tree Archery = new Tree(); Tree Axes = new Tree();
Tree Unarmed = new Tree(); Tree Archery = new Tree();
Tree Taming = new Tree(); Tree Unarmed = new Tree();
Tree Fishing = new Tree(); Tree Taming = new Tree();
Tree PowerLevel = new Tree(); Tree Fishing = new Tree();
Tree PowerLevel = new Tree();
//Add Data To Trees
try { //Add Data To Trees
FileReader file = new FileReader(location); try {
BufferedReader in = new BufferedReader(file); FileReader file = new FileReader(location);
String line = ""; BufferedReader in = new BufferedReader(file);
ArrayList<String> players = new ArrayList<String>(); String line = "";
ArrayList<String> players = new ArrayList<String>();
while ((line = in.readLine()) != null) {
String[] character = line.split(":"); while ((line = in.readLine()) != null) {
String p = character[0]; String[] character = line.split(":");
int powerLevel = 0; String p = character[0];
int powerLevel = 0;
//Prevent the same player from being added multiple times
if (players.contains(p)) { //Prevent the same player from being added multiple times
continue; if (players.contains(p)) {
} continue;
else { }
players.add(p); else {
} players.add(p);
}
if (character.length > 1 && m.isInt(character[1])) {
Mining.add(p, Integer.valueOf(character[1])); if (character.length > 1 && Misc.isInt(character[1])) {
powerLevel += Integer.valueOf(character[1]); Mining.add(p, Integer.valueOf(character[1]));
} powerLevel += Integer.valueOf(character[1]);
}
if (character.length > 5 && m.isInt(character[5])) {
WoodCutting.add(p, Integer.valueOf(character[5])); if (character.length > 5 && Misc.isInt(character[5])) {
powerLevel += Integer.valueOf(character[5]); WoodCutting.add(p, Integer.valueOf(character[5]));
} powerLevel += Integer.valueOf(character[5]);
}
if (character.length > 7 && m.isInt(character[7])) {
Repair.add(p, Integer.valueOf(character[7])); if (character.length > 7 && Misc.isInt(character[7])) {
powerLevel += Integer.valueOf(character[7]); Repair.add(p, Integer.valueOf(character[7]));
} powerLevel += Integer.valueOf(character[7]);
}
if (character.length > 8 && m.isInt(character[8])) {
Unarmed.add(p, Integer.valueOf(character[8])); if (character.length > 8 && Misc.isInt(character[8])) {
powerLevel += Integer.valueOf(character[8]); Unarmed.add(p, Integer.valueOf(character[8]));
} powerLevel += Integer.valueOf(character[8]);
}
if (character.length > 9 && m.isInt(character[9])) {
Herbalism.add(p, Integer.valueOf(character[9])); if (character.length > 9 && Misc.isInt(character[9])) {
powerLevel += Integer.valueOf(character[9]); Herbalism.add(p, Integer.valueOf(character[9]));
} powerLevel += Integer.valueOf(character[9]);
}
if (character.length > 10 && m.isInt(character[10])) {
Excavation.add(p, Integer.valueOf(character[10])); if (character.length > 10 && Misc.isInt(character[10])) {
powerLevel += Integer.valueOf(character[10]); Excavation.add(p, Integer.valueOf(character[10]));
} powerLevel += Integer.valueOf(character[10]);
}
if (character.length > 11 && m.isInt(character[11])) {
Archery.add(p, Integer.valueOf(character[11])); if (character.length > 11 && Misc.isInt(character[11])) {
powerLevel += Integer.valueOf(character[11]); Archery.add(p, Integer.valueOf(character[11]));
} powerLevel += Integer.valueOf(character[11]);
}
if (character.length > 12 && m.isInt(character[12])) {
Swords.add(p, Integer.valueOf(character[12])); if (character.length > 12 && Misc.isInt(character[12])) {
powerLevel += Integer.valueOf(character[12]); Swords.add(p, Integer.valueOf(character[12]));
} powerLevel += Integer.valueOf(character[12]);
}
if (character.length > 13 && m.isInt(character[13])) {
Axes.add(p, Integer.valueOf(character[13])); if (character.length > 13 && Misc.isInt(character[13])) {
powerLevel += Integer.valueOf(character[13]); Axes.add(p, Integer.valueOf(character[13]));
} powerLevel += Integer.valueOf(character[13]);
}
if (character.length > 14 && m.isInt(character[14])) {
Acrobatics.add(p, Integer.valueOf(character[14])); if (character.length > 14 && Misc.isInt(character[14])) {
powerLevel += Integer.valueOf(character[14]); Acrobatics.add(p, Integer.valueOf(character[14]));
} powerLevel += Integer.valueOf(character[14]);
}
if (character.length > 24 && m.isInt(character[24])) {
Taming.add(p, Integer.valueOf(character[24])); if (character.length > 24 && Misc.isInt(character[24])) {
powerLevel += Integer.valueOf(character[24]); Taming.add(p, Integer.valueOf(character[24]));
} powerLevel += Integer.valueOf(character[24]);
}
if (character.length > 34 && m.isInt(character[34])) {
Fishing.add(p, Integer.valueOf(character[34])); if (character.length > 34 && Misc.isInt(character[34])) {
powerLevel += Integer.valueOf(character[34]); Fishing.add(p, Integer.valueOf(character[34]));
} powerLevel += Integer.valueOf(character[34]);
}
PowerLevel.add(p, powerLevel);
} PowerLevel.add(p, powerLevel);
in.close(); }
} in.close();
catch (Exception e) { }
plugin.getLogger().severe(("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString())); catch (Exception e) {
} plugin.getLogger().severe(("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString()));
}
//Write the leader board files
leaderWrite(Mining.inOrder(), SkillType.MINING); //Write the leader board files
leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING); leaderWrite(Mining.inOrder(), SkillType.MINING);
leaderWrite(Repair.inOrder(), SkillType.REPAIR); leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING);
leaderWrite(Unarmed.inOrder(), SkillType.UNARMED); leaderWrite(Repair.inOrder(), SkillType.REPAIR);
leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM); leaderWrite(Unarmed.inOrder(), SkillType.UNARMED);
leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION); leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM);
leaderWrite(Archery.inOrder(), SkillType.ARCHERY); leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION);
leaderWrite(Swords.inOrder(), SkillType.SWORDS); leaderWrite(Archery.inOrder(), SkillType.ARCHERY);
leaderWrite(Axes.inOrder(), SkillType.AXES); leaderWrite(Swords.inOrder(), SkillType.SWORDS);
leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS); leaderWrite(Axes.inOrder(), SkillType.AXES);
leaderWrite(Taming.inOrder(), SkillType.TAMING); leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS);
leaderWrite(Fishing.inOrder(), SkillType.FISHING); leaderWrite(Taming.inOrder(), SkillType.TAMING);
leaderWrite(PowerLevel.inOrder(), SkillType.ALL); leaderWrite(Fishing.inOrder(), SkillType.FISHING);
} leaderWrite(PowerLevel.inOrder(), SkillType.ALL);
}
/**
* Write to the leaderboards. /**
* * Write to the leaderboards.
* @param ps Stats to write to the leaderboard *
* @param skillType Skill type to write the leaderboard of * @param ps Stats to write to the leaderboard
*/ * @param skillType Skill type to write the leaderboard of
private static void leaderWrite(PlayerStat[] ps, SkillType skillType) { */
String theLocation = leaderboardsDirectory + skillType.toString().toLowerCase() + ".mcmmo"; private static void leaderWrite(PlayerStat[] ps, SkillType skillType) {
File theDir = new File(theLocation); String theLocation = leaderboardsDirectory + skillType.toString().toLowerCase() + ".mcmmo";
File theDir = new File(theLocation);
//CHECK IF THE FILE EXISTS
if (!theDir.exists()) { //CHECK IF THE FILE EXISTS
FileWriter writer = null; if (!theDir.exists()) {
FileWriter writer = null;
try {
writer = new FileWriter(theLocation); try {
} writer = new FileWriter(theLocation);
catch (Exception e) { }
plugin.getLogger().severe(("Exception while creating " + theLocation + e.toString())); catch (Exception e) {
} plugin.getLogger().severe(("Exception while creating " + theLocation + e.toString()));
finally { }
try { finally {
if (writer != null) { try {
writer.close(); if (writer != null) {
} writer.close();
} }
catch (IOException e) { }
plugin.getLogger().severe("Exception while closing writer for " + theLocation + e.toString()); catch (IOException e) {
} plugin.getLogger().severe("Exception while closing writer for " + theLocation + e.toString());
} }
} }
else { }
try { else {
FileReader file = new FileReader(theLocation); try {
BufferedReader in = new BufferedReader(file); FileReader file = new FileReader(theLocation);
StringBuilder writer = new StringBuilder(); BufferedReader in = new BufferedReader(file);
StringBuilder writer = new StringBuilder();
for (PlayerStat p : ps) {
if (p.name.equals("$mcMMO_DummyInfo")) { for (PlayerStat p : ps) {
continue; if (p.name.equals("$mcMMO_DummyInfo")) {
} continue;
}
if (p.statVal == 0) {
continue; if (p.statVal == 0) {
} continue;
}
writer.append(p.name + ":" + p.statVal);
writer.append("\r\n"); writer.append(p.name + ":" + p.statVal);
} writer.append("\r\n");
}
in.close();
FileWriter out = new FileWriter(theLocation); in.close();
out.write(writer.toString()); FileWriter out = new FileWriter(theLocation);
out.close(); out.write(writer.toString());
} out.close();
catch (Exception e) { }
plugin.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString()); catch (Exception e) {
} plugin.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
} }
} }
}
/**
* Retrieve leaderboard info. /**
* * Retrieve leaderboard info.
* @param skillName Skill to retrieve info on. *
* @param pagenumber Which page in the leaderboards to retrieve * @param skillName Skill to retrieve info on.
* @return the requested leaderboard information * @param pagenumber Which page in the leaderboards to retrieve
*/ * @return the requested leaderboard information
public static String[] retrieveInfo(String skillName, int pagenumber) { */
String theLocation = leaderboardsDirectory + skillName.toLowerCase() + ".mcmmo"; public static String[] retrieveInfo(String skillName, int pagenumber) {
String theLocation = leaderboardsDirectory + skillName.toLowerCase() + ".mcmmo";
try {
FileReader file = new FileReader(theLocation); try {
BufferedReader in = new BufferedReader(file); FileReader file = new FileReader(theLocation);
int destination; BufferedReader in = new BufferedReader(file);
int destination;
//How many lines to skip through
if (pagenumber == 1) { //How many lines to skip through
destination = 0; if (pagenumber == 1) {
} destination = 0;
else { }
destination = (pagenumber * 10) - 9; else {
} destination = (pagenumber * 10) - 9;
}
int x = 0; //how many lines we've gone through
int y = 0; //going through the lines int x = 0; //how many lines we've gone through
String line = ""; int y = 0; //going through the lines
String[] info = new String[10]; //what to return String line = "";
String[] info = new String[10]; //what to return
while ((line = in.readLine()) != null && y < 10) {
x++; while ((line = in.readLine()) != null && y < 10) {
x++;
if (x >= destination && y < 10) {
info[y] = line.toString(); if (x >= destination && y < 10) {
y++; info[y] = line.toString();
} y++;
} }
}
in.close();
return info; in.close();
} return info;
catch (Exception e) { }
plugin.getLogger().severe("Exception while reading " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString()); catch (Exception e) {
} plugin.getLogger().severe("Exception while reading " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
}
return null; //Shouldn't get here
} return null; //Shouldn't get here
}
/**
* Update the leaderboards. /**
* * Update the leaderboards.
* @param ps Stats to update the leaderboard with. *
* @param skillType Skill whose leaderboard is being updated. * @param ps Stats to update the leaderboard with.
*/ * @param skillType Skill whose leaderboard is being updated.
public static void updateLeaderboard(PlayerStat ps, SkillType skillType) { */
if (Config.getInstance().getUseMySQL()) { public static void updateLeaderboard(PlayerStat ps, SkillType skillType) {
return; if (Config.getInstance().getUseMySQL()) {
} return;
}
String theLocation = leaderboardsDirectory + skillType.toString().toLowerCase() + ".mcmmo";
String theLocation = leaderboardsDirectory + skillType.toString().toLowerCase() + ".mcmmo";
try {
FileReader file = new FileReader(theLocation); try {
BufferedReader in = new BufferedReader(file); FileReader file = new FileReader(theLocation);
StringBuilder writer = new StringBuilder(); BufferedReader in = new BufferedReader(file);
String line = ""; StringBuilder writer = new StringBuilder();
Boolean inserted = false; String line = "";
Boolean inserted = false;
while ((line = in.readLine()) != null) {
while ((line = in.readLine()) != null) {
//Insert the player into the line before it finds a smaller one
if (Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) { //Insert the player into the line before it finds a smaller one
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); if (Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) {
inserted = true; writer.append(ps.name + ":" + ps.statVal).append("\r\n");
} inserted = true;
}
//Write anything that isn't the player already in the file so we remove the duplicate
if (!line.split(":")[0].equalsIgnoreCase(ps.name)) { //Write anything that isn't the player already in the file so we remove the duplicate
writer.append(line).append("\r\n"); if (!line.split(":")[0].equalsIgnoreCase(ps.name)) {
} writer.append(line).append("\r\n");
} }
}
if(!inserted) {
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); if(!inserted) {
} writer.append(ps.name + ":" + ps.statVal).append("\r\n");
}
in.close();
in.close();
//Write the new file
FileWriter out = new FileWriter(theLocation); //Write the new file
out.write(writer.toString()); FileWriter out = new FileWriter(theLocation);
out.close(); out.write(writer.toString());
} out.close();
catch (Exception e) { }
plugin.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString()); catch (Exception e) {
} plugin.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
} }
} }
}

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
/* /*
* Copyright 2011 Tyler Blair. All rights reserved. * Copyright 2011 Tyler Blair. All rights reserved.
* *

View File

@ -1,271 +1,272 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import java.util.Random; import java.util.Random;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
public class m {
public class Misc {
private static Random random = new Random();
private static Random random = new Random();
/**
* Gets a capitalized version of the target string. /**
* * Gets a capitalized version of the target string.
* @param target String to capitalize *
* @return the capitalized string * @param target String to capitalize
*/ * @return the capitalized string
public static String getCapitalized(String target) { */
String firstLetter = target.substring(0,1); public static String getCapitalized(String target) {
String remainder = target.substring(1); String firstLetter = target.substring(0,1);
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); String remainder = target.substring(1);
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
return capitalized;
} return capitalized;
}
/**
* Gets a nicely formatted string version of an item name from a given item ID. /**
* * Gets a nicely formatted string version of an item name from a given item ID.
* @param itemID The ID of the item to convert to string. *
* @return the nicely formatting string * @param itemID The ID of the item to convert to string.
*/ * @return the nicely formatting string
public static String prettyItemString(int itemID) { */
String baseString = Material.getMaterial(itemID).toString(); public static String prettyItemString(int itemID) {
String[] substrings = baseString.split("_"); String baseString = Material.getMaterial(itemID).toString();
String prettyString = ""; String[] substrings = baseString.split("_");
int size = 1; String prettyString = "";
int size = 1;
for (String s : substrings) {
prettyString = prettyString.concat(m.getCapitalized(s)); for (String s : substrings) {
prettyString = prettyString.concat(Misc.getCapitalized(s));
if (size < substrings.length) {
prettyString = prettyString.concat(" "); if (size < substrings.length) {
} prettyString = prettyString.concat(" ");
}
size++;
} size++;
}
return prettyString;
} return prettyString;
}
/**
* Gets the int represented by this string. /**
* * Gets the int represented by this string.
* @param string The string to parse *
* @return the int represented by this string * @param string The string to parse
*/ * @return the int represented by this string
public static int getInt(String string) { */
if (isInt(string)) { public static int getInt(String string) {
return Integer.parseInt(string); if (isInt(string)) {
} return Integer.parseInt(string);
else { }
return 0; else {
} return 0;
} }
}
/**
* Checks to see if an entity is currently invincible. /**
* * Checks to see if an entity is currently invincible.
* @param le The LivingEntity to check *
* @param event The event the entity is involved in * @param le The LivingEntity to check
* @return true if the entity is invincible, false otherwise * @param event The event the entity is involved in
*/ * @return true if the entity is invincible, false otherwise
public static boolean isInvincible(LivingEntity le, EntityDamageEvent event) { */
public static boolean isInvincible(LivingEntity le, EntityDamageEvent event) {
/*
* So apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility. /*
* So yeah, this is for that. * So apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility.
*/ * So yeah, this is for that.
if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) { */
return true; if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
} return true;
else { }
return false; else {
} return false;
} }
}
/**
* Simulate a block break event. /**
* * Simulate a block break event.
* @param block The block to break *
* @param player The player breaking the block * @param block The block to break
* @param shouldArmSwing true if an armswing event should be fired, false otherwise * @param player The player breaking the block
* @return true if the event wasn't cancelled, false otherwise * @param shouldArmSwing true if an armswing event should be fired, false otherwise
*/ * @return true if the event wasn't cancelled, false otherwise
public static boolean blockBreakSimulate(Block block, Player player, Boolean shouldArmSwing) { */
public static boolean blockBreakSimulate(Block block, Player player, Boolean shouldArmSwing) {
//Support for NoCheat
if (shouldArmSwing) { //Support for NoCheat
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); if (shouldArmSwing) {
mcMMO.p.getServer().getPluginManager().callEvent(armswing); FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
} mcMMO.p.getServer().getPluginManager().callEvent(armswing);
}
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
mcMMO.p.getServer().getPluginManager().callEvent(event); FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
return true; if (!event.isCancelled()) {
} return true;
else { }
return false; else {
} return false;
} }
}
/**
* Get the upgrade tier of the item in hand. /**
* * Get the upgrade tier of the item in hand.
* @param inHand The item to check the tier of *
* @return the tier of the item * @param inHand The item to check the tier of
*/ * @return the tier of the item
public static int getTier(ItemStack inHand) { */
int tier = 0; public static int getTier(ItemStack inHand) {
int tier = 0;
if (ItemChecks.isWoodTool(inHand)) {
tier = 1; if (ItemChecks.isWoodTool(inHand)) {
} tier = 1;
else if (ItemChecks.isStoneTool(inHand)) { }
tier = 2; else if (ItemChecks.isStoneTool(inHand)) {
} tier = 2;
else if (ItemChecks.isIronTool(inHand)) { }
tier = 3; else if (ItemChecks.isIronTool(inHand)) {
} tier = 3;
else if(ItemChecks.isGoldTool(inHand)) { }
tier = 1; else if(ItemChecks.isGoldTool(inHand)) {
} tier = 1;
else if(ItemChecks.isDiamondTool(inHand)) }
tier = 4; else if(ItemChecks.isDiamondTool(inHand))
tier = 4;
return tier;
} return tier;
}
/**
* Determine if two locations are near each other. /**
* * Determine if two locations are near each other.
* @param first The first location *
* @param second The second location * @param first The first location
* @param maxDistance The max distance apart * @param second The second location
* @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise * @param maxDistance The max distance apart
*/ * @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise
public static boolean isNear(Location first, Location second, double maxDistance) { */
if (!first.getWorld().equals(second.getWorld())) { public static boolean isNear(Location first, Location second, double maxDistance) {
return false; if (!first.getWorld().equals(second.getWorld())) {
} return false;
}
if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true; if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
} return true;
else { }
return false; else {
} return false;
} }
}
/**
* Determine if a string represents an Integer /**
* * Determine if a string represents an Integer
* @param string String to check *
* @return true if the string is an Integer, false otherwise * @param string String to check
*/ * @return true if the string is an Integer, false otherwise
public static boolean isInt(String string) { */
try { public static boolean isInt(String string) {
Integer.parseInt(string); try {
return true; Integer.parseInt(string);
} return true;
catch (NumberFormatException nFE) { }
return false; catch (NumberFormatException nFE) {
} return false;
} }
}
/**
* Drop items at a given location. /**
* * Drop items at a given location.
* @param location The location to drop the items at *
* @param is The items to drop * @param location The location to drop the items at
* @param quantity The amount of items to drop * @param is The items to drop
*/ * @param quantity The amount of items to drop
public static void mcDropItems(Location location, ItemStack is, int quantity) { */
for (int i = 0; i < quantity; i++) { public static void mcDropItems(Location location, ItemStack is, int quantity) {
mcDropItem(location, is); for (int i = 0; i < quantity; i++) {
} mcDropItem(location, is);
} }
}
/**
* Randomly drop an item at a given location. /**
* * Randomly drop an item at a given location.
* @param location The location to drop the items at *
* @param is The item to drop * @param location The location to drop the items at
* @param chance The percentage chance for the item to drop * @param is The item to drop
*/ * @param chance The percentage chance for the item to drop
public static void mcRandomDropItem(Location location, ItemStack is, double chance) { */
if (random.nextInt(100) < chance) { public static void mcRandomDropItem(Location location, ItemStack is, double chance) {
mcDropItem(location, is); if (random.nextInt(100) < chance) {
} mcDropItem(location, is);
} }
}
/**
* Randomly drop items at a given location. /**
* * Randomly drop items at a given location.
* @param location The location to drop the items at *
* @param is The item to drop * @param location The location to drop the items at
* @param chance The percentage chance for the item to drop * @param is The item to drop
* @param quantity The amount of items to drop * @param chance The percentage chance for the item to drop
*/ * @param quantity The amount of items to drop
public static void mcRandomDropItems(Location location, ItemStack is, int chance, int quantity) { */
for(int i = 0; i < quantity; i++) { public static void mcRandomDropItems(Location location, ItemStack is, int chance, int quantity) {
mcRandomDropItem(location, is, chance); for(int i = 0; i < quantity; i++) {
} mcRandomDropItem(location, is, chance);
} }
}
/**
* Drop an item at a given location. /**
* * Drop an item at a given location.
* @param location The location to drop the item at *
* @param itemStack The item to drop * @param location The location to drop the item at
*/ * @param itemStack The item to drop
public static void mcDropItem(Location location, ItemStack itemStack) { */
public static void mcDropItem(Location location, ItemStack itemStack) {
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack); // We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
mcMMO.p.getServer().getPluginManager().callEvent(event); McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return; if (event.isCancelled()) {
} return;
}
location.getWorld().dropItemNaturally(location, itemStack);
} location.getWorld().dropItemNaturally(location, itemStack);
}
/**
* Check if a skill level is higher than the max bonus level of the ability. /**
* * Check if a skill level is higher than the max bonus level of the ability.
* @param skillLevel Skill level to check *
* @param maxLevel Max level of the ability * @param skillLevel Skill level to check
* @return whichever value is lower * @param maxLevel Max level of the ability
*/ * @return whichever value is lower
public static int skillCheck(int skillLevel, int maxLevel) { */
if (skillLevel > maxLevel) { public static int skillCheck(int skillLevel, int maxLevel) {
return maxLevel; if (skillLevel > maxLevel) {
} return maxLevel;
else { }
return skillLevel; else {
} return skillLevel;
} }
}
public static int getPowerLevelCap() {
if (Config.getInstance().getPowerLevelCap() > 0) { public static int getPowerLevelCap() {
return Config.getInstance().getPowerLevelCap(); if (Config.getInstance().getPowerLevelCap() > 0) {
} return Config.getInstance().getPowerLevelCap();
else { }
return Integer.MAX_VALUE; else {
} return Integer.MAX_VALUE;
} }
} }
}

View File

@ -5,15 +5,14 @@ import java.util.ArrayList;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.m;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.LocaleLoader;
public class Page { public class Page {
public static int getTotalPageNumber(String address) public static int getTotalPageNumber(String address)
{ {
String[] addressSplit = mcLocale.getString(address).split("\n"); String[] addressSplit = LocaleLoader.getString(address).split("\n");
if(addressSplit.length <= 8) if(addressSplit.length <= 8)
return 1; return 1;
else else
@ -31,7 +30,7 @@ public class Page {
} }
ArrayList<String> allStrings = new ArrayList<String>(); ArrayList<String> allStrings = new ArrayList<String>();
String split[] = mcLocale.getString(address).split("\n"); String split[] = LocaleLoader.getString(address).split("\n");
allStrings.add(ChatColor.GOLD+"-="+ChatColor.GREEN+header+ChatColor.GOLD+"=-"); //So stylish allStrings.add(ChatColor.GOLD+"-="+ChatColor.GREEN+header+ChatColor.GOLD+"=-"); //So stylish
@ -59,7 +58,7 @@ public class Page {
public static void grabGuidePageForSkill(SkillType skilltype, Player player, String[] args) public static void grabGuidePageForSkill(SkillType skilltype, Player player, String[] args)
{ {
String capitalized = m.getCapitalized(skilltype.toString()); String capitalized = Misc.getCapitalized(skilltype.toString());
player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale. player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale.
if (args.length >= 1) if (args.length >= 1)
{ {
@ -68,10 +67,10 @@ public class Page {
String address = "Guides."+capitalized; String address = "Guides."+capitalized;
if(args.length > 1 && m.isInt(args[1]) && m.getInt(args[1]) <= Page.getTotalPageNumber(address)) if(args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address))
{ {
Page.clearChat(player); Page.clearChat(player);
for(String target : Page.grabPageContents(capitalized+" Guide", address, m.getInt(args[1]))) for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1])))
{ {
player.sendMessage(target); player.sendMessage(target);
} }
@ -83,11 +82,11 @@ public class Page {
player.sendMessage(target); player.sendMessage(target);
} }
} }
else if(args.length > 1 && m.getInt(args[1]) > Page.getTotalPageNumber(address)) else if(args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address))
{ {
player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale. player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale.
} }
else if(args.length > 1 && !m.isInt(args[1])) else if(args.length > 1 && !Misc.isInt(args[1]))
{ {
player.sendMessage("Not a valid page number!"); //TODO: Needs more locale. player.sendMessage("Not a valid page number!"); //TODO: Needs more locale.
} }

View File

@ -1,418 +1,418 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class mcPermissions { public class Permissions {
private static volatile mcPermissions instance; private static volatile Permissions instance;
public boolean permission(Player player, String perm) { public boolean permission(Player player, String perm) {
return player.hasPermission(perm); return player.hasPermission(perm);
} }
public static mcPermissions getInstance() { public static Permissions getInstance() {
if (instance == null) { if (instance == null) {
instance = new mcPermissions(); instance = new Permissions();
} }
return instance; return instance;
} }
/* /*
* GENERIC PERMISSIONS * GENERIC PERMISSIONS
*/ */
public boolean motd(Player player) { public boolean motd(Player player) {
return player.hasPermission("mcmmo.motd"); return player.hasPermission("mcmmo.motd");
} }
public boolean admin(Player player) { public boolean admin(Player player) {
return player.hasPermission("mcmmo.admin"); return player.hasPermission("mcmmo.admin");
} }
/* /*
* MCMMO.BYPASS.* * MCMMO.BYPASS.*
*/ */
public boolean arcaneBypass(Player player) { public boolean arcaneBypass(Player player) {
return player.hasPermission("mcmmo.bypass.arcanebypass"); return player.hasPermission("mcmmo.bypass.arcanebypass");
} }
public boolean inspectDistanceBypass(Player player) { public boolean inspectDistanceBypass(Player player) {
return player.hasPermission("mcmmo.bypass.inspect.distance"); return player.hasPermission("mcmmo.bypass.inspect.distance");
} }
public boolean inspectOfflineBypass(Player player) { public boolean inspectOfflineBypass(Player player) {
return player.hasPermission("mcmmo.bypass.inspect.offline"); return player.hasPermission("mcmmo.bypass.inspect.offline");
} }
/* /*
* MCMMO.TOOLS.* * MCMMO.TOOLS.*
*/ */
public boolean mcrefresh(Player player) { public boolean mcrefresh(Player player) {
return player.hasPermission("mcmmo.tools.mcrefresh"); return player.hasPermission("mcmmo.tools.mcrefresh");
} }
public boolean mcremove(Player player) { public boolean mcremove(Player player) {
return player.hasPermission("mcmmo.tools.mcremove"); return player.hasPermission("mcmmo.tools.mcremove");
} }
public boolean mmoedit(Player player) { public boolean mmoedit(Player player) {
return player.hasPermission("mcmmo.tools.mmoedit"); return player.hasPermission("mcmmo.tools.mmoedit");
} }
public boolean mcgod(Player player) { public boolean mcgod(Player player) {
return player.hasPermission("mcmmo.tools.mcgod"); return player.hasPermission("mcmmo.tools.mcgod");
} }
/* /*
* MCMMO.ABILITY.TAMING.* * MCMMO.ABILITY.TAMING.*
*/ */
public boolean fastFoodService(Player player) { public boolean fastFoodService(Player player) {
return player.hasPermission("mcmmo.ability.taming.fastfoodservice"); return player.hasPermission("mcmmo.ability.taming.fastfoodservice");
} }
public boolean sharpenedclaws(Player player) { public boolean sharpenedclaws(Player player) {
return player.hasPermission("mcmmo.ability.taming.sharpenedclaws"); return player.hasPermission("mcmmo.ability.taming.sharpenedclaws");
} }
public boolean gore(Player player) { public boolean gore(Player player) {
return player.hasPermission("mcmmo.ability.taming.gore"); return player.hasPermission("mcmmo.ability.taming.gore");
} }
public boolean callOfTheWild(Player player) { public boolean callOfTheWild(Player player) {
return player.hasPermission("mcmmo.ability.taming.callofthewild"); return player.hasPermission("mcmmo.ability.taming.callofthewild");
} }
public boolean environmentallyAware(Player player) { public boolean environmentallyAware(Player player) {
return player.hasPermission("mcmmo.ability.taming.environmentallyaware"); return player.hasPermission("mcmmo.ability.taming.environmentallyaware");
} }
public boolean thickFur(Player player) { public boolean thickFur(Player player) {
return player.hasPermission("mcmmo.ability.taming.thickfur"); return player.hasPermission("mcmmo.ability.taming.thickfur");
} }
public boolean shockProof(Player player) { public boolean shockProof(Player player) {
return player.hasPermission("mcmmo.ability.taming.shockproof"); return player.hasPermission("mcmmo.ability.taming.shockproof");
} }
public boolean beastLore(Player player) { public boolean beastLore(Player player) {
return player.hasPermission("mcmmo.ability.taming.beastlore"); return player.hasPermission("mcmmo.ability.taming.beastlore");
} }
/* /*
* MCMMO.ABILITY.FISHING.* * MCMMO.ABILITY.FISHING.*
*/ */
public boolean shakeMob(Player player) { public boolean shakeMob(Player player) {
return player.hasPermission("mcmmo.ability.fishing.shakemob"); return player.hasPermission("mcmmo.ability.fishing.shakemob");
} }
/* /*
* MCMMO.ABILITY.MINING.* * MCMMO.ABILITY.MINING.*
*/ */
public boolean superBreaker(Player player) { public boolean superBreaker(Player player) {
return player.hasPermission("mcmmo.ability.mining.superbreaker"); return player.hasPermission("mcmmo.ability.mining.superbreaker");
} }
public boolean miningDoubleDrops(Player player) { public boolean miningDoubleDrops(Player player) {
return player.hasPermission("mcmmo.ability.mining.doubledrops"); return player.hasPermission("mcmmo.ability.mining.doubledrops");
} }
/* /*
* MCMMO.ABILITY.WOODCUTTING.* * MCMMO.ABILITY.WOODCUTTING.*
*/ */
public boolean treeFeller(Player player) { public boolean treeFeller(Player player) {
return player.hasPermission("mcmmo.ability.woodcutting.treefeller"); return player.hasPermission("mcmmo.ability.woodcutting.treefeller");
} }
public boolean leafBlower(Player player) { public boolean leafBlower(Player player) {
return player.hasPermission("mcmmo.ability.woodcutting.leafblower"); return player.hasPermission("mcmmo.ability.woodcutting.leafblower");
} }
public boolean woodcuttingDoubleDrops(Player player) { public boolean woodcuttingDoubleDrops(Player player) {
return player.hasPermission("mcmmo.ability.woodcutting.doubledrops"); return player.hasPermission("mcmmo.ability.woodcutting.doubledrops");
} }
/* /*
* MCMMO.ABILITY.REPAIR.* * MCMMO.ABILITY.REPAIR.*
*/ */
public boolean repairBonus(Player player) { public boolean repairBonus(Player player) {
return player.hasPermission("mcmmo.ability.repair.repairbonus"); return player.hasPermission("mcmmo.ability.repair.repairbonus");
} }
public boolean arcaneForging(Player player) { public boolean arcaneForging(Player player) {
return player.hasPermission("mcmmo.ability.repair.arcaneforging"); return player.hasPermission("mcmmo.ability.repair.arcaneforging");
} }
public boolean woodRepair(Player player) { public boolean woodRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.woodrepair"); return player.hasPermission("mcmmo.ability.repair.woodrepair");
} }
public boolean stoneRepair(Player player) { public boolean stoneRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.stonerepair"); return player.hasPermission("mcmmo.ability.repair.stonerepair");
} }
public boolean leatherRepair(Player player) { public boolean leatherRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.leatherrepair"); return player.hasPermission("mcmmo.ability.repair.leatherrepair");
} }
public boolean ironRepair(Player player) { public boolean ironRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.ironrepair"); return player.hasPermission("mcmmo.ability.repair.ironrepair");
} }
public boolean goldRepair(Player player) { public boolean goldRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.goldrepair"); return player.hasPermission("mcmmo.ability.repair.goldrepair");
} }
public boolean diamondRepair(Player player) { public boolean diamondRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.diamondrepair"); return player.hasPermission("mcmmo.ability.repair.diamondrepair");
} }
public boolean armorRepair(Player player) { public boolean armorRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.armorrepair"); return player.hasPermission("mcmmo.ability.repair.armorrepair");
} }
public boolean toolRepair(Player player) { public boolean toolRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.toolrepair"); return player.hasPermission("mcmmo.ability.repair.toolrepair");
} }
public boolean stringRepair(Player player) { public boolean stringRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.stringrepair"); return player.hasPermission("mcmmo.ability.repair.stringrepair");
} }
/* /*
* MCMMO.ABILITY.UNARMED.* * MCMMO.ABILITY.UNARMED.*
*/ */
public boolean unarmedBonus(Player player) { public boolean unarmedBonus(Player player) {
return player.hasPermission("mcmmo.ability.unarmed.bonusdamage"); return player.hasPermission("mcmmo.ability.unarmed.bonusdamage");
} }
public boolean disarm(Player player) { public boolean disarm(Player player) {
return player.hasPermission("mcmmo.ability.unarmed.disarm"); return player.hasPermission("mcmmo.ability.unarmed.disarm");
} }
public boolean berserk(Player player) { public boolean berserk(Player player) {
return player.hasPermission("mcmmo.ability.unarmed.berserk"); return player.hasPermission("mcmmo.ability.unarmed.berserk");
} }
public boolean deflect(Player player) { public boolean deflect(Player player) {
return player.hasPermission("mcmmo.ability.unarmed.deflect"); return player.hasPermission("mcmmo.ability.unarmed.deflect");
} }
/* /*
* MCMMO.ABILITY.ARCHERY.* * MCMMO.ABILITY.ARCHERY.*
*/ */
public boolean trackArrows(Player player) { public boolean trackArrows(Player player) {
return player.hasPermission("mcmmo.ability.archery.trackarrows"); return player.hasPermission("mcmmo.ability.archery.trackarrows");
} }
public boolean ignition(Player player) { public boolean ignition(Player player) {
return player.hasPermission("mcmmo.ability.archery.ignition"); return player.hasPermission("mcmmo.ability.archery.ignition");
} }
public boolean daze(Player player) { public boolean daze(Player player) {
return player.hasPermission("mcmmo.ability.archery.daze"); return player.hasPermission("mcmmo.ability.archery.daze");
} }
/* /*
* MCMMO.ABILITY.HERBALISM.* * MCMMO.ABILITY.HERBALISM.*
*/ */
public boolean herbalismDoubleDrops(Player player) { public boolean herbalismDoubleDrops(Player player) {
return player.hasPermission("mcmmo.ability.herbalism.doubledrops"); return player.hasPermission("mcmmo.ability.herbalism.doubledrops");
} }
public boolean greenTerra(Player player) { public boolean greenTerra(Player player) {
return player.hasPermission("mcmmo.ability.herbalism.greenterra"); return player.hasPermission("mcmmo.ability.herbalism.greenterra");
} }
public boolean greenThumbBlocks(Player player) { public boolean greenThumbBlocks(Player player) {
return player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks"); return player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks");
} }
public boolean greenThumbWheat(Player player) { public boolean greenThumbWheat(Player player) {
return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat"); return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat");
} }
/* /*
* MCMMO.ABILITY.EXCAVATION.* * MCMMO.ABILITY.EXCAVATION.*
*/ */
public boolean gigaDrillBreaker(Player player) { public boolean gigaDrillBreaker(Player player) {
return player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker"); return player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker");
} }
public boolean excavationTreasures(Player player) { public boolean excavationTreasures(Player player) {
return player.hasPermission("mcmmo.ability.excavation.treasures"); return player.hasPermission("mcmmo.ability.excavation.treasures");
} }
/* /*
* MCMMO.ABILITY.SWORDS.* * MCMMO.ABILITY.SWORDS.*
*/ */
public boolean swordsBleed(Player player) { public boolean swordsBleed(Player player) {
return player.hasPermission("mcmmo.ability.swords.bleed"); return player.hasPermission("mcmmo.ability.swords.bleed");
} }
public boolean serratedStrikes(Player player) { public boolean serratedStrikes(Player player) {
return player.hasPermission("mcmmo.ability.swords.serratedstrikes"); return player.hasPermission("mcmmo.ability.swords.serratedstrikes");
} }
public boolean counterAttack(Player player) { public boolean counterAttack(Player player) {
return player.hasPermission("mcmmo.ability.swords.counterattack"); return player.hasPermission("mcmmo.ability.swords.counterattack");
} }
/* /*
* MCMMO.ABILITY.AXES.* * MCMMO.ABILITY.AXES.*
*/ */
public boolean skullSplitter(Player player) { public boolean skullSplitter(Player player) {
return player.hasPermission("mcmmo.ability.axes.skullsplitter"); return player.hasPermission("mcmmo.ability.axes.skullsplitter");
} }
public boolean axeBonus(Player player) { public boolean axeBonus(Player player) {
return player.hasPermission("mcmmo.ability.axes.bonusdamage"); return player.hasPermission("mcmmo.ability.axes.bonusdamage");
} }
public boolean criticalHit(Player player) { public boolean criticalHit(Player player) {
return player.hasPermission("mcmmo.ability.axes.criticalhit"); return player.hasPermission("mcmmo.ability.axes.criticalhit");
} }
public boolean impact(Player player) { public boolean impact(Player player) {
return player.hasPermission("mcmmo.ability.axes.impact"); return player.hasPermission("mcmmo.ability.axes.impact");
} }
/* /*
* MCMMO.ABILITY.ACROBATICS.* * MCMMO.ABILITY.ACROBATICS.*
*/ */
public boolean roll(Player player) { public boolean roll(Player player) {
return player.hasPermission("mcmmo.ability.acrobatics.roll"); return player.hasPermission("mcmmo.ability.acrobatics.roll");
} }
public boolean gracefulRoll(Player player) { public boolean gracefulRoll(Player player) {
return player.hasPermission("mcmmo.ability.acrobatics.gracefulroll"); return player.hasPermission("mcmmo.ability.acrobatics.gracefulroll");
} }
public boolean dodge(Player player) { public boolean dodge(Player player) {
return player.hasPermission("mcmmo.ability.acrobatics.dodge"); return player.hasPermission("mcmmo.ability.acrobatics.dodge");
} }
/* /*
* MCMMO.ABILITY.BLASTMINING.* * MCMMO.ABILITY.BLASTMINING.*
*/ */
public boolean biggerBombs(Player player) { public boolean biggerBombs(Player player) {
return player.hasPermission("mcmmo.ability.blastmining.biggerbombs"); return player.hasPermission("mcmmo.ability.blastmining.biggerbombs");
} }
public boolean demolitionsExpertise(Player player) { public boolean demolitionsExpertise(Player player) {
return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise"); return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise");
} }
/* /*
* MCMMO.ITEM.* * MCMMO.ITEM.*
*/ */
public boolean chimaeraWing(Player player) { public boolean chimaeraWing(Player player) {
return player.hasPermission("mcmmo.item.chimaerawing"); return player.hasPermission("mcmmo.item.chimaerawing");
} }
/* /*
* MCMMO.COMMANDS.* * MCMMO.COMMANDS.*
*/ */
public boolean mcAbility(Player player) { public boolean mcAbility(Player player) {
return player.hasPermission("mcmmo.commands.ability"); return player.hasPermission("mcmmo.commands.ability");
} }
public boolean partyTeleport(Player player) { public boolean partyTeleport(Player player) {
return player.hasPermission("mcmmo.commands.ptp"); return player.hasPermission("mcmmo.commands.ptp");
} }
public boolean inspect(Player player) { public boolean inspect(Player player) {
return player.hasPermission("mcmmo.commands.inspect"); return player.hasPermission("mcmmo.commands.inspect");
} }
public boolean party(Player player) { public boolean party(Player player) {
return player.hasPermission("mcmmo.commands.party"); return player.hasPermission("mcmmo.commands.party");
} }
/* /*
* MCMMO.CHAT.* * MCMMO.CHAT.*
*/ */
public boolean partyChat(Player player) { public boolean partyChat(Player player) {
return player.hasPermission("mcmmo.chat.partychat"); return player.hasPermission("mcmmo.chat.partychat");
} }
public boolean partyLock(Player player) { public boolean partyLock(Player player) {
return player.hasPermission("mcmmo.chat.partylock"); return player.hasPermission("mcmmo.chat.partylock");
} }
public boolean adminChat(Player player) { public boolean adminChat(Player player) {
return player.hasPermission("mcmmo.chat.adminchat"); return player.hasPermission("mcmmo.chat.adminchat");
} }
/* /*
* MCMMO.SKILLS.* * MCMMO.SKILLS.*
*/ */
public boolean taming(Player player) { public boolean taming(Player player) {
return player.hasPermission("mcmmo.skills.taming"); return player.hasPermission("mcmmo.skills.taming");
} }
public boolean mining(Player player) { public boolean mining(Player player) {
return player.hasPermission("mcmmo.skills.mining"); return player.hasPermission("mcmmo.skills.mining");
} }
public boolean blastMining(Player player) { public boolean blastMining(Player player) {
return player.hasPermission("mcmmo.skills.blastmining"); return player.hasPermission("mcmmo.skills.blastmining");
} }
public boolean fishing(Player player) { public boolean fishing(Player player) {
return player.hasPermission("mcmmo.skills.fishing"); return player.hasPermission("mcmmo.skills.fishing");
} }
public boolean woodcutting(Player player) { public boolean woodcutting(Player player) {
return player.hasPermission("mcmmo.skills.woodcutting"); return player.hasPermission("mcmmo.skills.woodcutting");
} }
public boolean repair(Player player) { public boolean repair(Player player) {
return player.hasPermission("mcmmo.skills.repair"); return player.hasPermission("mcmmo.skills.repair");
} }
public boolean unarmed(Player player) { public boolean unarmed(Player player) {
return player.hasPermission("mcmmo.skills.unarmed"); return player.hasPermission("mcmmo.skills.unarmed");
} }
public boolean archery(Player player) { public boolean archery(Player player) {
return player.hasPermission("mcmmo.skills.archery"); return player.hasPermission("mcmmo.skills.archery");
} }
public boolean herbalism(Player player) { public boolean herbalism(Player player) {
return player.hasPermission("mcmmo.skills.herbalism"); return player.hasPermission("mcmmo.skills.herbalism");
} }
public boolean excavation(Player player) { public boolean excavation(Player player) {
return player.hasPermission("mcmmo.skills.excavation"); return player.hasPermission("mcmmo.skills.excavation");
} }
public boolean swords(Player player) { public boolean swords(Player player) {
return player.hasPermission("mcmmo.skills.swords"); return player.hasPermission("mcmmo.skills.swords");
} }
public boolean axes(Player player) { public boolean axes(Player player) {
return player.hasPermission("mcmmo.skills.axes"); return player.hasPermission("mcmmo.skills.axes");
} }
public boolean acrobatics(Player player) { public boolean acrobatics(Player player) {
return player.hasPermission("mcmmo.skills.acrobatics"); return player.hasPermission("mcmmo.skills.acrobatics");
} }
} }

View File

@ -1,119 +1,121 @@
package com.gmail.nossr50; package com.gmail.nossr50.util;
import java.io.File; import java.io.File;
import java.io.FileWriter; 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.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.mcMMO;
public class Users { import com.gmail.nossr50.datatypes.PlayerProfile;
public static String location = mcMMO.usersFile; public class Users {
public static String directory = mcMMO.flatFileDirectory;
public static String directoryb = mcMMO.leaderboardDirectory; public static String location = mcMMO.usersFile;
public static String directory = mcMMO.flatFileDirectory;
public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>(); public static String directoryb = mcMMO.leaderboardDirectory;
/** public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>();
* Load users.
*/ /**
public static void loadUsers() { * Load users.
new File(directory).mkdir(); */
new File(directoryb).mkdir(); public static void loadUsers() {
File theDir = new File(location); new File(directory).mkdir();
new File(directoryb).mkdir();
if (!theDir.exists()) { File theDir = new File(location);
try {
FileWriter writer = new FileWriter(theDir); if (!theDir.exists()) {
writer.close(); try {
} FileWriter writer = new FileWriter(theDir);
catch (IOException e) { writer.close();
e.printStackTrace(); }
} catch (IOException e) {
} e.printStackTrace();
} }
}
/** }
* Add a new user.
* /**
* @param player The player to create a user record for * Add a new user.
*/ *
public static void addUser(Player player) { * @param player The player to create a user record for
if (!players.containsKey(player.getName().toLowerCase())) { */
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName(), true)); public static void addUser(Player player) {
} if (!players.containsKey(player.getName().toLowerCase())) {
} players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName(), true));
}
/** }
* Clear all users.
*/ /**
public static void clearUsers() { * Clear all users.
players.clear(); */
} public static void clearUsers() {
players.clear();
/** }
* Get all PlayerProfiles.
* /**
* @return a HashMap containing the PlayerProfile of everyone in the database * Get all PlayerProfiles.
*/ *
public static HashMap<String, PlayerProfile> getProfiles() { * @return a HashMap containing the PlayerProfile of everyone in the database
return players; */
} public static HashMap<String, PlayerProfile> getProfiles() {
return players;
/** }
* Remove a user from the database.
* /**
* @param player The player to remove * Remove a user from the database.
*/ *
public static void removeUser(Player player) { * @param player The player to remove
*/
//Only remove PlayerProfile if user is offline and we have it in memory public static void removeUser(Player player) {
if (!player.isOnline() && players.containsKey(player.getName().toLowerCase())) {
players.get(player.getName().toLowerCase()).save(); //Only remove PlayerProfile if user is offline and we have it in memory
players.remove(player.getName().toLowerCase()); if (!player.isOnline() && players.containsKey(player.getName().toLowerCase())) {
} players.get(player.getName().toLowerCase()).save();
} players.remove(player.getName().toLowerCase());
}
/** }
* Remove a user from the DB by name.
* /**
* @param playerName The name of the player to remove * Remove a user from the DB by name.
*/ *
public static void removeUserByName(String playerName) { * @param playerName The name of the player to remove
players.remove(playerName.toLowerCase()); */
} public static void removeUserByName(String playerName) {
players.remove(playerName.toLowerCase());
/** }
* Get the profile of a player.
* /**
* @param player The player whose profile to retrieve * Get the profile of a player.
* @return the player's profile *
*/ * @param player The player whose profile to retrieve
public static PlayerProfile getProfile(OfflinePlayer player) { * @return the player's profile
return getProfileByName(player.getName()); */
} public static PlayerProfile getProfile(OfflinePlayer player) {
return getProfileByName(player.getName());
/** }
* Get the profile of a player by name.
* /**
* @param player The name of the player whose profile to retrieve * Get the profile of a player by name.
* @return the player's profile *
*/ * @param player The name of the player whose profile to retrieve
public static PlayerProfile getProfileByName(String playerName) { * @return the player's profile
if (mcMMO.p.getServer().getOfflinePlayer(playerName).isOnline() || players.containsKey(playerName.toLowerCase())) { */
if (players.get(playerName.toLowerCase()) != null) { public static PlayerProfile getProfileByName(String playerName) {
return players.get(playerName.toLowerCase()); if (mcMMO.p.getServer().getOfflinePlayer(playerName).isOnline() || players.containsKey(playerName.toLowerCase())) {
} if (players.get(playerName.toLowerCase()) != null) {
else { return players.get(playerName.toLowerCase());
players.put(playerName.toLowerCase(), new PlayerProfile(playerName, true)); }
return players.get(playerName.toLowerCase()); else {
} players.put(playerName.toLowerCase(), new PlayerProfile(playerName, true));
} return players.get(playerName.toLowerCase());
else { }
return new PlayerProfile(playerName, false); }
} else {
} return new PlayerProfile(playerName, false);
} }
}
}