Part 2 of removing bad design patterns

This commit is contained in:
nossr50 2019-06-27 03:04:34 -07:00
parent 5ee862effd
commit 87af2419a3
234 changed files with 2303 additions and 2746 deletions

View File

@ -67,6 +67,7 @@ Version 2.2.0
Increased the default recipe cost for Chimaera Wing from 5 to 40 Increased the default recipe cost for Chimaera Wing from 5 to 40
Blast Mining Damage Decrease now scales more smoothly from ranks 1-8 Blast Mining Damage Decrease now scales more smoothly from ranks 1-8
Fixed a bug where Rupture wasn't using the base ticks setting from config when determining how many ticks of rupture to apply Fixed a bug where Rupture wasn't using the base ticks setting from config when determining how many ticks of rupture to apply
Fixed a bug where admin or party chat could be sent to the whole server
Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected") Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected")
Note: Admins are players who are an operator or have adminchat permission. Note: Admins are players who are an operator or have adminchat permission.

View File

@ -147,7 +147,7 @@
// //
// private static ChatManager getPartyChatManager(Plugin plugin, String party) { // private static ChatManager getPartyChatManager(Plugin plugin, String party) {
// ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY); // ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY);
// ((PartyChatManager) chatManager).setParty(PartyManager.getParty(party)); // ((PartyChatManager) chatManager).setParty(pluginRef.getPartyManager().getParty(party));
// //
// return chatManager; // return chatManager;
// } // }

View File

@ -56,7 +56,7 @@
// * @return true if the two players are in the same party, false otherwise // * @return true if the two players are in the same party, false otherwise
// */ // */
// public static boolean inSameParty(Player playera, Player playerb) { // public static boolean inSameParty(Player playera, Player playerb) {
// return PartyManager.inSameParty(playera, playerb); // return pluginRef.getPartyManager().inSameParty(playera, playerb);
// } // }
// //
// /** // /**
@ -67,7 +67,7 @@
// * @return the list of parties. // * @return the list of parties.
// */ // */
// public static List<Party> getParties() { // public static List<Party> getParties() {
// return PartyManager.getParties(); // return pluginRef.getPartyManager().getParties();
// } // }
// //
// /** // /**
@ -85,18 +85,18 @@
// if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
// return; // return;
// //
// Party party = PartyManager.getParty(partyName); // Party party = pluginRef.getPartyManager().getParty(partyName);
// //
// if (party == null) { // if (party == null) {
// party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); // party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
// } else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) { // } else if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) {
// if (PartyManager.isPartyFull(player, party)) { // if (pluginRef.getPartyManager().isPartyFull(player, party)) {
// mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString()); // mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
// return; // return;
// } // }
// } // }
// //
// PartyManager.addToParty(UserManager.getPlayer(player), party); // pluginRef.getPartyManager().addToParty(UserManager.getPlayer(player), party);
// } // }
// //
// /** // /**
@ -133,13 +133,13 @@
// if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
// return; // return;
// //
// Party party = PartyManager.getParty(partyName); // Party party = pluginRef.getPartyManager().getParty(partyName);
// //
// if (party == null) { // if (party == null) {
// party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName); // party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
// } // }
// //
// PartyManager.addToParty(UserManager.getPlayer(player), party); // pluginRef.getPartyManager().addToParty(UserManager.getPlayer(player), party);
// } // }
// //
// /** // /**
@ -154,7 +154,7 @@
// if (UserManager.getPlayer(player) == null) // if (UserManager.getPlayer(player) == null)
// return; // return;
// //
// PartyManager.removeFromParty(UserManager.getPlayer(player)); // pluginRef.getPartyManager().removeFromParty(UserManager.getPlayer(player));
// } // }
// //
// /** // /**
@ -166,7 +166,7 @@
// * @return the leader of the party // * @return the leader of the party
// */ // */
// public static String getPartyLeader(String partyName) { // public static String getPartyLeader(String partyName) {
// return PartyManager.getPartyLeaderName(partyName); // return pluginRef.getPartyManager().getPartyLeaderName(partyName);
// } // }
// //
// /** // /**
@ -179,7 +179,7 @@
// */ // */
// @Deprecated // @Deprecated
// public static void setPartyLeader(String partyName, String playerName) { // public static void setPartyLeader(String partyName, String playerName) {
// PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName)); // pluginRef.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), pluginRef.getPartyManager().getParty(partyName));
// } // }
// //
// /** // /**
@ -194,7 +194,7 @@
// public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) { // public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
// List<OfflinePlayer> members = new ArrayList<>(); // List<OfflinePlayer> members = new ArrayList<>();
// //
// for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) { // for (UUID memberUniqueId : pluginRef.getPartyManager().getAllMembers(player).keySet()) {
// OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId); // OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
// members.add(member); // members.add(member);
// } // }
@ -211,7 +211,7 @@
// */ // */
// @Deprecated // @Deprecated
// public static LinkedHashSet<String> getMembers(Player player) { // public static LinkedHashSet<String> getMembers(Player player) {
// return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values(); // return (LinkedHashSet<String>) pluginRef.getPartyManager().getAllMembers(player).values();
// } // }
// //
// /** // /**
@ -223,7 +223,7 @@
// * @return all the player names and uuids in the player's party // * @return all the player names and uuids in the player's party
// */ // */
// public static LinkedHashMap<UUID, String> getMembersMap(Player player) { // public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
// return PartyManager.getAllMembers(player); // return pluginRef.getPartyManager().getAllMembers(player);
// } // }
// //
// /** // /**
@ -235,7 +235,7 @@
// * @return all online players in this party // * @return all online players in this party
// */ // */
// public static List<Player> getOnlineMembers(String partyName) { // public static List<Player> getOnlineMembers(String partyName) {
// return PartyManager.getOnlineMembers(partyName); // return pluginRef.getPartyManager().getOnlineMembers(partyName);
// } // }
// //
// /** // /**
@ -247,7 +247,7 @@
// * @return all online players in the player's party // * @return all online players in the player's party
// */ // */
// public static List<Player> getOnlineMembers(Player player) { // public static List<Player> getOnlineMembers(Player player) {
// return PartyManager.getOnlineMembers(player); // return pluginRef.getPartyManager().getOnlineMembers(player);
// } // }
// //
// public static boolean hasAlly(String partyName) { // public static boolean hasAlly(String partyName) {
@ -255,7 +255,7 @@
// } // }
// //
// public static String getAllyName(String partyName) { // public static String getAllyName(String partyName) {
// Party ally = PartyManager.getParty(partyName).getAlly(); // Party ally = pluginRef.getPartyManager().getParty(partyName).getAlly();
// if (ally != null) { // if (ally != null) {
// return ally.getName(); // return ally.getName();
// } // }

View File

@ -1,9 +1,9 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//public class InvalidFormulaTypeException extends RuntimeException { public class InvalidFormulaTypeException extends RuntimeException {
// private static final long serialVersionUID = 3368670229490121886L; private static final long serialVersionUID = 3368670229490121886L;
//
// public InvalidFormulaTypeException() { public InvalidFormulaTypeException() {
// super("That is not a valid FormulaType."); super("That is not a valid FormulaType.");
// } }
//} }

View File

@ -1,9 +1,9 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//public class InvalidPlayerException extends RuntimeException { public class InvalidPlayerException extends RuntimeException {
// private static final long serialVersionUID = 907213002618581385L; private static final long serialVersionUID = 907213002618581385L;
//
// public InvalidPlayerException() { public InvalidPlayerException() {
// super("That player does not exist in the database."); super("That player does not exist in the database.");
// } }
//} }

View File

@ -1,9 +1,9 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//public class InvalidSkillException extends RuntimeException { public class InvalidSkillException extends RuntimeException {
// private static final long serialVersionUID = 942705284195791157L; private static final long serialVersionUID = 942705284195791157L;
//
// public InvalidSkillException(String s) { public InvalidSkillException(String s) {
// super(s + " does not match a valid skill."); super(s + " does not match a valid skill.");
// } }
//} }

View File

@ -1,9 +1,9 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//public class InvalidXPGainReasonException extends RuntimeException { public class InvalidXPGainReasonException extends RuntimeException {
// private static final long serialVersionUID = 4427052841957931157L; private static final long serialVersionUID = 4427052841957931157L;
//
// public InvalidXPGainReasonException() { public InvalidXPGainReasonException() {
// super("That is not a valid XPGainReason."); super("That is not a valid XPGainReason.");
// } }
//} }

View File

@ -1,11 +1,11 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//
//public class McMMOPlayerNotFoundException extends RuntimeException { public class McMMOPlayerNotFoundException extends RuntimeException {
// private static final long serialVersionUID = 761917904993202836L; private static final long serialVersionUID = 761917904993202836L;
//
// public McMMOPlayerNotFoundException(Player player) { public McMMOPlayerNotFoundException(Player player) {
// super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId()); super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
// } }
//} }

View File

@ -1,7 +1,7 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//public class MissingSkillPropertyDefinition extends RuntimeException { public class MissingSkillPropertyDefinition extends RuntimeException {
// public MissingSkillPropertyDefinition(String details) { public MissingSkillPropertyDefinition(String details) {
// super("A skill property is undefined! Details: " + details); super("A skill property is undefined! Details: " + details);
// } }
//} }

View File

@ -1,9 +1,9 @@
//package com.gmail.nossr50.api.exceptions; package com.gmail.nossr50.api.exceptions;
//
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//
//public class UndefinedSkillBehaviour extends RuntimeException { public class UndefinedSkillBehaviour extends RuntimeException {
// public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) { public UndefinedSkillBehaviour(PrimarySkillType primarySkillType) {
// super("Undefined behaviour for skill! - " + primarySkillType.toString()); super("Undefined behaviour for skill! - " + primarySkillType.toString());
// } }
//} }

View File

@ -11,16 +11,22 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class BukkitFactory { public class BukkitFactory {
private mcMMO pluginRef;
public BukkitFactory(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
/** /**
* Creates a BukkitMMOItem which contains Bukkit implementations for the type MMOItem * Creates a BukkitMMOItem which contains Bukkit implementations for the type MMOItem
* @return a new BukkitMMOItem * @return a new BukkitMMOItem
*/ */
public static MMOItem<?> createItem(String namespaceKey, int amount, RawNBT rawNBT) { public MMOItem<?> createItem(String namespaceKey, int amount, RawNBT rawNBT) {
return new BukkitMMOItem(namespaceKey, amount, rawNBT); return new BukkitMMOItem(namespaceKey, amount, rawNBT);
} }
public static MMOItem<?> createItem(ItemStack itemStack) { public MMOItem<?> createItem(ItemStack itemStack) {
return createItem(itemStack.getType().getKey().toString(), itemStack.getAmount(), new RawNBT(mcMMO.getNbtManager().getNBT(itemStack).toString())); return createItem(itemStack.getType().getKey().toString(), itemStack.getAmount(), new RawNBT(pluginRef.getNbtManager().getNBT(itemStack).toString()));
} }
} }

View File

@ -1,23 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.mcMMO;
import org.bukkit.plugin.Plugin;
public class AdminChatManager extends ChatManager {
protected AdminChatManager(Plugin plugin) {
super(plugin,
mcMMO.getConfigManager().getConfigCommands().isUseDisplayNames(),
mcMMO.getConfigManager().getConfigCommands().getAdminChatPrefix());
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOAdminChatEvent(plugin, senderName, displayName, message, isAsync));
}
@Override
protected void sendMessage() {
plugin.getServer().broadcast(message, "mcmmo.chat.adminchat");
}
}

View File

@ -2,83 +2,105 @@ package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.chat.McMMOChatEvent; 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.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public abstract class ChatManager { import java.util.regex.Matcher;
protected Plugin plugin; import java.util.regex.Pattern;
protected boolean useDisplayNames;
protected String chatPrefix;
protected String senderName; public class ChatManager {
protected String displayName; private final String ADMIN_CHAT_PERMISSION = "mcmmo.chat.adminchat";
protected String message; private mcMMO pluginRef;
protected ChatManager(Plugin plugin, boolean useDisplayNames, String chatPrefix) { public ChatManager(mcMMO pluginRef) {
this.plugin = plugin; this.pluginRef = pluginRef;
this.useDisplayNames = useDisplayNames;
this.chatPrefix = chatPrefix;
} }
protected void handleChat(McMMOChatEvent event) { public void processAdminChat(Player player, String message) {
plugin.getServer().getPluginManager().callEvent(event); sendAdminChatMessage(new McMMOAdminChatEvent(pluginRef, player.getName(), player.getDisplayName(), message));
}
public void processAdminChat(String senderName, String displayName, String message) {
sendAdminChatMessage(new McMMOAdminChatEvent(pluginRef, senderName, displayName, message));
}
public void processPartyChat(Party party, Player sender, String message) {
sendPartyChatMessage(new McMMOPartyChatEvent(pluginRef, sender.getName(), sender.getDisplayName(), party, message));
}
public void processPartyChat(Party party, String senderName, String message) {
sendPartyChatMessage(new McMMOPartyChatEvent(pluginRef, senderName, senderName, party, message));
}
private void sendAdminChatMessage(McMMOAdminChatEvent event) {
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
senderName = event.getSender(); String chatPrefix = pluginRef.getConfigManager().getConfigCommands().getAdminChatPrefix();
displayName = useDisplayNames ? event.getDisplayName() : senderName; String senderName = event.getSender();
message = LocaleLoader.formatString(chatPrefix, displayName) + " " + event.getMessage(); String displayName = pluginRef.getConfigManager().getConfigCommands().isUseDisplayNames() ? event.getDisplayName() : senderName;
String message = pluginRef.getLocaleManager().formatString(chatPrefix, displayName) + " " + event.getMessage();
sendMessage(); pluginRef.getServer().broadcast(message, ADMIN_CHAT_PERMISSION);
}
private void sendPartyChatMessage(McMMOPartyChatEvent event) {
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
Party party = event.getParty();
String chatPrefix = pluginRef.getConfigManager().getConfigParty().getPartyChatPrefixFormat();
String senderName = event.getSender();
String displayName = pluginRef.getConfigManager().getConfigCommands().isUseDisplayNames() ? event.getDisplayName() : senderName;
String message = pluginRef.getLocaleManager().formatString(chatPrefix, displayName) + " " + event.getMessage();
if (pluginRef.getConfigManager().getConfigParty().isPartyLeaderColoredGold()
&& senderName.equalsIgnoreCase(party.getLeader().getPlayerName())) {
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
}
for (Player member : party.getOnlineMembers()) {
member.sendMessage(message);
}
if (party.getAlly() != null) {
for (Player member : party.getAlly().getOnlineMembers()) {
String allyPrefix = pluginRef.getLocaleManager().formatString(pluginRef.getConfigManager().getConfigParty().getPartyChatPrefixAlly());
member.sendMessage(allyPrefix + message);
}
}
pluginRef.getServer().getConsoleSender().sendMessage(ChatColor.stripColor("[mcMMO] [P]<" + party.getName() + ">" + message));
/* /*
* Party Chat Spying * Party Chat Spying
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
*/ */
if (event instanceof McMMOPartyChatEvent) { for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
//We need to grab the party chat name Player player = mcMMOPlayer.getPlayer();
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
//Find the people with permissions //Check for toggled players
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) { if (mcMMOPlayer.isPartyChatSpying()) {
Player player = mcMMOPlayer.getPlayer(); Party adminParty = mcMMOPlayer.getParty();
//Check for toggled players //Only message admins not part of this party
if (mcMMOPlayer.isPartyChatSpying()) { if (adminParty != null) {
Party adminParty = mcMMOPlayer.getParty(); //TODO: Incorporate JSON
if (adminParty != event.getParty())
//Only message admins not part of this party player.sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy.Chat", event.getParty(), message));
if (adminParty != null) { } else {
//TODO: Incorporate JSON player.sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy.Chat", event.getParty(), message));
if (!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
} else {
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
}
} }
} }
} }
} }
public void handleChat(String senderName, String message) {
handleChat(senderName, senderName, message, false);
}
public void handleChat(Player player, String message, boolean isAsync) {
handleChat(player.getName(), player.getDisplayName(), message, isAsync);
}
public void handleChat(String senderName, String displayName, String message) {
handleChat(senderName, displayName, message, false);
}
public abstract void handleChat(String senderName, String displayName, String message, boolean isAsync);
protected abstract void sendMessage();
} }

View File

@ -1,30 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
public class ChatManagerFactory {
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<>();
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<>();
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
switch (mode) {
case ADMIN:
if (!adminChatManagers.containsKey(plugin)) {
adminChatManagers.put(plugin, new AdminChatManager(plugin));
}
return adminChatManagers.get(plugin);
case PARTY:
if (!partyChatManagers.containsKey(plugin)) {
partyChatManagers.put(plugin, new PartyChatManager(plugin));
}
return partyChatManagers.get(plugin);
default:
return null;
}
}
}

View File

@ -1,30 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.party.PartyChatTask;
import org.bukkit.plugin.Plugin;
public class PartyChatManager extends ChatManager {
private Party party;
protected PartyChatManager(Plugin plugin) {
super(plugin, mcMMO.getConfigManager().getConfigParty().isPartyDisplayNamesEnabled(),
mcMMO.getConfigManager().getConfigParty().getPartyChat().getPartyChatPrefixFormat());
}
public void setParty(Party party) {
this.party = party;
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOPartyChatEvent(plugin, senderName, displayName, party.getName(), message, isAsync));
}
@Override
protected void sendMessage() {
new PartyChatTask(plugin, party, senderName, displayName, message).runTask(plugin);
}
}

View File

