mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 17:53:00 +01:00
Compare commits
149 Commits
dev-spout
...
dev-wildca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a80cdaff71 | ||
|
|
75cbfa1b1c | ||
|
|
48c7aa3e84 | ||
|
|
87bce65098 | ||
|
|
c288dc433b | ||
|
|
0cc29d070f | ||
|
|
8fd94b625c | ||
|
|
ccca3fff26 | ||
|
|
f77446919f | ||
|
|
96fdf265d5 | ||
|
|
b964e3f7c3 | ||
|
|
d93c83f775 | ||
|
|
6b9f6c29ec | ||
|
|
09b0bf62e2 | ||
|
|
15d7d3f8a2 | ||
|
|
dedbdf890a | ||
|
|
30085e1e34 | ||
|
|
1c30146491 | ||
|
|
037022b175 | ||
|
|
0aa67727f5 | ||
|
|
8e3e1d5f11 | ||
|
|
d2d70089ca | ||
|
|
94a566acc9 | ||
|
|
daab095557 | ||
|
|
2b9b5df1ee | ||
|
|
e7e62b8d40 | ||
|
|
3d242bbdb6 | ||
|
|
e796eae3c3 | ||
|
|
a257e83a62 | ||
|
|
d527584248 | ||
|
|
0a4de6e2fc | ||
|
|
4b20f12eff | ||
|
|
0de1187012 | ||
|
|
8e474170e4 | ||
|
|
2eeb9b1f35 | ||
|
|
3de6e2c3f1 | ||
|
|
98d166808f | ||
|
|
f75e15dfdc | ||
|
|
f2b892b7d5 | ||
|
|
883ada01f8 | ||
|
|
3a8f45a04d | ||
|
|
906609696b | ||
|
|
66ccde4310 | ||
|
|
4970cdc3f4 | ||
|
|
1becc874ba | ||
|
|
b107a8dc7c | ||
|
|
37aebc1716 | ||
|
|
836877ff93 | ||
|
|
28a846e0cb | ||
|
|
0185a30ec9 | ||
|
|
38e1947302 | ||
|
|
4fb4d6fc0c | ||
|
|
6d719988bf | ||
|
|
b1c1f0e21e | ||
|
|
3f34cc7365 | ||
|
|
3c6c2837bd | ||
|
|
4bcef76fd8 | ||
|
|
2fd5d7aa81 | ||
|
|
5080c68dce | ||
|
|
3403aef37d | ||
|
|
53a34c12d2 | ||
|
|
59417d6721 | ||
|
|
93d63dbca5 | ||
|
|
4643cf1070 | ||
|
|
91bf54019e | ||
|
|
ead716ef0d | ||
|
|
8fec1af257 | ||
|
|
99248caba3 | ||
|
|
af64bdf742 | ||
|
|
66a4925371 | ||
|
|
8eb6acd60f | ||
|
|
ce6892f2e6 | ||
|
|
c14a4e9305 | ||
|
|
5825eb1696 | ||
|
|
bfebbd0095 | ||
|
|
b204507a82 | ||
|
|
9f53426511 | ||
|
|
03c2282c3f | ||
|
|
20092d55fd | ||
|
|
69a2a5cfff | ||
|
|
618cfad100 | ||
|
|
56e625a9df | ||
|
|
79a1ef5d3e | ||
|
|
10dd7619bf | ||
|
|
f9dfec5bd0 | ||
|
|
a9488bc18b | ||
|
|
f0ee708710 | ||
|
|
3390a31cc6 | ||
|
|
0b4b272223 | ||
|
|
8d200ea653 | ||
|
|
eb359c5595 | ||
|
|
e1b8088c17 | ||
|
|
70a1eea231 | ||
|
|
c744974192 | ||
|
|
faa11a87a9 | ||
|
|
91da5c4ab1 | ||
|
|
da5e770e06 | ||
|
|
09557e378b | ||
|
|
72d26fed0f | ||
|
|
225de799e8 | ||
|
|
334c44760f | ||
|
|
ac7fc1020d | ||
|
|
461871327b | ||
|
|
60ddd799de | ||
|
|
80571fbe8f | ||
|
|
d407f85704 | ||
|
|
458dc7db42 | ||
|
|
beab794c0e | ||
|
|
8256f5461c | ||
|
|
0fe3ad7432 | ||
|
|
04e5dda127 | ||
|
|
f65adea2f9 | ||
|
|
cdfb0da5c9 | ||
|
|
cfa3d34dff | ||
|
|
01b7d4f742 | ||
|
|
9a359bf42c | ||
|
|
ebdf11300b | ||
|
|
e1a8f02bce | ||
|
|
862d38b587 | ||
|
|
2415767c06 | ||
|
|
aa59348a94 | ||
|
|
9c925d3327 | ||
|
|
30f7521a3a | ||
|
|
7b3869e385 | ||
|
|
0e641f7c5b | ||
|
|
733d16cf35 | ||
|
|
833bc1b251 | ||
|
|
840f3d9382 | ||
|
|
34d6d867f2 | ||
|
|
e56d5a0454 | ||
|
|
53fdf750f4 | ||
|
|
f096e915cf | ||
|
|
ce59488e8e | ||
|
|
47db522cc1 | ||
|
|
a2cac82cba | ||
|
|
2e74333eb7 | ||
|
|
0056be2d5f | ||
|
|
1d7e034d5e | ||
|
|
8deac175d1 | ||
|
|
d0b766a2d3 | ||
|
|
65692f2a83 | ||
|
|
d0b0786284 | ||
|
|
87ac1002de | ||
|
|
c51fde7f1f | ||
|
|
0a6735110f | ||
|
|
8a284c50a2 | ||
|
|
09431ef27c | ||
|
|
9f9de86d21 | ||
|
|
d9c04a09ba |
@@ -7,7 +7,59 @@ Key:
|
|||||||
! Change
|
! Change
|
||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 1.4.08-dev
|
Version 1.5.01-dev
|
||||||
|
+ Added new child skill; Salvage
|
||||||
|
+ 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 for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
|
||||||
|
+ Added support for `MATERIAL|data` format in treasures.yml
|
||||||
|
+ Added API to experience events to get XP gain reason
|
||||||
|
+ Added API to check if an entity is bleeding
|
||||||
|
+ Added options to tools.yml and armor.yml config files to set a pretty repair material name
|
||||||
|
+ Added full support for repairables in tools.yml and armor.yml config files
|
||||||
|
+ Added new API class SkillAPI used to get a list of valid skill names
|
||||||
|
= Fixed bug where pistons would mess with the block tracking
|
||||||
|
= Fixed bug where the Updater was running on the main thread.
|
||||||
|
= Fixed bug when players would use /ptp without being in a party
|
||||||
|
= Fixed bug where player didn't have a mcMMOPlayer object in AsyncPlayerChatEvent
|
||||||
|
= Fixed bug where dodge would check the wrong player skill level
|
||||||
|
= Fixed bug which causes /party teleport to stop working
|
||||||
|
= Fixed bug where SaveTimerTask would produce an IndexOutOfBoundsException
|
||||||
|
= Fixed bug where Alchemy would not fire BrewEvents
|
||||||
|
= Fixed bug with setting custom names and lore in treasures config
|
||||||
|
= Fixed bug which would cause a NullPointerException with getFlowerAndGrassXp()
|
||||||
|
= Fixed bug which could cause and SQLException regarding the connection property 'maxReconnects'.
|
||||||
|
= Fixed bug where falling blocks were incorrectly tracked
|
||||||
|
= Fixed bug where items would get deleted when in Berserk with a full inventory
|
||||||
|
= Fixed bug where the console would not correctly show party chat colors
|
||||||
|
= Fixed bug where party chat was using non thread safe methods
|
||||||
|
= Fixed bug where Blast Mining unlock levels could be to high in certain occasions
|
||||||
|
= Fixed bug where Blast Minings ability "Demolition Expert" would not work
|
||||||
|
! Changed SecondaryAbilityEvent to implement Cancellable and it now gets fired for damage related secondary abilities
|
||||||
|
! Changed the way mcMMO handles bonus damage, updated for the new damage event API
|
||||||
|
! Changed player data saving. Save tasks are now asynchronous
|
||||||
|
! Vanished players no longer get hit by AoE effects
|
||||||
|
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients'
|
||||||
|
! Changed Alchemy XP distribution. XP is granted based on the stage of the potion.
|
||||||
|
! Changed behavior of the Blast Mining ability "Demolition Expert"; now only decreases damage for the ability user
|
||||||
|
! Updated for new getOnlinePlayers() behavior
|
||||||
|
- Removed salvage ability from Repair, salvage has it's own (child) skill now
|
||||||
|
|
||||||
|
Version 1.5.00
|
||||||
|
+ 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
|
||||||
+ 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
|
||||||
+ Added the possibility to gain experience when using Fishing "Shake"
|
+ Added the possibility to gain experience when using Fishing "Shake"
|
||||||
@@ -21,6 +73,13 @@ Version 1.4.08-dev
|
|||||||
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
|
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
|
||||||
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
|
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
|
||||||
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
|
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
|
||||||
|
+ Added config options to configure the items used in "Call of the Wild"
|
||||||
|
+ Added config option to configure the database command cooldown
|
||||||
|
= Fixed bug where healthbars wouldn't display if skills were disabled
|
||||||
|
= Fixed bug with "Call of the Wild" entities despawning
|
||||||
|
= Fixed bug with updating (very) old user data.
|
||||||
|
= Fixed bug with checking maximum durability of mod items.
|
||||||
|
= Fixed exploit involving Call of The Wild.
|
||||||
= Fixed bug where LeafBlower permissions were ignored
|
= Fixed bug where LeafBlower permissions were ignored
|
||||||
= Fixed bug with toggle commands not properly displaying the success message.
|
= Fixed bug with toggle commands not properly displaying the success message.
|
||||||
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
||||||
@@ -34,9 +93,12 @@ Version 1.4.08-dev
|
|||||||
= Fixed bug where party chat broke if the display name contained special characters
|
= Fixed bug where party chat broke if the display name contained special characters
|
||||||
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work
|
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work
|
||||||
= Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
|
= Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
|
||||||
|
= Fixed bug where some horses summoned with "Call of the Wild" were unable to jump
|
||||||
= Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command
|
= Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command
|
||||||
= Fixed bug where Hylian Luck was broken
|
= Fixed bug where Hylian Luck was broken
|
||||||
= Fixed bug where Snow would never drop treasures
|
= Fixed bug where Snow would never drop treasures
|
||||||
|
= Fixed issues with commands giving away vanished players.
|
||||||
|
= Fixed bug where the Repair lucky perk would increase the Arcane Forging downgrade chance, instead of decreasing it
|
||||||
! Changed party system. Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
|
! Changed party system. Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
|
||||||
! Changed appearance of party member list. Gold = party leader, White = online, Gray = offline, Italic = not nearby
|
! Changed appearance of party member list. Gold = party leader, White = online, Gray = offline, Italic = not nearby
|
||||||
! Updated localization files
|
! Updated localization files
|
||||||
@@ -46,6 +108,8 @@ Version 1.4.08-dev
|
|||||||
! Changed /ptp config setting, Commands.ptp.Confirm_Required is now Commands.ptp.Accept.Required
|
! Changed /ptp config setting, Commands.ptp.Confirm_Required is now Commands.ptp.Accept.Required
|
||||||
! Changed config validation for UnlockLevels, they can now also be 0
|
! Changed config validation for UnlockLevels, they can now also be 0
|
||||||
! Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other
|
! Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other
|
||||||
|
! Changed default amount of XP gained from mining Quartz Ore. From 250 to 100 XP.
|
||||||
|
! Changed Acrobatics config setting, Skills.Acrobatics.Prevent_XP_After_Teleport is now Skills.Acrobatics.XP_After_Teleport_Cooldown
|
||||||
- Removed /stats alias for /mcstats
|
- Removed /stats alias for /mcstats
|
||||||
|
|
||||||
Version 1.4.07
|
Version 1.4.07
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
|
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
|
||||||
|
|
||||||
### Brief Description
|
### Brief Description
|
||||||
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds thirteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Additionally, when run in conjuction with SpoutPlugin, mcMMO also has a custom XP bar to allow for easy tracking of progress towards leveling up. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
|
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
|
||||||
|
|
||||||
## About the Team
|
## About the Team
|
||||||
|
|
||||||
@@ -47,6 +47,5 @@ Required Libraries:
|
|||||||
* JUnit
|
* JUnit
|
||||||
* EMetrics
|
* EMetrics
|
||||||
* Bukkit
|
* Bukkit
|
||||||
* SpoutPlugin API
|
|
||||||
|
|
||||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||||
|
|||||||
132
extras/mods/1.7.x/twilightforest.armor.yml
Normal file
132
extras/mods/1.7.x/twilightforest.armor.yml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
# 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
|
||||||
116
extras/mods/1.7.x/twilightforest.blocks.yml
Normal file
116
extras/mods/1.7.x/twilightforest.blocks.yml
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
# 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
|
||||||
152
extras/mods/1.7.x/twilightforest.entities.yml
Normal file
152
extras/mods/1.7.x/twilightforest.entities.yml
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
# 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
|
||||||
184
extras/mods/1.7.x/twilightforest.tools.yml
Normal file
184
extras/mods/1.7.x/twilightforest.tools.yml
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
# 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
|
||||||
53
pom.xml
53
pom.xml
@@ -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.4.08-SNAPSHOT</version>
|
<version>1.5.01-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>
|
||||||
@@ -22,38 +22,6 @@
|
|||||||
<include>.jenkins</include>
|
<include>.jenkins</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
|
||||||
<targetPath>resources</targetPath>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources/xpbar/</directory>
|
|
||||||
<includes>
|
|
||||||
<include>xpbar*.png</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<targetPath>resources</targetPath>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources/healthbar/</directory>
|
|
||||||
<includes>
|
|
||||||
<include>health*.png</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<targetPath>resources</targetPath>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources/skillicon/</directory>
|
|
||||||
<includes>
|
|
||||||
<include>*.png</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<targetPath>resources</targetPath>
|
|
||||||
<filtering>false</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources/sound/</directory>
|
|
||||||
<includes>
|
|
||||||
<include>*.wav</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>com/gmail/nossr50/locale</targetPath>
|
<targetPath>com/gmail/nossr50/locale</targetPath>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
@@ -144,18 +112,6 @@
|
|||||||
<id>md_5-releases</id>
|
<id>md_5-releases</id>
|
||||||
<url>http://repo.md-5.net/content/repositories/releases/</url>
|
<url>http://repo.md-5.net/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>sonatype-nexus-releases</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>sonatype-nexus-snapshots</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
<updatePolicy>always</updatePolicy>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>Plugin MetricsExtension</id>
|
<id>Plugin MetricsExtension</id>
|
||||||
<url>http://repo.turt2live.com</url>
|
<url>http://repo.turt2live.com</url>
|
||||||
@@ -165,15 +121,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.6.4-R2.0</version>
|
<version>LATEST</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.spoutcraft</groupId>
|
|
||||||
<artifactId>spoutcraftplugin</artifactId>
|
|
||||||
<version>LATEST</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit-dep</artifactId>
|
<artifactId>junit-dep</artifactId>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.gmail.nossr50.api;
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
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.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
public final class AbilityAPI {
|
public final class AbilityAPI {
|
||||||
@@ -80,4 +82,8 @@ public final class AbilityAPI {
|
|||||||
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
||||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
|
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBleeding(LivingEntity entity) {
|
||||||
|
return BleedTimerTask.isBleeding(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
|
import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
|
||||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||||
|
import com.gmail.nossr50.api.exceptions.InvalidXPGainReasonException;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
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.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@@ -43,9 +45,7 @@ public final class ExperienceAPI {
|
|||||||
public static boolean isNonChildSkill(String skillType) {
|
public static boolean isNonChildSkill(String skillType) {
|
||||||
SkillType skill = SkillType.getSkill(skillType);
|
SkillType skill = SkillType.getSkill(skillType);
|
||||||
|
|
||||||
if (skill == null) return false;
|
return skill != null && !skill.isChildSkill();
|
||||||
|
|
||||||
return !skill.isChildSkill();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -64,8 +64,26 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addRawXP(Player player, String skillType, float XP) {
|
public static void addRawXP(Player player, String skillType, float XP) {
|
||||||
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), XP);
|
addRawXP(player, skillType, XP, "UNKNOWN");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds raw XP to the player.
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @param player The player to add XP to
|
||||||
|
* @param skillType The skill to add XP to
|
||||||
|
* @param XP The amount of XP to add
|
||||||
|
* @param xpGainReason The reason to gain XP
|
||||||
|
*
|
||||||
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
|
*/
|
||||||
|
public static void addRawXP(Player player, String skillType, float XP, String xpGainReason) {
|
||||||
|
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -100,8 +118,26 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addMultipliedXP(Player player, String skillType, int XP) {
|
public static void addMultipliedXP(Player player, String skillType, int XP) {
|
||||||
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
addMultipliedXP(player, skillType, XP, "UNKNOWN");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds XP to the player, calculates for XP Rate only.
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @param player The player to add XP to
|
||||||
|
* @param skillType The skill to add XP to
|
||||||
|
* @param XP The amount of XP to add
|
||||||
|
* @param xpGainReason The reason to gain XP
|
||||||
|
*
|
||||||
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
|
*/
|
||||||
|
public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||||
|
UserManager.getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,10 +167,28 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addModifiedXP(Player player, String skillType, int XP) {
|
public static void addModifiedXP(Player player, String skillType, int XP) {
|
||||||
|
addModifiedXP(player, skillType, XP, "UNKNOWN");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds XP to the player, calculates for XP Rate and skill modifier.
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @param player The player to add XP to
|
||||||
|
* @param skillType The skill to add XP to
|
||||||
|
* @param XP The amount of XP to add
|
||||||
|
* @param xpGainReason The reason to gain XP
|
||||||
|
*
|
||||||
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
|
*/
|
||||||
|
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||||
SkillType skill = getSkillType(skillType);
|
SkillType skill = getSkillType(skillType);
|
||||||
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,8 +221,27 @@ public final class ExperienceAPI {
|
|||||||
*
|
*
|
||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addXP(Player player, String skillType, int XP) {
|
public static void addXP(Player player, String skillType, int XP) {
|
||||||
UserManager.getPlayer(player).beginXpGain(getSkillType(skillType), XP);
|
addXP(player, skillType, XP, "UNKNOWN");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds XP to the player, calculates for XP Rate, skill modifiers, perks, child skills,
|
||||||
|
* and party sharing.
|
||||||
|
* </br>
|
||||||
|
* This function is designed for API usage.
|
||||||
|
*
|
||||||
|
* @param player The player to add XP to
|
||||||
|
* @param skillType The skill to add XP to
|
||||||
|
* @param XP The amount of XP to add
|
||||||
|
* @param xpGainReason The reason to gain XP
|
||||||
|
*
|
||||||
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
|
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||||
|
*/
|
||||||
|
public static void addXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||||
|
UserManager.getPlayer(player).beginXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,12 +422,12 @@ public final class ExperienceAPI {
|
|||||||
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.addLevels(skill, levels);
|
profile.addLevels(skill, levels);
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -583,7 +656,7 @@ public final class ExperienceAPI {
|
|||||||
PlayerProfile profile = getOfflineProfile(playerName);
|
PlayerProfile profile = getOfflineProfile(playerName);
|
||||||
|
|
||||||
profile.addXp(skill, XP);
|
profile.addXp(skill, XP);
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PlayerProfile getOfflineProfile(String playerName) {
|
private static PlayerProfile getOfflineProfile(String playerName) {
|
||||||
@@ -615,4 +688,14 @@ public final class ExperienceAPI {
|
|||||||
|
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static XPGainReason getXPGainReason(String reason) throws InvalidXPGainReasonException {
|
||||||
|
XPGainReason xpGainReason = XPGainReason.getXPGainReason(reason);
|
||||||
|
|
||||||
|
if (xpGainReason == null) {
|
||||||
|
throw new InvalidXPGainReasonException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return xpGainReason;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public final class PartyAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasAlly(String partyName) {
|
public static boolean hasAlly(String partyName) {
|
||||||
return PartyManager.getParty(partyName).getAlly() != null;
|
return getAllyName(partyName) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAllyName(String partyName) {
|
public static String getAllyName(String partyName) {
|
||||||
|
|||||||
93
src/main/java/com/gmail/nossr50/api/SkillAPI.java
Normal file
93
src/main/java/com/gmail/nossr50/api/SkillAPI.java
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.gmail.nossr50.api;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
|
|
||||||
public class SpoutHudAPI {
|
|
||||||
private SpoutHudAPI() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the mcMMO XP bar for a player.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*/
|
|
||||||
public static void disableXpBar(Player player) {
|
|
||||||
UserManager.getPlayer(player).getProfile().setHudType(HudType.DISABLED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the mcMMO XP bar for the server.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*/
|
|
||||||
public static void disableXpBar() {
|
|
||||||
SpoutConfig.getInstance().setXPBarEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package com.gmail.nossr50.api;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
||||||
|
|
||||||
public final class SpoutToolsAPI {
|
|
||||||
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
|
|
||||||
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
|
|
||||||
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
|
|
||||||
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
|
|
||||||
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
|
|
||||||
|
|
||||||
private SpoutToolsAPI() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a custom Spout tool to mcMMO for XP gain & ability use.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param spoutTool The tool to add
|
|
||||||
* @param type The type of tool to add
|
|
||||||
*/
|
|
||||||
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
|
|
||||||
switch (type) {
|
|
||||||
case AXE:
|
|
||||||
spoutAxes.add(spoutTool);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HOE:
|
|
||||||
spoutHoes.add(spoutTool);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICKAXE:
|
|
||||||
spoutPickaxes.add(spoutTool);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHOVEL:
|
|
||||||
spoutShovels.add(spoutTool);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SWORD:
|
|
||||||
spoutSwords.add(spoutTool);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isSpoutTool(ItemStack spoutTool, ToolType type) {
|
|
||||||
return getSpoutTools(type) != null && getSpoutTools(type).contains(spoutTool);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<ItemStack> getSpoutTools(ToolType type) {
|
|
||||||
switch (type) {
|
|
||||||
case AXE:
|
|
||||||
return spoutAxes;
|
|
||||||
|
|
||||||
case HOE:
|
|
||||||
return spoutHoes;
|
|
||||||
|
|
||||||
case PICKAXE:
|
|
||||||
return spoutPickaxes;
|
|
||||||
|
|
||||||
case SHOVEL:
|
|
||||||
return spoutShovels;
|
|
||||||
|
|
||||||
case SWORD:
|
|
||||||
return spoutSwords;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.gmail.nossr50.api.exceptions;
|
||||||
|
|
||||||
|
public class InvalidXPGainReasonException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 4427052841957931157L;
|
||||||
|
|
||||||
|
public InvalidXPGainReasonException() {
|
||||||
|
super("That is not a valid XPGainReason.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.runnables.party.PartyChatTask;
|
||||||
|
|
||||||
public class PartyChatManager extends ChatManager {
|
public class PartyChatManager extends ChatManager {
|
||||||
private Party party;
|
private Party party;
|
||||||
@@ -30,21 +25,6 @@ public class PartyChatManager extends ChatManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sendMessage() {
|
protected void sendMessage() {
|
||||||
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
|
new PartyChatTask(plugin, party, senderName, displayName, message).runTask(plugin);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -58,7 +57,7 @@ public class KrakenCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
|||||||
@@ -4,14 +4,12 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.spout.SpoutUtils;
|
|
||||||
|
|
||||||
public class McmmoCommand implements CommandExecutor {
|
public class McmmoCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
@@ -28,16 +26,14 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(mcSplit);
|
sender.sendMessage(mcSplit);
|
||||||
|
|
||||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||||
if (mcMMO.isSpoutEnabled() && sender instanceof Player) {
|
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||||
SpoutUtils.sendDonationNotification((Player) sender);
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
if (Permissions.showversion(sender)) {
|
||||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
|
||||||
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -62,7 +61,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.database;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -23,7 +22,7 @@ public class McremoveCommand implements TabExecutor {
|
|||||||
case 1:
|
case 1:
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
|
|
||||||
if (UserManager.getPlayer(playerName, true) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
|
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ public class McremoveCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -26,11 +27,11 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
profile.addLevels(skill, value);
|
profile.addLevels(skill, value);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, true);
|
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
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;
|
||||||
@@ -23,11 +24,11 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
profile.addXp(skill, value);
|
profile.addXp(skill, value);
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -68,7 +67,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
int value = Integer.parseInt(args[2]);
|
int value = Integer.parseInt(args[2]);
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||||
|
|
||||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
@@ -96,7 +95,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
case 2:
|
case 2:
|
||||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -28,7 +29,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
profile.modifySkill(skill, value);
|
profile.modifySkill(skill, value);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel);
|
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -14,6 +13,7 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
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.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -66,7 +66,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||||
|
|
||||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
@@ -94,7 +94,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
case 2:
|
case 2:
|
||||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||||
@@ -110,11 +110,11 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
profile.modifySkill(skill, 0);
|
profile.modifySkill(skill, 0);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
profile.save();
|
profile.scheduleAsyncSave();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false);
|
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -13,10 +12,10 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||||
|
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@@ -56,7 +55,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
||||||
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
||||||
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
||||||
private CommandExecutor partyTeleportCommand = mcMMO.p.getCommand("ptp").getExecutor();
|
private CommandExecutor partyTeleportCommand = new PtpCommand();
|
||||||
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
||||||
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
||||||
|
|
||||||
@@ -179,7 +178,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
case INVITE:
|
case INVITE:
|
||||||
case KICK:
|
case KICK:
|
||||||
case OWNER:
|
case OWNER:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
case XPSHARE:
|
case XPSHARE:
|
||||||
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
|
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
|
||||||
@@ -194,7 +193,10 @@ public class PartyCommand implements TabExecutor {
|
|||||||
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
playerNames = UserManager.getPlayerNames();
|
Player player = (Player) sender;
|
||||||
|
Party party = UserManager.getPlayer(player).getParty();
|
||||||
|
|
||||||
|
playerNames = party.getOnlinePlayerNames(player);
|
||||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
|
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
|
||||||
|
|
||||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.party.Party;
|
|||||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
public class PartyKickCommand implements CommandExecutor {
|
public class PartyKickCommand implements CommandExecutor {
|
||||||
@@ -19,13 +20,15 @@ public class PartyKickCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(args[1]);
|
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||||
|
|
||||||
if (!playerParty.getMembers().contains(target.getName())) {
|
if (!playerParty.getMembers().contains(targetName)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", target.getName()));
|
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
|
||||||
|
|
||||||
if (target.isOnline()) {
|
if (target.isOnline()) {
|
||||||
Player onlineTarget = target.getPlayer();
|
Player onlineTarget = target.getPlayer();
|
||||||
String partyName = playerParty.getName();
|
String partyName = playerParty.getName();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.party.alliance;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -111,7 +110,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 3:
|
case 3:
|
||||||
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
|
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
|
||||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true);
|
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
|
||||||
|
|
||||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.party.teleport;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -44,6 +43,12 @@ public class PtpCommand implements TabExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
|
if (!mcMMOPlayer.inParty()) {
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||||
@@ -109,7 +114,14 @@ public class PtpCommand implements TabExecutor {
|
|||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
Player player = (Player) sender;
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
|
if (!mcMMOPlayer.inParty()) {
|
||||||
|
return ImmutableList.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -29,7 +28,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||||
|
|
||||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
@@ -104,7 +103,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -15,7 +14,6 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@@ -47,7 +45,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||||
|
|
||||||
if (mcMMOPlayer != null) {
|
if (mcMMOPlayer != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
@@ -73,7 +71,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
Set<String> playerNames = UserManager.getPlayerNames();
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
@@ -83,8 +81,9 @@ public class McrankCommand implements TabExecutor {
|
|||||||
private void display(CommandSender sender, String playerName) {
|
private void display(CommandSender sender, String playerName) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ 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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||||
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.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@@ -85,8 +84,9 @@ public class MctopCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
public class AprilCommand implements TabExecutor {
|
||||||
|
private String skillName;
|
||||||
|
|
||||||
|
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
|
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
skillName = StringUtils.getCapitalized(label);
|
||||||
|
|
||||||
|
switch (args.length) {
|
||||||
|
case 0:
|
||||||
|
Player player = (Player) sender;
|
||||||
|
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
|
||||||
|
|
||||||
|
float skillValue = Misc.getRandom().nextInt(99);
|
||||||
|
|
||||||
|
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||||
|
player.sendMessage(LocaleLoader.getString("Commands.XPGain", getXPGainString(fakeSkillType)));
|
||||||
|
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, Misc.getRandom().nextInt(1000), 1000 + Misc.getRandom().nextInt(1000)));
|
||||||
|
|
||||||
|
|
||||||
|
List<String> effectMessages = effectsDisplay(fakeSkillType);
|
||||||
|
|
||||||
|
if (!effectMessages.isEmpty()) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
|
||||||
|
|
||||||
|
for (String message : effectMessages) {
|
||||||
|
player.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> statsMessages = statsDisplay(fakeSkillType);
|
||||||
|
|
||||||
|
if (!statsMessages.isEmpty()) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
|
||||||
|
|
||||||
|
for (String message : statsMessages) {
|
||||||
|
player.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage(LocaleLoader.formatString("[[DARK_AQUA]]Guide for {0} available - type /APRIL FOOLS ! :D", skillName));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getXPGainString(FakeSkillType fakeSkillType) {
|
||||||
|
switch (fakeSkillType) {
|
||||||
|
case MACHO:
|
||||||
|
return "Get beaten up";
|
||||||
|
case JUMPING:
|
||||||
|
return "Kris Kross will make ya Jump Jump";
|
||||||
|
case THROWING:
|
||||||
|
return "Chuck your items on the floor";
|
||||||
|
case WRECKING:
|
||||||
|
return "I'M GONNA WRECK IT!";
|
||||||
|
case CRAFTING:
|
||||||
|
return "Craft apple pies";
|
||||||
|
case WALKING:
|
||||||
|
return "Walk around the park";
|
||||||
|
case SWIMMING:
|
||||||
|
return "Like a fish on a bicycle";
|
||||||
|
case FALLING:
|
||||||
|
return "Faceplant the floor, headbutt the ground";
|
||||||
|
case CLIMBING:
|
||||||
|
return "Climb the highest mountain";
|
||||||
|
case FLYING:
|
||||||
|
return "I believe I can fly";
|
||||||
|
case DIVING:
|
||||||
|
return "Scuba club 4000";
|
||||||
|
case PIGGY:
|
||||||
|
return "OINK! OINK!";
|
||||||
|
default:
|
||||||
|
return "Sit and wait?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
|
switch (args.length) {
|
||||||
|
case 1:
|
||||||
|
return ImmutableList.of("?");
|
||||||
|
default:
|
||||||
|
return ImmutableList.of();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
|
||||||
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
|
switch (fakeSkillType) {
|
||||||
|
case MACHO:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Punching bag", "Absorb damage, like a bag of sand"));
|
||||||
|
break;
|
||||||
|
case JUMPING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Jump", "PRESS SPACE TO JUMP"));
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Jump Twice", "PRESS SPACE TWICE TO JUMP TWICE"));
|
||||||
|
break;
|
||||||
|
case THROWING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Drop Item", "Randomly drop items, at random"));
|
||||||
|
break;
|
||||||
|
case WRECKING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Ralphinator", "Smash windows with your fists"));
|
||||||
|
break;
|
||||||
|
case CRAFTING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Crafting", "Chance of successful craft"));
|
||||||
|
break;
|
||||||
|
case WALKING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Walk", "Traveling gracefully by foot"));
|
||||||
|
break;
|
||||||
|
case SWIMMING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Swim", "Just keep swimming, swimming, swimming"));
|
||||||
|
break;
|
||||||
|
case FALLING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Skydiving", "Go jump of a cliff. No, seriously."));
|
||||||
|
break;
|
||||||
|
case CLIMBING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Rock Climber", "Use string to climb mountains faster"));
|
||||||
|
break;
|
||||||
|
case FLYING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Fly", "Throw yourself at the ground and miss"));
|
||||||
|
break;
|
||||||
|
case DIVING:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Hold Breath", "Press shift to hold your breath longer"));
|
||||||
|
break;
|
||||||
|
case PIGGY:
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", "Carrot Turbo", "Supercharge your pigs with carrots"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> statsDisplay(FakeSkillType fakeSkillType) {
|
||||||
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
|
switch (fakeSkillType) {
|
||||||
|
case MACHO:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Damage Taken: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(77))));
|
||||||
|
break;
|
||||||
|
case JUMPING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Double Jump Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case THROWING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Drop Item Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(87))));
|
||||||
|
break;
|
||||||
|
case WRECKING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Wrecking Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(14))));
|
||||||
|
break;
|
||||||
|
case CRAFTING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Crafting Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case WALKING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Walk Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case SWIMMING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Swim Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case FALLING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Skydiving Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(37))));
|
||||||
|
break;
|
||||||
|
case CLIMBING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Rock Climber Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case FLYING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Fly Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case DIVING:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Hold Breath Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
||||||
|
break;
|
||||||
|
case PIGGY:
|
||||||
|
messages.add(LocaleLoader.formatString("[[RED]]Carrot Turbo Boost: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(80)) + 10));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.dazeModifier)));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Archery.Effect.2"), LocaleLoader.getString("Archery.Effect.3", Archery.dazeBonusDamage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canRetrieve) {
|
if (canRetrieve) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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;
|
||||||
|
|
||||||
@@ -51,7 +50,6 @@ public class FishingCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
boolean isStorming = player.getWorld().hasStorm();
|
|
||||||
|
|
||||||
// TREASURE HUNTER
|
// TREASURE HUNTER
|
||||||
if (canTreasureHunt) {
|
if (canTreasureHunt) {
|
||||||
@@ -70,7 +68,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
double totalEnchantChance = 0;
|
double totalEnchantChance = 0;
|
||||||
|
|
||||||
for (Rarity rarity : Rarity.values()) {
|
for (Rarity rarity : Rarity.values()) {
|
||||||
if (rarity != Rarity.TRAP || rarity != Rarity.RECORD) {
|
if (rarity != Rarity.TRAP && rarity != Rarity.RECORD) {
|
||||||
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
|
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,16 +90,14 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
// MASTER ANGLER
|
// MASTER ANGLER
|
||||||
if (canMasterAngler) {
|
if (canMasterAngler) {
|
||||||
double rawBiteChance = 1.0 / (isStorming ? 300 : 500);
|
double rawBiteChance = 1.0 / (player.getWorld().hasStorm() ? 300 : 500);
|
||||||
Location location = fishingManager.getHookLocation();
|
Location location = fishingManager.getHookLocation();
|
||||||
|
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
location = player.getLocation();
|
location = player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Biome biome = location.getBlock().getBiome();
|
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) {
|
||||||
|
|
||||||
if (biome == Biome.RIVER || biome == Biome.OCEAN) {
|
|
||||||
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
|
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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;
|
||||||
@@ -126,7 +127,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canBiggerBombs) {
|
if (canBiggerBombs) {
|
||||||
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.TWO);
|
int unlockLevel = BlastMining.getBiggerBombsUnlockLevel();
|
||||||
|
|
||||||
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)));
|
||||||
@@ -137,7 +138,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canDemoExpert) {
|
if (canDemoExpert) {
|
||||||
int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.FOUR);
|
int unlockLevel = BlastMining.getDemolitionExpertUnlockLevel();
|
||||||
|
|
||||||
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)));
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
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;
|
||||||
@@ -26,7 +27,6 @@ public class RepairCommand extends SkillCommand {
|
|||||||
private boolean canSuperRepair;
|
private boolean canSuperRepair;
|
||||||
private boolean canMasterRepair;
|
private boolean canMasterRepair;
|
||||||
private boolean canArcaneForge;
|
private boolean canArcaneForge;
|
||||||
private boolean canSalvage;
|
|
||||||
private boolean canRepairStone;
|
private boolean canRepairStone;
|
||||||
private boolean canRepairIron;
|
private boolean canRepairIron;
|
||||||
private boolean canRepairGold;
|
private boolean canRepairGold;
|
||||||
@@ -77,14 +77,13 @@ public class RepairCommand extends SkillCommand {
|
|||||||
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
||||||
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
||||||
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
||||||
canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE);
|
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||||
canRepairDiamond = Permissions.repairDiamond(player);
|
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||||
canRepairGold = Permissions.repairGold(player);
|
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||||
canRepairIron = Permissions.repairIron(player);
|
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE);
|
||||||
canRepairStone = Permissions.repairStone(player);
|
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||||
canRepairString = Permissions.repairString(player);
|
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||||
canRepairLeather = Permissions.repairLeather(player);
|
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||||
canRepairWood = Permissions.repairWood(player);
|
|
||||||
arcaneBypass = Permissions.arcaneBypass(player);
|
arcaneBypass = Permissions.arcaneBypass(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,10 +121,6 @@ public class RepairCommand extends SkillCommand {
|
|||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canSalvage && Repair.salvageUnlockLevel > 0) {
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Repair.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canArcaneForge) {
|
if (canArcaneForge) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
|
public class SalvageCommand extends SkillCommand {
|
||||||
|
private boolean canAdvancedSalvage;
|
||||||
|
private boolean canArcaneSalvage;
|
||||||
|
|
||||||
|
public SalvageCommand() {
|
||||||
|
super(SkillType.SALVAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void permissionsCheck(Player player) {
|
||||||
|
canAdvancedSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ADVANCED_SALVAGE);
|
||||||
|
canArcaneSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_SALVAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> effectsDisplay() {
|
||||||
|
List<String> messages = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (canAdvancedSalvage) {
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Salvage.Effect.0"), LocaleLoader.getString("Salvage.Effect.1")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canArcaneSalvage) {
|
||||||
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Salvage.Effect.2"), LocaleLoader.getString("Salvage.Effect.3")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
|
List<String> messages = new ArrayList<String>();
|
||||||
|
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||||
|
|
||||||
|
if (canAdvancedSalvage) {
|
||||||
|
if (skillValue < Salvage.advancedSalvageUnlockLevel) {
|
||||||
|
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Salvage.Ability.Locked.0", Salvage.advancedSalvageUnlockLevel)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"), LocaleLoader.getString("Salvage.Ability.Bonus.1", percent.format(salvageManager.getMaxSalvagePercentage()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canArcaneSalvage) {
|
||||||
|
messages.add(LocaleLoader.getString("Salvage.Arcane.Rank", salvageManager.getArcaneSalvageRank(), Salvage.Tier.values().length));
|
||||||
|
|
||||||
|
if (Salvage.arcaneSalvageEnchantLoss) {
|
||||||
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Salvage.arcaneSalvageDowngrades) {
|
||||||
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractPartial"), percent.format(salvageManager.getExtractPartialEnchantChance() / 100)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,9 +91,9 @@ public class TamingCommand extends SkillCommand {
|
|||||||
|
|
||||||
if (canCallWild) {
|
if (canCallWild) {
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13")));
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13")));
|
||||||
messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWOcelotCost()));
|
messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWCost(EntityType.OCELOT)));
|
||||||
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWWolfCost()));
|
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWCost(EntityType.WOLF)));
|
||||||
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWHorseCost()));
|
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWCost(EntityType.HORSE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// IRON ARM
|
// IRON ARM
|
||||||
if (canIronArm) {
|
if (canIronArm) {
|
||||||
ironArmBonus = Math.min(3 + ((int) skillValue / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
|
ironArmBonus = Math.min(Unarmed.ironArmMinBonusDamage + ((int) skillValue / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRON GRIP
|
// IRON GRIP
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.gmail.nossr50.commands.spout;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.util.StringUtil;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
public class MchudCommand extends SpoutCommand {
|
|
||||||
private static final List<String> HUD_TYPES;
|
|
||||||
|
|
||||||
static {
|
|
||||||
ArrayList<String> types = new ArrayList<String>();
|
|
||||||
|
|
||||||
for (HudType type : HudType.values()) {
|
|
||||||
types.add(type.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(types);
|
|
||||||
HUD_TYPES = ImmutableList.copyOf(types);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
|
||||||
switch (args.length) {
|
|
||||||
case 1:
|
|
||||||
return StringUtil.copyPartialMatches(args[0], HUD_TYPES, new ArrayList<String>(HUD_TYPES.size()));
|
|
||||||
default:
|
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean noArguments(Command command, CommandSender sender, String[] args) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean oneArgument(Command command, CommandSender sender, String[] args) {
|
|
||||||
try {
|
|
||||||
playerProfile.setHudType(HudType.valueOf(args[0].toUpperCase().trim()));
|
|
||||||
spoutHud.initializeXpBar();
|
|
||||||
spoutHud.updateXpBar();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException ex) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mchud.Invalid"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.gmail.nossr50.commands.spout;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabExecutor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
|
|
||||||
public abstract class SpoutCommand implements TabExecutor {
|
|
||||||
protected PlayerProfile playerProfile;
|
|
||||||
protected McMMOHud spoutHud;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mcMMO.isSpoutEnabled() || !SpoutConfig.getInstance().getXPBarEnabled()) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerProfile = UserManager.getPlayer((Player) sender).getProfile();
|
|
||||||
spoutHud = playerProfile.getSpoutHud();
|
|
||||||
|
|
||||||
if (spoutHud == null) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (args.length) {
|
|
||||||
case 0:
|
|
||||||
return noArguments(command, sender, args);
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
return oneArgument(command, sender, args);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract boolean noArguments(Command command, CommandSender sender, String[] args);
|
|
||||||
|
|
||||||
protected abstract boolean oneArgument(Command command, CommandSender sender, String[] args);
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
package com.gmail.nossr50.commands.spout;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.util.StringUtil;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
public class XplockCommand extends SpoutCommand {
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
|
||||||
switch (args.length) {
|
|
||||||
case 1:
|
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
|
||||||
return StringUtil.copyPartialMatches(args[0], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return matches;
|
|
||||||
default:
|
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean noArguments(Command command, CommandSender sender, String[] args) {
|
|
||||||
if (spoutHud.getXpBarLocked()) {
|
|
||||||
unlockXpBar(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
lockXpBar(sender, spoutHud.getLastGained());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean oneArgument(Command command, CommandSender sender, String[] args) {
|
|
||||||
if (CommandUtils.shouldEnableToggle(args[0])) {
|
|
||||||
lockXpBar(sender, spoutHud.getLastGained());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CommandUtils.shouldDisableToggle(args[0])) {
|
|
||||||
unlockXpBar(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CommandUtils.isInvalidSkill(sender, args[0])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkillType skill = SkillType.getSkill(args[0]);
|
|
||||||
|
|
||||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Permissions.xplock(sender, skill)) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
lockXpBar(sender, skill);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lockXpBar(CommandSender sender, SkillType skill) {
|
|
||||||
if (skill != null) {
|
|
||||||
spoutHud.setXpBarLocked(true);
|
|
||||||
spoutHud.setSkillLock(skill);
|
|
||||||
spoutHud.updateXpBar();
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.xplock.locked", skill.getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void unlockXpBar(CommandSender sender) {
|
|
||||||
spoutHud.setXpBarLocked(false);
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,6 +10,7 @@ import com.gmail.nossr50.skills.alchemy.Alchemy;
|
|||||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
@@ -133,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 (getDazeModifier() < 0) {
|
if (getDazeBonusDamage() < 0) {
|
||||||
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,10 +379,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSalvageUnlockLevel() < 0) {
|
|
||||||
reason.add("Skills.Repair.Salvage.UnlockLevel should be at least 0!");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ArcaneForging.Tier> arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values());
|
List<ArcaneForging.Tier> arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values());
|
||||||
|
|
||||||
for (ArcaneForging.Tier tier : arcaneForgingTierList) {
|
for (ArcaneForging.Tier tier : arcaneForgingTierList) {
|
||||||
@@ -414,6 +411,51 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SALVAGE */
|
||||||
|
if (getSalvageMaxPercentage() < 1) {
|
||||||
|
reason.add("Skills.Salvage.MaxPercentage should be at least 1!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getSalvageMaxPercentageLevel() < 1) {
|
||||||
|
reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getAdvancedSalvageUnlockLevel() < 1) {
|
||||||
|
reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 1!");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Salvage.Tier> salvageTierList = Arrays.asList(Salvage.Tier.values());
|
||||||
|
|
||||||
|
for (Salvage.Tier tier : salvageTierList) {
|
||||||
|
if (getArcaneSalvageRankLevel(tier) < 0) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getArcaneSalvageExtractFullEnchantsChance(tier) < 0 || getArcaneSalvageExtractFullEnchantsChance(tier) > 100) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getArcaneSalvageExtractPartialEnchantsChance(tier) < 0 || getArcaneSalvageExtractPartialEnchantsChance(tier) > 100) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tier != Salvage.Tier.EIGHT) {
|
||||||
|
Salvage.Tier nextTier = salvageTierList.get(salvageTierList.indexOf(tier) - 1);
|
||||||
|
|
||||||
|
if (getArcaneSalvageRankLevel(tier) >= getArcaneSalvageRankLevel(nextTier)) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextTier.toNumerical() + "!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getArcaneSalvageExtractFullEnchantsChance(tier) > getArcaneSalvageExtractFullEnchantsChance(nextTier)) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + nextTier.toNumerical() + "!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getArcaneSalvageExtractPartialEnchantsChance(tier) > getArcaneSalvageExtractPartialEnchantsChance(nextTier)) {
|
||||||
|
reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + nextTier.toNumerical() + "!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* SMELTING */
|
/* SMELTING */
|
||||||
if (getBurnModifierMaxLevel() < 1) {
|
if (getBurnModifierMaxLevel() < 1) {
|
||||||
reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
|
reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
|
||||||
@@ -672,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 getDazeModifier() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
public double getDazeBonusDamage() { 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); }
|
||||||
|
|
||||||
@@ -725,7 +767,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
/* REPAIR */
|
/* REPAIR */
|
||||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); }
|
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); }
|
||||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage.UnlockLevel", 600); }
|
|
||||||
|
|
||||||
/* Arcane Forging */
|
/* Arcane Forging */
|
||||||
public int getArcaneForgingRankLevel(ArcaneForging.Tier tier) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical()); }
|
public int getArcaneForgingRankLevel(ArcaneForging.Tier tier) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical()); }
|
||||||
@@ -736,6 +777,19 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
||||||
public double getArcaneForgingDowngradeChance(ArcaneForging.Tier tier) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + tier.toNumerical()); }
|
public double getArcaneForgingDowngradeChance(ArcaneForging.Tier tier) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + tier.toNumerical()); }
|
||||||
|
|
||||||
|
/* SALVAGE */
|
||||||
|
public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); }
|
||||||
|
public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); }
|
||||||
|
|
||||||
|
public int getAdvancedSalvageUnlockLevel() { return config.getInt("Skills.Salvage.AdvancedSalvage.UnlockLevel", 350); }
|
||||||
|
|
||||||
|
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
|
||||||
|
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
|
||||||
|
|
||||||
|
public int getArcaneSalvageRankLevel(Salvage.Tier tier) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical()); }
|
||||||
|
public double getArcaneSalvageExtractFullEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical()); }
|
||||||
|
public double getArcaneSalvageExtractPartialEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical()); }
|
||||||
|
|
||||||
/* SMELTING */
|
/* SMELTING */
|
||||||
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); }
|
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); }
|
||||||
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
||||||
@@ -777,6 +831,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }
|
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }
|
||||||
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
|
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
|
||||||
|
|
||||||
|
public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
|
||||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||||
|
|
||||||
/* UNARMED */
|
/* UNARMED */
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ 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;
|
||||||
|
|
||||||
@@ -182,20 +183,40 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Cannot use the same item for Repair and Salvage anvils!");
|
reason.add("Cannot use the same item for Repair and Salvage anvils!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingCOTWWolfCost() < 1) {
|
if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
|
||||||
reason.add("Skills.Taming.Call_Of_The_Wild.Bones_Required should be at least 1!");
|
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingCOTWOcelotCost() < 1) {
|
if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
|
||||||
reason.add("Skills.Taming.Call_Of_The_Wild.Fish_Required should be at least 1!");
|
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
|
if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
|
||||||
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot_Amount should be greater than 0!");
|
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
|
||||||
|
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
|
||||||
|
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
|
||||||
|
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
|
if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
|
||||||
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf_Amount should be greater than 0!");
|
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
|
||||||
|
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
|
||||||
|
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return noErrorsInConfig(reason);
|
return noErrorsInConfig(reason);
|
||||||
@@ -216,9 +237,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 boolean getConfigOverwriteEnabled() { return config.getBoolean("General.Config_Update_Overwrite", true); }
|
|
||||||
|
|
||||||
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]])"); }
|
||||||
public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
|
public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
|
||||||
@@ -229,6 +248,7 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
|
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
|
||||||
|
|
||||||
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
|
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
|
||||||
|
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
|
||||||
|
|
||||||
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
|
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
|
||||||
|
|
||||||
@@ -245,6 +265,11 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); }
|
public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); }
|
||||||
|
|
||||||
/* Scoreboards */
|
/* Scoreboards */
|
||||||
|
public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); }
|
||||||
|
public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); }
|
||||||
|
public boolean getShowStatsAfterLogin() { return config.getBoolean("Scoreboard.Show_Stats_After_Login", false); }
|
||||||
|
public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); }
|
||||||
|
|
||||||
public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
|
public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
|
||||||
public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }
|
public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }
|
||||||
public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); }
|
public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); }
|
||||||
@@ -270,11 +295,6 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); }
|
public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); }
|
||||||
public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); }
|
public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); }
|
||||||
|
|
||||||
public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); }
|
|
||||||
|
|
||||||
public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); }
|
|
||||||
public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); }
|
|
||||||
|
|
||||||
/* Database Purging */
|
/* Database Purging */
|
||||||
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
|
public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
|
||||||
public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
|
public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
|
||||||
@@ -423,14 +443,17 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
|
|
||||||
/* Acrobatics */
|
/* Acrobatics */
|
||||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||||
public boolean getPreventXPAfterTeleport() { return config.getBoolean("Skills.Acrobatics.Prevent_XP_After_Teleport", true); }
|
public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
|
||||||
|
|
||||||
/* Alchemy */
|
/* Alchemy */
|
||||||
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
|
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
|
||||||
public boolean getPreventHopperTransfer() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer", false); }
|
public boolean getPreventHopperTransferIngredients() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false); }
|
||||||
|
public boolean getPreventHopperTransferBottles() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false); }
|
||||||
|
|
||||||
/* 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); }
|
||||||
|
|
||||||
/* Mining */
|
/* Mining */
|
||||||
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
||||||
@@ -440,26 +463,27 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
|
public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
|
||||||
public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
|
public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
|
||||||
public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
|
public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
|
||||||
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_Material", "GOLD_BLOCK")); }
|
|
||||||
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
|
||||||
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
|
||||||
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
||||||
|
|
||||||
|
/* Salvage */
|
||||||
|
public boolean getSalvageAnvilMessagesEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Messages", true); }
|
||||||
|
public boolean getSalvageAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Placed_Sounds", true); }
|
||||||
|
public boolean getSalvageAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Use_Sounds", true); }
|
||||||
|
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Salvage.Anvil_Material", "GOLD_BLOCK")); }
|
||||||
|
public boolean getSalvageConfirmRequired() { return config.getBoolean("Skills.Salvage.Confirm_Required", true); }
|
||||||
|
|
||||||
/* 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 int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); }
|
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||||
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
|
||||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
|
||||||
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); }
|
||||||
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
|
|
||||||
|
|
||||||
/* Woodcutting */
|
/* Woodcutting */
|
||||||
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
|
public boolean getWoodcuttingDoubleDropsEnabled(TreeSpecies species) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
||||||
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 */
|
||||||
|
|||||||
@@ -3,13 +3,18 @@ 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.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
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 {
|
||||||
@@ -77,8 +82,10 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Alchemy */
|
/* Alchemy */
|
||||||
if (getPotionXP() <= 0) {
|
for (PotionStage potionStage : PotionStage.values()) {
|
||||||
reason.add("Experience.Alchemy.Potion should be greater than 0!");
|
if (getPotionXP(potionStage) < 0) {
|
||||||
|
reason.add("Experience.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Combat XP Multipliers */
|
/* Combat XP Multipliers */
|
||||||
@@ -103,9 +110,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fishing */
|
/* Fishing */
|
||||||
if (getFishingBaseXP() <= 0) {
|
// TODO: Add validation for each fish type once enum is available.
|
||||||
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!");
|
||||||
@@ -126,20 +131,12 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Woodcutting */
|
/* Woodcutting */
|
||||||
if (getWoodcuttingXPOak() <= 0) {
|
for (TreeSpecies species : TreeSpecies.values()) {
|
||||||
reason.add("Experience.Woodcutting.Oak should be greater than 0!");
|
String key = "Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_");
|
||||||
}
|
|
||||||
|
|
||||||
if (getWoodcuttingXPBirch() <= 0) {
|
if (config.getInt(key) <= 0) {
|
||||||
reason.add("Experience.Woodcutting.Birch should be greater than 0!");
|
reason.add(key + " 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) {
|
||||||
@@ -164,7 +161,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
/* Curve values */
|
/* Curve values */
|
||||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
||||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) +"_Values.exponent"); }
|
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||||
|
|
||||||
/* Global modifier */
|
/* Global modifier */
|
||||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||||
@@ -208,15 +205,119 @@ 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() { return config.getDouble("Experience.Alchemy.Potion", 150D); }
|
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||||
|
|
||||||
/* Fishing */
|
/* Fishing */
|
||||||
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
|
public int getFishXp(MaterialData data) {
|
||||||
|
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(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||||
|
|
||||||
/* Taming */
|
/* Taming */
|
||||||
public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
|
public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
|
||||||
@@ -224,10 +325,7 @@ 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 getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
|
public int getWoodcuttingTreeXP(TreeSpecies species) { return config.getInt("Experience.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
|
||||||
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); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ArmorConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false);
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class BlockConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false);
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class CustomArmorConfig extends ConfigLoader {
|
public class CustomArmorConfig extends ConfigLoader {
|
||||||
private boolean needsUpdate = false;
|
private boolean needsUpdate = false;
|
||||||
@@ -79,19 +79,23 @@ public class CustomArmorConfig extends ConfigLoader {
|
|||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
||||||
int repairQuantity = Repair.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
if (repairQuantity == 0) {
|
||||||
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, 0, repairQuantity, durability, RepairItemType.ARMOR, RepairMaterialType.OTHER, 1.0));
|
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
materialList.add(armorMaterial);
|
materialList.add(armorMaterial);
|
||||||
|
|||||||
@@ -68,39 +68,59 @@ public class CustomBlockConfig extends ConfigLoader {
|
|||||||
Material blockMaterial = Material.matchMaterial(blockInfo[0]);
|
Material blockMaterial = Material.matchMaterial(blockInfo[0]);
|
||||||
|
|
||||||
if (blockMaterial == null) {
|
if (blockMaterial == null) {
|
||||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
|
plugin.getLogger().warning("Invalid material name. [" + blockInfo[0] + "] This item will be skipped. - " + blockName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blockInfo.length == 2) {
|
||||||
|
String[] dataInfo = blockInfo[1].split("[-]");
|
||||||
|
|
||||||
|
if (dataInfo.length == 2) {
|
||||||
|
byte startData = Byte.valueOf(dataInfo[0]);
|
||||||
|
byte endData = Byte.valueOf(dataInfo[1]);
|
||||||
|
|
||||||
|
for (byte blockData = startData; blockData <= endData; blockData++) {
|
||||||
|
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
||||||
|
loadBlock(skillType, blockList, blockName, blockMaterialData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
||||||
|
|
||||||
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
|
||||||
|
loadBlock(skillType, blockList, blockName, blockMaterialData);
|
||||||
if (blockList != null) {
|
|
||||||
blockList.add(blockMaterialData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skillType.equals("Ability_Blocks")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain");
|
|
||||||
int smeltingXp = 0;
|
|
||||||
|
|
||||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
|
||||||
customOres.add(blockMaterialData);
|
|
||||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
|
||||||
}
|
|
||||||
else if (skillType.equals("Woodcutting")) {
|
|
||||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
|
||||||
customLogs.add(blockMaterialData);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
customLeaves.add(blockMaterialData);
|
|
||||||
xp = 0; // Leaves don't grant XP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadBlock(String skillType, List<MaterialData> blockList, String blockName, MaterialData blockMaterialData) {
|
||||||
|
if (blockList != null) {
|
||||||
|
blockList.add(blockMaterialData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skillType.equals("Ability_Blocks")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain");
|
||||||
|
int smeltingXp = 0;
|
||||||
|
|
||||||
|
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
|
customOres.add(blockMaterialData);
|
||||||
|
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||||
|
}
|
||||||
|
else if (skillType.equals("Woodcutting")) {
|
||||||
|
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||||
|
customLogs.add(blockMaterialData);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
customLeaves.add(blockMaterialData);
|
||||||
|
xp = 0; // Leaves don't grant XP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class CustomToolConfig extends ConfigLoader {
|
public class CustomToolConfig extends ConfigLoader {
|
||||||
private boolean needsUpdate = false;
|
private boolean needsUpdate = false;
|
||||||
@@ -87,19 +87,23 @@ public class CustomToolConfig extends ConfigLoader {
|
|||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
||||||
int repairQuantity = Repair.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
if (repairQuantity == 0) {
|
||||||
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, 0, repairQuantity, durability, RepairItemType.TOOL, RepairMaterialType.OTHER, 1.0));
|
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class EntityConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false);
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "entities.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ToolConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false);
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "tools.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class RepairConfig extends ConfigLoader {
|
public class RepairConfig extends ConfigLoader {
|
||||||
private List<Repairable> repairables;
|
private List<Repairable> repairables;
|
||||||
@@ -48,37 +48,37 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Repair Material Type
|
// Repair Material Type
|
||||||
RepairMaterialType repairMaterialType = RepairMaterialType.OTHER;
|
MaterialType repairMaterialType = MaterialType.OTHER;
|
||||||
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isWoodTool(repairItem)) {
|
if (ItemUtils.isWoodTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.WOOD;
|
repairMaterialType = MaterialType.WOOD;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.STONE;
|
repairMaterialType = MaterialType.STONE;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isStringTool(repairItem)) {
|
else if (ItemUtils.isStringTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.STRING;
|
repairMaterialType = MaterialType.STRING;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.LEATHER;
|
repairMaterialType = MaterialType.LEATHER;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.IRON;
|
repairMaterialType = MaterialType.IRON;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.GOLD;
|
repairMaterialType = MaterialType.GOLD;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||||
repairMaterialType = RepairMaterialType.DIAMOND;
|
repairMaterialType = MaterialType.DIAMOND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
repairMaterialType = RepairMaterialType.valueOf(repairMaterialTypeString);
|
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||||
@@ -87,7 +87,7 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
|
|
||||||
// Repair Material
|
// Repair Material
|
||||||
String repairMaterialName = config.getString("Repairables." + key + ".RepairMaterial");
|
String repairMaterialName = config.getString("Repairables." + key + ".RepairMaterial");
|
||||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultRepairMaterial() : Material.matchMaterial(repairMaterialName));
|
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
||||||
|
|
||||||
if (repairMaterial == null) {
|
if (repairMaterial == null) {
|
||||||
reason.add(key + " has an invalid repair material: " + repairMaterialName);
|
reason.add(key + " has an invalid repair material: " + repairMaterialName);
|
||||||
@@ -96,27 +96,31 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
||||||
|
|
||||||
|
if (maximumDurability <= 0) {
|
||||||
|
maximumDurability = (short) config.getInt("Repairables." + key + ".MaximumDurability");
|
||||||
|
}
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item Type
|
// Item Type
|
||||||
RepairItemType repairItemType = RepairItemType.OTHER;
|
ItemType repairItemType = ItemType.OTHER;
|
||||||
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||||
repairItemType = RepairItemType.TOOL;
|
repairItemType = ItemType.TOOL;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isArmor(repairItem)) {
|
else if (ItemUtils.isArmor(repairItem)) {
|
||||||
repairItemType = RepairItemType.ARMOR;
|
repairItemType = ItemType.ARMOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
repairItemType = RepairItemType.valueOf(repairItemTypeString);
|
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||||
@@ -132,7 +136,7 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Minimum Quantity
|
// Minimum Quantity
|
||||||
int minimumQuantity = (itemMaterial != null ? Repair.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
int minimumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
||||||
|
|
||||||
if (minimumQuantity <= 0 && itemMaterial != null) {
|
if (minimumQuantity <= 0 && itemMaterial != null) {
|
||||||
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package com.gmail.nossr50.config.skills.salvage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
||||||
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
|
public class SalvageConfig extends ConfigLoader {
|
||||||
|
private List<Salvageable> salvageables;
|
||||||
|
|
||||||
|
public SalvageConfig(String fileName) {
|
||||||
|
super(fileName);
|
||||||
|
loadKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadKeys() {
|
||||||
|
salvageables = new ArrayList<Salvageable>();
|
||||||
|
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("Salvageables");
|
||||||
|
Set<String> keys = section.getKeys(false);
|
||||||
|
|
||||||
|
for (String key : keys) {
|
||||||
|
// Validate all the things!
|
||||||
|
List<String> reason = new ArrayList<String>();
|
||||||
|
|
||||||
|
// Item Material
|
||||||
|
Material itemMaterial = Material.matchMaterial(key);
|
||||||
|
|
||||||
|
if (itemMaterial == null) {
|
||||||
|
reason.add("Invalid material: " + key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Salvage Material Type
|
||||||
|
MaterialType salvageMaterialType = MaterialType.OTHER;
|
||||||
|
String salvageMaterialTypeString = config.getString("Salvageables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
|
if (!config.contains("Salvageables." + key + ".MaterialType") && itemMaterial != null) {
|
||||||
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
|
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.WOOD;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.STONE;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isStringTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.STRING;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.LEATHER;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.IRON;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.GOLD;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.DIAMOND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString);
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex) {
|
||||||
|
reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Salvage Material
|
||||||
|
String salvageMaterialName = config.getString("Salvageables." + key + ".SalvageMaterial");
|
||||||
|
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||||
|
|
||||||
|
if (salvageMaterial == null) {
|
||||||
|
reason.add(key + " has an invalid salvage material: " + salvageMaterialName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maximum Durability
|
||||||
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Salvageables." + key + ".MaximumDurability"));
|
||||||
|
|
||||||
|
// Item Type
|
||||||
|
ItemType salvageItemType = ItemType.OTHER;
|
||||||
|
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType", "OTHER");
|
||||||
|
|
||||||
|
if (!config.contains("Salvageables." + key + ".ItemType") && itemMaterial != null) {
|
||||||
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
|
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||||
|
salvageItemType = ItemType.TOOL;
|
||||||
|
}
|
||||||
|
else if (ItemUtils.isArmor(salvageItem)) {
|
||||||
|
salvageItemType = ItemType.ARMOR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
salvageItemType = ItemType.valueOf(salvageItemTypeString);
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex) {
|
||||||
|
reason.add(key + " has an invalid ItemType of " + salvageItemTypeString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte salvageMetadata = (byte) config.getInt("Salvageables." + key + ".SalvageMaterialMetadata", -1);
|
||||||
|
int minimumLevel = config.getInt("Salvageables." + key + ".MinimumLevel");
|
||||||
|
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
|
if (minimumLevel < 0) {
|
||||||
|
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maximum Quantity
|
||||||
|
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
|
||||||
|
|
||||||
|
if (maximumQuantity <= 0 && itemMaterial != null) {
|
||||||
|
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1);
|
||||||
|
|
||||||
|
if (configMaximumQuantity > 0) {
|
||||||
|
maximumQuantity = configMaximumQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maximumQuantity <= 0) {
|
||||||
|
reason.add("Maximum quantity of " + key + " must be greater than 0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noErrorsInSalvageable(reason)) {
|
||||||
|
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, salvageMetadata, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageMaterialType, xpMultiplier);
|
||||||
|
salvageables.add(salvageable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<Salvageable> getLoadedSalvageables() {
|
||||||
|
return salvageables == null ? new ArrayList<Salvageable>() : salvageables;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean noErrorsInSalvageable(List<String> issues) {
|
||||||
|
if (!issues.isEmpty()) {
|
||||||
|
plugin.getLogger().warning("Errors have been found in: " + fileName);
|
||||||
|
plugin.getLogger().warning("The following issues were found:");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String issue : issues) {
|
||||||
|
plugin.getLogger().warning(issue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues.isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gmail.nossr50.config.skills.salvage;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
|
|
||||||
|
public class SalvageConfigManager {
|
||||||
|
private final List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
||||||
|
|
||||||
|
public SalvageConfigManager(mcMMO plugin) {
|
||||||
|
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||||
|
File dataFolder = plugin.getDataFolder();
|
||||||
|
File vanilla = new File(dataFolder, "salvage.vanilla.yml");
|
||||||
|
|
||||||
|
if (!vanilla.exists()) {
|
||||||
|
plugin.saveResource("salvage.vanilla.yml", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String fileName : dataFolder.list()) {
|
||||||
|
if (!pattern.matcher(fileName).matches()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(dataFolder, fileName);
|
||||||
|
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SalvageConfig salvageConfig = new SalvageConfig(fileName);
|
||||||
|
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Salvageable> getLoadedSalvageables() {
|
||||||
|
return salvageables;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package com.gmail.nossr50.config.spout;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
|
|
||||||
import org.getspout.spoutapi.keyboard.Keyboard;
|
|
||||||
|
|
||||||
public class SpoutConfig extends ConfigLoader {
|
|
||||||
private static SpoutConfig instance;
|
|
||||||
|
|
||||||
private SpoutConfig() {
|
|
||||||
super("spout.yml");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SpoutConfig getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new SpoutConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadKeys() {
|
|
||||||
// Setup default HUD
|
|
||||||
}
|
|
||||||
|
|
||||||
public HudType getDefaultHudType() {
|
|
||||||
try {
|
|
||||||
return HudType.valueOf(config.getString("Spout.HUD.Default", "STANDARD").toUpperCase().trim());
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException ex) {
|
|
||||||
return HudType.STANDARD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
|
|
||||||
public Keyboard getMenuKey() {
|
|
||||||
try {
|
|
||||||
return Keyboard.valueOf(config.getString("Menu.Key", "KEY_M").toUpperCase().trim());
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException ex) {
|
|
||||||
return Keyboard.KEY_M;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XP Bar */
|
|
||||||
public boolean getXPBarEnabled() { return config.getBoolean("XP.Bar.Enabled", true); }
|
|
||||||
public void setXPBarEnabled(boolean enabled) { config.set("XP.Bar.Enabled", enabled); }
|
|
||||||
|
|
||||||
public boolean getXPBarIconEnabled() { return config.getBoolean("XP.Icon.Enabled", true); }
|
|
||||||
public int getXPBarXPosition() { return config.getInt("XP.Bar.X_POS", 95); }
|
|
||||||
public int getXPBarYPosition() { return config.getInt("XP.Bar.Y_POS", 6); }
|
|
||||||
public int getXPIconXPosition() { return config.getInt("XP.Icon.X_POS", 78); }
|
|
||||||
public int getXPIconYPosition() { return config.getInt("XP.Icon.Y_POS", 2); }
|
|
||||||
|
|
||||||
/* HUD Colors */
|
|
||||||
public double getRetroHUDXPBorderRed() { return config.getDouble("HUD.Retro.Colors.Border.RED", 0.0); }
|
|
||||||
public double getRetroHUDXPBorderGreen() { return config.getDouble("HUD.Retro.Colors.Border.GREEN", 0.0); }
|
|
||||||
public double getRetroHUDXPBorderBlue() { return config.getDouble("HUD.Retro.Colors.Border.BLUE", 0.0); }
|
|
||||||
public double getRetroHUDXPBackgroundRed() { return config.getDouble("HUD.Retro.Colors.Background.RED", 0.75); }
|
|
||||||
public double getRetroHUDXPBackgroundGreen() { return config.getDouble("HUD.Retro.Colors.Background.GREEN", 0.75); }
|
|
||||||
public double getRetroHUDXPBackgroundBlue() { return config.getDouble("HUD.Retro.Colors.Background.BLUE", 0.75); }
|
|
||||||
|
|
||||||
public double getRetroHUDRed(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
|
|
||||||
public double getRetroHUDGreen(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
|
|
||||||
public double getRetroHUDBlue(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
|
|
||||||
|
|
||||||
/* Notification Tiers */
|
|
||||||
public int getNotificationTier1() { return config.getInt("Notifications.Tier1", 200); }
|
|
||||||
public int getNotificationTier2() { return config.getInt("Notifications.Tier2", 400); }
|
|
||||||
public int getNotificationTier3() { return config.getInt("Notifications.Tier3", 600); }
|
|
||||||
public int getNotificationTier4() { return config.getInt("Notifications.Tier4", 800); }
|
|
||||||
}
|
|
||||||
@@ -35,6 +35,8 @@ 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>();
|
||||||
@@ -158,26 +160,29 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
// Validate all the things!
|
// Validate all the things!
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<String>();
|
||||||
|
|
||||||
|
String[] treasureInfo = treasureName.split("[|]");
|
||||||
|
String materialName = treasureInfo[0];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Material, Amount, and Data
|
* Material, Amount, and Data
|
||||||
*/
|
*/
|
||||||
Material material;
|
Material material;
|
||||||
|
|
||||||
if (treasureName.contains("POTION")) {
|
if (materialName.contains("POTION")) {
|
||||||
material = Material.POTION;
|
material = Material.POTION;
|
||||||
}
|
}
|
||||||
else if (treasureName.contains("INK_SACK")) {
|
else if (materialName.contains("INK_SACK")) {
|
||||||
material = Material.INK_SACK;
|
material = Material.INK_SACK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
material = Material.matchMaterial(treasureName);
|
material = Material.matchMaterial(materialName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = config.getInt(type + "." + treasureName + ".Amount");
|
int amount = config.getInt(type + "." + treasureName + ".Amount");
|
||||||
int data = config.getInt(type + "." + treasureName + ".Data");
|
short data = (treasureInfo.length == 2) ? Byte.valueOf(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data");
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
reason.add("Invalid material: " + treasureName);
|
reason.add("Invalid material: " + materialName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
@@ -226,8 +231,8 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
*/
|
*/
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
|
||||||
if (treasureName.contains("POTION")) {
|
if (materialName.contains("POTION")) {
|
||||||
String potionType = treasureName.substring(7);
|
String potionType = materialName.substring(7);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
||||||
@@ -236,8 +241,8 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
reason.add("Invalid Potion_Type: " + potionType);
|
reason.add("Invalid Potion_Type: " + potionType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (treasureName.contains("INK_SACK")) {
|
else if (materialName.contains("INK_SACK")) {
|
||||||
String color = treasureName.substring(9);
|
String color = materialName.substring(9);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Dye dye = new Dye();
|
Dye dye = new Dye();
|
||||||
@@ -250,17 +255,17 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (material != null) {
|
else if (material != null) {
|
||||||
item = new ItemStack(material, amount, (short) data);
|
item = new ItemStack(material, amount, data);
|
||||||
|
|
||||||
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 + "Custom_Name"));
|
itemMeta.setLore(config.getStringList(type + "." + treasureName + ".Lore"));
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,6 +376,14 @@ 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);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public interface DatabaseManager {
|
|||||||
/**
|
/**
|
||||||
* Retrieve leaderboard info.
|
* Retrieve leaderboard info.
|
||||||
*
|
*
|
||||||
* @param skillName The skill to retrieve info on
|
* @param skill The skill to retrieve info on
|
||||||
* @param pageNumber Which page in the leaderboards to retrieve
|
* @param pageNumber Which page in the leaderboards to retrieve
|
||||||
* @param statsPerPage The number of stats per page
|
* @param statsPerPage The number of stats per page
|
||||||
* @return the requested leaderboard information
|
* @return the requested leaderboard information
|
||||||
|
|||||||
@@ -22,11 +22,14 @@ 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;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||||
@@ -259,8 +262,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
|
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
|
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
|
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
|
||||||
HudType hudType = profile.getHudType();
|
writer.append(":");
|
||||||
writer.append(hudType == null ? "STANDARD" : hudType.toString()).append(":");
|
|
||||||
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
|
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
|
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
|
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
|
||||||
@@ -606,7 +608,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
// Length checks depend on last character being ':'
|
// Length checks depend on last character being ':'
|
||||||
if (line.charAt(line.length() - 1) != ':') {
|
if (line.charAt(line.length() - 1) != ':') {
|
||||||
line = line + ":";
|
line = line.concat(":");
|
||||||
}
|
}
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
|
|
||||||
@@ -623,29 +625,33 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
String oldVersion = null;
|
String oldVersion = null;
|
||||||
|
|
||||||
|
if (character.length <= 33) {
|
||||||
|
// Introduction of HUDType
|
||||||
|
// Version 1.1.06
|
||||||
|
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
||||||
|
line = line.concat(" :");
|
||||||
|
character = line.split(":");
|
||||||
|
oldVersion = "1.1.06";
|
||||||
|
}
|
||||||
|
|
||||||
if (!character[33].isEmpty()) {
|
if (!character[33].isEmpty()) {
|
||||||
// Removal of Spout Support
|
// Removal of Spout Support
|
||||||
// Version 1.4.07-dev2
|
// Version 1.4.07-dev2
|
||||||
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
|
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
|
||||||
line = line.replace(character[33], "");
|
line = line.replace(character[33], "");
|
||||||
oldVersion = "1.4.07";
|
if (oldVersion == null) {
|
||||||
|
oldVersion = "1.4.07";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If they're valid, rewrite them to the file.
|
// If they're valid, rewrite them to the file.
|
||||||
if (character.length > 40) {
|
if (character.length == 41) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder newLine = new StringBuilder(line);
|
StringBuilder newLine = new StringBuilder(line);
|
||||||
|
|
||||||
if (character.length <= 33) {
|
|
||||||
// Introduction of HUDType
|
|
||||||
// Version 1.1.06
|
|
||||||
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
|
||||||
newLine.append(":");
|
|
||||||
oldVersion = "1.1.06";
|
|
||||||
}
|
|
||||||
if (character.length <= 35) {
|
if (character.length <= 35) {
|
||||||
// Introduction of Fishing
|
// Introduction of Fishing
|
||||||
// Version 1.2.00
|
// Version 1.2.00
|
||||||
@@ -684,7 +690,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
oldVersion = "1.4.06";
|
oldVersion = "1.4.06";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (character.length <= 40) {
|
if (character.length <= 39) {
|
||||||
// Addition of Alchemy
|
// Addition of Alchemy
|
||||||
// Version 1.4.08
|
// Version 1.4.08
|
||||||
newLine.append("0").append(":");
|
newLine.append("0").append(":");
|
||||||
@@ -694,10 +700,54 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove any blanks that shouldn't be there, and validate the other fields
|
||||||
|
String[] newCharacter = newLine.toString().split(":");
|
||||||
|
boolean corrupted = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < newCharacter.length; i++) {
|
||||||
|
if (newCharacter[i].isEmpty() && !(i == 2 || i == 3 || i == 23 || i == 33)) {
|
||||||
|
corrupted = true;
|
||||||
|
|
||||||
|
if (newCharacter.length != 41) {
|
||||||
|
newCharacter = (String[]) ArrayUtils.remove(newCharacter, i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i == 37) {
|
||||||
|
newCharacter[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
else if (i == 38) {
|
||||||
|
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newCharacter[i] = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isInt(newCharacter[i]) && i == 38) {
|
||||||
|
corrupted = true;
|
||||||
|
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isInt(newCharacter[i]) && !(i == 0 || i == 2 || i == 3 || i == 23 || i == 33 || i == 38)) {
|
||||||
|
corrupted = true;
|
||||||
|
newCharacter[i] = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (corrupted) {
|
||||||
|
mcMMO.p.debug("Updating corrupted database line for player " + newCharacter[0]);
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,6 +763,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,11 +827,10 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromLine(String[] character) throws Exception {
|
private PlayerProfile loadFromLine(String[] character) {
|
||||||
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||||
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
|
||||||
HudType hudType;
|
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
|
|
||||||
// TODO on updates, put new values in a try{} ?
|
// TODO on updates, put new values in a try{} ?
|
||||||
@@ -805,13 +862,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
// Acrobatics - Unused
|
// Acrobatics - Unused
|
||||||
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[36]));
|
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[36]));
|
||||||
|
|
||||||
try {
|
|
||||||
hudType = HudType.valueOf(character[33]);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
hudType = HudType.STANDARD; // Shouldn't happen unless database is being tampered with
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(character[38]);
|
mobHealthbarType = MobHealthbarType.valueOf(character[38]);
|
||||||
}
|
}
|
||||||
@@ -819,7 +869,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PlayerProfile(character[0], skills, skillsXp, skillsDATS, hudType, mobHealthbarType);
|
return new PlayerProfile(character[0], skills, skillsXp, skillsDATS, mobHealthbarType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {
|
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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;
|
||||||
@@ -17,12 +18,11 @@ 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;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.runnables.database.SQLDatabaseKeepaliveTask;
|
import com.gmail.nossr50.runnables.database.SQLDatabaseKeepaliveTask;
|
||||||
import com.gmail.nossr50.runnables.database.SQLReconnectTask;
|
import com.gmail.nossr50.runnables.database.SQLReconnectTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@@ -131,15 +131,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
||||||
HudType hudType = profile.getHudType();
|
|
||||||
|
|
||||||
success &= saveLogin(userId, ((int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
|
success &= saveLogin(userId, ((int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
|
||||||
saveHuds(userId, (hudType == null ? "STANDARD" : hudType.toString()), (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),
|
||||||
@@ -151,10 +150,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),
|
||||||
@@ -171,10 +170,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),
|
||||||
@@ -244,8 +243,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);
|
||||||
@@ -256,8 +255,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();
|
||||||
|
|
||||||
@@ -363,16 +362,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();
|
||||||
@@ -439,16 +438,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;
|
||||||
@@ -485,20 +484,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;
|
||||||
@@ -620,7 +619,6 @@ 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!");
|
||||||
@@ -712,151 +710,174 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
+ "PRIMARY KEY (`user_id`)) "
|
+ "PRIMARY KEY (`user_id`)) "
|
||||||
+ "DEFAULT CHARSET=latin1;");
|
+ "DEFAULT CHARSET=latin1;");
|
||||||
|
|
||||||
for (DatabaseUpdateType updateType : DatabaseUpdateType.values()) {
|
for (UpgradeType updateType : UpgradeType.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 missing values.
|
* Check database structure for necessary upgrades.
|
||||||
*
|
*
|
||||||
* @param update Type of data to check updates for
|
* @param upgrade Upgrade to attempt to apply
|
||||||
*/
|
*/
|
||||||
private void checkDatabaseStructure(DatabaseUpdateType update) {
|
private void checkDatabaseStructure(UpgradeType upgrade) {
|
||||||
String sql = "";
|
if (!checkConnected()) {
|
||||||
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultSet resultSet;
|
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
|
||||||
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
|
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)");
|
||||||
PreparedStatement statement = null;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Statement statement = null;
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!checkConnected()) {
|
statement = connection.createStatement();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
statement = connection.prepareStatement(sql);
|
switch (upgrade) {
|
||||||
resultSet = statement.executeQuery();
|
case ADD_FISHING:
|
||||||
|
try {
|
||||||
while (resultSet.next()) {
|
statement.executeQuery("SELECT `fishing` FROM `" + tablePrefix + "skills` LIMIT 1");
|
||||||
ArrayList<String> column = new ArrayList<String>();
|
}
|
||||||
|
catch (SQLException ex) {
|
||||||
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
|
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
|
||||||
column.add(resultSet.getString(i));
|
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'");
|
||||||
|
}
|
||||||
rows.put(resultSet.getRow(), column);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
break;
|
||||||
|
|
||||||
case FISHING:
|
case ADD_BLAST_MINING_COOLDOWN:
|
||||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
|
try {
|
||||||
write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
statement.executeQuery("SELECT `blast_mining` FROM `" + tablePrefix + "cooldowns` LIMIT 1");
|
||||||
write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
}
|
||||||
|
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;
|
break;
|
||||||
|
|
||||||
case MOB_HEALTHBARS:
|
case ADD_SQL_INDEXES:
|
||||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
|
resultSet = statement.executeQuery("SHOW INDEX FROM `" + tablePrefix + "skills` WHERE `Key_name` LIKE 'idx\\_%'");
|
||||||
write("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "' ;");
|
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;
|
break;
|
||||||
|
|
||||||
case ALCHEMY:
|
case ADD_MOB_HEALTHBARS:
|
||||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Alchemy...");
|
try {
|
||||||
write("ALTER TABLE `"+tablePrefix + "skills` ADD `alchemy` int(10) NOT NULL DEFAULT '0' ;");
|
statement.executeQuery("SELECT `mobhealthbar` FROM `" + tablePrefix + "huds` LIMIT 1");
|
||||||
write("ALTER TABLE `"+tablePrefix + "experience` ADD `alchemy` int(10) NOT NULL DEFAULT '0' ;");
|
}
|
||||||
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mcMMO.getUpgradeManager().setUpgradeCompleted(upgrade);
|
||||||
|
}
|
||||||
|
catch (SQLException ex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
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 the error, we're leaving
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -866,6 +887,7 @@ 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) {
|
||||||
@@ -901,6 +923,7 @@ 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) {
|
||||||
@@ -935,6 +958,7 @@ 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) {
|
||||||
@@ -980,6 +1004,7 @@ 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) {
|
||||||
@@ -1123,6 +1148,7 @@ 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) {
|
||||||
@@ -1166,7 +1192,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean saveHuds(int userId, String hudType, String mobHealthBar) {
|
private boolean saveHuds(int userId, String mobHealthBar) {
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1193,10 +1219,9 @@ 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
|
||||||
HudType hudType;
|
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
|
|
||||||
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added)
|
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added)
|
||||||
@@ -1245,13 +1270,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
|
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
|
||||||
skillsDATS.put(AbilityType.BLAST_MINING, result.getInt(OFFSET_DATS + 12));
|
skillsDATS.put(AbilityType.BLAST_MINING, result.getInt(OFFSET_DATS + 12));
|
||||||
|
|
||||||
try {
|
|
||||||
hudType = HudType.valueOf(result.getString(OFFSET_OTHER + 1));
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
hudType = HudType.STANDARD; // Shouldn't happen unless database is being tampered with
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 2));
|
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 2));
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1277,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PlayerProfile(playerName, skills, skillsXp, skillsDATS, hudType, mobHealthbarType);
|
return new PlayerProfile(playerName, skills, skillsXp, skillsDATS, mobHealthbarType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printErrors(SQLException ex) {
|
private void printErrors(SQLException ex) {
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.database;
|
|
||||||
|
|
||||||
public enum DatabaseUpdateType {
|
|
||||||
FISHING,
|
|
||||||
BLAST_MINING,
|
|
||||||
INDEX,
|
|
||||||
MOB_HEALTHBARS,
|
|
||||||
PARTY_NAMES,
|
|
||||||
KILL_ORPHANS,
|
|
||||||
DROPPED_SPOUT,
|
|
||||||
ALCHEMY
|
|
||||||
;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@@ -83,6 +84,19 @@ public class Party {
|
|||||||
return onlineMembers;
|
return onlineMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
||||||
|
Player player = sender instanceof Player ? (Player) sender : null;
|
||||||
|
List<String> onlinePlayerNames = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (Player onlinePlayer : getOnlineMembers()) {
|
||||||
|
if (player != null && player.canSee(onlinePlayer)) {
|
||||||
|
onlinePlayerNames.add(onlinePlayer.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return onlinePlayerNames;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -171,7 +185,7 @@ public class Party {
|
|||||||
|
|
||||||
public String getXpToLevelPercentage() {
|
public String getXpToLevelPercentage() {
|
||||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
return percent.format( this.getXp() / getXpToLevel());
|
return percent.format(this.getXp() / getXpToLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,9 +351,4 @@ public class Party {
|
|||||||
|
|
||||||
return this.getName().equals(other.getName());
|
return this.getName().equals(other.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return super.hashCode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
|||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.party.ShareHandler;
|
import com.gmail.nossr50.party.ShareHandler;
|
||||||
@@ -41,6 +41,7 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
|
|||||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||||
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
@@ -53,7 +54,6 @@ import com.gmail.nossr50.util.StringUtils;
|
|||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import com.gmail.nossr50.util.spout.SpoutUtils;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
@@ -81,7 +81,6 @@ public class McMMOPlayer {
|
|||||||
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||||
|
|
||||||
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||||
private final Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
|
||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
@@ -90,7 +89,6 @@ public class McMMOPlayer {
|
|||||||
private int chimeraWingLastUse;
|
private int chimeraWingLastUse;
|
||||||
private Location teleportCommence;
|
private Location teleportCommence;
|
||||||
|
|
||||||
private boolean isSpoutPlayer;
|
|
||||||
private boolean isUsingUnarmed;
|
private boolean isUsingUnarmed;
|
||||||
private final FixedMetadataValue playerMetadata;
|
private final FixedMetadataValue playerMetadata;
|
||||||
|
|
||||||
@@ -125,7 +123,6 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
for (ToolType toolType : ToolType.values()) {
|
for (ToolType toolType : ToolType.values()) {
|
||||||
toolMode.put(toolType, false);
|
toolMode.put(toolType, false);
|
||||||
toolATS.put(toolType, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
@@ -228,6 +225,10 @@ public class McMMOPlayer {
|
|||||||
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SalvageManager getSalvageManager() {
|
||||||
|
return (SalvageManager) skillManagers.get(SkillType.SALVAGE);
|
||||||
|
}
|
||||||
|
|
||||||
public SmeltingManager getSmeltingManager() {
|
public SmeltingManager getSmeltingManager() {
|
||||||
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
||||||
}
|
}
|
||||||
@@ -343,28 +344,6 @@ public class McMMOPlayer {
|
|||||||
toolMode.put(tool, isPrepared);
|
toolMode.put(tool, isPrepared);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current prep ATS of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to get the ATS for
|
|
||||||
* @return the ATS for the tool
|
|
||||||
*/
|
|
||||||
public long getToolPreparationATS(ToolType tool) {
|
|
||||||
return toolATS.get(tool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current prep ATS of a tool.
|
|
||||||
*
|
|
||||||
* @param tool Tool to set the ATS for
|
|
||||||
* @param ATS the ATS of the tool
|
|
||||||
*/
|
|
||||||
public void setToolPreparationATS(ToolType tool, long ATS) {
|
|
||||||
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
|
||||||
|
|
||||||
toolATS.put(tool, startTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Recently Hurt
|
* Recently Hurt
|
||||||
*/
|
*/
|
||||||
@@ -405,17 +384,6 @@ public class McMMOPlayer {
|
|||||||
teleportCommence = player.getLocation();
|
teleportCommence = player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Spout support
|
|
||||||
*/
|
|
||||||
public boolean isSpoutPlayer() {
|
|
||||||
return isSpoutPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsSpoutPlayer(boolean isSpoutPlayer) {
|
|
||||||
this.isSpoutPlayer = isSpoutPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exploit Prevention
|
* Exploit Prevention
|
||||||
*/
|
*/
|
||||||
@@ -491,7 +459,7 @@ public class McMMOPlayer {
|
|||||||
* @param skill Skill being used
|
* @param skill Skill being used
|
||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginXpGain(SkillType skill, float xp) {
|
public void beginXpGain(SkillType skill, float xp, XPGainReason xpGainReason) {
|
||||||
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
|
Validate.isTrue(xp >= 0.0, "XP gained should be greater than or equal to zero.");
|
||||||
|
|
||||||
if (xp <= 0.0) {
|
if (xp <= 0.0) {
|
||||||
@@ -504,7 +472,7 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (SkillType parentSkill : parentSkills) {
|
||||||
if (parentSkill.getPermissions(player)) {
|
if (parentSkill.getPermissions(player)) {
|
||||||
beginXpGain(parentSkill, splitXp);
|
beginXpGain(parentSkill, splitXp, xpGainReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,11 +480,11 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return if the experience has been shared
|
// Return if the experience has been shared
|
||||||
if (party != null && ShareHandler.handleXpShare(xp, this, skill)) {
|
if (party != null && ShareHandler.handleXpShare(xp, this, skill, ShareHandler.getSharedXpGainReason(xpGainReason))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
beginUnsharedXpGain(skill, xp);
|
beginUnsharedXpGain(skill, xp, xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -525,8 +493,8 @@ public class McMMOPlayer {
|
|||||||
* @param skill Skill being used
|
* @param skill Skill being used
|
||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginUnsharedXpGain(SkillType skill, float xp) {
|
public void beginUnsharedXpGain(SkillType skill, float xp, XPGainReason xpGainReason) {
|
||||||
applyXpGain(skill, modifyXpGain(skill, xp));
|
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason);
|
||||||
|
|
||||||
if (party == null) {
|
if (party == null) {
|
||||||
return;
|
return;
|
||||||
@@ -543,7 +511,7 @@ public class McMMOPlayer {
|
|||||||
* @param skillType Skill being used
|
* @param skillType Skill being used
|
||||||
* @param xp Experience amount to add
|
* @param xp Experience amount to add
|
||||||
*/
|
*/
|
||||||
public void applyXpGain(SkillType skillType, float xp) {
|
public void applyXpGain(SkillType skillType, float xp, XPGainReason xpGainReason) {
|
||||||
if (!skillType.getPermissions(player)) {
|
if (!skillType.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -552,24 +520,18 @@ public class McMMOPlayer {
|
|||||||
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
Set<SkillType> parentSkills = FamilyTree.getParents(skillType);
|
||||||
|
|
||||||
for (SkillType parentSkill : parentSkills) {
|
for (SkillType parentSkill : parentSkills) {
|
||||||
applyXpGain(parentSkill, xp / parentSkills.size());
|
applyXpGain(parentSkill, xp / parentSkills.size(), xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventUtils.handleXpGainEvent(player, skillType, xp)) {
|
if (!EventUtils.handleXpGainEvent(player, skillType, xp, xpGainReason)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOHud spoutHud = profile.getSpoutHud();
|
|
||||||
|
|
||||||
if (spoutHud != null) {
|
|
||||||
spoutHud.setLastGained(skillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
isUsingUnarmed = (skillType == SkillType.UNARMED);
|
isUsingUnarmed = (skillType == SkillType.UNARMED);
|
||||||
checkXp(skillType);
|
checkXp(skillType, xpGainReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -577,7 +539,7 @@ public class McMMOPlayer {
|
|||||||
*
|
*
|
||||||
* @param skillType The skill to check
|
* @param skillType The skill to check
|
||||||
*/
|
*/
|
||||||
private void checkXp(SkillType skillType) {
|
private void checkXp(SkillType skillType, XPGainReason xpGainReason) {
|
||||||
if (getSkillXpLevelRaw(skillType) < getXpToLevel(skillType)) {
|
if (getSkillXpLevelRaw(skillType) < getXpToLevel(skillType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -595,24 +557,15 @@ public class McMMOPlayer {
|
|||||||
levelsGained++;
|
levelsGained++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EventUtils.handleLevelChangeEvent(player, skillType, levelsGained, xpRemoved, true)) {
|
if (!EventUtils.handleLevelChangeEvent(player, skillType, levelsGained, xpRemoved, true, xpGainReason)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSpoutPlayer) {
|
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
||||||
SpoutUtils.processLevelup(this, skillType, levelsGained);
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSpoutPlayer) {
|
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
|
||||||
SpoutUtils.processXpGain(player, profile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -623,10 +576,6 @@ public class McMMOPlayer {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerProfile getProfile() {
|
public PlayerProfile getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
@@ -906,7 +855,6 @@ public class McMMOPlayer {
|
|||||||
player.sendMessage(tool.getRaiseTool());
|
player.sendMessage(tool.getRaiseTool());
|
||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationATS(tool, System.currentTimeMillis());
|
|
||||||
setToolPreparationMode(tool, true);
|
setToolPreparationMode(tool, true);
|
||||||
new ToolLowerTask(this, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
|
new ToolLowerTask(this, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
@@ -975,14 +923,6 @@ public class McMMOPlayer {
|
|||||||
profile.resetCooldowns();
|
profile.resetCooldowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
public McMMOHud getSpoutHud() {
|
|
||||||
return profile.getSpoutHud();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpoutHud(McMMOHud spoutHud) {
|
|
||||||
profile.setSpoutHud(spoutHud);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FixedMetadataValue getPlayerMetadata() {
|
public FixedMetadataValue getPlayerMetadata() {
|
||||||
return playerMetadata;
|
return playerMetadata;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,11 @@ import java.util.Set;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@@ -22,12 +20,10 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
public class PlayerProfile {
|
public class PlayerProfile {
|
||||||
private final String playerName;
|
private final String playerName;
|
||||||
private boolean loaded;
|
private boolean loaded;
|
||||||
private boolean changed;
|
private volatile boolean changed;
|
||||||
|
|
||||||
/* HUDs */
|
/* HUDs */
|
||||||
private HudType hudType;
|
|
||||||
private MobHealthbarType mobHealthbarType;
|
private MobHealthbarType mobHealthbarType;
|
||||||
private McMMOHud spoutHud;
|
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
|
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
|
||||||
@@ -37,7 +33,6 @@ public class PlayerProfile {
|
|||||||
public PlayerProfile(String playerName) {
|
public PlayerProfile(String playerName) {
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
|
|
||||||
hudType = mcMMO.isSpoutEnabled() ? SpoutConfig.getInstance().getDefaultHudType() : HudType.DISABLED;
|
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
|
|
||||||
for (AbilityType abilityType : AbilityType.values()) {
|
for (AbilityType abilityType : AbilityType.values()) {
|
||||||
@@ -55,10 +50,8 @@ public class PlayerProfile {
|
|||||||
this.loaded = isLoaded;
|
this.loaded = isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile(String playerName, Map<SkillType, Integer> levelData, Map<SkillType, Float> xpData, Map<AbilityType, Integer> cooldownData, HudType hudType, MobHealthbarType mobHealthbarType) {
|
public PlayerProfile(String playerName, Map<SkillType, Integer> levelData, Map<SkillType, Float> xpData, Map<AbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType) {
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
|
|
||||||
this.hudType = hudType;
|
|
||||||
this.mobHealthbarType = mobHealthbarType;
|
this.mobHealthbarType = mobHealthbarType;
|
||||||
|
|
||||||
skills.putAll(levelData);
|
skills.putAll(levelData);
|
||||||
@@ -68,12 +61,18 @@ public class PlayerProfile {
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void scheduleAsyncSave() {
|
||||||
|
new PlayerProfileSaveTask(this).runTaskAsynchronously(mcMMO.p);
|
||||||
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
if (!changed || !loaded) {
|
if (!changed || !loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = !mcMMO.getDatabaseManager().saveUser(new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), hudType, mobHealthbarType));
|
// TODO should this part be synchronized?
|
||||||
|
PlayerProfile profileCopy = new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), mobHealthbarType);
|
||||||
|
changed = !mcMMO.getDatabaseManager().saveUser(profileCopy);
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
|
||||||
@@ -88,26 +87,6 @@ public class PlayerProfile {
|
|||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* HUD Stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
public HudType getHudType() {
|
|
||||||
return hudType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public McMMOHud getSpoutHud() {
|
|
||||||
return spoutHud;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpoutHud(McMMOHud spoutHud) {
|
|
||||||
this.spoutHud = spoutHud;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHudType(HudType hudType) {
|
|
||||||
this.hudType = hudType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mob Healthbars
|
* Mob Healthbars
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
public enum ItemType {
|
||||||
|
ARMOR,
|
||||||
|
TOOL,
|
||||||
|
OTHER;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
public enum MaterialType {
|
||||||
|
STRING,
|
||||||
|
LEATHER,
|
||||||
|
WOOD,
|
||||||
|
STONE,
|
||||||
|
IRON,
|
||||||
|
GOLD,
|
||||||
|
DIAMOND,
|
||||||
|
OTHER;
|
||||||
|
|
||||||
|
public Material getDefaultMaterial() {
|
||||||
|
switch (this) {
|
||||||
|
case STRING:
|
||||||
|
return Material.STRING;
|
||||||
|
|
||||||
|
case LEATHER:
|
||||||
|
return Material.LEATHER;
|
||||||
|
|
||||||
|
case WOOD:
|
||||||
|
return Material.WOOD;
|
||||||
|
|
||||||
|
case STONE:
|
||||||
|
return Material.COBBLESTONE;
|
||||||
|
|
||||||
|
case IRON:
|
||||||
|
return Material.IRON_INGOT;
|
||||||
|
|
||||||
|
case GOLD:
|
||||||
|
return Material.GOLD_INGOT;
|
||||||
|
|
||||||
|
case DIAMOND:
|
||||||
|
return Material.DIAMOND;
|
||||||
|
|
||||||
|
case OTHER:
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,9 +46,12 @@ public enum SecondaryAbility {
|
|||||||
/* Repair */
|
/* Repair */
|
||||||
ARCANE_FORGING,
|
ARCANE_FORGING,
|
||||||
REPAIR_MASTERY,
|
REPAIR_MASTERY,
|
||||||
SALVAGE,
|
|
||||||
SUPER_REPAIR,
|
SUPER_REPAIR,
|
||||||
|
|
||||||
|
/* Salvage */
|
||||||
|
ADVANCED_SALVAGE,
|
||||||
|
ARCANE_SALVAGE,
|
||||||
|
|
||||||
/* Smelting */
|
/* Smelting */
|
||||||
FLUX_MINING,
|
FLUX_MINING,
|
||||||
FUEL_EFFICIENCY,
|
FUEL_EFFICIENCY,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
|
|||||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||||
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
@@ -43,7 +44,8 @@ public enum SkillType {
|
|||||||
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
|
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
|
||||||
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
|
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
|
||||||
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
||||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SALVAGE, SecondaryAbility.SUPER_REPAIR)),
|
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR)),
|
||||||
|
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE)),
|
||||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
||||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
||||||
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
|
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
|
||||||
@@ -63,7 +65,7 @@ public enum SkillType {
|
|||||||
|
|
||||||
public static final List<SkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
public static final List<SkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
||||||
public static final List<SkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
public static final List<SkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
||||||
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SMELTING);
|
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
List<SkillType> childSkills = new ArrayList<SkillType>();
|
List<SkillType> childSkills = new ArrayList<SkillType>();
|
||||||
@@ -182,6 +184,7 @@ public enum SkillType {
|
|||||||
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
||||||
public boolean isChildSkill() {
|
public boolean isChildSkill() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
|
case SALVAGE:
|
||||||
case SMELTING:
|
case SMELTING:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
public enum XPGainReason {
|
||||||
|
PVP,
|
||||||
|
PVE,
|
||||||
|
VAMPIRISM,
|
||||||
|
SHARED_PVP,
|
||||||
|
SHARED_PVE,
|
||||||
|
COMMAND,
|
||||||
|
UNKNOWN;
|
||||||
|
|
||||||
|
public static XPGainReason getXPGainReason(String reason) {
|
||||||
|
for (XPGainReason type : values()) {
|
||||||
|
if (type.name().equalsIgnoreCase(reason)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ 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 {
|
||||||
@@ -50,6 +51,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.spout.buttons;
|
|
||||||
|
|
||||||
import org.getspout.spoutapi.gui.GenericButton;
|
|
||||||
|
|
||||||
public class McMMOButton extends GenericButton {
|
|
||||||
private Slot slot;
|
|
||||||
|
|
||||||
public McMMOButton(String text, String toolTip) {
|
|
||||||
this.setText(text);
|
|
||||||
this.setTooltip(toolTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connect(Slot slot) {
|
|
||||||
this.slot = slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void activate() {
|
|
||||||
slot.activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface Slot {
|
|
||||||
public void activate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.spout.huds;
|
|
||||||
|
|
||||||
public enum HudType {
|
|
||||||
DISABLED,
|
|
||||||
STANDARD,
|
|
||||||
SMALL,
|
|
||||||
RETRO;
|
|
||||||
|
|
||||||
public HudType getNext() {
|
|
||||||
return values()[(ordinal() + 1) % values().length];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.spout.huds;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.popups.McMMOMenu;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.popups.McMMOXpBar;
|
|
||||||
|
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
|
||||||
|
|
||||||
public class McMMOHud {
|
|
||||||
private Player player;
|
|
||||||
private PlayerProfile profile;
|
|
||||||
|
|
||||||
private SkillType lastGained;
|
|
||||||
private SkillType skillLock;
|
|
||||||
private boolean xpBarLocked;
|
|
||||||
|
|
||||||
private McMMOMenu menu;
|
|
||||||
private McMMOXpBar xpBar;
|
|
||||||
|
|
||||||
public McMMOHud(McMMOPlayer mcMMOPlayer) {
|
|
||||||
this.player = mcMMOPlayer.getPlayer();
|
|
||||||
this.profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
initializeXpBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the HUD.
|
|
||||||
*/
|
|
||||||
public void initializeXpBar() {
|
|
||||||
if (SpoutConfig.getInstance().getXPBarEnabled()) {
|
|
||||||
if (xpBar != null) {
|
|
||||||
xpBar.removeWidgets();
|
|
||||||
}
|
|
||||||
|
|
||||||
xpBar = new McMMOXpBar(SpoutManager.getPlayer(player), profile.getHudType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the XP bar.
|
|
||||||
*/
|
|
||||||
public void updateXpBar() {
|
|
||||||
SkillType skillType = xpBarLocked ? skillLock : lastGained;
|
|
||||||
|
|
||||||
if (skillType == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
xpBar.update(skillType, profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMenuOpened() {
|
|
||||||
return (menu != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openMenu() {
|
|
||||||
menu = new McMMOMenu(SpoutManager.getPlayer(player), profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMenuClose() {
|
|
||||||
menu = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeWidgets() {
|
|
||||||
if (menu != null) {
|
|
||||||
menu.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
SpoutManager.getPlayer(player).getMainScreen().removeWidgets(mcMMO.p);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkillType getLastGained() {
|
|
||||||
return lastGained;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastGained(SkillType type) {
|
|
||||||
this.lastGained = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getXpBarLocked() {
|
|
||||||
return xpBarLocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXpBarLocked(boolean locked) {
|
|
||||||
this.xpBarLocked = locked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleXpBarLocked() {
|
|
||||||
xpBarLocked = !xpBarLocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SkillType getSkillLock() {
|
|
||||||
return skillLock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkillLock(SkillType type) {
|
|
||||||
this.skillLock = type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.spout.popups;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.buttons.McMMOButton;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.buttons.McMMOButton.Slot;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
|
|
||||||
import org.getspout.spoutapi.gui.GenericLabel;
|
|
||||||
import org.getspout.spoutapi.gui.GenericPopup;
|
|
||||||
import org.getspout.spoutapi.gui.InGameHUD;
|
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
|
||||||
|
|
||||||
public class McMMOMenu extends GenericPopup {
|
|
||||||
private McMMOButton hudButton;
|
|
||||||
private McMMOButton escapeButton;
|
|
||||||
|
|
||||||
private GenericLabel titleLabel = new GenericLabel();
|
|
||||||
private GenericLabel escapeLabel = new GenericLabel();
|
|
||||||
|
|
||||||
private static int centerX = 427 / 2;
|
|
||||||
private static int centerY = 240 / 2;
|
|
||||||
|
|
||||||
public McMMOMenu(final SpoutPlayer spoutPlayer, final PlayerProfile playerProfile) {
|
|
||||||
// 240, 427 are the bottom right
|
|
||||||
titleLabel.setText(LocaleLoader.getString("Spout.Menu.Title"));
|
|
||||||
titleLabel.setWidth(100);
|
|
||||||
titleLabel.setHeight(100);
|
|
||||||
titleLabel.setX(centerX - 35);
|
|
||||||
titleLabel.setY((centerY / 2) - 20);
|
|
||||||
|
|
||||||
escapeLabel.setText(LocaleLoader.getString("Spout.Menu.Exit"));
|
|
||||||
escapeLabel.setWidth(100);
|
|
||||||
escapeLabel.setHeight(100);
|
|
||||||
escapeLabel.setX(titleLabel.getX() - 15);
|
|
||||||
escapeLabel.setY(titleLabel.getY() + 10);
|
|
||||||
|
|
||||||
hudButton = new McMMOButton(LocaleLoader.getString("Spout.Menu.HudButton.1", playerProfile.getHudType().toString()), LocaleLoader.getString("Spout.Menu.HudButton.2"));
|
|
||||||
hudButton.setWidth(120);
|
|
||||||
hudButton.setHeight(20);
|
|
||||||
hudButton.setX(centerX - (hudButton.getWidth() / 2));
|
|
||||||
hudButton.setY(centerY / 2);
|
|
||||||
hudButton.connect(new Slot() {
|
|
||||||
@Override
|
|
||||||
public void activate() {
|
|
||||||
HudType nextHudType = playerProfile.getHudType().getNext();
|
|
||||||
McMMOHud spoutHud = playerProfile.getSpoutHud();
|
|
||||||
|
|
||||||
playerProfile.setHudType(nextHudType);
|
|
||||||
spoutHud.initializeXpBar();
|
|
||||||
spoutHud.updateXpBar();
|
|
||||||
|
|
||||||
hudButton.setText("HUD Type: " + nextHudType.toString());
|
|
||||||
hudButton.setDirty(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
escapeButton = new McMMOButton(LocaleLoader.getString("Spout.Menu.ExitButton"), null);
|
|
||||||
escapeButton.setWidth(60);
|
|
||||||
escapeButton.setHeight(20);
|
|
||||||
escapeButton.setX(centerX - (escapeButton.getWidth() / 2));
|
|
||||||
escapeButton.setY((centerY / 2) + (escapeButton.getHeight() * 2) + 5);
|
|
||||||
escapeButton.connect(new Slot() {
|
|
||||||
@Override
|
|
||||||
public void activate() {
|
|
||||||
spoutPlayer.getMainScreen().closePopup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
attachWidget(mcMMO.p, hudButton);
|
|
||||||
attachWidget(mcMMO.p, titleLabel);
|
|
||||||
attachWidget(mcMMO.p, escapeLabel);
|
|
||||||
attachWidget(mcMMO.p, escapeButton);
|
|
||||||
|
|
||||||
InGameHUD inGameHud = spoutPlayer.getMainScreen();
|
|
||||||
|
|
||||||
inGameHud.attachPopupScreen(this);
|
|
||||||
inGameHud.setDirty(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.spout.popups;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
import org.getspout.spoutapi.gui.Color;
|
|
||||||
import org.getspout.spoutapi.gui.GenericGradient;
|
|
||||||
import org.getspout.spoutapi.gui.GenericTexture;
|
|
||||||
import org.getspout.spoutapi.gui.InGameHUD;
|
|
||||||
import org.getspout.spoutapi.gui.RenderPriority;
|
|
||||||
import org.getspout.spoutapi.gui.Widget;
|
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
|
||||||
|
|
||||||
public class McMMOXpBar {
|
|
||||||
private SpoutPlayer spoutPlayer;
|
|
||||||
private Widget xpBar;
|
|
||||||
|
|
||||||
private GenericGradient xpFill;
|
|
||||||
private GenericGradient xpBackground;
|
|
||||||
private GenericGradient xpIconBackground;
|
|
||||||
private GenericGradient xpIconBorder;
|
|
||||||
private GenericTexture xpIcon;
|
|
||||||
|
|
||||||
public McMMOXpBar(SpoutPlayer spoutPlayer, HudType hudType) {
|
|
||||||
this.spoutPlayer = spoutPlayer;
|
|
||||||
|
|
||||||
switch (hudType) {
|
|
||||||
case RETRO:
|
|
||||||
initializeXpBarRetro();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STANDARD:
|
|
||||||
initializeXpBarStandard();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SMALL:
|
|
||||||
initializeXpBarSmall();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DISABLED:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
spoutPlayer.getMainScreen().setDirty(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeWidgets() {
|
|
||||||
InGameHUD inGameHud = spoutPlayer.getMainScreen();
|
|
||||||
|
|
||||||
if (xpBar != null) {
|
|
||||||
inGameHud.removeWidget(xpBar);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xpFill != null) {
|
|
||||||
inGameHud.removeWidget(xpFill);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xpBackground != null) {
|
|
||||||
inGameHud.removeWidget(xpBackground);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xpIconBackground != null) {
|
|
||||||
inGameHud.removeWidget(xpIconBackground);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xpIconBorder != null) {
|
|
||||||
inGameHud.removeWidget(xpIconBorder);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xpIcon != null) {
|
|
||||||
inGameHud.removeWidget(xpIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Retro XP bar.
|
|
||||||
*/
|
|
||||||
private void initializeXpBarRetro() {
|
|
||||||
Color border = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBorderRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderBlue(), 1f);
|
|
||||||
Color green = new Color(0f, 1f, 0f, 1f);
|
|
||||||
Color background = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBackgroundRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundBlue(), 1f);
|
|
||||||
|
|
||||||
xpBar = new GenericGradient();
|
|
||||||
xpFill = new GenericGradient();
|
|
||||||
xpBackground = new GenericGradient();
|
|
||||||
|
|
||||||
xpBar.setWidth(128);
|
|
||||||
xpBar.setHeight(4);
|
|
||||||
xpBar.setX(149);
|
|
||||||
xpBar.setY(10);
|
|
||||||
((GenericGradient) xpBar).setBottomColor(border);
|
|
||||||
((GenericGradient) xpBar).setTopColor(border);
|
|
||||||
xpBar.setPriority(RenderPriority.Highest);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
|
|
||||||
|
|
||||||
xpFill.setWidth(0);
|
|
||||||
xpFill.setHeight(2);
|
|
||||||
xpFill.setX(150);
|
|
||||||
xpFill.setY(11);
|
|
||||||
xpFill.setBottomColor(green);
|
|
||||||
xpFill.setTopColor(green);
|
|
||||||
xpFill.setPriority(RenderPriority.Lowest);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpFill);
|
|
||||||
|
|
||||||
xpBackground.setWidth(126);
|
|
||||||
xpBackground.setHeight(2);
|
|
||||||
xpBackground.setX(150);
|
|
||||||
xpBackground.setY(11);
|
|
||||||
xpBackground.setBottomColor(background);
|
|
||||||
xpBackground.setTopColor(background);
|
|
||||||
xpBackground.setPriority(RenderPriority.Low);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBackground);
|
|
||||||
|
|
||||||
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
|
|
||||||
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
|
|
||||||
|
|
||||||
xpIconBackground = new GenericGradient();
|
|
||||||
xpIconBorder = new GenericGradient();
|
|
||||||
xpIcon = new GenericTexture();
|
|
||||||
|
|
||||||
xpIconBackground.setBottomColor(darkbg);
|
|
||||||
xpIconBackground.setTopColor(darkbg);
|
|
||||||
xpIconBackground.setWidth(4);
|
|
||||||
xpIconBackground.setHeight(4);
|
|
||||||
xpIconBackground.setPriority(RenderPriority.High);
|
|
||||||
xpIconBackground.setX(142);
|
|
||||||
xpIconBackground.setY(10);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIconBackground);
|
|
||||||
|
|
||||||
xpIconBorder.setBottomColor(border);
|
|
||||||
xpIconBorder.setTopColor(border);
|
|
||||||
xpIconBorder.setWidth(6);
|
|
||||||
xpIconBorder.setHeight(6);
|
|
||||||
xpIconBorder.setPriority(RenderPriority.Highest);
|
|
||||||
xpIconBorder.setX(141);
|
|
||||||
xpIconBorder.setY(9);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIconBorder);
|
|
||||||
|
|
||||||
xpIcon.setWidth(6);
|
|
||||||
xpIcon.setHeight(6);
|
|
||||||
xpIcon.setX(141);
|
|
||||||
xpIcon.setY(9);
|
|
||||||
xpIcon.setPriority(RenderPriority.Normal);
|
|
||||||
xpIcon.setUrl("Icon_r.png");
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Standard XP bar.
|
|
||||||
*/
|
|
||||||
private void initializeXpBarStandard() {
|
|
||||||
xpBar = new GenericTexture();
|
|
||||||
|
|
||||||
((GenericTexture) xpBar).setUrl("xpbar_inc000.png");
|
|
||||||
xpBar.setX(SpoutConfig.getInstance().getXPBarXPosition());
|
|
||||||
xpBar.setY(SpoutConfig.getInstance().getXPBarYPosition());
|
|
||||||
xpBar.setHeight(8);
|
|
||||||
xpBar.setWidth(256);
|
|
||||||
xpBar.setPriority(RenderPriority.Lowest);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
|
|
||||||
|
|
||||||
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
|
|
||||||
xpIcon = new GenericTexture();
|
|
||||||
|
|
||||||
xpIcon.setUrl("Icon.png");
|
|
||||||
xpIcon.setHeight(16);
|
|
||||||
xpIcon.setWidth(32);
|
|
||||||
xpIcon.setX(SpoutConfig.getInstance().getXPIconXPosition());
|
|
||||||
xpIcon.setY(SpoutConfig.getInstance().getXPIconYPosition());
|
|
||||||
xpIcon.setPriority(RenderPriority.High);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Small XP bar.
|
|
||||||
*/
|
|
||||||
private void initializeXpBarSmall() {
|
|
||||||
xpBar = new GenericTexture();
|
|
||||||
|
|
||||||
((GenericTexture) xpBar).setUrl("xpbar_inc000.png");
|
|
||||||
xpBar.setX(427 / 2 - 64);
|
|
||||||
xpBar.setY(SpoutConfig.getInstance().getXPBarYPosition());
|
|
||||||
xpBar.setHeight(4);
|
|
||||||
xpBar.setWidth(128);
|
|
||||||
xpBar.setPriority(RenderPriority.Lowest);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
|
|
||||||
|
|
||||||
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
|
|
||||||
xpIcon = new GenericTexture();
|
|
||||||
|
|
||||||
xpIcon.setUrl("Icon.png");
|
|
||||||
xpIcon.setHeight(8);
|
|
||||||
xpIcon.setWidth(16);
|
|
||||||
xpIcon.setX(427 / 2 - (8 + 64));
|
|
||||||
xpIcon.setY(SpoutConfig.getInstance().getXPIconYPosition() + 2);
|
|
||||||
xpIcon.setPriority(RenderPriority.High);
|
|
||||||
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the XP bar.
|
|
||||||
*
|
|
||||||
* @param skillType The skill last used
|
|
||||||
* @param playerProfile The profile of the player whose XP bar should be updated
|
|
||||||
*/
|
|
||||||
public void update(SkillType skillType, PlayerProfile playerProfile) {
|
|
||||||
switch (playerProfile.getHudType()) {
|
|
||||||
case RETRO:
|
|
||||||
updateXpBarRetro(skillType, playerProfile);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STANDARD:
|
|
||||||
case SMALL:
|
|
||||||
updateXpBarStandard(skillType, playerProfile);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DISABLED:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update XP bar for Standard & Small styles.
|
|
||||||
*
|
|
||||||
* @param skillType The skill last used
|
|
||||||
* @param playerProfile The profile of the player whose XP bar should be updated
|
|
||||||
*/
|
|
||||||
private void updateXpBarStandard(SkillType skillType, PlayerProfile playerProfile) {
|
|
||||||
xpIcon.setUrl(StringUtils.getCapitalized(skillType.toString()) + ".png");
|
|
||||||
|
|
||||||
((GenericTexture) xpBar).setUrl(getUrlBar(getXpInc(playerProfile.getSkillXpLevel(skillType), playerProfile.getXpToLevel(skillType), HudType.STANDARD)));
|
|
||||||
|
|
||||||
spoutPlayer.getMainScreen().setDirty(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update XP bar for Retro styles.
|
|
||||||
*
|
|
||||||
* @param skillType The skill last used
|
|
||||||
* @param playerProfile The profile of the player whose XP bar should be updated
|
|
||||||
*/
|
|
||||||
private void updateXpBarRetro(SkillType skillType, PlayerProfile playerProfile) {
|
|
||||||
Color color = getRetroColor(skillType);
|
|
||||||
|
|
||||||
xpIcon.setUrl(StringUtils.getCapitalized(skillType.toString()) + "_r.png");
|
|
||||||
|
|
||||||
xpFill.setBottomColor(color);
|
|
||||||
xpFill.setTopColor(color);
|
|
||||||
xpFill.setWidth(getXpInc(playerProfile.getSkillXpLevel(skillType), playerProfile.getXpToLevel(skillType), HudType.RETRO));
|
|
||||||
|
|
||||||
spoutPlayer.getMainScreen().setDirty(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color getRetroColor(SkillType type) {
|
|
||||||
return new Color((float) SpoutConfig.getInstance().getRetroHUDRed(type), (float) SpoutConfig.getInstance().getRetroHUDGreen(type), (float) SpoutConfig.getInstance().getRetroHUDBlue(type), 1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getUrlBar(Integer number) {
|
|
||||||
char[] num = number.toString().toCharArray();
|
|
||||||
|
|
||||||
switch (num.length) {
|
|
||||||
case 1:
|
|
||||||
return "xpbar_inc00" + number + ".png";
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return "xpbar_inc0" + number + ".png";
|
|
||||||
|
|
||||||
default:
|
|
||||||
return "xpbar_inc" + number + ".png";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Integer getXpInc(int skillXp, int xpToLevel, HudType hudType) {
|
|
||||||
double percentage = (double) skillXp / xpToLevel;
|
|
||||||
double inc;
|
|
||||||
|
|
||||||
switch (hudType) {
|
|
||||||
case RETRO:
|
|
||||||
inc = 0.0079365079365079;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STANDARD:
|
|
||||||
inc = 0.0039370078740157;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) (percentage / inc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,6 +6,7 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
|
||||||
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.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,11 +16,21 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
protected SkillType skill;
|
protected SkillType skill;
|
||||||
protected int skillLevel;
|
protected int skillLevel;
|
||||||
|
protected XPGainReason xpGainReason;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
protected McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
protected McMMOPlayerExperienceEvent(Player player, SkillType skill) {
|
||||||
super(player);
|
super(player);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||||
|
this.xpGainReason = XPGainReason.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected McMMOPlayerExperienceEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||||
|
super(player);
|
||||||
|
this.skill = skill;
|
||||||
|
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||||
|
this.xpGainReason = xpGainReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,6 +47,13 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
|||||||
return skillLevel;
|
return skillLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The combat type involved in this event
|
||||||
|
*/
|
||||||
|
public XPGainReason getXpGainReason() {
|
||||||
|
return xpGainReason;
|
||||||
|
}
|
||||||
|
|
||||||
/** Following are required for Cancellable **/
|
/** Following are required for Cancellable **/
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
|
|||||||
@@ -3,12 +3,18 @@ package com.gmail.nossr50.events.experience;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a user levels change
|
* Called when a user levels change
|
||||||
*/
|
*/
|
||||||
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
|
public abstract class McMMOPlayerLevelChangeEvent extends McMMOPlayerExperienceEvent {
|
||||||
|
@Deprecated
|
||||||
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill) {
|
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill) {
|
||||||
super(player, skill);
|
super(player, skill, XPGainReason.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public McMMOPlayerLevelChangeEvent(Player player, SkillType skill, XPGainReason xpGainReason) {
|
||||||
|
super(player, skill, xpGainReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user