mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable
This commit is contained in:
commit
099dfcb0e5
@ -194,6 +194,20 @@ Version 2.2.0
|
||||
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
|
||||
Added API method to check if a skill was being level capped
|
||||
Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill
|
||||
Version 2.1.86
|
||||
Players will no longer be told they got a perfect result when salvaging if they are below max skill level
|
||||
Salvage results will now travel towards the player instead of moving in a random direction
|
||||
(FIX) You cannot view stats of players who are offline if your server limits the range on inspect for you via permissions or settings
|
||||
(FIX) Players will no longer be told they lack skill in salvage if they already qualify for the best possible result for the item
|
||||
(FIX) Fixed a bug where arcane salvage was being used to calculate salvage results instead of scrap collector
|
||||
(FIX) Added the missing locale color for 'Commands.Party.Commands'
|
||||
Modified colors used in locale strings 'Salvage.Skills.Lottery.Normal', 'Salvage.Skills.Lottery.Perfect', and 'Profile.Loading.FailurePlayer'
|
||||
When failing to load a profile mcMMO will increase the amount of time it waits before reattempting to load the profile for each failure
|
||||
|
||||
NOTES:
|
||||
You can (and always have been able) to turn off the inspect range check by setting it to 0 in the config
|
||||
2.2 is around the corner, most things are functional, still a lot of work left to do.
|
||||
|
||||
Version 2.1.85
|
||||
Fixed a nearly 6 year old bug where Super Repair was not included as a child permission under Repair ability permission nodes (which meant some players would not have access to this skill)
|
||||
Fixed a bug that could prevent salvage from working for certain players
|
||||
|
@ -66,11 +66,10 @@ public class InspectCommand implements TabExecutor {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
if (!Permissions.inspectOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
} else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
// Increment attempt counter and try
|
||||
attempt++;
|
||||
|
||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, 100);
|
||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100)));
|
||||
}
|
||||
|
||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.skills.salvage;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
@ -88,16 +87,14 @@ public class SalvageManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
int maxAmountSalvageable = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||
int potentialSalvageYield = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||
|
||||
int salvageableAmount = maxAmountSalvageable;
|
||||
|
||||
if (salvageableAmount == 0) {
|
||||
if (potentialSalvageYield <= 0) {
|
||||
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
|
||||
return;
|
||||
}
|
||||
|
||||
salvageableAmount = Math.min(salvageableAmount, getSalvageableAmount()); // Always get at least something back, if you're capable of salvaging it.
|
||||
potentialSalvageYield = Math.min(potentialSalvageYield, getSalvageLimit()); // Always get at least something back, if you're capable of salvaging it.
|
||||
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
location.add(0.5, 1, 0.5);
|
||||
@ -114,7 +111,7 @@ public class SalvageManager extends SkillManager {
|
||||
int lotteryResults = 1;
|
||||
int chanceOfSuccess = 99;
|
||||
|
||||
for(int x = 0; x < salvageableAmount-1; x++) {
|
||||
for(int x = 0; x < potentialSalvageYield-1; x++) {
|
||||
|
||||
if(RandomChanceUtil.rollDice(chanceOfSuccess, 100)) {
|
||||
chanceOfSuccess-=2;
|
||||
@ -124,9 +121,9 @@ public class SalvageManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(lotteryResults == salvageableAmount && salvageableAmount != 1 && RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
if(lotteryResults == potentialSalvageYield && potentialSalvageYield != 1 && RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Perfect", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||
} else if(RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE) || salvageableAmount == 1) {
|
||||
} else if(salvageable.getMaximumQuantity() == 1 || getSalvageLimit() >= salvageable.getMaximumQuantity()) {
|
||||
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Normal", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||
} else {
|
||||
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Untrained", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||
@ -143,7 +140,7 @@ public class SalvageManager extends SkillManager {
|
||||
Misc.dropItem(location, enchantBook);
|
||||
}
|
||||
|
||||
Misc.dropItems(location, salvageResults, 1);
|
||||
Misc.spawnItemTowardsLocation(location, player.getLocation().add(0, 0.25, 0), salvageResults);
|
||||
|
||||
// BWONG BWONG BWONG - CLUNK!
|
||||
if (mcMMO.getConfigManager().getConfigSalvage().getGeneral().isAnvilUseSounds()) {
|
||||
@ -159,8 +156,8 @@ public class SalvageManager extends SkillManager {
|
||||
return Math.min((((Salvage.salvageMaxPercentage / Salvage.salvageMaxPercentageLevel) * getSkillLevel()) / 100.0D), Salvage.salvageMaxPercentage / 100.0D);
|
||||
}*/
|
||||
|
||||
public int getSalvageableAmount() {
|
||||
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE));
|
||||
public int getSalvageLimit() {
|
||||
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_SCRAP_COLLECTOR));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
@ -115,6 +116,45 @@ public final class Misc {
|
||||
return location.getWorld().dropItemNaturally(location, itemStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop items at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The items to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void spawnItemsTowardsLocation(Location location, Location targetLocation, ItemStack is, int quantity) {
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
spawnItemTowardsLocation(location, targetLocation, is);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item at a given location.
|
||||
*
|
||||
* @param spawnLocation The location to drop the item at
|
||||
* @param itemStack The item to drop
|
||||
* @return Dropped Item entity or null if invalid or cancelled
|
||||
*/
|
||||
public static Item spawnItemTowardsLocation(Location spawnLocation, Location targetLocation, ItemStack itemStack) {
|
||||
if (itemStack.getType() == Material.AIR) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(spawnLocation, itemStack);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = spawnLocation.getWorld().dropItem(spawnLocation, itemStack);
|
||||
Vector vector = targetLocation.toVector().subtract(spawnLocation.toVector()).normalize();
|
||||
item.setVelocity(vector);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void profileCleanup(String playerName) {
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
|
||||
|
@ -35,12 +35,14 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if (sender instanceof Player
|
||||
&& mcMMO.getConfigManager().getConfigCommands().isLimitInspectRange()
|
||||
&& !hasPermission
|
||||
&& !Misc.isNear(((Player) sender).getLocation(),
|
||||
target.getLocation(),
|
||||
mcMMO.getConfigManager().getConfigCommands().getInspectCommandMaxDistance())) {
|
||||
if(!target.isOnline() && !hasPermission) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
} else if (mcMMO.getConfigManager().getConfigCommands().isLimitInspectRange()
|
||||
&& sender instanceof Player
|
||||
&& !Misc.isNear(((Player) sender).getLocation(), target.getLocation(),
|
||||
mcMMO.getConfigManager().getConfigCommands().getInspectCommandMaxDistance())
|
||||
&& !hasPermission) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
@ -390,8 +390,8 @@ Salvage.Skills.ArcaneSuccess=[[GREEN]]You able to extract all of the knowledge c
|
||||
Salvage.Listener.Anvil=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor.
|
||||
Salvage.Listener=Salvage:
|
||||
Salvage.SkillName=SALVAGE
|
||||
Salvage.Skills.Lottery.Normal=[[GOLD]]You were able to salvage [[GREEN]]{0}[[GOLD]] materials from [[DARK_AQUA]]{1}[[GOLD]].
|
||||
Salvage.Skills.Lottery.Perfect=[[GREEN]][[BOLD]]Perfect![[RESET]][[GOLD]] You salvaged [[GREEN]]{1}[[GOLD]] effortlessly, retrieving [[DARK_AQUA]]{0}[[GOLD]] materials.
|
||||
Salvage.Skills.Lottery.Normal=[[GOLD]]You were able to salvage [[DARK_AQUA]]{0}[[GOLD]] materials from [[YELLOW]]{1}[[GOLD]].
|
||||
Salvage.Skills.Lottery.Perfect=[[GREEN]][[BOLD]]Perfect![[RESET]][[GOLD]] You salvaged [[DARK_AQUA]]{1}[[GOLD]] effortlessly, retrieving [[DARK_AQUA]]{0}[[GOLD]] materials.
|
||||
Salvage.Skills.Lottery.Untrained=[[GRAY]]You aren't properly trained in salvaging. You were only able to recover [[RED]]{0}[[GRAY]] materials from [[GREEN]]{1}[[GRAY]].
|
||||
#Anvil (Shared between SALVAGE and REPAIR)
|
||||
Anvil.Unbreakable=This item is unbreakable!
|
||||
@ -631,7 +631,7 @@ Commands.Party.MembersNear=[[DARK_GRAY]]NEAR YOU [[DARK_AQUA]]{0}[[DARK_GRAY]]/[
|
||||
Commands.Party.Accept=[[GREEN]]- Accept party invite
|
||||
Commands.Party.Chat.Off=Party Chat only [[RED]]Off
|
||||
Commands.Party.Chat.On=Party Chat only [[GREEN]]On
|
||||
Commands.Party.Commands=---[][[GREEN]]PARTY COMMANDS[[RED]][]---
|
||||
Commands.Party.Commands=[[RED]]---[][[GREEN]]PARTY COMMANDS[[RED]][]---
|
||||
Commands.Party.Invite.0=[[RED]]ALERT: [[GREEN]]You have received a party invite for {0} from {1}
|
||||
Commands.Party.Invite.1=[[YELLOW]]Type [[GREEN]]/party accept[[YELLOW]] to accept the invite
|
||||
Commands.Party.Invite=[[GREEN]]- Send party invite
|
||||
@ -1084,7 +1084,7 @@ Scoreboard.Misc.Ability=Super Ability
|
||||
#DATABASE RECOVERY
|
||||
Profile.PendingLoad=[[RED]]Your mcMMO player data has not yet been loaded.
|
||||
Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded.
|
||||
Profile.Loading.FailurePlayer=[[RED]]mcMMO is having trouble loading your data, we have attempted to load it [[GREEN]]{0}[[RED]] times.[[LIGHT_GRAY]] You may want to contact the server admins about this issue. mcMMO will attempt to load your data until you disconnect, you will not gain XP or be able to use skills while the data is not loaded.
|
||||
Profile.Loading.FailurePlayer=[[RED]]mcMMO is having trouble loading your data, we have attempted to load it [[GREEN]]{0}[[RED]] times.[[RED]] You may want to contact the server admins about this issue. mcMMO will attempt to load your data until you disconnect, you will not gain XP or be able to use skills while the data is not loaded.
|
||||
Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. Attempts made so far {1}.
|
||||
#Holiday
|
||||
Holiday.AprilFools.Levelup=[[GOLD]]{0} is now level [[GREEN]]{1}[[GOLD]]!
|
||||
|
Loading…
Reference in New Issue
Block a user