@ -14,22 +14,28 @@ import java.util.List;
public class MHDCommand implements TabExecutor { public class MHDCommand implements TabExecutor {
private mcMMO pluginRef;
public MHDCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) { if (pluginRef.getDatabaseManager() instanceof SQLDatabaseManager) {
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager(); SQLDatabaseManager m = (SQLDatabaseManager) pluginRef.getDatabaseManager();
m.resetMobHealthSettings(); m.resetMobHealthSettings();
for (McMMOPlayer player : UserManager.getPlayers()) { for (McMMOPlayer player : UserManager.getPlayers()) {
player.getProfile().setMobHealthbarType(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType()); player.getProfile().setMobHealthbarType(pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType());
} }
sender.sendMessage("Mob health reset"); sender.sendMessage("Mob health reset");
return true; return true;
} }
if (mcMMO.getDatabaseManager() instanceof FlatfileDatabaseManager) { if (pluginRef.getDatabaseManager() instanceof FlatfileDatabaseManager) {
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager(); FlatfileDatabaseManager m = (FlatfileDatabaseManager) pluginRef.getDatabaseManager();
m.resetMobHealthSettings(); m.resetMobHealthSettings();
for (McMMOPlayer player : UserManager.getPlayers()) { for (McMMOPlayer player : UserManager.getPlayers()) {
player.getProfile().setMobHealthbarType(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType()); player.getProfile().setMobHealthbarType(pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType());
} }
sender.sendMessage("Mob health reset"); sender.sendMessage("Mob health reset");
return true; return true;

View File

@ -1,320 +0,0 @@
package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.skills.ModConfigType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
public class McImportCommand implements CommandExecutor {
int fileAmount;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
importModConfig();
return true;
default:
return false;
}
}
public void importModConfig() {
String importFilePath = mcMMO.getModDirectory() + File.separator + "import";
File importFile = new File(importFilePath, "import.log");
mcMMO.p.getLogger().info("Starting import of mod materials...");
fileAmount = 0;
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<>();
BufferedReader in = null;
try {
// Open the file
in = new BufferedReader(new FileReader(importFile));
String line;
String materialName;
String modName;
// While not at the end of the file
while ((line = in.readLine()) != null) {
String[] split1 = line.split("material ");
if (split1.length != 2) {
continue;
}
String[] split2 = split1[1].split(" with");
if (split2.length != 2) {
continue;
}
materialName = split2[0];
// Categorise each material under a mod config type
ModConfigType type = ModConfigType.getModConfigType(materialName);
if (!materialNames.containsKey(type)) {
materialNames.put(type, new ArrayList<>());
}
materialNames.get(type).add(materialName);
}
} catch (FileNotFoundException e) {
mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)");
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
return;
} catch (Exception e) {
e.printStackTrace();
return;
} finally {
tryClose(in);
}
createOutput(materialNames);
mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!");
}
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
for (ModConfigType modConfigType : materialNames.keySet()) {
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<>();
for (String materialName : materialNames.get(modConfigType)) {
String modName = Misc.getModName(materialName);
if (!materialNamesType.containsKey(modName)) {
materialNamesType.put(modName, new ArrayList<>());
}
materialNamesType.get(modName).add(materialName);
}
createOutput(modConfigType, materialNamesType);
}
}
private void tryClose(Closeable c) {
if (c == null) {
return;
}
try {
c.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private void createOutput(ModConfigType modConfigType, HashMap<String, ArrayList<String>> materialNames) {
File outputFilePath = new File(mcMMO.getModDirectory() + File.separator + "output");
if (!outputFilePath.exists() && !outputFilePath.mkdirs()) {
mcMMO.p.getLogger().severe("Could not create output directory! " + outputFilePath.getAbsolutePath());
}
FileWriter out = null;
String type = modConfigType.name().toLowerCase();
for (String modName : materialNames.keySet()) {
File outputFile = new File(outputFilePath, modName + "." + type + ".yml");
mcMMO.p.getLogger().info("Creating " + outputFile.getName());
try {
if (outputFile.exists() && !outputFile.delete()) {
mcMMO.p.getLogger().severe("Not able to delete old output file! " + outputFile.getAbsolutePath());
}
if (!outputFile.createNewFile()) {
mcMMO.p.getLogger().severe("Could not create output file! " + outputFile.getAbsolutePath());
continue;
}
StringBuilder writer = new StringBuilder();
HashMap<String, ArrayList<String>> configSections = getConfigSections(modConfigType, modName, materialNames);
if (configSections == null) {
mcMMO.p.getLogger().severe("Something went wrong!! type is " + type);
return;
}
// Write the file, go through each skill and write all the materials
for (String configSection : configSections.keySet()) {
if (configSection.equals("UNIDENTIFIED")) {
writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n");
writer.append("# copy and pasted to a valid section of this config file.").append("\r\n");
}
writer.append(configSection).append(":").append("\r\n");
for (String line : configSections.get(configSection)) {
writer.append(line).append("\r\n");
}
writer.append("\r\n");
}
out = new FileWriter(outputFile);
out.write(writer.toString());
} catch (Exception e) {
e.printStackTrace();
return;
} finally {
tryClose(out);
fileAmount++;
}
}
}
private HashMap<String, ArrayList<String>> getConfigSections(ModConfigType type, String modName, HashMap<String, ArrayList<String>> materialNames) {
switch (type) {
case BLOCKS:
return getConfigSectionsBlocks(modName, materialNames);
case TOOLS:
return getConfigSectionsTools(modName, materialNames);
case ARMOR:
return getConfigSectionsArmor(modName, materialNames);
case UNKNOWN:
return getConfigSectionsUnknown(modName, materialNames);
}
return null;
}
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a skill
for (String materialName : materialNames.get(modName)) {
String skillName = "UNIDENTIFIED";
if (materialName.contains("ORE")) {
skillName = "Mining";
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
skillName = "Woodcutting";
} else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
skillName = "Herbalism";
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
skillName = "Excavation";
}
if (!configSections.containsKey(skillName)) {
configSections.put(skillName, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(skillName);
skillContents.add(" " + materialName + "|0:");
skillContents.add(" " + " " + "XP_Gain: 99");
skillContents.add(" " + " " + "Double_Drops_Enabled: true");
if (skillName.equals("Mining")) {
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
} else if (skillName.equals("Woodcutting")) {
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
}
}
return configSections;
}
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a tool type
for (String materialName : materialNames.get(modName)) {
String toolType = "UNIDENTIFIED";
if (materialName.contains("PICKAXE")) {
toolType = "Pickaxes";
} else if (materialName.contains("AXE")) {
toolType = "Axes";
} else if (materialName.contains("BOW")) {
toolType = "Bows";
} else if (materialName.contains("HOE")) {
toolType = "Hoes";
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
toolType = "Shovels";
} else if (materialName.contains("SWORD")) {
toolType = "Swords";
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
skillContents.add(" " + materialName + ":");
skillContents.add(" " + " " + "XP_Modifier: 1.0");
skillContents.add(" " + " " + "Tier: 1");
skillContents.add(" " + " " + "Ability_Enabled: true");
addRepairableLines(materialName, skillContents);
}
return configSections;
}
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under an armor type
for (String materialName : materialNames.get(modName)) {
String toolType = "UNIDENTIFIED";
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
toolType = "Boots";
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
toolType = "Chestplates";
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
toolType = "Helmets";
} else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
toolType = "Leggings";
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
skillContents.add(" " + materialName + ":");
addRepairableLines(materialName, skillContents);
}
return configSections;
}
private void addRepairableLines(String materialName, ArrayList<String> skillContents) {
skillContents.add(" " + " " + "Repairable: true");
skillContents.add(" " + " " + "Repair_Material: REPAIR_MATERIAL_NAME");
skillContents.add(" " + " " + "Repair_Material_Data_Value: 0");
skillContents.add(" " + " " + "Repair_Material_Quantity: 9");
skillContents.add(" " + " " + "Repair_Material_Pretty_Name: Repair Item Name");
skillContents.add(" " + " " + "Repair_MinimumLevel: 0");
skillContents.add(" " + " " + "Repair_XpMultiplier: 1.0");
Material material = Material.matchMaterial(materialName);
short durability = (material == null) ? (short) 9999 : material.getMaxDurability();
skillContents.add(" " + " " + "Durability: " + ((durability > 0) ? durability : (short) 9999));
}
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and print them
for (String materialName : materialNames.get(modName)) {
String configKey = "UNIDENTIFIED";
if (!configSections.containsKey(configKey)) {
configSections.put(configKey, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(configKey);
skillContents.add(" " + materialName);
}
return configSections;
}
}

View File

@ -1,11 +1,18 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class McabilityCommand extends ToggleCommand { public class McabilityCommand extends ToggleCommand {
private mcMMO pluginRef;
public McabilityCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
protected boolean hasOtherPermission(CommandSender sender) { protected boolean hasOtherPermission(CommandSender sender) {
return Permissions.mcabilityOthers(sender); return Permissions.mcabilityOthers(sender);
@ -18,12 +25,12 @@ public class McabilityCommand extends ToggleCommand {
@Override @Override
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) { protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On"))); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
mcMMOPlayer.toggleAbilityUse(); mcMMOPlayer.toggleAbilityUse();
} }
@Override @Override
protected void sendSuccessMessage(CommandSender sender, String playerName) { protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability.Toggle", playerName));
} }
} }

View File

@ -18,11 +18,22 @@ import java.util.Collections;
import java.util.List; import java.util.List;
public class McconvertCommand implements TabExecutor { public class McconvertCommand implements TabExecutor {
private static final List<String> FORMULA_TYPES; private List<String> FORMULA_TYPES;
private static final List<String> DATABASE_TYPES; private List<String> DATABASE_TYPES;
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience"); private final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
private CommandExecutor databaseConvertCommand;
private CommandExecutor experienceConvertCommand;
static { private mcMMO pluginRef;
public McconvertCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
databaseConvertCommand = new ConvertDatabaseCommand(pluginRef);
experienceConvertCommand = new ConvertExperienceCommand(pluginRef);
initTypes();
}
private void initTypes() {
ArrayList<String> formulaTypes = new ArrayList<>(); ArrayList<String> formulaTypes = new ArrayList<>();
ArrayList<String> databaseTypes = new ArrayList<>(); ArrayList<String> databaseTypes = new ArrayList<>();
@ -37,7 +48,7 @@ public class McconvertCommand implements TabExecutor {
// Custom stuff // Custom stuff
databaseTypes.remove(DatabaseType.CUSTOM.toString()); databaseTypes.remove(DatabaseType.CUSTOM.toString());
if (mcMMO.getDatabaseManager().getDatabaseType() == DatabaseType.CUSTOM) { if (pluginRef.getDatabaseManager().getDatabaseType() == DatabaseType.CUSTOM) {
databaseTypes.add(DatabaseManagerFactory.getCustomDatabaseManagerClass().getName()); databaseTypes.add(DatabaseManagerFactory.getCustomDatabaseManagerClass().getName());
} }
@ -46,12 +57,8 @@ public class McconvertCommand implements TabExecutor {
FORMULA_TYPES = ImmutableList.copyOf(formulaTypes); FORMULA_TYPES = ImmutableList.copyOf(formulaTypes);
DATABASE_TYPES = ImmutableList.copyOf(databaseTypes); DATABASE_TYPES = ImmutableList.copyOf(databaseTypes);
} }
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {

View File

@ -1,11 +1,18 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class McgodCommand extends ToggleCommand { public class McgodCommand extends ToggleCommand {
private mcMMO pluginRef;
public McgodCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
protected boolean hasOtherPermission(CommandSender sender) { protected boolean hasOtherPermission(CommandSender sender) {
return Permissions.mcgodOthers(sender); return Permissions.mcgodOthers(sender);
@ -18,12 +25,12 @@ public class McgodCommand extends ToggleCommand {
@Override @Override
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) { protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled"))); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
mcMMOPlayer.toggleGodMode(); mcMMOPlayer.toggleGodMode();
} }
@Override @Override
protected void sendSuccessMessage(CommandSender sender, String playerName) { protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Toggle", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode.Toggle", playerName));
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.commands.party.PartySubcommandType; import com.gmail.nossr50.commands.party.PartySubcommandType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -10,6 +9,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class McmmoCommand implements CommandExecutor { public class McmmoCommand implements CommandExecutor {
private mcMMO pluginRef;
public McmmoCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -19,16 +25,16 @@ public class McmmoCommand implements CommandExecutor {
return true; return true;
} }
String description = LocaleLoader.getString("mcMMO.Description"); String description = pluginRef.getLocaleManager().getString("mcMMO.Description");
String[] mcSplit = description.split(","); String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit); sender.sendMessage(mcSplit);
if (mcMMO.getConfigManager().getConfigAds().isShowDonationInfo()) { if (pluginRef.getConfigManager().getConfigAds().isShowDonationInfo()) {
sender.sendMessage(LocaleLoader.getString("MOTD.Donate")); sender.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Donate"));
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal"); sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
} }
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion())); sender.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Version", pluginRef.getDescription().getVersion()));
// mcMMO.getHolidayManager().anniversaryCheck(sender); // mcMMO.getHolidayManager().anniversaryCheck(sender);
return true; return true;
@ -40,7 +46,7 @@ public class McmmoCommand implements CommandExecutor {
return true; return true;
} }
sender.sendMessage(LocaleLoader.getString("Commands.mcc.Header")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcc.Header"));
displayGeneralCommands(sender); displayGeneralCommands(sender);
displayOtherCommands(sender); displayOtherCommands(sender);
displayPartyCommands(sender); displayPartyCommands(sender);
@ -53,16 +59,16 @@ public class McmmoCommand implements CommandExecutor {
} }
private void displayGeneralCommands(CommandSender sender) { private void displayGeneralCommands(CommandSender sender) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mcstats " + LocaleLoader.getString("Commands.Stats")); sender.sendMessage(ChatColor.DARK_AQUA + " /mcstats " + pluginRef.getLocaleManager().getString("Commands.Stats"));
sender.sendMessage(ChatColor.DARK_AQUA + " /<skill>" + LocaleLoader.getString("Commands.SkillInfo")); sender.sendMessage(ChatColor.DARK_AQUA + " /<skill>" + pluginRef.getLocaleManager().getString("Commands.SkillInfo"));
sender.sendMessage(ChatColor.DARK_AQUA + " /mctop " + LocaleLoader.getString("Commands.Leaderboards")); sender.sendMessage(ChatColor.DARK_AQUA + " /mctop " + pluginRef.getLocaleManager().getString("Commands.Leaderboards"));
if (Permissions.inspect(sender)) { if (Permissions.inspect(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /inspect " + LocaleLoader.getString("Commands.Inspect")); sender.sendMessage(ChatColor.DARK_AQUA + " /inspect " + pluginRef.getLocaleManager().getString("Commands.Inspect"));
} }
if (Permissions.mcability(sender)) { if (Permissions.mcability(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mcability " + LocaleLoader.getString("Commands.ToggleAbility")); sender.sendMessage(ChatColor.DARK_AQUA + " /mcability " + pluginRef.getLocaleManager().getString("Commands.ToggleAbility"));
} }
} }
@ -71,41 +77,41 @@ public class McmmoCommand implements CommandExecutor {
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender)) if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
return; return;
sender.sendMessage(LocaleLoader.getString("Commands.Other")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Other"));
if (Permissions.skillreset(sender)) { if (Permissions.skillreset(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset")); sender.sendMessage(ChatColor.DARK_AQUA + " /skillreset <skill|all> " + pluginRef.getLocaleManager().getString("Commands.Reset"));
} }
if (Permissions.mmoedit(sender)) { if (Permissions.mmoedit(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mmoedit " + LocaleLoader.getString("Commands.mmoedit")); sender.sendMessage(ChatColor.DARK_AQUA + " /mmoedit " + pluginRef.getLocaleManager().getString("Commands.mmoedit"));
} }
if (Permissions.adminChat(sender)) { if (Permissions.adminChat(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /adminchat " + LocaleLoader.getString("Commands.AdminToggle")); sender.sendMessage(ChatColor.DARK_AQUA + " /adminchat " + pluginRef.getLocaleManager().getString("Commands.AdminToggle"));
} }
if (Permissions.mcgod(sender)) { if (Permissions.mcgod(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /mcgod " + LocaleLoader.getString("Commands.mcgod")); sender.sendMessage(ChatColor.DARK_AQUA + " /mcgod " + pluginRef.getLocaleManager().getString("Commands.mcgod"));
} }
} }
private void displayPartyCommands(CommandSender sender) { private void displayPartyCommands(CommandSender sender) {
if (Permissions.party(sender)) { if (Permissions.party(sender)) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Commands"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1")); sender.sendMessage(ChatColor.DARK_AQUA + " /party create <" + pluginRef.getLocaleManager().getString("Commands.Usage.PartyName") + "> " + pluginRef.getLocaleManager().getString("Commands.Party1"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2")); sender.sendMessage(ChatColor.DARK_AQUA + " /party join <" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "> " + pluginRef.getLocaleManager().getString("Commands.Party2"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party quit " + LocaleLoader.getString("Commands.Party.Quit")); sender.sendMessage(ChatColor.DARK_AQUA + " /party quit " + pluginRef.getLocaleManager().getString("Commands.Party.Quit"));
if (Permissions.partyChat(sender)) { if (Permissions.partyChat(sender)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /party chat " + LocaleLoader.getString("Commands.Party.Toggle")); sender.sendMessage(ChatColor.DARK_AQUA + " /party chat " + pluginRef.getLocaleManager().getString("Commands.Party.Toggle"));
} }
sender.sendMessage(ChatColor.DARK_AQUA + " /party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite")); sender.sendMessage(ChatColor.DARK_AQUA + " /party invite <" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "> " + pluginRef.getLocaleManager().getString("Commands.Party.Invite"));
sender.sendMessage(ChatColor.DARK_AQUA + " /party accept " + LocaleLoader.getString("Commands.Party.Accept")); sender.sendMessage(ChatColor.DARK_AQUA + " /party accept " + pluginRef.getLocaleManager().getString("Commands.Party.Accept"));
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) { if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
sender.sendMessage(ChatColor.DARK_AQUA + " /party teleport <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Teleport")); sender.sendMessage(ChatColor.DARK_AQUA + " /party teleport <" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "> " + pluginRef.getLocaleManager().getString("Commands.Party.Teleport"));
} }
} }
} }

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -12,6 +12,13 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
public class McnotifyCommand implements TabExecutor { public class McnotifyCommand implements TabExecutor {
private mcMMO pluginRef;
public McnotifyCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -20,9 +27,9 @@ public class McnotifyCommand implements TabExecutor {
//Not Loaded yet //Not Loaded yet
if (mcMMOPlayer == null) if (mcMMOPlayer == null)
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On"))); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications(); mcMMOPlayer.toggleChatNotifications();
return true; return true;

View File

@ -1,11 +1,18 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class McrefreshCommand extends ToggleCommand { public class McrefreshCommand extends ToggleCommand {
private mcMMO pluginRef;
public McrefreshCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
protected boolean hasOtherPermission(CommandSender sender) { protected boolean hasOtherPermission(CommandSender sender) {
return Permissions.mcrefreshOthers(sender); return Permissions.mcrefreshOthers(sender);
@ -23,11 +30,11 @@ public class McrefreshCommand extends ToggleCommand {
mcMMOPlayer.resetToolPrepMode(); mcMMOPlayer.resetToolPrepMode();
mcMMOPlayer.resetAbilityMode(); mcMMOPlayer.resetAbilityMode();
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Ability.Generic.Refresh")); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
} }
@Override @Override
protected void sendSuccessMessage(CommandSender sender, String playerName) { protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcrefresh.Success", playerName));
} }
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
@ -14,6 +13,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class McscoreboardCommand implements TabExecutor { public class McscoreboardCommand implements TabExecutor {
private mcMMO pluginRef;
public McscoreboardCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear"); private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear");
@Override @Override
@ -26,23 +32,23 @@ public class McscoreboardCommand implements TabExecutor {
case 1: case 1:
if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("reset")) { if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("reset")) {
ScoreboardManager.clearBoard(sender.getName()); ScoreboardManager.clearBoard(sender.getName());
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Clear")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Clear"));
return true; return true;
} }
if (args[0].equalsIgnoreCase("keep")) { if (args[0].equalsIgnoreCase("keep")) {
if (!mcMMO.getScoreboardSettings().getScoreboardsEnabled()) { if (!pluginRef.getScoreboardSettings().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Disabled"));
return true; return true;
} }
if (!ScoreboardManager.isBoardShown(sender.getName())) { if (!ScoreboardManager.isBoardShown(sender.getName())) {
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.NoBoard")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.NoBoard"));
return true; return true;
} }
ScoreboardManager.keepBoard(sender.getName()); ScoreboardManager.keepBoard(sender.getName());
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Keep")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Keep"));
return true; return true;
} }
@ -57,7 +63,7 @@ public class McscoreboardCommand implements TabExecutor {
int time = Math.abs(Integer.parseInt(args[1])); int time = Math.abs(Integer.parseInt(args[1]));
ScoreboardManager.setRevertTimer(sender.getName(), time); ScoreboardManager.setRevertTimer(sender.getName(), time);
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", time)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Timer", time));
return true; return true;
} }
@ -79,10 +85,10 @@ public class McscoreboardCommand implements TabExecutor {
} }
private boolean help(CommandSender sender) { private boolean help(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.0")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Help.0"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.1")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Help.1"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.2")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Help.2"));
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Help.3")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Help.3"));
return true; return true;
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType; import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
@ -17,7 +16,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class XprateCommand implements TabExecutor { public class XprateCommand implements TabExecutor {
private final double ORIGINAL_XP_RATE = mcMMO.getDynamicSettingsManager().getExperienceManager().getGlobalXpMult();
private mcMMO pluginRef;
public XprateCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@ -32,27 +36,27 @@ public class XprateCommand implements TabExecutor {
return true; return true;
} }
if (mcMMO.p.isXPEventEnabled()) { if (pluginRef.isXPEventEnabled()) {
if (mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages()) { if (pluginRef.getConfigManager().getConfigEvent().isSendTitleMessages()) {
mcMMO.getNotificationManager().broadcastTitle(mcMMO.p.getServer(), pluginRef.getNotificationManager().broadcastTitle(pluginRef.getServer(),
LocaleLoader.getString("Commands.Event.Stop"), pluginRef.getLocaleManager().getString("Commands.Event.Stop"),
LocaleLoader.getString("Commands.Event.Stop.Subtitle"), pluginRef.getLocaleManager().getString("Commands.Event.Stop.Subtitle"),
10, 10 * 20, 20); 10, 10 * 20, 20);
} }
if (mcMMO.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) { if (pluginRef.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop")); pluginRef.getServer().broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Event.Stop"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); pluginRef.getServer().broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Event.Stop.Subtitle"));
} }
//Admin notification //Admin notification
mcMMO.getNotificationManager().processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_END); pluginRef.getNotificationManager().processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_END);
mcMMO.p.toggleXpEventEnabled(); pluginRef.toggleXpEventEnabled();
} }
mcMMO.getDynamicSettingsManager().getExperienceManager().resetGlobalXpMult(); pluginRef.getDynamicSettingsManager().getExperienceManager().resetGlobalXpMult();
return true; return true;
case 2: case 2:
@ -66,9 +70,9 @@ public class XprateCommand implements TabExecutor {
} }
if (CommandUtils.shouldDisableToggle(args[1])) { if (CommandUtils.shouldDisableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(false); pluginRef.setXPEventEnabled(false);
} else if (CommandUtils.shouldEnableToggle(args[1])) { } else if (CommandUtils.shouldEnableToggle(args[1])) {
mcMMO.p.setXPEventEnabled(true); pluginRef.setXPEventEnabled(true);
} else { } else {
return false; return false;
} }
@ -76,26 +80,26 @@ public class XprateCommand implements TabExecutor {
int newXpRate = Integer.parseInt(args[0]); int newXpRate = Integer.parseInt(args[0]);
if (newXpRate < 0) { if (newXpRate < 0) {
sender.sendMessage(ChatColor.RED + LocaleLoader.getString("Commands.NegativeNumberWarn")); sender.sendMessage(ChatColor.RED + pluginRef.getLocaleManager().getString("Commands.NegativeNumberWarn"));
return true; return true;
} }
mcMMO.getDynamicSettingsManager().getExperienceManager().setGlobalXpMult(newXpRate); pluginRef.getDynamicSettingsManager().getExperienceManager().setGlobalXpMult(newXpRate);
if (mcMMO.getConfigManager().getConfigEvent().isSendTitleMessages()) { if (pluginRef.getConfigManager().getConfigEvent().isSendTitleMessages()) {
mcMMO.getNotificationManager().broadcastTitle(mcMMO.p.getServer(), pluginRef.getNotificationManager().broadcastTitle(pluginRef.getServer(),
LocaleLoader.getString("Commands.Event.Start"), pluginRef.getLocaleManager().getString("Commands.Event.Start"),
LocaleLoader.getString("Commands.Event.XP", newXpRate), pluginRef.getLocaleManager().getString("Commands.Event.XP", newXpRate),
10, 10 * 20, 20); 10, 10 * 20, 20);
} }
if (mcMMO.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) { if (pluginRef.getConfigManager().getConfigEvent().isBroadcastXPRateEventMessages()) {
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); pluginRef.getServer().broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Event.Start"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); pluginRef.getServer().broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Event.XP", newXpRate));
} }
//Admin notification //Admin notification
mcMMO.getNotificationManager().processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_MODIFY, String.valueOf(newXpRate)); pluginRef.getNotificationManager().processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_MODIFY, String.valueOf(newXpRate));
return true; return true;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.admin; package com.gmail.nossr50.commands.admin;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -10,21 +10,26 @@ import org.bukkit.command.CommandSender;
* @author Mark Vainomaa * @author Mark Vainomaa
*/ */
public final class McmmoReloadLocaleCommand implements CommandExecutor { public final class McmmoReloadLocaleCommand implements CommandExecutor {
private mcMMO pluginRef;
public McmmoReloadLocaleCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { if (args.length == 0) {
case 0: if (!Permissions.reloadlocale(sender)) {
if (!Permissions.reloadlocale(sender)) { sender.sendMessage(command.getPermissionMessage());
sender.sendMessage(command.getPermissionMessage());
return true;
}
LocaleLoader.reloadLocale();
sender.sendMessage(LocaleLoader.getString("Locale.Reloaded"));
return true; return true;
default: }
return false;
pluginRef.getLocaleManager().reloadLocale();
sender.sendMessage(pluginRef.getLocaleManager().getString("Locale.Reloaded"));
return true;
} }
return false;
} }
} }

