mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Rollback command classes to master versions
This commit is contained in:
parent
8e1b223288
commit
e958baf720
@ -1,30 +0,0 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AbilityToggleCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(@NotNull CommandSender sender) {
|
||||
return Permissions.mcabilityOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(@NotNull CommandSender sender) {
|
||||
return Permissions.mcability(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.Ability." + (mmoPlayer.getSuperAbilityManager().getAbilityActivationPermission() ? "Off" : "On")));
|
||||
mmoPlayer.getSuperAbilityManager().toggleAbilityActivationPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(@NotNull CommandSender sender, @NotNull String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName));
|
||||
}
|
||||
}
|
@ -7,10 +7,11 @@ import com.gmail.nossr50.commands.chat.AdminChatCommand;
|
||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||
import com.gmail.nossr50.config.ChatConfig;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
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.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -96,13 +97,13 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
public void validateLoadedData(@NotNull Player player) {
|
||||
if(mcMMO.getUserManager().queryPlayer(player) == null) {
|
||||
if(UserManager.getPlayer(player) == null) {
|
||||
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
}
|
||||
}
|
||||
|
||||
public void validatePlayerParty(@NotNull Player player) {
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer.getParty() == null) {
|
||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
||||
|
@ -3,9 +3,10 @@ package com.gmail.nossr50.commands;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.FlatFileDatabaseManager;
|
||||
import com.gmail.nossr50.database.SQLDatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -20,8 +21,8 @@ public class MHDCommand implements TabExecutor {
|
||||
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
|
||||
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) {
|
||||
mmoPlayer.setMobHealthBarType(Config.getInstance().getMobHealthbarDefault());
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
@ -29,8 +30,8 @@ public class MHDCommand implements TabExecutor {
|
||||
if (mcMMO.getDatabaseManager() instanceof FlatFileDatabaseManager) {
|
||||
FlatFileDatabaseManager m = (FlatFileDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) {
|
||||
mmoPlayer.setMobHealthBarType(Config.getInstance().getMobHealthbarDefault());
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
|
336
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
336
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
@ -0,0 +1,336 @@
|
||||
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 org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class McImportCommand implements CommandExecutor {
|
||||
int fileAmount;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
importModConfig();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean 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 false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
tryClose(in);
|
||||
}
|
||||
|
||||
createOutput(materialNames);
|
||||
|
||||
mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!");
|
||||
return true;
|
||||
}
|
||||
|
||||
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(Locale.ENGLISH);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class McabilityCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.mcabilityOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.mcability(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Ability." + (mcMMOPlayer.getAbilityUse() ? "Off" : "On")));
|
||||
mcMMOPlayer.toggleAbilityUse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Toggle", playerName));
|
||||
}
|
||||
}
|
@ -1,30 +1,29 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class McgodCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.mcgodOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.mcgod(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.GodMode." + (mmoPlayer.getGodMode() ? "Disabled" : "Enabled")));
|
||||
mmoPlayer.toggleGodMode();
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
|
||||
mcMMOPlayer.toggleGodMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(@NotNull CommandSender sender, @NotNull String playerName) {
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Toggle", playerName));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.commands.party.PartySubCommandType;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -109,7 +108,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + " /party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + " /party accept " + LocaleLoader.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"));
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -21,14 +21,14 @@ public class McnotifyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
|
||||
//Not Loaded yet
|
||||
if (mmoPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mmoPlayer.hasSkillChatNotifications() ? "Off" : "On")));
|
||||
mmoPlayer.toggleSkillChatNotifications();
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
||||
mcMMOPlayer.toggleChatNotifications();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1,34 +1,33 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class McrefreshCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.mcrefreshOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.mcrefresh(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
mmoPlayer.setRecentlyHurtTimestamp(0);
|
||||
mmoPlayer.getSuperAbilityManager().resetCooldowns();
|
||||
mmoPlayer.getSuperAbilityManager().unprimeAllAbilityTools();
|
||||
mmoPlayer.getSuperAbilityManager().disableSuperAbilities();
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.setRecentlyHurt(0);
|
||||
mcMMOPlayer.resetCooldowns();
|
||||
mcMMOPlayer.resetToolPrepMode();
|
||||
mcMMOPlayer.resetAbilityMode();
|
||||
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(@NotNull CommandSender sender, @NotNull String playerName) {
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", playerName));
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -34,14 +31,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||
|
||||
if(mmoPlayer != null) {
|
||||
applyCommandAction(mmoPlayer);
|
||||
} else {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||
}
|
||||
|
||||
applyCommandAction(UserManager.getPlayer(sender.getName()));
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
@ -51,18 +41,17 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
Player otherPlayer = Bukkit.getPlayer(playerName);
|
||||
OnlineMMOPlayer mmoOther = mcMMO.getUserManager().queryPlayer(otherPlayer);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, playerName, mmoOther)) {
|
||||
if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mmoOther.getPlayer().isOnline()) {
|
||||
return false;
|
||||
if (CommandUtils.isOffline(sender, mcMMOPlayer.getPlayer())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyCommandAction(mmoOther);
|
||||
applyCommandAction(mcMMOPlayer);
|
||||
sendSuccessMessage(sender, playerName);
|
||||
return true;
|
||||
|
||||
@ -80,8 +69,8 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
protected abstract boolean hasOtherPermission(@NotNull CommandSender sender);
|
||||
protected abstract boolean hasSelfPermission(@NotNull CommandSender sender);
|
||||
protected abstract void applyCommandAction(@NotNull OnlineMMOPlayer mmoPlayer);
|
||||
protected abstract void sendSuccessMessage(@NotNull CommandSender sender, @NotNull String playerName);
|
||||
protected abstract boolean hasOtherPermission(CommandSender sender);
|
||||
protected abstract boolean hasSelfPermission(CommandSender sender);
|
||||
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
|
||||
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.gmail.nossr50.commands.admin;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,15 +14,9 @@ public class PlayerDebugCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if(sender instanceof Player) {
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||
return true;
|
||||
}
|
||||
|
||||
mmoPlayer.toggleDebugMode(); //Toggle debug mode
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(Misc.adaptPlayer(mmoPlayer), "Commands.Mmodebug.Toggle", String.valueOf(mmoPlayer.isDebugMode()));
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -8,9 +8,9 @@ import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import com.gmail.nossr50.commands.CommandManager;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandPermission("mcmmo.chat.adminchat")
|
||||
@ -28,7 +28,7 @@ public class AdminChatCommand extends BaseCommand {
|
||||
if(args == null || args.length == 0) {
|
||||
//Process with no arguments
|
||||
if(bukkitCommandIssuer.isPlayer()) {
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
|
||||
} else {
|
||||
//Not support for console
|
||||
@ -36,7 +36,7 @@ public class AdminChatCommand extends BaseCommand {
|
||||
}
|
||||
} else {
|
||||
if(bukkitCommandIssuer.isPlayer()) {
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
|
||||
if(mmoPlayer == null)
|
||||
return;
|
||||
|
@ -1,31 +1,30 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.commands.ToggleCommand;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class McChatSpy extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpyOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(@NotNull CommandSender sender) {
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpy(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.AdminChatSpy." + (mmoPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
||||
mmoPlayer.togglePartyChatSpying();
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
||||
mcMMOPlayer.togglePartyChatSpying();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(@NotNull CommandSender sender, @NotNull String playerName) {
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Toggle", playerName));
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import com.gmail.nossr50.commands.CommandManager;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManagerImpl;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -34,7 +34,7 @@ public class PartyChatCommand extends BaseCommand {
|
||||
if(args == null || args.length == 0) {
|
||||
//Process with no arguments
|
||||
if(bukkitCommandIssuer.isPlayer()) {
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
|
||||
} else {
|
||||
//Not support for console
|
||||
@ -47,7 +47,7 @@ public class PartyChatCommand extends BaseCommand {
|
||||
* Player Logic
|
||||
*/
|
||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||
processCommandArgsPlayer(mmoPlayer, args);
|
||||
/*
|
||||
* Console Logic
|
||||
@ -59,11 +59,11 @@ public class PartyChatCommand extends BaseCommand {
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the command with arguments for a {@link OnlineMMOPlayer}
|
||||
* Processes the command with arguments for a {@link McMMOPlayer}
|
||||
* @param mmoPlayer target player
|
||||
* @param args command arguments
|
||||
*/
|
||||
private void processCommandArgsPlayer(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull String[] args) {
|
||||
private void processCommandArgsPlayer(@NotNull McMMOPlayer mmoPlayer, @NotNull String[] args) {
|
||||
//Player is not toggling and is chatting directly to party
|
||||
pluginRef.getChatManager().processPlayerMessage(mmoPlayer, args, ChatChannel.PARTY);
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class PartyChatCommand extends BaseCommand {
|
||||
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
|
||||
} else {
|
||||
//Grab party
|
||||
Party targetParty = PartyManagerImpl.getParty(args[0]);
|
||||
Party targetParty = PartyManager.getParty(args[0]);
|
||||
|
||||
if(targetParty != null) {
|
||||
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
||||
|
@ -8,6 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -49,21 +50,15 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
|
||||
|
||||
mcMMO.getUserManager().saveAllSync();
|
||||
mcMMO.getUserManager().clearAll();
|
||||
|
||||
if(oldDatabase == null) {
|
||||
sender.sendMessage("Could not load the other database, failed to convert users.");
|
||||
return true;
|
||||
}
|
||||
UserManager.saveAll();
|
||||
UserManager.clearAll();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
PlayerProfile profile = oldDatabase.queryPlayerDataByUUID(player.getUniqueId(), null);
|
||||
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId(), null);
|
||||
|
||||
if(profile == null)
|
||||
continue;
|
||||
|
||||
mcMMO.getUserManager().saveUserImmediately(profile.getPersistentPlayerData(), true);
|
||||
if (profile.isLoaded()) {
|
||||
mcMMO.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
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package com.gmail.nossr50.commands.database;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -16,24 +16,20 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DatabaseRemovePlayerCommand implements TabExecutor {
|
||||
public class McremoveCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
|
||||
if (mcMMO.getUserManager().queryPlayer(playerName) == null
|
||||
&& CommandUtils.hasNoProfile(sender, mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName))) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
UUID uuid = null;
|
||||
|
||||
Player targetPlayer = Bukkit.getPlayer(playerName);
|
||||
|
||||
if (targetPlayer != null) {
|
||||
uuid = targetPlayer.getUniqueId();
|
||||
if (Bukkit.getPlayer(playerName) != null) {
|
||||
uuid = Bukkit.getPlayer(playerName).getUniqueId();
|
||||
}
|
||||
|
||||
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.experience;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,9 +23,9 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
|
||||
profile.addLevels(rootSkill, value);
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
profile.addLevels(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
profile.scheduleAsyncSave();
|
||||
@ -35,10 +35,11 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
EventUtils.tryLevelChangeEvent(player, rootSkill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||
} else {
|
||||
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,10 +51,10 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, rootSkill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -19,16 +22,16 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
if (player != null) {
|
||||
//Check if player profile is loaded
|
||||
if(mcMMO.getUserManager().getPlayer(player) == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
mcMMO.getUserManager().getPlayer(player).applyXpGain(rootSkill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||
}
|
||||
else {
|
||||
profile.addXp(rootSkill, value);
|
||||
profile.addXp(skill, value);
|
||||
profile.scheduleAsyncSave();
|
||||
}
|
||||
}
|
||||
@ -42,10 +45,10 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, rootSkill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.database.FormulaConversionTask;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -32,8 +33,8 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Start", previousType.toString(), newType.toString()));
|
||||
|
||||
mcMMO.getUserManager().saveAllSync();
|
||||
mcMMO.getUserManager().clearAll();
|
||||
UserManager.saveAll();
|
||||
UserManager.clearAll();
|
||||
|
||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
||||
|
||||
|
@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.experience;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,11 +23,11 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
|
||||
int skillLevel = profile.getSkillLevel(rootSkill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(rootSkill);
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
int skillLevel = profile.getSkillLevel(skill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
|
||||
profile.modifySkill(rootSkill, value);
|
||||
profile.modifySkill(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
profile.scheduleAsyncSave();
|
||||
@ -43,7 +43,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
if(mmoPlayer != null) {
|
||||
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||
} else {
|
||||
EventUtils.tryLevelEditEvent(player, rootSkill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,10 +57,10 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", rootSkill.getName(), value));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class HardcoreCommand extends HardcoreModeCommand {
|
||||
@ -19,9 +19,9 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(RootSkill rootSkill) {
|
||||
if (rootSkill == null) {
|
||||
for (RootSkill rootSkill : PrimarySkillType.values()) {
|
||||
protected boolean checkEnabled(PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||
if (!primarySkillType.getHardcoreStatLossEnabled()) {
|
||||
return false;
|
||||
}
|
||||
@ -30,16 +30,16 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
return rootSkill.getHardcoreStatLossEnabled();
|
||||
return skill.getHardcoreStatLossEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(RootSkill rootSkill) {
|
||||
protected void enable(PrimarySkillType skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(RootSkill rootSkill) {
|
||||
protected void disable(PrimarySkillType skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@ -49,16 +49,16 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, RootSkill rootSkill) {
|
||||
if (rootSkill == null) {
|
||||
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
private void toggle(boolean enable, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
primarySkillType.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rootSkill.setHardcoreStatLossEnabled(enable);
|
||||
skill.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (rootSkill == null ? "all skills" : rootSkill.getName())));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName())));
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -75,7 +75,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
RootSkill rootSkill = mcMMO.p.getSkillRegister().getSkill(args[0]);
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(args[0]);
|
||||
|
||||
if (!CommandUtils.isChildSkill(sender, skill)) {
|
||||
return true;
|
||||
@ -87,7 +87,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
enable(rootSkill);
|
||||
enable(skill);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
enable(rootSkill);
|
||||
enable(skill);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -122,8 +122,8 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
|
||||
protected abstract boolean checkTogglePermissions(CommandSender sender);
|
||||
protected abstract boolean checkModifyPermissions(CommandSender sender);
|
||||
protected abstract boolean checkEnabled(RootSkill rootSkill);
|
||||
protected abstract void enable(RootSkill rootSkill);
|
||||
protected abstract void disable(RootSkill rootSkill);
|
||||
protected abstract boolean checkEnabled(PrimarySkillType skill);
|
||||
protected abstract void enable(PrimarySkillType skill);
|
||||
protected abstract void disable(PrimarySkillType skill);
|
||||
protected abstract void modify(CommandSender sender, double newPercentage);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class VampirismCommand extends HardcoreModeCommand {
|
||||
@ -19,9 +19,9 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(RootSkill rootSkill) {
|
||||
if (rootSkill == null) {
|
||||
for (RootSkill rootSkill : PrimarySkillType.values()) {
|
||||
protected boolean checkEnabled(PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||
if (!primarySkillType.getHardcoreVampirismEnabled()) {
|
||||
return false;
|
||||
}
|
||||
@ -30,16 +30,16 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
return rootSkill.getHardcoreVampirismEnabled();
|
||||
return skill.getHardcoreVampirismEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(RootSkill rootSkill) {
|
||||
protected void enable(PrimarySkillType skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(RootSkill rootSkill) {
|
||||
protected void disable(PrimarySkillType skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@ -49,16 +49,16 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, RootSkill rootSkill) {
|
||||
if (rootSkill == null) {
|
||||
for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
private void toggle(boolean enable, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
primarySkillType.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rootSkill.setHardcoreVampirismEnabled(enable);
|
||||
skill.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (rootSkill == null ? "all skills" : skill)));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (skill == null ? "all skills" : skill)));
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,25 +17,25 @@ public class PartyAcceptCommand implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
|
||||
//Check if player profile is loaded
|
||||
if (mcMMO.getUserManager().queryPlayer(player) == null) {
|
||||
if (UserManager.getPlayer(player) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
|
||||
if (!mmoPlayer.hasPartyInvite()) {
|
||||
if (!mcMMOPlayer.hasPartyInvite()) {
|
||||
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Changing parties
|
||||
if (!mcMMO.getPartyManager().changeOrJoinParty(mmoPlayer, mmoPlayer.getPartyInvite().getName())) {
|
||||
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().joinInvitedParty(mmoPlayer);
|
||||
PartyManager.joinInvitedParty(mcMMOPlayer);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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.neetgames.mcmmo.party.Party;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -15,27 +17,21 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 2) {//Check if player profile is loaded
|
||||
if (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender).getParty();
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
|
||||
|
||||
if(playerParty == null) {
|
||||
//TODO: Localize
|
||||
sender.sendMessage("Party is null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!playerParty.getPartyMemberManager().hasMember(target.getUniqueId())) {
|
||||
if (!playerParty.hasMember(target.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().setPartyLeader(target.getUniqueId(), playerParty);
|
||||
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -12,13 +12,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
@ -42,14 +42,14 @@ public class PartyChangePasswordCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void unprotectParty(Party party, CommandSender sender) {
|
||||
party.setPartyLock(true);
|
||||
party.setPartyPassword(null);
|
||||
party.setLocked(true);
|
||||
party.setPassword(null);
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Password.Removed"));
|
||||
}
|
||||
|
||||
private void protectParty(Party party, CommandSender sender, String password) {
|
||||
party.setPartyLock(true);
|
||||
party.setPartyPassword(password);
|
||||
party.setLocked(true);
|
||||
party.setPassword(password);
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Password.Set", password));
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -30,7 +30,7 @@ public class PartyCommand implements TabExecutor {
|
||||
static {
|
||||
ArrayList<String> subcommands = new ArrayList<>();
|
||||
|
||||
for (PartySubCommandType subcommand : PartySubCommandType.values()) {
|
||||
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
|
||||
subcommands.add(subcommand.toString());
|
||||
}
|
||||
|
||||
@ -38,19 +38,23 @@ public class PartyCommand implements TabExecutor {
|
||||
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
||||
}
|
||||
|
||||
private final CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
||||
private final CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
||||
private final CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
||||
private final CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
||||
private final CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
||||
private final CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
||||
private final CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
||||
private final CommandExecutor partyKickCommand = new PartyKickCommand();
|
||||
private final CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
||||
private final CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||
private final CommandExecutor partyLockCommand = new PartyLockCommand();
|
||||
private final CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
|
||||
private final CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
||||
private final CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
||||
private final CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
||||
private final CommandExecutor partyTeleportCommand = new PtpCommand();
|
||||
private final CommandExecutor partyChatCommand = new PartyChatCommand();
|
||||
private final CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
@ -65,20 +69,20 @@ public class PartyCommand implements TabExecutor {
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (args.length < 1) {
|
||||
if (!mcMMO.getPartyManager().mmoPlayer.inParty()) {
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return printUsage(player);
|
||||
}
|
||||
@ -86,19 +90,21 @@ public class PartyCommand implements TabExecutor {
|
||||
return partyInfoCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
PartySubCommandType subcommand = PartySubCommandType.getSubcommand(args[0]);
|
||||
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
|
||||
|
||||
if (subcommand == null) {
|
||||
return printUsage(player);
|
||||
}
|
||||
|
||||
// Can't use this for lock/unlock since they're handled by the same command
|
||||
if (!Permissions.partySubcommand(sender, subcommand)) {
|
||||
if (subcommand != PartySubcommandType.LOCK && subcommand != PartySubcommandType.UNLOCK && !Permissions.partySubcommand(sender, subcommand)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (subcommand) {
|
||||
case JOIN:
|
||||
return partyJoinCommand.onCommand(sender, command, label, args);
|
||||
case ACCEPT:
|
||||
return partyAcceptCommand.onCommand(sender, command, label, args);
|
||||
case CREATE:
|
||||
@ -110,7 +116,7 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
// Party member commands
|
||||
if (!mmoPlayer.inParty()) {
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return printUsage(player);
|
||||
}
|
||||
@ -129,7 +135,7 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
// Party leader commands
|
||||
if (!mmoPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
if (!mcMMOPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
return true;
|
||||
}
|
||||
@ -137,14 +143,23 @@ public class PartyCommand implements TabExecutor {
|
||||
switch (subcommand) {
|
||||
case XPSHARE:
|
||||
return partyXpShareCommand.onCommand(sender, command, label, args);
|
||||
case ITEMSHARE:
|
||||
return partyItemShareCommand.onCommand(sender, command, label, args);
|
||||
case KICK:
|
||||
return partyKickCommand.onCommand(sender, command, label, args);
|
||||
case DISBAND:
|
||||
return partyDisbandCommand.onCommand(sender, command, label, args);
|
||||
case OWNER:
|
||||
return partyChangeOwnerCommand.onCommand(sender, command, label, args);
|
||||
case LOCK:
|
||||
case UNLOCK:
|
||||
return partyLockCommand.onCommand(sender, command, label, args);
|
||||
case PASSWORD:
|
||||
return partyChangePasswordCommand.onCommand(sender, command, label, args);
|
||||
case RENAME:
|
||||
return partyRenameCommand.onCommand(sender, command, label, args);
|
||||
case ALLIANCE:
|
||||
return partyAllianceCommand.onCommand(sender, command, label, args);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -158,7 +173,7 @@ public class PartyCommand implements TabExecutor {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], PARTY_SUBCOMMANDS, new ArrayList<>(PARTY_SUBCOMMANDS.size()));
|
||||
case 2:
|
||||
PartySubCommandType subcommand = PartySubCommandType.getSubcommand(args[0]);
|
||||
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
|
||||
|
||||
if (subcommand == null) {
|
||||
return ImmutableList.of();
|
||||
@ -187,13 +202,13 @@ public class PartyCommand implements TabExecutor {
|
||||
Player player = (Player) sender;
|
||||
|
||||
//Not Loaded
|
||||
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
Party party = mcMMO.getUserManager().queryPlayer(player).getParty();
|
||||
Party party = UserManager.getPlayer(player).getParty();
|
||||
|
||||
playerNames = party.getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||
@ -204,7 +219,7 @@ public class PartyCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
case 3:
|
||||
if (PartySubCommandType.getSubcommand(args[0]) == PartySubCommandType.ITEMSHARE && isItemShareCategory(args[1])) {
|
||||
if (PartySubcommandType.getSubcommand(args[0]) == PartySubcommandType.ITEMSHARE && isItemShareCategory(args[1])) {
|
||||
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,26 +17,25 @@ public class PartyCreateCommand implements CommandExecutor {
|
||||
case 2:
|
||||
case 3:
|
||||
Player player = (Player) sender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check to see if the party exists, and if it does cancel creating a new party
|
||||
if (mcMMO.getPartyManager().isParty(args[1])) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.AlreadyExists", args[1]));
|
||||
if (PartyManager.checkPartyExistence(player, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Changing parties
|
||||
if (!mcMMO.getPartyManager().changeOrJoinParty(mmoPlayer, args[1])) {
|
||||
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().createParty(mmoPlayer, args[1], getPassword(args));
|
||||
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args));
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -1,9 +1,10 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -14,23 +15,23 @@ public class PartyDisbandCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||
String partyName = playerParty.getPartyName();
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String partyName = playerParty.getName();
|
||||
|
||||
for (PartyMember member : playerParty.getPartyMembers()) {
|
||||
if (!mcMMO.getPartyManager().handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
member.sendMessage(LocaleLoader.getString("Party.Disband"));
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().disbandParty(playerParty);
|
||||
PartyManager.disbandParty(playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -21,19 +24,19 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
case 1:
|
||||
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
Party party = mmoPlayer.getParty();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
displayPartyHeader(player, party);
|
||||
displayShareModeInfo(player, party);
|
||||
displayPartyFeatures(player, party);
|
||||
displayMemberInfo(player, mmoPlayer, party);
|
||||
displayMemberInfo(player, mcMMOPlayer, party);
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -46,7 +49,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
|
||||
|
||||
StringBuilder status = new StringBuilder();
|
||||
status.append(LocaleLoader.getString("Commands.Party.Status", party.getPartyName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()));
|
||||
status.append(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()));
|
||||
|
||||
if (!party.hasReachedLevelCap()) {
|
||||
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
|
||||
@ -87,26 +90,42 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
|
||||
private void displayShareModeInfo(Player player, Party party) {
|
||||
boolean xpShareEnabled = isUnlockedFeature(party, PartyFeature.XP_SHARE);
|
||||
boolean itemShareEnabled = isUnlockedFeature(party, PartyFeature.ITEM_SHARE);
|
||||
boolean itemSharingActive = (party.getItemShareMode() != ShareMode.NONE);
|
||||
|
||||
if (!xpShareEnabled) {
|
||||
if (!xpShareEnabled && !itemShareEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
String expShareInfo = "";
|
||||
String itemShareInfo = "";
|
||||
String separator = "";
|
||||
|
||||
if (xpShareEnabled) {
|
||||
expShareInfo = LocaleLoader.getString("Commands.Party.ExpShare", party.getXpShareMode().toString());
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.ShareMode") + expShareInfo);
|
||||
if (itemShareEnabled) {
|
||||
itemShareInfo = LocaleLoader.getString("Commands.Party.ItemShare", party.getItemShareMode().toString());
|
||||
}
|
||||
|
||||
if (xpShareEnabled && itemShareEnabled) {
|
||||
separator = ChatColor.DARK_GRAY + " || ";
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.ShareMode") + expShareInfo + separator + itemShareInfo);
|
||||
|
||||
if (itemSharingActive) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.ItemShareCategories", party.getItemShareCategories()));
|
||||
}
|
||||
}
|
||||
|
||||
private void displayMemberInfo(Player player, OnlineMMOPlayer mmoPlayer, Party party) {
|
||||
private void displayMemberInfo(Player player, McMMOPlayer mcMMOPlayer, Party party) {
|
||||
/*
|
||||
* Only show members of the party that this member can see
|
||||
*/
|
||||
|
||||
List<Player> nearMembers = mcMMO.getPartyManager().getNearVisibleMembers(mmoPlayer);
|
||||
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
|
||||
int membersOnline = party.getVisibleMembers(player).size();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
||||
|
@ -1,11 +1,12 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -17,7 +18,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 2) {
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayer(targetName);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
@ -25,13 +26,13 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
String playerName = player.getName();
|
||||
|
||||
if (player.equals(target)) {
|
||||
@ -39,19 +40,19 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcMMO.getPartyManager().inSameParty(player, target)) {
|
||||
if (PartyManager.inSameParty(player, target)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcMMO.getPartyManager().canInvite(mmoPlayer)) {
|
||||
if (!PartyManager.canInvite(mcMMOPlayer)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Locked"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = mmoPlayer.getParty();
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
if (mcMMO.getPartyManager().isPartyFull(target, playerParty)) {
|
||||
if (PartyManager.isPartyFull(target, playerParty)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), Config.getInstance().getPartyMaxSize()));
|
||||
return true;
|
||||
}
|
||||
@ -59,7 +60,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
mcMMOTarget.setPartyInvite(playerParty);
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getPartyName(), playerName));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), playerName));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,88 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PartyJoinCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
case 3:
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
if (!mcMMOTarget.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party targetParty = mcMMOTarget.getParty();
|
||||
|
||||
if (player.equals(target) || (mcMMOPlayer.inParty() && mcMMOPlayer.getParty().equals(targetParty))) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Join.Self"));
|
||||
return true;
|
||||
}
|
||||
|
||||
String password = getPassword(args);
|
||||
|
||||
// Make sure party passwords match
|
||||
if (!PartyManager.checkPartyPassword(player, targetParty, password)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String partyName = targetParty.getName();
|
||||
|
||||
// Changing parties
|
||||
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, partyName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(PartyManager.isPartyFull(player, targetParty))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName));
|
||||
PartyManager.addToParty(mcMMOPlayer, targetParty);
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "join", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">", "[" + LocaleLoader.getString("Commands.Usage.Password") + "]"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private String getPassword(String[] args) {
|
||||
if (args.length == 3) {
|
||||
return args[2];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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.neetgames.mcmmo.party.Party;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -16,12 +18,12 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 2) {
|
||||
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
|
||||
if (!playerParty.hasMember(targetName)) {
|
||||
@ -33,17 +35,17 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
|
||||
if (target.isOnline()) {
|
||||
Player onlineTarget = target.getPlayer();
|
||||
String partyName = playerParty.getPartyName();
|
||||
String partyName = playerParty.getName();
|
||||
|
||||
if (!mcMMO.getPartyManager().handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().processPartyLeaving(mcMMO.getUserManager().queryPlayer(onlineTarget));
|
||||
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
|
||||
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().removeFromParty(target, playerParty);
|
||||
PartyManager.removeFromParty(target, playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,19 +18,19 @@ public class PartyQuitCommand implements CommandExecutor {
|
||||
if (args.length == 1) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (mcMMO.getUserManager().getPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(player);
|
||||
Party playerParty = mmoPlayer.getParty();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
if (!mcMMO.getPartyManager().handlePartyChangeEvent(player, playerParty.getPartyName(), null, EventReason.LEFT_PARTY)) {
|
||||
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getPartyManager().removeFromParty(mmoPlayer);
|
||||
PartyManager.removeFromParty(mcMMOPlayer);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
|
||||
return true;
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,15 +16,15 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 2) {
|
||||
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||
Party playerParty = mmoPlayer.getParty();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
String oldPartyName = playerParty.getPartyName();
|
||||
String oldPartyName = playerParty.getName();
|
||||
String newPartyName = args[1];
|
||||
|
||||
// This is to prevent party leaders from spamming other players with the rename message
|
||||
@ -32,27 +33,26 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = Misc.adaptPlayer(mmoPlayer);
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
// Check to see if the party exists, and if it does cancel renaming the party
|
||||
if (mcMMO.getPartyManager().isParty(newPartyName)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.AlreadyExists", newPartyName));
|
||||
if (PartyManager.checkPartyExistence(player, newPartyName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String leaderName = playerParty.getLeader().getPlayerName();
|
||||
|
||||
for (PartyMember partyMember : playerParty.getPartyMembers()) {
|
||||
if (!mcMMO.getPartyManager().handlePartyChangeEvent(partyMember, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!partyMember.getName().equalsIgnoreCase(leaderName)) {
|
||||
partyMember.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
|
||||
if (!member.getName().equalsIgnoreCase(leaderName)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
|
||||
}
|
||||
}
|
||||
|
||||
playerParty.setPartyName(newPartyName);
|
||||
playerParty.setName(newPartyName);
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Rename", newPartyName));
|
||||
return true;
|
||||
|
@ -1,12 +1,13 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -16,13 +17,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class PartyXpShareCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
||||
@ -49,7 +50,7 @@ public class PartyXpShareCommand implements CommandExecutor {
|
||||
|
||||
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Xp"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
|
||||
|
||||
for (Player member : party.getPartyMembers()) {
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(changeModeMessage);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,12 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PtpAcceptAnyCommand implements CommandExecutor {
|
||||
@ -21,36 +17,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(sender instanceof ConsoleCommandSender)
|
||||
return false;
|
||||
|
||||
Player playerSender = (Player) sender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerSender);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
playerSender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||
return false;
|
||||
}
|
||||
|
||||
Party party = mcMMO.getPartyManager().getParty(playerSender);
|
||||
if(party == null) {
|
||||
//TODO: Localize error message
|
||||
playerSender.sendMessage("You don't have a party!");
|
||||
return false;
|
||||
}
|
||||
|
||||
PartyMember partyMember = party.getPartyMember(playerSender.getUniqueId());
|
||||
|
||||
if(partyMember == null) {
|
||||
mcMMO.p.getLogger().severe("PartyMember ref didn't exist for player named "+playerSender.getName() + ", this should never happen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
PartyTeleportRecord ptpRecord = partyMember.getPartyTeleportRecord();
|
||||
|
||||
if(ptpRecord == null) {
|
||||
|
||||
}
|
||||
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
|
||||
|
||||
if (ptpRecord.isConfirmRequired()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -20,21 +21,21 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().queryPlayer(player).getPartyTeleportRecord();
|
||||
PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord();
|
||||
|
||||
if (!ptpRecord.hasRequest()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rootSkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
|
||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
|
||||
ptpRecord.removeRequest();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
||||
return true;
|
||||
|
@ -2,22 +2,23 @@ package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.party.PartyFeature;
|
||||
import com.gmail.nossr50.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
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.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -56,24 +57,24 @@ public class PtpCommand implements TabExecutor {
|
||||
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
||||
return true;
|
||||
|
||||
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (!mmoPlayer.inParty()) {
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = mmoPlayer.getParty();
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
||||
@ -89,7 +90,7 @@ public class PtpCommand implements TabExecutor {
|
||||
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
long recentlyHurt = mmoPlayer.getRecentlyHurtTimestamp();
|
||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||
|
||||
if (hurtCooldown > 0) {
|
||||
@ -111,7 +112,7 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
||||
long ptpLastUse = mmoPlayer.getPartyTeleportRecord().getLastUse();
|
||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||
|
||||
if (ptpCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
|
||||
@ -134,19 +135,19 @@ public class PtpCommand implements TabExecutor {
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (!mmoPlayer.inParty()) {
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
List<String> playerNames = mmoPlayer.getParty().getOnlinePlayerNames(player);
|
||||
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||
}
|
||||
|
||||
@ -160,7 +161,7 @@ public class PtpCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().getPlayer(targetName);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
|
||||
@ -197,7 +198,7 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
||||
OnlineMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayer(targetName);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return false;
|
||||
@ -210,7 +211,7 @@ public class PtpCommand implements TabExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mcMMO.getPartyManager().inSameParty(player, target)) {
|
||||
if (!PartyManager.inSameParty(player, target)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return false;
|
||||
}
|
||||
@ -229,29 +230,28 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
||||
if(mcMMO.getUserManager().queryPlayer(targetPlayer) == null) {
|
||||
if(UserManager.getPlayer(targetPlayer) == null)
|
||||
{
|
||||
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(mcMMO.getUserManager().queryPlayer(teleportingPlayer) == null) {
|
||||
if(UserManager.getPlayer(teleportingPlayer) == null)
|
||||
{
|
||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(teleportingPlayer);
|
||||
McMMOPlayer mmoTargetPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(targetPlayer);
|
||||
|
||||
if(mmoPlayer == null || mmoTargetPlayer == null)
|
||||
return;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
|
||||
|
||||
long warmup = Config.getInstance().getPTPCommandWarmup();
|
||||
|
||||
mmoPlayer.actualizeTeleportCommenceLocation();
|
||||
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
||||
|
||||
if (warmup > 0) {
|
||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||
new TeleportationWarmup(mmoPlayer, mmoTargetPlayer).runTaskLater(mcMMO.p, 20 * warmup);
|
||||
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
|
||||
}
|
||||
else {
|
||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -17,8 +17,7 @@ public class PtpToggleCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().queryPlayer(player)
|
||||
.getPartyTeleportRecord();
|
||||
PartyTeleportRecord ptpRecord = UserManager.getPlayer(sender.getName()).getPartyTeleportRecord();
|
||||
|
||||
if (ptpRecord.isEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||
|
@ -1,12 +1,13 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -37,12 +38,12 @@ public class MccooldownCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
if (mcMMO.getUserManager().getPlayer(player) == null) {
|
||||
if (UserManager.getPlayer(player) == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
@ -52,7 +53,7 @@ public class MccooldownCommand implements TabExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
int seconds = mmoPlayer.getCooldownSeconds(ability);
|
||||
int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
|
||||
|
||||
if (seconds <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getLocalizedName()));
|
||||
|
@ -1,13 +1,14 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -52,10 +53,10 @@ public class McrankCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
if (mmoPlayer != null) {
|
||||
Player player = Misc.adaptPlayer(mmoPlayer);
|
||||
if (mcMMOPlayer != null) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
playerName = player.getName();
|
||||
|
||||
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
||||
@ -82,9 +83,9 @@ public class McrankCommand implements TabExecutor {
|
||||
|
||||
private void display(CommandSender sender, String playerName) {
|
||||
if (sender instanceof Player) {
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
|
||||
if(mmoPlayer == null)
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return;
|
||||
@ -92,8 +93,8 @@ public class McrankCommand implements TabExecutor {
|
||||
|
||||
long cooldownMillis = Math.min(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mmoPlayer.getDatabaseCommandATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mmoPlayer, cooldownMillis)));
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -104,7 +105,7 @@ public class McrankCommand implements TabExecutor {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mmoPlayer.actualizeDatabaseCommandATS();
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
boolean useBoard = Config.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
|
||||
@ -113,7 +114,7 @@ public class McrankCommand implements TabExecutor {
|
||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private long getCDSeconds(OnlineMMOPlayer mmoPlayer, long cooldownMillis) {
|
||||
return ((mmoPlayer.getDatabaseCommandATS() + cooldownMillis) - System.currentTimeMillis());
|
||||
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
||||
return ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,10 @@ package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -27,14 +26,12 @@ public class McstatsCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (mcMMO.getUserManager().queryPlayer(player) == null) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (Config.getInstance().getStatsUseBoard() && Config.getInstance().getScoreboardsEnabled()) {
|
||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||
@ -54,9 +51,9 @@ public class McstatsCommand implements TabExecutor {
|
||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
||||
|
||||
if (powerLevelCap != Integer.MAX_VALUE) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", mmoPlayer.getPowerLevel(), powerLevelCap));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mmoPlayer.getPowerLevel()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2,15 +2,15 @@ package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -25,26 +25,26 @@ import java.util.List;
|
||||
public class MctopCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
RootSkill rootSkill = null;
|
||||
PrimarySkillType skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
display(1, rootSkill, sender, command);
|
||||
display(1, skill, sender, command);
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (StringUtils.isInt(args[0])) {
|
||||
display(Math.abs(Integer.parseInt(args[0])), rootSkill, sender, command);
|
||||
display(Math.abs(Integer.parseInt(args[0])), skill, sender, command);
|
||||
return true;
|
||||
}
|
||||
|
||||
rootSkill = extractSkill(sender, args[0]);
|
||||
skill = extractSkill(sender, args[0]);
|
||||
|
||||
if (rootSkill == null) {
|
||||
if (skill == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
display(1, rootSkill, sender, command);
|
||||
display(1, skill, sender, command);
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
@ -52,13 +52,13 @@ public class MctopCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
rootSkill = extractSkill(sender, args[0]);
|
||||
skill = extractSkill(sender, args[0]);
|
||||
|
||||
if (rootSkill == null) {
|
||||
if (skill == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
display(Math.abs(Integer.parseInt(args[1])), rootSkill, sender, command);
|
||||
display(Math.abs(Integer.parseInt(args[1])), skill, sender, command);
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -74,8 +74,8 @@ public class MctopCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender, @NotNull Command command) {
|
||||
if (rootSkill != null && !Permissions.mctop(sender, PrimarySkillType.getSkill(rootSkill))) {
|
||||
private void display(int page, PrimarySkillType skill, CommandSender sender, Command command) {
|
||||
if (skill != null && !Permissions.mctop(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
@ -85,13 +85,11 @@ public class MctopCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mmoPlayer.getDatabaseCommandATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
double seconds = ((mmoPlayer.getDatabaseCommandATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
|
||||
if (seconds < 1) {
|
||||
seconds = 1;
|
||||
}
|
||||
@ -107,17 +105,17 @@ public class MctopCommand implements TabExecutor {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mmoPlayer.actualizeDatabaseCommandATS();
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
display(page, rootSkill, sender);
|
||||
display(page, skill, sender);
|
||||
}
|
||||
|
||||
private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender) {
|
||||
private void display(int page, PrimarySkillType skill, CommandSender sender) {
|
||||
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
|
||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
||||
|
||||
new MctopCommandAsyncTask(page, rootSkill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||
@ -125,7 +123,7 @@ public class MctopCommand implements TabExecutor {
|
||||
return null;
|
||||
}
|
||||
|
||||
RootSkill rootSkill = mcMMO.p.getSkillRegister().getSkill(rootSkillName);
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(skillName);
|
||||
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -21,9 +24,9 @@ public class XPBarCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if(sender instanceof Player) {
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer((Player) sender);
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
|
||||
if(mmoPlayer == null) {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(Misc.adaptPlayer(mmoPlayer), "Profile.PendingLoad");
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -32,29 +35,29 @@ public class XPBarCommand implements TabExecutor {
|
||||
} else if(args.length < 2) {
|
||||
String option = args[0];
|
||||
|
||||
if(option.equalsIgnoreCase(rootSkillBossBarSetting.RESET.toString())) {
|
||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(rootSkillBossBarSetting.RESET, null);
|
||||
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
|
||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
|
||||
return true;
|
||||
} else if(option.equalsIgnoreCase(rootSkillBossBarSetting.DISABLE.toString())) {
|
||||
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
|
||||
mmoPlayer.getExperienceBarManager().disableAllBars();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Per rootSkillSettings path
|
||||
//Per skill Settings path
|
||||
} else if (args.length == 2) {
|
||||
String skillName = args[1];
|
||||
|
||||
if(rootSkillUtils.isSkill(rootSkillName)) {
|
||||
if(SkillUtils.isSkill(skillName)) {
|
||||
|
||||
PrimarySkillType targetSkill = mcMMO.p.getSkillRegister().getSkill(rootSkillName);
|
||||
PrimarySkillType targetSkill = PrimarySkillType.getSkill(skillName);
|
||||
|
||||
//Target setting
|
||||
String option = args[0].toLowerCase();
|
||||
|
||||
SkillBossBarSetting settingTarget = getSettingTarget(option);
|
||||
if(settingTarget != null && settingTarget != SkillBossBarSetting.RESET) {
|
||||
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
|
||||
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
|
||||
//Change setting
|
||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
|
||||
return true;
|
||||
@ -72,16 +75,16 @@ public class XPBarCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable SkillBossBarSetting getSettingTarget(String string) {
|
||||
private @Nullable ExperienceBarManager.XPBarSettingTarget getSettingTarget(String string) {
|
||||
switch (string.toLowerCase()) {
|
||||
case "hide":
|
||||
return SkillBossBarSetting.HIDE;
|
||||
return ExperienceBarManager.XPBarSettingTarget.HIDE;
|
||||
case "show":
|
||||
return SkillBossBarSetting.SHOW;
|
||||
return ExperienceBarManager.XPBarSettingTarget.SHOW;
|
||||
case "reset":
|
||||
return SkillBossBarSetting.RESET;
|
||||
return ExperienceBarManager.XPBarSettingTarget.RESET;
|
||||
case "disable":
|
||||
return SkillBossBarSetting.DISABLE;
|
||||
return ExperienceBarManager.XPBarSettingTarget.DISABLE;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -93,13 +96,13 @@ public class XPBarCommand implements TabExecutor {
|
||||
case 1:
|
||||
List<String> options = new ArrayList<>();
|
||||
|
||||
for(rootSkillBossBarSetting settingTarget : SkillBossBarSetting.values()) {
|
||||
for(ExperienceBarManager.XPBarSettingTarget settingTarget : ExperienceBarManager.XPBarSettingTarget.values()) {
|
||||
options.add(StringUtils.getCapitalized(settingTarget.toString()));
|
||||
}
|
||||
|
||||
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(rootSkillBossBarSetting.values().length));
|
||||
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
|
||||
case 2:
|
||||
if(!args[0].equalsIgnoreCase(rootSkillBossBarSetting.RESET.toString()))
|
||||
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This command facilitates switching the rootSkillsystem scale between classic and modern scale
|
||||
* This command facilitates switching the skill system scale between classic and modern scale
|
||||
*/
|
||||
public class Mcmmoupgrade implements CommandExecutor {
|
||||
@Override
|
||||
|
@ -1,18 +1,16 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -29,23 +27,23 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ACROBATICS_DODGE
|
||||
if (canDodge) {
|
||||
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ACROBATICS_DODGE);
|
||||
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE);
|
||||
dodgeChance = dodgeStrings[0];
|
||||
dodgeChanceLucky = dodgeStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canDodge = canUseSubskill(mmoPlayer, SubSkillType.ACROBATICS_DODGE);
|
||||
canRoll = canUseSubskill(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
|
||||
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canDodge) {
|
||||
@ -62,10 +60,10 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
double rollChance, graceChance;
|
||||
|
||||
//Chance to roll at half
|
||||
RandomChanceSkill roll_rcs = new RandomChanceSkill(Misc.adaptPlayer(mmoPlayer), SubSkillType.ACROBATICS_ROLL);
|
||||
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Chance to graceful roll
|
||||
RandomChanceSkill grace_rcs = new RandomChanceSkill(Misc.adaptPlayer(mmoPlayer), SubSkillType.ACROBATICS_ROLL);
|
||||
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
|
||||
|
||||
//Chance Stat Calculations
|
||||
@ -73,7 +71,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||
|
||||
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
||||
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Format
|
||||
double rollChanceLucky = rollChance * 1.333D;
|
||||
@ -91,10 +89,10 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ACROBATICS);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -32,23 +29,18 @@ public class AlchemyCommand extends SkillCommand {
|
||||
super(PrimarySkillType.ALCHEMY);
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(@NotNull Player player) {
|
||||
protected String[] calculateAbilityDisplayValues(Player player) {
|
||||
//TODO: Needed?
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
if(mmoPlayer == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return new String[] {"DATA NOT LOADED", "DATA NOT LOADED"};
|
||||
}
|
||||
|
||||
return calculateAbilityDisplayValues(mmoPlayer);
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
AlchemyManager alchemyManager = ((McMMOPlayer) (mmoPlayer)).getAlchemyManager();
|
||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||
String[] displayValues = new String[2];
|
||||
|
||||
boolean isLucky = Permissions.lucky(Misc.adaptPlayer(mmoPlayer), PrimarySkillType.ALCHEMY);
|
||||
boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);
|
||||
|
||||
displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";
|
||||
displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;
|
||||
@ -56,19 +48,18 @@ public class AlchemyCommand extends SkillCommand {
|
||||
return displayValues;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ALCHEMY_CATALYSIS
|
||||
if (canCatalysis) {
|
||||
String[] catalysisStrings = calculateAbilityDisplayValues(mmoPlayer.getPlayer());
|
||||
String[] catalysisStrings = calculateAbilityDisplayValues(player);
|
||||
brewSpeed = catalysisStrings[0];
|
||||
brewSpeedLucky = catalysisStrings[1];
|
||||
}
|
||||
|
||||
// ALCHEMY_CONCOCTIONS
|
||||
if (canConcoctions) {
|
||||
AlchemyManager alchemyManager = mmoPlayer.getAlchemyManager();
|
||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||
tier = alchemyManager.getTier();
|
||||
ingredientCount = alchemyManager.getIngredients().size();
|
||||
ingredientList = alchemyManager.getIngredientList();
|
||||
@ -76,13 +67,13 @@ public class AlchemyCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canCatalysis = canUseSubskill(mmoPlayer, SubSkillType.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = canUseSubskill(mmoPlayer, SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canCatalysis) {
|
||||
@ -102,10 +93,10 @@ public class AlchemyCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ALCHEMY);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class AprilCommand implements TabExecutor {
|
||||
|
||||
if (args.length == 0) {
|
||||
Player player = (Player) sender;
|
||||
FakeSkillType fakeSkillType = FakeSkillType.getByName(rootSkillName);
|
||||
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
|
||||
|
||||
float skillValue = Misc.getRandom().nextInt(99);
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -29,36 +29,36 @@ public class ArcheryCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ARCHERY_ARROW_RETRIEVAL
|
||||
if (canRetrieve) {
|
||||
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
retrieveChance = retrieveStrings[0];
|
||||
retrieveChanceLucky = retrieveStrings[1];
|
||||
}
|
||||
|
||||
// ARCHERY_DAZE
|
||||
if (canDaze) {
|
||||
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.ARCHERY_DAZE);
|
||||
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE);
|
||||
dazeChance = dazeStrings[0];
|
||||
dazeChanceLucky = dazeStrings[1];
|
||||
}
|
||||
|
||||
// rootSkillSHOT
|
||||
// SKILL SHOT
|
||||
if (canSkillShot) {
|
||||
skillShotBonus = percent.format(Archery.getDamageBonusPercent(mmoPlayer));
|
||||
skillShotBonus = percent.format(Archery.getDamageBonusPercent(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canSkillShot = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
canDaze = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_DAZE);
|
||||
canRetrieve = canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE);
|
||||
canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canRetrieve) {
|
||||
@ -75,19 +75,19 @@ public class ArcheryCommand extends SkillCommand {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||
if(canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.ARCHERY);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.axes.Axes;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -34,43 +35,43 @@ public class AxesCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ARMOR IMPACT
|
||||
if (canImpact) {
|
||||
impactDamage = ((McMMOPlayer) (mmoPlayer)).getArcheryManager().getImpactDurabilityDamage();
|
||||
impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage();
|
||||
}
|
||||
|
||||
// AXE MASTERY
|
||||
if (canAxeMastery) {
|
||||
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(mmoPlayer.getPlayer());
|
||||
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player);
|
||||
}
|
||||
|
||||
// CRITICAL HIT
|
||||
if (canCritical) {
|
||||
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
critChance = criticalHitStrings[0];
|
||||
critChanceLucky = criticalHitStrings[1];
|
||||
}
|
||||
|
||||
// SKULL SPLITTER
|
||||
if (canSkullSplitter) {
|
||||
String[] skullSplitterStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
skullSplitterLength = skullSplitterStrings[0];
|
||||
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canSkullSplitter = Permissions.skullSplitter(mmoPlayer.getPlayer()) && RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canCritical = canUseSubskill(mmoPlayer, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = canUseSubskill(mmoPlayer, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = canUseSubskill(mmoPlayer, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = canUseSubskill(mmoPlayer, SubSkillType.AXES_GREATER_IMPACT);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canImpact) {
|
||||
@ -95,19 +96,19 @@ public class AxesCommand extends SkillCommand {
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||
if(canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.AXES);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,16 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -27,26 +26,26 @@ public class ExcavationCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// GIGA DRILL BREAKER
|
||||
if (canGigaDrill) {
|
||||
String[] gigaDrillStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
gigaDrillBreakerLength = gigaDrillStrings[0];
|
||||
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(mmoPlayer.getPlayer()) && RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canTreasureHunt = canUseSubskill(mmoPlayer, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
ExcavationManager excavationManager = ((McMMOPlayer) (mmoPlayer)).getExcavationManager();
|
||||
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();
|
||||
|
||||
if (canGigaDrill) {
|
||||
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
||||
@ -55,7 +54,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||
if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
||||
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||
@ -67,10 +66,10 @@ public class ExcavationCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.EXCAVATION);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -47,8 +47,8 @@ public class FishingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
FishingManager fishingManager = ((McMMOPlayer) (mmoPlayer)).getFishingManager();
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
// TREASURE HUNTER
|
||||
if (canTreasureHunt) {
|
||||
@ -79,35 +79,35 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
// FISHING_SHAKE
|
||||
if (canShake) {
|
||||
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(mmoPlayer, PrimarySkillType.FISHING, fishingManager.getShakeChance());
|
||||
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(player, PrimarySkillType.FISHING, fishingManager.getShakeChance());
|
||||
shakeChance = shakeStrings[0];
|
||||
shakeChanceLucky = shakeStrings[1];
|
||||
}
|
||||
|
||||
// FISHERMAN'S DIET
|
||||
if (canFishermansDiet) {
|
||||
fishermansDietRank = RankUtils.getRank(mmoPlayer, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
fishermansDietRank = RankUtils.getRank(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
}
|
||||
|
||||
// MASTER ANGLER
|
||||
if (canMasterAngler) {
|
||||
maMinWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMinWaitReduction(RankUtils.getRank(mmoPlayer, SubSkillType.FISHING_MASTER_ANGLER), false));
|
||||
maMaxWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMaxWaitReduction(RankUtils.getRank(mmoPlayer, SubSkillType.FISHING_MASTER_ANGLER), false, 0));
|
||||
maMinWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMinWaitReduction(RankUtils.getRank(player, SubSkillType.FISHING_MASTER_ANGLER), false));
|
||||
maMaxWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMaxWaitReduction(RankUtils.getRank(player, SubSkillType.FISHING_MASTER_ANGLER), false, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canTreasureHunt = canUseSubskill(mmoPlayer, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = canUseSubskill(mmoPlayer, SubSkillType.FISHING_MAGIC_HUNTER) && canUseSubskill(mmoPlayer, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canShake = canUseSubskill(mmoPlayer, SubSkillType.FISHING_SHAKE);
|
||||
canFishermansDiet = canUseSubskill(mmoPlayer, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && canUseSubskill(mmoPlayer, SubSkillType.FISHING_MASTER_ANGLER);
|
||||
canIceFish = canUseSubskill(mmoPlayer, SubSkillType.FISHING_ICE_FISHING);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = canUseSubskill(player, SubSkillType.FISHING_MAGIC_HUNTER) && canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canShake = canUseSubskill(player, SubSkillType.FISHING_SHAKE);
|
||||
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
|
||||
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canFishermansDiet) {
|
||||
@ -152,10 +152,10 @@ public class FishingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.FISHING);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -43,74 +41,64 @@ public class HerbalismCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
// FARMERS DIET
|
||||
if (canFarmersDiet) {
|
||||
farmersDietRank = RankUtils.getRank(mmoPlayer, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
farmersDietRank = RankUtils.getRank(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
}
|
||||
|
||||
// GREEN TERRA
|
||||
if (canGreenTerra) {
|
||||
String[] greenTerraStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] greenTerraStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
greenTerraLength = greenTerraStrings[0];
|
||||
greenTerraLengthEndurance = greenTerraStrings[1];
|
||||
}
|
||||
|
||||
// GREEN THUMB
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
greenThumbStage = RankUtils.getRank(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
|
||||
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbChance = greenThumbStrings[0];
|
||||
greenThumbChanceLucky = greenThumbStrings[1];
|
||||
}
|
||||
|
||||
// HYLIAN LUCK
|
||||
if (hasHylianLuck) {
|
||||
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
hylianLuckChance = hylianLuckStrings[0];
|
||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||
}
|
||||
|
||||
// SHROOM THUMB
|
||||
if (canShroomThumb) {
|
||||
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
shroomThumbChance = shroomThumbStrings[0];
|
||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
hasHylianLuck = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(mmoPlayer.getPlayer());
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB)
|
||||
&& (Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.WHEAT)
|
||||
|| Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.CARROT)
|
||||
|| Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.POTATO)
|
||||
|| Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.BEETROOT)
|
||||
|| Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.NETHER_WART)
|
||||
|| Permissions.greenThumbPlant(Misc.adaptPlayer(mmoPlayer), Material.COCOA));
|
||||
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.HERBALISM_GREEN_THUMB)
|
||||
&& (Permissions.greenThumbBlock(Misc.adaptPlayer(mmoPlayer), Material.DIRT)
|
||||
|| Permissions.greenThumbBlock(Misc.adaptPlayer(mmoPlayer), Material.COBBLESTONE)
|
||||
|| Permissions.greenThumbBlock(Misc.adaptPlayer(mmoPlayer), Material.COBBLESTONE_WALL)
|
||||
|| Permissions.greenThumbBlock(Misc.adaptPlayer(mmoPlayer), Material.STONE_BRICKS));
|
||||
canFarmersDiet = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_DOUBLE_DROPS) && !rootSkill.getDoubleDropsDisabled();
|
||||
canShroomThumb = canUseSubskill(mmoPlayer, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
protected void permissionsCheck(Player player) {
|
||||
hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
|
||||
canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canDoubleDrop) {
|
||||
@ -153,10 +141,10 @@ public class HerbalismCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.HERBALISM);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -38,10 +39,10 @@ public class MiningCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// BLAST MINING
|
||||
if (canBlast || canDemoExpert || canBiggerBombs) {
|
||||
MiningManager miningManager = ((McMMOPlayer) (mmoPlayer)).getMiningManager();
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
|
||||
blastMiningRank = miningManager.getBlastMiningTier();
|
||||
bonusTNTDrops = miningManager.getDropMultiplier();
|
||||
@ -53,30 +54,30 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
// SUPER BREAKER
|
||||
if (canSuperBreaker) {
|
||||
String[] superBreakerStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] superBreakerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
superBreakerLength = superBreakerStrings[0];
|
||||
superBreakerLengthEndurance = superBreakerStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(mmoPlayer.getPlayer());
|
||||
canBlast = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(mmoPlayer.getPlayer());
|
||||
canDemoExpert = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(mmoPlayer.getPlayer());
|
||||
canDoubleDrop = canUseSubskill(mmoPlayer, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(mmoPlayer.getPlayer());
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canBiggerBombs) {
|
||||
@ -110,10 +111,10 @@ public class MiningCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.MINING);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
@ -37,13 +34,6 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
return false;
|
||||
|
||||
Player player = (Player) commandSender;
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(Permissions.mmoinfo(player))
|
||||
{
|
||||
if(args == null || args[0] == null)
|
||||
@ -58,7 +48,7 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
return true;
|
||||
} else if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0]))
|
||||
{
|
||||
displayInfo(mmoPlayer, args[0]);
|
||||
displayInfo(player, args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -79,21 +69,19 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
private void displayInfo(@NotNull OnlineMMOPlayer mmoPlayer, String subSkillName)
|
||||
private void displayInfo(Player player, String subSkillName)
|
||||
{
|
||||
//Check to see if the rootSkillexists in the new system
|
||||
//Check to see if the skill exists in the new system
|
||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
|
||||
if(abstractSubSkill != null)
|
||||
{
|
||||
/* New System Skills are programmable */
|
||||
abstractSubSkill.printInfo(mmoPlayer.getPlayer());
|
||||
abstractSubSkill.printInfo(player);
|
||||
//TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
} else {
|
||||
/*
|
||||
* rootSkillis only in the old system
|
||||
* Skill is only in the old system
|
||||
*/
|
||||
Player player = Misc.adaptPlayer(mmoPlayer);
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
@ -107,6 +95,6 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
//Send Player Wiki Link
|
||||
TextComponentFactory.sendPlayerSubSkillWikiLink(mmoPlayer, subSkillName);
|
||||
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -9,13 +10,13 @@ import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -47,7 +48,7 @@ public class RepairCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
||||
@ -67,37 +68,37 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
// SUPER REPAIR
|
||||
if (canSuperRepair) {
|
||||
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
superRepairChance = superRepairStrings[0];
|
||||
superRepairChanceLucky = superRepairStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canSuperRepair = canUseSubskill(mmoPlayer, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = canUseSubskill(mmoPlayer, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = canUseSubskill(mmoPlayer, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(Misc.adaptPlayer(mmoPlayer), MaterialType.WOOD);
|
||||
arcaneBypass = (Permissions.arcaneBypass(mmoPlayer.getPlayer()) || Permissions.hasRepairEnchantBypassPerk(mmoPlayer.getPlayer()));
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||
arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canArcaneForge) {
|
||||
RepairManager repairManager = ((McMMOPlayer) (mmoPlayer)).getRepairManager();
|
||||
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
|
||||
|
||||
messages.add(getStatMessage(false, true,
|
||||
SubSkillType.REPAIR_ARCANE_FORGING,
|
||||
String.valueOf(RankUtils.getRank(mmoPlayer, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||
|
||||
if (ArcaneForging.arcaneForgingEnchantLoss || ArcaneForging.arcaneForgingDowngrades) {
|
||||
@ -120,10 +121,10 @@ public class RepairCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.REPAIR);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -22,26 +23,26 @@ public class SalvageCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canScrapCollector = canUseSubskill(mmoPlayer, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
|
||||
canArcaneSalvage = canUseSubskill(mmoPlayer, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canScrapCollector = canUseSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
|
||||
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
SalvageManager salvageManager = ((McMMOPlayer) (mmoPlayer)).getSalvageManager();
|
||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||
|
||||
if (canScrapCollector) {
|
||||
messages.add(getStatMessage(false, true,
|
||||
SubSkillType.SALVAGE_SCRAP_COLLECTOR,
|
||||
String.valueOf(RankUtils.getRank(mmoPlayer, SubSkillType.SALVAGE_SCRAP_COLLECTOR)),
|
||||
String.valueOf(RankUtils.getRank(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)),
|
||||
RankUtils.getHighestRankStr(SubSkillType.SALVAGE_SCRAP_COLLECTOR)));
|
||||
}
|
||||
|
||||
@ -63,10 +64,10 @@ public class SalvageCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SALVAGE);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -2,15 +2,15 @@ package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
@ -19,8 +19,6 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -37,8 +35,7 @@ import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class SkillCommand implements TabExecutor {
|
||||
protected @NotNull RootSkill rootSkill;
|
||||
protected @NotNull RootSkill rootSkill;
|
||||
protected PrimarySkillType skill;
|
||||
private final String skillName;
|
||||
|
||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
@ -46,11 +43,10 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
private final CommandExecutor skillGuideCommand;
|
||||
|
||||
public SkillCommand(@NotNull RootSkill rootSkill) {
|
||||
this.rootSkill = PrimarySkillType.getSkill(primarySkillType);
|
||||
this.primarySkillType = primarySkillType;
|
||||
skillName = rootSkill.getName();
|
||||
skillGuideCommand = new SkillGuideCommand(rootSkill);
|
||||
public SkillCommand(PrimarySkillType skill) {
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,33 +59,33 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
Player player = Misc.adaptPlayer(mmoPlayer);
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, rootSkill);
|
||||
boolean isLucky = Permissions.lucky(player, skill);
|
||||
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
|
||||
float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(rootSkill);
|
||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the rootSkillcommand easier
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
||||
for (int i = 0; i < 2; i++) {
|
||||
player.sendMessage("");
|
||||
}
|
||||
|
||||
permissionsCheck(mmoPlayer);
|
||||
dataCalculations(mmoPlayer, skillValue);
|
||||
permissionsCheck(player);
|
||||
dataCalculations(player, skillValue);
|
||||
|
||||
sendSkillCommandHeader(mmoPlayer, (int) skillValue);
|
||||
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
||||
|
||||
//Make JSON text components
|
||||
List<Component> subskillTextComponents = getTextComponents(mmoPlayer);
|
||||
List<Component> subskillTextComponents = getTextComponents(player);
|
||||
|
||||
//Subskills Header
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul")));
|
||||
@ -104,7 +100,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}*/
|
||||
|
||||
//Stats
|
||||
sendStatMessages(mmoPlayer, isLucky, hasEndurance, skillValue);
|
||||
getStatMessages(player, isLucky, hasEndurance, skillValue);
|
||||
|
||||
//Header
|
||||
|
||||
@ -112,12 +108,12 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
//Link Header
|
||||
if (Config.getInstance().getUrlLinksEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
||||
TextComponentFactory.sendPlayerUrlHeader(mmoPlayer);
|
||||
TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
}
|
||||
|
||||
|
||||
if (Config.getInstance().getScoreboardsEnabled() && Config.getInstance().getSkillUseBoard()) {
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, primarySkillType);
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -125,39 +121,39 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return skillGuideCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
private void sendStatMessages(@NotNull OnlineMMOPlayer mmoPlayer, boolean isLucky, boolean hasEndurance, float skillValue) {
|
||||
List<String> statsMessages = statsDisplay(mmoPlayer, skillValue, hasEndurance, isLucky);
|
||||
private void getStatMessages(Player player, boolean isLucky, boolean hasEndurance, float skillValue) {
|
||||
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
|
||||
|
||||
if (!statsMessages.isEmpty()) {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Commands.Stats.Self.Overhaul")));
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Commands.Stats.Self.Overhaul")));
|
||||
|
||||
for (String message : statsMessages) {
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(message);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH)));
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
private void sendSkillCommandHeader(@NotNull OnlineMMOPlayer mmoPlayer, int skillValue) {
|
||||
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
|
||||
ChatColor hd1 = ChatColor.DARK_AQUA;
|
||||
ChatColor c1 = ChatColor.GOLD;
|
||||
ChatColor c2 = ChatColor.RED;
|
||||
|
||||
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||
|
||||
if(!PrimarySkillType.isChildSkill(rootSkill))
|
||||
if(!skill.isChildSkill())
|
||||
{
|
||||
/*
|
||||
* NON-CHILD SKILLS
|
||||
*/
|
||||
|
||||
//XP GAIN METHOD
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(rootSkill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
|
||||
//LEVEL
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mmoPlayer.getExperienceHandler().getSkillXpValue(rootSkill), mmoPlayer.getExperienceHandler().getExperienceToNextLevel(rootSkill)));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
|
||||
} else {
|
||||
/*
|
||||
@ -165,11 +161,11 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
*/
|
||||
|
||||
|
||||
Set<RootSkill> parents = FamilyTree.getParentSkills(rootSkill);
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
//TODO: Add JSON here
|
||||
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mmoPlayer.getSkillLevel(parent), mmoPlayer.getSkillXpLevel(parent), mmoPlayer.getXpToLevel(parent)))*/
|
||||
ArrayList<RootSkill> parentList = new ArrayList<>(parents);
|
||||
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
|
||||
ArrayList<PrimarySkillType> parentList = new ArrayList<>(parents);
|
||||
|
||||
StringBuilder parentMessage = new StringBuilder();
|
||||
|
||||
@ -185,15 +181,35 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
//XP GAIN METHOD
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString()));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString()));
|
||||
//LEVEL
|
||||
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
|
||||
|
||||
}
|
||||
/*
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (PrimarySkillType parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
if (args.length == 1) {
|
||||
return ImmutableList.of("?");
|
||||
}
|
||||
@ -204,12 +220,12 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
|
||||
}
|
||||
|
||||
protected @NotNull String[] getAbilityDisplayValues(@NotNull SkillActivationType skillActivationType, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull SubSkillType subSkill) {
|
||||
return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType, Misc.adaptPlayer(mmoPlayer), subSkill);
|
||||
protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
|
||||
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
|
||||
}
|
||||
|
||||
protected @NotNull String[] calculateLengthDisplayValues(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
int maxLength = PrimarySkillType.getSuperAbilityType().getMaxLength();
|
||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||
int maxLength = skill.getAbility().getMaxLength();
|
||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
||||
|
||||
@ -217,13 +233,13 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
if(abilityLengthCap <= 0)
|
||||
{
|
||||
length = 2 + (int) (rootSkillValue / abilityLengthVar);
|
||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||
}
|
||||
else {
|
||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||
}
|
||||
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(Misc.adaptPlayer(mmoPlayer), length, maxLength);
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
|
||||
|
||||
if (maxLength != 0) {
|
||||
length = Math.min(length, maxLength);
|
||||
@ -232,12 +248,12 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
||||
}
|
||||
|
||||
protected @NotNull String getStatMessage(SubSkillType subSkillType, String... vars)
|
||||
protected String getStatMessage(SubSkillType subSkillType, String... vars)
|
||||
{
|
||||
return getStatMessage(false, false, subSkillType, vars);
|
||||
}
|
||||
|
||||
protected @NotNull String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
|
||||
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
|
||||
{
|
||||
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||
@ -251,7 +267,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
protected @NotNull String getLimitBreakDescriptionParameter() {
|
||||
protected String getLimitBreakDescriptionParameter() {
|
||||
if(AdvancedConfig.getInstance().canApplyLimitBreakPVE()) {
|
||||
return "(PVP/PVE)";
|
||||
} else {
|
||||
@ -259,23 +275,24 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue);
|
||||
protected abstract void dataCalculations(Player player, float skillValue);
|
||||
|
||||
protected abstract void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer);
|
||||
protected abstract void permissionsCheck(Player player);
|
||||
|
||||
//protected abstract List<String> effectsDisplay();
|
||||
|
||||
protected abstract @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky);
|
||||
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
|
||||
|
||||
protected abstract @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer player);
|
||||
protected abstract List<Component> getTextComponents(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a player can use a skill
|
||||
* @param mmoPlayer target player
|
||||
* @param player target player
|
||||
* @param subSkillType target subskill
|
||||
* @return true if the player has permission and has the rootSkillunlocked
|
||||
* @return true if the player has permission and has the skill unlocked
|
||||
*/
|
||||
protected boolean canUseSubskill(@NotNull OnlineMMOPlayer mmoPlayer, SubSkillType subSkillType) {
|
||||
return Permissions.isSubSkillEnabled(Misc.adaptPlayer(mmoPlayer), subSkillType) && RankUtils.hasUnlockedSubskill(mmoPlayer, subSkillType);
|
||||
protected boolean canUseSubskill(Player player, SubSkillType subSkillType)
|
||||
{
|
||||
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.CoreSkills;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.neetgames.mcmmo.skill.RootSkill;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -12,18 +11,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
//TODO: Switch to root rootSkillbased
|
||||
public class SkillGuideCommand implements CommandExecutor {
|
||||
private final String header;
|
||||
private final RootSkill rootSkill;
|
||||
private final ArrayList<String> guide;
|
||||
|
||||
private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
||||
public SkillGuideCommand(@NotNull RootSkill rootSkill) {
|
||||
this.rootSkill = rootSkill;
|
||||
header = LocaleLoader.getString("Guides.Header", rootSkill.getName());
|
||||
guide = getGuide(rootSkill);
|
||||
public SkillGuideCommand(PrimarySkillType skill) {
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||
guide = getGuide(skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,11 +86,11 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
return allStrings;
|
||||
}
|
||||
|
||||
private ArrayList<String> getGuide(RootSkill rootSkill) {
|
||||
private ArrayList<String> getGuide(PrimarySkillType skill) {
|
||||
ArrayList<String> guide = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(rootSkill.toString()) + ".Section." + i).split("\n");
|
||||
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");
|
||||
|
||||
if (section[0].startsWith("!")) {
|
||||
break;
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -30,10 +31,10 @@ public class SmeltingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// FUEL EFFICIENCY
|
||||
if (canFuelEfficiency) {
|
||||
burnTimeModifier = String.valueOf(((McMMOPlayer) (mmoPlayer)).getSmeltingManager().getFuelEfficiencyMultiplier());
|
||||
burnTimeModifier = String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getFuelEfficiencyMultiplier());
|
||||
}
|
||||
|
||||
// FLUX MINING
|
||||
@ -45,22 +46,22 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
// SECOND SMELT
|
||||
if (canSecondSmelt) {
|
||||
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
str_secondSmeltChance = secondSmeltStrings[0];
|
||||
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canFuelEfficiency = canUseSubskill(mmoPlayer, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = canUseSubskill(mmoPlayer, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
//canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(Misc.adaptPlayer(mmoPlayer), rootSkill) && RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
/*if (canFluxMine) {
|
||||
@ -80,17 +81,17 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
if (canUnderstandTheArt) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART,
|
||||
String.valueOf(((McMMOPlayer) (mmoPlayer)).getSmeltingManager().getVanillaXpMultiplier())));
|
||||
String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier())));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SMELTING);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -33,45 +34,45 @@ public class SwordsCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// SWORDS_COUNTER_ATTACK
|
||||
if (canCounter) {
|
||||
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
counterChance = counterStrings[0];
|
||||
counterChanceLucky = counterStrings[1];
|
||||
}
|
||||
|
||||
// SWORDS_RUPTURE
|
||||
if (canBleed) {
|
||||
bleedLength = ((McMMOPlayer) (mmoPlayer)).getSwordsManager().getRuptureBleedTicks();
|
||||
bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||
|
||||
String[] bleedStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.SWORDS_RUPTURE);
|
||||
String[] bleedStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_RUPTURE);
|
||||
bleedChance = bleedStrings[0];
|
||||
bleedChanceLucky = bleedStrings[1];
|
||||
}
|
||||
|
||||
// SERRATED STRIKES
|
||||
if (canSerratedStrike) {
|
||||
String[] serratedStrikesStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] serratedStrikesStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
serratedStrikesLength = serratedStrikesStrings[0];
|
||||
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canBleed = canUseSubskill(mmoPlayer, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = canUseSubskill(mmoPlayer, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(mmoPlayer.getPlayer());
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBleed = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
int ruptureTicks = ((McMMOPlayer) (mmoPlayer)).getSwordsManager().getRuptureBleedTicks();
|
||||
double ruptureDamagePlayers = RankUtils.getRank(mmoPlayer, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
||||
double ruptureDamageMobs = RankUtils.getRank(mmoPlayer, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
|
||||
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
||||
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
|
||||
|
||||
if (canCounter) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
|
||||
@ -94,25 +95,25 @@ public class SwordsCommand extends SkillCommand {
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.SWORDS_STAB))
|
||||
if(canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
||||
{
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||
String.valueOf(((McMMOPlayer) (mmoPlayer)).getSwordsManager().getStabDamage())));
|
||||
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||
if(canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.SWORDS);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -33,29 +33,29 @@ public class TamingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
if (canGore) {
|
||||
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.TAMING_GORE);
|
||||
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE);
|
||||
goreChance = goreStrings[0];
|
||||
goreChanceLucky = goreStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canBeastLore = canUseSubskill(mmoPlayer, SubSkillType.TAMING_BEAST_LORE);
|
||||
canCallWild = Permissions.callOfTheWild(Misc.adaptPlayer(mmoPlayer), EntityType.HORSE) || Permissions.callOfTheWild(Misc.adaptPlayer(mmoPlayer), EntityType.WOLF) || Permissions.callOfTheWild(Misc.adaptPlayer(mmoPlayer), EntityType.OCELOT);
|
||||
canEnvironmentallyAware = canUseSubskill(mmoPlayer, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = canUseSubskill(mmoPlayer, SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = canUseSubskill(mmoPlayer, SubSkillType.TAMING_GORE);
|
||||
canSharpenedClaws = canUseSubskill(mmoPlayer, SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = canUseSubskill(mmoPlayer, SubSkillType.TAMING_SHOCK_PROOF);
|
||||
canThickFur = canUseSubskill(mmoPlayer, SubSkillType.TAMING_THICK_FUR);
|
||||
canHolyHound = canUseSubskill(mmoPlayer, SubSkillType.TAMING_HOLY_HOUND);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE);
|
||||
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||
canEnvironmentallyAware = canUseSubskill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = canUseSubskill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = canUseSubskill(player, SubSkillType.TAMING_GORE);
|
||||
canSharpenedClaws = canUseSubskill(player, SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = canUseSubskill(player, SubSkillType.TAMING_SHOCK_PROOF);
|
||||
canThickFur = canUseSubskill(player, SubSkillType.TAMING_THICK_FUR);
|
||||
canHolyHound = canUseSubskill(player, SubSkillType.TAMING_HOLY_HOUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
@ -92,10 +92,10 @@ public class TamingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, this.rootSkill);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -36,53 +37,53 @@ public class UnarmedCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// UNARMED_ARROW_DEFLECT
|
||||
if (canDeflect) {
|
||||
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
deflectChance = deflectStrings[0];
|
||||
deflectChanceLucky = deflectStrings[1];
|
||||
}
|
||||
|
||||
// BERSERK
|
||||
if (canBerserk) {
|
||||
String[] berserkStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] berserkStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
berserkLength = berserkStrings[0];
|
||||
berserkLengthEndurance = berserkStrings[1];
|
||||
}
|
||||
|
||||
// UNARMED_DISARM
|
||||
if (canDisarm) {
|
||||
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.UNARMED_DISARM);
|
||||
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);
|
||||
disarmChance = disarmStrings[0];
|
||||
disarmChanceLucky = disarmStrings[1];
|
||||
}
|
||||
|
||||
// IRON ARM
|
||||
if (canIronArm) {
|
||||
ironArmBonus = ((McMMOPlayer) (mmoPlayer)).getUnarmedManager().getSteelArmStyleDamage();
|
||||
ironArmBonus = UserManager.getPlayer(player).getUnarmedManager().getSteelArmStyleDamage();
|
||||
}
|
||||
|
||||
// IRON GRIP
|
||||
if (canIronGrip) {
|
||||
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.UNARMED_IRON_GRIP);
|
||||
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
ironGripChance = ironGripStrings[0];
|
||||
ironGripChanceLucky = ironGripStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canBerserk = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(mmoPlayer.getPlayer());
|
||||
canIronArm = canUseSubskill(mmoPlayer, SubSkillType.UNARMED_STEEL_ARM_STYLE);
|
||||
canDeflect = canUseSubskill(mmoPlayer, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = canUseSubskill(mmoPlayer, SubSkillType.UNARMED_DISARM);
|
||||
canIronGrip = canUseSubskill(mmoPlayer, SubSkillType.UNARMED_IRON_GRIP);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
|
||||
canIronArm = canUseSubskill(player, SubSkillType.UNARMED_STEEL_ARM_STYLE);
|
||||
canDeflect = canUseSubskill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = canUseSubskill(player, SubSkillType.UNARMED_DISARM);
|
||||
canIronGrip = canUseSubskill(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
// TODO: Apparently we forgot about block cracker?
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canDeflect) {
|
||||
@ -113,19 +114,19 @@ public class UnarmedCommand extends SkillCommand {
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||
if(canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(mmoPlayer, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.UNARMED);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -32,39 +32,39 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
setDoubleDropClassicChanceStrings(mmoPlayer);
|
||||
setDoubleDropClassicChanceStrings(player);
|
||||
}
|
||||
|
||||
// TREE FELLER
|
||||
if (canTreeFell) {
|
||||
String[] treeFellerStrings = calculateLengthDisplayValues(mmoPlayer, skillValue);
|
||||
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
treeFellerLength = treeFellerStrings[0];
|
||||
treeFellerLengthEndurance = treeFellerStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
private void setDoubleDropClassicChanceStrings(OnlineMMOPlayer mmoPlayer) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, mmoPlayer, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
canTreeFell = RankUtils.hasUnlockedSubskill(mmoPlayer, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(mmoPlayer.getPlayer());
|
||||
canDoubleDrop = canUseSubskill(mmoPlayer, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && !rootSkill.getDoubleDropsDisabled() && RankUtils.getRank(mmoPlayer, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canLeafBlow = canUseSubskill(mmoPlayer, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
canKnockOnWood = canTreeFell && canUseSubskill(mmoPlayer, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD);
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && !skill.getDoubleDropsDisabled() && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
canKnockOnWood = canTreeFell && canUseSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD);
|
||||
/*canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER);
|
||||
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
|
||||
canNaturesBounty = canUseSubskill(player, SubSkillType.WOODCUTTING_NATURES_BOUNTY);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
if (canDoubleDrop) {
|
||||
@ -75,7 +75,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
if (canKnockOnWood) {
|
||||
String lootNote;
|
||||
|
||||
if(RankUtils.hasReachedRank(2, mmoPlayer, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
|
||||
} else {
|
||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");
|
||||
@ -97,10 +97,10 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.WOODCUTTING);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user