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

Compare commits

..

43 Commits

Author SHA1 Message Date
TfT_02
b791649432 Also include the end value! 2014-06-09 18:22:40 +02:00
TfT_02
306ac5d949 Add debug messages 2014-06-09 17:21:06 +02:00
TfT_02
fb75eac1f7 Minor cleanup 2014-06-09 17:20:55 +02:00
TfT_02
44a4448527 Add support for data value ranges in blocks.yml
For example `Block_1|0-5`
2014-06-09 13:43:34 +02:00
TfT_02
001ea19b1c Update pom.xml and changelog 2014-06-09 00:07:34 +02:00
TfT_02
3f347091c4 Update changelog 2014-06-09 00:05:06 +02:00
TfT_02
f4dbbd7e57 Fix an IndexOutOfBoundsException: Index: 0
In SaveTimerTask.java

Fixes #2039
2014-06-09 00:05:05 +02:00
TfT_02
e4d3cb5f4d Remove PvpLogger checks
No longer needed when testing with Combat Tag v6.1.4, the NPCs have
metadata „NPC”.

Fixes #2017
2014-06-09 00:05:05 +02:00
riking
e455b41ab9 Save users asynchronously 2014-06-09 00:05:05 +02:00
TfT_02
ea704a87db Remove this check here, allows Salvage in Adv mode
We’re already checking if the players game mode isn’t CREATIVE, so we
can safely remove this check.

Fixes #2059
2014-06-09 00:05:04 +02:00
TfT_02
813d9049c2 Added missing Salvage permissions to plugin.yml 2014-06-09 00:05:04 +02:00
TfT_02
67314e1320 Actually fix maximumQuantity reading from config
Now we try to automatically detect the maximum quantity if possible and
fall back to the config if the user has set a value there.

Also fixed the feedback message which said „Minimum quantity” instead
of „Maximum quantity”
2014-06-09 00:05:04 +02:00
TfT_02
0e6611c7e9 Check permission before sending anvil messages 2014-06-09 00:05:04 +02:00
TfT_02
7d82d5ff7b Let config key take priority here 2014-06-09 00:05:04 +02:00
TfT_02
eb51081a66 Cleanup RepairConfig leftovers in SalvageConfig
Some copy/pasta I forgot to remove
2014-06-09 00:05:03 +02:00
TfT_02
00c89d2cf6 Fix Maximum Quantity in Salvage configs 2014-06-09 00:05:03 +02:00
TfT_02
d88afaf696 Don't display child skills on scoreboards
This fixes an issue where the scoreboard would not display properly
when using /mcstats or /inspect.

Fixes #2037
2014-06-09 00:05:01 +02:00
TfT_02
c6be608e5e Add SALVAGE to MISC_SKILLS List 2014-06-09 00:03:34 +02:00
TfT_02
9def3d5eb4 Add changelog entry for Salvage child skill
Closes #561
2014-06-09 00:03:34 +02:00
TfT_02
a052bfda7e Minor cleanup of imports 2014-06-09 00:03:33 +02:00
TfT_02
c35c3c0dab A whole bunch of more work to convert Salvage to a child skill 2014-06-09 00:03:32 +02:00
GJ
23f5946cac Convert Salvage to a child skill. 2014-06-09 00:03:30 +02:00
TfT_02
813eeb8873 Fix a NPE when tab completing with /ptp
Fixes #2013
2014-06-09 00:03:29 +02:00
TfT_02
8e60403fc1 Fix a bunch of small formatting issues 2014-06-09 00:03:23 +02:00
Sean Porter
23b4ff7134 Redstone ore now throws events when it flips on or off.
Fixes issue #2021
2014-06-09 00:02:49 +02:00
TfT_02
b16dec4532 Added API to check if an entity is bleeding 2014-06-09 00:02:49 +02:00
TfT_02
271ba2e5f1 Use getAllyName() here instead 2014-06-09 00:02:48 +02:00
TfT_02
c9ab2bebd6 Add option to prevent hopper transfers of bottles 2014-06-09 00:02:48 +02:00
TfT_02
ef4bbca36a Update README.md 2014-06-09 00:02:47 +02:00
TfT_02
ad789ea2bf Fix /party teleport command
Why did we use getCommand("ptp").getExecutor() again?

Fixes #1995
2014-06-09 00:02:47 +02:00
TfT_02
b848968094 Added API to XP events to get XP gain reason 2014-06-09 00:01:24 +02:00
Sean Porter
c572054e67 Fix the calculations for Iron Arm Style in the Unarmed command. 2014-06-09 00:00:36 +02:00
TfT_02
2e6a43ac97 Fix bug where dodge would check the wrong player 2014-06-09 00:00:35 +02:00
TfT_02
837e59d187 Check if player has a mcMMOPlayer object
Fixes #1976
2014-06-09 00:00:34 +02:00
TfT_02
7f7aa9e799 Prevent accidentally breaking regrown crops
Adds #828
2014-06-09 00:00:34 +02:00
TfT_02
10c18de9bf Added option to open /mcstats after logging in
Added #1033
2014-06-09 00:00:34 +02:00
TfT_02
0b92023937 Players need to be in a party to use /ptp
Fixes #1967
2014-06-09 00:00:33 +02:00
TfT_02
04f02ca7f4 Support MATERIAL|data format in treasures.yml
Allows users to use the same material type for multiple treasures in
treasures.yml

Fixes #1965
2014-06-09 00:00:33 +02:00
TfT_02
d701553efe Check event.getBow() != null
Fixes #1933
2014-06-09 00:00:32 +02:00
TfT_02
e812a949db Vanished players no longer get hit by AoE effects
Fixes #1964
2014-06-09 00:00:32 +02:00
TfT_02
f88dd29926 Updater should not be running on the main thread
Fixes #1957
2014-06-09 00:00:26 +02:00
TfT_02
c588708056 Move PlayerUpdateInventoryTask to runnables.player 2014-06-08 23:59:52 +02:00
TfT_02
a9f800ac68 Add option to drop extra fish
Allows enabling of old fishing mechanic where fish was always caught,
even when a treasure was found
2014-06-08 23:59:20 +02:00
119 changed files with 879 additions and 2413 deletions

View File

@@ -7,7 +7,7 @@ Key:
! Change ! Change
- Removal - Removal
Version 1.5.01-dev Version 1.4.09-dev
+ Added new child skill; Salvage + Added new child skill; Salvage
+ Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second + Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
+ Added option to config.yml to show the /mcstats scoreboard automatically after logging in + Added option to config.yml to show the /mcstats scoreboard automatically after logging in
@@ -15,50 +15,17 @@ Version 1.5.01-dev
+ Added support for `MATERIAL|data` format in treasures.yml + Added support for `MATERIAL|data` format in treasures.yml
+ Added API to experience events to get XP gain reason + Added API to experience events to get XP gain reason
+ Added API to check if an entity is bleeding + 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 where the Updater was running on the main thread.
= Fixed bug when players would use /ptp without being in a party = 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 player didn't have a mcMMOPlayer object in AsyncPlayerChatEvent
= Fixed bug where dodge would check the wrong player skill level = Fixed bug where dodge would check the wrong player skill level
= Fixed bug which causes /party teleport to stop working = Fixed bug which causes /party teleport to stop working
= Fixed bug where SaveTimerTask would produce an IndexOutOfBoundsException = 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 ! Changed player data saving. Save tasks are now asynchronous
! Vanished players no longer get hit by AoE effects ! Vanished players no longer get hit by AoE effects
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients' ! 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 - Removed salvage ability from Repair, salvage has it's own (child) skill now
Version 1.5.00
+ Added Podzol & Red Sand to Excavation
+ Added Hardened Clay, Stained Clay, and Packed Ice to Mining blocks
+ Added Acacia and Dark Oak to Woodcutting blocks
+ Added Salmon, Clownfish, and Pufferfish to Fishing XP
+ Added new flowers and grasses to Herbalism XP
+ Added option to config.yml which allows players to always catch fish, even when a treasure is found
+ Added option to config.yml to override vanilla Minecraft treasures
! Fishing XP now depends on the type of fish.
! Woodcutting XP in experience.yml and Woodcutting double drops in config.yml now use the tree species names. Oak is now Generic, and Spruce is now Redwood.
! Red_Rose was replaced by Poppy, and so the key in experience.yml has been updated accordingly.
- Removed deprecated permission nodes
- Removed "Treasure found!" message
Version 1.4.08 Version 1.4.08
+ Added a new skill; Alchemy. Special thanks to EasyMFnE for creating this! + Added a new skill; Alchemy. Special thanks to EasyMFnE for creating this!
+ Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances + Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances

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

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>1.5.01-SNAPSHOT</version> <version>1.4.09-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement> <issueManagement>
@@ -121,7 +121,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>LATEST</version> <version>1.6.4-R2.0</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

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; 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 org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; 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 { public class PartyChatManager extends ChatManager {
private Party party; private Party party;
@@ -25,6 +30,21 @@ public class PartyChatManager extends ChatManager {
@Override @Override
protected void sendMessage() { 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) { 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) { if (canRetrieve) {

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Biome;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -97,7 +98,9 @@ public class FishingCommand extends SkillCommand {
location = player.getLocation(); location = player.getLocation();
} }
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) { Biome biome = location.getBlock().getBiome();
if (biome == Biome.RIVER || biome == Biome.OCEAN) {
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
} }

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.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.mining.BlastMining.Tier; import com.gmail.nossr50.skills.mining.BlastMining.Tier;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@@ -127,7 +126,7 @@ public class MiningCommand extends SkillCommand {
} }
if (canBiggerBombs) { if (canBiggerBombs) {
int unlockLevel = BlastMining.getBiggerBombsUnlockLevel(); int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.TWO);
if (skillValue < unlockLevel) { if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.1", 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) { if (canDemoExpert) {
int unlockLevel = BlastMining.getDemolitionExpertUnlockLevel(); int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.FOUR);
if (skillValue < unlockLevel) { if (skillValue < unlockLevel) {
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.2", 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!"); 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!"); 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 getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.MaxBonus", 2.0D); }
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); } public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
public double 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); } public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }

View File

@@ -5,7 +5,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@@ -237,6 +236,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); } public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); } public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); } public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); } public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
@@ -452,7 +452,6 @@ public class Config extends AutoUpdateConfigLoader {
/* Fishing */ /* Fishing */
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); } public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
public boolean getFishingOverrideTreasures() { return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true); }
public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); } public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); }
/* Mining */ /* Mining */
@@ -474,7 +473,6 @@ public class Config extends AutoUpdateConfigLoader {
/* Unarmed */ /* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); } 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 */ /* Taming */
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); } public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
@@ -483,7 +481,10 @@ public class Config extends AutoUpdateConfigLoader {
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); } public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
/* Woodcutting */ /* Woodcutting */
public boolean getWoodcuttingDoubleDropsEnabled(TreeSpecies species) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); } public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); } public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
/* AFK Leveling */ /* AFK Leveling */

View File

