1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 09:43:00 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
TfT_02
8f4096cf1d Calculate Alchemy XP based on potion stage
Adds #1926
2014-06-08 23:03:26 +02:00
84 changed files with 430 additions and 1848 deletions

View File

@@ -15,34 +15,16 @@ Version 1.5.01-dev
+ Added support for `MATERIAL|data` format in treasures.yml
+ Added API to experience events to get XP gain reason
+ Added API to check if an entity is bleeding
+ Added options to tools.yml and armor.yml config files to set a pretty repair material name
+ Added full support for repairables in tools.yml and armor.yml config files
+ Added new API class SkillAPI used to get a list of valid skill names
= Fixed bug where pistons would mess with the block tracking
= Fixed bug where the Updater was running on the main thread.
= Fixed bug when players would use /ptp without being in a party
= Fixed bug where player didn't have a mcMMOPlayer object in AsyncPlayerChatEvent
= Fixed bug where dodge would check the wrong player skill level
= Fixed bug which causes /party teleport to stop working
= Fixed bug where SaveTimerTask would produce an IndexOutOfBoundsException
= Fixed bug where Alchemy would not fire BrewEvents
= Fixed bug with setting custom names and lore in treasures config
= Fixed bug which would cause a NullPointerException with getFlowerAndGrassXp()
= Fixed bug which could cause and SQLException regarding the connection property 'maxReconnects'.
= Fixed bug where falling blocks were incorrectly tracked
= Fixed bug where items would get deleted when in Berserk with a full inventory
= Fixed bug where the console would not correctly show party chat colors
= Fixed bug where party chat was using non thread safe methods
= Fixed bug where Blast Mining unlock levels could be to high in certain occasions
= Fixed bug where Blast Minings ability "Demolition Expert" would not work
! Changed SecondaryAbilityEvent to implement Cancellable and it now gets fired for damage related secondary abilities
! Changed the way mcMMO handles bonus damage, updated for the new damage event API
! Changed player data saving. Save tasks are now asynchronous
! Vanished players no longer get hit by AoE effects
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients'
! Changed Alchemy XP distribution. XP is granted based on the stage of the potion.
! Changed behavior of the Blast Mining ability "Demolition Expert"; now only decreases damage for the ability user
! Updated for new getOnlinePlayers() behavior
- Removed salvage ability from Repair, salvage has it's own (child) skill now
Version 1.5.00

View File

@@ -1,132 +0,0 @@
# Config created by joulesbeef
# Created For twilightforest-2.2.3
#
#
# Settings for Boots
###
Boots:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODBOOTS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYBOOTS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
TWILIGHTFOREST_ITEM_STEELEAFBOOTS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYBOOTS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Chestplates
###
Chestplates:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODPLATE:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYPLATE:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
TWILIGHTFOREST_ITEM_STEELEAFPLATE:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYPLATE:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Helmets
###
Helmets:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODHELM:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYHELM:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
TWILIGHTFOREST_ITEM_STEELEAFHELM:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYHELM:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 50
# Settings for Leggings
###
Leggings:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODLEGS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYLEGS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Stealeaf
TWILIGHTFOREST_ITEM_STEELEAFLEGS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYLEGS:
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

View File

@@ -1,116 +0,0 @@
# Config created by joulesbeef
# Created For twilightforest-2.2.3
#
#
# Settings for Custom Herbalism Blocks
###
Herbalism:
# Mushgloom
TWILIGHTFOREST_TILE_TFLOG|9:
XP_Gain: 150
Double_Drops_Enabled: true
# Torchberry Plant
TWILIGHTFOREST_TILE_TFLOG|13:
XP_Gain: 20
Double_Drops_Enabled: true
# Mayapple
TWILIGHTFOREST_TILE_TFLOG|4:
XP_Gain: 30
Double_Drops_Enabled: true
# Fiddlehead
TWILIGHTFOREST_TILE_TFLOG|8:
XP_Gain: 35
Double_Drops_Enabled: true
#
# Settings for Custom Mining Blocks
###
Mining:
# Mazestone
TWILIGHTFOREST_TILE_TFMAZESTONE|0:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|1:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|2:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|3:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|4:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|5:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|6:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
TWILIGHTFOREST_TILE_TFMAZESTONE|7:
XP_Gain: 250
Double_Drops_Enabled: true
Is_Ore: false
#
# Settings for Custom Woodcutting Blocks
###
Woodcutting:
# Twilight Oak
TWILIGHTFOREST_TILE_TFLOG|0:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
# Canopy
TWILIGHTFOREST_TILE_TFLOG|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Mangrove
TWILIGHTFOREST_TILE_TFLOG|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Darkwood
TWILIGHTFOREST_TILE_TFLOG|3:
XP_Gain: 100
Double_Drops_Enabled: true
Is_Log: true
# Roots
TWILIGHTFOREST_TILE_TFROOTS|0:
XP_Gain: 10
Double_Drops_Enabled: true
Is_Log: false
TWILIGHTFOREST_TILE_TFROOTS|1:
XP_Gain: 10
Double_Drops_Enabled: true
Is_Log: false
# Timewood
TWILIGHTFOREST_TILE_TFMAGICLOG|0:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Transwood
TWILIGHTFOREST_TILE_TFMAGICLOG|1:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Minewood
TWILIGHTFOREST_TILE_TFMAGICLOG|2:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true
# Sortingwood
TWILIGHTFOREST_TILE_TFMAGICLOG|3:
XP_Gain: 1000
Double_Drops_Enabled: true
Is_Log: true

View File

@@ -1,152 +0,0 @@
# Config created by joulesbeef
# Created For twilightforest-2.2.3
#
# Settings for Custom Mobs
MoCreatures-Ogre:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-TwilightLich:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-HelmetCrab:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-SlimeBeetle:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-TwilightWraith:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-Naga:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
MoCreatures-Shark:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-TowerTermite:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
MoCreatures-SmallFish:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-Redcap:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-YetiBoss:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
MoCreatures-HellRat:
Class: Monster
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-Hydra:
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-Firefly:
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-KnightPhantom:
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
TwilightForest-TowerGolem:
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0
MoCreatures-FishBowl:
XP_Multiplier: 1.0
Tameable: false
Taming_XP: 0
CanBeSummoned: false
COTW_Material: ''
COTW_Material_Data: 0
COTW_Material_Amount: 0

View File

@@ -1,184 +0,0 @@
# Config created by joulesbeef
# Created For twilightforest-2.2.3
#
#
# Settings for Axes
###
Axes:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODAXE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
TWILIGHTFOREST_ITEM_STEELEAFAXE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYAXE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Minotaur
TWILIGHTFOREST_ITEM_MINOTAURAXE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: Diamond
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Hoes
###
Hoes:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODHOE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
TWILIGHTFOREST_ITEM_STEELEAFHOE:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Pickaxes
###
Pickaxes:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODPICK:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYPICK:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
TWILIGHTFOREST_ITEM_STEELEAFPICK:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYPICK:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Shovels
###
Shovels:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODSHOVEL:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
TWILIGHTFOREST_ITEM_STEELEAFSHOVEL:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
#
# Settings for Swords
###
Swords:
# Ironwood
TWILIGHTFOREST_ITEM_IRONWOODSWORD:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_IRONWOODINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Fiery
TWILIGHTFOREST_ITEM_FIERYSWORD:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_FIERYINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Steeleaf
TWILIGHTFOREST_ITEM_STEELEAFSWORD:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_STEELEAFINGOT
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500
# Knightmetal
TWILIGHTFOREST_ITEM_KNIGHTLYSWORD:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: TWILIGHTFOREST_ITEM_KNIGHTMETAL
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 2
Durability: 500

View File

@@ -1,93 +0,0 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SkillType;
public final class SkillAPI {
private SkillAPI() {}
/**
* Returns a list of strings with mcMMO's skills
* This includes parent and child skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getSkills() {
return getListFromEnum(Arrays.asList(SkillType.values()));
}
/**
* Returns a list of strings with mcMMO's skills
* This only includes parent skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getNonChildSkills() {
return getListFromEnum(SkillType.NON_CHILD_SKILLS);
}
/**
* Returns a list of strings with mcMMO's skills
* This only includes child skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getChildSkills() {
return getListFromEnum(SkillType.CHILD_SKILLS);
}
/**
* Returns a list of strings with mcMMO's skills
* This only includes combat skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getCombatSkills() {
return getListFromEnum(SkillType.COMBAT_SKILLS);
}
/**
* Returns a list of strings with mcMMO's skills
* This only includes gathering skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getGatheringSkills() {
return getListFromEnum(SkillType.GATHERING_SKILLS);
}
/**
* Returns a list of strings with mcMMO's skills
* This only includes misc skills
* </br>
* This function is designed for API usage.
*
* @return a list of strings with valid skill names
*/
public static List<String> getMiscSkills() {
return getListFromEnum(SkillType.MISC_SKILLS);
}
private static List<String> getListFromEnum(List<SkillType> skillsTypes) {
List<String> skills = new ArrayList<String>();
for (SkillType skillType : skillsTypes) {
skills.add(skillType.name());
}
return skills;
}
}

View File

@@ -1,11 +1,16 @@
package com.gmail.nossr50.chat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.runnables.party.PartyChatTask;
import com.gmail.nossr50.locale.LocaleLoader;
public class PartyChatManager extends ChatManager {
private Party party;
@@ -25,6 +30,21 @@ public class PartyChatManager extends ChatManager {
@Override
protected void sendMessage() {
new PartyChatTask(plugin, party, senderName, displayName, message).runTask(plugin);
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
}
for (Player member : party.getOnlineMembers()) {
member.sendMessage(message);
}
if (party.getAlly() != null) {
for (Player member : party.getAlly().getOnlineMembers()) {
String allyPrefix = LocaleLoader.formatString(Config.getInstance().getPartyChatPrefixAlly());
member.sendMessage(allyPrefix + message);
}
}
plugin.getLogger().info("[P]<" + party.getName() + ">" + message);
}
}