View File

@ -1,11 +1,18 @@
package com.gmail.nossr50.commands.admin; package com.gmail.nossr50.commands.admin;
import com.gmail.nossr50.mcMMO;
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;
public class PlayerDebug implements CommandExecutor { public class PlayerDebug implements CommandExecutor {
private mcMMO pluginRef;
public PlayerDebug(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return false; return false;

View File

@ -1,15 +1,16 @@
package com.gmail.nossr50.commands.chat; package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.datatypes.chat.ChatMode; import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.mcMMO;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class AdminChatCommand extends ChatCommand { public class AdminChatCommand extends ChatCommand {
public AdminChatCommand() { public AdminChatCommand(mcMMO pluginRef) {
super(ChatMode.ADMIN); super(ChatMode.ADMIN, pluginRef);
} }
@Override @Override
protected void handleChatSending(CommandSender sender, String[] args) { protected void handleChatSending(CommandSender sender, String[] args) {
chatManager.handleChat(sender.getName(), getDisplayName(sender), buildChatMessage(args, 0)); pluginRef.getChatManager().processAdminChat(sender.getName(), getDisplayName(sender), buildChatMessage(args, 0));
} }
} }

View File

@ -1,13 +1,9 @@
package com.gmail.nossr50.commands.chat; package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.datatypes.chat.ChatMode; import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -21,12 +17,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class ChatCommand implements TabExecutor { public abstract class ChatCommand implements TabExecutor {
protected ChatManager chatManager;
private ChatMode chatMode; private ChatMode chatMode;
public mcMMO pluginRef;
public ChatCommand(ChatMode chatMode) { public ChatCommand(ChatMode chatMode, mcMMO pluginRef) {
this.chatMode = chatMode; this.chatMode = chatMode;
this.chatManager = ChatManagerFactory.getChatManager(mcMMO.p, chatMode); this.pluginRef = pluginRef;
} }
@Override @Override
@ -109,19 +105,19 @@ public abstract class ChatCommand implements TabExecutor {
} }
protected String getDisplayName(CommandSender sender) { protected String getDisplayName(CommandSender sender) {
return (sender instanceof Player) ? ((Player) sender).getDisplayName() : LocaleLoader.getString("Commands.Chat.Console"); return (sender instanceof Player) ? ((Player) sender).getDisplayName() : pluginRef.getLocaleManager().getString("Commands.Chat.Console");
} }
protected abstract void handleChatSending(CommandSender sender, String[] args); protected abstract void handleChatSending(CommandSender sender, String[] args);
private void enableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) { private void enableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) { if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return; return;
} }
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.CHAT))) { if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.1"));
return; return;
} }
@ -131,7 +127,7 @@ public abstract class ChatCommand implements TabExecutor {
private void disableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) { private void disableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) { if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return; return;
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.commands.ToggleCommand; import com.gmail.nossr50.commands.ToggleCommand;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -19,12 +18,12 @@ public class McChatSpy extends ToggleCommand {
@Override @Override
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) { protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled"))); mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
mcMMOPlayer.togglePartyChatSpying(); mcMMOPlayer.togglePartyChatSpying();
} }
@Override @Override
protected void sendSuccessMessage(CommandSender sender, String playerName) { protected void sendSuccessMessage(CommandSender sender, String playerName) {
sender.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Toggle", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy.Toggle", playerName));
} }
} }

View File

@ -1,18 +1,16 @@
package com.gmail.nossr50.commands.chat; package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.datatypes.chat.ChatMode; import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PartyChatCommand extends ChatCommand { public class PartyChatCommand extends ChatCommand {
public PartyChatCommand() { public PartyChatCommand(mcMMO pluginRef) {
super(ChatMode.PARTY); super(ChatMode.PARTY, pluginRef);
} }
@Override @Override
@ -28,33 +26,32 @@ public class PartyChatCommand extends ChatCommand {
party = UserManager.getPlayer((Player) sender).getParty(); party = UserManager.getPlayer((Player) sender).getParty();
if (party == null) { if (party == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return; return;
} }
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.CHAT)) { if (party.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.1"));
return; return;
} }
message = buildChatMessage(args, 0); message = buildChatMessage(args, 0);
} else { } else {
if (args.length < 2) { if (args.length < 2) {
sender.sendMessage(LocaleLoader.getString("Party.Specify")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Specify"));
return; return;
} }
party = PartyManager.getParty(args[0]); party = pluginRef.getPartyManager().getParty(args[0]);
if (party == null) { if (party == null) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.InvalidName"));
return; return;
} }
message = buildChatMessage(args, 1); message = buildChatMessage(args, 1);
} }
((PartyChatManager) chatManager).setParty(party); pluginRef.getChatManager().processPartyChat(party, getDisplayName(sender), message);
chatManager.handleChat(sender.getName(), getDisplayName(sender), message);
} }
} }

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.database.DatabaseConversionTask; import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask; import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
@ -15,15 +14,22 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class ConvertDatabaseCommand implements CommandExecutor { public class ConvertDatabaseCommand implements CommandExecutor {
private mcMMO pluginRef;
public ConvertDatabaseCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]); DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType(); DatabaseType newType = pluginRef.getDatabaseManager().getDatabaseType();
if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) { if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Database.Same", newType.toString()));
return true; return true;
} }
@ -36,34 +42,34 @@ public class ConvertDatabaseCommand implements CommandExecutor {
clazz = Class.forName(args[1]); clazz = Class.forName(args[1]);
if (!DatabaseManager.class.isAssignableFrom(clazz)) { if (!DatabaseManager.class.isAssignableFrom(clazz)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1])); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true; return true;
} }
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz); oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1])); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true; return true;
} }
} }
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
UserManager.saveAll(); UserManager.saveAll();
UserManager.clearAll(); UserManager.clearAll();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { for (Player player : pluginRef.getServer().getOnlinePlayers()) {
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId()); PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId());
if (profile.isLoaded()) { if (profile.isLoaded()) {
mcMMO.getDatabaseManager().saveUser(profile); pluginRef.getDatabaseManager().saveUser(profile);
} }
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(pluginRef, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
} }
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p); new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(pluginRef);
return true; return true;
default: default:

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.database; package com.gmail.nossr50.commands.database;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -10,17 +9,24 @@ import org.bukkit.command.TabExecutor;
import java.util.List; import java.util.List;
public class McpurgeCommand implements TabExecutor { public class McpurgeCommand implements TabExecutor {
private mcMMO pluginRef;
public McpurgeCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 0: case 0:
mcMMO.getDatabaseManager().purgePowerlessUsers(); pluginRef.getDatabaseManager().purgePowerlessUsers();
if (mcMMO.getDatabaseCleaningSettings().getOldUserCutoffMonths() != -1) { if (pluginRef.getDatabaseCleaningSettings().getOldUserCutoffMonths() != -1) {
mcMMO.getDatabaseManager().purgeOldUsers(); pluginRef.getDatabaseManager().purgeOldUsers();
} }
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcpurge.Success"));
return true; return true;
default: default:

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.database; package com.gmail.nossr50.commands.database;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -16,33 +15,37 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public class McremoveCommand implements TabExecutor { public class McremoveCommand implements TabExecutor {
private mcMMO pluginRef;
public McremoveCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { if (args.length == 1) {
case 1: String playerName = CommandUtils.getMatchedPlayerName(args[0]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
return true;
}
UUID uuid = null;
if(Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
} else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, pluginRef.getDatabaseManager().loadPlayerProfile(playerName, false))) {
return true; return true;
}
default: UUID uuid = null;
return false;
if (Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (pluginRef.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcremove.Success", playerName));
} else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}
return true;
} }
return false;
} }
@Override @Override

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.database; package com.gmail.nossr50.commands.database;
import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -11,23 +10,27 @@ import org.bukkit.command.TabExecutor;
import java.util.List; import java.util.List;
public class MmoshowdbCommand implements TabExecutor { public class MmoshowdbCommand implements TabExecutor {
private mcMMO pluginRef;
public MmoshowdbCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { if (args.length == 0) {
case 0: Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
if (clazz != null) { if (clazz != null) {
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", clazz.getName())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoshowdb", clazz.getName()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (mcMMO.getMySQLConfigSettings().isMySQLEnabled() ? "sql" : "flatfile")));
return true; return true;
}
default: sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoshowdb", (pluginRef.getMySQLConfigSettings().isMySQLEnabled() ? "sql" : "flatfile")));
return false; return true;
} }
return false;
} }
@Override @Override

View File