@@ -3,18 +3,13 @@ package com.gmail.nossr50.config.experience;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.GrassSpecies;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.material.LongGrass;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.AutoUpdateConfigLoader; import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
public class ExperienceConfig extends AutoUpdateConfigLoader { public class ExperienceConfig extends AutoUpdateConfigLoader {
@@ -82,10 +77,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
*/ */
/* Alchemy */ /* Alchemy */
for (PotionStage potionStage : PotionStage.values()) { if (getPotionXP() <= 0) {
if (getPotionXP(potionStage) < 0) { reason.add("Experience.Alchemy.Potion should be greater than 0!");
reason.add("Experience.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
}
} }
/* Combat XP Multipliers */ /* Combat XP Multipliers */
@@ -110,7 +103,9 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
} }
/* Fishing */ /* Fishing */
// TODO: Add validation for each fish type once enum is available. if (getFishingBaseXP() <= 0) {
reason.add("Experience.Fishing.Base should be greater than 0!");
}
if (getFishingShakeXP() <= 0) { if (getFishingShakeXP() <= 0) {
reason.add("Experience.Fishing.Shake should be greater than 0!"); reason.add("Experience.Fishing.Shake should be greater than 0!");
@@ -131,12 +126,20 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
} }
/* Woodcutting */ /* Woodcutting */
for (TreeSpecies species : TreeSpecies.values()) { if (getWoodcuttingXPOak() <= 0) {
String key = "Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_"); reason.add("Experience.Woodcutting.Oak should be greater than 0!");
}
if (config.getInt(key) <= 0) { if (getWoodcuttingXPBirch() <= 0) {
reason.add(key + " should be greater than 0!"); reason.add("Experience.Woodcutting.Birch should be greater than 0!");
} }
if (getWoodcuttingXPSpruce() <= 0) {
reason.add("Experience.Woodcutting.Spruce should be greater than 0!");
}
if (getWoodcuttingXPJungle() <= 0) {
reason.add("Experience.Woodcutting.Jungle should be greater than 0!");
} }
if (getWoodcuttingXPHugeBrownMushroom() <= 0) { if (getWoodcuttingXPHugeBrownMushroom() <= 0) {
@@ -205,116 +208,12 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public double getFeatherFallXPModifier() { return config.getDouble("Experience.Acrobatics.FeatherFall_Multiplier", 2.0); } public double getFeatherFallXPModifier() { return config.getDouble("Experience.Acrobatics.FeatherFall_Multiplier", 2.0); }
/* Alchemy */ /* Alchemy */
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); } public double getPotionXP() { return config.getDouble("Experience.Alchemy.Potion", 150D); }
/* Fishing */ /* Fishing */
public int getFishXp(MaterialData data) { public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Fishing.Raw_Fish", 800);
case 0x1:
return config.getInt("Experience.Fishing.Raw_Salmon", 800);
case 0x2:
return config.getInt("Experience.Fishing.Clownfish", 800);
case 0x3:
return config.getInt("Experience.Fishing.Pufferfish", 800);
default:
return 0;
}
}
public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); } public int getFishingShakeXP() { return config.getInt("Experience.Fishing.Shake", 50); }
/* Herbalism */
public int getFlowerAndGrassXp(MaterialData data) {
Material type = data.getItemType();
if (type == Material.RED_ROSE) {
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Herbalism.Poppy", 100);
case 0x1:
return config.getInt("Experience.Herbalism.Blue_Orchid", 150);
case 0x2:
return config.getInt("Experience.Herbalism.Allium", 300);
case 0x3:
return config.getInt("Experience.Herbalism.Azure_Bluet", 150);
case 0x4:
return config.getInt("Experience.Herbalism.Red_Tulip", 150);
case 0x5:
return config.getInt("Experience.Herbalism.Orange_Tulip", 150);
case 0x6:
return config.getInt("Experience.Herbalism.White_Tulip", 150);
case 0x7:
return config.getInt("Experience.Herbalism.Pink_Tulip", 150);
case 0x8:
return config.getInt("Experience.Herbalism.Oxeye_Daisy", 150);
default:
return 0;
}
}
else if (type == Material.LONG_GRASS) {
GrassSpecies species = ((LongGrass) data).getSpecies();
if (species == null) {
return 0;
}
switch (species) {
case DEAD:
return config.getInt("Experience.Herbalism.Dead_Bush", 30);
case FERN_LIKE:
return config.getInt("Experience.Herbalism.Small_Fern", 10);
case NORMAL:
return config.getInt("Experience.Herbalism.Small_Grass", 10);
default:
return 0;
}
}
else if (type == Material.DOUBLE_PLANT) {
switch (data.getData()) {
case 0x0:
return config.getInt("Experience.Herbalism.Sunflower", 50);
case 0x1:
return config.getInt("Experience.Herbalism.Lilac", 50);
case 0x2:
return config.getInt("Experience.Herbalism.Tall_Grass", 50);
case 0x3:
return config.getInt("Experience.Herbalism.Tall_Fern", 50);
case 0x4:
return config.getInt("Experience.Herbalism.Rose_Bush", 50);
case 0x5:
return config.getInt("Experience.Herbalism.Peony", 50);
default:
return 0;
}
}
return 0;
}
/* Repair */ /* Repair */
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); } public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); } public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
@@ -325,7 +224,10 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); } public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
/* Woodcutting */ /* Woodcutting */
public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); } public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); } public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); } public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
} }

View File

@@ -85,17 +85,13 @@ public class CustomArmorConfig extends ConfigLoader {
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2); 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(); short durability = armorMaterial.getMaxDurability();
if (durability == 0) { if (durability == 0) {
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70); 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); materialList.add(armorMaterial);

View File