View File

@@ -65,7 +65,7 @@ public class ArcheryCommand extends SkillCommand {
}
if (canDaze) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3", Archery.dazeBonusDamage)));
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3", Archery.dazeModifier)));
}
if (canRetrieve) {

View File

@@ -9,7 +9,6 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.util.Permissions;
@@ -127,7 +126,7 @@ public class MiningCommand extends SkillCommand {
}
if (canBiggerBombs) {
int unlockLevel = BlastMining.getBiggerBombsUnlockLevel();
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.TWO);
if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", unlockLevel)));
@@ -138,7 +137,7 @@ public class MiningCommand extends SkillCommand {
}
if (canDemoExpert) {
int unlockLevel = BlastMining.getDemolitionExpertUnlockLevel();
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.FOUR);
if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", unlockLevel)));

View File

@@ -134,7 +134,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
}
if (getDazeBonusDamage() < 0) {
if (getDazeModifier() < 0) {
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
}
@@ -714,7 +714,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
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 getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
public double getDazeModifier() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }

View File

@@ -237,6 +237,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
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 String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
@@ -474,7 +475,6 @@ public class Config extends AutoUpdateConfigLoader {
/* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
public boolean getUnarmedItemPickupDisabled() { return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true); }
/* Taming */
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.config.experience;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.GrassSpecies;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.EntityType;
@@ -268,12 +267,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
}
else if (type == Material.LONG_GRASS) {
GrassSpecies species = ((LongGrass) data).getSpecies();
if (species == null) {
return 0;
}
switch (species) {
switch (((LongGrass) data).getSpecies()) {
case DEAD:
return config.getInt("Experience.Herbalism.Dead_Bush", 30);

View File

@@ -85,17 +85,13 @@ public class CustomArmorConfig extends ConfigLoader {
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2);
}
String repairItemName = config.getString(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
int repairMinimumLevel = config.getInt(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
double repairXpMultiplier = config.getDouble(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
short durability = armorMaterial.getMaxDurability();
if (durability == 0) {
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
}
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, 1.0));
}
materialList.add(armorMaterial);

View File

@@ -68,59 +68,39 @@ public class CustomBlockConfig extends ConfigLoader {
Material blockMaterial = Material.matchMaterial(blockInfo[0]);
if (blockMaterial == null) {
plugin.getLogger().warning("Invalid material name. [" + blockInfo[0] + "] This item will be skipped. - " + blockName);
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
continue;
}
if (blockInfo.length == 2) {
String[] dataInfo = blockInfo[1].split("[-]");
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
if (dataInfo.length == 2) {
byte startData = Byte.valueOf(dataInfo[0]);
byte endData = Byte.valueOf(dataInfo[1]);
if (blockList != null) {
blockList.add(blockMaterialData);
}
for (byte blockData = startData; blockData <= endData; blockData++) {
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
loadBlock(skillType, blockList, blockName, blockMaterialData);
}
if (skillType.equals("Ability_Blocks")) {
continue;
}
return;
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain");
int smeltingXp = 0;
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
customOres.add(blockMaterialData);
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
}
else if (skillType.equals("Woodcutting")) {
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
customLogs.add(blockMaterialData);
}
else {
customLeaves.add(blockMaterialData);
xp = 0; // Leaves don't grant XP
}
}
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
loadBlock(skillType, blockList, blockName, blockMaterialData);
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
}
}
private void loadBlock(String skillType, List<MaterialData> blockList, String blockName, MaterialData blockMaterialData) {
if (blockList != null) {
blockList.add(blockMaterialData);
}
if (skillType.equals("Ability_Blocks")) {
return;
}
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain");
int smeltingXp = 0;
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
customOres.add(blockMaterialData);
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
}
else if (skillType.equals("Woodcutting")) {
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
customLogs.add(blockMaterialData);
}
else {
customLeaves.add(blockMaterialData);
xp = 0; // Leaves don't grant XP
}
}
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
}
}

View File

@@ -93,17 +93,13 @@ public class CustomToolConfig extends ConfigLoader {
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Quantity", 2);
}
String repairItemName = config.getString(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
int repairMinimumLevel = config.getInt(toolType + "." + toolName + ".Repair_MinimumLevel", 0);
double repairXpMultiplier = config.getDouble(toolType + "." + toolName + ".Repair_XpMultiplier", 1);
short durability = toolMaterial.getMaxDurability();
if (durability == 0) {
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60);
}
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, 1.0));
}
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);

View File

@@ -259,13 +259,13 @@ public class TreasureConfig extends ConfigLoader {
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(config.getString(type + "." + treasureName + ".Custom_Name"));
itemMeta.setDisplayName(config.getString(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta);
}
if (config.contains(type + "." + treasureName + ".Lore")) {
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setLore(config.getStringList(type + "." + treasureName + ".Lore"));
itemMeta.setLore(config.getStringList(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta);
}
}

View File

@@ -22,7 +22,6 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -737,17 +736,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
if (corrupted) {
mcMMO.p.debug("Updating corrupted database line for player " + newCharacter[0]);
newLine = new StringBuilder(org.apache.commons.lang.StringUtils.join(newCharacter, ":"));
}
if (oldVersion != null) {
mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion);
}
if (corrupted || oldVersion != null) {
newLine = new StringBuilder(org.apache.commons.lang.StringUtils.join(newCharacter, ":"));
newLine = newLine.append(":");
}
writer.append(newLine).append("\r\n");
}
@@ -763,14 +758,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
tryClose(out);
}
}
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_FISHING);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_BLAST_MINING_COOLDOWN);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_SQL_INDEXES);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_MOB_HEALTHBARS);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.DROP_SQL_PARTY_NAMES);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.DROP_SPOUT);
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_ALCHEMY);
return;
}

View File