@ -3,13 +3,20 @@ package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class AddlevelsCommand extends ExperienceCommand { public class AddlevelsCommand extends ExperienceCommand {
private mcMMO pluginRef;
public AddlevelsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
protected boolean permissionsCheckSelf(CommandSender sender) { protected boolean permissionsCheckSelf(CommandSender sender) {
return Permissions.addlevels(sender); return Permissions.addlevels(sender);
@ -35,11 +42,11 @@ public class AddlevelsCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value) { protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.1", value));
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
} }
} }

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -37,11 +36,11 @@ public class AddxpCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value) { protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardAll", value));
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardSkill", value, skill.getName()));
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.database.FormulaConversionTask; import com.gmail.nossr50.runnables.database.FormulaConversionTask;
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask; import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
@ -12,6 +11,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class ConvertExperienceCommand implements CommandExecutor { public class ConvertExperienceCommand implements CommandExecutor {
private mcMMO pluginRef;
public ConvertExperienceCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -22,22 +28,22 @@ public class ConvertExperienceCommand implements CommandExecutor {
if(formulaType.toString().equalsIgnoreCase(args[1])) { if(formulaType.toString().equalsIgnoreCase(args[1])) {
FormulaType previousType = formulaType; FormulaType previousType = formulaType;
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Start", previousType.toString(), mcMMO.getConfigManager().getConfigLeveling().getFormulaType().toString())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Experience.Start", previousType.toString(), pluginRef.getConfigManager().getConfigLeveling().getFormulaType().toString()));
UserManager.saveAll(); UserManager.saveAll();
UserManager.clearAll(); UserManager.clearAll();
new FormulaConversionTask(sender, previousType).runTaskLater(mcMMO.p, 1); new FormulaConversionTask(sender, previousType).runTaskLater(pluginRef, 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { for (Player player : pluginRef.getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(pluginRef, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
} }
return true; return true;
} }
} }
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Invalid")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.mcconvert.Experience.Invalid"));
return true; return true;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -20,11 +19,18 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public abstract class ExperienceCommand implements TabExecutor { public abstract class ExperienceCommand implements TabExecutor {
private mcMMO pluginRef;
public ExperienceCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
} }
} }
@ -54,13 +60,13 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
if (skill != null && skill.isChildSkill()) { if (skill != null && skill.isChildSkill()) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
//Profile not loaded //Profile not loaded
if (UserManager.getPlayer(sender.getName()) == null) { if (UserManager.getPlayer(sender.getName()) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -85,7 +91,7 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
if (skill != null && skill.isChildSkill()) { if (skill != null && skill.isChildSkill()) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.ChildSkill"));
return true; return true;
} }
@ -97,11 +103,11 @@ public abstract class ExperienceCommand implements TabExecutor {
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process. // If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
UUID uuid = null; UUID uuid = null;
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName); OfflinePlayer player = pluginRef.getServer().getOfflinePlayer(playerName);
if (player != null) { if (player != null) {
uuid = player.getUniqueId(); uuid = player.getUniqueId();
} }
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false); PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
if (CommandUtils.unloadedProfile(sender, profile)) { if (CommandUtils.unloadedProfile(sender, profile)) {
return true; return true;

View File

@ -3,13 +3,17 @@ package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class MmoeditCommand extends ExperienceCommand { public class MmoeditCommand extends ExperienceCommand {
public MmoeditCommand(mcMMO pluginRef) {
super(pluginRef);
}
@Override @Override
protected boolean permissionsCheckSelf(CommandSender sender) { protected boolean permissionsCheckSelf(CommandSender sender) {
return Permissions.mmoedit(sender); return Permissions.mmoedit(sender);
@ -41,11 +45,11 @@ public class MmoeditCommand extends ExperienceCommand {
@Override @Override
protected void handlePlayerMessageAll(Player player, int value) { protected void handlePlayerMessageAll(Player player, int value) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.AllSkills.1", value));
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.Modified.1", skill.getName(), value));
} }
} }

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -27,11 +26,18 @@ import java.util.UUID;
* value/quantity argument is removed. * value/quantity argument is removed.
*/ */
public class SkillresetCommand implements TabExecutor { public class SkillresetCommand implements TabExecutor {
private mcMMO pluginRef;
public SkillresetCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
} }
} }
@ -84,11 +90,11 @@ public class SkillresetCommand implements TabExecutor {
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process. // If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
UUID uuid = null; UUID uuid = null;
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName); OfflinePlayer player = pluginRef.getServer().getOfflinePlayer(playerName);
if (player != null) { if (player != null) {
uuid = player.getUniqueId(); uuid = player.getUniqueId();
} }
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false); PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
if (CommandUtils.unloadedProfile(sender, profile)) { if (CommandUtils.unloadedProfile(sender, profile)) {
return true; return true;
@ -143,11 +149,11 @@ public class SkillresetCommand implements TabExecutor {
} }
protected void handlePlayerMessageAll(Player player) { protected void handlePlayerMessageAll(Player player) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.All")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.All"));
} }
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.Single", skill.getName()));
} }
private boolean validateArguments(CommandSender sender, String skillName) { private boolean validateArguments(CommandSender sender, String skillName) {

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -12,35 +10,32 @@ import org.bukkit.entity.Player;
public class PartyAcceptCommand implements CommandExecutor { public class PartyAcceptCommand 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) {
switch (args.length) { if (args.length == 1) {
case 1: Player player = (Player) sender;
Player player = (Player) sender;
//Check if player profile is loaded //Check if player profile is loaded
if (UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
PartyManager.joinInvitedParty(mcMMOPlayer);
return true; return true;
}
default: McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));
if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoInvites"));
return true; return true;
}
// Changing parties
if (!pluginRef.getPartyManager().changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
pluginRef.getPartyManager().joinInvitedParty(mcMMOPlayer);
return true;
} }
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "accept"));
return true;
} }
} }

View File

@ -1,9 +1,7 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -13,30 +11,37 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PartyChangeOwnerCommand implements CommandExecutor { public class PartyChangeOwnerCommand implements CommandExecutor {
private mcMMO pluginRef;
public PartyChangeOwnerCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
//Check if player profile is loaded //Check if player profile is loaded
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName); OfflinePlayer target = pluginRef.getServer().getOfflinePlayer(targetName);
if (!playerParty.hasMember(target.getUniqueId())) { if (!playerParty.hasMember(target.getUniqueId())) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.NotInYourParty", targetName));
return true; return true;
} }
PartyManager.setPartyLeader(target.getUniqueId(), playerParty); pluginRef.getPartyManager().setPartyLeader(target.getUniqueId(), playerParty);
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "owner", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
return true; return true;
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -12,7 +11,7 @@ public class PartyChangePasswordCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -33,8 +32,8 @@ public class PartyChangePasswordCommand implements CommandExecutor {
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "password", "[clear|reset]")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "password", "[clear|reset]"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "password", "<" + LocaleLoader.getString("Commands.Usage.Password") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "password", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Password") + ">"));
return true; return true;
} }
} }
@ -42,12 +41,12 @@ public class PartyChangePasswordCommand implements CommandExecutor {
private void unprotectParty(Party party, CommandSender sender) { private void unprotectParty(Party party, CommandSender sender) {
party.setLocked(true); party.setLocked(true);
party.setPassword(null); party.setPassword(null);
sender.sendMessage(LocaleLoader.getString("Party.Password.Removed")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Password.Removed"));
} }
private void protectParty(Party party, CommandSender sender, String password) { private void protectParty(Party party, CommandSender sender, String password) {
party.setLocked(true); party.setLocked(true);
party.setPassword(password); party.setPassword(password);
sender.sendMessage(LocaleLoader.getString("Party.Password.Set", password)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Password.Set", password));
} }
} }

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand; import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@ -24,11 +23,19 @@ import java.util.Collections;
import java.util.List; import java.util.List;
public class PartyCommand implements TabExecutor { public class PartyCommand implements TabExecutor {
private static final List<String> PARTY_SUBCOMMANDS;
private static final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
static { private mcMMO pluginRef;
public PartyCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
initSubCommandList();
}
private List<String> PARTY_SUBCOMMANDS;
private final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
private final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
private void initSubCommandList() {
ArrayList<String> subcommands = new ArrayList<>(); ArrayList<String> subcommands = new ArrayList<>();
for (PartySubcommandType subcommand : PartySubcommandType.values()) { for (PartySubcommandType subcommand : PartySubcommandType.values()) {
@ -61,7 +68,7 @@ public class PartyCommand implements TabExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
//If the party system is disabled, don't fire this command //If the party system is disabled, don't fire this command
if (!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled()) if (!pluginRef.getConfigManager().getConfigParty().isPartySystemEnabled())
return true; return true;
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@ -80,7 +87,7 @@ public class PartyCommand implements TabExecutor {
} }
if (UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); player.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -88,7 +95,7 @@ public class PartyCommand implements TabExecutor {
if (args.length < 1) { if (args.length < 1) {
if (!mcMMOPlayer.inParty()) { if (!mcMMOPlayer.inParty()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return printUsage(player); return printUsage(player);
} }
@ -122,7 +129,7 @@ public class PartyCommand implements TabExecutor {
// Party member commands // Party member commands
if (!mcMMOPlayer.inParty()) { if (!mcMMOPlayer.inParty()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return printUsage(player); return printUsage(player);
} }
@ -143,7 +150,7 @@ public class PartyCommand implements TabExecutor {
// Party leader commands // Party leader commands
if (!mcMMOPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) { if (!mcMMOPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) {
sender.sendMessage(LocaleLoader.getString("Party.NotOwner")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.NotOwner"));
return true; return true;
} }
@ -210,7 +217,7 @@ public class PartyCommand implements TabExecutor {
//Not Loaded //Not Loaded
if (UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return ImmutableList.of(); return ImmutableList.of();
} }
@ -236,9 +243,9 @@ public class PartyCommand implements TabExecutor {
} }
private boolean printUsage(Player player) { private boolean printUsage(Player player) {
player.sendMessage(LocaleLoader.getString("Party.Help.0", "/party join")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.0", "/party join"));
player.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.1", "/party create"));
player.sendMessage(LocaleLoader.getString("Party.Help.2", "/party ?")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.2", "/party ?"));
return true; return true;
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -19,25 +17,25 @@ public class PartyCreateCommand implements CommandExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); player.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
// Check to see if the party exists, and if it does cancel creating a new party // Check to see if the party exists, and if it does cancel creating a new party
if (PartyManager.checkPartyExistence(player, args[1])) { if (pluginRef.getPartyManager().checkPartyExistence(player, args[1])) {
return true; return true;
} }
// Changing parties // Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) { if (!pluginRef.getPartyManager().changeOrJoinParty(mcMMOPlayer, args[1])) {
return true; return true;
} }
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args)); pluginRef.getPartyManager().createParty(mcMMOPlayer, args[1], getPassword(args));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "create", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "[" + LocaleLoader.getString("Commands.Usage.Password") + "]")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "party", "create", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.PartyName") + ">", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Password") + "]"));
return true; return true;
} }
} }

View File

@ -2,8 +2,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -16,7 +14,7 @@ public class PartyDisbandCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -24,18 +22,18 @@ public class PartyDisbandCommand implements CommandExecutor {
String partyName = playerParty.getName(); String partyName = playerParty.getName();
for (Player member : playerParty.getOnlineMembers()) { for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) { if (!pluginRef.getPartyManager().handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true; return true;
} }
member.sendMessage(LocaleLoader.getString("Party.Disband")); member.sendMessage(pluginRef.getLocaleManager().getString("Party.Disband"));
} }
PartyManager.disbandParty(playerParty); pluginRef.getPartyManager().disbandParty(playerParty);
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "disband"));
return true; return true;
} }
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.locale.LocaleLoader;
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;
@ -11,19 +10,19 @@ public class PartyHelpCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
sender.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.3", "/party join", "/party quit"));
sender.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.1", "/party create"));
sender.sendMessage(LocaleLoader.getString("Party.Help.4", "/party <lock|unlock>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.4", "/party <lock|unlock>"));
sender.sendMessage(LocaleLoader.getString("Party.Help.5", "/party password")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.5", "/party password"));
sender.sendMessage(LocaleLoader.getString("Party.Help.6", "/party kick")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.6", "/party kick"));
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.7", "/party leader"));
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.8", "/party disband"));
sender.sendMessage(LocaleLoader.getString("Party.Help.9", "/party itemshare")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.9", "/party itemshare"));
sender.sendMessage(LocaleLoader.getString("Party.Help.10", "/party xpshare")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Help.10", "/party xpshare"));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "help")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "help"));
return true; return true;
} }
} }

View File

@ -4,8 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -23,7 +21,7 @@ public class PartyInfoCommand implements CommandExecutor {
case 0: case 0:
case 1: case 1:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
@ -37,26 +35,26 @@ public class PartyInfoCommand implements CommandExecutor {
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "info")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "info"));
return true; return true;
} }
} }
private void displayPartyHeader(Player player, Party party) { private void displayPartyHeader(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Header"));
/*if (!party.hasReachedLevelCap()) { /*if (!party.hasReachedLevelCap()) {
status.append(" (").append(party.getXpToLevelPercentage()).append(")"); status.append(" (").append(party.getXpToLevelPercentage()).append(")");
}*/ }*/
player.sendMessage(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()) player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Status", party.getName(), pluginRef.getLocaleManager().getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel())
/*if (!party.hasReachedLevelCap()) { /*if (!party.hasReachedLevelCap()) {
status.append(" (").append(party.getXpToLevelPercentage()).append(")"); status.append(" (").append(party.getXpToLevelPercentage()).append(")");
}*/); }*/);
} }
private void displayPartyFeatures(Player player, Party party) { private void displayPartyFeatures(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Features.Header"));
List<String> unlockedPartyFeatures = new ArrayList<>(); List<String> unlockedPartyFeatures = new ArrayList<>();
List<String> lockedPartyFeatures = new ArrayList<>(); List<String> lockedPartyFeatures = new ArrayList<>();
@ -73,7 +71,7 @@ public class PartyInfoCommand implements CommandExecutor {
} }
} }
player.sendMessage(LocaleLoader.getString("Commands.Party.UnlockedFeatures", unlockedPartyFeatures.isEmpty() ? "None" : unlockedPartyFeatures)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.UnlockedFeatures", unlockedPartyFeatures.isEmpty() ? "None" : unlockedPartyFeatures));
for (String message : lockedPartyFeatures) { for (String message : lockedPartyFeatures) {
player.sendMessage(message); player.sendMessage(message);
@ -81,7 +79,7 @@ public class PartyInfoCommand implements CommandExecutor {
} }
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) { private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
return party.getLevel() >= PartyManager.getPartyFeatureUnlockLevel(partyFeature); return party.getLevel() >= pluginRef.getPartyManager().getPartyFeatureUnlockLevel(partyFeature);
} }
private void displayShareModeInfo(Player player, Party party) { private void displayShareModeInfo(Player player, Party party) {
@ -98,21 +96,21 @@ public class PartyInfoCommand implements CommandExecutor {
String separator = ""; String separator = "";
if (xpShareEnabled) { if (xpShareEnabled) {
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", party.getXpShareMode().toString()); expShareInfo = pluginRef.getLocaleManager().getString("Commands.Party.ExpShare", party.getXpShareMode().toString());
} }
if (itemShareEnabled) { if (itemShareEnabled) {
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", party.getItemShareMode().toString()); itemShareInfo = pluginRef.getLocaleManager().getString("Commands.Party.ItemShare", party.getItemShareMode().toString());
} }
if (xpShareEnabled && itemShareEnabled) { if (xpShareEnabled && itemShareEnabled) {
separator = ChatColor.DARK_GRAY + " || "; separator = ChatColor.DARK_GRAY + " || ";
} }
player.sendMessage(LocaleLoader.getString("Commands.Party.ShareMode") + expShareInfo + separator + itemShareInfo); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.ShareMode") + expShareInfo + separator + itemShareInfo);
if (itemSharingActive) { if (itemSharingActive) {
player.sendMessage(LocaleLoader.getString("Commands.Party.ItemShareCategories", party.getItemShareCategories())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.ItemShareCategories", party.getItemShareCategories()));
} }
} }
@ -121,11 +119,11 @@ public class PartyInfoCommand implements CommandExecutor {
* Only show members of the party that this member can see * Only show members of the party that this member can see
*/ */
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer); List<Player> nearMembers = pluginRef.getPartyManager().getNearVisibleMembers(mcMMOPlayer);
int membersOnline = party.getVisibleMembers(player).size(); int membersOnline = party.getVisibleMembers(player).size();
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Members.Header"));
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size() + 1, membersOnline)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.MembersNear", nearMembers.size() + 1, membersOnline));
player.sendMessage(party.createMembersList(player)); player.sendMessage(party.createMembersList(player));
} }
} }

View File

@ -2,9 +2,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -27,7 +24,7 @@ public class PartyInviteCommand implements CommandExecutor {
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -36,39 +33,39 @@ public class PartyInviteCommand implements CommandExecutor {
String playerName = player.getName(); String playerName = player.getName();
if (player.equals(target)) { if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Invite.Self"));
return true; return true;
} }
if (PartyManager.inSameParty(player, target)) { if (pluginRef.getPartyManager().inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Player.InSameParty", targetName));
return true; return true;
} }
if (!PartyManager.canInvite(mcMMOPlayer)) { if (!pluginRef.getPartyManager().canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Locked"));
return true; return true;
} }
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) if (pluginRef.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if (PartyManager.isPartyFull(target, playerParty)) { if (pluginRef.getPartyManager().isPartyFull(target, playerParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.PartyFull.Invite",
target.getName(), playerParty.toString(), target.getName(), playerParty.toString(),
mcMMO.getConfigManager().getConfigParty().getPartySizeLimit())); pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()));
return true; return true;
} }
mcMMOTarget.setPartyInvite(playerParty); mcMMOTarget.setPartyInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), playerName)); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1")); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Invite.1"));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "invite", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
return true; return true;
} }
} }

View File

