mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 17:53:00 +01:00
Compare commits
16 Commits
dev-import
...
dev-events
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcdb5abaea | ||
|
|
b1095ce1a6 | ||
|
|
2497c62ada | ||
|
|
997685b5ec | ||
|
|
a65bcb9e5d | ||
|
|
26d5db07ef | ||
|
|
d6fbf1be34 | ||
|
|
965035fa72 | ||
|
|
a99293aa48 | ||
|
|
20967bea92 | ||
|
|
e10b70c422 | ||
|
|
071c568353 | ||
|
|
d5fb19a7db | ||
|
|
badabeb8e4 | ||
|
|
d0a1d44fa2 | ||
|
|
fdaa42edd3 |
@@ -8,26 +8,20 @@ Key:
|
|||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 1.4.08-dev
|
Version 1.4.08-dev
|
||||||
+ Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances
|
|
||||||
+ Added the possibility to gain experience when using Fishing "Shake"
|
+ Added the possibility to gain experience when using Fishing "Shake"
|
||||||
+ Added config options to disable various sound effects
|
+ Added config options to disable various sound effects
|
||||||
+ Smelting now works with custom ores - add smelting XP value to blocks.yml, or it will default to 1/10th of normal XP.
|
+ Smelting now works with custom ores - add smelting XP value to blocks.yml, or it will default to 1/10th of normal XP.
|
||||||
+ Added automatic cleanup of backups folder.
|
+ Added automatic cleanup of backups folder.
|
||||||
+ Added bypass permission for finding Fishing traps
|
+ Added bypass permission for finding Fishing traps
|
||||||
= Fixed bug where LeafBlower permissions were ignored
|
|
||||||
= Fixed bug with toggle commands not properly displaying the success message.
|
= Fixed bug with toggle commands not properly displaying the success message.
|
||||||
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
||||||
= Fixed bug with Salvage not reading the config value for the anvil material.
|
= Fixed bug with Salvage not reading the config value for the anvil material.
|
||||||
= Fixed exploit where you could receive smelting XP for improper items
|
= Fixed exploit where you could receive smelting XP for improper items
|
||||||
= Fixed bug where the Unbreaking enchantment was ignored when using "Super Breaker" or "Giga Drill Breaker"
|
= Fixed bug where the Unbreaking enchantment was ignored when using "Super Breaker" or "Giga Drill Breaker"
|
||||||
= Fixed bug which prevented players from gaining Acrobatics XP when the setting 'Prevent_XP_After_Teleport' was set to false
|
= Fixed bug which prevented players from gaining Acrobatics XP when the setting 'Prevent_XP_After_Teleport' was set to false
|
||||||
= Fixed bug where cooldown donor perks were reducing more than expected
|
= Fixed McMMOPlayerDisarmEvent reporting the skill level of the defending player, not the attacking player.
|
||||||
= Fixed bug where disabling hardcore mode for specific skills didn't work
|
= Fixed bug where arrow retrieval was not properly detecting entities that already existed in the tracker
|
||||||
= Fixed bug which caused the backup cleanup to delete old backups while it should have kept those
|
|
||||||
= Fixed bug where party chat broke if the display name contained special characters
|
|
||||||
! Updated localization files
|
! Updated localization files
|
||||||
! Changed AxesCritical to CriticalHit in config file
|
|
||||||
! Changed several secondary ability permissions(deprecated versions still exist)
|
|
||||||
|
|
||||||
Version 1.4.07
|
Version 1.4.07
|
||||||
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
|
+ Added XP boost to Acrobatics when wearing Boots of Feather Falling
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.gmail.nossr50.chat;
|
package com.gmail.nossr50.chat;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@@ -30,7 +27,7 @@ public class PartyChatManager extends ChatManager {
|
|||||||
@Override
|
@Override
|
||||||
protected void sendMessage() {
|
protected void sendMessage() {
|
||||||
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
|
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
|
||||||
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
|
message = message.replaceFirst(displayName, ChatColor.GOLD + displayName + ChatColor.RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player member : party.getOnlineMembers()) {
|
for (Player member : party.getOnlineMembers()) {
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.gmail.nossr50.commands.database;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
|
import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@@ -49,6 +52,17 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
|
||||||
|
|
||||||
UserManager.saveAll();
|
UserManager.saveAll();
|
||||||
|
UserManager.clearAll();
|
||||||
|
|
||||||
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
|
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getName(), false);
|
||||||
|
|
||||||
|
if (profile.isLoaded()) {
|
||||||
|
mcMMO.getDatabaseManager().saveUser(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
UserManager.addUser(player);
|
||||||
|
}
|
||||||
|
|
||||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -52,12 +52,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillType skill;
|
SkillType skill = SkillType.getSkill(args[1]);
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
|
||||||
skill = null;
|
|
||||||
} else {
|
|
||||||
skill = SkillType.getSkill(args[1]);
|
|
||||||
}
|
|
||||||
int value = Integer.parseInt(args[2]);
|
int value = Integer.parseInt(args[2]);
|
||||||
|
|
||||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||||
@@ -105,7 +100,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
protected abstract void handlePlayerMessageSkill(Player player, int value, SkillType skill);
|
protected abstract void handlePlayerMessageSkill(Player player, int value, SkillType skill);
|
||||||
|
|
||||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||||
if (CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName))) {
|
if (CommandUtils.isInvalidInteger(sender, value) || CommandUtils.isInvalidSkill(sender, skillName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ import com.gmail.nossr50.util.commands.CommandUtils;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
/**
|
|
||||||
* This class mirrors the structure of ExperienceCommand, except the
|
|
||||||
* value/quantity argument is removed.
|
|
||||||
*/
|
|
||||||
public class SkillresetCommand implements TabExecutor {
|
public class SkillresetCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
@@ -35,35 +31,29 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionsCheckSelf(sender)) {
|
if (!Permissions.skillreset(sender)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateArguments(sender, args[0])) {
|
if (CommandUtils.isInvalidSkill(sender, args[0])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]));
|
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]), args.length, sender, command);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (!permissionsCheckOthers(sender)) {
|
if (!Permissions.skillresetOthers(sender)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateArguments(sender, args[1])) {
|
if (CommandUtils.isInvalidSkill(sender, args[1])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillType skill;
|
SkillType skill = SkillType.getSkill(args[1]);
|
||||||
if (args[1].equalsIgnoreCase("all")) {
|
|
||||||
skill = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
skill = SkillType.getSkill(args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
||||||
@@ -76,13 +66,13 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
editValues(null, profile, skill);
|
editValues(null, profile, skill, args.length, sender, command);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, args.length, sender, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSenderMessage(sender, playerName, skill);
|
ExperienceCommand.handleSenderMessage(sender, playerName, skill);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -103,7 +93,31 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill) {
|
private void editValues(Player player, PlayerProfile profile, SkillType skill, int argsLength, CommandSender sender, Command command) {
|
||||||
|
if (skill == null) {
|
||||||
|
for (SkillType skillType : SkillType.values()) {
|
||||||
|
handleCommand(player, profile, skillType, argsLength, sender, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
handleCommand(player, profile, skill, argsLength, sender, command);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCommand(Player player, PlayerProfile profile, SkillType skill, int argsLength, CommandSender sender, Command command) {
|
||||||
|
if (argsLength == 1 && !Permissions.skillreset(sender, skill) || (argsLength == 2 && !Permissions.skillresetOthers(sender, skill))) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int levelsRemoved = profile.getSkillLevel(skill);
|
int levelsRemoved = profile.getSkillLevel(skill);
|
||||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||||
|
|
||||||
@@ -116,56 +130,4 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
|
|
||||||
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false);
|
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
|
||||||
return Permissions.skillreset(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean permissionsCheckOthers(CommandSender sender) {
|
|
||||||
return Permissions.skillresetOthers(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void handlePlayerMessageAll(Player player) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void handlePlayerMessageSkill(Player player, SkillType skill) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
|
||||||
if (CommandUtils.isInvalidSkill(sender, skillName) && !skillName.equalsIgnoreCase("all")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
|
|
||||||
if (skill == null) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
|
|
||||||
if (skill == null) {
|
|
||||||
for (SkillType skillType : SkillType.values()) {
|
|
||||||
handleCommand(player, profile, skillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player != null) {
|
|
||||||
handlePlayerMessageAll(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
handleCommand(player, profile, skill);
|
|
||||||
|
|
||||||
if (player != null) {
|
|
||||||
handlePlayerMessageSkill(player, skill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class MccooldownCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
for (AbilityType ability : AbilityType.NORMAL_ABILITIES) {
|
||||||
if (!ability.getPermissions(player)) {
|
if (!ability.getPermissions(player)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.skills.acrobatics.Acrobatics;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class AcrobaticsCommand extends SkillCommand {
|
public class AcrobaticsCommand extends SkillCommand {
|
||||||
@@ -30,21 +30,21 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
// DODGE
|
// DODGE
|
||||||
if (canDodge) {
|
if (canDodge) {
|
||||||
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DODGE, isLucky);
|
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, Acrobatics.dodgeMaxBonusLevel, Acrobatics.dodgeMaxChance, isLucky);
|
||||||
dodgeChance = dodgeStrings[0];
|
dodgeChance = dodgeStrings[0];
|
||||||
dodgeChanceLucky = dodgeStrings[1];
|
dodgeChanceLucky = dodgeStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ROLL
|
// ROLL
|
||||||
if (canRoll) {
|
if (canRoll) {
|
||||||
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.ROLL, isLucky);
|
String[] rollStrings = calculateAbilityDisplayValues(skillValue, Acrobatics.rollMaxBonusLevel, Acrobatics.rollMaxChance, isLucky);
|
||||||
rollChance = rollStrings[0];
|
rollChance = rollStrings[0];
|
||||||
rollChanceLucky = rollStrings[1];
|
rollChanceLucky = rollStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// GRACEFUL ROLL
|
// GRACEFUL ROLL
|
||||||
if (canGracefulRoll) {
|
if (canGracefulRoll) {
|
||||||
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GRACEFUL_ROLL, isLucky);
|
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, Acrobatics.gracefulRollMaxBonusLevel, Acrobatics.gracefulRollMaxChance, isLucky);
|
||||||
gracefulRollChance = gracefulRollStrings[0];
|
gracefulRollChance = gracefulRollStrings[0];
|
||||||
gracefulRollChanceLucky = gracefulRollStrings[1];
|
gracefulRollChanceLucky = gracefulRollStrings[1];
|
||||||
}
|
}
|
||||||
@@ -52,9 +52,9 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DODGE);
|
canDodge = Permissions.dodge(player);
|
||||||
canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ROLL);
|
canRoll = Permissions.roll(player);
|
||||||
canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL);
|
canGracefulRoll = Permissions.gracefulRoll(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.archery.Archery;
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
@@ -36,14 +35,14 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DAZE
|
// DAZE
|
||||||
if (canDaze) {
|
if (canDaze) {
|
||||||
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DAZE, isLucky);
|
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, Archery.dazeMaxBonusLevel, Archery.dazeMaxBonus, isLucky);
|
||||||
dazeChance = dazeStrings[0];
|
dazeChance = dazeStrings[0];
|
||||||
dazeChanceLucky = dazeStrings[1];
|
dazeChanceLucky = dazeStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// RETRIEVE
|
// RETRIEVE
|
||||||
if (canRetrieve) {
|
if (canRetrieve) {
|
||||||
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.RETRIEVE, isLucky);
|
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, Archery.retrieveMaxBonusLevel, Archery.retrieveMaxChance, isLucky);
|
||||||
retrieveChance = retrieveStrings[0];
|
retrieveChance = retrieveStrings[0];
|
||||||
retrieveChanceLucky = retrieveStrings[1];
|
retrieveChanceLucky = retrieveStrings[1];
|
||||||
}
|
}
|
||||||
@@ -51,9 +50,9 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SKILL_SHOT);
|
canSkillShot = Permissions.bonusDamage(player, skill);
|
||||||
canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DAZE);
|
canDaze = Permissions.daze(player);
|
||||||
canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.RETRIEVE);
|
canRetrieve = Permissions.arrowRetrieval(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.axes.Axes;
|
import com.gmail.nossr50.skills.axes.Axes;
|
||||||
@@ -14,14 +13,14 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
public class AxesCommand extends SkillCommand {
|
public class AxesCommand extends SkillCommand {
|
||||||
private String critChance;
|
private String critChance;
|
||||||
private String critChanceLucky;
|
private String critChanceLucky;
|
||||||
private double axeMasteryDamage;
|
private double bonusDamage;
|
||||||
private double impactDamage;
|
private double impactDamage;
|
||||||
private String skullSplitterLength;
|
private String skullSplitterLength;
|
||||||
private String skullSplitterLengthEndurance;
|
private String skullSplitterLengthEndurance;
|
||||||
|
|
||||||
private boolean canSkullSplitter;
|
private boolean canSkullSplitter;
|
||||||
private boolean canCritical;
|
private boolean canCritical;
|
||||||
private boolean canAxeMastery;
|
private boolean canBonusDamage;
|
||||||
private boolean canImpact;
|
private boolean canImpact;
|
||||||
private boolean canGreaterImpact;
|
private boolean canGreaterImpact;
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
// ARMOR IMPACT
|
// IMPACT
|
||||||
if (canImpact) {
|
if (canImpact) {
|
||||||
impactDamage = 1 + (skillValue / Axes.impactIncreaseLevel);
|
impactDamage = 1 + (skillValue / Axes.impactIncreaseLevel);
|
||||||
}
|
}
|
||||||
@@ -43,26 +42,26 @@ public class AxesCommand extends SkillCommand {
|
|||||||
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// CRITICAL HIT
|
// CRITICAL STRIKES
|
||||||
if (canCritical) {
|
if (canCritical) {
|
||||||
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.CRITICAL_HIT, isLucky);
|
String[] criticalStrikeStrings = calculateAbilityDisplayValues(skillValue, Axes.criticalHitMaxBonusLevel, Axes.criticalHitMaxChance, isLucky);
|
||||||
critChance = criticalHitStrings[0];
|
critChance = criticalStrikeStrings[0];
|
||||||
critChanceLucky = criticalHitStrings[1];
|
critChanceLucky = criticalStrikeStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// AXE MASTERY
|
// AXE MASTERY
|
||||||
if (canAxeMastery) {
|
if (canBonusDamage) {
|
||||||
axeMasteryDamage = Math.min(skillValue / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
|
bonusDamage = Math.min(skillValue / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSkullSplitter = Permissions.skullSplitter(player);
|
canSkullSplitter = Permissions.skullSplitter(player);
|
||||||
canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CRITICAL_HIT);
|
canCritical = Permissions.criticalStrikes(player);
|
||||||
canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.AXE_MASTERY);
|
canBonusDamage = Permissions.bonusDamage(player, skill);
|
||||||
canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARMOR_IMPACT);
|
canImpact = Permissions.armorImpact(player);
|
||||||
canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GREATER_IMPACT);
|
canGreaterImpact = Permissions.greaterImpact(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,7 +76,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.2"), LocaleLoader.getString("Axes.Effect.3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canAxeMastery) {
|
if (canBonusDamage) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Axes.Effect.4"), LocaleLoader.getString("Axes.Effect.5")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +95,8 @@ public class AxesCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<String>();
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
if (canAxeMastery) {
|
if (canBonusDamage) {
|
||||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage)));
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", bonusDamage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canImpact) {
|
if (canImpact) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -34,7 +33,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
||||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER);
|
canTreasureHunt = Permissions.excavationTreasureHunter(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@@ -115,12 +114,12 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER);
|
canTreasureHunt = Permissions.fishingTreasureHunter(player);
|
||||||
canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER);
|
canMagicHunt = Permissions.magicHunter(player);
|
||||||
canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHAKE);
|
canShake = Permissions.shake(player);
|
||||||
canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET);
|
canFishermansDiet = Permissions.fishermansDiet(player);
|
||||||
canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MASTER_ANGLER);
|
canMasterAngler = Permissions.masterAngler(player);
|
||||||
canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ICE_FISHING);
|
canIceFish = Permissions.iceFishing(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||||
@@ -56,28 +55,28 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||||
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
|
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
|
||||||
|
|
||||||
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GREEN_THUMB_PLANT, isLucky);
|
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, Herbalism.greenThumbMaxLevel, Herbalism.greenThumbMaxChance, isLucky);
|
||||||
greenThumbChance = greenThumbStrings[0];
|
greenThumbChance = greenThumbStrings[0];
|
||||||
greenThumbChanceLucky = greenThumbStrings[1];
|
greenThumbChanceLucky = greenThumbStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HERBALISM_DOUBLE_DROPS, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, Herbalism.doubleDropsMaxLevel, Herbalism.doubleDropsMaxChance, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// HYLIAN LUCK
|
// HYLIAN LUCK
|
||||||
if (hasHylianLuck) {
|
if (hasHylianLuck) {
|
||||||
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HYLIAN_LUCK, isLucky);
|
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, Herbalism.hylianLuckMaxLevel, Herbalism.hylianLuckMaxChance, isLucky);
|
||||||
hylianLuckChance = hylianLuckStrings[0];
|
hylianLuckChance = hylianLuckStrings[0];
|
||||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// SHROOM THUMB
|
// SHROOM THUMB
|
||||||
if (canShroomThumb) {
|
if (canShroomThumb) {
|
||||||
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SHROOM_THUMB, isLucky);
|
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, Herbalism.shroomThumbMaxLevel, Herbalism.shroomThumbMaxChance, isLucky);
|
||||||
shroomThumbChance = shroomThumbStrings[0];
|
shroomThumbChance = shroomThumbStrings[0];
|
||||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||||
}
|
}
|
||||||
@@ -85,13 +84,13 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
|
hasHylianLuck = Permissions.hylianLuck(player);
|
||||||
canGreenTerra = Permissions.greenTerra(player);
|
canGreenTerra = Permissions.greenTerra(player);
|
||||||
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
|
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
|
||||||
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
|
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
|
||||||
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
|
canFarmersDiet = Permissions.farmersDiet(player);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
|
||||||
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
canShroomThumb = Permissions.shroomThumb(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import java.util.List;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
||||||
|
import com.gmail.nossr50.skills.mining.Mining;
|
||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@@ -48,7 +48,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.MINING_DOUBLE_DROPS, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, Mining.doubleDropsMaxLevel, Mining.doubleDropsMaxChance, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
canBiggerBombs = Permissions.biggerBombs(player);
|
canBiggerBombs = Permissions.biggerBombs(player);
|
||||||
canBlast = Permissions.remoteDetonation(player);
|
canBlast = Permissions.remoteDetonation(player);
|
||||||
canDemoExpert = Permissions.demolitionsExpertise(player);
|
canDemoExpert = Permissions.demolitionsExpertise(player);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
|
||||||
canSuperBreaker = Permissions.superBreaker(player);
|
canSuperBreaker = Permissions.superBreaker(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
@@ -66,7 +65,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SUPER REPAIR
|
// SUPER REPAIR
|
||||||
if (canSuperRepair) {
|
if (canSuperRepair) {
|
||||||
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SUPER_REPAIR, isLucky);
|
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, Repair.superRepairMaxBonusLevel, Repair.superRepairMaxChance, isLucky);
|
||||||
superRepairChance = superRepairStrings[0];
|
superRepairChance = superRepairStrings[0];
|
||||||
superRepairChanceLucky = superRepairStrings[1];
|
superRepairChanceLucky = superRepairStrings[1];
|
||||||
}
|
}
|
||||||
@@ -74,10 +73,10 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
canSuperRepair = Permissions.superRepair(player);
|
||||||
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
canMasterRepair = Permissions.repairMastery(player);
|
||||||
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
canArcaneForge = Permissions.arcaneForging(player);
|
||||||
canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE);
|
canSalvage = Permissions.salvage(player);
|
||||||
canRepairDiamond = Permissions.repairDiamond(player);
|
canRepairDiamond = Permissions.repairDiamond(player);
|
||||||
canRepairGold = Permissions.repairGold(player);
|
canRepairGold = Permissions.repairGold(player);
|
||||||
canRepairIron = Permissions.repairIron(player);
|
canRepairIron = Permissions.repairIron(player);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
@@ -137,10 +136,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return displayValues;
|
return displayValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbility skillAbility, boolean isLucky) {
|
protected String[] calculateAbilityDisplayValues(float skillValue, int maxBonusLevel, double maxChance, boolean isLucky) {
|
||||||
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility);
|
return calculateAbilityDisplayValues((maxChance / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
||||||
|
|
||||||
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(skillAbility) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
@@ -39,7 +38,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// SECOND SMELT
|
// SECOND SMELT
|
||||||
if (canSecondSmelt) {
|
if (canSecondSmelt) {
|
||||||
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SECOND_SMELT, isLucky);
|
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, Smelting.secondSmeltMaxLevel, Smelting.secondSmeltMaxChance, isLucky);
|
||||||
secondSmeltChance = secondSmeltStrings[0];
|
secondSmeltChance = secondSmeltStrings[0];
|
||||||
secondSmeltChanceLucky = secondSmeltStrings[1];
|
secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||||
}
|
}
|
||||||
@@ -54,9 +53,9 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY);
|
canFuelEfficiency = Permissions.fuelEfficiency(player);
|
||||||
canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SECOND_SMELT);
|
canSecondSmelt = Permissions.doubleDrops(player, skill);
|
||||||
canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FLUX_MINING);
|
canFluxMine = Permissions.fluxMining(player);
|
||||||
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.swords.Swords;
|
import com.gmail.nossr50.skills.swords.Swords;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class SwordsCommand extends SkillCommand {
|
public class SwordsCommand extends SkillCommand {
|
||||||
private String counterChance;
|
private String counterAttackChance;
|
||||||
private String counterChanceLucky;
|
private String counterAttackChanceLucky;
|
||||||
private int bleedLength;
|
private int bleedLength;
|
||||||
private String bleedChance;
|
private String bleedChance;
|
||||||
private String bleedChanceLucky;
|
private String bleedChanceLucky;
|
||||||
@@ -40,25 +38,25 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
|
|
||||||
// BLEED
|
// BLEED
|
||||||
if (canBleed) {
|
if (canBleed) {
|
||||||
bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbility.BLEED)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks;
|
bleedLength = (skillValue >= Swords.bleedMaxBonusLevel) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks;
|
||||||
|
|
||||||
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.BLEED, isLucky);
|
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, Swords.bleedMaxBonusLevel, Swords.bleedMaxChance, isLucky);
|
||||||
bleedChance = bleedStrings[0];
|
bleedChance = bleedStrings[0];
|
||||||
bleedChanceLucky = bleedStrings[1];
|
bleedChanceLucky = bleedStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// COUNTER
|
// COUNTER ATTACK
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.COUNTER, isLucky);
|
String[] counterAttackStrings = calculateAbilityDisplayValues(skillValue, Swords.counterAttackMaxBonusLevel, Swords.counterAttackMaxChance, isLucky);
|
||||||
counterChance = counterStrings[0];
|
counterAttackChance = counterAttackStrings[0];
|
||||||
counterChanceLucky = counterStrings[1];
|
counterAttackChanceLucky = counterAttackStrings[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBleed = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BLEED);
|
canBleed = Permissions.bleed(player);
|
||||||
canCounter = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.COUNTER);
|
canCounter = Permissions.counterAttack(player);
|
||||||
canSerratedStrike = Permissions.serratedStrikes(player);
|
canSerratedStrike = Permissions.serratedStrikes(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +85,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
List<String> messages = new ArrayList<String>();
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
if (canCounter) {
|
if (canCounter) {
|
||||||
messages.add(LocaleLoader.getString("Swords.Combat.Counter.Chance", counterChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", counterChanceLucky) : ""));
|
messages.add(LocaleLoader.getString("Swords.Combat.Counter.Chance", counterAttackChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", counterAttackChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canBleed) {
|
if (canBleed) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.taming.Taming;
|
import com.gmail.nossr50.skills.taming.Taming;
|
||||||
@@ -34,7 +33,7 @@ public class TamingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
if (canGore) {
|
if (canGore) {
|
||||||
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GORE, isLucky);
|
String[] goreStrings = calculateAbilityDisplayValues(skillValue, Taming.goreMaxBonusLevel, Taming.goreMaxChance, isLucky);
|
||||||
goreChance = goreStrings[0];
|
goreChance = goreStrings[0];
|
||||||
goreChanceLucky = goreStrings[1];
|
goreChanceLucky = goreStrings[1];
|
||||||
}
|
}
|
||||||
@@ -42,15 +41,15 @@ public class TamingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBeastLore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BEAST_LORE);
|
canBeastLore = Permissions.beastLore(player);
|
||||||
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||||
canEnvironmentallyAware = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ENVIROMENTALLY_AWARE);
|
canEnvironmentallyAware = Permissions.environmentallyAware(player);
|
||||||
canFastFood = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FAST_FOOD);
|
canFastFood = Permissions.fastFoodService(player);
|
||||||
canGore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GORE);
|
canGore = Permissions.gore(player);
|
||||||
canSharpenedClaws = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHARPENED_CLAWS);
|
canSharpenedClaws = Permissions.sharpenedClaws(player);
|
||||||
canShockProof = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHOCK_PROOF);
|
canShockProof = Permissions.shockProof(player);
|
||||||
canThickFur = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.THICK_FUR);
|
canThickFur = Permissions.thickFur(player);
|
||||||
canHolyHound = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HOLY_HOUND);
|
canHolyHound = Permissions.holyHound(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||||
@@ -24,7 +23,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
private boolean canBerserk;
|
private boolean canBerserk;
|
||||||
private boolean canDisarm;
|
private boolean canDisarm;
|
||||||
private boolean canIronArm;
|
private boolean canBonusDamage;
|
||||||
private boolean canDeflect;
|
private boolean canDeflect;
|
||||||
private boolean canIronGrip;
|
private boolean canIronGrip;
|
||||||
|
|
||||||
@@ -43,26 +42,26 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DISARM
|
// DISARM
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DISARM, isLucky);
|
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, Unarmed.disarmMaxBonusLevel, Unarmed.disarmMaxChance, isLucky);
|
||||||
disarmChance = disarmStrings[0];
|
disarmChance = disarmStrings[0];
|
||||||
disarmChanceLucky = disarmStrings[1];
|
disarmChanceLucky = disarmStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFLECT
|
// DEFLECT
|
||||||
if (canDeflect) {
|
if (canDeflect) {
|
||||||
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DEFLECT, isLucky);
|
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, Unarmed.deflectMaxBonusLevel, Unarmed.deflectMaxChance, isLucky);
|
||||||
deflectChance = deflectStrings[0];
|
deflectChance = deflectStrings[0];
|
||||||
deflectChanceLucky = deflectStrings[1];
|
deflectChanceLucky = deflectStrings[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRON ARM
|
// IRON ARM
|
||||||
if (canIronArm) {
|
if (canBonusDamage) {
|
||||||
ironArmBonus = Math.min(3 + ((int) skillValue / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
|
ironArmBonus = Math.min(3 + ((int) skillValue / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRON GRIP
|
// IRON GRIP
|
||||||
if (canIronGrip) {
|
if (canIronGrip) {
|
||||||
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.IRON_GRIP, isLucky);
|
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, Unarmed.ironGripMaxBonusLevel, Unarmed.ironGripMaxChance, isLucky);
|
||||||
ironGripChance = ironGripStrings[0];
|
ironGripChance = ironGripStrings[0];
|
||||||
ironGripChanceLucky = ironGripStrings[1];
|
ironGripChanceLucky = ironGripStrings[1];
|
||||||
}
|
}
|
||||||
@@ -71,11 +70,10 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canBerserk = Permissions.berserk(player);
|
canBerserk = Permissions.berserk(player);
|
||||||
canIronArm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_ARM);
|
canBonusDamage = Permissions.bonusDamage(player, skill);
|
||||||
canDeflect = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DEFLECT);
|
canDeflect = Permissions.arrowDeflect(player);
|
||||||
canDisarm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DISARM);
|
canDisarm = Permissions.disarm(player);
|
||||||
canIronGrip = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_GRIP);
|
canIronGrip = Permissions.ironGrip(player);
|
||||||
// TODO: Apparently we forgot about block cracker?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,13 +83,12 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
if (canBerserk) {
|
if (canBerserk) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.0"), LocaleLoader.getString("Unarmed.Effect.1")));
|
||||||
}
|
}
|
||||||
// TODO: Apparently we forgot about block cracker?
|
|
||||||
|
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.2"), LocaleLoader.getString("Unarmed.Effect.3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canIronArm) {
|
if (canBonusDamage) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Unarmed.Effect.4"), LocaleLoader.getString("Unarmed.Effect.5")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +107,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<String>();
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
if (canIronArm) {
|
if (canBonusDamage) {
|
||||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", ironArmBonus)));
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", ironArmBonus)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import java.util.List;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.skills.woodcutting.Woodcutting;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class WoodcuttingCommand extends SkillCommand {
|
public class WoodcuttingCommand extends SkillCommand {
|
||||||
@@ -36,7 +36,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, isLucky);
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, Woodcutting.doubleDropsMaxLevel, Woodcutting.doubleDropsMaxChance, isLucky);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@@ -45,8 +45,8 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
canTreeFell = Permissions.treeFeller(player);
|
canTreeFell = Permissions.treeFeller(player);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.doubleDrops(player, skill) && !skill.getDoubleDropsDisabled();
|
||||||
canLeafBlow = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.LEAF_BLOWER);
|
canLeafBlow = Permissions.leafBlower(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,13 +4,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||||
private static AdvancedConfig instance;
|
private static AdvancedConfig instance;
|
||||||
@@ -43,11 +40,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACROBATICS */
|
/* ACROBATICS */
|
||||||
if (getMaxChance(SecondaryAbility.DODGE) < 1) {
|
if (getDodgeChanceMax() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DODGE) < 1) {
|
if (getDodgeMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +52,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
|
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.ROLL) < 1) {
|
if (getRollChanceMax() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.ROLL) < 1) {
|
if (getRollMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,11 +64,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
|
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.GRACEFUL_ROLL) < 1) {
|
if (getGracefulRollChanceMax() < 1) {
|
||||||
reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.GRACEFUL_ROLL) < 1) {
|
if (getGracefulRollMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,11 +89,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
|
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.DAZE) < 1) {
|
if (getDazeBonusMax() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DAZE) < 1) {
|
if (getDazeMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,11 +101,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.RETRIEVE) < 1) {
|
if (getRetrieveChanceMax() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
|
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.RETRIEVE) < 1) {
|
if (getRetrieveMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,28 +114,28 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AXES */
|
/* AXES */
|
||||||
if (getAxeMasteryBonusMax() < 1) {
|
if (getBonusDamageAxesBonusMax() < 1) {
|
||||||
reason.add("Skills.Axes.AxeMastery.MaxBonus should be at least 1!");
|
reason.add("Skills.Axes.DamageIncrease.MaxBonus should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getAxeMasteryMaxBonusLevel() < 1) {
|
if (getBonusDamageAxesMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Axes.DamageIncrease.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.CRITICAL_HIT) < 1) {
|
if (getAxesCriticalChance() < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
|
reason.add("Skills.Axes.AxesCritical.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.CRITICAL_HIT) < 1) {
|
if (getAxesCriticalMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Axes.AxesCritical.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCriticalHitPVPModifier() < 1) {
|
if (getAxesCriticalPVPModifier() < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.PVP_Modifier should be at least 1!");
|
reason.add("Skills.Axes.AxesCritical.PVP_Modifier should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCriticalHitPVEModifier() < 1) {
|
if (getAxesCriticalPVEModifier() < 1) {
|
||||||
reason.add("Skills.Axes.CriticalHit.PVE_Modifier should be at least 1!");
|
reason.add("Skills.Axes.AxesCritical.PVE_Modifier should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGreaterImpactChance() < 1) {
|
if (getGreaterImpactChance() < 1) {
|
||||||
@@ -231,44 +228,44 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
|
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
|
if (getGreenThumbChanceMax() < 1) {
|
||||||
reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
|
reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
|
if (getGreenThumbMaxLevel() < 1) {
|
||||||
reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
|
if (getHerbalismDoubleDropsChanceMax() < 1) {
|
||||||
reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
|
reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
|
if (getHerbalismDoubleDropsMaxLevel() < 1) {
|
||||||
reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.HYLIAN_LUCK) < 1) {
|
if (getHylianLuckChanceMax() < 1) {
|
||||||
reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
|
reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.HYLIAN_LUCK) < 1) {
|
if (getHylianLuckMaxLevel() < 1) {
|
||||||
reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.SHROOM_THUMB) < 1) {
|
if (getShroomThumbChanceMax() < 1) {
|
||||||
reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
|
reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.SHROOM_THUMB) < 1) {
|
if (getShroomThumbMaxLevel() < 1) {
|
||||||
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
if (getMaxChance(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
|
if (getMiningDoubleDropChance() < 1) {
|
||||||
reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
|
reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
|
if (getMiningDoubleDropMaxLevel() < 1) {
|
||||||
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,11 +334,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.SUPER_REPAIR) < 1) {
|
if (getSuperRepairChanceMax() < 1) {
|
||||||
reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
|
reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.SUPER_REPAIR) < 1) {
|
if (getSuperRepairMaxLevel() < 1) {
|
||||||
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,11 +387,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
|
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.SECOND_SMELT) < 1) {
|
if (getSecondSmeltMaxLevel() < 1) {
|
||||||
reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.SECOND_SMELT) < 1) {
|
if (getSecondSmeltMaxChance() < 1) {
|
||||||
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
|
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,11 +428,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* SWORDS */
|
/* SWORDS */
|
||||||
if (getMaxChance(SecondaryAbility.BLEED) < 1) {
|
if (getBleedChanceMax() < 1) {
|
||||||
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!");
|
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.BLEED) < 1) {
|
if (getBleedMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,11 +448,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
|
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.COUNTER) < 1) {
|
if (getCounterChanceMax() < 1) {
|
||||||
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
|
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.COUNTER) < 1) {
|
if (getCounterMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,11 +470,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
|
|
||||||
/* TAMING */
|
/* TAMING */
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.GORE) < 1) {
|
if (getGoreChanceMax() < 1) {
|
||||||
reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
|
reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.GORE) < 1) {
|
if (getGoreMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,27 +531,27 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UNARMED */
|
/* UNARMED */
|
||||||
if (getMaxChance(SecondaryAbility.DISARM) < 1) {
|
if (getDisarmChanceMax() < 1) {
|
||||||
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
|
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DISARM) < 1) {
|
if (getDisarmMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.DEFLECT) < 1) {
|
if (getDeflectChanceMax() < 1) {
|
||||||
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
|
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.DEFLECT) < 1) {
|
if (getDeflectMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.IRON_GRIP) < 1) {
|
if (getIronGripChanceMax() < 1) {
|
||||||
reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
|
reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.IRON_GRIP) < 1) {
|
if (getIronGripMaxBonusLevel() < 1) {
|
||||||
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,11 +576,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 1!");
|
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxChance(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
if (getWoodcuttingDoubleDropChance() < 1) {
|
||||||
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
|
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMaxBonusLevel(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
|
if (getWoodcuttingDoubleDropMaxLevel() < 1) {
|
||||||
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,14 +611,17 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
|
||||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||||
|
|
||||||
public int getMaxBonusLevel(SecondaryAbility skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".MaxBonusLevel"); }
|
|
||||||
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); }
|
|
||||||
|
|
||||||
/* ACROBATICS */
|
/* ACROBATICS */
|
||||||
|
public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge.ChanceMax", 20.0D); }
|
||||||
|
public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge.MaxBonusLevel", 800); }
|
||||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||||
|
|
||||||
|
public double getRollChanceMax() { return config.getDouble("Skills.Acrobatics.Roll.ChanceMax", 100.0D); }
|
||||||
|
public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll.MaxBonusLevel", 1000); }
|
||||||
public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
|
public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
|
||||||
|
|
||||||
|
public double getGracefulRollChanceMax() { return config.getDouble("Skills.Acrobatics.GracefulRoll.ChanceMax", 100.0D); }
|
||||||
|
public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll.MaxBonusLevel", 500); }
|
||||||
public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
|
public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
|
||||||
|
|
||||||
/* ARCHERY */
|
/* ARCHERY */
|
||||||
@@ -630,16 +630,23 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.MaxBonus", 2.0D); }
|
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.MaxBonus", 2.0D); }
|
||||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||||
|
|
||||||
|
public double getDazeBonusMax() { return config.getDouble("Skills.Archery.Daze.ChanceMax", 50.0D); }
|
||||||
|
public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze.MaxBonusLevel", 1000); }
|
||||||
public double getDazeModifier() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
public double getDazeModifier() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
||||||
|
|
||||||
|
public double getRetrieveChanceMax() { return config.getDouble("Skills.Archery.Retrieve.ChanceMax", 100.0D); }
|
||||||
|
public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
||||||
|
|
||||||
/* AXES */
|
/* AXES */
|
||||||
public double getAxeMasteryBonusMax() { return config.getDouble("Skills.Axes.AxeMastery.MaxBonus", 4.0D); }
|
public double getBonusDamageAxesBonusMax() { return config.getDouble("Skills.Axes.DamageIncrease.MaxBonus", 4.0D); }
|
||||||
public int getAxeMasteryMaxBonusLevel() { return config.getInt("Skills.Axes.AxeMastery.MaxBonusLevel", 200); }
|
public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease.MaxBonusLevel", 200); }
|
||||||
|
|
||||||
public double getCriticalHitPVPModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVP_Modifier", 1.5D); }
|
public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical.ChanceMax", 37.50D); }
|
||||||
public double getCriticalHitPVEModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVE_Modifier", 2.0D); }
|
public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical.MaxBonusLevel", 750); }
|
||||||
|
public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical.PVP_Modifier", 1.5D); }
|
||||||
|
public double getAxesCriticalPVEModifier() { return config.getDouble("Skills.Axes.AxesCritical.PVE_Modifier", 2.0D); }
|
||||||
|
|
||||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
||||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
||||||
@@ -671,8 +678,22 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
|
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
|
||||||
|
|
||||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
|
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
|
||||||
|
public double getGreenThumbChanceMax() { return config.getDouble("Skills.Herbalism.GreenThumb.ChanceMax", 100.0D); }
|
||||||
|
public int getGreenThumbMaxLevel() { return config.getInt("Skills.Herbalism.GreenThumb.MaxBonusLevel", 1500); }
|
||||||
|
|
||||||
|
public double getHerbalismDoubleDropsChanceMax() { return config.getDouble("Skills.Herbalism.DoubleDrops.ChanceMax", 100.0D); }
|
||||||
|
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
|
public double getHylianLuckChanceMax() { return config.getDouble("Skills.Herbalism.HylianLuck.ChanceMax", 10.0D); }
|
||||||
|
public int getHylianLuckMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
|
public double getShroomThumbChanceMax() { return config.getDouble("Skills.Herbalism.ShroomThumb.ChanceMax", 50.0D); }
|
||||||
|
public int getShroomThumbMaxLevel() { return config.getInt("Skills.Herbalism.ShroomThumb.MaxBonusLevel", 1500); }
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
|
public double getMiningDoubleDropChance() { return config.getDouble("Skills.Mining.DoubleDrops.ChanceMax", 100.0D); }
|
||||||
|
public int getMiningDoubleDropMaxLevel() { return config.getInt("Skills.Mining.DoubleDrops.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
public int getBlastMiningRankLevel(BlastMining.Tier tier) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + tier.toNumerical()); }
|
public int getBlastMiningRankLevel(BlastMining.Tier tier) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + tier.toNumerical()); }
|
||||||
public double getBlastDamageDecrease(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + tier.toNumerical()); }
|
public double getBlastDamageDecrease(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + tier.toNumerical()); }
|
||||||
public double getOreBonus(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + tier.toNumerical()); }
|
public double getOreBonus(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + tier.toNumerical()); }
|
||||||
@@ -683,6 +704,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
/* REPAIR */
|
/* REPAIR */
|
||||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); }
|
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); }
|
||||||
|
public double getSuperRepairChanceMax() { return config.getDouble("Skills.Repair.SuperRepair.ChanceMax", 100.0D); }
|
||||||
|
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair.MaxBonusLevel", 1000); }
|
||||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage.UnlockLevel", 600); }
|
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage.UnlockLevel", 600); }
|
||||||
|
|
||||||
/* Arcane Forging */
|
/* Arcane Forging */
|
||||||
@@ -698,6 +721,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); }
|
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); }
|
||||||
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
||||||
|
|
||||||
|
public int getSecondSmeltMaxLevel() { return config.getInt("Skills.Smelting.SecondSmelt.MaxBonusLevel", 1000); }
|
||||||
|
public double getSecondSmeltMaxChance() { return config.getDouble("Skills.Smelting.SecondSmelt.ChanceMax", 100.0D); }
|
||||||
|
|
||||||
public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }
|
public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }
|
||||||
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
|
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
|
||||||
|
|
||||||
@@ -706,16 +732,22 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getSmeltingVanillaXPBoostMultiplier(Smelting.Tier tier) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical()); }
|
public int getSmeltingVanillaXPBoostMultiplier(Smelting.Tier tier) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical()); }
|
||||||
|
|
||||||
/* SWORDS */
|
/* SWORDS */
|
||||||
|
public double getBleedChanceMax() { return config.getDouble("Skills.Swords.Bleed.ChanceMax", 75.0D); }
|
||||||
|
public int getBleedMaxBonusLevel() { return config.getInt("Skills.Swords.Bleed.MaxBonusLevel", 750); }
|
||||||
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed.MaxTicks", 3); }
|
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed.MaxTicks", 3); }
|
||||||
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed.BaseTicks", 2); }
|
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed.BaseTicks", 2); }
|
||||||
|
|
||||||
public boolean getCounterRequiresBlock() { return config.getBoolean("Skills.Swords.Counter.RequiresBlock"); }
|
public boolean getCounterRequiresBlock() { return config.getBoolean("Skills.Swords.Counter.RequiresBlock"); }
|
||||||
|
public double getCounterChanceMax() { return config.getDouble("Skills.Swords.Counter.ChanceMax", 30.0D); }
|
||||||
|
public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter.MaxBonusLevel", 600); }
|
||||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.Counter.DamageModifier", 2.0D); }
|
public double getCounterModifier() { return config.getDouble("Skills.Swords.Counter.DamageModifier", 2.0D); }
|
||||||
|
|
||||||
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
||||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.BleedTicks", 5); }
|
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.BleedTicks", 5); }
|
||||||
|
|
||||||
/* TAMING */
|
/* TAMING */
|
||||||
|
public double getGoreChanceMax() { return config.getDouble("Skills.Taming.Gore.ChanceMax", 100.0D); }
|
||||||
|
public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore.MaxBonusLevel", 1000); }
|
||||||
public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore.BleedTicks", 2); }
|
public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore.BleedTicks", 2); }
|
||||||
public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
|
public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
|
||||||
|
|
||||||
@@ -738,14 +770,25 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||||
|
|
||||||
/* UNARMED */
|
/* UNARMED */
|
||||||
|
public double getDisarmChanceMax() { return config.getDouble("Skills.Unarmed.Disarm.ChanceMax", 33.0D); }
|
||||||
|
public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
|
public double getDeflectChanceMax() { return config.getDouble("Skills.Unarmed.Deflect.ChanceMax", 50.0D); }
|
||||||
|
public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
|
public double getIronGripChanceMax() { return config.getDouble("Skills.Unarmed.IronGrip.ChanceMax", 100.0D); }
|
||||||
|
public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
public double getIronArmMinBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMin", 3.0D); }
|
public double getIronArmMinBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMin", 3.0D); }
|
||||||
public double getIronArmMaxBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMax", 8.0D); }
|
public double getIronArmMaxBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMax", 8.0D); }
|
||||||
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm.IncreaseLevel", 50); }
|
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm.IncreaseLevel", 50); }
|
||||||
public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
|
|
||||||
|
|
||||||
/* WOODCUTTING */
|
/* WOODCUTTING */
|
||||||
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); }
|
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); }
|
||||||
|
|
||||||
|
public double getWoodcuttingDoubleDropChance() { return config.getDouble("Skills.Woodcutting.DoubleDrops.ChanceMax", 100.0D); }
|
||||||
|
public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops.MaxBonusLevel", 1000); }
|
||||||
|
|
||||||
/* KRAKEN STUFF */
|
/* KRAKEN STUFF */
|
||||||
public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); }
|
public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); }
|
||||||
public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); }
|
public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); }
|
||||||
|
|||||||
@@ -205,7 +205,6 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
|
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
|
||||||
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
|
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
|
||||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||||
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
|
|
||||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||||
public boolean getConfigOverwriteEnabled() { return config.getBoolean("General.Config_Update_Overwrite", true); }
|
public boolean getConfigOverwriteEnabled() { return config.getBoolean("General.Config_Update_Overwrite", true); }
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
byte blockData = Byte.valueOf(blockInfo[1]);
|
||||||
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
||||||
blockList.add(blockMaterialData);
|
blockList.add(blockMaterialData);
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ public interface DatabaseManager {
|
|||||||
public void purgePowerlessUsers();
|
public void purgePowerlessUsers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge users who haven't logged on in over a certain time frame from the
|
* Purge users who haven't logged on in over a certain time frame from the database.
|
||||||
* database.
|
|
||||||
*/
|
*/
|
||||||
public void purgeOldUsers();
|
public void purgeOldUsers();
|
||||||
|
|
||||||
@@ -43,13 +42,13 @@ public interface DatabaseManager {
|
|||||||
public boolean saveUser(PlayerProfile profile);
|
public boolean saveUser(PlayerProfile profile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve leaderboard info.
|
* Retrieve leaderboard info.
|
||||||
*
|
*
|
||||||
* @param skillName The skill to retrieve info on
|
* @param skillName The skill to retrieve info on
|
||||||
* @param pageNumber Which page in the leaderboards to retrieve
|
* @param pageNumber Which page in the leaderboards to retrieve
|
||||||
* @param statsPerPage The number of stats per page
|
* @param statsPerPage The number of stats per page
|
||||||
* @return the requested leaderboard information
|
* @return the requested leaderboard information
|
||||||
*/
|
*/
|
||||||
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage);
|
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,9 +74,9 @@ public interface DatabaseManager {
|
|||||||
*
|
*
|
||||||
* @param playerName The name of the player to load from the database
|
* @param playerName The name of the player to load from the database
|
||||||
* @param createNew Whether to create a new record if the player is not
|
* @param createNew Whether to create a new record if the player is not
|
||||||
* found
|
* found
|
||||||
* @return The player's data, or an unloaded PlayerProfile if not found
|
* @return The player's data, or an unloaded PlayerProfile if not found
|
||||||
* and createNew is false
|
* and createNew is false
|
||||||
*/
|
*/
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
|
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew);
|
||||||
|
|
||||||
@@ -97,17 +96,9 @@ public interface DatabaseManager {
|
|||||||
public void convertUsers(DatabaseManager destination);
|
public void convertUsers(DatabaseManager destination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the type of database in use. Custom databases should return
|
* Retrieve the type of database in use. Custom databases should return CUSTOM.
|
||||||
* CUSTOM.
|
|
||||||
*
|
*
|
||||||
* @return The type of database
|
* @return The type of database
|
||||||
*/
|
*/
|
||||||
public DatabaseType getDatabaseType();
|
public DatabaseType getDatabaseType();
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for database conversion. If this is set to true, profiles may not
|
|
||||||
* be loaded from the database. This method will be called before and
|
|
||||||
* after database imports.
|
|
||||||
*/
|
|
||||||
public void setLoadingDisabled(boolean state);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
||||||
private final File usersFile;
|
private final File usersFile;
|
||||||
private static final Object fileWritingLock = new Object();
|
private static final Object fileWritingLock = new Object();
|
||||||
private volatile boolean converting = false;
|
|
||||||
|
|
||||||
protected FlatfileDatabaseManager() {
|
protected FlatfileDatabaseManager() {
|
||||||
usersFile = new File(mcMMO.getUsersFilePath());
|
usersFile = new File(mcMMO.getUsersFilePath());
|
||||||
@@ -43,10 +42,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
updateLeaderboards();
|
updateLeaderboards();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingDisabled(boolean state) {
|
|
||||||
converting = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void purgePowerlessUsers() {
|
public void purgePowerlessUsers() {
|
||||||
int purgedUsers = 0;
|
int purgedUsers = 0;
|
||||||
|
|
||||||
@@ -374,10 +369,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||||
if (converting) {
|
|
||||||
return new PlayerProfile(playerName, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
String usersFilePath = mcMMO.getUsersFilePath();
|
||||||
|
|
||||||
|
|||||||
@@ -49,19 +49,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
// How many connection attempts have failed
|
// How many connection attempts have failed
|
||||||
private int reconnectAttempt = 0;
|
private int reconnectAttempt = 0;
|
||||||
|
|
||||||
// If we're importing users, do not allow creation of profiles
|
|
||||||
private volatile boolean converting = false;
|
|
||||||
|
|
||||||
protected SQLDatabaseManager() {
|
protected SQLDatabaseManager() {
|
||||||
checkStructure();
|
checkStructure();
|
||||||
|
|
||||||
new SQLDatabaseKeepaliveTask(this).runTaskTimerAsynchronously(mcMMO.p, 10, 60L * 60 * Misc.TICK_CONVERSION_FACTOR);
|
new SQLDatabaseKeepaliveTask(this).runTaskTimerAsynchronously(mcMMO.p, 10, 60L * 60 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingDisabled(boolean state) {
|
|
||||||
converting = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void purgePowerlessUsers() {
|
public void purgePowerlessUsers() {
|
||||||
if (!checkConnected()) {
|
if (!checkConnected()) {
|
||||||
return;
|
return;
|
||||||
@@ -353,16 +346,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||||
if (converting) {
|
|
||||||
return new PlayerProfile(playerName, false); // return unloaded profile during database conversion
|
|
||||||
}
|
|
||||||
|
|
||||||
return loadPlayerProfile(playerName, create, true);
|
return loadPlayerProfile(playerName, create, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadPlayerProfile(String playerName, boolean create, boolean retry) {
|
private PlayerProfile loadPlayerProfile(String playerName, boolean create, boolean retry) {
|
||||||
if (!checkConnected()) {
|
if (!checkConnected()) {
|
||||||
return new PlayerProfile(playerName, false); // return unloaded profile if not connected
|
return new PlayerProfile(playerName, false); // return fake profile if not connected
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.bukkit.Server;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@@ -88,13 +87,11 @@ public class McMMOPlayer {
|
|||||||
private Location teleportCommence;
|
private Location teleportCommence;
|
||||||
|
|
||||||
private boolean isUsingUnarmed;
|
private boolean isUsingUnarmed;
|
||||||
private final FixedMetadataValue playerMetadata;
|
|
||||||
|
|
||||||
public McMMOPlayer(Player player) {
|
public McMMOPlayer(Player player) {
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
playerMetadata = new FixedMetadataValue(mcMMO.p, playerName);
|
|
||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, true);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, true);
|
||||||
party = PartyManager.getPlayerParty(playerName);
|
party = PartyManager.getPlayerParty(playerName);
|
||||||
ptpRecord = new PartyTeleportRecord();
|
ptpRecord = new PartyTeleportRecord();
|
||||||
@@ -531,7 +528,7 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventUtils.handleXpGainEvent(player, skillType, xp)) {
|
if (!EventUtils.handleXpChangeEvent(player, skillType, xp, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,6 +757,10 @@ public class McMMOPlayer {
|
|||||||
ToolType tool = skill.getTool();
|
ToolType tool = skill.getTool();
|
||||||
AbilityType ability = skill.getAbility();
|
AbilityType ability = skill.getAbility();
|
||||||
|
|
||||||
|
if (!getToolPreparationMode(tool) || !ability.getPermissions(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, false);
|
setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
if (getAbilityMode(ability)) {
|
if (getAbilityMode(ability)) {
|
||||||
@@ -780,7 +781,7 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EventUtils.callPlayerAbilityActivateEvent(player, skill).isCancelled()) {
|
if (!EventUtils.handlePlayerAbilityActivateEvent(player, ability)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -916,8 +917,4 @@ public class McMMOPlayer {
|
|||||||
public void resetCooldowns() {
|
public void resetCooldowns() {
|
||||||
profile.resetCooldowns();
|
profile.resetCooldowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FixedMetadataValue getPlayerMetadata() {
|
|
||||||
return playerMetadata;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
|||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
public class PlayerProfile {
|
public class PlayerProfile {
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
private boolean loaded;
|
private boolean loaded;
|
||||||
@@ -34,7 +32,7 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
|
|
||||||
for (AbilityType abilityType : AbilityType.values()) {
|
for (AbilityType abilityType : AbilityType.NORMAL_ABILITIES) {
|
||||||
abilityDATS.put(abilityType, 0);
|
abilityDATS.put(abilityType, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +63,7 @@ public class PlayerProfile {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = !mcMMO.getDatabaseManager().saveUser(new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), mobHealthbarType));
|
changed = !mcMMO.getDatabaseManager().saveUser(this);
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public enum AbilityType {
|
public enum AbilityType {
|
||||||
BERSERK(
|
BERSERK(
|
||||||
"Unarmed.Skills.Berserk.On",
|
"Unarmed.Skills.Berserk.On",
|
||||||
@@ -69,7 +75,16 @@ public enum AbilityType {
|
|||||||
"Mining.Blast.Other.On",
|
"Mining.Blast.Other.On",
|
||||||
"Mining.Blast.Refresh",
|
"Mining.Blast.Refresh",
|
||||||
null),
|
null),
|
||||||
;
|
|
||||||
|
/**
|
||||||
|
* No cooldown - always active
|
||||||
|
*/
|
||||||
|
LEAF_BLOWER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not a first-class Ability - part of Berserk
|
||||||
|
*/
|
||||||
|
BLOCK_CRACKER;
|
||||||
|
|
||||||
private String abilityOn;
|
private String abilityOn;
|
||||||
private String abilityOff;
|
private String abilityOff;
|
||||||
@@ -77,6 +92,20 @@ public enum AbilityType {
|
|||||||
private String abilityRefresh;
|
private String abilityRefresh;
|
||||||
private String abilityPlayerOff;
|
private String abilityPlayerOff;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Those abilities that have a cooldown saved to the database.
|
||||||
|
*/
|
||||||
|
public static final List<AbilityType> NORMAL_ABILITIES = ImmutableList.of(BERSERK, BLAST_MINING, GIGA_DRILL_BREAKER, GREEN_TERRA, SERRATED_STRIKES, SKULL_SPLITTER, SUPER_BREAKER, TREE_FELLER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Those abilities that do not have a cooldown saved to the database.
|
||||||
|
*/
|
||||||
|
public static final List<AbilityType> NON_NORMAL_ABILITIES = ImmutableList.of(BLOCK_CRACKER, LEAF_BLOWER);
|
||||||
|
|
||||||
|
private AbilityType() {
|
||||||
|
this(null, null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
private AbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
private AbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||||
this.abilityOn = abilityOn;
|
this.abilityOn = abilityOn;
|
||||||
this.abilityOff = abilityOff;
|
this.abilityOff = abilityOff;
|
||||||
@@ -152,12 +181,18 @@ public enum AbilityType {
|
|||||||
case BLAST_MINING:
|
case BLAST_MINING:
|
||||||
return Permissions.remoteDetonation(player);
|
return Permissions.remoteDetonation(player);
|
||||||
|
|
||||||
|
case BLOCK_CRACKER:
|
||||||
|
return Permissions.blockCracker(player);
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
case GIGA_DRILL_BREAKER:
|
||||||
return Permissions.gigaDrillBreaker(player);
|
return Permissions.gigaDrillBreaker(player);
|
||||||
|
|
||||||
case GREEN_TERRA:
|
case GREEN_TERRA:
|
||||||
return Permissions.greenTerra(player);
|
return Permissions.greenTerra(player);
|
||||||
|
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
return Permissions.leafBlower(player);
|
||||||
|
|
||||||
case SERRATED_STRIKES:
|
case SERRATED_STRIKES:
|
||||||
return Permissions.serratedStrikes(player);
|
return Permissions.serratedStrikes(player);
|
||||||
|
|
||||||
@@ -186,12 +221,18 @@ public enum AbilityType {
|
|||||||
case BERSERK:
|
case BERSERK:
|
||||||
return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW);
|
return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW);
|
||||||
|
|
||||||
|
case BLOCK_CRACKER:
|
||||||
|
return BlockUtils.affectedByBlockCracker(blockState);
|
||||||
|
|
||||||
case GIGA_DRILL_BREAKER:
|
case GIGA_DRILL_BREAKER:
|
||||||
return BlockUtils.affectedByGigaDrillBreaker(blockState);
|
return BlockUtils.affectedByGigaDrillBreaker(blockState);
|
||||||
|
|
||||||
case GREEN_TERRA:
|
case GREEN_TERRA:
|
||||||
return BlockUtils.canMakeMossy(blockState);
|
return BlockUtils.canMakeMossy(blockState);
|
||||||
|
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
return BlockUtils.isLeaves(blockState);
|
||||||
|
|
||||||
case SUPER_BREAKER:
|
case SUPER_BREAKER:
|
||||||
return BlockUtils.affectedBySuperBreaker(blockState);
|
return BlockUtils.affectedBySuperBreaker(blockState);
|
||||||
|
|
||||||
@@ -202,4 +243,23 @@ public enum AbilityType {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if ability should be triggered.
|
||||||
|
*
|
||||||
|
* @param player The player using the ability
|
||||||
|
* @param block The block modified by the ability
|
||||||
|
* @return true if the ability should activate, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean triggerCheck(Player player, Block block) {
|
||||||
|
switch (this) {
|
||||||
|
case BERSERK:
|
||||||
|
case BLOCK_CRACKER:
|
||||||
|
case LEAF_BLOWER:
|
||||||
|
return blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
|
||||||
|
|
||||||
public enum SecondaryAbility {
|
|
||||||
/* ACROBATICS */
|
|
||||||
DODGE,
|
|
||||||
GRACEFUL_ROLL,
|
|
||||||
ROLL,
|
|
||||||
|
|
||||||
/* ARCHERY */
|
|
||||||
DAZE,
|
|
||||||
RETRIEVE,
|
|
||||||
SKILL_SHOT,
|
|
||||||
|
|
||||||
/* Axes */
|
|
||||||
ARMOR_IMPACT,
|
|
||||||
AXE_MASTERY,
|
|
||||||
CRITICAL_HIT,
|
|
||||||
GREATER_IMPACT,
|
|
||||||
|
|
||||||
/* Excavation */
|
|
||||||
EXCAVATION_TREASURE_HUNTER,
|
|
||||||
|
|
||||||
/* Fishing */
|
|
||||||
FISHERMANS_DIET,
|
|
||||||
FISHING_TREASURE_HUNTER,
|
|
||||||
ICE_FISHING,
|
|
||||||
MAGIC_HUNTER,
|
|
||||||
MASTER_ANGLER,
|
|
||||||
SHAKE,
|
|
||||||
|
|
||||||
/* Herbalism */
|
|
||||||
FARMERS_DIET,
|
|
||||||
GREEN_THUMB_PLANT,
|
|
||||||
GREEN_THUMB_BLOCK,
|
|
||||||
HERBALISM_DOUBLE_DROPS,
|
|
||||||
HYLIAN_LUCK,
|
|
||||||
SHROOM_THUMB,
|
|
||||||
|
|
||||||
/* Mining */
|
|
||||||
MINING_DOUBLE_DROPS,
|
|
||||||
|
|
||||||
/* Repair */
|
|
||||||
ARCANE_FORGING,
|
|
||||||
REPAIR_MASTERY,
|
|
||||||
SALVAGE,
|
|
||||||
SUPER_REPAIR,
|
|
||||||
|
|
||||||
/* Smelting */
|
|
||||||
FLUX_MINING,
|
|
||||||
FUEL_EFFICIENCY,
|
|
||||||
SECOND_SMELT,
|
|
||||||
|
|
||||||
/* Swords */
|
|
||||||
BLEED,
|
|
||||||
COUNTER,
|
|
||||||
|
|
||||||
/* Taming */
|
|
||||||
BEAST_LORE,
|
|
||||||
CALL_OF_THE_WILD,
|
|
||||||
ENVIROMENTALLY_AWARE,
|
|
||||||
FAST_FOOD,
|
|
||||||
GORE,
|
|
||||||
HOLY_HOUND,
|
|
||||||
SHARPENED_CLAWS,
|
|
||||||
SHOCK_PROOF,
|
|
||||||
THICK_FUR,
|
|
||||||
|
|
||||||
/* Unarmed */
|
|
||||||
BLOCK_CRACKER,
|
|
||||||
DEFLECT,
|
|
||||||
DISARM,
|
|
||||||
IRON_ARM,
|
|
||||||
IRON_GRIP,
|
|
||||||
|
|
||||||
/* Woodcutting */
|
|
||||||
LEAF_BLOWER,
|
|
||||||
WOODCUTTING_DOUBLE_DROPS;
|
|
||||||
}
|
|
||||||
@@ -34,25 +34,24 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public enum SkillType {
|
public enum SkillType {
|
||||||
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL)),
|
ACROBATICS(AcrobaticsManager.class, Color.WHITE),
|
||||||
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT)),
|
ARCHERY(ArcheryManager.class, Color.MAROON),
|
||||||
AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbility.ARMOR_IMPACT, SecondaryAbility.AXE_MASTERY, SecondaryAbility.CRITICAL_HIT, SecondaryAbility.GREATER_IMPACT)),
|
AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE),
|
||||||
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER)),
|
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL),
|
||||||
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
|
FISHING(FishingManager.class, Color.NAVY),
|
||||||
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
|
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE),
|
||||||
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE),
|
||||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SALVAGE, SecondaryAbility.SUPER_REPAIR)),
|
REPAIR(RepairManager.class, Color.SILVER),
|
||||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
SMELTING(SmeltingManager.class, Color.YELLOW),
|
||||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD),
|
||||||
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
|
TAMING(TamingManager.class, Color.PURPLE),
|
||||||
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
|
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS),
|
||||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
|
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE);
|
||||||
|
|
||||||
private Class<? extends SkillManager> managerClass;
|
private Class<? extends SkillManager> managerClass;
|
||||||
private Color runescapeColor;
|
private Color runescapeColor;
|
||||||
private AbilityType ability;
|
private AbilityType ability;
|
||||||
private ToolType tool;
|
private ToolType tool;
|
||||||
private List<SecondaryAbility> secondaryAbilities;
|
|
||||||
|
|
||||||
public static final List<String> SKILL_NAMES;
|
public static final List<String> SKILL_NAMES;
|
||||||
|
|
||||||
@@ -86,16 +85,18 @@ public enum SkillType {
|
|||||||
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbility> secondaryAbilities) {
|
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor) {
|
||||||
this(managerClass, runescapeColor, null, null, secondaryAbilities);
|
this.managerClass = managerClass;
|
||||||
|
this.runescapeColor = runescapeColor;
|
||||||
|
ability = null;
|
||||||
|
tool = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
|
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool) {
|
||||||
this.managerClass = managerClass;
|
this.managerClass = managerClass;
|
||||||
this.runescapeColor = runescapeColor;
|
this.runescapeColor = runescapeColor;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
this.secondaryAbilities = secondaryAbilities;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends SkillManager> getManagerClass() {
|
public Class<? extends SkillManager> getManagerClass() {
|
||||||
@@ -147,10 +148,6 @@ public enum SkillType {
|
|||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SecondaryAbility> getSkillAbilities() {
|
|
||||||
return secondaryAbilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getXpModifier() {
|
public double getXpModifier() {
|
||||||
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
|
||||||
}
|
}
|
||||||
@@ -188,15 +185,6 @@ public enum SkillType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) {
|
|
||||||
for (SkillType type : values()) {
|
|
||||||
if (type.getSkillAbilities().contains(skillAbility)) {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SkillType byAbility(AbilityType ability) {
|
public static SkillType byAbility(AbilityType ability) {
|
||||||
for (SkillType type : values()) {
|
for (SkillType type : values()) {
|
||||||
if (type.getAbility() == ability) {
|
if (type.getAbility() == ability) {
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
package com.gmail.nossr50.events.abilities;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
public class McMMOPlayerAbilityActivateEvent extends McMMOPlayerAbilityEvent implements Cancellable {
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public McMMOPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
public McMMOPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
||||||
super(player, skill);
|
super(player, skill);
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public McMMOPlayerAbilityActivateEvent(Player player, AbilityType ability) {
|
||||||
|
super(player, ability);
|
||||||
|
cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
package com.gmail.nossr50.events.abilities;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerAbilityEvent {
|
||||||
|
@Deprecated
|
||||||
public McMMOPlayerAbilityDeactivateEvent(Player player, SkillType skill) {
|
public McMMOPlayerAbilityDeactivateEvent(Player player, SkillType skill) {
|
||||||
super(player, skill);
|
super(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public McMMOPlayerAbilityDeactivateEvent(Player player, AbilityType ability) {
|
||||||
|
super(player, ability);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.gmail.nossr50.events.abilities;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerAbilityEvent extends PlayerEvent {
|
||||||
|
private SkillType skill;
|
||||||
|
private AbilityType ability;
|
||||||
|
private boolean useParticleEffects;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
protected McMMOPlayerAbilityEvent(Player player, SkillType skill) {
|
||||||
|
super(player);
|
||||||
|
ability = skill.getAbility();
|
||||||
|
useParticleEffects = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected McMMOPlayerAbilityEvent(Player player, AbilityType ability) {
|
||||||
|
super(player);
|
||||||
|
this.ability = ability;
|
||||||
|
this.useParticleEffects = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected McMMOPlayerAbilityEvent(Player player, AbilityType ability, boolean useParticleEffects) {
|
||||||
|
super(player);
|
||||||
|
this.ability = ability;
|
||||||
|
this.useParticleEffects = useParticleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public SkillType getSkill() {
|
||||||
|
return skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityType getAbility() {
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean useParticleEffects() {
|
||||||
|
return useParticleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shouldUseParticleEffects(boolean useParticleEffects) {
|
||||||
|
this.useParticleEffects = useParticleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Rest of file is required boilerplate for custom events **/
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience.levels;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.experience.McMMOPlayerExperienceEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a user levels change
|
* Called when a user levels change
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience.levels;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience.levels;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50.events.experience.xp;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.experience.McMMOPlayerExperienceEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerXpChangeEvent extends McMMOPlayerExperienceEvent {
|
||||||
|
public McMMOPlayerXpChangeEvent(Player player, SkillType skill) {
|
||||||
|
super(player, skill);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.gmail.nossr50.events.experience;
|
package com.gmail.nossr50.events.experience.xp;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
|||||||
/**
|
/**
|
||||||
* Called when a player gains XP in a skill
|
* Called when a player gains XP in a skill
|
||||||
*/
|
*/
|
||||||
public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
public class McMMOPlayerXpGainEvent extends McMMOPlayerXpChangeEvent {
|
||||||
private float xpGained;
|
private float xpGained;
|
||||||
|
|
||||||
public McMMOPlayerXpGainEvent(Player player, SkillType skill, float xpGained) {
|
public McMMOPlayerXpGainEvent(Player player, SkillType skill, float xpGained) {
|
||||||
@@ -31,7 +31,7 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param xpGained int amount of experience gained in this event
|
* @param xpGained float amount of experience gained in this event
|
||||||
*/
|
*/
|
||||||
public void setRawXpGained(float xpGained) {
|
public void setRawXpGained(float xpGained) {
|
||||||
this.xpGained = xpGained;
|
this.xpGained = xpGained;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.gmail.nossr50.events.experience.xp;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
|
public class McMMOPlayerXpLossEvent extends McMMOPlayerXpChangeEvent {
|
||||||
|
private float xpLost;
|
||||||
|
|
||||||
|
public McMMOPlayerXpLossEvent(Player player, SkillType skill, float xpLost) {
|
||||||
|
super(player, skill);
|
||||||
|
this.xpLost = xpLost;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The amount of experience lost in this event
|
||||||
|
*/
|
||||||
|
public float getRawXpLost() {
|
||||||
|
return xpLost;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param xpLost amount of experience lost in this event
|
||||||
|
*/
|
||||||
|
public void setRawXpLost(float xpLost) {
|
||||||
|
this.xpLost = xpLost;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.gmail.nossr50.events.skills;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerCombatEvent extends FakeEntityDamageByEntityEvent {
|
||||||
|
private Player player;
|
||||||
|
private SkillType skill;
|
||||||
|
private int skillLevel;
|
||||||
|
|
||||||
|
protected McMMOPlayerCombatEvent(Player player, Entity damager, Entity damagee, DamageCause cause, double damage, SkillType skill) {
|
||||||
|
super(damager, damagee, cause, damage);
|
||||||
|
this.player = player;
|
||||||
|
this.skill = skill;
|
||||||
|
skillLevel = UserManager.getPlayer(player).getProfile().getSkillLevel(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected McMMOPlayerCombatEvent(Player player, Entity damagee, DamageCause cause, double damage, SkillType skill) {
|
||||||
|
super(player, damagee, cause, damage);
|
||||||
|
this.player = player;
|
||||||
|
this.skill = skill;
|
||||||
|
skillLevel = UserManager.getPlayer(player).getProfile().getSkillLevel(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkillType getSkill() {
|
||||||
|
return skill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSkillLevel() {
|
||||||
|
return skillLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.gmail.nossr50.events.skills;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerTreasureEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
private ItemStack treasure;
|
||||||
|
private int xpGained;
|
||||||
|
|
||||||
|
protected McMMOPlayerTreasureEvent(Player player, SkillType skill, ItemStack treasure, int xpGained) {
|
||||||
|
super(player, skill);
|
||||||
|
this.treasure = treasure;
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
this.cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getTreasure() {
|
||||||
|
return treasure;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTreasure(ItemStack item) {
|
||||||
|
this.treasure = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getXpGained() {
|
||||||
|
return xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXpGained(int xpGained) {
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean newValue) {
|
||||||
|
this.cancelled = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.gmail.nossr50.events.skills.abilities;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
|
||||||
|
|
||||||
public class McMMOPlayerAbilityEvent extends McMMOPlayerSkillEvent {
|
|
||||||
private AbilityType ability;
|
|
||||||
|
|
||||||
protected McMMOPlayerAbilityEvent(Player player, SkillType skill) {
|
|
||||||
super(player, skill);
|
|
||||||
ability = skill.getAbility();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbilityType getAbility() {
|
|
||||||
return ability;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.acrobatics;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerAcrobaticsEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
protected McMMOPlayerAcrobaticsEvent(Player player) {
|
||||||
|
super(player, SkillType.ACROBATICS);
|
||||||
|
cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.acrobatics;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerDodgeEvent extends McMMOPlayerAcrobaticsEvent {
|
||||||
|
private double damageTaken;
|
||||||
|
private float xpGained;
|
||||||
|
|
||||||
|
public McMMOPlayerDodgeEvent(Player player, double damageTaken, float xpGained) {
|
||||||
|
super(player);
|
||||||
|
this.damageTaken = damageTaken;
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDamageTaken() {
|
||||||
|
return damageTaken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDamageTaken(double damageTaken) {
|
||||||
|
this.damageTaken = damageTaken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getXpGained() {
|
||||||
|
return xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXpGained(float xpGained) {
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.acrobatics;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerRollEvent extends McMMOPlayerAcrobaticsEvent {
|
||||||
|
private double damageTaken;
|
||||||
|
private float xpGained;
|
||||||
|
private boolean graceful;
|
||||||
|
|
||||||
|
public McMMOPlayerRollEvent(Player player, double damageTaken, float xpGained, boolean graceful) {
|
||||||
|
super(player);
|
||||||
|
this.damageTaken = damageTaken;
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
this.graceful = graceful;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDamageTaken() {
|
||||||
|
return damageTaken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDamageTaken(double damageTaken) {
|
||||||
|
this.damageTaken = damageTaken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getXpGained() {
|
||||||
|
return xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXpGained(float xpGained) {
|
||||||
|
this.xpGained = xpGained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGraceful() {
|
||||||
|
return graceful;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.archery;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerCombatEvent;
|
||||||
|
|
||||||
|
public class McMMOPlayerArcheryCombatEvent extends McMMOPlayerCombatEvent {
|
||||||
|
public McMMOPlayerArcheryCombatEvent(Player player, Entity damager, Entity damagee, DamageCause cause, double damage) {
|
||||||
|
super(player, damager, damagee, cause, damage, SkillType.ARCHERY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.archery;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerArcheryEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
protected McMMOPlayerArcheryEvent(Player player) {
|
||||||
|
super(player, SkillType.ARCHERY);
|
||||||
|
cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.archery;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
|
|
||||||
|
public class McMMOPlayerDazeEvent extends McMMOPlayerArcheryCombatEvent {
|
||||||
|
public McMMOPlayerDazeEvent(Player player, Entity damager, Entity damagee) {
|
||||||
|
super(player, damager, damagee, DamageCause.PROJECTILE, Archery.dazeModifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.archery;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerSkillShotEvent extends McMMOPlayerArcheryCombatEvent {
|
||||||
|
public McMMOPlayerSkillShotEvent(Player player, Entity damager, Entity damagee, double damage) {
|
||||||
|
super(player, damager, damagee, DamageCause.PROJECTILE, damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerCombatEvent;
|
||||||
|
|
||||||
|
public class McMMOPlayerAxeCombatEvent extends McMMOPlayerCombatEvent {
|
||||||
|
public McMMOPlayerAxeCombatEvent(Player player, Entity damagee, DamageCause cause, double damage) {
|
||||||
|
super(player, damagee, cause, damage, SkillType.AXES);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerAxeEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
protected McMMOPlayerAxeEvent(Player player) {
|
||||||
|
super(player, SkillType.AXES);
|
||||||
|
cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerAxeMasteryEvent extends McMMOPlayerAxeCombatEvent {
|
||||||
|
public McMMOPlayerAxeMasteryEvent(Player player, Entity damagee, double damage) {
|
||||||
|
super(player, damagee, DamageCause.ENTITY_ATTACK, damage);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerCriticalHitEvent extends McMMOPlayerAxeCombatEvent {
|
||||||
|
public McMMOPlayerCriticalHitEvent(Player player, Entity damagee, double damage) {
|
||||||
|
super(player, damagee, DamageCause.ENTITY_ATTACK, damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class McMMOPlayerGreaterImpactEvent extends McMMOPlayerAxeCombatEvent {
|
||||||
|
private Vector knockbackVelocity;
|
||||||
|
|
||||||
|
public McMMOPlayerGreaterImpactEvent(Player player, Entity damagee, double damage, Vector knockbackVelocity) {
|
||||||
|
super(player, damagee, DamageCause.ENTITY_ATTACK, damage);
|
||||||
|
this.knockbackVelocity = knockbackVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector getKnockbackVelocity() {
|
||||||
|
return knockbackVelocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKnockbackVelocity(Vector knockbackVelocity) {
|
||||||
|
this.knockbackVelocity = knockbackVelocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.axes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class McMMOPlayerImpactEvent extends McMMOPlayerAxeEvent {
|
||||||
|
private ItemStack armor;
|
||||||
|
|
||||||
|
public McMMOPlayerImpactEvent(Player player, ItemStack armor) {
|
||||||
|
super(player);
|
||||||
|
this.armor = armor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getArmor() {
|
||||||
|
return armor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.excavation;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerTreasureEvent;
|
||||||
|
|
||||||
|
public class McMMOPlayerExcavationTreasureEvent extends McMMOPlayerTreasureEvent {
|
||||||
|
private Block block;
|
||||||
|
|
||||||
|
public McMMOPlayerExcavationTreasureEvent(Player player, ItemStack treasure, int xpGained, Block block) {
|
||||||
|
super(player, SkillType.EXCAVATION, treasure, xpGained);
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getBlock() {
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.fishing;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerCombatEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerFishingCombatEvent extends McMMOPlayerCombatEvent {
|
||||||
|
public McMMOPlayerFishingCombatEvent(Player player, Entity damager, Entity damagee, DamageCause cause, double damage) {
|
||||||
|
super(player, damager, damagee, cause, damage, SkillType.FISHING);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,29 +3,11 @@ package com.gmail.nossr50.events.skills.fishing;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class McMMOPlayerFishingTreasureEvent extends McMMOPlayerFishingEvent {
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
private ItemStack treasure;
|
import com.gmail.nossr50.events.skills.McMMOPlayerTreasureEvent;
|
||||||
private int xp;
|
|
||||||
|
|
||||||
public McMMOPlayerFishingTreasureEvent(Player player, ItemStack treasure, int xp) {
|
public class McMMOPlayerFishingTreasureEvent extends McMMOPlayerTreasureEvent {
|
||||||
super(player);
|
public McMMOPlayerFishingTreasureEvent(Player player, ItemStack treasure, int xpGained) {
|
||||||
this.treasure = treasure;
|
super(player, SkillType.FISHING, treasure, xpGained);
|
||||||
this.xp = xp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getTreasure() {
|
|
||||||
return treasure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTreasure(ItemStack item) {
|
|
||||||
this.treasure = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getXp() {
|
|
||||||
return xp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXp(int xp) {
|
|
||||||
this.xp = xp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package com.gmail.nossr50.events.skills.fishing;
|
package com.gmail.nossr50.events.skills.fishing;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Fish;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class McMMOPlayerShakeEvent extends McMMOPlayerFishingEvent {
|
public class McMMOPlayerShakeEvent extends McMMOPlayerFishingCombatEvent {
|
||||||
private ItemStack drop;
|
private ItemStack drop;
|
||||||
|
|
||||||
public McMMOPlayerShakeEvent(Player player, ItemStack drop) {
|
public McMMOPlayerShakeEvent(Player player, Fish hook, ItemStack drop, LivingEntity target, double damage) {
|
||||||
super(player);
|
super(player, hook, target, DamageCause.PROJECTILE, damage);
|
||||||
this.drop = drop;
|
this.drop = drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.herbalism;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerHerbalismEvent extends McMMOPlayerSkillEvent {
|
||||||
|
public McMMOPlayerHerbalismEvent(Player player) {
|
||||||
|
super(player, SkillType.HERBALISM);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
|
||||||
|
|
||||||
public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
|
|
||||||
|
|
||||||
private SecondaryAbility secondaryAbility;
|
|
||||||
|
|
||||||
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
|
|
||||||
super(player, SkillType.bySecondaryAbility(secondaryAbility));
|
|
||||||
this.secondaryAbility = secondaryAbility;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the SecondaryAbility involved in the event
|
|
||||||
* @return the SecondaryAbility
|
|
||||||
*/
|
|
||||||
public SecondaryAbility getSecondaryAbility() {
|
|
||||||
return secondaryAbility;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
|
|
||||||
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
|
|
||||||
|
|
||||||
private double chance;
|
|
||||||
|
|
||||||
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
|
|
||||||
super(player, ability);
|
|
||||||
this.chance = chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
|
|
||||||
* @return The activation chance of the ability
|
|
||||||
*/
|
|
||||||
public double getChance() {
|
|
||||||
return chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the activation chance of the ability [0D-1.0D]
|
|
||||||
* @param The activation chance of the ability
|
|
||||||
*/
|
|
||||||
public void setChance(double chance) {
|
|
||||||
this.chance = chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the activation chance of the ability to 100% or 0%
|
|
||||||
* @param whether it should be successful or not
|
|
||||||
*/
|
|
||||||
public void setSuccessful(boolean success) {
|
|
||||||
this.chance = success ? 1.0D : 0D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.unarmed;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class McMMOPlayerDeflectEvent extends McMMOPlayerUnarmedEvent {
|
||||||
|
public McMMOPlayerDeflectEvent(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +1,27 @@
|
|||||||
package com.gmail.nossr50.events.skills.unarmed;
|
package com.gmail.nossr50.events.skills.unarmed;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
public class McMMOPlayerDisarmEvent extends McMMOPlayerUnarmedEvent {
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
|
||||||
|
|
||||||
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
|
||||||
private boolean cancelled;
|
|
||||||
private Player defender;
|
private Player defender;
|
||||||
|
private ItemStack droppedItem;
|
||||||
|
|
||||||
public McMMOPlayerDisarmEvent(Player defender) {
|
public McMMOPlayerDisarmEvent(Player attacker, Player defender) {
|
||||||
super(defender, SkillType.UNARMED);
|
super(attacker);
|
||||||
this.defender = defender;
|
this.defender = defender;
|
||||||
|
this.setDroppedItem(defender.getItemInHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getDefender() {
|
public Player getDefender() {
|
||||||
return defender;
|
return defender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Following are required for Cancellable **/
|
public ItemStack getDroppedItem() {
|
||||||
@Override
|
return droppedItem;
|
||||||
public boolean isCancelled() {
|
|
||||||
return cancelled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setDroppedItem(ItemStack droppedItem) {
|
||||||
public void setCancelled(boolean cancelled) {
|
this.droppedItem = droppedItem;
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.gmail.nossr50.events.skills.unarmed;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
|
|
||||||
|
public abstract class McMMOPlayerUnarmedEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
protected McMMOPlayerUnarmedEvent(Player player) {
|
||||||
|
super(player, SkillType.UNARMED);
|
||||||
|
cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,6 @@ import com.gmail.nossr50.config.HiddenConfig;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||||
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
|
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
|
||||||
@@ -36,7 +35,6 @@ import com.gmail.nossr50.skills.mining.MiningManager;
|
|||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -145,21 +143,17 @@ public class BlockListener implements Listener {
|
|||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
if (BlockUtils.affectedByGreenTerra(blockState) && Permissions.skillEnabled(player, SkillType.HERBALISM)) {
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
if (herbalismManager.canActivateAbility()) {
|
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||||
* Instead, we check it inside the drops handler.
|
* Instead, we check it inside the drops handler.
|
||||||
*/
|
*/
|
||||||
if (SkillType.HERBALISM.getPermissions(player)) {
|
herbalismManager.blockBreak(blockState);
|
||||||
herbalismManager.herbalismBlockCheck(blockState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MINING */
|
/* MINING */
|
||||||
@@ -183,7 +177,7 @@ public class BlockListener implements Listener {
|
|||||||
/* EXCAVATION */
|
/* EXCAVATION */
|
||||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && SkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && SkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||||
excavationManager.excavationBlockCheck(blockState);
|
excavationManager.blockBreak(blockState);
|
||||||
|
|
||||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||||
excavationManager.gigaDrillBreaker(blockState);
|
excavationManager.gigaDrillBreaker(blockState);
|
||||||
@@ -280,19 +274,19 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
if (ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState))) {
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
else if (ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState)) {
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.WOODCUTTING);
|
mcMMOPlayer.checkAbilityActivation(SkillType.WOODCUTTING);
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
else if (ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState)) {
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.MINING);
|
mcMMOPlayer.checkAbilityActivation(SkillType.MINING);
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
else if (ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState)) {
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.EXCAVATION);
|
mcMMOPlayer.checkAbilityActivation(SkillType.EXCAVATION);
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
else if (heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState))) {
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED);
|
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,22 +329,22 @@ public class BlockListener implements Listener {
|
|||||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||||
*/
|
*/
|
||||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
if (mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
||||||
if (mcMMOPlayer.getHerbalismManager().processGreenTerra(blockState)) {
|
if (mcMMOPlayer.getHerbalismManager().greenTerra(blockState)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
|
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
|
||||||
if (AbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
if (AbilityType.BERSERK.triggerCheck(player, block)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
player.playSound(block.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && AbilityType.BLOCK_CRACKER.triggerCheck(player, block)) {
|
||||||
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && AbilityType.LEAF_BLOWER.triggerCheck(player, block)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
player.playSound(blockState.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
player.playSound(blockState.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,10 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
|
||||||
import com.gmail.nossr50.skills.archery.Archery;
|
import com.gmail.nossr50.skills.archery.Archery;
|
||||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||||
@@ -76,7 +74,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
||||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation())));
|
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@@ -88,7 +86,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0));
|
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0));
|
||||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation())));
|
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,16 +235,8 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
event.setDamage(mcMMOPlayer.getAcrobaticsManager().roll(event.getDamage()));
|
||||||
|
event.setCancelled(event.getDamage() == 0);
|
||||||
if (acrobaticsManager.canRoll()) {
|
|
||||||
event.setDamage(acrobaticsManager.rollCheck(event.getDamage()));
|
|
||||||
|
|
||||||
if (event.getDamage() == 0) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_EXPLOSION:
|
case BLOCK_EXPLOSION:
|
||||||
@@ -516,7 +506,7 @@ public class EntityListener implements Listener {
|
|||||||
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||||
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||||
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
if (Permissions.farmersDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -525,20 +515,20 @@ public class EntityListener implements Listener {
|
|||||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
if (Permissions.farmersDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
if (Permissions.fishermansDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().fishermansDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
if (Permissions.fishermansDiet(player)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().fishermansDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
|
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@@ -43,7 +43,7 @@ public class InventoryListener implements Listener {
|
|||||||
Block furnaceBlock = Misc.processInventoryOpenorCloseEvent(event);
|
Block furnaceBlock = Misc.processInventoryOpenorCloseEvent(event);
|
||||||
|
|
||||||
if (furnaceBlock != null && !furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
if (furnaceBlock != null && !furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, new FixedMetadataValue(plugin, player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = Misc.getPlayerFromFurnace(furnaceBlock);
|
Player player = Misc.getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
|
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -36,7 +35,6 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
|
|||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.ShareHandler;
|
import com.gmail.nossr50.party.ShareHandler;
|
||||||
@@ -213,24 +211,15 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case FISHING:
|
case FISHING:
|
||||||
if (!Permissions.krakenBypass(player)) {
|
event.setCancelled(fishingManager.exploitPrevention());
|
||||||
event.setCancelled(fishingManager.exploitPrevention());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
|
event.setExpToDrop(fishingManager.vanillaXpBoost(event.getExpToDrop()));
|
||||||
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case IN_GROUND:
|
case IN_GROUND:
|
||||||
Block block = player.getTargetBlock(null, 100);
|
event.setCancelled(fishingManager.iceFishing(event.getHook(), player.getTargetBlock(null, 100)));
|
||||||
|
|
||||||
if (fishingManager.canIceFish(block)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
fishingManager.iceFishing(event.getHook(), block);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -259,9 +248,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case FISHING:
|
case FISHING:
|
||||||
if (fishingManager.canMasterAngler()) {
|
fishingManager.masterAngler(event.getHook());
|
||||||
fishingManager.masterAngler(event.getHook());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
@@ -269,9 +256,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case CAUGHT_ENTITY:
|
case CAUGHT_ENTITY:
|
||||||
if (fishingManager.canShake(caught)) {
|
fishingManager.shake(event.getHook(), caught);
|
||||||
fishingManager.shakeCheck((LivingEntity) caught);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -300,14 +285,6 @@ public class PlayerListener implements Listener {
|
|||||||
Item drop = event.getItem();
|
Item drop = event.getItem();
|
||||||
ItemStack dropStack = drop.getItemStack();
|
ItemStack dropStack = drop.getItemStack();
|
||||||
|
|
||||||
if (drop.hasMetadata(mcMMO.disarmedItemKey)) {
|
|
||||||
if (!player.getName().equals(drop.getMetadata(mcMMO.disarmedItemKey).get(0).value())) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
||||||
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
||||||
|
|
||||||
@@ -441,14 +418,13 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* SALVAGE CHECKS */
|
||||||
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
|
else if (type == Repair.salvageAnvilMaterial && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
||||||
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
||||||
repairManager.handleSalvage(block.getLocation(), heldItem);
|
repairManager.handleSalvage(block.getLocation(), heldItem);
|
||||||
player.updateInventory();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,7 +455,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* SALVAGE CHECKS */
|
||||||
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
|
else if (type == Repair.salvageAnvilMaterial && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
|
|
||||||
// Cancel salvaging an enchanted item
|
// Cancel salvaging an enchanted item
|
||||||
@@ -539,12 +515,8 @@ public class PlayerListener implements Listener {
|
|||||||
/* GREEN THUMB CHECK */
|
/* GREEN THUMB CHECK */
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
if (herbalismManager.greenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||||
player.setItemInHand(new ItemStack(Material.SEEDS, heldItem.getAmount() - 1));
|
blockState.update(true);
|
||||||
|
|
||||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
|
||||||
blockState.update(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SHROOM THUMB CHECK */
|
/* SHROOM THUMB CHECK */
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
import com.gmail.nossr50.events.abilities.McMMOPlayerAbilityActivateEvent;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
import com.gmail.nossr50.events.experience.levels.McMMOPlayerLevelUpEvent;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
import com.gmail.nossr50.events.experience.xp.McMMOPlayerXpGainEvent;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
|
|
||||||
public class ScoreboardsListener implements Listener {
|
public class ScoreboardsListener implements Listener {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
import com.gmail.nossr50.events.experience.levels.McMMOPlayerLevelUpEvent;
|
||||||
|
|
||||||
public class SelfListener implements Listener {
|
public class SelfListener implements Listener {
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public final static String bowForceKey = "mcMMO: Bow Force";
|
public final static String bowForceKey = "mcMMO: Bow Force";
|
||||||
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
||||||
public final static String customDamageKey = "mcMMO: Custom Damage";
|
public final static String customDamageKey = "mcMMO: Custom Damage";
|
||||||
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
|
||||||
|
|
||||||
public static FixedMetadataValue metadataValue;
|
public static FixedMetadataValue metadataValue;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class SaveTimerTask extends BukkitRunnable {
|
|||||||
int count = 1;
|
int count = 1;
|
||||||
|
|
||||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||||
new PlayerProfileSaveTask(mcMMOPlayer.getProfile()).runTaskLaterAsynchronously(mcMMO.p, count);
|
new PlayerProfileSaveTask(mcMMOPlayer.getProfile()).runTaskLater(mcMMO.p, count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,13 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class CleanBackupsTask extends BukkitRunnable {
|
public class CleanBackupsTask extends BukkitRunnable {
|
||||||
private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator;
|
private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator;
|
||||||
@@ -22,7 +21,7 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Integer> savedDays = new ArrayList<Integer>();
|
List<Integer> savedDays = new ArrayList<Integer>();
|
||||||
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<Integer, List<Integer>>();
|
List<Integer> savedWeeks = new ArrayList<Integer>();
|
||||||
List<File> toDelete = new ArrayList<File>();
|
List<File> toDelete = new ArrayList<File>();
|
||||||
int amountTotal = 0;
|
int amountTotal = 0;
|
||||||
int amountDeleted = 0;
|
int amountDeleted = 0;
|
||||||
@@ -52,29 +51,20 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
cal.setTime(date);
|
cal.setTime(date);
|
||||||
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
||||||
int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
|
int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
|
||||||
int year = cal.get(Calendar.YEAR);
|
|
||||||
|
|
||||||
if (isPast24Hours(date) && Config.getInstance().getKeepLast24Hours()) {
|
if (isPast24Hours(date) && Config.getInstance().getKeepLast24Hours()) {
|
||||||
// Keep all files from the last 24 hours
|
// Keep all files from the last 24 hours
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
|
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
|
||||||
// Keep daily backups of the past week
|
// Keep daily backups of the past week
|
||||||
savedDays.add(dayOfWeek);
|
savedDays.add(dayOfWeek);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else if (!savedWeeks.contains(weekOfYear) && Config.getInstance().getKeepWeeklyPastMonth()) {
|
||||||
List<Integer> savedWeeks = savedYearsWeeks.get(year);
|
// Keep one backup of each week
|
||||||
if (savedWeeks == null) {
|
savedWeeks.add(weekOfYear);
|
||||||
savedWeeks = new ArrayList<Integer>();
|
continue;
|
||||||
savedYearsWeeks.put(year, savedWeeks);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!savedWeeks.contains(weekOfYear) && Config.getInstance().getKeepWeeklyPastMonth()) {
|
|
||||||
// Keep one backup of each week
|
|
||||||
savedWeeks.add(weekOfYear);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
amountDeleted++;
|
amountDeleted++;
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.gmail.nossr50.runnables.database;
|
package com.gmail.nossr50.runnables.database;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
|
|
||||||
public class DatabaseConversionTask extends BukkitRunnable {
|
public class DatabaseConversionTask extends BukkitRunnable {
|
||||||
private final DatabaseManager sourceDatabase;
|
private final DatabaseManager sourceDatabase;
|
||||||
@@ -23,24 +20,12 @@ public class DatabaseConversionTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
||||||
sourceDatabase.setLoadingDisabled(true);
|
|
||||||
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
sourceDatabase.setLoadingDisabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, new Runnable() {
|
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
|
|
||||||
// Reload all users from the new database
|
|
||||||
UserManager.clearAll();
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
||||||
UserManager.addUser(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
@@ -46,18 +45,11 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.callAbilityDeactivateEvent(player, ability);
|
EventUtils.handleAbilityDeactivateEvent(player, ability);
|
||||||
|
|
||||||
mcMMOPlayer.setAbilityMode(ability, false);
|
mcMMOPlayer.setAbilityMode(ability, false);
|
||||||
mcMMOPlayer.setAbilityInformed(ability, false);
|
mcMMOPlayer.setAbilityInformed(ability, false);
|
||||||
|
|
||||||
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
|
||||||
|
|
||||||
if (mcMMOPlayer.useChatNotifications()) {
|
|
||||||
player.sendMessage(ability.getAbilityOff());
|
|
||||||
}
|
|
||||||
|
|
||||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayerOff(player));
|
|
||||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ public abstract class SkillManager {
|
|||||||
return mcMMOPlayer.getSkillLevel(skill);
|
return mcMMOPlayer.getSkillLevel(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getActivationChance() {
|
||||||
|
return activationChance;
|
||||||
|
}
|
||||||
|
|
||||||
public void applyXpGain(float xp) {
|
public void applyXpGain(float xp) {
|
||||||
mcMMOPlayer.beginXpGain(skill, xp);
|
mcMMOPlayer.beginXpGain(skill, xp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,17 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
|
||||||
public final class Acrobatics {
|
public final class Acrobatics {
|
||||||
public static double rollThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
public static int dodgeMaxBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel();
|
||||||
public static double gracefulRollThreshold = AdvancedConfig.getInstance().getGracefulRollDamageThreshold();
|
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
||||||
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
public static double dodgeMaxChance = AdvancedConfig.getInstance().getDodgeChanceMax();
|
||||||
|
|
||||||
|
public static int rollMaxBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel();
|
||||||
|
public static double rollThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||||
|
public static double rollMaxChance = AdvancedConfig.getInstance().getRollChanceMax();
|
||||||
|
|
||||||
|
public static int gracefulRollMaxBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel();
|
||||||
|
public static double gracefulRollThreshold = AdvancedConfig.getInstance().getGracefulRollDamageThreshold();
|
||||||
|
public static double gracefulRollMaxChance = AdvancedConfig.getInstance().getGracefulRollChanceMax();
|
||||||
|
|
||||||
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
|
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
|
||||||
public static int rollXpModifier = ExperienceConfig.getInstance().getRollXPModifier();
|
public static int rollXpModifier = ExperienceConfig.getInstance().getRollXPModifier();
|
||||||
@@ -19,11 +27,11 @@ public final class Acrobatics {
|
|||||||
|
|
||||||
private Acrobatics() {};
|
private Acrobatics() {};
|
||||||
|
|
||||||
protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
protected static double calculateModifiedDodgeDamage(double damage) {
|
||||||
return Math.max(damage / damageModifier, 1.0);
|
return Math.max(damage / dodgeDamageModifier, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static double calculateModifiedRollDamage(double damage, double damageThreshold) {
|
protected static double calculateModifiedRollDamage(double damage, boolean isGraceful) {
|
||||||
return Math.max(damage - damageThreshold, 0.0);
|
return Math.max(damage - (isGraceful ? gracefulRollThreshold : rollThreshold), 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import org.bukkit.entity.LightningStrike;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.acrobatics.McMMOPlayerDodgeEvent;
|
||||||
|
import com.gmail.nossr50.events.skills.acrobatics.McMMOPlayerRollEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@@ -28,47 +30,11 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRoll() {
|
public boolean canRoll() {
|
||||||
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ROLL);
|
return !exploitPrevention() && Permissions.roll(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDodge(Entity damager) {
|
private boolean canDodge(Entity damager, double modifiedDamage) {
|
||||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
|
return (Permissions.dodge(getPlayer()) && !(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) && skill.shouldProcess(damager) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel) && !isFatal(modifiedDamage));
|
||||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return skill.shouldProcess(damager);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the damage reduction and XP gain from the Dodge ability
|
|
||||||
*
|
|
||||||
* @param damage The amount of damage initially dealt by the event
|
|
||||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
|
||||||
*/
|
|
||||||
public double dodgeCheck(double damage) {
|
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
|
||||||
Player player = getPlayer();
|
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.DODGE, player, getSkillLevel(), activationChance)) {
|
|
||||||
ParticleEffectUtils.playDodgeEffect(player);
|
|
||||||
|
|
||||||
if (mcMMOPlayer.useChatNotifications()) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Why do we check respawn cooldown here?
|
|
||||||
if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier));
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifiedDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
return damage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,47 +43,28 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
*/
|
*/
|
||||||
public double rollCheck(double damage) {
|
public double roll(double damage) {
|
||||||
|
if (!canRoll()) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
boolean isGraceful = player.isSneaking() && Permissions.gracefulRoll(player);
|
||||||
|
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, isGraceful);
|
||||||
|
|
||||||
if (player.isSneaking() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL)) {
|
if (!isFatal(modifiedDamage) && isSuccessfulRoll(isGraceful)) {
|
||||||
return gracefulRollCheck(damage);
|
McMMOPlayerRollEvent event = new McMMOPlayerRollEvent(player, modifiedDamage, calculateRollXP(damage, true), isGraceful);
|
||||||
}
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
|
if (event.isCancelled()) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.ROLL, player, getSkillLevel(), activationChance)) {
|
return event.getDamageTaken();
|
||||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
|
||||||
applyXpGain(calculateRollXP(damage, true));
|
|
||||||
|
|
||||||
return modifiedDamage;
|
|
||||||
}
|
|
||||||
else if (!isFatal(damage)) {
|
|
||||||
applyXpGain(calculateRollXP(damage, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
lastFallLocation = player.getLocation();
|
|
||||||
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the damage reduction and XP gain from the Graceful Roll ability
|
|
||||||
*
|
|
||||||
* @param damage The amount of damage initially dealt by the event
|
|
||||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
|
||||||
*/
|
|
||||||
private double gracefulRollCheck(double damage) {
|
|
||||||
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
|
|
||||||
|
|
||||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.GRACEFUL_ROLL, getPlayer(), getSkillLevel(), activationChance)) {
|
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
|
|
||||||
applyXpGain(calculateRollXP(damage, true));
|
|
||||||
|
|
||||||
return modifiedDamage;
|
|
||||||
}
|
}
|
||||||
else if (!isFatal(damage)) {
|
else if (!isFatal(damage)) {
|
||||||
applyXpGain(calculateRollXP(damage, false));
|
applyXpGain(calculateRollXP(damage, false));
|
||||||
|
lastFallLocation = player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
@@ -150,8 +97,47 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
return fallTries > Config.getInstance().getAcrobaticsAFKMaxTries();
|
return fallTries > Config.getInstance().getAcrobaticsAFKMaxTries();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFatal(double damage) {
|
/**
|
||||||
return getPlayer().getHealth() - damage <= 0;
|
* Handle the damage reduction and XP gain from the Dodge ability
|
||||||
|
*
|
||||||
|
* @param damager The entity that dealt the damage
|
||||||
|
* @param damage The amount of damage initially dealt by the event
|
||||||
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
|
*/
|
||||||
|
public double dodge(Entity damager, double damage) {
|
||||||
|
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage);
|
||||||
|
|
||||||
|
if (!canDodge(damager, modifiedDamage)) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
McMMOPlayerDodgeEvent event = new McMMOPlayerDodgeEvent(player, modifiedDamage, (float) (damage * Acrobatics.dodgeXpModifier));
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleEffectUtils.playDodgeEffect(player);
|
||||||
|
|
||||||
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||||
|
applyXpGain(event.getXpGained());
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.getDamageTaken();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSuccessfulRoll(boolean isGraceful) {
|
||||||
|
double maxChance = isGraceful ? Acrobatics.gracefulRollMaxChance : Acrobatics.rollMaxChance;
|
||||||
|
int maxLevel = isGraceful ? Acrobatics.gracefulRollMaxBonusLevel : Acrobatics.rollMaxBonusLevel;
|
||||||
|
|
||||||
|
return (maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) > Misc.getRandom().nextInt(activationChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float calculateRollXP(double damage, boolean isRoll) {
|
private float calculateRollXP(double damage, boolean isRoll) {
|
||||||
@@ -164,4 +150,8 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
|
|
||||||
return xp;
|
return xp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFatal(double damage) {
|
||||||
|
return getPlayer().getHealth() - damage < 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,39 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
|
||||||
public class Archery {
|
public class Archery {
|
||||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
private static Map<UUID, TrackedEntity> trackedEntities = new HashMap<UUID, TrackedEntity>();
|
||||||
|
|
||||||
|
public static int retrieveMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel();
|
||||||
|
public static double retrieveMaxChance = AdvancedConfig.getInstance().getRetrieveChanceMax();
|
||||||
|
|
||||||
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
|
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
|
||||||
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
|
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
|
||||||
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
|
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
|
||||||
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||||
|
|
||||||
|
public static int dazeMaxBonusLevel = AdvancedConfig.getInstance().getDazeMaxBonusLevel();
|
||||||
public static double dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
|
public static double dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
|
||||||
|
public static double dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax();
|
||||||
|
|
||||||
public static final double DISTANCE_XP_MULTIPLIER = 0.025;
|
public static final double DISTANCE_XP_MULTIPLIER = 0.025;
|
||||||
|
|
||||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
TrackedEntity trackedEntity = trackedEntities.get(livingEntity.getUniqueId());
|
||||||
if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) {
|
|
||||||
trackedEntity.incrementArrowCount();
|
if (trackedEntity != null) {
|
||||||
return;
|
trackedEntity.incrementArrowCount();
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addToTracker(livingEntity); // If the entity isn't tracked yet
|
addToTracker(livingEntity); // If the entity isn't tracked yet
|
||||||
@@ -40,11 +43,11 @@ public class Archery {
|
|||||||
TrackedEntity trackedEntity = new TrackedEntity(livingEntity);
|
TrackedEntity trackedEntity = new TrackedEntity(livingEntity);
|
||||||
|
|
||||||
trackedEntity.incrementArrowCount();
|
trackedEntity.incrementArrowCount();
|
||||||
trackedEntities.add(trackedEntity);
|
trackedEntities.put(livingEntity.getUniqueId(), trackedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void removeFromTracker(TrackedEntity trackedEntity) {
|
protected static void removeFromTracker(UUID id) {
|
||||||
trackedEntities.remove(trackedEntity);
|
trackedEntities.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,24 +56,14 @@ public class Archery {
|
|||||||
* @param livingEntity The entity hit by the arrows
|
* @param livingEntity The entity hit by the arrows
|
||||||
*/
|
*/
|
||||||
public static void arrowRetrievalCheck(LivingEntity livingEntity) {
|
public static void arrowRetrievalCheck(LivingEntity livingEntity) {
|
||||||
for (Iterator<TrackedEntity> entityIterator = trackedEntities.iterator(); entityIterator.hasNext();) {
|
UUID id = livingEntity.getUniqueId();
|
||||||
TrackedEntity trackedEntity = entityIterator.next();
|
TrackedEntity trackedEntity = trackedEntities.get(id);
|
||||||
|
|
||||||
if (trackedEntity.getID() == livingEntity.getUniqueId()) {
|
if (trackedEntity == null) {
|
||||||
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), trackedEntity.getArrowCount());
|
return;
|
||||||
entityIterator.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static Location stringToLocation(String location) {
|
Misc.dropItems(livingEntity.getLocation(), new ItemStack(Material.ARROW), trackedEntity.getArrowCount());
|
||||||
String[] values = location.split(",");
|
removeFromTracker(id);
|
||||||
|
|
||||||
return new Location(mcMMO.p.getServer().getWorld(values[0]), Double.parseDouble(values[1]), Double.parseDouble(values[2]), Double.parseDouble(values[3]), Float.parseFloat(values[4]), Float.parseFloat(values[5]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String locationToString(Location location) {
|
|
||||||
return location.getWorld().getName() + "," + location.getX() + "," + location.getY() + "," + location.getZ() + "," + location.getYaw() + "," + location.getPitch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,19 @@ import org.bukkit.entity.Arrow;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.archery.McMMOPlayerDazeEvent;
|
||||||
|
import com.gmail.nossr50.events.skills.archery.McMMOPlayerSkillShotEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class ArcheryManager extends SkillManager {
|
public class ArcheryManager extends SkillManager {
|
||||||
@@ -26,26 +25,14 @@ public class ArcheryManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, SkillType.ARCHERY);
|
super(mcMMOPlayer, SkillType.ARCHERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDaze(LivingEntity target) {
|
|
||||||
return target instanceof Player && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DAZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSkillShot() {
|
|
||||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SKILL_SHOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canRetrieveArrows() {
|
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.RETRIEVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate bonus XP awarded for Archery when hitting a far-away target.
|
* Calculate bonus XP awarded for Archery when hitting a far-away target.
|
||||||
*
|
*
|
||||||
* @param target The {@link LivingEntity} damaged by the arrow
|
* @param target The {@link LivingEntity} damaged by the arrow
|
||||||
* @param damager The {@link Entity} who shot the arrow
|
* @param damager The {@link Entity} who shot the arrow
|
||||||
*/
|
*/
|
||||||
public void distanceXpBonus(LivingEntity target, Entity damager) {
|
public void awardDistanceXpBonus(LivingEntity target, Entity damager) {
|
||||||
Location firedLocation = Archery.stringToLocation(damager.getMetadata(mcMMO.arrowDistanceKey).get(0).asString());
|
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
|
||||||
Location targetLocation = target.getLocation();
|
Location targetLocation = target.getLocation();
|
||||||
|
|
||||||
if (firedLocation.getWorld() != targetLocation.getWorld()) {
|
if (firedLocation.getWorld() != targetLocation.getWorld()) {
|
||||||
@@ -59,39 +46,52 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* Track arrows fired for later retrieval.
|
* Track arrows fired for later retrieval.
|
||||||
*
|
*
|
||||||
* @param target The {@link LivingEntity} damaged by the arrow
|
* @param target The {@link LivingEntity} damaged by the arrow
|
||||||
|
* @param arrow The {@link Arrow} that damaged the target
|
||||||
*/
|
*/
|
||||||
public void retrieveArrows(LivingEntity target) {
|
public void trackArrow(LivingEntity target, Arrow arrow) {
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.RETRIEVE, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!canTrackArrows(target, arrow)) {
|
||||||
Archery.incrementTrackerValue(target);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Archery.incrementTrackerValue(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the effects of the Daze ability
|
* Handle the effects of the Daze ability
|
||||||
*
|
*
|
||||||
* @param defender The {@link Player} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
* @param arrow The {@link Arrow} that was fired
|
* @param arrow The {@link Arrow} that was fired
|
||||||
*/
|
*/
|
||||||
public double daze(Player defender, Arrow arrow) {
|
public double daze(LivingEntity target, Arrow arrow) {
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!canDaze(target)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player attacker = getPlayer();
|
||||||
|
|
||||||
|
McMMOPlayerDazeEvent event = new McMMOPlayerDazeEvent(attacker, arrow, target);
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player defender = (Player) target;
|
||||||
Location dazedLocation = defender.getLocation();
|
Location dazedLocation = defender.getLocation();
|
||||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||||
|
|
||||||
defender.teleport(dazedLocation);
|
defender.teleport(dazedLocation);
|
||||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, Misc.TICK_CONVERSION_FACTOR * 10, 10));
|
||||||
|
|
||||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMOPlayer.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CombatUtils.callFakeDamageEvent(arrow, defender, DamageCause.PROJECTILE, Archery.dazeModifier);
|
return event.getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,9 +102,36 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param arrow The {@link Arrow} that was fired
|
* @param arrow The {@link Arrow} that was fired
|
||||||
*/
|
*/
|
||||||
public double skillShot(LivingEntity target, double damage, Arrow arrow) {
|
public double skillShot(LivingEntity target, double damage, Arrow arrow) {
|
||||||
|
if (!canUseSkillShot(target)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
McMMOPlayerSkillShotEvent event = new McMMOPlayerSkillShotEvent(getPlayer(), arrow, target, calculateSkillShotBonus(damage));
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.getDamage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private double calculateSkillShotBonus(double damage) {
|
||||||
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
|
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
|
||||||
double archeryBonus = Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
|
double archeryBonus = Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
|
||||||
|
|
||||||
return CombatUtils.callFakeDamageEvent(arrow, target, DamageCause.PROJECTILE, archeryBonus);
|
return archeryBonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canDaze(LivingEntity target) {
|
||||||
|
return target.isValid() && target instanceof Player && Permissions.daze(getPlayer()) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canUseSkillShot(LivingEntity target) {
|
||||||
|
return target.isValid() && getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(getPlayer(), skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canTrackArrows(LivingEntity target, Arrow arrow) {
|
||||||
|
return target.isValid() && Permissions.arrowRetrieval(getPlayer()) && !arrow.hasMetadata(mcMMO.infiniteArrowKey) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,15 +22,11 @@ public class TrackedEntity extends BukkitRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!livingEntity.isValid()) {
|
if (!livingEntity.isValid()) {
|
||||||
Archery.removeFromTracker(this);
|
Archery.removeFromTracker(id);
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LivingEntity getLivingEntity() {
|
|
||||||
return livingEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected UUID getID() {
|
protected UUID getID() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
|||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
|
||||||
public class Axes {
|
public class Axes {
|
||||||
public static double axeMasteryMaxBonus = AdvancedConfig.getInstance().getAxeMasteryBonusMax();
|
public static double bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax();
|
||||||
public static int axeMasteryMaxBonusLevel = AdvancedConfig.getInstance().getAxeMasteryMaxBonusLevel();
|
public static int bonusDamageMaxBonusLevel = AdvancedConfig.getInstance().getBonusDamageAxesMaxBonusLevel();
|
||||||
|
|
||||||
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier();
|
public static int criticalHitMaxBonusLevel = AdvancedConfig.getInstance().getAxesCriticalMaxBonusLevel();
|
||||||
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier();
|
public static double criticalHitMaxChance = AdvancedConfig.getInstance().getAxesCriticalChance();
|
||||||
|
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getAxesCriticalPVPModifier();
|
||||||
|
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getAxesCriticalPVEModifier();
|
||||||
|
|
||||||
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
|
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
|
||||||
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
|
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.events.skills.axes.McMMOPlayerAxeMasteryEvent;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
import com.gmail.nossr50.events.skills.axes.McMMOPlayerCriticalHitEvent;
|
||||||
|
import com.gmail.nossr50.events.skills.axes.McMMOPlayerGreaterImpactEvent;
|
||||||
|
import com.gmail.nossr50.events.skills.axes.McMMOPlayerImpactEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@@ -26,39 +26,24 @@ public class AxesManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, SkillType.AXES);
|
super(mcMMOPlayer, SkillType.AXES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseAxeMastery() {
|
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.AXE_MASTERY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canCriticalHit(LivingEntity target) {
|
|
||||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CRITICAL_HIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canImpact(LivingEntity target) {
|
|
||||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ARMOR_IMPACT) && Axes.hasArmor(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canGreaterImpact(LivingEntity target) {
|
|
||||||
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.GREATER_IMPACT) && !Axes.hasArmor(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
|
||||||
return target.isValid() && mcMMOPlayer.getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canActivateAbility() {
|
|
||||||
return mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the effects of the Axe Mastery ability
|
* Handle the effects of the Axe Mastery ability
|
||||||
*
|
*
|
||||||
* @param target The {@link LivingEntity} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
*/
|
*/
|
||||||
public double axeMastery(LivingEntity target) {
|
public double axeMastery(LivingEntity target) {
|
||||||
double axeBonus = Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
|
if (!canUseAxeMastery(target)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return CombatUtils.callFakeDamageEvent(getPlayer(), target, axeBonus);
|
McMMOPlayerAxeMasteryEvent event = new McMMOPlayerAxeMasteryEvent(getPlayer(), target, calculateAxeMasteryBonus());
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,24 +53,27 @@ public class AxesManager extends SkillManager {
|
|||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public double criticalHit(LivingEntity target, double damage) {
|
public double criticalHit(LivingEntity target, double damage) {
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.CRITICAL_HIT, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!canCriticalHit(target)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
player.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||||
|
|
||||||
if (target instanceof Player) {
|
boolean targetIsPlayer = target instanceof Player;
|
||||||
|
|
||||||
|
if (targetIsPlayer) {
|
||||||
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||||
|
|
||||||
damage = (damage * Axes.criticalHitPVPModifier) - damage;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
damage = (damage * Axes.criticalHitPVEModifier) - damage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CombatUtils.callFakeDamageEvent(player, target, damage);
|
McMMOPlayerCriticalHitEvent event = new McMMOPlayerCriticalHitEvent(player, target, calculateCriticalHitBonus(damage, targetIsPlayer));
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,16 +81,24 @@ public class AxesManager extends SkillManager {
|
|||||||
*
|
*
|
||||||
* @param target The {@link LivingEntity} being affected by Impact
|
* @param target The {@link LivingEntity} being affected by Impact
|
||||||
*/
|
*/
|
||||||
public void impactCheck(LivingEntity target) {
|
public void impact(LivingEntity target) {
|
||||||
|
if (!canImpact(target)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = getPlayer();
|
||||||
int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
|
int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
|
||||||
|
McMMOPlayerImpactEvent event;
|
||||||
|
|
||||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||||
if (ItemUtils.isArmor(armor)) {
|
if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||||
double chance = Axes.impactChance / activationChance;
|
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
|
||||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.ARMOR_IMPACT, chance);
|
|
||||||
|
event = new McMMOPlayerImpactEvent(player, armor);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
|
if (event.isCancelled()) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,17 +110,21 @@ public class AxesManager extends SkillManager {
|
|||||||
* @param target The {@link LivingEntity} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
*/
|
*/
|
||||||
public double greaterImpact(LivingEntity target) {
|
public double greaterImpact(LivingEntity target) {
|
||||||
double chance = Axes.greaterImpactChance / activationChance;
|
if (!canUseGreaterImpact(target)) {
|
||||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.GREATER_IMPACT, chance);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ((event.getChance() * activationChance) <= Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
McMMOPlayerGreaterImpactEvent event = new McMMOPlayerGreaterImpactEvent(player, target, Axes.greaterImpactBonusDamage, player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
target.setVelocity(event.getKnockbackVelocity());
|
||||||
|
|
||||||
if (mcMMOPlayer.useChatNotifications()) {
|
if (mcMMOPlayer.useChatNotifications()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||||
@@ -138,7 +138,7 @@ public class AxesManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CombatUtils.callFakeDamageEvent(player, target, Axes.greaterImpactBonusDamage);
|
return event.getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +147,31 @@ public class AxesManager extends SkillManager {
|
|||||||
* @param target The {@link LivingEntity} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public void skullSplitterCheck(LivingEntity target, double damage) {
|
public void skullSplitter(LivingEntity target, double damage) {
|
||||||
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
|
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double calculateAxeMasteryBonus() {
|
||||||
|
return Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double calculateCriticalHitBonus(double damage, boolean isPlayer) {
|
||||||
|
return (damage * (isPlayer ? Axes.criticalHitPVPModifier : Axes.criticalHitPVEModifier)) - damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canUseAxeMastery(LivingEntity target) {
|
||||||
|
return target.isValid() && Permissions.bonusDamage(getPlayer(), skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canCriticalHit(LivingEntity target) {
|
||||||
|
return target.isValid() && Permissions.criticalStrikes(getPlayer()) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canImpact(LivingEntity target) {
|
||||||
|
return target.isValid() && Axes.hasArmor(target) && Permissions.armorImpact(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canUseGreaterImpact(LivingEntity target) {
|
||||||
|
return target.isValid() && !Axes.hasArmor(target) && Permissions.greaterImpact(getPlayer()) && (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,16 @@ package com.gmail.nossr50.skills.excavation;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
|
import com.gmail.nossr50.events.skills.excavation.McMMOPlayerExcavationTreasureEvent;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -25,20 +28,30 @@ public class ExcavationManager extends SkillManager {
|
|||||||
*
|
*
|
||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void excavationBlockCheck(BlockState blockState) {
|
public void blockBreak(BlockState blockState) {
|
||||||
int xp = Excavation.getBlockXP(blockState);
|
int xp = Excavation.getBlockXP(blockState);
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {
|
if (Permissions.excavationTreasureHunter(getPlayer())) {
|
||||||
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
|
||||||
|
|
||||||
if (!treasures.isEmpty()) {
|
if (!treasures.isEmpty()) {
|
||||||
int skillLevel = getSkillLevel();
|
int skillLevel = getSkillLevel();
|
||||||
Location location = blockState.getLocation();
|
Location location = blockState.getLocation();
|
||||||
|
|
||||||
|
Player player = getPlayer();
|
||||||
|
Block block = blockState.getBlock();
|
||||||
|
|
||||||
for (ExcavationTreasure treasure : treasures) {
|
for (ExcavationTreasure treasure : treasures) {
|
||||||
if (skillLevel >= treasure.getDropLevel() && SkillUtils.treasureDropSuccessful(getPlayer(), treasure.getDropChance(), activationChance)) {
|
if (skillLevel >= treasure.getDropLevel() && SkillUtils.treasureDropSuccessful(treasure.getDropChance(), activationChance)) {
|
||||||
xp += treasure.getXp();
|
McMMOPlayerExcavationTreasureEvent event = new McMMOPlayerExcavationTreasureEvent(player, treasure.getDrop(), treasure.getXp(), block);
|
||||||
Misc.dropItem(location, treasure.getDrop());
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
xp += event.getXpGained();
|
||||||
|
Misc.dropItem(location, event.getTreasure());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,8 +66,8 @@ public class ExcavationManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void gigaDrillBreaker(BlockState blockState) {
|
public void gigaDrillBreaker(BlockState blockState) {
|
||||||
excavationBlockCheck(blockState);
|
blockBreak(blockState);
|
||||||
excavationBlockCheck(blockState);
|
blockBreak(blockState);
|
||||||
|
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||||
@@ -49,7 +48,6 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@@ -75,14 +73,6 @@ public class FishingManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, SkillType.FISHING);
|
super(mcMMOPlayer, SkillType.FISHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canShake(Entity target) {
|
|
||||||
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SHAKE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canMasterAngler() {
|
|
||||||
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.MASTER_ANGLER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean unleashTheKraken() {
|
public boolean unleashTheKraken() {
|
||||||
return unleashTheKraken(true);
|
return unleashTheKraken(true);
|
||||||
}
|
}
|
||||||
@@ -163,11 +153,13 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean exploitPrevention() {
|
public boolean exploitPrevention() {
|
||||||
if (!AdvancedConfig.getInstance().getKrakenEnabled()) {
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
if (Permissions.krakenBypass(player) || !AdvancedConfig.getInstance().getKrakenEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||||
|
|
||||||
if (!targetBlock.isLiquid()) {
|
if (!targetBlock.isLiquid()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -188,30 +180,197 @@ public class FishingManager extends SkillManager {
|
|||||||
return unleashTheKraken(false);
|
return unleashTheKraken(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canIceFish(Block block) {
|
/**
|
||||||
if (getSkillLevel() < AdvancedConfig.getInstance().getIceFishingUnlockLevel()) {
|
* Handle the Fisherman's Diet ability
|
||||||
|
*
|
||||||
|
* @param rankChange The # of levels to change rank for the food
|
||||||
|
* @param eventFoodLevel The initial change in hunger from the event
|
||||||
|
*
|
||||||
|
* @return the modified change in hunger for the event
|
||||||
|
*/
|
||||||
|
public int fishermansDiet(int rankChange, int eventFoodLevel) {
|
||||||
|
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean iceFishing(Fish hook, Block block) {
|
||||||
|
if (!canIceFish(block)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.getType() != Material.ICE) {
|
// Make a hole
|
||||||
return false;
|
block.setType(Material.STATIONARY_WATER);
|
||||||
|
|
||||||
|
for (BlockFace face : BlockFace.values()) {
|
||||||
|
Block relative = block.getRelative(face);
|
||||||
|
|
||||||
|
if (relative.getType() == Material.ICE) {
|
||||||
|
relative.setType(Material.STATIONARY_WATER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this is a body of water, not just a block of ice.
|
// Recast in the new spot
|
||||||
Biome biome = block.getBiome();
|
return !EventUtils.callFakeFishEvent(getPlayer(), hook).isCancelled();
|
||||||
boolean isFrozenBiome = (biome == Biome.FROZEN_OCEAN || biome == Biome.FROZEN_RIVER || biome == Biome.TAIGA || biome == Biome.TAIGA_HILLS || biome == Biome.ICE_PLAINS || biome == Biome.ICE_MOUNTAINS);
|
}
|
||||||
|
|
||||||
if (!isFrozenBiome && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) {
|
public void masterAngler(Fish hook) {
|
||||||
return false;
|
if (!canUseMasterAngler()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
Location location = hook.getLocation();
|
||||||
|
Biome biome = location.getBlock().getBiome();
|
||||||
|
double biteChance = hook.getBiteChance();
|
||||||
|
|
||||||
if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ICE_FISHING)) {
|
hookLocation = location;
|
||||||
return false;
|
|
||||||
|
if (biome == Biome.RIVER || biome == Biome.OCEAN) {
|
||||||
|
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
return EventUtils.simulateBlockBreak(block, player, false);
|
if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
|
||||||
|
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBoatModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
hook.setBiteChance(Math.min(biteChance, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the results from a successful fishing trip
|
||||||
|
*
|
||||||
|
* @param fishingCatch The {@link Item} initially caught
|
||||||
|
*/
|
||||||
|
public void handleFishing(Item fishingCatch) {
|
||||||
|
this.fishingCatch = fishingCatch;
|
||||||
|
int treasureXp = 0;
|
||||||
|
Player player = getPlayer();
|
||||||
|
FishingTreasure treasure = null;
|
||||||
|
|
||||||
|
if (Config.getInstance().getFishingDropsEnabled() && Permissions.fishingTreasureHunter(player)) {
|
||||||
|
treasure = getFishingTreasure();
|
||||||
|
this.fishingCatch = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (treasure != null) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.ItemFound"));
|
||||||
|
|
||||||
|
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
||||||
|
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||||
|
|
||||||
|
if (Permissions.magicHunter(player) && ItemUtils.isEnchantable(treasureDrop)) {
|
||||||
|
enchants = handleMagicHunter(treasureDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
McMMOPlayerFishingTreasureEvent event = EventUtils.callFishingTreasureEvent(player, treasureDrop, treasure.getXp(), enchants);
|
||||||
|
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
treasureDrop = event.getTreasure();
|
||||||
|
treasureXp = event.getXpGained();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
treasureDrop = null;
|
||||||
|
treasureXp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop the original catch at the feet of the player and set the treasure as the real catch
|
||||||
|
if (treasureDrop != null) {
|
||||||
|
boolean enchanted = false;
|
||||||
|
|
||||||
|
if (!enchants.isEmpty()) {
|
||||||
|
treasureDrop.addUnsafeEnchantments(enchants);
|
||||||
|
enchanted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enchanted) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.MagicFound"));
|
||||||
|
}
|
||||||
|
|
||||||
|
fishingCatch.setItemStack(treasureDrop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyXpGain(ExperienceConfig.getInstance().getFishingBaseXP() + treasureXp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the vanilla XP boost for Fishing
|
||||||
|
*
|
||||||
|
* @param experience The amount of experience initially awarded by the event
|
||||||
|
*
|
||||||
|
* @return the modified event experience
|
||||||
|
*/
|
||||||
|
public int vanillaXpBoost(int experience) {
|
||||||
|
return experience * (Permissions.vanillaXpBoost(getPlayer(), skill) ? getVanillaXpMultiplier() : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getHookLocation() {
|
||||||
|
return hookLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Shake ability
|
||||||
|
*
|
||||||
|
* @param entity The {@link Entity} affected by the ability
|
||||||
|
*/
|
||||||
|
public void shake(Fish hook, Entity entity) {
|
||||||
|
if (!canShake(entity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fishingTries--; // Because autoclicking to shake is OK.
|
||||||
|
|
||||||
|
LivingEntity target = (LivingEntity) entity;
|
||||||
|
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
||||||
|
|
||||||
|
if (possibleDrops == null || possibleDrops.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack drop = Fishing.chooseDrop(possibleDrops);
|
||||||
|
|
||||||
|
// It's possible that chooseDrop returns null if the sum of probability in possibleDrops is inferior than 100
|
||||||
|
if (drop == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extra processing depending on the mob and drop type
|
||||||
|
switch (target.getType()) {
|
||||||
|
case SHEEP:
|
||||||
|
Sheep sheep = (Sheep) target;
|
||||||
|
drop = new Wool(sheep.getColor()).toItemStack(drop.getAmount());
|
||||||
|
sheep.setSheared(true);
|
||||||
|
|
||||||
|
case SKELETON:
|
||||||
|
if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) {
|
||||||
|
switch (drop.getType()) {
|
||||||
|
case SKULL_ITEM:
|
||||||
|
drop.setDurability((short) 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ARROW:
|
||||||
|
drop.setType(Material.COAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
McMMOPlayerShakeEvent event = new McMMOPlayerShakeEvent(getPlayer(), hook, drop, target, Math.max(target.getMaxHealth() / 4, 1)); // TODO: Config option for shake damage
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Misc.dropItem(target.getLocation(), event.getDrop());
|
||||||
|
CombatUtils.dealDamage(target, event.getDamage());
|
||||||
|
applyXpGain(ExperienceConfig.getInstance().getFishingShakeXP());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,201 +407,6 @@ public class FishingManager extends SkillManager {
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the Fisherman's Diet ability
|
|
||||||
*
|
|
||||||
* @param rankChange The # of levels to change rank for the food
|
|
||||||
* @param eventFoodLevel The initial change in hunger from the event
|
|
||||||
*
|
|
||||||
* @return the modified change in hunger for the event
|
|
||||||
*/
|
|
||||||
public int handleFishermanDiet(int rankChange, int eventFoodLevel) {
|
|
||||||
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void iceFishing(Fish hook, Block block) {
|
|
||||||
// Make a hole
|
|
||||||
block.setType(Material.STATIONARY_WATER);
|
|
||||||
|
|
||||||
for (int x = -1; x <= 1; x++) {
|
|
||||||
for (int z = -1; z <= 1; z++) {
|
|
||||||
Block relative = block.getRelative(x, 0, z);
|
|
||||||
|
|
||||||
if (relative.getType() == Material.ICE) {
|
|
||||||
relative.setType(Material.STATIONARY_WATER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recast in the new spot
|
|
||||||
EventUtils.callFakeFishEvent(getPlayer(), hook);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void masterAngler(Fish hook) {
|
|
||||||
Player player = getPlayer();
|
|
||||||
Location location = hook.getLocation();
|
|
||||||
Biome biome = location.getBlock().getBiome();
|
|
||||||
double biteChance = hook.getBiteChance();
|
|
||||||
|
|
||||||
hookLocation = location;
|
|
||||||
|
|
||||||
if (biome == Biome.RIVER || biome == Biome.OCEAN) {
|
|
||||||
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
|
|
||||||
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBoatModifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
hook.setBiteChance(Math.min(biteChance, 1.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process the results from a successful fishing trip
|
|
||||||
*
|
|
||||||
* @param fishingCatch The {@link Item} initially caught
|
|
||||||
*/
|
|
||||||
public void handleFishing(Item fishingCatch) {
|
|
||||||
this.fishingCatch = fishingCatch;
|
|
||||||
int treasureXp = 0;
|
|
||||||
Player player = getPlayer();
|
|
||||||
FishingTreasure treasure = null;
|
|
||||||
|
|
||||||
if (Config.getInstance().getFishingDropsEnabled() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER)) {
|
|
||||||
treasure = getFishingTreasure();
|
|
||||||
this.fishingCatch = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (treasure != null) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.ItemFound"));
|
|
||||||
|
|
||||||
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
|
||||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) {
|
|
||||||
enchants = handleMagicHunter(treasureDrop);
|
|
||||||
}
|
|
||||||
|
|
||||||
McMMOPlayerFishingTreasureEvent event = EventUtils.callFishingTreasureEvent(player, treasureDrop, treasure.getXp(), enchants);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
|
||||||
treasureDrop = event.getTreasure();
|
|
||||||
treasureXp = event.getXp();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
treasureDrop = null;
|
|
||||||
treasureXp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop the original catch at the feet of the player and set the treasure as the real catch
|
|
||||||
if (treasureDrop != null) {
|
|
||||||
boolean enchanted = false;
|
|
||||||
|
|
||||||
if (!enchants.isEmpty()) {
|
|
||||||
treasureDrop.addUnsafeEnchantments(enchants);
|
|
||||||
enchanted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enchanted) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.MagicFound"));
|
|
||||||
}
|
|
||||||
|
|
||||||
fishingCatch.setItemStack(treasureDrop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
applyXpGain(ExperienceConfig.getInstance().getFishingBaseXP() + treasureXp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the vanilla XP boost for Fishing
|
|
||||||
*
|
|
||||||
* @param experience The amount of experience initially awarded by the event
|
|
||||||
*
|
|
||||||
* @return the modified event damage
|
|
||||||
*/
|
|
||||||
public int handleVanillaXpBoost(int experience) {
|
|
||||||
return experience * getVanillaXpMultiplier();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getHookLocation() {
|
|
||||||
return hookLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the Shake ability
|
|
||||||
*
|
|
||||||
* @param target The {@link LivingEntity} affected by the ability
|
|
||||||
*/
|
|
||||||
public void shakeCheck(LivingEntity target) {
|
|
||||||
fishingTries--; // Because autoclicking to shake is OK.
|
|
||||||
|
|
||||||
SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.SHAKE, getShakeProbability() / activationChance);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
|
|
||||||
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
|
|
||||||
|
|
||||||
if (possibleDrops == null || possibleDrops.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack drop = Fishing.chooseDrop(possibleDrops);
|
|
||||||
|
|
||||||
// It's possible that chooseDrop returns null if the sum of probability in possibleDrops is inferior than 100
|
|
||||||
if (drop == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extra processing depending on the mob and drop type
|
|
||||||
switch (target.getType()) {
|
|
||||||
case SHEEP:
|
|
||||||
Sheep sheep = (Sheep) target;
|
|
||||||
|
|
||||||
if (drop.getType() == Material.WOOL) {
|
|
||||||
if (sheep.isSheared()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
drop = new Wool(sheep.getColor()).toItemStack(drop.getAmount());
|
|
||||||
sheep.setSheared(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SKELETON:
|
|
||||||
if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) {
|
|
||||||
switch (drop.getType()) {
|
|
||||||
case SKULL_ITEM:
|
|
||||||
drop.setDurability((short) 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ARROW:
|
|
||||||
drop.setType(Material.COAL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop);
|
|
||||||
|
|
||||||
drop = shakeEvent.getDrop();
|
|
||||||
|
|
||||||
if (shakeEvent.isCancelled() || drop == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Misc.dropItem(target.getLocation(), drop);
|
|
||||||
CombatUtils.dealDamage(target, Math.max(target.getMaxHealth() / 4, 1)); // Make it so you can shake a mob no more than 4 times.
|
|
||||||
applyXpGain(ExperienceConfig.getInstance().getFishingShakeXP());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the Treasure Hunter ability for Fishing
|
* Process the Treasure Hunter ability for Fishing
|
||||||
*
|
*
|
||||||
@@ -620,4 +584,34 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canShake(Entity target) {
|
||||||
|
return target.isValid() && target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.shake(getPlayer()) && getShakeProbability() > Misc.getRandom().nextInt(getActivationChance());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canUseMasterAngler() {
|
||||||
|
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.masterAngler(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canIceFish(Block block) {
|
||||||
|
if (getSkillLevel() < AdvancedConfig.getInstance().getIceFishingUnlockLevel() || block.getType() != Material.ICE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure this is a body of water, not just a block of ice.
|
||||||
|
Biome biome = block.getBiome();
|
||||||
|
boolean isFrozenBiome = (biome == Biome.FROZEN_OCEAN || biome == Biome.FROZEN_RIVER || biome == Biome.TAIGA || biome == Biome.TAIGA_HILLS || biome == Biome.ICE_PLAINS || biome == Biome.ICE_MOUNTAINS);
|
||||||
|
|
||||||
|
if (!isFrozenBiome || (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
if (!Permissions.iceFishing(player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EventUtils.simulateBlockBreak(block, player, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,18 @@ public class Herbalism {
|
|||||||
public static int greenThumbStageChangeLevel = AdvancedConfig.getInstance().getGreenThumbStageChange();
|
public static int greenThumbStageChangeLevel = AdvancedConfig.getInstance().getGreenThumbStageChange();
|
||||||
public static int greenThumbStageMaxLevel = greenThumbStageChangeLevel * 4;
|
public static int greenThumbStageMaxLevel = greenThumbStageChangeLevel * 4;
|
||||||
|
|
||||||
|
public static int greenThumbMaxLevel = AdvancedConfig.getInstance().getGreenThumbMaxLevel();
|
||||||
|
public static double greenThumbMaxChance = AdvancedConfig.getInstance().getGreenThumbChanceMax();
|
||||||
|
|
||||||
|
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
|
||||||
|
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
|
||||||
|
|
||||||
|
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLuckMaxLevel();
|
||||||
|
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
|
||||||
|
|
||||||
|
public static int shroomThumbMaxLevel = AdvancedConfig.getInstance().getShroomThumbMaxLevel();
|
||||||
|
public static double shroomThumbMaxChance = AdvancedConfig.getInstance().getShroomThumbChanceMax();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.gmail.nossr50.config.treasure.TreasureConfig;
|
|||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||||
@@ -57,11 +56,11 @@ public class HerbalismManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Material itemType = player.getItemInHand().getType();
|
Material itemType = player.getItemInHand().getType();
|
||||||
|
|
||||||
return (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
return (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.shroomThumb(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseHylianLuck() {
|
public boolean canUseHylianLuck() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.HYLIAN_LUCK);
|
return Permissions.hylianLuck(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||||
@@ -93,7 +92,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processGreenTerra(BlockState blockState) {
|
public boolean greenTerra(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (!Permissions.greenThumbBlock(player, blockState.getType())) {
|
if (!Permissions.greenThumbBlock(player, blockState.getType())) {
|
||||||
@@ -101,34 +100,29 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
ItemStack seed = new ItemStack(Material.SEEDS);
|
|
||||||
|
|
||||||
if (!playerInventory.containsAtLeast(seed, 1)) {
|
if (!playerInventory.contains(Material.SEEDS)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore"));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerInventory.removeItem(seed);
|
playerInventory.removeItem(new ItemStack(Material.SEEDS));
|
||||||
player.updateInventory(); // Needed until replacement available
|
player.updateInventory();
|
||||||
|
|
||||||
return Herbalism.convertGreenTerraBlocks(blockState);
|
return Herbalism.convertGreenTerraBlocks(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Process double drops & XP gain for Herbalism.
|
||||||
*
|
*
|
||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void herbalismBlockCheck(BlockState blockState) {
|
public void blockBreak(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.SUGAR_CANE_BLOCK);
|
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.SUGAR_CANE_BLOCK);
|
||||||
|
|
||||||
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
if (!canBlockCheck() || (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState))) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canBlockCheck()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +135,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
||||||
xp = customBlock.getXpGain();
|
xp = customBlock.getXpGain();
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {
|
if (Permissions.doubleDrops(player, skill) && customBlock.isDoubleDropEnabled()) {
|
||||||
drops = blockState.getBlock().getDrops();
|
drops = blockState.getBlock().getDrops();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +146,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
xp = ExperienceConfig.getInstance().getXp(skill, material);
|
xp = ExperienceConfig.getInstance().getXp(skill, material);
|
||||||
|
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
|
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.doubleDrops(player, skill)) {
|
||||||
drops = blockState.getBlock().getDrops();
|
drops = blockState.getBlock().getDrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +163,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.HERBALISM_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance)) {
|
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.doubleDropsMaxChance, Herbalism.doubleDropsMaxLevel)) {
|
||||||
for (ItemStack item : drops) {
|
for (ItemStack item : drops) {
|
||||||
Misc.dropItems(blockState.getLocation(), item, amount);
|
Misc.dropItems(blockState.getLocation(), item, amount);
|
||||||
}
|
}
|
||||||
@@ -183,8 +177,15 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
public boolean greenThumbBlocks(BlockState blockState) {
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.GREEN_THUMB_BLOCK, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!canGreenThumbBlock(blockState)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack heldItem = getPlayer().getItemInHand();
|
||||||
|
heldItem.setAmount(heldItem.getAmount() - 1);
|
||||||
|
|
||||||
|
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -199,7 +200,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @return true if the ability was successful, false otherwise
|
* @return true if the ability was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean processHylianLuck(BlockState blockState) {
|
public boolean processHylianLuck(BlockState blockState) {
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.HYLIAN_LUCK, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.hylianLuckMaxChance, Herbalism.hylianLuckMaxLevel)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +268,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.SHROOM_THUMB, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.shroomThumbMaxChance, Herbalism.shroomThumbMaxLevel)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -284,43 +285,35 @@ public class HerbalismManager extends SkillManager {
|
|||||||
private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) {
|
private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
ItemStack seed = null;
|
Material seed = null;
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case CARROT:
|
case CARROT:
|
||||||
seed = new ItemStack(Material.CARROT_ITEM);
|
seed = Material.CARROT_ITEM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CROPS:
|
case CROPS:
|
||||||
seed = new ItemStack(Material.SEEDS);
|
seed = Material.SEEDS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETHER_WARTS:
|
case NETHER_WARTS:
|
||||||
seed = new ItemStack(Material.NETHER_STALK);
|
seed = Material.NETHER_STALK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POTATO:
|
case POTATO:
|
||||||
seed = new ItemStack(Material.POTATO_ITEM);
|
seed = Material.POTATO_ITEM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playerInventory.containsAtLeast(seed, 1)) {
|
if (!playerInventory.contains(seed) || (!greenTerra && !SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) || !handleBlockState(blockState, greenTerra)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!greenTerra && !SkillUtils.activationSuccessful(SecondaryAbility.GREEN_THUMB_PLANT, getPlayer(), getSkillLevel(), activationChance)) {
|
playerInventory.removeItem(new ItemStack(seed));
|
||||||
return;
|
player.updateInventory();
|
||||||
}
|
|
||||||
|
|
||||||
if (!handleBlockState(blockState, greenTerra)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerInventory.removeItem(seed);
|
|
||||||
player.updateInventory(); // Needed until replacement available
|
|
||||||
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
|
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
@@ -11,6 +12,8 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.ModUtils;
|
import com.gmail.nossr50.util.ModUtils;
|
||||||
|
|
||||||
public class Mining {
|
public class Mining {
|
||||||
|
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getMiningDoubleDropMaxLevel();
|
||||||
|
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getMiningDoubleDropChance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate XP gain for Mining.
|
* Calculate XP gain for Mining.
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ import org.bukkit.block.BlockState;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||||
@@ -59,7 +60,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
applyXpGain(Mining.getBlockXp(blockState));
|
applyXpGain(Mining.getBlockXp(blockState));
|
||||||
|
|
||||||
if (!Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS)) {
|
if (!Permissions.doubleDrops(player, skill)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ public class MiningManager extends SkillManager {
|
|||||||
boolean silkTouch = player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
boolean silkTouch = player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
||||||
|
|
||||||
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.MINING_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance)) {
|
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||||
if (silkTouch) {
|
if (silkTouch) {
|
||||||
Mining.handleSilkTouchDrops(blockState);
|
Mining.handleSilkTouchDrops(blockState);
|
||||||
}
|
}
|
||||||
@@ -103,7 +104,7 @@ public class MiningManager extends SkillManager {
|
|||||||
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
||||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||||
|
|
||||||
tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
|
tnt.setMetadata(mcMMO.tntMetadataKey, new FixedMetadataValue(mcMMO.p, player.getName()));
|
||||||
tnt.setFuseTicks(0);
|
tnt.setFuseTicks(0);
|
||||||
targetBlock.setType(Material.AIR);
|
targetBlock.setType(Material.AIR);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public class Repair {
|
|||||||
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
||||||
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
||||||
|
|
||||||
|
public static int superRepairMaxBonusLevel = AdvancedConfig.getInstance().getSuperRepairMaxLevel();
|
||||||
|
public static double superRepairMaxChance = AdvancedConfig.getInstance().getSuperRepairChanceMax();
|
||||||
|
|
||||||
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
||||||
|
|
||||||
public static Material salvageAnvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
public static Material salvageAnvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@@ -168,7 +167,7 @@ public class RepairManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.getDurability() == 0) {
|
if (item.getDurability() == 0) {
|
||||||
player.setItemInHand(new ItemStack(Material.AIR));
|
player.setItemInHand(null);
|
||||||
location.setY(location.getY() + 1);
|
location.setY(location.getY() + 1);
|
||||||
|
|
||||||
Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
|
Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
|
||||||
@@ -274,12 +273,12 @@ public class RepairManager extends SkillManager {
|
|||||||
private short repairCalculate(short durability, int repairAmount) {
|
private short repairCalculate(short durability, int repairAmount) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY)) {
|
if (Permissions.repairMastery(player)) {
|
||||||
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
|
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
|
||||||
repairAmount += bonus;
|
repairAmount += bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR) && checkPlayerProcRepair()) {
|
if (Permissions.superRepair(player) && checkPlayerProcRepair()) {
|
||||||
repairAmount *= 2.0D;
|
repairAmount *= 2.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +295,7 @@ public class RepairManager extends SkillManager {
|
|||||||
* @return true if bonus granted, false otherwise
|
* @return true if bonus granted, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean checkPlayerProcRepair() {
|
private boolean checkPlayerProcRepair() {
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.SUPER_REPAIR, getPlayer(), getSkillLevel(), activationChance)) {
|
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Repair.superRepairMaxChance, Repair.superRepairMaxBonusLevel)) {
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -323,7 +322,7 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getArcaneForgingRank() == 0 || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING)) {
|
if (getArcaneForgingRank() == 0 || !Permissions.arcaneForging(player)) {
|
||||||
for (Enchantment enchant : enchants.keySet()) {
|
for (Enchantment enchant : enchants.keySet()) {
|
||||||
item.removeEnchantment(enchant);
|
item.removeEnchantment(enchant);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ public class Smelting {
|
|||||||
public static int burnModifierMaxLevel = AdvancedConfig.getInstance().getBurnModifierMaxLevel();
|
public static int burnModifierMaxLevel = AdvancedConfig.getInstance().getBurnModifierMaxLevel();
|
||||||
public static double burnTimeMultiplier = AdvancedConfig.getInstance().getBurnTimeMultiplier();
|
public static double burnTimeMultiplier = AdvancedConfig.getInstance().getBurnTimeMultiplier();
|
||||||
|
|
||||||
|
public static int secondSmeltMaxLevel = AdvancedConfig.getInstance().getSecondSmeltMaxLevel();
|
||||||
|
public static double secondSmeltMaxChance = AdvancedConfig.getInstance().getSecondSmeltMaxChance();
|
||||||
|
|
||||||
public static int fluxMiningUnlockLevel = AdvancedConfig.getInstance().getFluxMiningUnlockLevel();
|
public static int fluxMiningUnlockLevel = AdvancedConfig.getInstance().getFluxMiningUnlockLevel();
|
||||||
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
|
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
|
import com.gmail.nossr50.skills.mining.Mining;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@@ -25,11 +24,11 @@ public class SmeltingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseFluxMining(BlockState blockState) {
|
public boolean canUseFluxMining(BlockState blockState) {
|
||||||
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState);
|
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.fluxMining(getPlayer()) && !mcMMO.getPlaceStore().isTrue(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSecondSmeltSuccessful() {
|
public boolean isDoubleDropSuccessful() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SECOND_SMELT) && SkillUtils.activationSuccessful(SecondaryAbility.SECOND_SMELT, getPlayer(), getSkillLevel(), activationChance);
|
return Permissions.doubleDrops(getPlayer(), skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,9 +40,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
public boolean processFluxMining(BlockState blockState) {
|
public boolean processFluxMining(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.FLUX_MINING, Smelting.fluxMiningChance / activationChance);
|
if (Smelting.fluxMiningChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
@@ -63,7 +60,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1);
|
Misc.dropItems(blockState.getLocation(), item, isDoubleDropSuccessful() ? 2 : 1);
|
||||||
|
|
||||||
blockState.setType(Material.AIR);
|
blockState.setType(Material.AIR);
|
||||||
player.sendMessage(LocaleLoader.getString("Smelting.FluxMining.Success"));
|
player.sendMessage(LocaleLoader.getString("Smelting.FluxMining.Success"));
|
||||||
@@ -85,9 +82,11 @@ public class SmeltingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) {
|
public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) {
|
||||||
|
Player player = getPlayer();
|
||||||
|
|
||||||
applyXpGain(Smelting.getResourceXp(smelting));
|
applyXpGain(Smelting.getResourceXp(smelting));
|
||||||
|
|
||||||
if (isSecondSmeltSuccessful()) {
|
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Smelting.secondSmeltMaxChance, Smelting.secondSmeltMaxLevel)) {
|
||||||
ItemStack newResult = result.clone();
|
ItemStack newResult = result.clone();
|
||||||
|
|
||||||
newResult.setAmount(result.getAmount() + 1);
|
newResult.setAmount(result.getAmount() + 1);
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ package com.gmail.nossr50.skills.swords;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
|
||||||
public class Swords {
|
public class Swords {
|
||||||
|
public static int bleedMaxBonusLevel = AdvancedConfig.getInstance().getBleedMaxBonusLevel();
|
||||||
public static int bleedMaxTicks = AdvancedConfig.getInstance().getBleedMaxTicks();
|
public static int bleedMaxTicks = AdvancedConfig.getInstance().getBleedMaxTicks();
|
||||||
public static int bleedBaseTicks = AdvancedConfig.getInstance().getBleedBaseTicks();
|
public static int bleedBaseTicks = AdvancedConfig.getInstance().getBleedBaseTicks();
|
||||||
|
public static double bleedMaxChance = AdvancedConfig.getInstance().getBleedChanceMax();
|
||||||
|
|
||||||
public static boolean counterAttackRequiresBlock = AdvancedConfig.getInstance().getCounterRequiresBlock();
|
public static boolean counterAttackRequiresBlock = AdvancedConfig.getInstance().getCounterRequiresBlock();
|
||||||
|
public static int counterAttackMaxBonusLevel = AdvancedConfig.getInstance().getCounterMaxBonusLevel();
|
||||||
public static double counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier();
|
public static double counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier();
|
||||||
|
public static double counterAttackMaxChance = AdvancedConfig.getInstance().getCounterChanceMax();
|
||||||
|
|
||||||
public static double serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
|
public static double serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
|
||||||
public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks();
|
public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks();
|
||||||
|
|||||||
@@ -4,12 +4,8 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@@ -23,20 +19,12 @@ public class SwordsManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, SkillType.SWORDS);
|
super(mcMMOPlayer, SkillType.SWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canActivateAbility() {
|
|
||||||
return mcMMOPlayer.getToolPreparationMode(ToolType.SWORD) && Permissions.serratedStrikes(getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canUseBleed() {
|
public boolean canUseBleed() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.BLEED);
|
return Permissions.bleed(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseCounterAttack(Entity target) {
|
public boolean canUseCounterAttack(Entity target) {
|
||||||
return target instanceof LivingEntity && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.COUNTER);
|
return target instanceof LivingEntity && Permissions.counterAttack(getPlayer());
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canUseSerratedStrike() {
|
|
||||||
return mcMMOPlayer.getAbilityMode(AbilityType.SERRATED_STRIKES) && Permissions.serratedStrikes(getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,9 +33,9 @@ public class SwordsManager extends SkillManager {
|
|||||||
* @param target The defending entity
|
* @param target The defending entity
|
||||||
*/
|
*/
|
||||||
public void bleedCheck(LivingEntity target) {
|
public void bleedCheck(LivingEntity target) {
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.BLEED, getPlayer(), getSkillLevel(), activationChance)) {
|
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.bleedMaxChance, Swords.bleedMaxBonusLevel)) {
|
||||||
|
|
||||||
if (getSkillLevel() >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbility.BLEED)) {
|
if (getSkillLevel() >= Swords.bleedMaxBonusLevel) {
|
||||||
BleedTimerTask.add(target, Swords.bleedMaxTicks);
|
BleedTimerTask.add(target, Swords.bleedMaxTicks);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -79,7 +67,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.activationSuccessful(SecondaryAbility.COUNTER, getPlayer(), getSkillLevel(), activationChance)) {
|
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
|
||||||
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier);
|
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier);
|
||||||
|
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ public class Taming {
|
|||||||
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
||||||
|
|
||||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||||
|
public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
|
||||||
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||||
|
public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
|
||||||
|
|
||||||
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
|
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
|
||||||
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@@ -32,35 +30,35 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseThickFur() {
|
public boolean canUseThickFur() {
|
||||||
return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.THICK_FUR);
|
return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.thickFur(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseEnvironmentallyAware() {
|
public boolean canUseEnvironmentallyAware() {
|
||||||
return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ENVIROMENTALLY_AWARE);
|
return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.environmentallyAware(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseShockProof() {
|
public boolean canUseShockProof() {
|
||||||
return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SHOCK_PROOF);
|
return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.shockProof(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseHolyHound() {
|
public boolean canUseHolyHound() {
|
||||||
return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.HOLY_HOUND);
|
return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.holyHound(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseFastFoodService() {
|
public boolean canUseFastFoodService() {
|
||||||
return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.FAST_FOOD);
|
return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.fastFoodService(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseSharpenedClaws() {
|
public boolean canUseSharpenedClaws() {
|
||||||
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SHARPENED_CLAWS);
|
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.sharpenedClaws(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseGore() {
|
public boolean canUseGore() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.GORE);
|
return Permissions.gore(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBeastLore() {
|
public boolean canUseBeastLore() {
|
||||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.BEAST_LORE);
|
return Permissions.beastLore(getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,10 +92,7 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param damage The damage being absorbed by the wolf
|
* @param damage The damage being absorbed by the wolf
|
||||||
*/
|
*/
|
||||||
public void fastFoodService(Wolf wolf, double damage) {
|
public void fastFoodService(Wolf wolf, double damage) {
|
||||||
double chance = Taming.fastFoodServiceActivationChance / activationChance;
|
if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.FAST_FOOD, chance);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
||||||
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
|
|
||||||
|
|
||||||
double health = wolf.getHealth();
|
double health = wolf.getHealth();
|
||||||
double maxHealth = wolf.getMaxHealth();
|
double maxHealth = wolf.getMaxHealth();
|
||||||
@@ -117,7 +112,7 @@ public class TamingManager extends SkillManager {
|
|||||||
* @param wolf The wolf using the ability
|
* @param wolf The wolf using the ability
|
||||||
*/
|
*/
|
||||||
public double gore(LivingEntity target, double damage, Wolf wolf) {
|
public double gore(LivingEntity target, double damage, Wolf wolf) {
|
||||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.GORE, getPlayer(), getSkillLevel(), activationChance)) {
|
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +255,7 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
heldItem.setAmount(heldItemAmount - summonAmount);
|
||||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ public class Unarmed {
|
|||||||
public static double ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
public static double ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
||||||
public static int ironArmIncreaseLevel = AdvancedConfig.getInstance().getIronArmIncreaseLevel();
|
public static int ironArmIncreaseLevel = AdvancedConfig.getInstance().getIronArmIncreaseLevel();
|
||||||
|
|
||||||
|
public static int disarmMaxBonusLevel = AdvancedConfig.getInstance().getDisarmMaxBonusLevel();
|
||||||
|
public static double disarmMaxChance = AdvancedConfig.getInstance().getDisarmChanceMax();
|
||||||
|
|
||||||
|
public static int deflectMaxBonusLevel = AdvancedConfig.getInstance().getDeflectMaxBonusLevel();
|
||||||
|
public static double deflectMaxChance = AdvancedConfig.getInstance().getDeflectChanceMax();
|
||||||
|
|
||||||
|
public static int ironGripMaxBonusLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel();
|
||||||
|
public static double ironGripMaxChance = AdvancedConfig.getInstance().getIronGripChanceMax();
|
||||||
|
|
||||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||||
|
|
||||||
public static double berserkDamageModifier = 1.5;
|
public static double berserkDamageModifier = 1.5;
|
||||||
@@ -71,7 +80,8 @@ public class Unarmed {
|
|||||||
|
|
||||||
nextSlot++;
|
nextSlot++;
|
||||||
}
|
}
|
||||||
} else if (firstEmpty != -1) {
|
}
|
||||||
|
else if (firstEmpty != -1) {
|
||||||
drop.remove();
|
drop.remove();
|
||||||
dropStack.setAmount(dropAmount);
|
dropStack.setAmount(dropAmount);
|
||||||
inventory.setItem(firstEmpty, dropStack);
|
inventory.setItem(firstEmpty, dropStack);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user