@@ -4,7 +4,6 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
@@ -18,8 +17,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.database.DatabaseUpdateType;
import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -136,9 +135,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
success &= saveHuds(userId, (mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()));
success &= saveLongs(
"UPDATE " + tablePrefix + "cooldowns SET "
+ " mining = ?, woodcutting = ?, unarmed = ?"
+ ", herbalism = ?, excavation = ?, swords = ?"
+ ", axes = ?, blast_mining = ? WHERE user_id = ?",
+ " mining = ?, woodcutting = ?, unarmed = ?"
+ ", herbalism = ?, excavation = ?, swords = ?"
+ ", axes = ?, blast_mining = ? WHERE user_id = ?",
userId,
profile.getAbilityDATS(AbilityType.SUPER_BREAKER),
profile.getAbilityDATS(AbilityType.TREE_FELLER),
@@ -150,10 +149,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
profile.getAbilityDATS(AbilityType.BLAST_MINING));
success &= saveIntegers(
"UPDATE " + tablePrefix + "skills SET "
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?",
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?",
profile.getSkillLevel(SkillType.TAMING),
profile.getSkillLevel(SkillType.MINING),
profile.getSkillLevel(SkillType.REPAIR),
@@ -170,10 +169,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
userId);
success &= saveIntegers(
"UPDATE " + tablePrefix + "experience SET "
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?",
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?",
profile.getSkillXpLevel(SkillType.TAMING),
profile.getSkillXpLevel(SkillType.MINING),
profile.getSkillXpLevel(SkillType.REPAIR),
@@ -243,8 +242,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
String skillName = skillType.name().toLowerCase();
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = ?)";
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = ?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, playerName);
@@ -255,8 +254,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
int rank = resultSet.getInt("rank");
sql = "SELECT user, " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
"AND " + skillName + " = (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = '" + playerName + "') ORDER BY user";
"AND " + skillName + " = (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = '" + playerName + "') ORDER BY user";
statement.close();
@@ -362,16 +361,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
try {
statement = connection.prepareStatement(
"SELECT "
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
+ "e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, "
+ "c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, "
+ "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?");
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
+ "e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, "
+ "c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, "
+ "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?");
statement.setString(1, playerName);
ResultSet result = statement.executeQuery();
@@ -438,16 +437,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
try {
statement = connection.prepareStatement(
"SELECT "
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
+ "e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, "
+ "c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, "
+ "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?");
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
+ "e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, "
+ "c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, "
+ "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?");
List<String> usernames = getStoredUsers();
ResultSet resultSet;
int convertedUsers = 0;
@@ -484,20 +483,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
/**
* Check connection status and re-establish if dead or stale.
* <p/>
* If the very first immediate attempt fails, further attempts
* will be made in progressively larger intervals up to MAX_WAIT
* intervals.
* <p/>
* This allows for MySQL to time out idle connections as needed by
* server operator, without affecting McMMO, while still providing
* protection against a database outage taking down Bukkit's tick
* processing loop due to attempting a database connection each
* time McMMO needs the database.
*
* @return the boolean value for whether or not we are connected
*/
* Check connection status and re-establish if dead or stale.
*
* If the very first immediate attempt fails, further attempts
* will be made in progressively larger intervals up to MAX_WAIT
* intervals.
*
* This allows for MySQL to time out idle connections as needed by
* server operator, without affecting McMMO, while still providing
* protection against a database outage taking down Bukkit's tick
* processing loop due to attempting a database connection each
* time McMMO needs the database.
*
* @return the boolean value for whether or not we are connected
*/
public boolean checkConnected() {
boolean isClosed = true;
boolean isValid = false;
@@ -619,6 +618,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
connectionProperties.put("user", Config.getInstance().getMySQLUserName());
connectionProperties.put("password", Config.getInstance().getMySQLUserPassword());
connectionProperties.put("autoReconnect", "false");
connectionProperties.put("maxReconnects", "0");
connection = DriverManager.getConnection(connectionString, connectionProperties);
mcMMO.p.getLogger().info("Connection to MySQL was a success!");
@@ -710,174 +710,144 @@ public final class SQLDatabaseManager implements DatabaseManager {
+ "PRIMARY KEY (`user_id`)) "
+ "DEFAULT CHARSET=latin1;");
for (UpgradeType updateType : UpgradeType.values()) {
for (DatabaseUpdateType updateType : DatabaseUpdateType.values()) {
checkDatabaseStructure(updateType);
}
mcMMO.p.getLogger().info("Killing orphans");
write("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "experience`.`user_id` = `u`.`id`)");
write("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "huds`.`user_id` = `u`.`id`)");
write("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `u`.`id`)");
write("DELETE FROM `" + tablePrefix + "skills` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "skills`.`user_id` = `u`.`id`)");
}
/**
* Check database structure for necessary upgrades.
* Check database structure for missing values.
*
* @param upgrade Upgrade to attempt to apply
* @param update Type of data to check updates for
*/
private void checkDatabaseStructure(UpgradeType upgrade) {
if (!checkConnected()) {
return;
private void checkDatabaseStructure(DatabaseUpdateType update) {
String sql = "";
switch (update) {
case BLAST_MINING:
sql = "SELECT * FROM `" + tablePrefix + "cooldowns` ORDER BY `" + tablePrefix + "cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
break;
case FISHING:
sql = "SELECT * FROM `" + tablePrefix + "experience` ORDER BY `" + tablePrefix + "experience`.`fishing` ASC LIMIT 0 , 30";
break;
case ALCHEMY:
sql = "SELECT * FROM `" + tablePrefix + "experience` ORDER BY `" + tablePrefix + "experience`.`alchemy` ASC LIMIT 0 , 30";
break;
case INDEX:
if (read("SHOW INDEX FROM " + tablePrefix + "skills").size() != 13 && checkConnected()) {
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
write("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_taming` (`taming`) USING BTREE, "
+ "ADD INDEX `idx_mining` (`mining`) USING BTREE, "
+ "ADD INDEX `idx_woodcutting` (`woodcutting`) USING BTREE, "
+ "ADD INDEX `idx_repair` (`repair`) USING BTREE, "
+ "ADD INDEX `idx_unarmed` (`unarmed`) USING BTREE, "
+ "ADD INDEX `idx_herbalism` (`herbalism`) USING BTREE, "
+ "ADD INDEX `idx_excavation` (`excavation`) USING BTREE, "
+ "ADD INDEX `idx_archery` (`archery`) USING BTREE, "
+ "ADD INDEX `idx_swords` (`swords`) USING BTREE, "
+ "ADD INDEX `idx_axes` (`axes`) USING BTREE, "
+ "ADD INDEX `idx_acrobatics` (`acrobatics`) USING BTREE, "
+ "ADD INDEX `idx_fishing` (`fishing`) USING BTREE;");
}
return;
case MOB_HEALTHBARS:
sql = "SELECT * FROM `" + tablePrefix + "huds` ORDER BY `" + tablePrefix + "huds`.`mobhealthbar` ASC LIMIT 0 , 30";
break;
case PARTY_NAMES:
write("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;");
return;
case DROPPED_SPOUT:
write("ALTER TABLE `" + tablePrefix + "huds` DROP COLUMN `hudtype` ;");
return;
case KILL_ORPHANS:
mcMMO.p.getLogger().info("Killing orphans");
write(
"DELETE FROM " + tablePrefix + "experience " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "experience.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "huds " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "huds.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "cooldowns " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "cooldowns.user_id = u.id);"
);
write(
"DELETE FROM " + tablePrefix + "skills " +
"WHERE NOT EXISTS (SELECT * FROM " +
tablePrefix + "users u WHERE " +
tablePrefix + "skills.user_id = u.id);"
);
return;
default:
break;
}
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)");
return;
}
Statement statement = null;
ResultSet resultSet = null;
ResultSet resultSet;
PreparedStatement statement = null;
try {
statement = connection.createStatement();
switch (upgrade) {
case ADD_FISHING:
try {
statement.executeQuery("SELECT `fishing` FROM `" + tablePrefix + "skills` LIMIT 1");
}
catch (SQLException ex) {
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0'");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0'");
}
break;
case ADD_BLAST_MINING_COOLDOWN:
try {
statement.executeQuery("SELECT `blast_mining` FROM `" + tablePrefix + "cooldowns` LIMIT 1");
}
catch (SQLException ex) {
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Blast Mining...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0'");
}
break;
case ADD_SQL_INDEXES:
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
resultSet.last();
if (resultSet.getRow() != SkillType.NON_CHILD_SKILLS.size()) {
mcMMO.p.getLogger().info("Indexing tables, this may take a while on larger databases");
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
String skill_name = skill.name().toLowerCase();
try {
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD INDEX `idx_" + skill_name + "` (`" + skill_name + "`) USING BTREE");
}
catch (SQLException ex) {
// Ignore
}
}
}
break;
case ADD_MOB_HEALTHBARS:
try {
statement.executeQuery("SELECT `mobhealthbar` FROM `" + tablePrefix + "huds` LIMIT 1");
}
catch (SQLException ex) {
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "'");
}
break;
case DROP_SQL_PARTY_NAMES:
try {
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "users` LIMIT 1");
ResultSetMetaData rsmeta = resultSet.getMetaData();
boolean column_exists = false;
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
if (rsmeta.getColumnName(i).equalsIgnoreCase("party")) {
column_exists = true;
break;
}
}
if (column_exists) {
mcMMO.p.getLogger().info("Removing party name from users table...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party`");
}
}
catch (SQLException ex) {
// Ignore
}
break;
case DROP_SPOUT:
try {
resultSet = statement.executeQuery("SELECT * FROM `" + tablePrefix + "huds` LIMIT 1");
ResultSetMetaData rsmeta = resultSet.getMetaData();
boolean column_exists = false;
for (int i = 1; i <= rsmeta.getColumnCount(); i++) {
if (rsmeta.getColumnName(i).equalsIgnoreCase("hudtype")) {
column_exists = true;
break;
}
}
if (column_exists) {
mcMMO.p.getLogger().info("Removing Spout HUD type from huds table...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "huds` DROP COLUMN `hudtype`");
}
}
catch (SQLException ex) {
// Ignore
}
break;
case ADD_ALCHEMY:
try {
statement.executeQuery("SELECT `alchemy` FROM `" + tablePrefix + "skills` LIMIT 1");
}
catch (SQLException ex) {
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Alchemy...");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "skills` ADD `alchemy` int(10) NOT NULL DEFAULT '0'");
statement.executeQuery("ALTER TABLE `" + tablePrefix + "experience` ADD `alchemy` int(10) NOT NULL DEFAULT '0'");
}
break;
default:
break;
if (!checkConnected()) {
return;
}
mcMMO.getUpgradeManager().setUpgradeCompleted(upgrade);
statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery();
while (resultSet.next()) {
// No reason to do anything here... we're just trying to catch exceptions
}
}
catch (SQLException ex) {
switch (update) {
case BLAST_MINING:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Blast Mining...");
write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
break;
case FISHING:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
break;
case MOB_HEALTHBARS:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
write("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "' ;");
break;
case ALCHEMY:
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Alchemy...");
write("ALTER TABLE `"+tablePrefix + "skills` ADD `alchemy` int(10) NOT NULL DEFAULT '0' ;");
write("ALTER TABLE `"+tablePrefix + "experience` ADD `alchemy` int(10) NOT NULL DEFAULT '0' ;");
break;
default:
break;
}
}
finally {
if (resultSet != null) {
try {
resultSet.close();
}
catch (SQLException e) {
// Ignore
}
}
if (statement != null) {
try {
statement.close();
}
catch (SQLException e) {
// Ignore
// Ignore the error, we're leaving
}
}
}
@@ -887,7 +857,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Attempt to write the SQL query.
*
* @param sql Query to write.
*
* @return true if the query was successfully written, false otherwise.
*/
private boolean write(String sql) {
@@ -923,7 +892,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Returns the number of rows affected by either a DELETE or UPDATE query
*
* @param sql SQL query to execute
*
* @return the number of rows affected
*/
private int update(String sql) {
@@ -958,7 +926,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Read SQL query.
*
* @param sql SQL query to read
*
* @return the rows in this SQL query
*/
private HashMap<Integer, ArrayList<String>> read(String sql) {
@@ -1004,7 +971,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Get the Integer. Only return first row / first field.
*
* @param statement SQL query to execute
*
* @return the value in the first row / first field
*/
private int readInt(PreparedStatement statement) {
@@ -1148,7 +1114,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Retrieve the database id for a player
*
* @param playerName The name of the user to retrieve the id for
*
* @return the requested id or -1 if not found
*/
private int readId(String playerName) {
@@ -1219,8 +1184,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
MobHealthbarType mobHealthbarType;

View File

@@ -0,0 +1,13 @@
package com.gmail.nossr50.datatypes.database;
public enum DatabaseUpdateType {
FISHING,
BLAST_MINING,
INDEX,
MOB_HEALTHBARS,
PARTY_NAMES,
KILL_ORPHANS,
DROPPED_SPOUT,
ALCHEMY
;
}

View File

@@ -1,11 +0,0 @@
package com.gmail.nossr50.datatypes.database;
public enum UpgradeType {
ADD_FISHING,
ADD_BLAST_MINING_COOLDOWN,
ADD_SQL_INDEXES,
ADD_MOB_HEALTHBARS,
DROP_SQL_PARTY_NAMES,
DROP_SPOUT,
ADD_ALCHEMY;
}

View File

@@ -7,7 +7,6 @@ import java.util.Map.Entry;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
public class AlchemyPotion {
@@ -51,10 +50,6 @@ public class AlchemyPotion {
return potion;
}
public Potion toPotion(int amount) {
return Potion.fromItemStack(this.toItemStack(amount));
}
public short getDataValue() {
return dataValue;
}

View File

@@ -1,5 +1,7 @@
package com.gmail.nossr50.datatypes.skills.alchemy;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.Potion;
public enum PotionStage {
@@ -31,19 +33,15 @@ public enum PotionStage {
public static PotionStage getPotionStage(AlchemyPotion input, AlchemyPotion output) {
PotionStage potionStage = getPotionStage(output);
if (!isWaterBottle(input) && getPotionStage(input) == potionStage) {
if (getPotionStage(input) == potionStage) {
potionStage = PotionStage.FIVE;
}
return potionStage;
}
private static boolean isWaterBottle(AlchemyPotion input) {
return input.getDataValue() == 0;
}
public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
Potion potion = alchemyPotion.toPotion(1);
Potion potion = Potion.fromItemStack(new ItemStack(Material.POTION, 1, alchemyPotion.getDataValue()));
int stage = 1;

View File

@@ -1,11 +0,0 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.block.Block;
import org.bukkit.event.inventory.BrewEvent;
import org.bukkit.inventory.BrewerInventory;
public class FakeBrewEvent extends BrewEvent {
public FakeBrewEvent(Block brewer, BrewerInventory contents) {
super(brewer, contents);
}
}

View File

@@ -1,36 +1,13 @@
package com.gmail.nossr50.events.fake;
import java.util.EnumMap;
import java.util.Map;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.google.common.base.Function;
import com.google.common.base.Functions;
/**
* Called when mcMMO applies damage from an entity due to special abilities.
*/
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damager, damagee, cause, modifiers, getFunctionModifiers(modifiers));
}
@Deprecated
public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage) {
super(damager, damagee, cause, damage);
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {
modifierFunctions.put(modifier, ZERO);
}
return modifierFunctions;
}
}

View File

@@ -1,36 +1,13 @@
package com.gmail.nossr50.events.fake;
import java.util.EnumMap;
import java.util.Map;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageEvent;
import com.google.common.base.Function;
import com.google.common.base.Functions;
/**
* Called when mcMMO applies damage due to special abilities.
*/
public class FakeEntityDamageEvent extends EntityDamageEvent {
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
super(damagee, cause, modifiers, getFunctionModifiers(modifiers));
}
@Deprecated
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) {
super(damagee, cause, damage);
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {
modifierFunctions.put(modifier, ZERO);
}
return modifierFunctions;
}
}

View File

@@ -1,20 +1,18 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Cancellable {
public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
private SecondaryAbility secondaryAbility;
private boolean cancelled;
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
super(player, SkillType.bySecondaryAbility(secondaryAbility));
this.secondaryAbility = secondaryAbility;
cancelled = false;
}
/**
@@ -24,12 +22,4 @@ public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Canc
public SecondaryAbility getSecondaryAbility() {
return secondaryAbility;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean newValue) {
this.cancelled = newValue;
}
}

View File

@@ -5,6 +5,7 @@ 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) {

View File

@@ -31,7 +31,6 @@ 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.FakeBlockDamageEvent;
import com.gmail.nossr50.runnables.PistonTrackerTask;
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
@@ -64,27 +63,27 @@ public class BlockListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (!EventUtils.shouldProcessEvent(event.getBlock(), true)) {
return;
}
List<Block> blocks = event.getBlocks();
BlockFace direction = event.getDirection();
Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished
if (futureEmptyBlock.getType() == Material.AIR) {
return;
}
List<Block> blocks = event.getBlocks();
for (Block b : blocks) {
if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) {
b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue);
if (b.equals(futureEmptyBlock) && futureEmptyBlock.getType() == Material.AIR) {
mcMMO.getPlaceStore().setFalse(b);
}
}
}
// Needed because blocks sometimes don't move when two pistons push towards each other
new PistonTrackerTask(blocks, direction, futureEmptyBlock).runTaskLater(plugin, 2);
for (Block b : blocks) {
Block nextBlock = b.getRelative(direction);
if (nextBlock.hasMetadata(mcMMO.blockMetadataKey)) {
mcMMO.getPlaceStore().setTrue(nextBlock);
nextBlock.removeMetadata(mcMMO.blockMetadataKey, plugin);
}
}
}
/**
@@ -94,10 +93,6 @@ public class BlockListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if (!EventUtils.shouldProcessEvent(event.getBlock(), false)) {
return;
}
if (!event.isSticky()) {
return;
}

View File

@@ -53,7 +53,6 @@ import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.herbalism.Herbalism;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.skills.taming.TamingManager;
@@ -110,9 +109,7 @@ public class EntityListener implements Listener {
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Block block = event.getBlock();
// When the event is fired for the falling block that changes back to a normal block
// event.getBlock().getType() returns AIR
if (!BlockUtils.shouldBeWatched(block.getState()) && block.getType() != Material.AIR) {
if (!BlockUtils.shouldBeWatched(block.getState())) {
return;
}
@@ -150,7 +147,7 @@ public class EntityListener implements Listener {
return;
}
double damage = event.getFinalDamage();
double damage = event.getDamage();
if (damage <= 0) {
return;
@@ -193,11 +190,6 @@ public class EntityListener implements Listener {
attacker = (Entity) animalTamer;
}
}
else if (attacker instanceof TNTPrimed && defender instanceof Player) {
if (BlastMining.processBlastMiningExplosion(event, (TNTPrimed) attacker, (Player) defender)) {
return;
}
}
if (defender instanceof Player && attacker instanceof Player) {
Player defendingPlayer = (Player) defender;
@@ -219,7 +211,7 @@ public class EntityListener implements Listener {
}
CombatUtils.processCombatAttack(event, attacker, target);
CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage());
CombatUtils.handleHealthbars(attacker, target, event.getDamage());
}
/**
@@ -233,7 +225,7 @@ public class EntityListener implements Listener {
return;
}
double damage = event.getFinalDamage();
double damage = event.getDamage();
if (damage <= 0) {
return;
@@ -284,7 +276,20 @@ public class EntityListener implements Listener {
if (acrobaticsManager.canRoll()) {
event.setDamage(acrobaticsManager.rollCheck(event.getDamage()));
if (event.getFinalDamage() == 0) {
if (event.getDamage() == 0) {
event.setCancelled(true);
return;
}
}
break;
case BLOCK_EXPLOSION:
MiningManager miningManager = mcMMOPlayer.getMiningManager();
if (miningManager.canUseDemolitionsExpertise()) {
event.setDamage(miningManager.processDemolitionsExpertise(event.getDamage()));
if (event.getDamage() == 0) {
event.setCancelled(true);
return;
}
@@ -295,7 +300,7 @@ public class EntityListener implements Listener {
break;
}
if (event.getFinalDamage() >= 1) {
if (event.getDamage() >= 1) {
mcMMOPlayer.actualizeRecentlyHurt();
}
}
@@ -329,7 +334,7 @@ public class EntityListener implements Listener {
if (tamingManager.canUseThickFur()) {
event.setDamage(Taming.processThickFur(wolf, event.getDamage()));
if (event.getFinalDamage() == 0) {
if (event.getDamage() == 0) {
event.setCancelled(true);
}
}
@@ -355,7 +360,7 @@ public class EntityListener implements Listener {
if (tamingManager.canUseShockProof()) {
event.setDamage(Taming.processShockProof(wolf, event.getDamage()));
if (event.getFinalDamage() == 0) {
if (event.getDamage() == 0) {
event.setCancelled(true);
}
}

View File

@@ -332,11 +332,9 @@ public class PlayerListener implements Listener {
}
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
boolean pickupSuccess = Unarmed.handleItemPickup(player.getInventory(), drop);
boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
event.setCancelled(cancel);
event.setCancelled(Unarmed.handleItemPickup(player.getInventory(), drop));
if (pickupSuccess) {
if (event.isCancelled()) {
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.updateInventory();
return;

View File

@@ -60,7 +60,6 @@ import com.gmail.nossr50.util.commands.CommandRegistrationManager;
import com.gmail.nossr50.util.experience.FormulaManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.upgrade.UpgradeManager;
import net.shatteredlands.shatt.backup.ZipLibrary;
@@ -73,7 +72,6 @@ public class mcMMO extends JavaPlugin {
private static DatabaseManager databaseManager;
private static FormulaManager formulaManager;
private static HolidayManager holidayManager;
private static UpgradeManager upgradeManager;
/* File Paths */
private static String mainDirectory;
@@ -114,7 +112,6 @@ public class mcMMO extends JavaPlugin {
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
public final static String playerDataKey = "mcMMO: Player Data";
public final static String greenThumbDataKey = "mcMMO: Green Thumb";
public final static String pistonDataKey = "mcMMO: Piston State";
public static FixedMetadataValue metadataValue;
@@ -131,8 +128,6 @@ public class mcMMO extends JavaPlugin {
PluginManager pluginManager = getServer().getPluginManager();
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
upgradeManager = new UpgradeManager();
setupFilePaths();
modManager = new ModManager();
@@ -143,7 +138,7 @@ public class mcMMO extends JavaPlugin {
return;
}
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
if (getServer().getName().equals("MCPC+")) {
checkModConfigs();
}
@@ -313,10 +308,6 @@ public class mcMMO extends JavaPlugin {
return modManager;
}
public static UpgradeManager getUpgradeManager() {
return upgradeManager;
}
@Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager;
@@ -494,22 +485,22 @@ public class mcMMO extends JavaPlugin {
private void checkModConfigs() {
if (!Config.getInstance().getToolModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom tool config for mcMMO is disabled!");
getLogger().info("MCPC+ implementation found, but the custom tool config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml.");
}
if (!Config.getInstance().getArmorModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom armor config for mcMMO is disabled!");
getLogger().info("MCPC+ implementation found, but the custom armor config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml.");
}
if (!Config.getInstance().getBlockModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom block config for mcMMO is disabled!");
getLogger().info("MCPC+ implementation found, but the custom block config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml.");
}
if (!Config.getInstance().getEntityModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom entity config for mcMMO is disabled!");
getLogger().info("MCPC+ implementation found, but the custom entity config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
}
}

View File

@@ -1,47 +0,0 @@
package com.gmail.nossr50.runnables;
import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
public class PistonTrackerTask extends BukkitRunnable {
private List<Block> blocks;
private BlockFace direction;
private Block futureEmptyBlock;
public PistonTrackerTask(List<Block> blocks, BlockFace direction, Block futureEmptyBlock) {
this.blocks = blocks;
this.direction = direction;
this.futureEmptyBlock = futureEmptyBlock;
}
@Override
public void run() {
// Check to see if futureEmptyBlock is empty - if it isn't; the blocks didn't move
if (!BlockUtils.isPistonPiece(futureEmptyBlock.getState())) {
return;
}
if (mcMMO.getPlaceStore().isTrue(futureEmptyBlock)) {
mcMMO.getPlaceStore().setFalse(futureEmptyBlock);
}
for (Block b : blocks) {
Block nextBlock = b.getRelative(direction);
if (nextBlock.hasMetadata(mcMMO.blockMetadataKey)) {
mcMMO.getPlaceStore().setTrue(nextBlock);
nextBlock.removeMetadata(mcMMO.blockMetadataKey, mcMMO.p);
}
else if (mcMMO.getPlaceStore().isTrue(nextBlock)) {
// Block doesn't have metadatakey but isTrue - set it to false
mcMMO.getPlaceStore().setFalse(nextBlock);
}
}
}
}

View File

@@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
@@ -20,16 +21,10 @@ public class StickyPistonTrackerTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getPlaceStore().isTrue(movedBlock)) {
if (!BlockUtils.shouldBeWatched(movedBlock.getState()) || movedBlock.getPistonMoveReaction() != PistonMoveReaction.MOVE || !mcMMO.getPlaceStore().isTrue(movedBlock)) {
return;
}
if (!BlockUtils.isPistonPiece(movedBlock.getState())) {
// The block didn't move
return;
}
// The sticky piston actually pulled the block so move the PlaceStore data
mcMMO.getPlaceStore().setFalse(movedBlock);
mcMMO.getPlaceStore().setTrue(block.getRelative(direction));
}

View File

@@ -1,51 +0,0 @@
package com.gmail.nossr50.runnables.party;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
public class PartyChatTask extends BukkitRunnable {
private Plugin plugin;
private Party party;
private String senderName;
private String displayName;
private String message;
public PartyChatTask(Plugin plugin, Party party, String senderName, String displayName, String message) {
this.plugin = plugin;
this.party = party;
this.senderName = senderName;
this.displayName = displayName;
this.message = message;
}
@Override
public void run() {
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
}
for (Player member : party.getOnlineMembers()) {
member.sendMessage(message);
}
if (party.getAlly() != null) {
for (Player member : party.getAlly().getOnlineMembers()) {
String allyPrefix = LocaleLoader.formatString(Config.getInstance().getPartyChatPrefixAlly());
member.sendMessage(allyPrefix + message);
}
}
plugin.getServer().getConsoleSender().sendMessage("[mcMMO] [P]<" + party.getName() + ">" + message);
}
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.alchemy;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
@@ -19,7 +18,6 @@ import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.events.fake.FakeBrewEvent;
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask;
import com.gmail.nossr50.util.Permissions;
@@ -103,8 +101,6 @@ public final class AlchemyPotionBrewer {
return;
}
List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();
for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i);
@@ -115,27 +111,11 @@ public final class AlchemyPotionBrewer {
AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
inputList.add(input);
if (output != null) {
inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
}
}
FakeBrewEvent event = new FakeBrewEvent(brewingStand.getBlock(), inventory);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || inputList.isEmpty()) {
return;
}
for (AlchemyPotion input : inputList) {
AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
if (output != null && player != null) {
PotionStage potionStage = PotionStage.getPotionStage(input, output);
if (UserManager.hasPlayerDataKey(player)) {
if (player != null) {
PotionStage potionStage = PotionStage.getPotionStage(input, output);
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
}
}

View File

@@ -19,7 +19,7 @@ public class Archery {
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
public static double dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
public static final double DISTANCE_XP_MULTIPLIER = 0.025;

View File

@@ -1,9 +1,11 @@
package com.gmail.nossr50.skills.archery;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@@ -16,6 +18,7 @@ import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class ArcheryManager extends SkillManager {
@@ -67,8 +70,9 @@ public class ArcheryManager extends SkillManager {
* Handle the effects of the Daze ability
*
* @param defender The {@link Player} being affected by the ability
* @param arrow The {@link Arrow} that was fired
*/
public double daze(Player defender) {
public double daze(Player defender, Arrow arrow) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
return 0;
}
@@ -87,21 +91,20 @@ public class ArcheryManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
}
return Archery.dazeBonusDamage;
return CombatUtils.callFakeDamageEvent(arrow, defender, DamageCause.PROJECTILE, Archery.dazeModifier);
}
/**
* Handle the effects of the Skill Shot ability
*
* @param target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event
* @param arrow The {@link Arrow} that was fired
*/
public double skillShot(double damage) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.SKILL_SHOT, getPlayer())) {
return damage;
}
public double skillShot(LivingEntity target, double damage, Arrow arrow) {
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
double archeryBonus = Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
return Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
return CombatUtils.callFakeDamageEvent(arrow, target, DamageCause.PROJECTILE, archeryBonus);
}
}

View File

@@ -1,20 +1,20 @@
package com.gmail.nossr50.skills.axes;
import java.util.Map;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
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.ToolType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
@@ -52,13 +52,13 @@ public class AxesManager extends SkillManager {
/**
* Handle the effects of the Axe Mastery ability
*
* @param target The {@link LivingEntity} being affected by the ability
*/
public double axeMastery() {
if (!SkillUtils.activationSuccessful(SecondaryAbility.AXE_MASTERY, getPlayer())) {
return 0;
}
public double axeMastery(LivingEntity target) {
double axeBonus = Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
return Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
return CombatUtils.callFakeDamageEvent(getPlayer(), target, axeBonus);
}
/**
@@ -85,7 +85,7 @@ public class AxesManager extends SkillManager {
damage = (damage * Axes.criticalHitPVEModifier) - damage;
}
return damage;
return CombatUtils.callFakeDamageEvent(player, target, damage);
}
/**
@@ -98,7 +98,10 @@ public class AxesManager extends SkillManager {
for (ItemStack armor : target.getEquipment().getArmorContents()) {
if (ItemUtils.isArmor(armor)) {
if (SkillUtils.activationSuccessful(SecondaryAbility.ARMOR_IMPACT, getPlayer(), Axes.impactChance, activationChance)) {
double chance = Axes.impactChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.ARMOR_IMPACT, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
}
}
@@ -111,7 +114,10 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability
*/
public double greaterImpact(LivingEntity target) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.GREATER_IMPACT, getPlayer(), Axes.greaterImpactChance, activationChance)) {
double chance = Axes.greaterImpactChance / activationChance;
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;
}
@@ -132,7 +138,7 @@ public class AxesManager extends SkillManager {
}
}
return Axes.greaterImpactBonusDamage;
return CombatUtils.callFakeDamageEvent(player, target, Axes.greaterImpactBonusDamage);
}
/**
@@ -141,7 +147,7 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event
*/
public void skullSplitterCheck(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, modifiers, skill);
public void skullSplitterCheck(LivingEntity target, double damage) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
}
}

View File

@@ -1,18 +1,9 @@
package com.gmail.nossr50.skills.mining;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.player.UserManager;
public class BlastMining {
// The order of the values is extremely important, a few methods depend on it to work properly
@@ -64,58 +55,4 @@ public class BlastMining {
public static Material detonator = Config.getInstance().getDetonatorItem();
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
public static int getDemolitionExpertUnlockLevel() {
List<Tier> tierList = Arrays.asList(Tier.values());
for (Tier tier : tierList) {
if (tier.getBlastDamageDecrease() > 0) {
continue;
}
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
}
return 0;
}
public static int getBiggerBombsUnlockLevel() {
List<Tier> tierList = Arrays.asList(Tier.values());
for (Tier tier : tierList) {
if (tier.getBlastRadiusModifier() > 1.0) {
continue;
}
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
}
return 0;
}
public static boolean processBlastMiningExplosion(EntityDamageByEntityEvent event, TNTPrimed tnt, Player defender) {
if (!tnt.hasMetadata(mcMMO.tntMetadataKey) || !UserManager.hasPlayerDataKey(defender)) {
return false;
}
// We can make this assumption because we (should) be the only ones using this exact metadata
Player player = mcMMO.p.getServer().getPlayerExact(tnt.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!player.equals(defender)) {
return false;
}
MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager();
if (!miningManager.canUseDemolitionsExpertise()) {
return false;
}
event.setDamage(DamageModifier.BASE, miningManager.processDemolitionsExpertise(event.getDamage()));
if (event.getFinalDamage() == 0) {
event.setCancelled(true);
return false;
}
return true;
}
}

View File

@@ -33,7 +33,7 @@ public class MiningManager extends SkillManager {
}
public boolean canUseDemolitionsExpertise() {
return getSkillLevel() >= BlastMining.getDemolitionExpertUnlockLevel() && Permissions.demolitionsExpertise(getPlayer());
return getSkillLevel() >= BlastMining.Tier.FOUR.getLevel() && Permissions.demolitionsExpertise(getPlayer());
}
public boolean canDetonate() {
@@ -47,7 +47,7 @@ public class MiningManager extends SkillManager {
}
public boolean canUseBiggerBombs() {
return getSkillLevel() >= BlastMining.getBiggerBombsUnlockLevel() && Permissions.biggerBombs(getPlayer());
return getSkillLevel() >= BlastMining.Tier.TWO.getLevel() && Permissions.biggerBombs(getPlayer());
}
/**

View File

@@ -97,8 +97,7 @@ public class RepairManager extends SkillManager {
// Check if they have the proper material to repair with
if (!inventory.contains(repairMaterial)) {
String prettyName = repairable.getRepairMaterialPrettyName() == null ? StringUtils.getPrettyItemString(repairMaterial) : repairable.getRepairMaterialPrettyName();
String message = LocaleLoader.getString("Skills.NeedMore", prettyName);
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) {
message += ":" + repairMaterialMetadata;

View File

@@ -28,13 +28,6 @@ public interface Repairable {
*/
public byte getRepairMaterialMetadata();
/**
* Gets the pretty name of the material used to repair this item
*
* @return the pretty name of the repair material
*/
public String getRepairMaterialPrettyName();
/**
* Gets the RepairItemType value for this repairable item
*

View File

@@ -8,15 +8,11 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
public class RepairableFactory {
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
return getRepairable(itemMaterial, repairMaterial, repairMetadata, null, 0, minimumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
}
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
return getRepairable(itemMaterial, repairMaterial, repairMetadata, null, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
}
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, String repairMaterialPrettyName, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
// TODO: Add in loading from config what type of repairable we want.
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, repairMaterialPrettyName, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
}
}

View File

@@ -11,16 +11,14 @@ public class SimpleRepairable implements Repairable {
private final int minimumQuantity, minimumLevel;
private final short maximumDurability, baseRepairDurability;
private final byte repairMetadata;
private String repairMaterialPrettyName;
private final ItemType repairItemType;
private final MaterialType repairMaterialType;
private final double xpMultiplier;
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, String repairMaterialPrettyName, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
this.itemMaterial = type;
this.repairMaterial = repairMaterial;
this.repairMetadata = repairMetadata;
this.repairMaterialPrettyName = repairMaterialPrettyName;
this.repairItemType = repairItemType;
this.repairMaterialType = repairMaterialType;
this.minimumLevel = minimumLevel;
@@ -45,11 +43,6 @@ public class SimpleRepairable implements Repairable {
return repairMetadata;
}
@Override
public String getRepairMaterialPrettyName() {
return repairMaterialPrettyName;
}
@Override
public ItemType getRepairItemType() {
return repairItemType;

View File

@@ -84,6 +84,8 @@ public class SalvageManager extends SkillManager {
return;
}
byte salvageMaterialMetadata = salvageable.getSalvageMaterialMetadata();
int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
if (salvageableAmount == 0) {
@@ -106,8 +108,6 @@ public class SalvageManager extends SkillManager {
}
}
byte salvageMaterialMetadata = (salvageable.getSalvageMaterialMetadata() != (byte) -1) ? salvageable.getSalvageMaterialMetadata() : 0;
Misc.dropItems(location, new MaterialData(salvageable.getSalvageMaterial(), salvageMaterialMetadata).toItemStack(salvageableAmount), 1);
// BWONG BWONG BWONG - CLUNK!

View File

@@ -7,37 +7,37 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
public interface Salvageable {
/**
* Gets the type of this salvageable item
* Gets the type of this repairable item
*
* @return the type of this salvageable
* @return the type of this repairable
*/
public Material getItemMaterial();
/**
* Gets the material of the items dropped when salvaging this item
* Gets the id of the material used to repair this item
*
* @return the material of the salvage drop
* @return the id of the repair material
*/
public Material getSalvageMaterial();
/**
* Gets the metadata byte value of the items dropped when salvaging this item
* Gets the metadata byte value of the material used to repair this item
*
* @return the byte metadata of the salvage drop
* @return the byte metadata of the repair material
*/
public byte getSalvageMaterialMetadata();
/**
* Gets the ItemType value for this salvageable item
* Gets the RepairItemType value for this repairable item
*
* @return the ItemType for this salvageable
* @return the RepairItemType for this repairable
*/
public ItemType getSalvageItemType();
/**
* Gets the MaterialType value for this salvageable item
* Gets the RepairMaterialType value for this repairable item
*
* @return the MaterialType for this salvageable
* @return the RepairMaterialType for this repairable
*/
public MaterialType getSalvageMaterialType();
@@ -58,25 +58,25 @@ public interface Salvageable {
public short getMaximumDurability();
/**
* Gets the base salvage durability on which to calculate bonuses.
* Gets the base repair durability on which to calculate bonuses.
*
* This is actually the maximum durability divided by the minimum quantity
*
* @return the base salvage durability
* @return the base repair durability
*/
public short getBaseSalvageDurability();
/**
* Gets the minimum salvage level needed to salvage this item
* Gets the minimum repair level needed to repair this item
*
* @return the minimum level to salvage this item, or 0 for no minimum
* @return the minimum level to repair this item, or 0 for no minimum
*/
public int getMinimumLevel();
/**
* Gets the xpMultiplier for this salvageable
* Gets the xpMultiplier for this repairable
*
* @return the xpMultiplier of this salvageable
* @return the xpMultiplier of this repairable
*/
public double getXpMultiplier();
}

View File

@@ -1,11 +1,8 @@
package com.gmail.nossr50.skills.swords;
import java.util.Map;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@@ -99,8 +96,8 @@ public class SwordsManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event
*/
public void serratedStrikes(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, modifiers, skill);
public void serratedStrikes(LivingEntity target, double damage) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, skill);
BleedTimerTask.add(target, Swords.serratedStrikesBleedTicks);
}
}

View File

@@ -18,12 +18,14 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.XPGainReason;
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class TamingManager extends SkillManager {
@@ -94,16 +96,18 @@ public class TamingManager extends SkillManager {
* @param damage The damage being absorbed by the wolf
*/
public void fastFoodService(Wolf wolf, double damage) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.FAST_FOOD, getPlayer(), Taming.fastFoodServiceActivationChance, activationChance)) {
return;
}
double chance = Taming.fastFoodServiceActivationChance / activationChance;
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 maxHealth = wolf.getMaxHealth();
double health = wolf.getHealth();
double maxHealth = wolf.getMaxHealth();
if (health < maxHealth) {
double newHealth = health + damage;
wolf.setHealth(Math.min(newHealth, maxHealth));
if (health < maxHealth) {
double newHealth = health + damage;
wolf.setHealth(Math.min(newHealth, maxHealth));
}
}
}
@@ -112,8 +116,9 @@ public class TamingManager extends SkillManager {
*
* @param target The LivingEntity to apply Gore on
* @param damage The initial damage
* @param wolf The wolf using the ability
*/
public double gore(LivingEntity target, double damage) {
public double gore(LivingEntity target, double damage, Wolf wolf) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.GORE, getPlayer(), getSkillLevel(), activationChance)) {
return 0;
}
@@ -127,11 +132,11 @@ public class TamingManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
damage = (damage * Taming.goreModifier) - damage;
return damage;
return CombatUtils.callFakeDamageEvent(wolf, target, damage);
}
public double sharpenedClaws() {
return Taming.sharpenedClawsBonusDamage;
public double sharpenedClaws(LivingEntity target, Wolf wolf) {
return CombatUtils.callFakeDamageEvent(wolf, target, Taming.sharpenedClawsBonusDamage);
}
/**

View File

@@ -69,9 +69,6 @@ public class Unarmed {
nextSlot++;
}
// Inventory is full - cancel the item pickup
return false;
}
else if (firstEmpty != -1) {
drop.remove();

View File

@@ -22,6 +22,7 @@ import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class UnarmedManager extends SkillManager {
@@ -56,10 +57,6 @@ public class UnarmedManager extends SkillManager {
}
public boolean blockCrackerCheck(BlockState blockState) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.BLOCK_CRACKER, getPlayer())) {
return false;
}
MaterialData data = blockState.getData();
switch (blockState.getType()) {
@@ -120,23 +117,24 @@ public class UnarmedManager extends SkillManager {
/**
* Handle the effects of the Berserk ability
*
* @param target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event
*/
public double berserkDamage(double damage) {
public double berserkDamage(LivingEntity target, double damage) {
damage = (damage * Unarmed.berserkDamageModifier) - damage;
return damage;
return CombatUtils.callFakeDamageEvent(getPlayer(), target, damage);
}
/**
* Handle the effects of the Iron Arm ability
*
* @param target The {@link LivingEntity} being affected by the ability
*/
public double ironArm() {
if (!SkillUtils.activationSuccessful(SecondaryAbility.IRON_ARM, getPlayer())) {
return 0;
}
public double ironArm(LivingEntity target) {
double unarmedBonus = Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
return Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
return CombatUtils.callFakeDamageEvent(getPlayer(), target, unarmedBonus);
}
/**

View File

@@ -173,4 +173,5 @@ public class WoodcuttingManager extends SkillManager {
applyXpGain(xp, XPGainReason.PVE);
}
}

View File

@@ -308,12 +308,6 @@ public final class BlockUtils {
return type == Repair.anvilMaterial || type == Salvage.anvilMaterial;
}
public static boolean isPistonPiece(BlockState blockState) {
Material type = blockState.getType();
return type == Material.PISTON_MOVING_PIECE || type == Material.AIR;
}
/**
* Get a HashSet containing every transparent block
*

View File

@@ -8,7 +8,6 @@ import org.bukkit.entity.Fish;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.PluginManager;
import com.gmail.nossr50.mcMMO;
@@ -16,7 +15,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
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.XPGainReason;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent;
@@ -36,7 +34,6 @@ import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEve
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent;
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
@@ -49,13 +46,6 @@ public class EventUtils {
return event;
}
public static SecondaryAbilityEvent callSecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
SecondaryAbilityEvent event = new SecondaryAbilityEvent(player, secondaryAbility);
mcMMO.p.getServer().getPluginManager().callEvent(event);
return event;
}
public static FakePlayerAnimationEvent callFakeArmSwingEvent(Player player) {
FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
@@ -204,26 +194,4 @@ public class EventUtils {
return event;
}
/**
* There is a bug in CraftBukkit that causes piston events to
* fire multiple times. Check this method to see if the piston event
* should be processed.
*
* @param block Block object of the piston block
* @param isExtendEvent should be true when called from BlockPistonExtendEvent
*
* @return true if the PistonEvent should be processed, false otherwise
*/
public static boolean shouldProcessEvent(Block block, boolean isExtendEvent) {
String pistonAction = isExtendEvent ? "EXTEND" : "RETRACT";
String lastAction = block.hasMetadata(mcMMO.pistonDataKey) ? block.getMetadata(mcMMO.pistonDataKey).get(0).asString() : "";
if (!lastAction.equals(pistonAction)) {
block.setMetadata(mcMMO.pistonDataKey, new FixedMetadataValue(mcMMO.p, pistonAction));
return true;
}
return false;
}
}

View File

@@ -11,8 +11,6 @@ import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.google.common.collect.ImmutableList;
public final class UserManager {
private UserManager() {}
@@ -52,8 +50,8 @@ public final class UserManager {
* Save all users ON THIS THREAD.
*/
public static void saveAll() {
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.size() + ")");
Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers();
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.length + ")");
for (Player player : onlinePlayers) {
getPlayer(player).getProfile().save();

View File

@@ -22,7 +22,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
@@ -159,8 +158,8 @@ public class ScoreboardManager {
// Called in onDisable()
public static void teardownAll() {
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")");
Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers();
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.length + ")");
for (Player player : onlinePlayers) {
teardownPlayer(player);
}

View File

@@ -1,9 +1,5 @@
package com.gmail.nossr50.util.skills;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Animals;
@@ -19,11 +15,11 @@ import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -48,16 +44,12 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableMap;
public final class CombatUtils {
private CombatUtils() {}
private static void processSwordCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
private static void processSwordCombat(LivingEntity target, Player player, double damage) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
double initialDamage = event.getDamage();
Map<DamageModifier, Double> modifiers = getModifiers(event);
if (swordsManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.SWORDS);
@@ -68,7 +60,7 @@ public final class CombatUtils {
}
if (swordsManager.canUseSerratedStrike()) {
swordsManager.serratedStrikes(target, initialDamage, modifiers);
swordsManager.serratedStrikes(target, damage);
}
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
@@ -77,7 +69,6 @@ public final class CombatUtils {
private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
double initialDamage = event.getDamage();
double finalDamage = initialDamage;
Map<DamageModifier, Double> modifiers = getModifiers(event);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
AxesManager axesManager = mcMMOPlayer.getAxesManager();
@@ -87,7 +78,7 @@ public final class CombatUtils {
}
if (axesManager.canUseAxeMastery()) {
finalDamage += axesManager.axeMastery();
finalDamage += axesManager.axeMastery(target);
}
if (axesManager.canCriticalHit(target)) {
@@ -102,10 +93,10 @@ public final class CombatUtils {
}
if (axesManager.canUseSkullSplitter(target)) {
axesManager.skullSplitterCheck(target, initialDamage, modifiers);
axesManager.skullSplitterCheck(target, initialDamage);
}
applyScaledModifiers(initialDamage, finalDamage, event);
event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.AXES);
}
@@ -121,18 +112,18 @@ public final class CombatUtils {
}
if (unarmedManager.canUseIronArm()) {
finalDamage += unarmedManager.ironArm();
finalDamage += unarmedManager.ironArm(target);
}
if (unarmedManager.canUseBerserk()) {
finalDamage += unarmedManager.berserkDamage(initialDamage);
finalDamage += unarmedManager.berserkDamage(target, initialDamage);
}
if (unarmedManager.canDisarm(target)) {
unarmedManager.disarmCheck((Player) target);
}
applyScaledModifiers(initialDamage, finalDamage, event);
event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
}
@@ -148,14 +139,14 @@ public final class CombatUtils {
}
if (tamingManager.canUseSharpenedClaws()) {
finalDamage += tamingManager.sharpenedClaws();
finalDamage += tamingManager.sharpenedClaws(target, wolf);
}
if (tamingManager.canUseGore()) {
finalDamage += tamingManager.gore(target, initialDamage);
finalDamage += tamingManager.gore(target, initialDamage, wolf);
}
applyScaledModifiers(initialDamage, finalDamage, event);
event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.TAMING);
}
@@ -179,11 +170,11 @@ public final class CombatUtils {
}
if (archeryManager.canSkillShot()) {
finalDamage += archeryManager.skillShot(initialDamage);
finalDamage += archeryManager.skillShot(target, initialDamage, arrow);
}
if (archeryManager.canDaze(target)) {
finalDamage += archeryManager.daze((Player) target);
finalDamage += archeryManager.daze((Player) target, arrow);
}
if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canRetrieveArrows()) {
@@ -192,7 +183,7 @@ public final class CombatUtils {
archeryManager.distanceXpBonus(target, arrow);
applyScaledModifiers(initialDamage, finalDamage, event);
event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
}
@@ -236,7 +227,7 @@ public final class CombatUtils {
}
if (SkillType.SWORDS.getPermissions(player)) {
processSwordCombat(target, player, event);
processSwordCombat(target, player, event.getDamage());
}
}
else if (ItemUtils.isAxe(heldItem)) {
@@ -317,7 +308,6 @@ public final class CombatUtils {
* @param target LivingEntity which to attempt to damage
* @param damage Amount of damage to attempt to do
*/
@Deprecated
public static void dealDamage(LivingEntity target, double damage) {
dealDamage(target, damage, DamageCause.CUSTOM, null);
}
@@ -329,7 +319,6 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
@Deprecated
public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker) {
dealDamage(target, damage, DamageCause.ENTITY_ATTACK, attacker);
}
@@ -341,23 +330,6 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
public static void dealDamage(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers, LivingEntity attacker) {
if (target.isDead()) {
return;
}
// Aren't we applying the damage twice????
target.damage(callFakeDamageEvent(attacker, target, damage, modifiers));
}
/**
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
*
* @param target LivingEntity which to attempt to damage
* @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
@Deprecated
public static void dealDamage(LivingEntity target, double damage, DamageCause cause, Entity attacker) {
if (target.isDead()) {
return;
@@ -374,7 +346,7 @@ public final class CombatUtils {
* @param damage The initial damage amount
* @param type The type of skill being used
*/
public static void applyAbilityAoE(Player attacker, LivingEntity target, double damage, Map<DamageModifier, Double> modifiers, SkillType type) {
public static void applyAbilityAoE(Player attacker, LivingEntity target, double damage, SkillType type) {
int numberOfTargets = getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
double damageAmount = Math.max(damage, 1);
@@ -410,7 +382,7 @@ public final class CombatUtils {
break;
}
dealDamage(livingEntity, damageAmount, modifiers, attacker);
dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--;
}
}
@@ -595,86 +567,23 @@ public final class CombatUtils {
return false;
}
@Deprecated
public static double callFakeDamageEvent(Entity attacker, Entity target, double damage) {
return callFakeDamageEvent(attacker, target, DamageCause.ENTITY_ATTACK, new EnumMap<DamageModifier, Double>(ImmutableMap.of(DamageModifier.BASE, damage)));
return callFakeDamageEvent(attacker, target, DamageCause.ENTITY_ATTACK, damage);
}
@Deprecated
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause damageCause, double damage) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, damageCause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, damageCause, damage);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause cause, double damage) {
if (Config.getInstance().getEventCallbackEnabled()) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, cause, damage);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
if (damageEvent.isCancelled()) {
return 0;
}
return damageEvent.getFinalDamage();
}
public static double callFakeDamageEvent(Entity attacker, Entity target, Map<DamageModifier, Double> modifiers) {
return callFakeDamageEvent(attacker, target, DamageCause.ENTITY_ATTACK, modifiers);
}
public static double callFakeDamageEvent(Entity attacker, Entity target, double damage, Map<DamageModifier, Double> modifiers) {
return callFakeDamageEvent(attacker, target, DamageCause.ENTITY_ATTACK, getScaledModifiers(damage, modifiers));
}
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause cause, Map<DamageModifier, Double> modifiers) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
if (damageEvent.isCancelled()) {
return 0;
}
return damageEvent.getFinalDamage();
}
private static Map<DamageModifier, Double> getModifiers(EntityDamageEvent event) {
Map<DamageModifier, Double> modifiers = new HashMap<DamageModifier, Double>();
for (DamageModifier modifier : DamageModifier.values()) {
modifiers.put(modifier, event.getDamage(modifier));
}
return modifiers;
}
private static Map<DamageModifier, Double> getScaledModifiers(double damage, Map<DamageModifier, Double> modifiers) {
Map<DamageModifier, Double> scaledModifiers = new HashMap<DamageModifier, Double>();
for (DamageModifier modifier : modifiers.keySet()) {
if (modifier == DamageModifier.BASE) {
scaledModifiers.put(modifier, damage);
continue;
if (damageEvent.isCancelled()) {
return 0;
}
scaledModifiers.put(modifier, damage * modifiers.get(modifier));
damage = damageEvent.getDamage();
}
return scaledModifiers;
}
public static EntityDamageByEntityEvent applyScaledModifiers(double initialDamage, double finalDamage, EntityDamageByEntityEvent event) {
// No additional damage
if (initialDamage == finalDamage) {
return event;
}
for (DamageModifier modifier : DamageModifier.values()) {
if (!event.isApplicable(modifier)) {
continue;
}
if (modifier == DamageModifier.BASE) {
event.setDamage(modifier, finalDamage);
continue;
}
event.setDamage(modifier, finalDamage / initialDamage * event.getDamage(modifier));
}
return event;
return damage;
}
/**

View File

@@ -24,10 +24,8 @@ 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.events.skills.secondaryabilities.SecondaryAbilityEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
@@ -207,25 +205,13 @@ public class SkillUtils {
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance) && !event.isCancelled();
}
public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, double staticChance, int activationChance) {
double chance = staticChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance) && !event.isCancelled();
}
public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player) {
SecondaryAbilityEvent event = EventUtils.callSecondaryAbilityEvent(player, skillAbility);
return !event.isCancelled();
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance);
}
public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
return (event.getChance() * activationChance) > (Misc.getRandom().nextDouble() * activationChance) && !event.isCancelled();
return (event.getChance() * activationChance) > (Misc.getRandom().nextDouble() * activationChance);
}
private static boolean isLocalizedSkill(String skillName) {

View File

@@ -1,65 +0,0 @@
package com.gmail.nossr50.util.upgrade;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.database.UpgradeType;
public class UpgradeManager extends ConfigLoader {
private final Set<UpgradeType> setNeededUpgrades;
public UpgradeManager() {
super("upgrades.yml");
setNeededUpgrades = EnumSet.allOf(UpgradeType.class);
loadKeys();
}
/**
* Check if the given {@link UpgradeType} is necessary.
*
* @param type Upgrade type to check
*
* @return true if plugin data needs to have the given upgrade
*/
public boolean shouldUpgrade(final UpgradeType type) {
return setNeededUpgrades.contains(type);
}
/**
* Set the given {@link UpgradeType} as completed. Does nothing if
* the upgrade was applied previously.
*
* @param type Upgrade type to set as complete
*/
public void setUpgradeCompleted(final UpgradeType type) {
if (!setNeededUpgrades.remove(type)) {
return;
}
plugin.debug("Saving upgrade status for type " + type.toString() + "...");
config.set("Upgrades_Finished." + type.toString(), true);
try {
config.save(getFile());
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void loadKeys() {
for (UpgradeType type : UpgradeType.values()) {
if (config.getBoolean("Upgrades_Finished." + type.toString())) {
setNeededUpgrades.remove(type);
}
}
plugin.debug("Needed upgrades: " + Arrays.toString(setNeededUpgrades.toArray(new UpgradeType[setNeededUpgrades.size()])));
}
}

View File

@@ -17,6 +17,8 @@ General:
# Allow mcMMO to check if a new version is available
Update_Check: true
Prefer_Beta: false
# Allow mcMMO to inform other plugins of damage being dealt
Event_Callback: true
Power_Level_Cap: 0
# Should mcMMO print out debug messages?
Verbose_Logging: false
@@ -352,9 +354,6 @@ Skills:
Level_Cap: 0
Block_Cracker:
SmoothBrick_To_CrackedBrick: true
# When using Unarmed, picked up items will automatically get moved to a free slot instead of going in the slot
# of your hand. Should item pickup be disabled when your entire inventory - except for your hand - is full?
Item_Pickup_Disabled_Full_Inventory: true
Woodcutting:
Tree_Feller_Sounds: true
Level_Cap: 0

View File

@@ -739,7 +739,7 @@ Guides.Axes.Section.5=[[DARK_AQUA]]How does Greater Impact work?\n[[YELLOW]]You
##Excavation
Guides.Excavation.Section.0=[[DARK_AQUA]]About Excavation:\n[[YELLOW]]Excavation is the act of digging up dirt to find treasures.\n[[YELLOW]]By excavating the land you will find treasures.\n[[YELLOW]]The more you do this the more treasures you can find.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill you must dig with a shovel in hand.\n[[YELLOW]]Only certain materials can be dug up for treasures and XP.
Guides.Excavation.Section.1=[[DARK_AQUA]]Compatible Materials:\n[[YELLOW]]Grass, Dirt, Sand, Clay, Gravel, Mycelium, Soul Sand, Snow
Guides.Excavation.Section.1=[[DARK_AQUA]]Compatible Materials:\n[[YELLOW]]Grass, Dirt, Sand, Clay, Gravel, Mycelium, Soul Sand
Guides.Excavation.Section.2=[[DARK_AQUA]]How to use Giga Drill Breaker:\n[[YELLOW]]With a shovel in hand right click to ready your tool.\n[[YELLOW]]Once in this state you have about 4 seconds to make\n[[YELLOW]]contact with Excavation compatible materials this will\n[[YELLOW]]activate Giga Drill Breaker.
Guides.Excavation.Section.3=[[DARK_AQUA]]What is Giga Drill Breaker?\n[[YELLOW]]Giga Drill Breaker is an ability with a cooldown\n[[YELLOW]]tied to Excavation skill. It triples your chance\n[[YELLOW]]of finding treasures and enables instant break\n[[YELLOW]]on Excavation materials.
Guides.Excavation.Section.4=[[DARK_AQUA]]How does Treasure Hunter work?\n[[YELLOW]]Every possible treasure for Excavation has its own\n[[YELLOW]]skill level requirement for it to drop, as a result it's\n[[YELLOW]]difficult to say how much it is helping you.\n[[YELLOW]]Just keep in mind that the higher your Excavation skill\n[[YELLOW]]is, the more treasures that can be found.\n[[YELLOW]]And also keep in mind that each type of Excavation\n[[YELLOW]]compatible material has its own unique list of treasures.\n[[YELLOW]]In other words you will find different treasures in Dirt\n[[YELLOW]]than you would in Gravel.

View File

@@ -1,47 +1,4 @@
#
# Armor example configuration
# Last updated on ${project.version}-b${BUILD_NUMBER}
#
# Any file named armor.*.yml in the mod folder will be loaded as a armor config
# For every armor type there is a separate section.
# The names of each subitem should be the exact material name.
# The bare minimum of an Armor piece is that it has a Repair_Material
#
#
# Repairable: Whether or not the item is repairable
## This defaults to true
#
# Repair_Material: This is the material name of the item used to repair this armor.
## This is required to be set if you want to be able to repair the item.
#
# Repair_Material_Data_Value: This is the metadata of the item used to repair this armor.
## A value of -1 means to ignore all metadata when repairing.
## This defaults to -1
#
# Repair_Material_Quantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3
## This defaults to 9
#
# Repair_Material_Pretty_Name: The pretty name of the repair material.
## Used in the feedback message when not enough repair materials are found.
## This defaults to the Repair_Material converted to string.
#
# Repair_Material_Pretty_Name: The pretty name of the repair material.
## Used in the feedback message when not enough repair materials are found.
## This defaults to the Repair_Material converted to string.
#
# Repair_MinimumLevel: This is the minimum repair level needed to repair this item.
## Valid values are => 0
## This defaults to 0
#
# Repair_XpMultiplier: This is the amount to multiply the xp bonus by.
## This defaults to 1
#
# Durability: This is the maximum durability of the armor.
## Valid values are >= 1
#
###
#
# Settings for Boots
###
Boots:
@@ -50,18 +7,12 @@ Boots:
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
Boot_2:
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
#
# Settings for Chestplates
@@ -72,18 +23,12 @@ Chestplates:
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
Chestplate_2:
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
#
# Settings for Helmets
@@ -94,18 +39,12 @@ Helmets:
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
Helmet_2:
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
#
# Settings for Leggings
@@ -116,16 +55,10 @@ Leggings:
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999
Legging_2:
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 999

View File

@@ -1,220 +1,132 @@
#
# Tools example configuration
# Last updated on ${project.version}-b${BUILD_NUMBER}
#
# Any file named tools.*.yml in the mod folder will be loaded as a tools config
# For every tool type there is a separate section.
# The names of each subitem should be the exact material name.
# The bare minimum of a Tool is that it has a Repair_Material
#
#
#
# XP_Modifier: This is the xp modifier of the tool, xp is multiplied by this modifier.
## Valid values are > 0
## This defaults to 1.0.
#
# Tier: The tier of the tool
## Used to determine the capabilities of AoE abilities with certain skills
## Valid values range from 1 to 4
## This defaults to 1
#
# Ability_Enabled: Whether or not abilities are enabled with this tool
## This defaults to true
#
# Repairable: Whether or not the item is repairable
## This defaults to true
#
# Repair_Material: This is the material name of the item used to repair this tool.
## This is required to be set if you want to be able to repair the item.
#
# Repair_Material_Data_Value: This is the metadata of the item used to repair this tool.
## A value of -1 means to ignore all metadata when repairing.
## This defaults to -1
#
# Repair_Material_Quantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses.
## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3
## This defaults to 9
#
# Repair_Material_Pretty_Name: The pretty name of the repair material.
## Used in the feedback message when not enough repair materials are found.
## This defaults to the Repair_Material converted to string.
#
# Repair_MinimumLevel: This is the minimum repair level needed to repair this item.
## Valid values are => 0
## This defaults to 0
#
# Repair_XpMultiplier: This is the amount to multiply the xp bonus by.
## This defaults to 1
#
# Durability: This is the maximum durability of the tool.
## Valid values are >= 1
#
###
#
# Settings for Axes
###
Axes:
Axe_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Axe_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
#
# Settings for Bows
###
Bows:
Bow_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Bow_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
#
# Settings for Hoes
###
Hoes:
Hoe_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Hoe_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
#
# Settings for Pickaxes
###
Pickaxes:
Pickaxe_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Pickaxe_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
#
# Settings for Shovels
###
Shovels:
Shovel_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Shovel_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
#
# Settings for Swords
###
Swords:
Sword_1:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999
Sword_2:
XP_Modifier: 1.0
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: REPAIR_MATERIAL_NAME
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Repair_Material_Pretty_Name: Repair Item Name
Repair_MinimumLevel: 0
Repair_XpMultiplier: 1.0
Durability: 9999

View File

@@ -1954,11 +1954,6 @@ permissions:
children:
mcmmo.ability.repair.all: true
mcmmo.commands.repair: true
mcmmo.skills.salvage:
description: Allows access to the Salvage skill
children:
mcmmo.ability.salvage.all: true
mcmmo.commands.salvage: true
mcmmo.skills.smelting:
description: Allows access to the Smelting skill
children:

View File

@@ -1,9 +0,0 @@
# WARNING: DO NOT MODIFY THIS CONFIG
Upgrades_Finished:
ADD_FISHING: false
ADD_BLAST_MINING_COOLDOWN: false
ADD_SQL_INDEXES: false
ADD_MOB_HEALTHBARS: false
DROP_SQL_PARTY_NAMES: false
DROP_SPOUT: false
ADD_ALCHEMY: false

View File

@@ -58,13 +58,12 @@ finally () {</pre>
break;
case 2:</pre>
* Prefer early returns over method indentation. Example:
* <pre>if (!precondition) {
// Possibly cleanup
return;
* Whenever possible, check for a negative, rather than a positive
* <pre>if (!something) {
// Do things
}
// Continue with task</pre>
// Do other things</pre>
* Java standard class and method naming, with exception to McMMO in a class name
* <pre>thisIsAMethod()</pre>
* <pre>ThisIsAClass</pre>
@@ -89,6 +88,8 @@ finally () {</pre>
* protected
* static protected
* abstract protected
* override private
* private
* static private
* No one-line if statements, they should all have brackets
* abstract private
* No one-line if statements, they should all have brackets