@ -4,8 +4,6 @@ import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -18,14 +16,14 @@ public class PartyItemShareCommand 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) {
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) { if (party.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.4"));
return true; return true;
} }
@ -34,7 +32,7 @@ public class PartyItemShareCommand implements CommandExecutor {
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase()); ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase());
if (mode == null) { if (mode == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>"));
return true; return true;
} }
@ -49,21 +47,21 @@ public class PartyItemShareCommand implements CommandExecutor {
} else if (CommandUtils.shouldDisableToggle(args[2])) { } else if (CommandUtils.shouldDisableToggle(args[2])) {
toggle = false; toggle = false;
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
return true; return true;
} }
try { try {
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle); handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
} }
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
return true; return true;
} }
} }
@ -71,7 +69,7 @@ public class PartyItemShareCommand implements CommandExecutor {
private void handleChangingShareMode(Party party, ShareMode mode) { private void handleChangingShareMode(Party party, ShareMode mode) {
party.setItemShareMode(mode); party.setItemShareMode(mode);
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Item"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString()))); String changeModeMessage = pluginRef.getLocaleManager().getString("Commands.Party.SetSharing", pluginRef.getLocaleManager().getString("Party.ShareType.Item"), pluginRef.getLocaleManager().getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
for (Player member : party.getOnlineMembers()) { for (Player member : party.getOnlineMembers()) {
member.sendMessage(changeModeMessage); member.sendMessage(changeModeMessage);
@ -81,7 +79,7 @@ public class PartyItemShareCommand implements CommandExecutor {
private void handleToggleItemShareCategory(Party party, ItemShareType type, boolean toggle) { private void handleToggleItemShareCategory(Party party, ItemShareType type, boolean toggle) {
party.setSharingDrops(type, toggle); party.setSharingDrops(type, toggle);
String toggleMessage = LocaleLoader.getString("Commands.Party.ToggleShareCategory", StringUtils.getCapitalized(type.toString()), toggle ? "enabled" : "disabled"); String toggleMessage = pluginRef.getLocaleManager().getString("Commands.Party.ToggleShareCategory", StringUtils.getCapitalized(type.toString()), toggle ? "enabled" : "disabled");
for (Player member : party.getOnlineMembers()) { for (Player member : party.getOnlineMembers()) {
member.sendMessage(toggleMessage); member.sendMessage(toggleMessage);

View File

@ -2,9 +2,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -28,14 +25,14 @@ public class PartyJoinCommand implements CommandExecutor {
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if (!mcMMOTarget.inParty()) { if (!mcMMOTarget.inParty()) {
sender.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.PlayerNotInParty", targetName));
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -43,36 +40,36 @@ public class PartyJoinCommand implements CommandExecutor {
Party targetParty = mcMMOTarget.getParty(); Party targetParty = mcMMOTarget.getParty();
if (player.equals(target) || (mcMMOPlayer.inParty() && mcMMOPlayer.getParty().equals(targetParty))) { if (player.equals(target) || (mcMMOPlayer.inParty() && mcMMOPlayer.getParty().equals(targetParty))) {
sender.sendMessage(LocaleLoader.getString("Party.Join.Self")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Join.Self"));
return true; return true;
} }
String password = getPassword(args); String password = getPassword(args);
// Make sure party passwords match // Make sure party passwords match
if (!PartyManager.checkPartyPassword(player, targetParty, password)) { if (!pluginRef.getPartyManager().checkPartyPassword(player, targetParty, password)) {
return true; return true;
} }
String partyName = targetParty.getName(); String partyName = targetParty.getName();
// Changing parties // Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, partyName)) { if (!pluginRef.getPartyManager().changeOrJoinParty(mcMMOPlayer, partyName)) {
return true; return true;
} }
if (mcMMO.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped()) if (pluginRef.getConfigManager().getConfigParty().getPartyGeneral().isPartySizeCapped())
if (PartyManager.isPartyFull(player, targetParty)) { if (pluginRef.getPartyManager().isPartyFull(player, targetParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.PartyFull", targetParty.toString()));
return true; return true;
} }
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Join", partyName));
PartyManager.addToParty(mcMMOPlayer, targetParty); pluginRef.getPartyManager().addToParty(mcMMOPlayer, targetParty);
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "join", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">", "[" + LocaleLoader.getString("Commands.Usage.Password") + "]")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "party", "join", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Password") + "]"));
return true; return true;
} }
} }

View File

@ -2,9 +2,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -19,7 +16,7 @@ public class PartyKickCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -27,29 +24,29 @@ public class PartyKickCommand implements CommandExecutor {
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
if (!playerParty.hasMember(targetName)) { if (!playerParty.hasMember(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.NotInYourParty", targetName));
return true; return true;
} }
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName); OfflinePlayer target = pluginRef.getServer().getOfflinePlayer(targetName);
if (target.isOnline()) { if (target.isOnline()) {
Player onlineTarget = target.getPlayer(); Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName(); String partyName = playerParty.getName();
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) { if (!pluginRef.getPartyManager().handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true; return true;
} }
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget)); pluginRef.getPartyManager().processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName)); onlineTarget.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Kick", partyName));
} }
PartyManager.removeFromParty(target, playerParty); pluginRef.getPartyManager().removeFromParty(target, playerParty);
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "kick", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
return true; return true;
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -46,29 +45,29 @@ public class PartyLockCommand implements CommandExecutor {
} }
private void sendUsageStrings(CommandSender sender) { private void sendUsageStrings(CommandSender sender) {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "lock", "[on|off]")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "lock", "[on|off]"));
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "unlock")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "unlock"));
} }
private void togglePartyLock(CommandSender sender, boolean lock) { private void togglePartyLock(CommandSender sender, boolean lock) {
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return; return;
} }
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) { if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoPermission")); sender.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoPermission"));
return; return;
} }
if (lock ? party.isLocked() : !party.isLocked()) { if (lock ? party.isLocked() : !party.isLocked()) {
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "IsLocked" : "IsntLocked"))); sender.sendMessage(pluginRef.getLocaleManager().getString("Party." + (lock ? "IsLocked" : "IsntLocked")));
return; return;
} }
party.setLocked(lock); party.setLocked(lock);
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "Locked" : "Unlocked"))); sender.sendMessage(pluginRef.getLocaleManager().getString("Party." + (lock ? "Locked" : "Unlocked")));
} }
} }

View File

@ -3,8 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -19,23 +17,23 @@ public class PartyQuitCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) { if (!pluginRef.getPartyManager().handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true; return true;
} }
PartyManager.removeFromParty(mcMMOPlayer); pluginRef.getPartyManager().removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Leave"));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "quit")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "party", "quit"));
return true; return true;
} }
} }

View File

@ -3,8 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -17,7 +15,7 @@ public class PartyRenameCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -29,36 +27,36 @@ public class PartyRenameCommand implements CommandExecutor {
// This is to prevent party leaders from spamming other players with the rename message // This is to prevent party leaders from spamming other players with the rename message
if (oldPartyName.equalsIgnoreCase(newPartyName)) { if (oldPartyName.equalsIgnoreCase(newPartyName)) {
sender.sendMessage(LocaleLoader.getString("Party.Rename.Same")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Rename.Same"));
return true; return true;
} }
Player player = mcMMOPlayer.getPlayer(); Player player = mcMMOPlayer.getPlayer();
// Check to see if the party exists, and if it does cancel renaming the party // Check to see if the party exists, and if it does cancel renaming the party
if (PartyManager.checkPartyExistence(player, newPartyName)) { if (pluginRef.getPartyManager().checkPartyExistence(player, newPartyName)) {
return true; return true;
} }
String leaderName = playerParty.getLeader().getPlayerName(); String leaderName = playerParty.getLeader().getPlayerName();
for (Player member : playerParty.getOnlineMembers()) { for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) { if (!pluginRef.getPartyManager().handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
return true; return true;
} }
if (!member.getName().equalsIgnoreCase(leaderName)) { if (!member.getName().equalsIgnoreCase(leaderName)) {
member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName)); member.sendMessage(pluginRef.getLocaleManager().getString("Party.InformedOnNameChange", leaderName, newPartyName));
} }
} }
playerParty.setName(newPartyName); playerParty.setName(newPartyName);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Rename", newPartyName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Rename", newPartyName));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "rename", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "rename", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.PartyName") + ">"));
return true; return true;
} }
} }

View File

@ -3,8 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -17,14 +15,14 @@ public class PartyXpShareCommand 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) {
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) { if (party.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.5"));
return true; return true;
} }
@ -35,13 +33,13 @@ public class PartyXpShareCommand implements CommandExecutor {
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) { } else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.EQUAL); handleChangingShareMode(party, ShareMode.EQUAL);
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
} }
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
return true; return true;
} }
} }
@ -49,7 +47,7 @@ public class PartyXpShareCommand implements CommandExecutor {
private void handleChangingShareMode(Party party, ShareMode mode) { private void handleChangingShareMode(Party party, ShareMode mode) {
party.setXpShareMode(mode); party.setXpShareMode(mode);
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Xp"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString()))); String changeModeMessage = pluginRef.getLocaleManager().getString("Commands.Party.SetSharing", pluginRef.getLocaleManager().getString("Party.ShareType.Xp"), pluginRef.getLocaleManager().getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
for (Player member : party.getOnlineMembers()) { for (Player member : party.getOnlineMembers()) {
member.sendMessage(changeModeMessage); member.sendMessage(changeModeMessage);

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.party.alliance; package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -15,27 +13,27 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyAllianceInvite()) { if (!mcMMOPlayer.hasPartyAllianceInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites")); sender.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoInvites"));
return true; return true;
} }
if (mcMMOPlayer.getParty().getAlly() != null) { if (mcMMOPlayer.getParty().getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.AlreadyAllies"));
return true; return true;
} }
PartyManager.acceptAllianceInvite(mcMMOPlayer); pluginRef.getPartyManager().acceptAllianceInvite(mcMMOPlayer);
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "alliance", "accept"));
return true; return true;
} }
} }

View File

@ -3,8 +3,6 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -35,7 +33,7 @@ public class PartyAllianceCommand implements TabExecutor {
} }
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -46,8 +44,8 @@ public class PartyAllianceCommand implements TabExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
if (playerParty.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) { if (playerParty.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.3"));
return true; return true;
} }
@ -64,8 +62,8 @@ public class PartyAllianceCommand implements TabExecutor {
case 2: case 2:
case 3: case 3:
if (playerParty.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) { if (playerParty.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.3"));
return true; return true;
} }
@ -98,8 +96,8 @@ public class PartyAllianceCommand implements TabExecutor {
} }
private void printUsage() { private void printUsage() {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.0")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Help.0"));
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.1")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Help.1"));
} }
@Override @Override
@ -120,12 +118,12 @@ public class PartyAllianceCommand implements TabExecutor {
} }
private void displayPartyHeader() { private void displayPartyHeader() {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Header"));
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Ally", playerParty.getName(), targetParty.getName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Ally", playerParty.getName(), targetParty.getName()));
} }
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) { private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Members.Header"));
player.sendMessage(playerParty.createMembersList(player)); player.sendMessage(playerParty.createMembersList(player));
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------"); player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");
player.sendMessage(targetParty.createMembersList(player)); player.sendMessage(targetParty.createMembersList(player));

View File

@ -2,8 +2,6 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -16,7 +14,7 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
@ -24,15 +22,15 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
Party party = mcMMOPlayer.getParty(); Party party = mcMMOPlayer.getParty();
if (party.getAlly() == null) { if (party.getAlly() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.None"));
return true; return true;
} }
PartyManager.disbandAlliance(player, party, party.getAlly()); pluginRef.getPartyManager().disbandAlliance(player, party, party.getAlly());
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "alliance", "disband"));
return true; return true;
} }
} }

View File

@ -2,8 +2,6 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -26,7 +24,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -35,41 +33,41 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
String playerName = player.getName(); String playerName = player.getName();
if (player.equals(target)) { if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Invite.Self"));
return true; return true;
} }
if (!mcMMOTarget.inParty()) { if (!mcMMOTarget.inParty()) {
player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName)); player.sendMessage(pluginRef.getLocaleManager().getString("Party.PlayerNotInParty", targetName));
return true; return true;
} }
if (PartyManager.inSameParty(player, target)) { if (pluginRef.getPartyManager().inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Player.InSameParty", targetName));
return true; return true;
} }
if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) { if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) {
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName)); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Target.NotOwner", targetName));
return true; return true;
} }
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();
if (playerParty.getAlly() != null) { if (playerParty.getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.AlreadyAllies"));
return true; return true;
} }
mcMMOTarget.setPartyAllianceInvite(playerParty); mcMMOTarget.setPartyAllianceInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.0", playerParty.getName(), playerName)); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.1")); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.Alliance.Invite.1"));
return true; return true;
default: default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "alliance", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "party", "alliance", "invite", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
return true; return true;
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.party.teleport; package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -19,9 +18,9 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord(); PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
if (ptpRecord.isConfirmRequired()) { if (ptpRecord.isConfirmRequired()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.AcceptAny.Disabled"));
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.AcceptAny.Enabled"));
} }
ptpRecord.toggleConfirmRequired(); ptpRecord.toggleConfirmRequired();

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.party.teleport; package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -13,6 +12,13 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PtpAcceptCommand implements CommandExecutor { public class PtpAcceptCommand implements CommandExecutor {
private mcMMO pluginRef;
public PtpAcceptCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!Permissions.partyTeleportAccept(sender)) { if (!Permissions.partyTeleportAccept(sender)) {
@ -21,7 +27,7 @@ public class PtpAcceptCommand implements CommandExecutor {
} }
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -29,13 +35,13 @@ public class PtpAcceptCommand implements CommandExecutor {
PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord(); PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord();
if (!ptpRecord.hasRequest()) { if (!ptpRecord.hasRequest()) {
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.NoRequests"));
return true; return true;
} }
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), mcMMO.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout())) { if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout())) {
ptpRecord.removeRequest(); ptpRecord.removeRequest();
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.RequestExpired"));
return true; return true;
} }
@ -46,16 +52,16 @@ public class PtpAcceptCommand implements CommandExecutor {
return true; return true;
} }
if (mcMMO.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) { if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
World targetWorld = target.getWorld(); World targetWorld = target.getWorld();
World playerWorld = player.getWorld(); World playerWorld = player.getWorld();
if (!Permissions.partyTeleportAllWorlds(target)) { if (!Permissions.partyTeleportAllWorlds(target)) {
if (!Permissions.partyTeleportWorld(target, targetWorld)) { if (!Permissions.partyTeleportWorld(target, targetWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return true; return true;
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) { } else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName())); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
return true; return true;
} }
} }

View File