@@ -78,6 +78,7 @@ public class CustomBlockConfig extends ConfigLoader {
if (dataInfo.length == 2) { if (dataInfo.length == 2) {
byte startData = Byte.valueOf(dataInfo[0]); byte startData = Byte.valueOf(dataInfo[0]);
byte endData = Byte.valueOf(dataInfo[1]); byte endData = Byte.valueOf(dataInfo[1]);
System.out.println(blockName + " Data range; [" + startData + " - " + endData + "]");
for (byte blockData = startData; blockData <= endData; blockData++) { for (byte blockData = startData; blockData <= endData; blockData++) {
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData); MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
@@ -96,6 +97,7 @@ public class CustomBlockConfig extends ConfigLoader {
} }
private void loadBlock(String skillType, List<MaterialData> blockList, String blockName, MaterialData blockMaterialData) { private void loadBlock(String skillType, List<MaterialData> blockList, String blockName, MaterialData blockMaterialData) {
System.out.println("Loading block: " + blockMaterialData.getItemType() + " " + blockMaterialData.getData());
if (blockList != null) { if (blockList != null) {
blockList.add(blockMaterialData); blockList.add(blockMaterialData);
} }

View File

@@ -93,17 +93,13 @@ public class CustomToolConfig extends ConfigLoader {
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Quantity", 2); 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(); short durability = toolMaterial.getMaxDurability();
if (durability == 0) { if (durability == 0) {
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60); 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); double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);

View File

@@ -35,8 +35,6 @@ public class TreasureConfig extends ConfigLoader {
public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromSnow = new ArrayList<ExcavationTreasure>(); public List<ExcavationTreasure> excavationFromSnow = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromRedSand = new ArrayList<ExcavationTreasure>();
public List<ExcavationTreasure> excavationFromPodzol = new ArrayList<ExcavationTreasure>();
public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromBushes = new ArrayList<HylianTreasure>();
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
@@ -259,13 +257,13 @@ public class TreasureConfig extends ConfigLoader {
if (config.contains(type + "." + treasureName + ".Custom_Name")) { if (config.contains(type + "." + treasureName + ".Custom_Name")) {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(config.getString(type + "." + treasureName + ".Custom_Name")); itemMeta.setDisplayName(config.getString(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta); item.setItemMeta(itemMeta);
} }
if (config.contains(type + "." + treasureName + ".Lore")) { if (config.contains(type + "." + treasureName + ".Lore")) {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
itemMeta.setLore(config.getStringList(type + "." + treasureName + ".Lore")); itemMeta.setLore(config.getStringList(type + "." + treasureName + "Custom_Name"));
item.setItemMeta(itemMeta); item.setItemMeta(itemMeta);
} }
} }
@@ -376,14 +374,6 @@ public class TreasureConfig extends ConfigLoader {
if (dropList.contains("Snow")) { if (dropList.contains("Snow")) {
excavationFromSnow.add(excavationTreasure); excavationFromSnow.add(excavationTreasure);
} }
if (dropList.contains("Red_Sand")) {
excavationFromRedSand.add(excavationTreasure);
}
if (dropList.contains("Podzol")) {
excavationFromPodzol.add(excavationTreasure);
}
} }
else if (isHylian) { else if (isHylian) {
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel); HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);

View File

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

View File

@@ -4,7 +4,6 @@ import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
@@ -18,8 +17,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType; 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.PlayerStat;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -136,9 +135,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
success &= saveHuds(userId, (mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString())); success &= saveHuds(userId, (mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()));
success &= saveLongs( success &= saveLongs(
"UPDATE " + tablePrefix + "cooldowns SET " "UPDATE " + tablePrefix + "cooldowns SET "
+ " mining = ?, woodcutting = ?, unarmed = ?" + " mining = ?, woodcutting = ?, unarmed = ?"
+ ", herbalism = ?, excavation = ?, swords = ?" + ", herbalism = ?, excavation = ?, swords = ?"
+ ", axes = ?, blast_mining = ? WHERE user_id = ?", + ", axes = ?, blast_mining = ? WHERE user_id = ?",
userId, userId,
profile.getAbilityDATS(AbilityType.SUPER_BREAKER), profile.getAbilityDATS(AbilityType.SUPER_BREAKER),
profile.getAbilityDATS(AbilityType.TREE_FELLER), profile.getAbilityDATS(AbilityType.TREE_FELLER),
@@ -150,10 +149,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
profile.getAbilityDATS(AbilityType.BLAST_MINING)); profile.getAbilityDATS(AbilityType.BLAST_MINING));
success &= saveIntegers( success &= saveIntegers(
"UPDATE " + tablePrefix + "skills SET " "UPDATE " + tablePrefix + "skills SET "
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?" + " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?", + ", fishing = ?, alchemy = ? WHERE user_id = ?",
profile.getSkillLevel(SkillType.TAMING), profile.getSkillLevel(SkillType.TAMING),
profile.getSkillLevel(SkillType.MINING), profile.getSkillLevel(SkillType.MINING),
profile.getSkillLevel(SkillType.REPAIR), profile.getSkillLevel(SkillType.REPAIR),
@@ -170,10 +169,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
userId); userId);
success &= saveIntegers( success &= saveIntegers(
"UPDATE " + tablePrefix + "experience SET " "UPDATE " + tablePrefix + "experience SET "
+ " taming = ?, mining = ?, repair = ?, woodcutting = ?" + " taming = ?, mining = ?, repair = ?, woodcutting = ?"
+ ", unarmed = ?, herbalism = ?, excavation = ?" + ", unarmed = ?, herbalism = ?, excavation = ?"
+ ", archery = ?, swords = ?, axes = ?, acrobatics = ?" + ", archery = ?, swords = ?, axes = ?, acrobatics = ?"
+ ", fishing = ?, alchemy = ? WHERE user_id = ?", + ", fishing = ?, alchemy = ? WHERE user_id = ?",
profile.getSkillXpLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING),
profile.getSkillXpLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING),
profile.getSkillXpLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR),
@@ -243,8 +242,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) { for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
String skillName = skillType.name().toLowerCase(); String skillName = skillType.name().toLowerCase();
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + 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 " + "AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = ?)"; "WHERE user = ?)";
PreparedStatement statement = connection.prepareStatement(sql); PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, playerName); statement.setString(1, playerName);
@@ -255,8 +254,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
int rank = resultSet.getInt("rank"); int rank = resultSet.getInt("rank");
sql = "SELECT user, " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + 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 " + "AND " + skillName + " = (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
"WHERE user = '" + playerName + "') ORDER BY user"; "WHERE user = '" + playerName + "') ORDER BY user";
statement.close(); statement.close();
@@ -362,16 +361,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
try { try {
statement = connection.prepareStatement( statement = connection.prepareStatement(
"SELECT " "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, " + "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, " + "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, " + "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 " + "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u " + "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " + "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " + "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " + "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " + "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?"); + "WHERE u.user = ?");
statement.setString(1, playerName); statement.setString(1, playerName);
ResultSet result = statement.executeQuery(); ResultSet result = statement.executeQuery();
@@ -438,16 +437,16 @@ public final class SQLDatabaseManager implements DatabaseManager {
try { try {
statement = connection.prepareStatement( statement = connection.prepareStatement(
"SELECT " "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, " + "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, " + "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, " + "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 " + "h.mobhealthbar "
+ "FROM " + tablePrefix + "users u " + "FROM " + tablePrefix + "users u "
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " + "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " + "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " + "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " + "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
+ "WHERE u.user = ?"); + "WHERE u.user = ?");
List<String> usernames = getStoredUsers(); List<String> usernames = getStoredUsers();
ResultSet resultSet; ResultSet resultSet;
int convertedUsers = 0; int convertedUsers = 0;
@@ -484,20 +483,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
/** /**
* Check connection status and re-establish if dead or stale. * Check connection status and re-establish if dead or stale.
* <p/> *
* If the very first immediate attempt fails, further attempts * If the very first immediate attempt fails, further attempts
* will be made in progressively larger intervals up to MAX_WAIT * will be made in progressively larger intervals up to MAX_WAIT
* intervals. * intervals.
* <p/> *
* This allows for MySQL to time out idle connections as needed by * This allows for MySQL to time out idle connections as needed by
* server operator, without affecting McMMO, while still providing * server operator, without affecting McMMO, while still providing
* protection against a database outage taking down Bukkit's tick * protection against a database outage taking down Bukkit's tick
* processing loop due to attempting a database connection each * processing loop due to attempting a database connection each
* time McMMO needs the database. * time McMMO needs the database.
* *
* @return the boolean value for whether or not we are connected * @return the boolean value for whether or not we are connected
*/ */
public boolean checkConnected() { public boolean checkConnected() {
boolean isClosed = true; boolean isClosed = true;
boolean isValid = false; boolean isValid = false;
@@ -619,6 +618,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
connectionProperties.put("user", Config.getInstance().getMySQLUserName()); connectionProperties.put("user", Config.getInstance().getMySQLUserName());
connectionProperties.put("password", Config.getInstance().getMySQLUserPassword()); connectionProperties.put("password", Config.getInstance().getMySQLUserPassword());
connectionProperties.put("autoReconnect", "false"); connectionProperties.put("autoReconnect", "false");
connectionProperties.put("maxReconnects", "0");
connection = DriverManager.getConnection(connectionString, connectionProperties); connection = DriverManager.getConnection(connectionString, connectionProperties);
mcMMO.p.getLogger().info("Connection to MySQL was a success!"); mcMMO.p.getLogger().info("Connection to MySQL was a success!");
@@ -710,174 +710,144 @@ public final class SQLDatabaseManager implements DatabaseManager {
+ "PRIMARY KEY (`user_id`)) " + "PRIMARY KEY (`user_id`)) "
+ "DEFAULT CHARSET=latin1;"); + "DEFAULT CHARSET=latin1;");
for (UpgradeType updateType : UpgradeType.values()) { for (DatabaseUpdateType updateType : DatabaseUpdateType.values()) {
checkDatabaseStructure(updateType); 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) { private void checkDatabaseStructure(DatabaseUpdateType update) {
if (!checkConnected()) { String sql = "";
return;
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)) { ResultSet resultSet;
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)"); PreparedStatement statement = null;
return;
}
Statement statement = null;
ResultSet resultSet = null;
try { try {
statement = connection.createStatement(); if (!checkConnected()) {
return;
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;
} }
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) { 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 { finally {
if (resultSet != null) {
try {
resultSet.close();
}
catch (SQLException e) {
// Ignore
}
}
if (statement != null) { if (statement != null) {
try { try {
statement.close(); statement.close();
} }
catch (SQLException e) { 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. * Attempt to write the SQL query.
* *
* @param sql Query to write. * @param sql Query to write.
*
* @return true if the query was successfully written, false otherwise. * @return true if the query was successfully written, false otherwise.
*/ */
private boolean write(String sql) { 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 * Returns the number of rows affected by either a DELETE or UPDATE query
* *
* @param sql SQL query to execute * @param sql SQL query to execute
*
* @return the number of rows affected * @return the number of rows affected
*/ */
private int update(String sql) { private int update(String sql) {
@@ -958,7 +926,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Read SQL query. * Read SQL query.
* *
* @param sql SQL query to read * @param sql SQL query to read
*
* @return the rows in this SQL query * @return the rows in this SQL query
*/ */
private HashMap<Integer, ArrayList<String>> read(String sql) { 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. * Get the Integer. Only return first row / first field.
* *
* @param statement SQL query to execute * @param statement SQL query to execute
*
* @return the value in the first row / first field * @return the value in the first row / first field
*/ */
private int readInt(PreparedStatement statement) { private int readInt(PreparedStatement statement) {
@@ -1148,7 +1114,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
* Retrieve the database id for a player * Retrieve the database id for a player
* *
* @param playerName The name of the user to retrieve the id for * @param playerName The name of the user to retrieve the id for
*
* @return the requested id or -1 if not found * @return the requested id or -1 if not found
*/ */
private int readId(String playerName) { private int readId(String playerName) {
@@ -1219,8 +1184,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException { private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
MobHealthbarType mobHealthbarType; 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.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
public class AlchemyPotion { public class AlchemyPotion {
@@ -51,10 +50,6 @@ public class AlchemyPotion {
return potion; return potion;
} }
public Potion toPotion(int amount) {
return Potion.fromItemStack(this.toItemStack(amount));
}
public short getDataValue() { public short getDataValue() {
return dataValue; return dataValue;
} }

View File

@@ -1,72 +0,0 @@
package com.gmail.nossr50.datatypes.skills.alchemy;
import org.bukkit.potion.Potion;
public enum PotionStage {
FIVE(5),
FOUR(4),
THREE(3),
TWO(2),
ONE(1);
int numerical;
private PotionStage(int numerical) {
this.numerical = numerical;
}
public int toNumerical() {
return numerical;
}
private static PotionStage getPotionStageNumerical(int numerical) {
for (PotionStage potionStage : values()) {
if (numerical >= potionStage.toNumerical()) {
return potionStage;
}
}
return ONE;
}
public static PotionStage getPotionStage(AlchemyPotion input, AlchemyPotion output) {
PotionStage potionStage = getPotionStage(output);
if (!isWaterBottle(input) && 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);
int stage = 1;
// Check if potion isn't awkward or mundane
if (potion.getType() != null) {
stage++;
}
// Check if potion has a glowstone dust amplifier
if (potion.getLevel() > 1) {
stage++;
}
// Check if potion has a redstone dust amplifier
if (potion.hasExtendedDuration()) {
stage++;
}
// Check if potion has a gunpowder amplifier
if (potion.isSplash()) {
stage++;
}
return PotionStage.getPotionStageNumerical(stage);
}
}

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; package com.gmail.nossr50.events.fake;
import java.util.EnumMap;
import java.util.Map;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent; 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. * Called when mcMMO applies damage from an entity due to special abilities.
*/ */
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent { 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) { public FakeEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage) {
super(damager, damagee, cause, 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; package com.gmail.nossr50.events.fake;
import java.util.EnumMap;
import java.util.Map;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageEvent; 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. * Called when mcMMO applies damage due to special abilities.
*/ */
public class FakeEntityDamageEvent extends EntityDamageEvent { 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) { public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) {
super(damagee, cause, 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; package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Cancellable { public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
private SecondaryAbility secondaryAbility; private SecondaryAbility secondaryAbility;
private boolean cancelled;
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) { public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
super(player, SkillType.bySecondaryAbility(secondaryAbility)); super(player, SkillType.bySecondaryAbility(secondaryAbility));
this.secondaryAbility = secondaryAbility; this.secondaryAbility = secondaryAbility;
cancelled = false;
} }
/** /**
@@ -24,12 +22,4 @@ public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Canc
public SecondaryAbility getSecondaryAbility() { public SecondaryAbility getSecondaryAbility() {
return secondaryAbility; 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; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent { public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
private double chance; private double chance;
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, 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.datatypes.skills.ToolType;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
import com.gmail.nossr50.runnables.PistonTrackerTask;
import com.gmail.nossr50.runnables.StickyPistonTrackerTask; import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.excavation.ExcavationManager;
@@ -64,27 +63,27 @@ public class BlockListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) { public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (!EventUtils.shouldProcessEvent(event.getBlock(), true)) { List<Block> blocks = event.getBlocks();
return;
}
BlockFace direction = event.getDirection(); BlockFace direction = event.getDirection();
Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished 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) { for (Block b : blocks) {
if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) { if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) {
b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue); 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 for (Block b : blocks) {
new PistonTrackerTask(blocks, direction, futureEmptyBlock).runTaskLater(plugin, 2); 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) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) { public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if (!EventUtils.shouldProcessEvent(event.getBlock(), false)) {
return;
}
if (!event.isSticky()) { if (!event.isSticky()) {
return; return;
} }

View File

@@ -37,7 +37,6 @@ import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
@@ -53,7 +52,6 @@ import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.herbalism.Herbalism; import com.gmail.nossr50.skills.herbalism.Herbalism;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
@@ -110,9 +108,7 @@ public class EntityListener implements Listener {
public void onEntityChangeBlock(EntityChangeBlockEvent event) { public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Block block = event.getBlock(); Block block = event.getBlock();
// When the event is fired for the falling block that changes back to a normal block if (!BlockUtils.shouldBeWatched(block.getState())) {
// event.getBlock().getType() returns AIR
if (!BlockUtils.shouldBeWatched(block.getState()) && block.getType() != Material.AIR) {
return; return;
} }
@@ -150,7 +146,7 @@ public class EntityListener implements Listener {
return; return;
} }
double damage = event.getFinalDamage(); double damage = event.getDamage();
if (damage <= 0) { if (damage <= 0) {
return; return;
@@ -180,11 +176,7 @@ public class EntityListener implements Listener {
} }
if (attacker instanceof Projectile) { if (attacker instanceof Projectile) {
ProjectileSource projectileSource = ((Projectile) attacker).getShooter(); attacker = ((Projectile) attacker).getShooter();
if (projectileSource instanceof LivingEntity) {
attacker = (LivingEntity) projectileSource;
}
} }
else if (attacker instanceof Tameable) { else if (attacker instanceof Tameable) {
AnimalTamer animalTamer = ((Tameable) attacker).getOwner(); AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
@@ -193,11 +185,6 @@ public class EntityListener implements Listener {
attacker = (Entity) animalTamer; 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) { if (defender instanceof Player && attacker instanceof Player) {
Player defendingPlayer = (Player) defender; Player defendingPlayer = (Player) defender;
@@ -219,7 +206,7 @@ public class EntityListener implements Listener {
} }
CombatUtils.processCombatAttack(event, attacker, target); CombatUtils.processCombatAttack(event, attacker, target);
CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage()); CombatUtils.handleHealthbars(attacker, target, event.getDamage());
} }
/** /**
@@ -233,7 +220,7 @@ public class EntityListener implements Listener {
return; return;
} }
double damage = event.getFinalDamage(); double damage = event.getDamage();
if (damage <= 0) { if (damage <= 0) {
return; return;
@@ -284,7 +271,20 @@ public class EntityListener implements Listener {
if (acrobaticsManager.canRoll()) { if (acrobaticsManager.canRoll()) {
event.setDamage(acrobaticsManager.rollCheck(event.getDamage())); 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); event.setCancelled(true);
return; return;
} }
@@ -295,7 +295,7 @@ public class EntityListener implements Listener {
break; break;
} }
if (event.getFinalDamage() >= 1) { if (event.getDamage() >= 1) {
mcMMOPlayer.actualizeRecentlyHurt(); mcMMOPlayer.actualizeRecentlyHurt();
} }
} }
@@ -329,7 +329,7 @@ public class EntityListener implements Listener {
if (tamingManager.canUseThickFur()) { if (tamingManager.canUseThickFur()) {
event.setDamage(Taming.processThickFur(wolf, event.getDamage())); event.setDamage(Taming.processThickFur(wolf, event.getDamage()));
if (event.getFinalDamage() == 0) { if (event.getDamage() == 0) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@@ -355,7 +355,7 @@ public class EntityListener implements Listener {
if (tamingManager.canUseShockProof()) { if (tamingManager.canUseShockProof()) {
event.setDamage(Taming.processShockProof(wolf, event.getDamage())); event.setDamage(Taming.processShockProof(wolf, event.getDamage()));
if (event.getFinalDamage() == 0) { if (event.getDamage() == 0) {
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@@ -24,7 +24,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -226,13 +225,6 @@ public class PlayerListener implements Listener {
return; return;
case CAUGHT_FISH: case CAUGHT_FISH:
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
Item fishingCatch = (Item) event.getCaught();
if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.RAW_FISH) {
fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
}
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) { if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
} }
@@ -332,11 +324,9 @@ public class PlayerListener implements Listener {
} }
if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) { if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isSharable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
boolean pickupSuccess = Unarmed.handleItemPickup(player.getInventory(), drop); event.setCancelled(Unarmed.handleItemPickup(player.getInventory(), drop));
boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
event.setCancelled(cancel);
if (pickupSuccess) { if (event.isCancelled()) {
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch()); player.playSound(player.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.getPopPitch());
player.updateInventory(); player.updateInventory();
return; return;
@@ -704,13 +694,4 @@ public class PlayerListener implements Listener {
} }
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerStatisticIncrementEvent(PlayerStatisticIncrementEvent event) {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
mcMMO.getHolidayManager().handleStatisticEvent(event);
}
} }

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.experience.FormulaManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.upgrade.UpgradeManager;
import net.shatteredlands.shatt.backup.ZipLibrary; import net.shatteredlands.shatt.backup.ZipLibrary;
@@ -73,7 +72,6 @@ public class mcMMO extends JavaPlugin {
private static DatabaseManager databaseManager; private static DatabaseManager databaseManager;
private static FormulaManager formulaManager; private static FormulaManager formulaManager;
private static HolidayManager holidayManager; private static HolidayManager holidayManager;
private static UpgradeManager upgradeManager;
/* File Paths */ /* File Paths */
private static String mainDirectory; 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 disarmedItemKey = "mcMMO: Disarmed Item";
public final static String playerDataKey = "mcMMO: Player Data"; public final static String playerDataKey = "mcMMO: Player Data";
public final static String greenThumbDataKey = "mcMMO: Green Thumb"; public final static String greenThumbDataKey = "mcMMO: Green Thumb";
public final static String pistonDataKey = "mcMMO: Piston State";
public static FixedMetadataValue metadataValue; public static FixedMetadataValue metadataValue;
@@ -131,8 +128,6 @@ public class mcMMO extends JavaPlugin {
PluginManager pluginManager = getServer().getPluginManager(); PluginManager pluginManager = getServer().getPluginManager();
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null; healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
upgradeManager = new UpgradeManager();
setupFilePaths(); setupFilePaths();
modManager = new ModManager(); modManager = new ModManager();
@@ -143,7 +138,7 @@ public class mcMMO extends JavaPlugin {
return; return;
} }
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) { if (getServer().getName().equals("MCPC+")) {
checkModConfigs(); checkModConfigs();
} }
@@ -313,10 +308,6 @@ public class mcMMO extends JavaPlugin {
return modManager; return modManager;
} }
public static UpgradeManager getUpgradeManager() {
return upgradeManager;
}
@Deprecated @Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) { public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager; mcMMO.databaseManager = databaseManager;
@@ -494,22 +485,22 @@ public class mcMMO extends JavaPlugin {
private void checkModConfigs() { private void checkModConfigs() {
if (!Config.getInstance().getToolModsEnabled()) { 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."); getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml.");
} }
if (!Config.getInstance().getArmorModsEnabled()) { 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."); getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml.");
} }
if (!Config.getInstance().getBlockModsEnabled()) { 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."); getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml.");
} }
if (!Config.getInstance().getEntityModsEnabled()) { 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."); 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.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@@ -20,16 +21,10 @@ public class StickyPistonTrackerTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (!mcMMO.getPlaceStore().isTrue(movedBlock)) { if (!BlockUtils.shouldBeWatched(movedBlock.getState()) || movedBlock.getPistonMoveReaction() != PistonMoveReaction.MOVE || !mcMMO.getPlaceStore().isTrue(movedBlock)) {
return; 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().setFalse(movedBlock);
mcMMO.getPlaceStore().setTrue(block.getRelative(direction)); 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

@@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.skills;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@@ -20,7 +19,6 @@ public class AprilTask extends BukkitRunnable {
} }
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) { for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
int random = Misc.getRandom().nextInt(40) + 11;
int betterRandom = Misc.getRandom().nextInt(2000); int betterRandom = Misc.getRandom().nextInt(2000);
if (betterRandom == 0) { if (betterRandom == 0) {
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
@@ -28,9 +26,10 @@ public class AprilTask extends BukkitRunnable {
fireworksShow(player); fireworksShow(player);
} }
for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) { for (HolidayManager.FakeSkillType fakeSkillType : HolidayManager.FakeSkillType.values()) {
if (player.getStatistic(statistic) > 0 && player.getStatistic(statistic) % random == 0) { int random = Misc.getRandom().nextInt(250);
mcMMO.getHolidayManager().levelUpApril(player, HolidayManager.FakeSkillType.getByStatistic(statistic)); if (random == 0) {
mcMMO.getHolidayManager().levelUpApril(player, fakeSkillType);
break; break;
} }
} }

View File

@@ -9,7 +9,6 @@ import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.datatypes.skills.XPGainReason;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
@@ -65,7 +64,7 @@ public class AlchemyManager extends SkillManager {
return Math.min(Alchemy.catalysisMaxSpeed, Alchemy.catalysisMinSpeed + (Alchemy.catalysisMaxSpeed - Alchemy.catalysisMinSpeed) * (skillLevel - Alchemy.catalysisUnlockLevel) / (Alchemy.catalysisMaxBonusLevel - Alchemy.catalysisUnlockLevel)) * (isLucky ? LUCKY_MODIFIER : 1.0); return Math.min(Alchemy.catalysisMaxSpeed, Alchemy.catalysisMinSpeed + (Alchemy.catalysisMaxSpeed - Alchemy.catalysisMinSpeed) * (skillLevel - Alchemy.catalysisUnlockLevel) / (Alchemy.catalysisMaxBonusLevel - Alchemy.catalysisUnlockLevel)) * (isLucky ? LUCKY_MODIFIER : 1.0);
} }
public void handlePotionBrewSuccesses(PotionStage potionStage, int amount) { public void handlePotionBrewSuccesses(int amount) {
applyXpGain((float) (ExperienceConfig.getInstance().getPotionXP(potionStage) * amount), XPGainReason.PVE); applyXpGain((float) (ExperienceConfig.getInstance().getPotionXP() * amount), XPGainReason.PVE);
} }
} }

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.alchemy; package com.gmail.nossr50.skills.alchemy;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
@@ -18,8 +17,6 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; 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.player.PlayerUpdateInventoryTask;
import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask; import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@@ -103,8 +100,6 @@ public final class AlchemyPotionBrewer {
return; return;
} }
List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i); ItemStack item = inventory.getItem(i);
@@ -115,28 +110,11 @@ public final class AlchemyPotionBrewer {
AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability()); AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient)); AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
inputList.add(input);
if (output != null) { if (output != null) {
inventory.setItem(i, output.toItemStack(item.getAmount()).clone()); inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
}
}
FakeBrewEvent event = new FakeBrewEvent(brewingStand.getBlock(), inventory); if (player != null) {
mcMMO.p.getServer().getPluginManager().callEvent(event); UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
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)) {
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 skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax(); 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; public static final double DISTANCE_XP_MULTIPLIER = 0.025;

View File

@@ -1,9 +1,11 @@
package com.gmail.nossr50.skills.archery; package com.gmail.nossr50.skills.archery;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@@ -16,6 +18,7 @@ import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
public class ArcheryManager extends SkillManager { public class ArcheryManager extends SkillManager {
@@ -67,8 +70,9 @@ public class ArcheryManager extends SkillManager {
* Handle the effects of the Daze ability * Handle the effects of the Daze ability
* *
* @param defender The {@link Player} being affected by the ability * @param 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)) { if (!SkillUtils.activationSuccessful(SecondaryAbility.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
return 0; return 0;
} }
@@ -87,21 +91,20 @@ public class ArcheryManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed")); 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 * 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 damage The amount of damage initially dealt by the event
* @param arrow The {@link Arrow} that was fired
*/ */
public double skillShot(double damage) { public double skillShot(LivingEntity target, double damage, Arrow arrow) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.SKILL_SHOT, getPlayer())) {
return damage;
}
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage); double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
double archeryBonus = Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
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; package com.gmail.nossr50.skills.axes;
import java.util.Map;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
@@ -52,13 +52,13 @@ public class AxesManager extends SkillManager {
/** /**
* Handle the effects of the Axe Mastery ability * Handle the effects of the Axe Mastery ability
*
* @param target The {@link LivingEntity} being affected by the ability
*/ */
public double axeMastery() { public double axeMastery(LivingEntity target) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.AXE_MASTERY, getPlayer())) { double axeBonus = Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
return 0;
}
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; 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()) { for (ItemStack armor : target.getEquipment().getArmorContents()) {
if (ItemUtils.isArmor(armor)) { 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); 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 * @param target The {@link LivingEntity} being affected by the ability
*/ */
public double greaterImpact(LivingEntity target) { 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; 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 target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event * @param damage The amount of damage initially dealt by the event
*/ */
public void skullSplitterCheck(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) { public void skullSplitterCheck(LivingEntity target, double damage) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, modifiers, skill); CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
} }
} }

View File

@@ -21,13 +21,13 @@ public class Excavation {
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) { protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case DIRT: case DIRT:
return blockState.getRawData() == 0x2 ? TreasureConfig.getInstance().excavationFromPodzol : TreasureConfig.getInstance().excavationFromDirt; return TreasureConfig.getInstance().excavationFromDirt;
case GRASS: case GRASS:
return TreasureConfig.getInstance().excavationFromGrass; return TreasureConfig.getInstance().excavationFromGrass;
case SAND: case SAND:
return blockState.getRawData() == 0x1 ? TreasureConfig.getInstance().excavationFromRedSand : TreasureConfig.getInstance().excavationFromSand; return TreasureConfig.getInstance().excavationFromSand;
case GRAVEL: case GRAVEL:
return TreasureConfig.getInstance().excavationFromGravel; return TreasureConfig.getInstance().excavationFromGravel;

View File

@@ -1,12 +1,9 @@
package com.gmail.nossr50.skills.fishing; package com.gmail.nossr50.skills.fishing;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -57,13 +54,6 @@ public final class Fishing {
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2; public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5; public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5;
public static Set<Biome> masterAnglerBiomes = EnumSet.of(Biome.RIVER, Biome.OCEAN, Biome.DEEP_OCEAN);
public static Set<Biome> iceFishingBiomes = EnumSet.of(
Biome.FROZEN_OCEAN, Biome.FROZEN_RIVER,
Biome.TAIGA, Biome.TAIGA_HILLS, Biome.TAIGA_MOUNTAINS,
Biome.ICE_PLAINS, Biome.ICE_MOUNTAINS, Biome.ICE_PLAINS_SPIKES,
Biome.COLD_TAIGA, Biome.COLD_TAIGA_HILLS, Biome.COLD_TAIGA_MOUNTAINS);
private Fishing() {} private Fishing() {}
/** /**

View File

@@ -12,6 +12,7 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@@ -198,7 +199,10 @@ public class FishingManager extends SkillManager {
} }
// Make sure this is a body of water, not just a block of ice. // Make sure this is a body of water, not just a block of ice.
if (!Fishing.iceFishingBiomes.contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) { Biome biome = block.getBiome();
boolean isFrozenBiome = (biome == Biome.FROZEN_OCEAN || biome == Biome.FROZEN_RIVER || biome == Biome.TAIGA || biome == Biome.TAIGA_HILLS || biome == Biome.ICE_PLAINS || biome == Biome.ICE_MOUNTAINS);
if (!isFrozenBiome && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) {
return false; return false;
} }
@@ -278,11 +282,12 @@ public class FishingManager extends SkillManager {
public void masterAngler(Fish hook) { public void masterAngler(Fish hook) {
Player player = getPlayer(); Player player = getPlayer();
Location location = hook.getLocation(); Location location = hook.getLocation();
Biome biome = location.getBlock().getBiome();
double biteChance = hook.getBiteChance(); double biteChance = hook.getBiteChance();
hookLocation = location; hookLocation = location;
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) { if (biome == Biome.RIVER || biome == Biome.OCEAN) {
biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); biteChance = biteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
} }
@@ -300,7 +305,6 @@ public class FishingManager extends SkillManager {
*/ */
public void handleFishing(Item fishingCatch) { public void handleFishing(Item fishingCatch) {
this.fishingCatch = fishingCatch; this.fishingCatch = fishingCatch;
int fishXp = ExperienceConfig.getInstance().getFishXp(fishingCatch.getItemStack().getData());
int treasureXp = 0; int treasureXp = 0;
Player player = getPlayer(); Player player = getPlayer();
FishingTreasure treasure = null; FishingTreasure treasure = null;
@@ -311,6 +315,8 @@ public class FishingManager extends SkillManager {
} }
if (treasure != null) { if (treasure != null) {
player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.ItemFound"));
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay? ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>(); Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
@@ -350,7 +356,7 @@ public class FishingManager extends SkillManager {
} }
} }
applyXpGain(fishXp + treasureXp, XPGainReason.PVE); applyXpGain(ExperienceConfig.getInstance().getFishingBaseXP() + treasureXp, XPGainReason.PVE);
} }
/** /**
@@ -449,8 +455,6 @@ public class FishingManager extends SkillManager {
*/ */
private FishingTreasure getFishingTreasure() { private FishingTreasure getFishingTreasure() {
double diceRoll = Misc.getRandom().nextDouble() * 100; double diceRoll = Misc.getRandom().nextDouble() * 100;
diceRoll -= getPlayer().getItemInHand().getEnchantmentLevel(Enchantment.LUCK);
FishingTreasure treasure = null; FishingTreasure treasure = null;
for (Rarity rarity : Rarity.values()) { for (Rarity rarity : Rarity.values()) {

View File

@@ -148,12 +148,7 @@ public class HerbalismManager extends SkillManager {
processGreenThumbPlants(blockState, greenTerra); processGreenThumbPlants(blockState, greenTerra);
} }
if (material == Material.DOUBLE_PLANT || material == Material.RED_ROSE || material == Material.LONG_GRASS) { xp = ExperienceConfig.getInstance().getXp(skill, material);
xp = ExperienceConfig.getInstance().getFlowerAndGrassXp(blockState.getData());
}
else {
xp = ExperienceConfig.getInstance().getXp(skill, material);
}
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) { if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
drops = blockState.getBlock().getDrops(); drops = blockState.getBlock().getDrops();

View File

@@ -1,18 +1,9 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material; 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.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.player.UserManager;
public class BlastMining { public class BlastMining {
// The order of the values is extremely important, a few methods depend on it to work properly // 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 static Material detonator = Config.getInstance().getDetonatorItem();
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100; 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

@@ -39,13 +39,11 @@ public class Mining {
switch (blockType) { switch (blockType) {
case ENDER_STONE: case ENDER_STONE:
case GOLD_ORE: case GOLD_ORE:
case HARD_CLAY:
case IRON_ORE: case IRON_ORE:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
handleMiningDrops(blockState); handleMiningDrops(blockState);
return; return;
@@ -57,13 +55,12 @@ public class Mining {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case EMERALD_ORE: case REDSTONE_ORE:
case GLOWSTONE: case GLOWSTONE:
case LAPIS_ORE: case LAPIS_ORE:
case PACKED_ICE:
case QUARTZ_ORE:
case REDSTONE_ORE:
case STONE: case STONE:
case EMERALD_ORE:
case QUARTZ_ORE:
Misc.dropItem(blockState.getLocation(), new ItemStack(blockType)); Misc.dropItem(blockState.getLocation(), new ItemStack(blockType));
return; return;
@@ -85,20 +82,17 @@ public class Mining {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case EMERALD_ORE: case EMERALD_ORE:
case ENDER_STONE:
case GLOWSTONE: case GLOWSTONE:
case GOLD_ORE:
case HARD_CLAY:
case IRON_ORE:
case LAPIS_ORE: case LAPIS_ORE:
case STONE:
case ENDER_STONE:
case GOLD_ORE:
case IRON_ORE:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case PACKED_ICE:
case REDSTONE_ORE: case REDSTONE_ORE:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
case STONE:
case QUARTZ_ORE: case QUARTZ_ORE:
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
return; return;

View File

@@ -33,7 +33,7 @@ public class MiningManager extends SkillManager {
} }
public boolean canUseDemolitionsExpertise() { public boolean canUseDemolitionsExpertise() {
return getSkillLevel() >= BlastMining.getDemolitionExpertUnlockLevel() && Permissions.demolitionsExpertise(getPlayer()); return getSkillLevel() >= BlastMining.Tier.FOUR.getLevel() && Permissions.demolitionsExpertise(getPlayer());
} }
public boolean canDetonate() { public boolean canDetonate() {
@@ -47,7 +47,7 @@ public class MiningManager extends SkillManager {
} }
public boolean canUseBiggerBombs() { 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 // Check if they have the proper material to repair with
if (!inventory.contains(repairMaterial)) { if (!inventory.contains(repairMaterial)) {
String prettyName = repairable.getRepairMaterialPrettyName() == null ? StringUtils.getPrettyItemString(repairMaterial) : repairable.getRepairMaterialPrettyName(); String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
String message = LocaleLoader.getString("Skills.NeedMore", prettyName);
if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) { if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) {
message += ":" + repairMaterialMetadata; message += ":" + repairMaterialMetadata;

View File

@@ -28,13 +28,6 @@ public interface Repairable {
*/ */
public byte getRepairMaterialMetadata(); 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 * 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 class RepairableFactory {
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) { 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) { 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. // 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 int minimumQuantity, minimumLevel;
private final short maximumDurability, baseRepairDurability; private final short maximumDurability, baseRepairDurability;
private final byte repairMetadata; private final byte repairMetadata;
private String repairMaterialPrettyName;
private final ItemType repairItemType; private final ItemType repairItemType;
private final MaterialType repairMaterialType; private final MaterialType repairMaterialType;
private final double xpMultiplier; 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.itemMaterial = type;
this.repairMaterial = repairMaterial; this.repairMaterial = repairMaterial;
this.repairMetadata = repairMetadata; this.repairMetadata = repairMetadata;
this.repairMaterialPrettyName = repairMaterialPrettyName;
this.repairItemType = repairItemType; this.repairItemType = repairItemType;
this.repairMaterialType = repairMaterialType; this.repairMaterialType = repairMaterialType;
this.minimumLevel = minimumLevel; this.minimumLevel = minimumLevel;
@@ -45,11 +43,6 @@ public class SimpleRepairable implements Repairable {
return repairMetadata; return repairMetadata;
} }
@Override
public String getRepairMaterialPrettyName() {
return repairMaterialPrettyName;
}
@Override @Override
public ItemType getRepairItemType() { public ItemType getRepairItemType() {
return repairItemType; return repairItemType;

View File

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

View File

@@ -7,37 +7,37 @@ import com.gmail.nossr50.datatypes.skills.MaterialType;
public interface Salvageable { 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(); 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(); 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(); 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(); 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(); public MaterialType getSalvageMaterialType();
@@ -58,25 +58,25 @@ public interface Salvageable {
public short getMaximumDurability(); 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 * This is actually the maximum durability divided by the minimum quantity
* *
* @return the base salvage durability * @return the base repair durability
*/ */
public short getBaseSalvageDurability(); 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(); 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(); public double getXpMultiplier();
} }

View File

@@ -1,11 +1,8 @@
package com.gmail.nossr50.skills.swords; package com.gmail.nossr50.skills.swords;
import java.util.Map;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; 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 target The {@link LivingEntity} being affected by the ability
* @param damage The amount of damage initially dealt by the event * @param damage The amount of damage initially dealt by the event
*/ */
public void serratedStrikes(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) { public void serratedStrikes(LivingEntity target, double damage) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, modifiers, skill); CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, skill);
BleedTimerTask.add(target, Swords.serratedStrikesBleedTicks); 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.SkillType;
import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.datatypes.skills.XPGainReason;
import com.gmail.nossr50.events.fake.FakeEntityTameEvent; 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.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
public class TamingManager extends SkillManager { public class TamingManager extends SkillManager {
@@ -94,16 +96,18 @@ public class TamingManager extends SkillManager {
* @param damage The damage being absorbed by the wolf * @param damage The damage being absorbed by the wolf
*/ */
public void fastFoodService(Wolf wolf, double damage) { public void fastFoodService(Wolf wolf, double damage) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.FAST_FOOD, getPlayer(), Taming.fastFoodServiceActivationChance, activationChance)) { double chance = Taming.fastFoodServiceActivationChance / activationChance;
return; SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.FAST_FOOD, chance);
} mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
double health = wolf.getHealth(); double health = wolf.getHealth();
double maxHealth = wolf.getMaxHealth(); double maxHealth = wolf.getMaxHealth();
if (health < maxHealth) { if (health < maxHealth) {
double newHealth = health + damage; double newHealth = health + damage;
wolf.setHealth(Math.min(newHealth, maxHealth)); wolf.setHealth(Math.min(newHealth, maxHealth));
}
} }
} }
@@ -112,8 +116,9 @@ public class TamingManager extends SkillManager {
* *
* @param target The LivingEntity to apply Gore on * @param target The LivingEntity to apply Gore on
* @param damage The initial damage * @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)) { if (!SkillUtils.activationSuccessful(SecondaryAbility.GORE, getPlayer(), getSkillLevel(), activationChance)) {
return 0; return 0;
} }
@@ -127,11 +132,11 @@ public class TamingManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore")); getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
damage = (damage * Taming.goreModifier) - damage; damage = (damage * Taming.goreModifier) - damage;
return damage; return CombatUtils.callFakeDamageEvent(wolf, target, damage);
} }
public double sharpenedClaws() { public double sharpenedClaws(LivingEntity target, Wolf wolf) {
return Taming.sharpenedClawsBonusDamage; return CombatUtils.callFakeDamageEvent(wolf, target, Taming.sharpenedClawsBonusDamage);
} }
/** /**

View File

@@ -69,9 +69,6 @@ public class Unarmed {
nextSlot++; nextSlot++;
} }
// Inventory is full - cancel the item pickup
return false;
} }
else if (firstEmpty != -1) { else if (firstEmpty != -1) {
drop.remove(); 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.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
public class UnarmedManager extends SkillManager { public class UnarmedManager extends SkillManager {
@@ -56,10 +57,6 @@ public class UnarmedManager extends SkillManager {
} }
public boolean blockCrackerCheck(BlockState blockState) { public boolean blockCrackerCheck(BlockState blockState) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.BLOCK_CRACKER, getPlayer())) {
return false;
}
MaterialData data = blockState.getData(); MaterialData data = blockState.getData();
switch (blockState.getType()) { switch (blockState.getType()) {
@@ -120,23 +117,24 @@ public class UnarmedManager extends SkillManager {
/** /**
* Handle the effects of the Berserk ability * 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 * @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; damage = (damage * Unarmed.berserkDamageModifier) - damage;
return damage; return CombatUtils.callFakeDamageEvent(getPlayer(), target, damage);
} }
/** /**
* Handle the effects of the Iron Arm ability * Handle the effects of the Iron Arm ability
*
* @param target The {@link LivingEntity} being affected by the ability
*/ */
public double ironArm() { public double ironArm(LivingEntity target) {
if (!SkillUtils.activationSuccessful(SecondaryAbility.IRON_ARM, getPlayer())) { double unarmedBonus = Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
return 0;
}
return Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage); return CombatUtils.callFakeDamageEvent(getPlayer(), target, unarmedBonus);
} }
/** /**

View File

@@ -5,7 +5,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@@ -56,19 +55,28 @@ public final class Woodcutting {
return mcMMO.getModManager().getBlock(blockState).getXpGain(); return mcMMO.getModManager().getBlock(blockState).getXpGain();
} }
//TODO Remove this workaround when casting to Tree works again switch (((Tree) blockState.getData()).getSpecies()) {
TreeSpecies species = TreeSpecies.GENERIC; case GENERIC:
if (blockState.getData() instanceof Tree) { return ExperienceConfig.getInstance().getWoodcuttingXPOak();
species = ((Tree) blockState.getData()).getSpecies();
case REDWOOD:
return ExperienceConfig.getInstance().getWoodcuttingXPSpruce();
case BIRCH:
return ExperienceConfig.getInstance().getWoodcuttingXPBirch();
case JUNGLE:
int xp = ExperienceConfig.getInstance().getWoodcuttingXPJungle();
if (experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
xp *= 0.5;
}
return xp;
default:
return 0;
} }
int xp = ExperienceConfig.getInstance().getWoodcuttingTreeXP(species);
if (species == TreeSpecies.JUNGLE && experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
xp *= 0.5;
}
return xp;
} }
/** /**
@@ -81,14 +89,33 @@ public final class Woodcutting {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
} }
else { else {
//TODO Remove this workaround when casting to Tree works again switch (((Tree) blockState.getData()).getSpecies()) {
TreeSpecies species = TreeSpecies.GENERIC; case GENERIC:
if (blockState.getData() instanceof Tree) { if (Config.getInstance().getOakDoubleDropsEnabled()) {
species = ((Tree) blockState.getData()).getSpecies(); Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
} }
return;
if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) { case REDWOOD:
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops()); if (Config.getInstance().getSpruceDoubleDropsEnabled()) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
}
return;
case BIRCH:
if (Config.getInstance().getBirchDoubleDropsEnabled()) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
}
return;
case JUNGLE:
if (Config.getInstance().getJungleDoubleDropsEnabled()) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
}
return;
default:
return;
} }
} }
} }

View File

@@ -141,15 +141,11 @@ public class WoodcuttingManager extends SkillManager {
Misc.dropItems(blockState.getLocation(), block.getDrops()); Misc.dropItems(blockState.getLocation(), block.getDrops());
} }
else { else {
//TODO Remove this workaround when casting to Tree works again Tree tree = (Tree) blockState.getData();
if (blockState.getData() instanceof Tree) { tree.setDirection(BlockFace.UP);
Tree tree = (Tree) blockState.getData();
tree.setDirection(BlockFace.UP);
}
switch (material) { switch (material) {
case LOG: case LOG:
case LOG_2:
if (canGetDoubleDrops()) { if (canGetDoubleDrops()) {
Woodcutting.checkForDoubleDrop(blockState); Woodcutting.checkForDoubleDrop(blockState);
} }
@@ -158,7 +154,6 @@ public class WoodcuttingManager extends SkillManager {
break; break;
case LEAVES: case LEAVES:
case LEAVES_2:
Misc.dropItems(blockState.getLocation(), block.getDrops()); Misc.dropItems(blockState.getLocation(), block.getDrops());
break; break;
@@ -173,4 +168,5 @@ public class WoodcuttingManager extends SkillManager {
applyXpGain(xp, XPGainReason.PVE); applyXpGain(xp, XPGainReason.PVE);
} }
} }

View File

@@ -113,9 +113,7 @@ public final class BlockUtils {
switch (blockState.getType()) { switch (blockState.getType()) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: case CACTUS:
case DOUBLE_PLANT:
case MELON_BLOCK: case MELON_BLOCK:
case LONG_GRASS:
case PUMPKIN: case PUMPKIN:
case RED_MUSHROOM: case RED_MUSHROOM:
case RED_ROSE: case RED_ROSE:
@@ -153,13 +151,10 @@ public final class BlockUtils {
switch (blockState.getType()) { switch (blockState.getType()) {
case ENDER_STONE: case ENDER_STONE:
case GLOWSTONE: case GLOWSTONE:
case HARD_CLAY:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case PACKED_ICE:
case SANDSTONE: case SANDSTONE:
case STAINED_CLAY:
case STONE: case STONE:
return true; return true;
@@ -201,7 +196,6 @@ public final class BlockUtils {
public static boolean isLog(BlockState blockState) { public static boolean isLog(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case LOG: case LOG:
case LOG_2:
case HUGE_MUSHROOM_1: case HUGE_MUSHROOM_1:
case HUGE_MUSHROOM_2: case HUGE_MUSHROOM_2:
return true; return true;
@@ -220,7 +214,6 @@ public final class BlockUtils {
public static boolean isLeaves(BlockState blockState) { public static boolean isLeaves(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case LEAVES: case LEAVES:
case LEAVES_2:
return true; return true;
default: default:
@@ -283,7 +276,7 @@ public final class BlockUtils {
* Determine if a given block can be made into Mycelium * Determine if a given block can be made into Mycelium
* *
* @param blockState The {@link BlockState} of the block to check * @param blockState The {@link BlockState} of the block to check
* @return true if the block can be made into Mycelium, false otherwise * @return true if the block can be made in Mycelium, false otherwise
*/ */
public static boolean canMakeShroomy(BlockState blockState) { public static boolean canMakeShroomy(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
@@ -308,12 +301,6 @@ public final class BlockUtils {
return type == Repair.anvilMaterial || type == Salvage.anvilMaterial; 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 * 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.entity.Player;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import com.gmail.nossr50.mcMMO; 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.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.datatypes.skills.XPGainReason;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent; 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.McMMOPlayerFishingTreasureEvent;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent; import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent;
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent; 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.events.skills.unarmed.McMMOPlayerDisarmEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@@ -49,13 +46,6 @@ public class EventUtils {
return event; 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) { public static FakePlayerAnimationEvent callFakeArmSwingEvent(Player player) {
FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player); FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@@ -204,26 +194,4 @@ public class EventUtils {
return event; 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

@@ -10,10 +10,8 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.EnumSet;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@@ -22,13 +20,11 @@ import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@@ -71,45 +67,8 @@ public final class HolidayManager {
} }
return null; return null;
} }
public static FakeSkillType getByStatistic(Statistic statistic) {
switch (statistic) {
case DAMAGE_TAKEN:
return FakeSkillType.MACHO;
case JUMP:
return FakeSkillType.JUMPING;
case DROP:
return FakeSkillType.THROWING;
case MINE_BLOCK:
case BREAK_ITEM:
return FakeSkillType.WRECKING;
case CRAFT_ITEM:
return FakeSkillType.CRAFTING;
case WALK_ONE_CM:
return FakeSkillType.WALKING;
case SWIM_ONE_CM:
return FakeSkillType.SWIMMING;
case FALL_ONE_CM:
return FakeSkillType.FALLING;
case CLIMB_ONE_CM:
return FakeSkillType.CLIMBING;
case FLY_ONE_CM:
return FakeSkillType.FLYING;
case DIVE_ONE_CM:
return FakeSkillType.DIVING;
case PIG_ONE_CM:
return FakeSkillType.PIGGY;
default:
return FakeSkillType.UNKNOWN;
}
}
} }
public final Set<Statistic> movementStatistics = EnumSet.of(
Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.DIVE_ONE_CM,
Statistic.PIG_ONE_CM);
static { static {
List<Color> colors = new ArrayList<Color>(); List<Color> colors = new ArrayList<Color>();
List<ChatColor> chatColors = new ArrayList<ChatColor>(); List<ChatColor> chatColors = new ArrayList<ChatColor>();
@@ -342,40 +301,8 @@ public final class HolidayManager {
return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime()); return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
} }
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
Player player = event.getPlayer();
Statistic statistic = event.getStatistic();
int newValue = event.getNewValue();
int modifier;
switch (statistic) {
case DAMAGE_TAKEN:
modifier = 500;
break;
case JUMP:
modifier = 500;
break;
case DROP:
modifier = 200;
break;
case MINE_BLOCK:
case BREAK_ITEM:
modifier = 500;
break;
case CRAFT_ITEM:
modifier = 100;
break;
default:
return;
}
if (newValue % modifier == 0) {
mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
}
}
public void levelUpApril(Player player, FakeSkillType fakeSkillType) { public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(SkillType.MINING)) + 1; int levelTotal = Misc.getRandom().nextInt(UserManager.getPlayer(player).getSkillLevel(SkillType.MINING)) + 1;
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH); player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")"); player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")");
ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size()))); ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));

View File

@@ -1,14 +1,12 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.CoalType;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Coal;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@@ -588,8 +586,6 @@ public final class ItemUtils {
case PUMPKIN_SEEDS: case PUMPKIN_SEEDS:
case WATER_LILY: case WATER_LILY:
case VINE: case VINE:
case LONG_GRASS:
case DOUBLE_PLANT:
return true; return true;
case INK_SACK: case INK_SACK:
@@ -618,6 +614,7 @@ public final class ItemUtils {
case PORK: case PORK:
case GRILLED_PORK: case GRILLED_PORK:
case WOOL: case WOOL:
case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
case IRON_INGOT: case IRON_INGOT:
case SNOW_BALL: case SNOW_BALL:
case BLAZE_ROD: case BLAZE_ROD:
@@ -630,17 +627,12 @@ public final class ItemUtils {
case ARROW: case ARROW:
case SLIME_BALL: case SLIME_BALL:
case NETHER_STAR: case NETHER_STAR:
case COAL: // Not sure we should include this, as it will also trigger when mining
case ROTTEN_FLESH: case ROTTEN_FLESH:
case GOLD_NUGGET: case GOLD_NUGGET:
case EGG: case EGG:
return true; return true;
case COAL: // Not sure we should include this, as it will also trigger when mining
return (((Coal) item.getData()).getType() == CoalType.COAL);
case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
return (item.getData().getData() == 0x0);
default: default:
return false; return false;
} }
@@ -655,9 +647,7 @@ public final class ItemUtils {
public static boolean isWoodcuttingDrop(ItemStack item) { public static boolean isWoodcuttingDrop(ItemStack item) {
switch (item.getType()) { switch (item.getType()) {
case LOG: case LOG:
case LOG_2:
case LEAVES: case LEAVES:
case LEAVES_2:
case SAPLING: case SAPLING:
case APPLE: case APPLE:
return true; return true;

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
@@ -31,10 +30,6 @@ public class StringUtils {
return createPrettyEnumString(ability.toString()); return createPrettyEnumString(ability.toString());
} }
public static String getPrettyTreeSpeciesString(TreeSpecies species) {
return createPrettyEnumString(species.toString());
}
public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) { public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) {
switch (secondaryAbility) { switch (secondaryAbility) {
case HERBALISM_DOUBLE_DROPS: case HERBALISM_DOUBLE_DROPS:

View File

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

View File

@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
@@ -22,7 +23,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -40,21 +40,21 @@ public class ScoreboardManager {
static final String POWER_LEVEL = LocaleLoader.getString("Scoreboard.Misc.PowerLevel"); static final String POWER_LEVEL = LocaleLoader.getString("Scoreboard.Misc.PowerLevel");
static final String LABEL_POWER_LEVEL = POWER_LEVEL; static final OfflinePlayer LABEL_POWER_LEVEL = getOfflinePlayer(POWER_LEVEL);
static final String LABEL_LEVEL = LocaleLoader.getString("Scoreboard.Misc.Level"); static final OfflinePlayer LABEL_LEVEL = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Level"));
static final String LABEL_CURRENT_XP = LocaleLoader.getString("Scoreboard.Misc.CurrentXP"); static final OfflinePlayer LABEL_CURRENT_XP = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.CurrentXP"));
static final String LABEL_REMAINING_XP = LocaleLoader.getString("Scoreboard.Misc.RemainingXP"); static final OfflinePlayer LABEL_REMAINING_XP = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.RemainingXP"));
static final String LABEL_ABILITY_COOLDOWN = LocaleLoader.getString("Scoreboard.Misc.Cooldown"); static final OfflinePlayer LABEL_ABILITY_COOLDOWN = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Cooldown"));
static final String LABEL_OVERALL = LocaleLoader.getString("Scoreboard.Misc.Overall"); static final OfflinePlayer LABEL_OVERALL = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Overall"));
static final Map<SkillType, String> skillLabels; static final Map<SkillType, OfflinePlayer> skillLabels;
static final Map<AbilityType, String> abilityLabelsColored; static final Map<AbilityType, OfflinePlayer> abilityLabelsColored;
static final Map<AbilityType, String> abilityLabelsSkill; static final Map<AbilityType, OfflinePlayer> abilityLabelsSkill;
static { static {
ImmutableMap.Builder<SkillType, String> skillLabelBuilder = ImmutableMap.builder(); ImmutableMap.Builder<SkillType, OfflinePlayer> skillLabelBuilder = ImmutableMap.builder();
ImmutableMap.Builder<AbilityType, String> abilityLabelBuilder = ImmutableMap.builder(); ImmutableMap.Builder<AbilityType, OfflinePlayer> abilityLabelBuilder = ImmutableMap.builder();
ImmutableMap.Builder<AbilityType, String> abilityLabelSkillBuilder = ImmutableMap.builder(); ImmutableMap.Builder<AbilityType, OfflinePlayer> abilityLabelSkillBuilder = ImmutableMap.builder();
if (Config.getInstance().getScoreboardRainbows()) { if (Config.getInstance().getScoreboardRainbows()) {
// Everything but black, gray, gold // Everything but black, gray, gold
@@ -78,38 +78,36 @@ public class ScoreboardManager {
int i = 0; int i = 0;
for (SkillType type : SkillType.values()) { for (SkillType type : SkillType.values()) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false)); skillLabelBuilder.put(type, getOfflinePlayer(colors.get(i) + type.getName()));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), getOfflinePlayer(colors.get(i) + type.getAbility().getName()));
if (type == SkillType.MINING) { if (type == SkillType.MINING) {
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(colors.get(i) + AbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(AbilityType.BLAST_MINING, getOfflinePlayer(colors.get(i) + AbilityType.BLAST_MINING.getName()));
} }
} }
if (++i == colors.size()) { if (++i == colors.size()) i = 0;
i = 0;
}
} }
} }
else { else {
for (SkillType type : SkillType.values()) { for (SkillType type : SkillType.values()) {
// Include child skills // Include child skills
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName())); skillLabelBuilder.put(type, getOfflinePlayer(ChatColor.GREEN + type.getName()));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(ChatColor.AQUA + type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), getOfflinePlayerDots(ChatColor.AQUA + type.getAbility().getName()));
if (type == SkillType.MINING) { if (type == SkillType.MINING) {
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(ChatColor.AQUA + AbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(AbilityType.BLAST_MINING, getOfflinePlayerDots(ChatColor.AQUA + AbilityType.BLAST_MINING.getName()));
} }
} }
} }
} }
for (AbilityType type : AbilityType.values()) { for (AbilityType type : AbilityType.values()) {
abilityLabelSkillBuilder.put(type, getShortenedName((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName())); abilityLabelSkillBuilder.put(type, getOfflinePlayerDots((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName()));
} }
skillLabels = skillLabelBuilder.build(); skillLabels = skillLabelBuilder.build();
@@ -119,6 +117,22 @@ public class ScoreboardManager {
private static List<String> dirtyPowerLevels = new ArrayList<String>(); private static List<String> dirtyPowerLevels = new ArrayList<String>();
private static OfflinePlayer getOfflinePlayer(String name) {
return getOfflinePlayer(name, false);
}
private static OfflinePlayer getOfflinePlayerDots(String name) {
return getOfflinePlayer(name, true);
}
private static OfflinePlayer getOfflinePlayer(String name, boolean useDots) {
if (name.length() > 16) {
name = useDots ? name.substring(0, 14) + ".." : name.substring(0, 16);
}
return mcMMO.p.getServer().getOfflinePlayer(name);
}
public enum SidebarType { public enum SidebarType {
NONE, NONE,
SKILL_BOARD, SKILL_BOARD,
@@ -128,18 +142,6 @@ public class ScoreboardManager {
TOP_BOARD; TOP_BOARD;
} }
private static String getShortenedName(String name) {
return getShortenedName(name, true);
}
private static String getShortenedName(String name, boolean useDots) {
if (name.length() > 16) {
name = useDots ? name.substring(0, 14) + ".." : name.substring(0, 16);
}
return name;
}
// **** Listener call-ins **** // // **** Listener call-ins **** //
// Called by PlayerJoinEvent listener // Called by PlayerJoinEvent listener
@@ -159,8 +161,8 @@ public class ScoreboardManager {
// Called in onDisable() // Called in onDisable()
public static void teardownAll() { public static void teardownAll() {
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers()); Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers();
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")"); mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.length + ")");
for (Player player : onlinePlayers) { for (Player player : onlinePlayers) {
teardownPlayer(player); teardownPlayer(player);
} }
@@ -336,7 +338,7 @@ public class ScoreboardManager {
Player player = mcMMOPlayer.getPlayer(); Player player = mcMMOPlayer.getPlayer();
int power = mcMMOPlayer.getPowerLevel(); int power = mcMMOPlayer.getPowerLevel();
mainObjective.getScore(playerName).setScore(power); mainObjective.getScore(player).setScore(power);
for (ScoreboardWrapper wrapper : PLAYER_SCOREBOARDS.values()) { for (ScoreboardWrapper wrapper : PLAYER_SCOREBOARDS.values()) {
wrapper.updatePowerLevel(player, power); wrapper.updatePowerLevel(player, power);
@@ -349,7 +351,7 @@ public class ScoreboardManager {
/** /**
* Gets or creates the power level objective on the main scoreboard. * Gets or creates the power level objective on the main scoreboard.
* <p/> * <p>
* If power levels are disabled, the objective is deleted and null is * If power levels are disabled, the objective is deleted and null is
* returned. * returned.
* *

View File

@@ -28,6 +28,7 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
public class ScoreboardWrapper { public class ScoreboardWrapper {
// Initialization variables // Initialization variables
public final String playerName; public final String playerName;
private final Scoreboard scoreboard; private final Scoreboard scoreboard;
@@ -58,7 +59,7 @@ public class ScoreboardWrapper {
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) { for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
powerObjective.getScore(mcMMOPlayer.getProfile().getPlayerName()).setScore(mcMMOPlayer.getPowerLevel()); powerObjective.getScore(mcMMOPlayer.getPlayer()).setScore(mcMMOPlayer.getPowerLevel());
} }
} }
} }
@@ -68,7 +69,6 @@ public class ScoreboardWrapper {
} }
public BukkitTask updateTask = null; public BukkitTask updateTask = null;
private class ScoreboardQuickUpdate extends BukkitRunnable { private class ScoreboardQuickUpdate extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
@@ -78,7 +78,6 @@ public class ScoreboardWrapper {
} }
public BukkitTask revertTask = null; public BukkitTask revertTask = null;
private class ScoreboardChangeTask extends BukkitRunnable { private class ScoreboardChangeTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
@@ -88,7 +87,6 @@ public class ScoreboardWrapper {
} }
public BukkitTask cooldownTask = null; public BukkitTask cooldownTask = null;
private class ScoreboardCooldownTask extends BukkitRunnable { private class ScoreboardCooldownTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
@@ -123,8 +121,7 @@ public class ScoreboardWrapper {
try { try {
cooldownTask.cancel(); cooldownTask.cancel();
} }
catch (Throwable ignored) { catch (Throwable ignored) {}
}
cooldownTask = null; cooldownTask = null;
} }
@@ -277,7 +274,7 @@ public class ScoreboardWrapper {
targetProfile = null; targetProfile = null;
leaderboardPage = -1; leaderboardPage = -1;
loadObjective(ScoreboardManager.skillLabels.get(skill)); loadObjective(ScoreboardManager.skillLabels.get(skill).getName());
} }
public void setTypeSelfStats() { public void setTypeSelfStats() {
@@ -358,7 +355,7 @@ public class ScoreboardWrapper {
int endPosition = page * 15; int endPosition = page * 15;
int startPosition = endPosition - 14; int startPosition = endPosition - 14;
loadObjective(String.format("%s (%2d - %2d)", ScoreboardManager.skillLabels.get(skill), startPosition, endPosition)); loadObjective(String.format("%s (%2d - %2d)", ScoreboardManager.skillLabels.get(skill).getName(), startPosition, endPosition));
} }
// Setup for after a board type change // Setup for after a board type change
@@ -384,8 +381,7 @@ public class ScoreboardWrapper {
try { try {
updateTask.cancel(); updateTask.cancel();
} }
catch (Throwable ignored) { catch (Throwable ignored) {} // catch NullPointerException and IllegalStateException and any Error; don't care
} // catch NullPointerException and IllegalStateException and any Error; don't care
updateTask = null; updateTask = null;
@@ -403,123 +399,123 @@ public class ScoreboardWrapper {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
switch (sidebarType) { switch (sidebarType) {
case NONE: case NONE:
break; break;
case SKILL_BOARD: case SKILL_BOARD:
Validate.notNull(targetSkill); Validate.notNull(targetSkill);
if (!targetSkill.isChildSkill()) { if (!targetSkill.isChildSkill()) {
int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill); int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill);
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP); sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP); sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
}
else {
for (SkillType parentSkill : FamilyTree.getParents(targetSkill)) {
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
}
}
sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill));
if (targetSkill.getAbility() != null) {
boolean stopUpdating;
if (targetSkill == SkillType.MINING) {
// Special-Case: Mining has two abilities, both with cooldowns
Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.SUPER_BREAKER));
Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.BLAST_MINING));
int secondsSB = Math.max(mcMMOPlayer.calculateTimeRemaining(AbilityType.SUPER_BREAKER), 0);
int secondsBM = Math.max(mcMMOPlayer.calculateTimeRemaining(AbilityType.BLAST_MINING), 0);
cooldownSB.setScore(secondsSB);
cooldownBM.setScore(secondsBM);
stopUpdating = (secondsSB == 0 && secondsBM == 0);
} }
else { else {
for (SkillType parentSkill : FamilyTree.getParents(targetSkill)) { AbilityType ability = targetSkill.getAbility();
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill)); Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
}
}
sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill));
if (targetSkill.getAbility() != null) {
boolean stopUpdating;
if (targetSkill == SkillType.MINING) {
// Special-Case: Mining has two abilities, both with cooldowns
Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.SUPER_BREAKER));
Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(AbilityType.BLAST_MINING));
int secondsSB = Math.max(mcMMOPlayer.calculateTimeRemaining(AbilityType.SUPER_BREAKER), 0);
int secondsBM = Math.max(mcMMOPlayer.calculateTimeRemaining(AbilityType.BLAST_MINING), 0);
cooldownSB.setScore(secondsSB);
cooldownBM.setScore(secondsBM);
stopUpdating = (secondsSB == 0 && secondsBM == 0);
}
else {
AbilityType ability = targetSkill.getAbility();
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
cooldown.setScore(seconds);
stopUpdating = seconds == 0;
}
if (stopUpdating) {
stopCooldownUpdating();
}
else {
startCooldownUpdating();
}
}
break;
case COOLDOWNS_BOARD:
boolean anyCooldownsActive = false;
for (AbilityType ability : AbilityType.values()) {
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0); int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
if (seconds != 0) { cooldown.setScore(seconds);
anyCooldownsActive = true;
}
sidebarObjective.getScore(ScoreboardManager.abilityLabelsColored.get(ability)).setScore(seconds); stopUpdating = seconds == 0;
} }
if (anyCooldownsActive) { if (stopUpdating) {
startCooldownUpdating();
}
else {
stopCooldownUpdating(); stopCooldownUpdating();
} }
break;
case STATS_BOARD:
// Select the profile to read from
PlayerProfile newProfile;
if (targetProfile != null) {
newProfile = targetProfile; // offline
}
else if (targetPlayer == null) {
newProfile = mcMMOPlayer.getProfile(); // self
}
else { else {
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online startCooldownUpdating();
}
}
break;
case COOLDOWNS_BOARD:
boolean anyCooldownsActive = false;
for (AbilityType ability : AbilityType.values()) {
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
if (seconds != 0) {
anyCooldownsActive = true;
} }
// Calculate power level here sidebarObjective.getScore(ScoreboardManager.abilityLabelsColored.get(ability)).setScore(seconds);
int powerLevel = 0; }
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long
int level = newProfile.getSkillLevel(skill);
powerLevel += level; if (anyCooldownsActive) {
startCooldownUpdating();
}
else {
stopCooldownUpdating();
}
break;
// TODO: Verify that this is what we want - calculated in power level but not displayed case STATS_BOARD:
if (!skill.getPermissions(player)) { // Select the profile to read from
continue; PlayerProfile newProfile;
}
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(skill)).setScore(level); if (targetProfile != null) {
newProfile = targetProfile; // offline
}
else if (targetPlayer == null) {
newProfile = mcMMOPlayer.getProfile(); // self
}
else {
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
}
// Calculate power level here
int powerLevel = 0;
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long
int level = newProfile.getSkillLevel(skill);
powerLevel += level;
// TODO: Verify that this is what we want - calculated in power level but not displayed
if (!skill.getPermissions(player)) {
continue;
} }
sidebarObjective.getScore(ScoreboardManager.LABEL_POWER_LEVEL).setScore(powerLevel); sidebarObjective.getScore(ScoreboardManager.skillLabels.get(skill)).setScore(level);
break; }
case RANK_BOARD: sidebarObjective.getScore(ScoreboardManager.LABEL_POWER_LEVEL).setScore(powerLevel);
case TOP_BOARD: break;
case RANK_BOARD:
case TOP_BOARD:
/* /*
* @see #acceptRankData(Map<SkillType, Integer> rank) * @see #acceptRankData(Map<SkillType, Integer> rank)
* @see #acceptLeaderboardData(List<PlayerStat> stats) * @see #acceptLeaderboardData(List<PlayerStat> stats)
*/ */
break; break;
default: default:
break; break;
} }
} }
@@ -554,11 +550,11 @@ public class ScoreboardWrapper {
name = ChatColor.GOLD + "--You--"; name = ChatColor.GOLD + "--You--";
} }
sidebarObjective.getScore(name).setScore(stat.statVal); sidebarObjective.getScore(mcMMO.p.getServer().getOfflinePlayer(name)).setScore(stat.statVal);
} }
} }
public void updatePowerLevel(Player player, int newPowerLevel) { public void updatePowerLevel(Player player, int newPowerLevel) {
powerObjective.getScore(player.getName()).setScore(newPowerLevel); powerObjective.getScore(player).setScore(newPowerLevel);
} }
} }

View File

@@ -1,9 +1,5 @@
package com.gmail.nossr50.util.skills; 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.Material;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
@@ -19,11 +15,10 @@ import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@@ -48,16 +43,12 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableMap;
public final class CombatUtils { public final class CombatUtils {
private 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); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager(); SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
double initialDamage = event.getDamage();
Map<DamageModifier, Double> modifiers = getModifiers(event);
if (swordsManager.canActivateAbility()) { if (swordsManager.canActivateAbility()) {
mcMMOPlayer.checkAbilityActivation(SkillType.SWORDS); mcMMOPlayer.checkAbilityActivation(SkillType.SWORDS);
@@ -68,7 +59,7 @@ public final class CombatUtils {
} }
if (swordsManager.canUseSerratedStrike()) { if (swordsManager.canUseSerratedStrike()) {
swordsManager.serratedStrikes(target, initialDamage, modifiers); swordsManager.serratedStrikes(target, damage);
} }
startGainXp(mcMMOPlayer, target, SkillType.SWORDS); startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
@@ -77,7 +68,6 @@ public final class CombatUtils {
private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) { private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
double initialDamage = event.getDamage(); double initialDamage = event.getDamage();
double finalDamage = initialDamage; double finalDamage = initialDamage;
Map<DamageModifier, Double> modifiers = getModifiers(event);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
AxesManager axesManager = mcMMOPlayer.getAxesManager(); AxesManager axesManager = mcMMOPlayer.getAxesManager();
@@ -87,7 +77,7 @@ public final class CombatUtils {
} }
if (axesManager.canUseAxeMastery()) { if (axesManager.canUseAxeMastery()) {
finalDamage += axesManager.axeMastery(); finalDamage += axesManager.axeMastery(target);
} }
if (axesManager.canCriticalHit(target)) { if (axesManager.canCriticalHit(target)) {
@@ -102,10 +92,10 @@ public final class CombatUtils {
} }
if (axesManager.canUseSkullSplitter(target)) { 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); startGainXp(mcMMOPlayer, target, SkillType.AXES);
} }
@@ -121,18 +111,18 @@ public final class CombatUtils {
} }
if (unarmedManager.canUseIronArm()) { if (unarmedManager.canUseIronArm()) {
finalDamage += unarmedManager.ironArm(); finalDamage += unarmedManager.ironArm(target);
} }
if (unarmedManager.canUseBerserk()) { if (unarmedManager.canUseBerserk()) {
finalDamage += unarmedManager.berserkDamage(initialDamage); finalDamage += unarmedManager.berserkDamage(target, initialDamage);
} }
if (unarmedManager.canDisarm(target)) { if (unarmedManager.canDisarm(target)) {
unarmedManager.disarmCheck((Player) target); unarmedManager.disarmCheck((Player) target);
} }
applyScaledModifiers(initialDamage, finalDamage, event); event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.UNARMED); startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
} }
@@ -148,14 +138,14 @@ public final class CombatUtils {
} }
if (tamingManager.canUseSharpenedClaws()) { if (tamingManager.canUseSharpenedClaws()) {
finalDamage += tamingManager.sharpenedClaws(); finalDamage += tamingManager.sharpenedClaws(target, wolf);
} }
if (tamingManager.canUseGore()) { 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); startGainXp(mcMMOPlayer, target, SkillType.TAMING);
} }
@@ -179,11 +169,11 @@ public final class CombatUtils {
} }
if (archeryManager.canSkillShot()) { if (archeryManager.canSkillShot()) {
finalDamage += archeryManager.skillShot(initialDamage); finalDamage += archeryManager.skillShot(target, initialDamage, arrow);
} }
if (archeryManager.canDaze(target)) { if (archeryManager.canDaze(target)) {
finalDamage += archeryManager.daze((Player) target); finalDamage += archeryManager.daze((Player) target, arrow);
} }
if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canRetrieveArrows()) { if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canRetrieveArrows()) {
@@ -192,7 +182,7 @@ public final class CombatUtils {
archeryManager.distanceXpBonus(target, arrow); archeryManager.distanceXpBonus(target, arrow);
applyScaledModifiers(initialDamage, finalDamage, event); event.setDamage(finalDamage);
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble()); startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
} }
@@ -236,7 +226,7 @@ public final class CombatUtils {
} }
if (SkillType.SWORDS.getPermissions(player)) { if (SkillType.SWORDS.getPermissions(player)) {
processSwordCombat(target, player, event); processSwordCombat(target, player, event.getDamage());
} }
} }
else if (ItemUtils.isAxe(heldItem)) { else if (ItemUtils.isAxe(heldItem)) {
@@ -273,10 +263,10 @@ public final class CombatUtils {
} }
else if (entityType == EntityType.ARROW) { else if (entityType == EntityType.ARROW) {
Arrow arrow = (Arrow) damager; Arrow arrow = (Arrow) damager;
ProjectileSource projectileSource = arrow.getShooter(); LivingEntity shooter = arrow.getShooter();
if (projectileSource != null && projectileSource instanceof Player && SkillType.ARCHERY.shouldProcess(target)) { if (shooter != null && shooter instanceof Player && SkillType.ARCHERY.shouldProcess(target)) {
Player player = (Player) projectileSource; Player player = (Player) shooter;
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) { if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
processArcheryCombat(target, player, event, arrow); processArcheryCombat(target, player, event, arrow);
@@ -317,7 +307,6 @@ public final class CombatUtils {
* @param target LivingEntity which to attempt to damage * @param target LivingEntity which to attempt to damage
* @param damage Amount of damage to attempt to do * @param damage Amount of damage to attempt to do
*/ */
@Deprecated
public static void dealDamage(LivingEntity target, double damage) { public static void dealDamage(LivingEntity target, double damage) {
dealDamage(target, damage, DamageCause.CUSTOM, null); dealDamage(target, damage, DamageCause.CUSTOM, null);
} }
@@ -329,7 +318,6 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do * @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager * @param attacker Player to pass to event as damager
*/ */
@Deprecated
public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker) { public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker) {
dealDamage(target, damage, DamageCause.ENTITY_ATTACK, attacker); dealDamage(target, damage, DamageCause.ENTITY_ATTACK, attacker);
} }
@@ -341,23 +329,6 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do * @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager * @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) { public static void dealDamage(LivingEntity target, double damage, DamageCause cause, Entity attacker) {
if (target.isDead()) { if (target.isDead()) {
return; return;
@@ -374,7 +345,7 @@ public final class CombatUtils {
* @param damage The initial damage amount * @param damage The initial damage amount
* @param type The type of skill being used * @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 int numberOfTargets = getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
double damageAmount = Math.max(damage, 1); double damageAmount = Math.max(damage, 1);
@@ -410,7 +381,7 @@ public final class CombatUtils {
break; break;
} }
dealDamage(livingEntity, damageAmount, modifiers, attacker); dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--; numberOfTargets--;
} }
} }
@@ -595,86 +566,23 @@ public final class CombatUtils {
return false; return false;
} }
@Deprecated
public static double callFakeDamageEvent(Entity attacker, Entity target, double damage) { 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 cause, double damage) {
public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause damageCause, double damage) { if (Config.getInstance().getEventCallbackEnabled()) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, damageCause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, damageCause, damage); EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, cause, damage);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent); mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
if (damageEvent.isCancelled()) { if (damageEvent.isCancelled()) {
return 0; 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;
} }
scaledModifiers.put(modifier, damage * modifiers.get(modifier)); damage = damageEvent.getDamage();
} }
return scaledModifiers; return damage;
}
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;
} }
/** /**

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.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
@@ -207,25 +205,13 @@ public class SkillUtils {
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance; double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance) && !event.isCancelled(); return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance);
}
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();
} }
public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) { public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(event); 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) { 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 # Allow mcMMO to check if a new version is available
Update_Check: true Update_Check: true
Prefer_Beta: false Prefer_Beta: false
# Allow mcMMO to inform other plugins of damage being dealt
Event_Callback: true
Power_Level_Cap: 0 Power_Level_Cap: 0
# Should mcMMO print out debug messages? # Should mcMMO print out debug messages?
Verbose_Logging: false Verbose_Logging: false
@@ -292,7 +294,6 @@ Skills:
Fishing: Fishing:
Level_Cap: 0 Level_Cap: 0
Drops_Enabled: true Drops_Enabled: true
Override_Vanilla_Treasures: true
# Always catch fish, even when treasure is found # Always catch fish, even when treasure is found
Extra_Fish: false Extra_Fish: false
Herbalism: Herbalism:
@@ -352,9 +353,6 @@ Skills:
Level_Cap: 0 Level_Cap: 0
Block_Cracker: Block_Cracker:
SmoothBrick_To_CrackedBrick: true 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: Woodcutting:
Tree_Feller_Sounds: true Tree_Feller_Sounds: true
Level_Cap: 0 Level_Cap: 0
@@ -396,12 +394,10 @@ Double_Drops:
Sandstone: true Sandstone: true
Stone: true Stone: true
Woodcutting: Woodcutting:
Acacia: true Oak: true
Birch: true Birch: true
Dark_Oak: true Spruce: true
Generic: true
Jungle: true Jungle: true
Redwood: true
# #
# Settings for commands # Settings for commands

View File

@@ -80,22 +80,9 @@ Experience:
# FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant # FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant
FeatherFall_Multiplier: 2.0 FeatherFall_Multiplier: 2.0
Alchemy: Alchemy:
# Alchemy potion stages are based on the number of ingredients added Potion: 120
# Potion_Stage_1 represents a base potion
# Potion_Stage_2 represents a base potion with one ingredient
# Potion_Stage_3 represents a base potion with one ingredient and one amplifier
# Potion_Stage_4 represents a base potion with one ingredient and two amplifiers
# Potion_Stage_5 represents a base potion with one ingredient where the amplifiers are swapped
Potion_Stage_1: 15
Potion_Stage_2: 30
Potion_Stage_3: 60
Potion_Stage_4: 120
Potion_Stage_5: 0
Fishing: Fishing:
Raw_Fish: 800 Base: 800
Raw_Salmon: 800
Clownfish: 800
Pufferfish: 800
Shake: 50 Shake: 50
Excavation: Excavation:
Clay: 40 Clay: 40
@@ -108,46 +95,27 @@ Experience:
Snow_Block: 40 Snow_Block: 40
Soul_Sand: 40 Soul_Sand: 40
Woodcutting: Woodcutting:
Acacia: 90 Oak: 70
Spruce: 80
Birch: 90 Birch: 90
Dark_Oak: 90
Generic: 70
Jungle: 100 Jungle: 100
Redwood: 80
Huge_Mushroom_Red: 70 Huge_Mushroom_Red: 70
Huge_Mushroom_Brown: 70 Huge_Mushroom_Brown: 70
Herbalism: Herbalism:
Allium: 300
Azure_Bluet: 150
Blue_Orchid: 150
Brown_Mushroom: 150 Brown_Mushroom: 150
Cactus: 30 Cactus: 30
Carrot: 50 Carrot: 50
Cocoa: 30 Cocoa: 30
Crops: 50 Crops: 50
Dead_Bush: 30
Lilac: 50
Melon_Block: 20 Melon_Block: 20
Nether_Warts: 50 Nether_Warts: 50
Orange_Tulip: 150
Oxeye_Daisy: 150
Peony: 50
Pink_Tulip: 150
Poppy: 100
Potato: 50 Potato: 50
Pumpkin: 20 Pumpkin: 20
Red_Mushroom: 150 Red_Mushroom: 150
Red_Tulip: 150 Red_Rose: 100
Rose_Bush: 50
Small_Fern: 10
Small_Grass: 10
Sugar_Cane_Block: 30 Sugar_Cane_Block: 30
Sunflower: 50
Tall_Grass: 50
Tall_Fern: 50
Vine: 10 Vine: 10
Water_Lily: 100 Water_Lily: 100
White_Tulip: 150
Yellow_Flower: 100 Yellow_Flower: 100
Mining: Mining:
Coal_Ore: 100 Coal_Ore: 100
@@ -156,17 +124,14 @@ Experience:
Ender_Stone: 150 Ender_Stone: 150
Glowstone: 30 Glowstone: 30
Gold_Ore: 350 Gold_Ore: 350
Hard_Clay: 30
Iron_Ore: 250 Iron_Ore: 250
Lapis_Ore: 400 Lapis_Ore: 400
Mossy_Cobblestone: 30 Mossy_Cobblestone: 30
Netherrack: 30 Netherrack: 30
Obsidian: 150 Obsidian: 150
Packed_Ice: 50
Quartz_Ore: 100 Quartz_Ore: 100
Redstone_Ore: 150 Redstone_Ore: 150
Sandstone: 30 Sandstone: 30
Stained_Clay: 50
Stone: 30 Stone: 30
Repair: Repair:
Base: 1000.0 Base: 1000.0

View File

@@ -95,6 +95,7 @@ Fishing.Effect.10=Ryba\u0159en\u00ed v ledu
Fishing.Effect.11=Umo\u017e\u0148uje v\u00e1m ryba\u0159it v ledov\u00fdch prost\u0159ed\u00edch Fishing.Effect.11=Umo\u017e\u0148uje v\u00e1m ryba\u0159it v ledov\u00fdch prost\u0159ed\u00edch
Fishing.Chance.Raining=[[BLUE]] De\u0161\u0165ov\u00fd bonus Fishing.Chance.Raining=[[BLUE]] De\u0161\u0165ov\u00fd bonus
Fishing.Listener=Rybareni: Fishing.Listener=Rybareni:
Fishing.Ability.TH.ItemFound=[[GRAY]]Nasel si poklad!
Fishing.Ability.TH.MagicFound=[[GRAY]]C\u00edt\u00edte dotek magie s t\u00edmto \u00falovkem... Fishing.Ability.TH.MagicFound=[[GRAY]]C\u00edt\u00edte dotek magie s t\u00edmto \u00falovkem...
Fishing.SkillName=RYBARENI Fishing.SkillName=RYBARENI
Fishing.Skillup=[[YELLOW]]Dovednost v rybareni byla navysena o {0}. Celkem ({1}) Fishing.Skillup=[[YELLOW]]Dovednost v rybareni byla navysena o {0}. Celkem ({1})

View File

@@ -87,6 +87,7 @@ Fishing.Effect.6=Fisherman\'s Diet
Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Effect.7=Improves hunger restored from fished foods
Fishing.Chance.Raining=[[BLUE]] Rain Bonus Fishing.Chance.Raining=[[BLUE]] Rain Bonus
Fishing.Listener=Fishing: Fishing.Listener=Fishing:
Fishing.Ability.TH.ItemFound=[[GRAY]]Treasure found!
Fishing.Ability.TH.MagicFound=[[GRAY]]You feel a touch of magic with this catch... Fishing.Ability.TH.MagicFound=[[GRAY]]You feel a touch of magic with this catch...
Fishing.SkillName=FISHING Fishing.SkillName=FISHING
Fishing.Skillup=[[YELLOW]]Fishing skill increased by {0}. Total ({1}) Fishing.Skillup=[[YELLOW]]Fishing skill increased by {0}. Total ({1})

View File

@@ -87,6 +87,7 @@ Fishing.Effect.6=Fiskers Diet
Fishing.Effect.7=Forbedrer Sult genoprettet af Fisked mad Fishing.Effect.7=Forbedrer Sult genoprettet af Fisked mad
Fishing.Chance.Raining=[[BLUE]] Regn Bonus Fishing.Chance.Raining=[[BLUE]] Regn Bonus
Fishing.Listener=Fiskeri: Fishing.Listener=Fiskeri:
Fishing.Ability.TH.ItemFound=[[GRAY]Du har fundet en skat!
Fishing.Ability.TH.MagicFound=[[GRAY]]Du f\u00f8ler et strejf a magi med denne fangst... Fishing.Ability.TH.MagicFound=[[GRAY]]Du f\u00f8ler et strejf a magi med denne fangst...
Fishing.SkillName=FISKER Fishing.SkillName=FISKER
Fishing.Skillup=[[YELLOW]]Fisker evne for\u00f8get med {0}. Total ({1}) Fishing.Skillup=[[YELLOW]]Fisker evne for\u00f8get med {0}. Total ({1})

View File

@@ -87,6 +87,7 @@ Fishing.Effect.6=Fischer-Mahlzeit
Fishing.Effect.7=Verbessert Effizienz von geangelter Nahrung Fishing.Effect.7=Verbessert Effizienz von geangelter Nahrung
Fishing.Chance.Raining=[[BLUE]] Rain Bonus Fishing.Chance.Raining=[[BLUE]] Rain Bonus
Fishing.Listener=Angeln: Fishing.Listener=Angeln:
Fishing.Ability.TH.ItemFound=[[AQUA]]Du hast einen Schatz gefunden!
Fishing.Ability.TH.MagicFound=[[AQUA]]Dich ber\u00fchrt ein leichter Zauber bei diesem Fang... Fishing.Ability.TH.MagicFound=[[AQUA]]Dich ber\u00fchrt ein leichter Zauber bei diesem Fang...
Fishing.SkillName=ANGELN Fishing.SkillName=ANGELN
Fishing.Skillup=[[YELLOW]]Angel Skill um {0} gestiegen. Gesamt ({1}) Fishing.Skillup=[[YELLOW]]Angel Skill um {0} gestiegen. Gesamt ({1})

View File

@@ -137,6 +137,7 @@ Fishing.Effect.10=Ice Fishing
Fishing.Effect.11=Allows you to fish in icy biomes Fishing.Effect.11=Allows you to fish in icy biomes
Fishing.Chance.Raining=[[BLUE]] Rain Bonus Fishing.Chance.Raining=[[BLUE]] Rain Bonus
Fishing.Listener=Fishing: Fishing.Listener=Fishing:
Fishing.Ability.TH.ItemFound=[[GRAY]]Treasure found!
Fishing.Ability.TH.MagicFound=[[GRAY]]You feel a touch of magic with this catch... Fishing.Ability.TH.MagicFound=[[GRAY]]You feel a touch of magic with this catch...
Fishing.Ability.TH.Boom=[[GRAY]]BOOM TIME!!! Fishing.Ability.TH.Boom=[[GRAY]]BOOM TIME!!!
Fishing.Ability.TH.Poison=[[GRAY]]Something doesn't smell quite right... Fishing.Ability.TH.Poison=[[GRAY]]Something doesn't smell quite right...
@@ -739,7 +740,7 @@ Guides.Axes.Section.5=[[DARK_AQUA]]How does Greater Impact work?\n[[YELLOW]]You
##Excavation ##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.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.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.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. 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

@@ -96,6 +96,7 @@ Fishing.Effect.10=Pesca de hielo
Fishing.Effect.11=Te permite pescar en biomas de hielo Fishing.Effect.11=Te permite pescar en biomas de hielo
Fishing.Chance.Raining=[[BLUE]] Lluvia de Bonus Fishing.Chance.Raining=[[BLUE]] Lluvia de Bonus
Fishing.Listener=Pescador: Fishing.Listener=Pescador:
Fishing.Ability.TH.ItemFound=[[GRAY]]\u00a1Tesoro encontrado!
Fishing.Ability.TH.MagicFound=[[GRAY]]Sientes un toque de magia con esta pesca... Fishing.Ability.TH.MagicFound=[[GRAY]]Sientes un toque de magia con esta pesca...
Fishing.SkillName=PESCADOR Fishing.SkillName=PESCADOR
Fishing.Skillup=[[YELLOW]]Habilidad de Pescador incrementada en {0}. Total ({1}) Fishing.Skillup=[[YELLOW]]Habilidad de Pescador incrementada en {0}. Total ({1})

View File

@@ -2,6 +2,7 @@ Acrobatics.Listener=Akrobaatika:
Acrobatics.SkillName=AKROBAATIKA Acrobatics.SkillName=AKROBAATIKA
Acrobatics.Skillup=[[YELLOW]]Akrobaatika oskus kasvanud {0} v\u00f5rra. Kokku ({1}) Acrobatics.Skillup=[[YELLOW]]Akrobaatika oskus kasvanud {0} v\u00f5rra. Kokku ({1})
Archery.Skillup=[[YELLOW]]Vibunduse oskus kasvanud {0} v\u00f5rra. Kokku ({1}) Archery.Skillup=[[YELLOW]]Vibunduse oskus kasvanud {0} v\u00f5rra. Kokku ({1})
Fishing.Ability.TH.ItemFound=[[GRAY]]Varandus leitud!
Mining.Ability.Lower=[[GRAY]]**TE LANGETASITE OMA KIRKA** Mining.Ability.Lower=[[GRAY]]**TE LANGETASITE OMA KIRKA**
Mining.Ability.Ready=[[GREEN]]**TE PANITE OMA KIRKA VALMIS** Mining.Ability.Ready=[[GREEN]]**TE PANITE OMA KIRKA VALMIS**
Mining.Listener=Kaevandamine: Mining.Listener=Kaevandamine:

Some files were not shown because too many files have changed in this diff Show More