mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Fixing some tab completion bugs for mcconvert
This commit is contained in:
parent
8d10f8053f
commit
61e46b6f10
@ -32,6 +32,8 @@ Version 2.2.0
|
||||
Added new locale string 'Commands.Reload.Finished'
|
||||
Added new permission 'mcmmo.commands.reload'
|
||||
Lily pads were removed from the Alchemy Ingredient list as they are unused
|
||||
Experience formula conversion command no longer relies on a file to determine what formula you were using previously, instead it determines this from command parameters
|
||||
Fixed some tab completion bugs for /mcconvert command
|
||||
Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected")
|
||||
Note: Admins are players who are an operator or have adminchat permission.
|
||||
|
||||
|
@ -74,11 +74,11 @@ public class McconvertCommand implements TabExecutor {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size()));
|
||||
case 2:
|
||||
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
|
||||
if (args[1].equalsIgnoreCase("database") || args[1].equalsIgnoreCase("db")) {
|
||||
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<>(DATABASE_TYPES.size()));
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[0].equalsIgnoreCase("exp")) {
|
||||
if (args[1].equalsIgnoreCase("experience") || args[1].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
|
||||
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<>(FORMULA_TYPES.size()));
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import sun.security.krb5.Config;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -56,7 +56,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import sun.security.krb5.Config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.datatypes.player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
|
@ -14,11 +14,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class FormulaConversionTask extends BukkitRunnable {
|
||||
private CommandSender sender;
|
||||
private FormulaType formulaType;
|
||||
private FormulaType previousFormula;
|
||||
|
||||
public FormulaConversionTask(CommandSender sender, FormulaType formulaType) {
|
||||
public FormulaConversionTask(CommandSender sender, FormulaType previousFormula) {
|
||||
this.sender = sender;
|
||||
this.formulaType = formulaType;
|
||||
this.previousFormula = previousFormula;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,9 +48,8 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
convertedUsers++;
|
||||
Misc.printProgress(convertedUsers, DatabaseManager.progressInterval, startMillis);
|
||||
}
|
||||
mcMMO.getFormulaManager().setPreviousFormulaType(formulaType);
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Finish", formulaType.toString()));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Finish", previousFormula.toString()));
|
||||
}
|
||||
|
||||
private void editValues(PlayerProfile profile) {
|
||||
@ -59,13 +58,13 @@ public class FormulaConversionTask extends BukkitRunnable {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
int oldLevel = profile.getSkillLevel(primarySkillType);
|
||||
int oldXPLevel = profile.getSkillXpLevel(primarySkillType);
|
||||
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel);
|
||||
int totalOldXP = mcMMO.getFormulaManager().calculateTotalExperience(oldLevel, oldXPLevel, previousFormula);
|
||||
|
||||
if (totalOldXP == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(primarySkillType, (int) Math.floor(totalOldXP / 1.0), formulaType);
|
||||
int[] newExperienceValues = mcMMO.getFormulaManager().calculateNewLevel(primarySkillType, (int) Math.floor(totalOldXP / 1.0), previousFormula);
|
||||
int newLevel = newExperienceValues[0];
|
||||
int newXPlevel = newExperienceValues[1];
|
||||
|
||||
|
@ -3,16 +3,11 @@ package com.gmail.nossr50.util.experience;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.For;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FormulaManager {
|
||||
private static File formulaFile = new File(mcMMO.getFlatFileDirectory() + "formula.yml");
|
||||
|
||||
// Experience needed to reach a level, cached values for speed
|
||||
private Map<Integer, Integer> experienceNeededRetroLinear;
|
||||
private Map<Integer, Integer> experienceNeededStandardLinear;
|
||||
|
@ -9,14 +9,16 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
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.TextComponentFactory;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user