@ -5,9 +5,7 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.items.TeleportationWarmup; import com.gmail.nossr50.runnables.items.TeleportationWarmup;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@ -15,7 +13,6 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils; import com.gmail.nossr50.worldguard.WorldGuardUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -29,13 +26,20 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class PtpCommand implements TabExecutor { public class PtpCommand implements TabExecutor {
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
private mcMMO pluginRef;
public PtpCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
public final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
private CommandExecutor ptpToggleCommand = new PtpToggleCommand(); private CommandExecutor ptpToggleCommand = new PtpToggleCommand();
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand(); private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand(); private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) { protected boolean canTeleport(CommandSender sender, Player player, String targetName) {
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName); McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
@ -45,49 +49,49 @@ public class PtpCommand implements TabExecutor {
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if (player.equals(target)) { if (player.equals(target)) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Self")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Self"));
return false; return false;
} }
if (!PartyManager.inSameParty(player, target)) { if (!pluginRef.getPartyManager().inSameParty(player, target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); player.sendMessage(pluginRef.getLocaleManager().getString("Party.NotInYourParty", targetName));
return false; return false;
} }
if (!mcMMOTarget.getPartyTeleportRecord().isEnabled()) { if (!mcMMOTarget.getPartyTeleportRecord().isEnabled()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Disabled", targetName)); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Disabled", targetName));
return false; return false;
} }
if (!target.isValid()) { if (!target.isValid()) {
player.sendMessage(LocaleLoader.getString("Party.Teleport.Dead")); player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Dead"));
return false; return false;
} }
return true; return true;
} }
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) { protected void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if (UserManager.getPlayer(targetPlayer) == null) { if (UserManager.getPlayer(targetPlayer) == null) {
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); targetPlayer.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return; return;
} }
if (UserManager.getPlayer(teleportingPlayer) == null) { if (UserManager.getPlayer(teleportingPlayer) == null) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); teleportingPlayer.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return; return;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer); McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
long warmup = mcMMO.getConfigManager().getConfigParty().getPTP().getPtpWarmup(); long warmup = pluginRef.getConfigManager().getConfigParty().getPTP().getPtpWarmup();
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer); mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
if (warmup > 0) { if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup)); teleportingPlayer.sendMessage(pluginRef.getLocaleManager().getString("Teleport.Commencing", warmup));
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup); new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(pluginRef, 20 * warmup);
} else { } else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer); EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
} }
@ -103,7 +107,7 @@ public class PtpCommand implements TabExecutor {
/* WORLD GUARD MAIN FLAG CHECK */ /* WORLD GUARD MAIN FLAG CHECK */
if (WorldGuardUtils.isWorldGuardLoaded()) { if (WorldGuardUtils.isWorldGuardLoaded()) {
if (!WorldGuardManager.getInstance().hasMainFlag(player)) if (!pluginRef.getWorldGuardManager().hasMainFlag(player))
return true; return true;
} }
@ -116,73 +120,70 @@ public class PtpCommand implements TabExecutor {
} }
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.inParty()) { if (!mcMMOPlayer.inParty()) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Party.None"));
return true; return true;
} }
Party party = mcMMOPlayer.getParty(); Party party = mcMMOPlayer.getParty();
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) { if (party.getLevel() < pluginRef.getPartyManager().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2")); sender.sendMessage(pluginRef.getLocaleManager().getString("Party.Feature.Disabled.2"));
return true; return true;
} }
switch (args.length) { if (args.length == 1) {
case 1: if (args[0].equalsIgnoreCase("toggle")) {
if (args[0].equalsIgnoreCase("toggle")) { return ptpToggleCommand.onCommand(sender, command, label, args);
return ptpToggleCommand.onCommand(sender, command, label, args); }
}
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) { if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
return ptpAcceptAnyCommand.onCommand(sender, command, label, args); return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
} }
long recentlyHurt = mcMMOPlayer.getRecentlyHurt(); long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
int hurtCooldown = mcMMO.getConfigManager().getConfigParty().getPTP().getPtpRecentlyHurtCooldown(); int hurtCooldown = pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRecentlyHurtCooldown();
if (hurtCooldown > 0) { if (hurtCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player); int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
if (timeRemaining > 0) { if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", timeRemaining)); player.sendMessage(pluginRef.getLocaleManager().getString("Item.Injured.Wait", timeRemaining));
return true;
}
}
if (args[0].equalsIgnoreCase("accept")) {
return ptpAcceptCommand.onCommand(sender, command, label, args);
}
if (!Permissions.partyTeleportSend(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true; return true;
} }
}
int ptpCooldown = mcMMO.getConfigManager().getConfigParty().getPTP().getPtpCooldown(); if (args[0].equalsIgnoreCase("accept")) {
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse(); return ptpAcceptCommand.onCommand(sender, command, label, args);
}
if (ptpCooldown > 0) { if (!Permissions.partyTeleportSend(sender)) {
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player); sender.sendMessage(command.getPermissionMessage());
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
return true;
}
}
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
return true; return true;
}
default: int ptpCooldown = pluginRef.getConfigManager().getConfigParty().getPTP().getPtpCooldown();
return false; long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
if (ptpCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
if (timeRemaining > 0) {
player.sendMessage(pluginRef.getLocaleManager().getString("Item.Generic.Wait", timeRemaining));
return true;
}
}
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
return true;
} }
return false;
} }
@Override @Override
@ -193,7 +194,7 @@ public class PtpCommand implements TabExecutor {
if (matches.size() == 0) { if (matches.size() == 0) {
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return ImmutableList.of(); return ImmutableList.of();
} }
@ -232,9 +233,9 @@ public class PtpCommand implements TabExecutor {
ptpRecord.setRequestor(player); ptpRecord.setRequestor(player);
ptpRecord.actualizeTimeout(); ptpRecord.actualizeTimeout();
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName())); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.Request1", player.getName()));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", mcMMO.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout())); target.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.Request2", pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout()));
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.party.teleport; package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -19,9 +18,9 @@ public class PtpToggleCommand implements CommandExecutor {
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord(); PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
if (ptpRecord.isEnabled()) { if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.Disabled"));
} else { } else {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.Enabled"));
} }
ptpRecord.toggleEnabled(); ptpRecord.toggleEnabled();

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@ -20,6 +19,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class InspectCommand implements TabExecutor { public class InspectCommand implements TabExecutor {
private mcMMO pluginRef;
public InspectCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -29,35 +35,35 @@ public class InspectCommand implements TabExecutor {
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process. // If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile PlayerProfile profile = pluginRef.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
if (!CommandUtils.isLoaded(sender, profile)) { if (!CommandUtils.isLoaded(sender, profile)) {
return true; return true;
} }
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player if (pluginRef.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) { && pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile); ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
if (!mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) { if (!pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) {
return true; return true;
} }
} }
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.OfflineStats", playerName));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Gathering"));
for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) { for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Combat"));
for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) { for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); sender.sendMessage(pluginRef.getLocaleManager().getString("Stats.Header.Misc"));
for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) { for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
@ -66,26 +72,26 @@ public class InspectCommand implements TabExecutor {
Player target = mcMMOPlayer.getPlayer(); Player target = mcMMOPlayer.getPlayer();
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) { if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline")); sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
return true; return true;
} }
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) { else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
return true; return true;
} }
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) { if (pluginRef.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile()); ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
if (!mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) { if (!pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) {
return true; return true;
} }
} }
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName())); sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Stats", target.getName()));
CommandUtils.printGatheringSkills(target, sender); CommandUtils.printGatheringSkills(target, sender);
CommandUtils.printCombatSkills(target, sender); CommandUtils.printCombatSkills(target, sender);
CommandUtils.printMiscSkills(target, sender); CommandUtils.printMiscSkills(target, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel())); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
} }
return true; return true;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -16,6 +15,13 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
public class MccooldownCommand implements TabExecutor { public class MccooldownCommand implements TabExecutor {
private mcMMO pluginRef;
public MccooldownCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@ -30,23 +36,23 @@ public class MccooldownCommand implements TabExecutor {
case 0: case 0:
Player player = (Player) sender; Player player = (Player) sender;
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) { if (pluginRef.getScoreboardSettings().getScoreboardsEnabled() && pluginRef.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) {
ScoreboardManager.enablePlayerCooldownScoreboard(player); ScoreboardManager.enablePlayerCooldownScoreboard(player);
if (!mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) { if (!pluginRef.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) {
return true; return true;
} }
} }
if (UserManager.getPlayer(player) == null) { if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); player.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Cooldowns.Header"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote")); player.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoSkillNote"));
for (SuperAbilityType ability : SuperAbilityType.values()) { for (SuperAbilityType ability : SuperAbilityType.values()) {
if (!ability.getPermissions(player)) { if (!ability.getPermissions(player)) {
@ -56,9 +62,9 @@ public class MccooldownCommand implements TabExecutor {
int seconds = mcMMOPlayer.calculateTimeRemaining(ability); int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
if (seconds <= 0) { if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Cooldowns.Row.Y", ability.getName()));
} else { } else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
} }
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.core.MetadataConstants; import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -21,6 +20,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class McrankCommand implements TabExecutor { public class McrankCommand implements TabExecutor {
private mcMMO pluginRef;
public McrankCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
@ -89,32 +95,32 @@ public class McrankCommand implements TabExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName()); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return; return;
} }
long cooldownMillis = 5000; long cooldownMillis = 5000;
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) { if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis))); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
return; return;
} }
if (((Player) sender).hasMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY)) { if (((Player) sender).hasMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Database.Processing"));
return; return;
} else { } else {
((Player) sender).setMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(mcMMO.p, null)); ((Player) sender).setMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(pluginRef, null));
} }
mcMMOPlayer.actualizeDatabaseATS(); mcMMOPlayer.actualizeDatabaseATS();
} }
boolean useBoard = mcMMO.getScoreboardSettings().getScoreboardsEnabled() && (sender instanceof Player) boolean useBoard = pluginRef.getScoreboardSettings().getScoreboardsEnabled() && (sender instanceof Player)
&& (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.RANK_BOARD)); && (pluginRef.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.RANK_BOARD));
boolean useChat = !useBoard || mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.RANK_BOARD); boolean useChat = !useBoard || pluginRef.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.RANK_BOARD);
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
} }
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) { private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -14,6 +13,13 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
public class McstatsCommand implements TabExecutor { public class McstatsCommand implements TabExecutor {
private mcMMO pluginRef;
public McstatsCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@ -27,33 +33,33 @@ public class McstatsCommand implements TabExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
Player player = (Player) sender; Player player = (Player) sender;
if (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) { if (pluginRef.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && pluginRef.getScoreboardSettings().getScoreboardsEnabled()) {
ScoreboardManager.enablePlayerStatsScoreboard(player); ScoreboardManager.enablePlayerStatsScoreboard(player);
if (!mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.STATS_BOARD)) { if (!pluginRef.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.STATS_BOARD)) {
return true; return true;
} }
} }
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats")); player.sendMessage(pluginRef.getLocaleManager().getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote")); player.sendMessage(pluginRef.getLocaleManager().getString("mcMMO.NoSkillNote"));
CommandUtils.printGatheringSkills(player); CommandUtils.printGatheringSkills(player);
CommandUtils.printCombatSkills(player); CommandUtils.printCombatSkills(player);
CommandUtils.printMiscSkills(player); CommandUtils.printMiscSkills(player);
int powerLevelCap = mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap(); int powerLevelCap = pluginRef.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().getLevelCap();
if (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().isLevelCapEnabled()) { if (pluginRef.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevelSettings().isLevelCapEnabled()) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
} else { } else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel())); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
} }
return true; return true;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.core.MetadataConstants; import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -23,6 +22,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MctopCommand implements TabExecutor { public class MctopCommand implements TabExecutor {
private mcMMO pluginRef;
public MctopCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PrimarySkillType skill = null; PrimarySkillType skill = null;
@ -96,15 +102,15 @@ public class MctopCommand implements TabExecutor {
seconds = 1; seconds = 1;
} }
sender.sendMessage(LocaleLoader.formatString(LocaleLoader.getString("Commands.Database.Cooldown"), seconds)); sender.sendMessage(pluginRef.getLocaleManager().formatString(pluginRef.getLocaleManager().getString("Commands.Database.Cooldown"), seconds));
return; return;
} }
if (((Player) sender).hasMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY)) { if (((Player) sender).hasMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing")); sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Database.Processing"));
return; return;
} else { } else {
((Player) sender).setMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(mcMMO.p, null)); ((Player) sender).setMetadata(MetadataConstants.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(pluginRef, null));
} }
mcMMOPlayer.actualizeDatabaseATS(); mcMMOPlayer.actualizeDatabaseATS();
@ -114,10 +120,10 @@ public class MctopCommand implements TabExecutor {
} }
private void display(int page, PrimarySkillType skill, CommandSender sender) { private void display(int page, PrimarySkillType skill, CommandSender sender) {
boolean useBoard = (sender instanceof Player) && (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.TOP_BOARD)); boolean useBoard = (sender instanceof Player) && (pluginRef.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.TOP_BOARD));
boolean useChat = !useBoard || mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.TOP_BOARD); boolean useChat = !useBoard || pluginRef.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.TOP_BOARD);
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(pluginRef);
} }
private PrimarySkillType extractSkill(CommandSender sender, String skillName) { private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@ -1,15 +0,0 @@
package com.gmail.nossr50.commands.server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
/**
* This command facilitates switching the skill system scale between classic and modern scale
*/
public class Mcmmoupgrade implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return false;
}
}

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.server; package com.gmail.nossr50.commands.server;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -12,10 +11,10 @@ import org.jetbrains.annotations.NotNull;
public class ReloadCommand implements CommandExecutor { public class ReloadCommand implements CommandExecutor {
private mcMMO plugin; private mcMMO pluginRef;
public ReloadCommand(mcMMO plugin) { public ReloadCommand(mcMMO plugin) {
this.plugin = plugin; this.pluginRef = plugin;
} }
@Override @Override
@ -25,9 +24,9 @@ public class ReloadCommand implements CommandExecutor {
return false; return false;
} }
Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Start")); Bukkit.broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Reload.Start"));
plugin.reload(); pluginRef.reload();
Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Finished")); Bukkit.broadcastMessage(pluginRef.getLocaleManager().getString("Commands.Reload.Finished"));
return true; return true;
} }

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.random.RandomChanceSkill; import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
@ -21,8 +21,8 @@ public class AcrobaticsCommand extends SkillCommand {
private boolean canDodge; private boolean canDodge;
private boolean canRoll; private boolean canRoll;
public AcrobaticsCommand() { public AcrobaticsCommand(mcMMO pluginRef) {
super(PrimarySkillType.ACROBATICS); super(PrimarySkillType.ACROBATICS, pluginRef);
} }
@Override @Override
@ -47,7 +47,7 @@ public class AcrobaticsCommand extends SkillCommand {
if (canDodge) { if (canDodge) {
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance) messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", dodgeChanceLucky) : ""));
} }
if (canRoll) { if (canRoll) {
@ -76,10 +76,10 @@ public class AcrobaticsCommand extends SkillCommand {
double graceChanceLucky = graceChance * 1.333D; double graceChanceLucky = graceChance * 1.333D;
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0]) messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));
/*messages.add(getStatMessage(true, false, SubSkillType.ACROBATICS_ROLL, String.valueOf(graceChance)) /*messages.add(getStatMessage(true, false, SubSkillType.ACROBATICS_ROLL, String.valueOf(graceChance))
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", String.valueOf(graceChanceLucky)) : ""));*/ + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", String.valueOf(graceChanceLucky)) : ""));*/
} }
} }

View File

@ -26,7 +26,7 @@
//// protected String[] calculateAbilityDisplayValues(Player player) { //// protected String[] calculateAbilityDisplayValues(Player player) {
//// //TODO: Needed? //// //TODO: Needed?
//// if (UserManager.getPlayer(player) == null) { //// if (UserManager.getPlayer(player) == null) {
//// player.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); //// player.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
//// return new String[]{"DATA NOT LOADED", "DATA NOT LOADED"}; //// return new String[]{"DATA NOT LOADED", "DATA NOT LOADED"};
//// } //// }
//// ////
@ -71,15 +71,15 @@
// //
//// if (canCatalysis) { //// if (canCatalysis) {
//// messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed) //// messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
//// + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : "")); //// + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
//// } //// }
//// ////
//// if (canConcoctions) { //// if (canConcoctions) {
//// messages.add(getStatMessage(false, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(tier), String.valueOf(RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS)))); //// messages.add(getStatMessage(false, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(tier), String.valueOf(RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))));
//// messages.add(getStatMessage(true, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(ingredientCount), ingredientList)); //// messages.add(getStatMessage(true, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(ingredientCount), ingredientList));
//// ////
//// //messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))); //// //messages.add(pluginRef.getLocaleManager().getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS)));
//// //messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList)); //// //messages.add(pluginRef.getLocaleManager().getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
//// } //// }
// //
// return messages; // return messages;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
@ -23,8 +23,8 @@ public class ArcheryCommand extends SkillCommand {
private boolean canDaze; private boolean canDaze;
private boolean canRetrieve; private boolean canRetrieve;
public ArcheryCommand() { public ArcheryCommand(mcMMO pluginRef) {
super(PrimarySkillType.ARCHERY); super(PrimarySkillType.ARCHERY, pluginRef);
} }
@Override @Override
@ -62,12 +62,12 @@ public class ArcheryCommand extends SkillCommand {
if (canRetrieve) { if (canRetrieve) {
messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance) messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", retrieveChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", retrieveChanceLucky) : ""));
} }
if (canDaze) { if (canDaze) {
messages.add(getStatMessage(SubSkillType.ARCHERY_DAZE, dazeChance) messages.add(getStatMessage(SubSkillType.ARCHERY_DAZE, dazeChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", dazeChanceLucky) : ""));
} }
if (canSkillShot) { if (canSkillShot) {

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.skills.axes.Axes;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -30,8 +29,8 @@ public class AxesCommand extends SkillCommand {
private boolean canImpact; private boolean canImpact;
private boolean canGreaterImpact; private boolean canGreaterImpact;
public AxesCommand() { public AxesCommand(mcMMO pluginRef) {
super(PrimarySkillType.AXES); super(PrimarySkillType.AXES, pluginRef);
} }
@Override @Override
@ -75,25 +74,25 @@ public class AxesCommand extends SkillCommand {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canImpact) { if (canImpact) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.2"), pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.3", impactDamage)));
} }
if (canAxeMastery) { if (canAxeMastery) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.0"), pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.1", axeMasteryDamage)));
} }
if (canCritical) { if (canCritical) {
messages.add(getStatMessage(SubSkillType.AXES_CRITICAL_STRIKES, critChance) messages.add(getStatMessage(SubSkillType.AXES_CRITICAL_STRIKES, critChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", critChanceLucky) : ""));
} }
if (canGreaterImpact) { if (canGreaterImpact) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", mcMMO.getConfigManager().getConfigAxes().getGreaterImpactBonusDamage()))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.4"), pluginRef.getLocaleManager().getString("Axes.Ability.Bonus.5", pluginRef.getConfigManager().getConfigAxes().getGreaterImpactBonusDamage())));
} }
if (canSkullSplitter) { if (canSkullSplitter) {
messages.add(getStatMessage(SubSkillType.AXES_SKULL_SPLITTER, skullSplitterLength) messages.add(getStatMessage(SubSkillType.AXES_SKULL_SPLITTER, skullSplitterLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
} }
if (canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) { if (canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
@ -21,8 +21,8 @@ public class ExcavationCommand extends SkillCommand {
private boolean canGigaDrill; private boolean canGigaDrill;
private boolean canTreasureHunt; private boolean canTreasureHunt;
public ExcavationCommand() { public ExcavationCommand(mcMMO pluginRef) {
super(PrimarySkillType.EXCAVATION); super(PrimarySkillType.EXCAVATION, pluginRef);
} }
@Override @Override
@ -49,9 +49,9 @@ public class ExcavationCommand extends SkillCommand {
if (canGigaDrill) { if (canGigaDrill) {
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength) messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); //messages.add(pluginRef.getLocaleManager().getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
} }
if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) { if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {

View File

@ -5,7 +5,7 @@ import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity; import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -46,8 +46,8 @@ public class FishingCommand extends SkillCommand {
private boolean canIceFish; private boolean canIceFish;
private boolean canInnerPeace; private boolean canInnerPeace;
public FishingCommand() { public FishingCommand(mcMMO pluginRef) {
super(PrimarySkillType.FISHING); super(PrimarySkillType.FISHING, pluginRef);
} }
@Override @Override
@ -155,7 +155,7 @@ public class FishingCommand extends SkillCommand {
if (canShake) { if (canShake) {
messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance) messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
} }
if (canTreasureHunt) { if (canTreasureHunt) {

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
@ -35,8 +35,8 @@ public class HerbalismCommand extends SkillCommand {
private boolean canDoubleDrop; private boolean canDoubleDrop;
private boolean canShroomThumb; private boolean canShroomThumb;
public HerbalismCommand() { public HerbalismCommand(mcMMO pluginRef) {
super(PrimarySkillType.HERBALISM); super(PrimarySkillType.HERBALISM, pluginRef);
} }
@Override @Override
@ -102,7 +102,7 @@ public class HerbalismCommand extends SkillCommand {
if (canDoubleDrop) { if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance) messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canFarmersDiet) { if (canFarmersDiet) {
@ -111,15 +111,15 @@ public class HerbalismCommand extends SkillCommand {
if (canGreenTerra) { if (canGreenTerra) {
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength) messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
//messages.add(LocaleLoader.getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : "")); //messages.add(pluginRef.getLocaleManager().getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
} }
if (canGreenThumbBlocks || canGreenThumbPlants) { if (canGreenThumbBlocks || canGreenThumbPlants) {
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_THUMB, greenThumbChance) messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_THUMB, greenThumbChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : ""));
} }
if (canGreenThumbPlants) { if (canGreenThumbPlants) {
@ -128,12 +128,12 @@ public class HerbalismCommand extends SkillCommand {
if (hasHylianLuck) { if (hasHylianLuck) {
messages.add(getStatMessage(SubSkillType.HERBALISM_HYLIAN_LUCK, hylianLuckChance) messages.add(getStatMessage(SubSkillType.HERBALISM_HYLIAN_LUCK, hylianLuckChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", hylianLuckChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", hylianLuckChanceLucky) : ""));
} }
if (canShroomThumb) { if (canShroomThumb) {
messages.add(getStatMessage(SubSkillType.HERBALISM_SHROOM_THUMB, shroomThumbChance) messages.add(getStatMessage(SubSkillType.HERBALISM_SHROOM_THUMB, shroomThumbChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shroomThumbChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", shroomThumbChanceLucky) : ""));
} }
return messages; return messages;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
@ -33,8 +33,8 @@ public class MiningCommand extends SkillCommand {
private boolean canBiggerBombs; private boolean canBiggerBombs;
private boolean canDemoExpert; private boolean canDemoExpert;
public MiningCommand() { public MiningCommand(mcMMO pluginRef) {
super(PrimarySkillType.MINING); super(PrimarySkillType.MINING, pluginRef);
} }
@Override @Override
@ -81,29 +81,29 @@ public class MiningCommand extends SkillCommand {
if (canBiggerBombs) { if (canBiggerBombs) {
messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease))); messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease)));
//messages.add(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease)); //messages.add(pluginRef.getLocaleManager().getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
} }
if (canBlast) { if (canBlast) {
messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING)), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops))); messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING)), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
//messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops))); //messages.add(pluginRef.getLocaleManager().getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
} }
if (canDemoExpert) { if (canDemoExpert) {
messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease)); messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease)); //messages.add(pluginRef.getLocaleManager().getString("Mining.Effect.Decrease", blastDamageDecrease));
} }
if (canDoubleDrop) { if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.MINING_DOUBLE_DROPS, doubleDropChance) messages.add(getStatMessage(SubSkillType.MINING_DOUBLE_DROPS, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canSuperBreaker) { if (canSuperBreaker) {
messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength) messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
//messages.add(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : "")); //messages.add(pluginRef.getLocaleManager().getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
} }
return messages; return messages;

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -22,6 +22,12 @@ import java.util.List;
*/ */
public class MmoInfoCommand implements TabExecutor { public class MmoInfoCommand implements TabExecutor {
private mcMMO pluginRef;
public MmoInfoCommand(mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override @Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
/* /*
@ -37,10 +43,10 @@ public class MmoInfoCommand implements TabExecutor {
return false; return false;
if (args[0].equalsIgnoreCase("???")) { if (args[0].equalsIgnoreCase("???")) {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.SubSkillHeader", "???"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.Mystery"));
return true; return true;
} else if (InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) { } else if (InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) {
displayInfo(player, args[0]); displayInfo(player, args[0]);
@ -48,7 +54,7 @@ public class MmoInfoCommand implements TabExecutor {
} }
//Not a real skill //Not a real skill
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.NoMatch")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.NoMatch"));
return true; return true;
} }
} }
@ -77,10 +83,10 @@ public class MmoInfoCommand implements TabExecutor {
/* /*
* Skill is only in the old system * Skill is only in the old system
*/ */
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName)); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.DetailsHeader"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill")); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.MmoInfo.OldSkill"));
} }
for (SubSkillType subSkillType : SubSkillType.values()) { for (SubSkillType subSkillType : SubSkillType.values()) {

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.RepairManager; import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
@ -39,17 +38,17 @@ public class RepairCommand extends SkillCommand {
// private int ironLevel; // private int ironLevel;
// private int stoneLevel; // private int stoneLevel;
public RepairCommand() { public RepairCommand(mcMMO pluginRef) {
super(PrimarySkillType.REPAIR); super(PrimarySkillType.REPAIR, pluginRef);
} }
@Override @Override
protected void dataCalculations(Player player, double skillValue) { protected void dataCalculations(Player player, double skillValue) {
// We're using pickaxes here, not the best but it works // We're using pickaxes here, not the best but it works
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE); Repairable diamondRepairable = pluginRef.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE); Repairable goldRepairable = pluginRef.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE); Repairable ironRepairable = pluginRef.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE); Repairable stoneRepairable = pluginRef.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0 // TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
// diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel(); // diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
@ -59,8 +58,8 @@ public class RepairCommand extends SkillCommand {
// REPAIR MASTERY // REPAIR MASTERY
if (canMasterRepair) { if (canMasterRepair) {
double maxBonus = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY); double maxBonus = pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY);
int maxBonusLevel = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY); int maxBonusLevel = pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY);
repairMasteryBonus = percent.format(Math.min(((maxBonus / maxBonusLevel) * skillValue), maxBonus) / 100D); repairMasteryBonus = percent.format(Math.min(((maxBonus / maxBonusLevel) * skillValue), maxBonus) / 100D);
} }
@ -100,7 +99,7 @@ public class RepairCommand extends SkillCommand {
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)), String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING))); RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() || mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) { if (pluginRef.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() || pluginRef.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING, messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING,
String.valueOf(arcaneBypass ? 100 : repairManager.getKeepEnchantChance()), String.valueOf(arcaneBypass ? 100 : repairManager.getKeepEnchantChance()),
String.valueOf(arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance()))); //Jesus those parentheses String.valueOf(arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance()))); //Jesus those parentheses
@ -113,7 +112,7 @@ public class RepairCommand extends SkillCommand {
if (canSuperRepair) { if (canSuperRepair) {
messages.add(getStatMessage(SubSkillType.REPAIR_SUPER_REPAIR, superRepairChance) messages.add(getStatMessage(SubSkillType.REPAIR_SUPER_REPAIR, superRepairChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", superRepairChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", superRepairChanceLucky) : ""));
} }
return messages; return messages;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.salvage.Salvage; import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.salvage.SalvageManager; import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
@ -18,8 +18,8 @@ public class SalvageCommand extends SkillCommand {
private boolean canScrapCollector; private boolean canScrapCollector;
private boolean canArcaneSalvage; private boolean canArcaneSalvage;
public SalvageCommand() { public SalvageCommand(mcMMO pluginRef) {
super(PrimarySkillType.SALVAGE); super(PrimarySkillType.SALVAGE, pluginRef);
} }
@Override @Override
@ -52,11 +52,11 @@ public class SalvageCommand extends SkillCommand {
String.valueOf(RankUtils.getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE)))); String.valueOf(RankUtils.getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE))));
if (Salvage.arcaneSalvageEnchantLoss) { if (Salvage.arcaneSalvageEnchantLoss) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100)));
} }
if (Salvage.arcaneSalvageDowngrades) { if (Salvage.arcaneSalvageDowngrades) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractPartial"), percent.format(salvageManager.getExtractPartialEnchantChance() / 100))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Salvage.Arcane.ExtractPartial"), percent.format(salvageManager.getExtractPartialEnchantChance() / 100)));
} }
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -36,8 +35,10 @@ public abstract class SkillCommand implements TabExecutor {
protected DecimalFormat decimal = new DecimalFormat("##0.00"); protected DecimalFormat decimal = new DecimalFormat("##0.00");
private String skillName; private String skillName;
private CommandExecutor skillGuideCommand; private CommandExecutor skillGuideCommand;
protected mcMMO pluginRef;
public SkillCommand(PrimarySkillType skill) { public SkillCommand(PrimarySkillType skill, mcMMO pluginRef) {
this.pluginRef = pluginRef;
this.skill = skill; this.skill = skill;
skillName = skill.getName(); skillName = skill.getName();
skillGuideCommand = new SkillGuideCommand(skill); skillGuideCommand = new SkillGuideCommand(skill);
@ -63,7 +64,7 @@ public abstract class SkillCommand implements TabExecutor {
} }
if (UserManager.getPlayer((Player) sender) == null) { if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
return true; return true;
} }
@ -77,7 +78,7 @@ public abstract class SkillCommand implements TabExecutor {
double skillValue = mcMMOPlayer.getSkillLevel(skill); double skillValue = mcMMOPlayer.getSkillLevel(skill);
//Send the players a few blank lines to make finding the top of the skill command easier //Send the players a few blank lines to make finding the top of the skill command easier
if (mcMMO.getConfigManager().getConfigCommands().isSendBlankLines()) if (pluginRef.getConfigManager().getConfigCommands().isSendBlankLines())
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
player.sendMessage(""); player.sendMessage("");
} }
@ -91,7 +92,7 @@ public abstract class SkillCommand implements TabExecutor {
List<TextComponent> subskillTextComponents = getTextComponents(player); List<TextComponent> subskillTextComponents = getTextComponents(player);
//Subskills Header //Subskills Header
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul"))); player.sendMessage(pluginRef.getLocaleManager().getString("Skills.Overhaul.Header", pluginRef.getLocaleManager().getString("Effects.SubSkills.Overhaul")));
//Send JSON text components //Send JSON text components
@ -109,14 +110,14 @@ public abstract class SkillCommand implements TabExecutor {
//Link Header //Link Header
if (mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks()) { if (pluginRef.getConfigManager().getConfigAds().isShowWebsiteLinks()) {
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header")); player.sendMessage(pluginRef.getLocaleManager().getString("Overhaul.mcMMO.Header"));
TextComponentFactory.sendPlayerUrlHeader(player); TextComponentFactory.sendPlayerUrlHeader(player);
} }
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() if (pluginRef.getScoreboardSettings().getScoreboardsEnabled()
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes() && pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes()
.getConfigSectionSkillBoard().isUseThisBoard()) { .getConfigSectionSkillBoard().isUseThisBoard()) {
ScoreboardManager.enablePlayerSkillScoreboard(player, skill); ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
} }
@ -131,14 +132,14 @@ public abstract class SkillCommand implements TabExecutor {
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky); List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
if (!statsMessages.isEmpty()) { if (!statsMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Commands.Stats.Self.Overhaul"))); player.sendMessage(pluginRef.getLocaleManager().getString("Skills.Overhaul.Header", pluginRef.getLocaleManager().getString("Commands.Stats.Self.Overhaul")));
for (String message : statsMessages) { for (String message : statsMessages) {
player.sendMessage(message); player.sendMessage(message);
} }
} }
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase())); player.sendMessage(pluginRef.getLocaleManager().getString("Guides.Available", skillName, skillName.toLowerCase()));
} }
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) { private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
@ -147,7 +148,7 @@ public abstract class SkillCommand implements TabExecutor {
ChatColor c2 = ChatColor.RED; ChatColor c2 = ChatColor.RED;
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName)); player.sendMessage(pluginRef.getLocaleManager().getString("Skills.Overhaul.Header", skillName));
if (!skill.isChildSkill()) { if (!skill.isChildSkill()) {
/* /*
@ -155,10 +156,10 @@ public abstract class SkillCommand implements TabExecutor {
*/ */
//XP GAIN METHOD //XP GAIN METHOD
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString())))); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.XPGain.Overhaul", pluginRef.getLocaleManager().getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
//LEVEL //LEVEL
player.sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill))); player.sendMessage(pluginRef.getLocaleManager().getString("Effects.Level.Overhaul", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
} else { } else {
/* /*
@ -170,26 +171,26 @@ public abstract class SkillCommand implements TabExecutor {
ArrayList<PrimarySkillType> parentList = new ArrayList<>(); ArrayList<PrimarySkillType> parentList = new ArrayList<>();
//TODO: Add JSON here //TODO: Add JSON here
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/ /*player.sendMessage(parent.getName() + " - " + pluginRef.getLocaleManager().getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
parentList.addAll(parents); parentList.addAll(parents);
StringBuilder parentMessage = new StringBuilder(); StringBuilder parentMessage = new StringBuilder();
for (int i = 0; i < parentList.size(); i++) { for (int i = 0; i < parentList.size(); i++) {
if (i + 1 < parentList.size()) { if (i + 1 < parentList.size()) {
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)))); parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY + ", "); parentMessage.append(ChatColor.GRAY + ", ");
} else { } else {
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)))); parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
} }
} }
//XP GAIN METHOD //XP GAIN METHOD
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child"))); player.sendMessage(pluginRef.getLocaleManager().getString("Commands.XPGain.Overhaul", pluginRef.getLocaleManager().getString("Commands.XPGain.Child")));
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString())); player.sendMessage(pluginRef.getLocaleManager().getString("Effects.Child.Overhaul", skillValue, parentMessage.toString()));
//LEVEL //LEVEL
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue)); //player.sendMessage(pluginRef.getLocaleManager().getString("Effects.Child.Overhaul", skillValue, skillValue));
} }
} }
@ -230,10 +231,10 @@ public abstract class SkillCommand implements TabExecutor {
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription(); String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if (isCustom) if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars)); return pluginRef.getLocaleManager().getString(templateKey, pluginRef.getLocaleManager().getString(statDescriptionKey, vars));
else { else {
String[] mergedList = mcMMO.getNotificationManager().addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars); String[] mergedList = pluginRef.getNotificationManager().addItemToFirstPositionOfArray(pluginRef.getLocaleManager().getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList); return pluginRef.getLocaleManager().getString(templateKey, mergedList);
} }
} }

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -13,12 +13,14 @@ import java.util.Arrays;
public class SkillGuideCommand implements CommandExecutor { public class SkillGuideCommand implements CommandExecutor {
private String header; private String header;
private ArrayList<String> guide; private ArrayList<String> guide;
private String invalidPage;
private mcMMO pluginRef;
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid"); public SkillGuideCommand(PrimarySkillType skill, mcMMO pluginRef) {
header = pluginRef.getLocaleManager().getString("Guides.Header", skill.getName());
public SkillGuideCommand(PrimarySkillType skill) {
header = LocaleLoader.getString("Guides.Header", skill.getName());
guide = getGuide(skill); guide = getGuide(skill);
invalidPage = pluginRef.getLocaleManager().getString("Guides.Page.Invalid");
this.pluginRef = pluginRef;
} }
@Override @Override
@ -43,7 +45,7 @@ public class SkillGuideCommand implements CommandExecutor {
int pageNumber = Integer.parseInt(args[1]); int pageNumber = Integer.parseInt(args[1]);
if (pageNumber > totalPages || pageNumber <= 0) { if (pageNumber > totalPages || pageNumber <= 0) {
sender.sendMessage(LocaleLoader.getString("Guides.Page.OutOfRange", totalPages)); sender.sendMessage(pluginRef.getLocaleManager().getString("Guides.Page.OutOfRange", totalPages));
return true; return true;
} }
@ -88,7 +90,7 @@ public class SkillGuideCommand implements CommandExecutor {
ArrayList<String> guide = new ArrayList<>(); ArrayList<String> guide = new ArrayList<>();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n"); String[] section = pluginRef.getLocaleManager().getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");
if (section[0].startsWith("!")) { if (section[0].startsWith("!")) {
break; break;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -25,8 +25,8 @@ public class SmeltingCommand extends SkillCommand {
private boolean canFluxMine; private boolean canFluxMine;
private boolean canUnderstandTheArt; private boolean canUnderstandTheArt;
public SmeltingCommand() { public SmeltingCommand(mcMMO pluginRef) {
super(PrimarySkillType.SMELTING); super(PrimarySkillType.SMELTING, pluginRef);
} }
@Override @Override
@ -65,8 +65,8 @@ public class SmeltingCommand extends SkillCommand {
/*if (canFluxMine) { /*if (canFluxMine) {
messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance) messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Smelting.Ability.FluxMining", str_fluxMiningChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Smelting.Ability.FluxMining", str_fluxMiningChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : ""));
}*/ }*/
if (canFuelEfficiency) { if (canFuelEfficiency) {
@ -75,7 +75,7 @@ public class SmeltingCommand extends SkillCommand {
if (canSecondSmelt) { if (canSecondSmelt) {
messages.add(getStatMessage(SubSkillType.SMELTING_SECOND_SMELT, str_secondSmeltChance) messages.add(getStatMessage(SubSkillType.SMELTING_SECOND_SMELT, str_secondSmeltChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_secondSmeltChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", str_secondSmeltChanceLucky) : ""));
} }
if (canUnderstandTheArt) { if (canUnderstandTheArt) {

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
@ -28,8 +27,8 @@ public class SwordsCommand extends SkillCommand {
private boolean canSerratedStrike; private boolean canSerratedStrike;
private boolean canBleed; private boolean canBleed;
public SwordsCommand() { public SwordsCommand(mcMMO pluginRef) {
super(PrimarySkillType.SWORDS); super(PrimarySkillType.SWORDS, pluginRef);
} }
@Override @Override
@ -70,31 +69,31 @@ public class SwordsCommand extends SkillCommand {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks(); int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
double ruptureDamagePlayer = mcMMO.getConfigManager().getConfigSwords().getRuptureDamagePlayer(); double ruptureDamagePlayer = pluginRef.getConfigManager().getConfigSwords().getRuptureDamagePlayer();
double pveRupture = mcMMO.getConfigManager().getConfigSwords().getRuptureDamageMobs(); double pveRupture = pluginRef.getConfigManager().getConfigSwords().getRuptureDamageMobs();
double pvpDamageRupture = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? ruptureDamagePlayer * 1.5D : ruptureDamagePlayer; double pvpDamageRupture = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? ruptureDamagePlayer * 1.5D : ruptureDamagePlayer;
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? pveRupture * 1.5D : pveRupture; double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? pveRupture * 1.5D : pveRupture;
if (canCounter) { if (canCounter) {
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance) messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", counterChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", counterChanceLucky) : ""));
} }
if (canBleed) { if (canBleed) {
messages.add(getStatMessage(SubSkillType.SWORDS_RUPTURE, bleedChance) messages.add(getStatMessage(SubSkillType.SWORDS_RUPTURE, bleedChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", bleedChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", bleedChanceLucky) : ""));
messages.add(getStatMessage(true, true, SubSkillType.SWORDS_RUPTURE, messages.add(getStatMessage(true, true, SubSkillType.SWORDS_RUPTURE,
String.valueOf(ruptureTicks), String.valueOf(ruptureTicks),
String.valueOf(pvpDamageRupture), String.valueOf(pvpDamageRupture),
String.valueOf(ruptureDamageMobs))); String.valueOf(ruptureDamageMobs)));
messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note")); messages.add(pluginRef.getLocaleManager().getString("Swords.Combat.Rupture.Note"));
} }
if (canSerratedStrike) { if (canSerratedStrike) {
messages.add(getStatMessage(SubSkillType.SWORDS_SERRATED_STRIKES, serratedStrikesLength) messages.add(getStatMessage(SubSkillType.SWORDS_SERRATED_STRIKES, serratedStrikesLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
} }
if (canUseSubskill(player, SubSkillType.SWORDS_STAB)) { if (canUseSubskill(player, SubSkillType.SWORDS_STAB)) {

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
@ -27,8 +27,8 @@ public class TamingCommand extends SkillCommand {
private boolean canFastFood; private boolean canFastFood;
private boolean canHolyHound; private boolean canHolyHound;
public TamingCommand() { public TamingCommand(mcMMO pluginRef) {
super(PrimarySkillType.TAMING); super(PrimarySkillType.TAMING, pluginRef);
} }
@Override @Override
@ -58,46 +58,46 @@ public class TamingCommand extends SkillCommand {
List<String> messages = new ArrayList<>(); List<String> messages = new ArrayList<>();
if (canEnvironmentallyAware) { if (canEnvironmentallyAware) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1"))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.0"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.1")));
} }
if (canFastFood) { if (canFastFood) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Ability.Bonus.8"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.8"),
LocaleLoader.getString("Taming.Ability.Bonus.9", pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.9",
percent.format(Taming.getInstance().getFastFoodServiceActivationChance() / 100D)))); percent.format(Taming.getInstance().getFastFoodServiceActivationChance() / 100D))));
} }
if (canGore) { if (canGore) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Combat.Chance.Gore"), pluginRef.getLocaleManager().getString("Taming.Combat.Chance.Gore"),
goreChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", goreChanceLucky) : "")); goreChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", goreChanceLucky) : ""));
} }
if (canHolyHound) { if (canHolyHound) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Ability.Bonus.10"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.10"),
LocaleLoader.getString("Taming.Ability.Bonus.11"))); pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.11")));
} }
if (canSharpenedClaws) { if (canSharpenedClaws) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Ability.Bonus.6"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.6"),
LocaleLoader.getString("Taming.Ability.Bonus.7", pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.7",
Taming.getInstance().getSharpenedClawsBonusDamage()))); Taming.getInstance().getSharpenedClawsBonusDamage())));
} }
if (canShockProof) { if (canShockProof) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Ability.Bonus.4"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.4"),
LocaleLoader.getString("Taming.Ability.Bonus.5", pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.5",
Taming.getInstance().getShockProofModifier()))); Taming.getInstance().getShockProofModifier())));
} }
if (canThickFur) { if (canThickFur) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template",
LocaleLoader.getString("Taming.Ability.Bonus.2"), pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.2"),
LocaleLoader.getString("Taming.Ability.Bonus.3", pluginRef.getLocaleManager().getString("Taming.Ability.Bonus.3",
Taming.getInstance().getThickFurModifier()))); Taming.getInstance().getThickFurModifier())));
} }

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@ -31,8 +31,8 @@ public class UnarmedCommand extends SkillCommand {
private boolean canDeflect; private boolean canDeflect;
private boolean canIronGrip; private boolean canIronGrip;
public UnarmedCommand() { public UnarmedCommand(mcMMO pluginRef) {
super(PrimarySkillType.UNARMED); super(PrimarySkillType.UNARMED, pluginRef);
} }
@Override @Override
@ -87,30 +87,30 @@ public class UnarmedCommand extends SkillCommand {
if (canDeflect) { if (canDeflect) {
messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance) messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", deflectChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", deflectChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", deflectChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", deflectChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Unarmed.Ability.Chance.ArrowDeflect", deflectChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", deflectChanceLucky) : ""));
} }
if (canBerserk) { if (canBerserk) {
messages.add(getStatMessage(SubSkillType.UNARMED_BERSERK, berserkLength) messages.add(getStatMessage(SubSkillType.UNARMED_BERSERK, berserkLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : ""));
//messages.add(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", berserkLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : "")); //messages.add(pluginRef.getLocaleManager().getString("Unarmed.Ability.Berserk.Length", berserkLength) + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : ""));
} }
if (canDisarm) { if (canDisarm) {
messages.add(getStatMessage(SubSkillType.UNARMED_DISARM, disarmChance) messages.add(getStatMessage(SubSkillType.UNARMED_DISARM, disarmChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", disarmChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", disarmChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", disarmChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", disarmChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Unarmed.Ability.Chance.Disarm", disarmChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", disarmChanceLucky) : ""));
} }
if (canIronArm) { if (canIronArm) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", ironArmBonus))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Unarmed.Ability.Bonus.0"), pluginRef.getLocaleManager().getString("Unarmed.Ability.Bonus.1", ironArmBonus)));
} }
if (canIronGrip) { if (canIronGrip) {
messages.add(getStatMessage(SubSkillType.UNARMED_IRON_GRIP, ironGripChance) messages.add(getStatMessage(SubSkillType.UNARMED_IRON_GRIP, ironGripChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : "")); //messages.add(pluginRef.getLocaleManager().getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
} }
if (canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) { if (canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
@ -25,8 +25,8 @@ public class WoodcuttingCommand extends SkillCommand {
private boolean canBarkSurgeon; private boolean canBarkSurgeon;
private boolean canNaturesBounty; private boolean canNaturesBounty;
public WoodcuttingCommand() { public WoodcuttingCommand(mcMMO pluginRef) {
super(PrimarySkillType.WOODCUTTING); super(PrimarySkillType.WOODCUTTING, pluginRef);
} }
@Override @Override
@ -66,16 +66,16 @@ public class WoodcuttingCommand extends SkillCommand {
if (canDoubleDrop) { if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance) messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : "")); + (isLucky ? pluginRef.getLocaleManager().getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
} }
if (canLeafBlow) { if (canLeafBlow) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1"))); messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Woodcutting.Ability.0"), pluginRef.getLocaleManager().getString("Woodcutting.Ability.1")));
} }
if (canTreeFell) { if (canTreeFell) {
messages.add(getStatMessage(SubSkillType.WOODCUTTING_TREE_FELLER, treeFellerLength) messages.add(getStatMessage(SubSkillType.WOODCUTTING_TREE_FELLER, treeFellerLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", treeFellerLengthEndurance) : "")); + (hasEndurance ? pluginRef.getLocaleManager().getString("Perks.ActivationTime.Bonus", treeFellerLengthEndurance) : ""));
} }
return messages; return messages;

View File

@ -123,7 +123,7 @@ public class AdvancedConfig extends ConfigValidated {
public AdvancedConfig() { public AdvancedConfig() {
//super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true); //super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true);
super("advanced", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true); super("advanced", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
} }
/** /**
@ -136,7 +136,7 @@ public class AdvancedConfig extends ConfigValidated {
*/ */
@Deprecated @Deprecated
public static AdvancedConfig getInstance() { public static AdvancedConfig getInstance() {
return mcMMO.getConfigManager().getAdvancedConfig(); return pluginRef.getConfigManager().getAdvancedConfig();
} }
/** /**

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode;
@ -112,7 +111,7 @@ public abstract class Config implements VersionedConfig {
* Used for backing up configs with our zip library * Used for backing up configs with our zip library
*/ */
private void registerFileBackup() { private void registerFileBackup() {
mcMMO.getConfigManager().registerUserFile(getUserConfigFile()); pluginRef.getConfigManager().registerUserFile(getUserConfigFile());
} }
/** /**
@ -172,7 +171,7 @@ public abstract class Config implements VersionedConfig {
* @return the File for the newly created config * @return the File for the newly created config
*/ */
private File generateDefaultFile() { private File generateDefaultFile() {
mcMMO.p.getLogger().info("Attempting to create a default config for " + fileName); pluginRef.getLogger().info("Attempting to create a default config for " + fileName);
//Not sure if this will work properly... //Not sure if this will work properly...
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath()); Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
@ -180,7 +179,7 @@ public abstract class Config implements VersionedConfig {
= HoconConfigurationLoader.builder().setPath(potentialFile).build(); = HoconConfigurationLoader.builder().setPath(potentialFile).build();
try { try {
mcMMO.p.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath()); pluginRef.getLogger().info("Config File Full Path: " + getDefaultConfigFile().getAbsolutePath());
//Delete any existing default config //Delete any existing default config
if (getDefaultConfigFile().exists()) if (getDefaultConfigFile().exists())
getDefaultConfigFile().delete(); getDefaultConfigFile().delete();
@ -194,9 +193,9 @@ public abstract class Config implements VersionedConfig {
//Save to a new file //Save to a new file
generation_loader.save(defaultRootNode); generation_loader.save(defaultRootNode);
mcMMO.p.getLogger().info("Generated a default file for " + fileName); pluginRef.getLogger().info("Generated a default file for " + fileName);
} catch (IOException e) { } catch (IOException e) {
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath()); pluginRef.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
e.printStackTrace(); e.printStackTrace();
} }
@ -251,9 +250,9 @@ public abstract class Config implements VersionedConfig {
/* /*
* Gen a Default config from inside the JAR * Gen a Default config from inside the JAR
*/ */
mcMMO.p.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH); pluginRef.getLogger().info("Preparing to copy internal resource file (in JAR) - " + FILE_RELATIVE_PATH);
//InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH); //InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
InputStream inputStream = mcMMO.p.getResource(FILE_RELATIVE_PATH); InputStream inputStream = pluginRef.getResource(FILE_RELATIVE_PATH);
byte[] buffer = new byte[inputStream.available()]; byte[] buffer = new byte[inputStream.available()];
inputStream.read(buffer); inputStream.read(buffer);
@ -263,7 +262,7 @@ public abstract class Config implements VersionedConfig {
//Wipe old default file on disk //Wipe old default file on disk
if (targetFile.exists() && deleteOld) { if (targetFile.exists() && deleteOld) {
mcMMO.p.getLogger().info("Updating file " + relativeOutputPath); pluginRef.getLogger().info("Updating file " + relativeOutputPath);
targetFile.delete(); //Necessary? targetFile.delete(); //Necessary?
} }
@ -273,7 +272,7 @@ public abstract class Config implements VersionedConfig {
} }
Files.write(buffer, targetFile); Files.write(buffer, targetFile);
mcMMO.p.getLogger().info("Created config file - " + relativeOutputPath); pluginRef.getLogger().info("Created config file - " + relativeOutputPath);
inputStream.close(); //Close the input stream inputStream.close(); //Close the input stream
@ -322,10 +321,10 @@ public abstract class Config implements VersionedConfig {
* MainConfig will have any missing nodes inserted with their default value * MainConfig will have any missing nodes inserted with their default value
*/ */
public void readConfig() { public void readConfig() {
mcMMO.p.getLogger().info("Attempting to read " + FILE_RELATIVE_PATH + "."); pluginRef.getLogger().info("Attempting to read " + FILE_RELATIVE_PATH + ".");
int version = this.userRootNode.getNode("ConfigVersion").getInt(); int version = this.userRootNode.getNode("ConfigVersion").getInt();
mcMMO.p.getLogger().info(FILE_RELATIVE_PATH + " version is " + version); pluginRef.getLogger().info(FILE_RELATIVE_PATH + " version is " + version);
//Update our config //Update our config
updateConfig(); updateConfig();
@ -335,8 +334,8 @@ public abstract class Config implements VersionedConfig {
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates * Compares the users config file to the default and adds any missing nodes and applies any necessary updates
*/ */
private void updateConfig() { private void updateConfig() {
mcMMO.p.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map"); pluginRef.getLogger().info(defaultRootNode.getChildrenMap().size() + " items in default children map");
mcMMO.p.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map"); pluginRef.getLogger().info(userRootNode.getChildrenMap().size() + " items in default root map");
// Merge Values from default // Merge Values from default
if (mergeNewKeys) if (mergeNewKeys)
@ -374,7 +373,7 @@ public abstract class Config implements VersionedConfig {
* @throws IOException * @throws IOException
*/ */
private void saveUserCopy() throws IOException { private void saveUserCopy() throws IOException {
mcMMO.p.getLogger().info("Saving new node"); pluginRef.getLogger().info("Saving new node");
userCopyLoader.save(userRootNode); userCopyLoader.save(userRootNode);
} }
@ -384,7 +383,7 @@ public abstract class Config implements VersionedConfig {
private void updateConfigVersion() { private void updateConfigVersion() {
// Set a version for our config // Set a version for our config
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion()); this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
mcMMO.p.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH); pluginRef.getLogger().info("Updated config to [" + getConfigVersion() + "] - " + FILE_RELATIVE_PATH);
} }
/** /**

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -48,7 +46,7 @@ public class ConfigConstants {
* @return the File for the data folder used by mcMMO * @return the File for the data folder used by mcMMO
*/ */
public static File getDataFolder() { public static File getDataFolder() {
return mcMMO.p.getDataFolder(); return pluginRef.getDataFolder();
} }
public static File getConfigFolder() { public static File getConfigFolder() {

View File

@ -82,6 +82,8 @@ import java.util.Set;
* Settings in configs are sometimes not platform-ready, you can find platform ready implementations in the {@link com.gmail.nossr50.core.DynamicSettingsManager DynamicSettingsManager} * Settings in configs are sometimes not platform-ready, you can find platform ready implementations in the {@link com.gmail.nossr50.core.DynamicSettingsManager DynamicSettingsManager}
*/ */
public final class ConfigManager { public final class ConfigManager {
private mcMMO pluginRef;
/* File array - Used for backups */ /* File array - Used for backups */
private ArrayList<File> userFiles; private ArrayList<File> userFiles;
@ -150,7 +152,8 @@ public final class ConfigManager {
private ArrayList<String> configErrors; //Collect errors to whine about to server admins private ArrayList<String> configErrors; //Collect errors to whine about to server admins
public ConfigManager() { public ConfigManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
userFiles = new ArrayList<>(); userFiles = new ArrayList<>();
} }
@ -265,7 +268,7 @@ public final class ConfigManager {
*/ */
customSerializers = TypeSerializers.getDefaultSerializers().newChild(); customSerializers = TypeSerializers.getDefaultSerializers().newChild();
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate..."); pluginRef.getLogger().info("Registering custom type serializers for Configurate...");
customSerializers.registerType(new TypeToken<PrimarySkillType>() {}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken<PrimarySkillType>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
@ -321,7 +324,7 @@ public final class ConfigManager {
* Technically this reloads a lot of stuff, not just configs * Technically this reloads a lot of stuff, not just configs
*/ */
public void reloadConfigs() { public void reloadConfigs() {
mcMMO.p.getLogger().info("Reloading config values..."); pluginRef.getLogger().info("Reloading config values...");
loadConfigs(); //Load everything again loadConfigs(); //Load everything again
} }

View File

@ -17,7 +17,7 @@ public class MainConfig extends ConfigValidated {
public static final String GENERAL = "General"; public static final String GENERAL = "General";
public static final String RETRO_MODE = "RetroMode"; public static final String RETRO_MODE = "RetroMode";
public static final String ENABLED = "Enabled"; public static final String ENABLED = "Enabled";
public static final String LOCALE = "Locale"; public static final String LOCALE = "LocaleManager";
public static final String EN_US = "en_us"; public static final String EN_US = "en_us";
public static final String SHOW_PROFILE_LOADED = "Show_Profile_Loaded"; public static final String SHOW_PROFILE_LOADED = "Show_Profile_Loaded";
public static final String DONATE_MESSAGE = "Donate_Message"; public static final String DONATE_MESSAGE = "Donate_Message";
@ -200,7 +200,7 @@ public class MainConfig extends ConfigValidated {
public MainConfig() { public MainConfig() {
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true); //super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
super("main", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true); super("main", pluginRef.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
} }
/** /**
@ -213,7 +213,7 @@ public class MainConfig extends ConfigValidated {
*/ */
@Deprecated @Deprecated
public static MainConfig getInstance() { public static MainConfig getInstance() {
return mcMMO.getConfigManager().getMainConfig(); return pluginRef.getConfigManager().getMainConfig();
} }
/** /**

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import java.util.List; import java.util.List;
/** /**
@ -22,7 +20,7 @@ public interface UnsafeValueValidation {
if (validKeyErrors != null && validKeyErrors.size() > 0) { if (validKeyErrors != null && validKeyErrors.size() > 0) {
for (String error : validKeyErrors) { for (String error : validKeyErrors) {
mcMMO.p.getLogger().severe(error); pluginRef.getLogger().severe(error);
} }
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import org.bukkit.World; import org.bukkit.World;
/** /**
@ -10,7 +9,7 @@ import org.bukkit.World;
public class WorldBlacklist { public class WorldBlacklist {
public static boolean isWorldBlacklisted(World world) { public static boolean isWorldBlacklisted(World world) {
for (String s : mcMMO.getConfigManager().getConfigWorldBlacklist().getBlackListedWorlds()) { for (String s : pluginRef.getConfigManager().getConfigWorldBlacklist().getBlackListedWorlds()) {
if (world.getName().equalsIgnoreCase(s)) if (world.getName().equalsIgnoreCase(s))
return true; return true;
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.config.hocon; package com.gmail.nossr50.config.hocon;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.mcMMO;
import ninja.leaping.configurate.ConfigurationOptions; import ninja.leaping.configurate.ConfigurationOptions;
import ninja.leaping.configurate.ValueType; import ninja.leaping.configurate.ValueType;
import ninja.leaping.configurate.commented.CommentedConfigurationNode; import ninja.leaping.configurate.commented.CommentedConfigurationNode;
@ -92,7 +91,7 @@ public class SerializedConfigLoader<T> {
Files.createFile(path); Files.createFile(path);
} }
configurationOptions = ConfigurationOptions.defaults().setSerializers(mcMMO.getConfigManager().getCustomSerializers()).setHeader(CONFIG_HEADER); configurationOptions = ConfigurationOptions.defaults().setSerializers(pluginRef.getConfigManager().getCustomSerializers()).setHeader(CONFIG_HEADER);
data = SimpleCommentedConfigurationNode.root(configurationOptions); data = SimpleCommentedConfigurationNode.root(configurationOptions);
fileData = SimpleCommentedConfigurationNode.root(configurationOptions); fileData = SimpleCommentedConfigurationNode.root(configurationOptions);
@ -114,7 +113,7 @@ public class SerializedConfigLoader<T> {
reload(); reload();
save(); save();
} catch (Exception e) { } catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to initialize config - " + path.toString()); pluginRef.getLogger().severe("Failed to initialize config - " + path.toString());
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -146,7 +145,7 @@ public class SerializedConfigLoader<T> {
this.loader.save(saveNode); this.loader.save(saveNode);
return true; return true;
} catch (IOException | ObjectMappingException e) { } catch (IOException | ObjectMappingException e) {
mcMMO.p.getLogger().severe("Failed to save configuration - " + path.toString()); pluginRef.getLogger().severe("Failed to save configuration - " + path.toString());
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
@ -172,7 +171,7 @@ public class SerializedConfigLoader<T> {
// populate the config object // populate the config object
populateInstance(); populateInstance();
} catch (Exception e) { } catch (Exception e) {
mcMMO.p.getLogger().severe("Failed to load configuration - " + path.toString()); pluginRef.getLogger().severe("Failed to load configuration - " + path.toString());
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -78,7 +78,7 @@ public class ConfigExperienceBars {
@Setting(value = "Extra-Details", comment = "Adds extra details to the XP bar, these cause a bit more performance overhead and may not look very pretty" + @Setting(value = "Extra-Details", comment = "Adds extra details to the XP bar, these cause a bit more performance overhead and may not look very pretty" +
"\nYou can customize the more detailed XP bar in the locale" + "\nYou can customize the more detailed XP bar in the locale" +
"\nLocale key - XPBar.Complex.Template" + "\nLocaleManager key - XPBar.Complex.Template" +
"\nThe default extra detailed XP bar will include quite a few extra things, you can actually remove each thing you don't want displayed in the locale" + "\nThe default extra detailed XP bar will include quite a few extra things, you can actually remove each thing you don't want displayed in the locale" +
"\nFor tips on editing the locale check - https://mcmmo.org/wiki/Locale" + "\nFor tips on editing the locale check - https://mcmmo.org/wiki/Locale" +
"\nDefault value: " + DETAILED_XP_BARS_DEFAULT) "\nDefault value: " + DETAILED_XP_BARS_DEFAULT)

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.hocon.playerleveling;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
@ -247,7 +246,7 @@ public class ConfigLeveling {
case SALVAGE: case SALVAGE:
return configSectionLevelCaps.getConfigSectionSkillLevelCaps().getSalvage().getLevelCap(); return configSectionLevelCaps.getConfigSectionSkillLevelCaps().getSalvage().getLevelCap();
default: default:
mcMMO.p.getLogger().severe("No defined level cap for " + primarySkillType.toString() + " - Contact the mcMMO dev team!"); pluginRef.getLogger().severe("No defined level cap for " + primarySkillType.toString() + " - Contact the mcMMO dev team!");
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
} }
@ -285,7 +284,7 @@ public class ConfigLeveling {
case SALVAGE: case SALVAGE:
return configSectionLevelCaps.getConfigSectionSkillLevelCaps().getSalvage().isLevelCapEnabled(); return configSectionLevelCaps.getConfigSectionSkillLevelCaps().getSalvage().isLevelCapEnabled();
default: default:
mcMMO.p.getLogger().severe("No defined level cap for " + primarySkillType.toString() + " - Contact the mcMMO dev team!"); pluginRef.getLogger().severe("No defined level cap for " + primarySkillType.toString() + " - Contact the mcMMO dev team!");
return false; return false;
} }
} }

Some files were not shown because too many files have changed in this diff Show More