mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-19 02:12:58 +01:00
Compare commits
90 Commits
dev-uuid-c
...
javadocs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b249aa4e6 | ||
|
|
1a2d586086 | ||
|
|
63b332216e | ||
|
|
8e5340ebc3 | ||
|
|
e4af611c91 | ||
|
|
c31281971c | ||
|
|
eda38cba66 | ||
|
|
b5a2e76926 | ||
|
|
38cc7435dc | ||
|
|
864a760e9c | ||
|
|
0838cbb874 | ||
|
|
4844be80da | ||
|
|
62a767db89 | ||
|
|
ce3463ad6d | ||
|
|
5d059d8537 | ||
|
|
332860b9ce | ||
|
|
2a443cd9db | ||
|
|
f4d1004d32 | ||
|
|
9d8aec7eca | ||
|
|
958c116fd0 | ||
|
|
ec1a125809 | ||
|
|
2dd8e719c8 | ||
|
|
d62c68a490 | ||
|
|
3c6dd290f4 | ||
|
|
07e589aae3 | ||
|
|
1119d3c17f | ||
|
|
eac5d1ee7a | ||
|
|
56cb5c092f | ||
|
|
9d7faf9ed9 | ||
|
|
7da661546f | ||
|
|
48d3280e5e | ||
|
|
b61c65636b | ||
|
|
087a0b079f | ||
|
|
2147417322 | ||
|
|
4304970059 | ||
|
|
fc981fda20 | ||
|
|
be9ff51fd9 | ||
|
|
adde56114e | ||
|
|
5cfd2dc799 | ||
|
|
c878775c72 | ||
|
|
574cdd374b | ||
|
|
a3943aab24 | ||
|
|
1503e58d11 | ||
|
|
2650d57d8e | ||
|
|
4d402c7229 | ||
|
|
d687543910 | ||
|
|
d8ad519cd0 | ||
|
|
a23d093271 | ||
|
|
8a35d69540 | ||
|
|
097a5a0894 | ||
|
|
8760c2bbb0 | ||
|
|
dc635fe7d7 | ||
|
|
f10a1d0ffb | ||
|
|
809779e508 | ||
|
|
80d358d1fd | ||
|
|
a1be17c72c | ||
|
|
0a066f51bb | ||
|
|
294141c353 | ||
|
|
5a47f9fa86 | ||
|
|
6ee2d7d823 | ||
|
|
f2881f02c8 | ||
|
|
9f5445689c | ||
|
|
0ea163e3ee | ||
|
|
f097aa4a67 | ||
|
|
1fcb9e649e | ||
|
|
1d0dc02013 | ||
|
|
8766d31943 | ||
|
|
d857bf483e | ||
|
|
b7774251eb | ||
|
|
da7507fc75 | ||
|
|
fe4699430d | ||
|
|
df4fc8149d | ||
|
|
c156f0c346 | ||
|
|
79a17b0c1c | ||
|
|
d3051ad127 | ||
|
|
f4c53aaf8a | ||
|
|
432ff95a98 | ||
|
|
fe29bb4b9f | ||
|
|
ae5347bc0f | ||
|
|
966de87ef9 | ||
|
|
3569f9a182 | ||
|
|
70a23f8a0a | ||
|
|
857e12b96e | ||
|
|
c10525ada9 | ||
|
|
fb8592495d | ||
|
|
a48ada306c | ||
|
|
8db0d663dc | ||
|
|
70744371a3 | ||
|
|
18c322e8d6 | ||
|
|
75cbfa1b1c |
@@ -9,15 +9,27 @@ Key:
|
||||
|
||||
Version 1.5.01-dev
|
||||
+ Added new child skill; Salvage
|
||||
+ Added UUID support!
|
||||
+ Added SQL connection pooling and async loading!
|
||||
+ Added the long awaited Diminished Returns feature
|
||||
+ 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 option to config.yml for Scoreboards, display "Ability" instead of ability names on the scoreboards
|
||||
+ Added options to experience.yml for Dirt and Sand variations
|
||||
+ 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 API to ExperienceAPI to get the amount of XP needed for a level
|
||||
+ Added API class SkillAPI used to get a list of valid skill names
|
||||
+ Added API events for hardcore features, McMMOPlayerPreDeathPenaltyEvent, McMMOPlayerStatLossEvent and McMMOPlayerVampirismEvent
|
||||
+ Added API to ExperienceAPI to specify if XP can be shared
|
||||
+ 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
|
||||
+ Added magical mod config file import command, for Cauldron 1.7+. Check wiki for usage
|
||||
+ Added particle effects and sounds to "Call of the Wild" (Taming)
|
||||
+ Added summon length to "Call of the Wild". Summons will now commit suicide after their lifespan expires
|
||||
+ Added feature which makes tamed wolves attack a target shot by the owner
|
||||
= 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
|
||||
@@ -35,6 +47,7 @@ Version 1.5.01-dev
|
||||
= 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
|
||||
= Fixed bug where Repair_Material_Quantity wasn't read in mod config files
|
||||
! 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
|
||||
@@ -43,6 +56,8 @@ Version 1.5.01-dev
|
||||
! 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
|
||||
! Changed McMMOPlayerDeathPenaltyEvent to get fired after hardcore penalty calculations, use McMMOPlayerPreDeathPenaltyEvent for old behavior
|
||||
! Moved Refresh_Chunks setting from hidden.yml to config.yml
|
||||
- Removed salvage ability from Repair, salvage has it's own (child) skill now
|
||||
|
||||
Version 1.5.00
|
||||
|
||||
14
extras/mods/1.6.x/advancedgenetics.tools.yml
Normal file
14
extras/mods/1.6.x/advancedgenetics.tools.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Advanced Genetics 1.4.3
|
||||
Bows:
|
||||
# Genetic
|
||||
X31179:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31197
|
||||
Repair_Material_Pretty_Name: "Cell"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 1501
|
||||
9
extras/mods/1.6.x/appliedenergistics.blocks.yml
Normal file
9
extras/mods/1.6.x/appliedenergistics.blocks.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Applied Energistics rv14-finale3
|
||||
Mining:
|
||||
# Certus Quartz Ore
|
||||
X4076|0:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
65
extras/mods/1.6.x/appliedenergistics.tools.yml
Normal file
65
extras/mods/1.6.x/appliedenergistics.tools.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Applied Energistics rv14-finale3
|
||||
Axes:
|
||||
# Quartz
|
||||
X4365:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X4362
|
||||
Repair_Material_Pretty_Name: "Certus Quartz"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 250
|
||||
|
||||
Hoes:
|
||||
# Quartz
|
||||
X4366:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X4362
|
||||
Repair_Material_Pretty_Name: "Certus Quartz"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 2
|
||||
|
||||
Pickaxes:
|
||||
# Quartz
|
||||
X4368:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X4362
|
||||
Repair_Material_Pretty_Name: "Certus Quartz"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 250
|
||||
|
||||
Shovels:
|
||||
# Quartz
|
||||
X4367:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X4362
|
||||
Repair_Material_Pretty_Name: "Certus Quartz"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 750
|
||||
|
||||
Swords:
|
||||
# Quartz
|
||||
X4369:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X4362
|
||||
Repair_Material_Pretty_Name: "Certus Quartz"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 250
|
||||
9
extras/mods/1.6.x/bigreactors.blocks.yml
Normal file
9
extras/mods/1.6.x/bigreactors.blocks.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Big Reactors 0.3.4A2
|
||||
Mining:
|
||||
# Yellorite
|
||||
X1750|0:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
77
extras/mods/1.6.x/biomesoplenty.armor.yml
Normal file
77
extras/mods/1.6.x/biomesoplenty.armor.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of BoP 1.2.1.434
|
||||
Boots:
|
||||
# Wading
|
||||
X21269:
|
||||
Repairable: false
|
||||
Durability: 9999
|
||||
# Muddy
|
||||
X21283:
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 26
|
||||
# Amethyst
|
||||
X21293:
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 520
|
||||
|
||||
Chestplates:
|
||||
# Muddy
|
||||
X21281:
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 32
|
||||
# Amethyst
|
||||
X21291:
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 640
|
||||
|
||||
Helmets:
|
||||
# Muddy
|
||||
X21280:
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 22
|
||||
# Amethyst
|
||||
X21290:
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 440
|
||||
|
||||
Leggings:
|
||||
# Muddy
|
||||
X21280:
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 30
|
||||
# Amethyst
|
||||
X21290:
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 600
|
||||
44
extras/mods/1.6.x/biomesoplenty.blocks.yml
Normal file
44
extras/mods/1.6.x/biomesoplenty.blocks.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Incomplete! Only covers ores
|
||||
# Up to date as of BoP 1.2.1.434
|
||||
Mining:
|
||||
# Red Rock
|
||||
X162|0:
|
||||
XP_Gain: 30
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: false
|
||||
# Amethyst
|
||||
X1921|0:
|
||||
XP_Gain: 200
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Ruby
|
||||
X1921|2:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Peridot
|
||||
X1921|4:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Topaz
|
||||
X1921|6:
|
||||
XP_Gain: 200
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Tanzanite
|
||||
X1921|8:
|
||||
XP_Gain: 200
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Malachite
|
||||
X1921|10:
|
||||
XP_Gain: 200
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Sapphire
|
||||
X1921|12:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
121
extras/mods/1.6.x/biomesoplenty.tools.yml
Normal file
121
extras/mods/1.6.x/biomesoplenty.tools.yml
Normal file
@@ -0,0 +1,121 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of BoP 1.2.1.434
|
||||
Axes:
|
||||
# Amethyst
|
||||
X21287:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 2013
|
||||
# Muddy
|
||||
X21277:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 32
|
||||
|
||||
Hoes:
|
||||
# Amethyst
|
||||
X21288:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 2013
|
||||
# Muddy
|
||||
X21278:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 32
|
||||
|
||||
Pickaxes:
|
||||
# Amethyst
|
||||
X21286:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 2013
|
||||
# Muddy
|
||||
X21276:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 32
|
||||
|
||||
Shovels:
|
||||
# Amethyst
|
||||
X21285:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 2013
|
||||
# Muddy
|
||||
X21275:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 32
|
||||
|
||||
Swords:
|
||||
# Amethyst
|
||||
X21284:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X21264
|
||||
Repair_Material_Pretty_Name: "Amethyst"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 2013
|
||||
# Muddy
|
||||
X21274:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X21263
|
||||
Repair_Material_Pretty_Name: "Mud Ball"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 32
|
||||
31
extras/mods/1.6.x/emasher.armor.yml
Normal file
31
extras/mods/1.6.x/emasher.armor.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Emasher Resource 1.2.3.5
|
||||
Boots:
|
||||
# Hemp
|
||||
X9301:
|
||||
Repairable: true
|
||||
Repair_Material: X9291
|
||||
Repair_Material_Pretty_Name: "Hemp"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 65
|
||||
|
||||
Chestplates:
|
||||
# Hemp
|
||||
X9299:
|
||||
Repairable: true
|
||||
Repair_Material: X9291
|
||||
Repair_Material_Pretty_Name: "Hemp"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 80
|
||||
|
||||
Leggings:
|
||||
# Hemp
|
||||
X9300:
|
||||
Repairable: true
|
||||
Repair_Material: X9291
|
||||
Repair_Material_Pretty_Name: "Hemp"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 75
|
||||
44
extras/mods/1.6.x/emasher.blocks.yml
Normal file
44
extras/mods/1.6.x/emasher.blocks.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Emasher Resource 1.2.3.5
|
||||
Mining:
|
||||
# Bauxite
|
||||
X1565|0:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Cassiterite
|
||||
X1565|1:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Emery
|
||||
X1565|2:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Galena
|
||||
X1565|3:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Native Copper
|
||||
X1565|4:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Petlandite
|
||||
X1565|5:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Ruby
|
||||
X1565|6:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Sapphire
|
||||
X1565|7:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
54
extras/mods/1.6.x/extrautilities.tools.yml
Normal file
54
extras/mods/1.6.x/extrautilities.tools.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Extra Utilities 1.0.3c
|
||||
Axes:
|
||||
# Healing
|
||||
X10264:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X10258
|
||||
Repair_Material_Pretty_Name: "Unstable Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 1561
|
||||
|
||||
Hoes:
|
||||
# Reversing
|
||||
X10265:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: true
|
||||
Repair_Material: X10258
|
||||
Repair_Material_Pretty_Name: "Unstable Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 1561
|
||||
|
||||
Pickaxes:
|
||||
# Destruction
|
||||
X10263:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: false
|
||||
Durability: 6244
|
||||
|
||||
Shovels:
|
||||
# Erosion
|
||||
X10262:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: false
|
||||
Durability: 6244
|
||||
|
||||
Swords:
|
||||
# Etheric
|
||||
X10261:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 4
|
||||
Repairable: false
|
||||
Durability: 1561
|
||||
9
extras/mods/1.6.x/factorization.blocks.yml
Normal file
9
extras/mods/1.6.x/factorization.blocks.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Factorization 0.8.34
|
||||
Mining:
|
||||
# Dark Iron Ore
|
||||
X1004|0:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
19
extras/mods/1.6.x/forestry.blocks.yml
Normal file
19
extras/mods/1.6.x/forestry.blocks.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Forestry 2.3.1.1
|
||||
Mining:
|
||||
# Apatite
|
||||
X1398|0:
|
||||
XP_Gain: 100
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Copper
|
||||
X1398|1:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Tin
|
||||
X1398|2:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
27
extras/mods/1.6.x/forestry.tools.yml
Normal file
27
extras/mods/1.6.x/forestry.tools.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Forestry 2.3.1.1
|
||||
Pickaxes:
|
||||
# Survivalist
|
||||
X13261:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X5261
|
||||
Repair_Material_Pretty_Name: "Bronze Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 200
|
||||
|
||||
Shovels:
|
||||
# Survivalist
|
||||
X13264:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X5261
|
||||
Repair_Material_Pretty_Name: "Bronze Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 200
|
||||
11
extras/mods/1.6.x/minefactoryreloaded.armor.yml
Normal file
11
extras/mods/1.6.x/minefactoryreloaded.armor.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Minefactory Reloaded 2.7.9 Final
|
||||
Boots:
|
||||
# Plastic
|
||||
X12306:
|
||||
Repairable: true
|
||||
Repair_Material: X12249
|
||||
Repair_Material_Pretty_Name: "Plastic Sheets"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 39
|
||||
41
extras/mods/1.6.x/natura.armor.yml
Normal file
41
extras/mods/1.6.x/natura.armor.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Natura 2.1.14
|
||||
Boots:
|
||||
# Impskin
|
||||
X12712:
|
||||
Repairable: true
|
||||
Repair_Material: X12660
|
||||
Repair_Material_Pretty_Name: "Imp Leather"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 429
|
||||
|
||||
Chestplates:
|
||||
# Impskin
|
||||
X12710:
|
||||
Repairable: true
|
||||
Repair_Material: X12660
|
||||
Repair_Material_Pretty_Name: "Imp Leather"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 528
|
||||
|
||||
Helmets:
|
||||
# Impskin
|
||||
X12709:
|
||||
Repairable: true
|
||||
Repair_Material: X12660
|
||||
Repair_Material_Pretty_Name: "Imp Leather"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 363
|
||||
|
||||
Leggings:
|
||||
# Impskin
|
||||
X12709:
|
||||
Repairable: true
|
||||
Repair_Material: X12660
|
||||
Repair_Material_Pretty_Name: "Imp Leather"
|
||||
Repair_Material_Data_Value: 6
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 495
|
||||
272
extras/mods/1.6.x/natura.tools.yml
Normal file
272
extras/mods/1.6.x/natura.tools.yml
Normal file
@@ -0,0 +1,272 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Natura 2.1.14
|
||||
Axes:
|
||||
# Bloodwood
|
||||
X12685:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Bloodwood Planks"
|
||||
Repair_Material_Data_Value: 4
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 350
|
||||
# Darkwood
|
||||
X12689:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Darkwood Planks"
|
||||
Repair_Material_Data_Value: 11
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 131
|
||||
# Fusewood
|
||||
X12693:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Fusewood Planks"
|
||||
Repair_Material_Data_Value: 12
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 250
|
||||
# Ghostwood
|
||||
X12681:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Ghostwood Planks"
|
||||
Repair_Material_Data_Value: 2
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 59
|
||||
# Quartz
|
||||
X12697:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: QUARTZ_BLOCK
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 131
|
||||
|
||||
Bows:
|
||||
# Bloodwood
|
||||
X12706:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X12677
|
||||
Repair_Material_Pretty_Name: "Bloodwood Stick"
|
||||
Repair_Material_Data_Value: 4
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 1501
|
||||
# Darkwood
|
||||
X12707:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X12677
|
||||
Repair_Material_Pretty_Name: "Darkwood Stick"
|
||||
Repair_Material_Data_Value: 11
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 162
|
||||
# Fusewood
|
||||
X12708:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X12677
|
||||
Repair_Material_Pretty_Name: "Fusewood Stick"
|
||||
Repair_Material_Data_Value: 12
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 28
|
||||
# Ghostwood
|
||||
X12705:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X12677
|
||||
Repair_Material_Pretty_Name: "Ghostwood Stick"
|
||||
Repair_Material_Data_Value: 2
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 384
|
||||
|
||||
|
||||
Pickaxes:
|
||||
# Bloodwood
|
||||
X12683:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Bloodwood Planks"
|
||||
Repair_Material_Data_Value: 4
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 350
|
||||
# Darkwood
|
||||
X12687:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Darkwood Planks"
|
||||
Repair_Material_Data_Value: 11
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 131
|
||||
# Fusewood
|
||||
X12691:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Fusewood Planks"
|
||||
Repair_Material_Data_Value: 12
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 250
|
||||
# Ghostwood
|
||||
X12679:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Ghostwood Planks"
|
||||
Repair_Material_Data_Value: 2
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 59
|
||||
# Quartz
|
||||
X12695:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: QUARTZ_BLOCK
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 131
|
||||
|
||||
Shovels:
|
||||
# Bloodwood
|
||||
X12684:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Bloodwood Planks"
|
||||
Repair_Material_Data_Value: 4
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 350
|
||||
# Darkwood
|
||||
X12688:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Darkwood Planks"
|
||||
Repair_Material_Data_Value: 11
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 131
|
||||
# Fusewood
|
||||
X12692:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Fusewood Planks"
|
||||
Repair_Material_Data_Value: 12
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 250
|
||||
# Ghostwood
|
||||
X12680:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Ghostwood Planks"
|
||||
Repair_Material_Data_Value: 2
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 59
|
||||
# Quartz
|
||||
X12696:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: QUARTZ_BLOCK
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 131
|
||||
|
||||
Swords:
|
||||
# Bloodwood
|
||||
X12682:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Bloodwood Planks"
|
||||
Repair_Material_Data_Value: 4
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 350
|
||||
# Darkwood
|
||||
X12686:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Darkwood Planks"
|
||||
Repair_Material_Data_Value: 11
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 131
|
||||
# Fusewood
|
||||
X12690:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Fusewood Planks"
|
||||
Repair_Material_Data_Value: 12
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 250
|
||||
# Ghostwood
|
||||
X12678:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: X3262
|
||||
Repair_Material_Pretty_Name: "Ghostwood Planks"
|
||||
Repair_Material_Data_Value: 2
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 59
|
||||
# Quartz
|
||||
X12694:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: true
|
||||
Repair_Material: QUARTZ_BLOCK
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 131
|
||||
29
extras/mods/1.6.x/projectred.blocks.yml
Normal file
29
extras/mods/1.6.x/projectred.blocks.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Project Red 4.3.5.30
|
||||
Mining:
|
||||
# Ruby
|
||||
X2130|0:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Sapphire
|
||||
X2130|1:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Peridot
|
||||
X2130|2:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Marble
|
||||
X2131|0:
|
||||
XP_Gain: 30
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: false
|
||||
# Basalt
|
||||
X2131|3:
|
||||
XP_Gain: 30
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: false
|
||||
176
extras/mods/1.6.x/projectred.tools.yml
Normal file
176
extras/mods/1.6.x/projectred.tools.yml
Normal file
@@ -0,0 +1,176 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Project Red 4.3.5.30
|
||||
Axes:
|
||||
# Ruby
|
||||
X9353:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Ruby"
|
||||
Repair_Material_Data_Value: 37
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
# Sapphire
|
||||
X9354:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Sapphire"
|
||||
Repair_Material_Data_Value: 38
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
# Peridot
|
||||
X9355:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Peridot"
|
||||
Repair_Material_Data_Value: 39
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
|
||||
Hoes:
|
||||
# Ruby
|
||||
X9356:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Ruby"
|
||||
Repair_Material_Data_Value: 37
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
# Sapphire
|
||||
X9357:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Sapphire"
|
||||
Repair_Material_Data_Value: 38
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
# Peridot
|
||||
X9358:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Peridot"
|
||||
Repair_Material_Data_Value: 39
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
|
||||
Pickaxes:
|
||||
# Ruby
|
||||
X9359:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Ruby"
|
||||
Repair_Material_Data_Value: 37
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
# Sapphire
|
||||
X9360:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Sapphire"
|
||||
Repair_Material_Data_Value: 38
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
# Peridot
|
||||
X9361:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Peridot"
|
||||
Repair_Material_Data_Value: 39
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 500
|
||||
|
||||
Shovels:
|
||||
# Ruby
|
||||
X9362:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Ruby"
|
||||
Repair_Material_Data_Value: 37
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 500
|
||||
# Sapphire
|
||||
X9363:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Sapphire"
|
||||
Repair_Material_Data_Value: 38
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 500
|
||||
# Peridot
|
||||
X9364:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Peridot"
|
||||
Repair_Material_Data_Value: 39
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 500
|
||||
|
||||
Swords:
|
||||
# Ruby
|
||||
X9365:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Ruby"
|
||||
Repair_Material_Data_Value: 37
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
# Sapphire
|
||||
X9366:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Sapphire"
|
||||
Repair_Material_Data_Value: 38
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
# Peridot
|
||||
X9368:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X9281
|
||||
Repair_Material_Pretty_Name: "Peridot"
|
||||
Repair_Material_Data_Value: 39
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
@@ -1,44 +1,49 @@
|
||||
# Config created by Dragyn
|
||||
# Created For Railcraft_1.6.2-8.1.0.0
|
||||
#
|
||||
#
|
||||
# Settings for Boots
|
||||
###
|
||||
# Config wrote by Dragyn, updated by M1cr0man
|
||||
# Up to date as of Railcraft 8.4.0.0
|
||||
Boots:
|
||||
# Steel
|
||||
X7758:
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Chestplates
|
||||
###
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 325
|
||||
|
||||
Chestplates:
|
||||
# Steel
|
||||
X7761:
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Helmets
|
||||
###
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 400
|
||||
|
||||
Helmets:
|
||||
# Steel
|
||||
X7759:
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Leggings
|
||||
###
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 275
|
||||
|
||||
Leggings:
|
||||
# Steel
|
||||
X7760:
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 375
|
||||
# Overalls
|
||||
X7757:
|
||||
Repairable: true
|
||||
Repair_Material: WOOL
|
||||
Repair_Material_Pretty_Name: "Light Blue Wool"
|
||||
Repair_Material_Data_Value: 3
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 75
|
||||
@@ -1,76 +1,66 @@
|
||||
# Config created by Dragyn
|
||||
# Created For Railcraft_1.6.2-8.1.0.0
|
||||
#
|
||||
#
|
||||
# Settings for Axes
|
||||
###
|
||||
# Config wrote by Dragyn, updated by M1cr0man
|
||||
# Up to date as of Railcraft 8.4.0.0
|
||||
Axes:
|
||||
# Steel
|
||||
X7819:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
|
||||
|
||||
#
|
||||
# Settings for Hoes
|
||||
###
|
||||
Hoes:
|
||||
# Steel
|
||||
X7820:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
|
||||
#
|
||||
# Settings for Pickaxes
|
||||
###
|
||||
Pickaxes:
|
||||
# Steel
|
||||
X7821:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Shovels
|
||||
###
|
||||
|
||||
Shovels:
|
||||
# Steel
|
||||
X7823:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Swords
|
||||
###
|
||||
|
||||
Swords:
|
||||
# Steel
|
||||
X7824:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X7796
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 500
|
||||
9
extras/mods/1.6.x/stargatetech2.blocks.yml
Normal file
9
extras/mods/1.6.x/stargatetech2.blocks.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Stargate Tech 2 Alpha 0.7.3
|
||||
Mining:
|
||||
# Naquadah Ore
|
||||
X1005|0:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
41
extras/mods/1.6.x/thermalexpansion.armor.yml
Normal file
41
extras/mods/1.6.x/thermalexpansion.armor.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Thermal Expansion 3.0.0.7
|
||||
Boots:
|
||||
# Invar
|
||||
X31973:
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 325
|
||||
|
||||
Chestplates:
|
||||
# Invar
|
||||
X31975:
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 400
|
||||
|
||||
Helmets:
|
||||
# Invar
|
||||
X31976:
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 275
|
||||
|
||||
Leggings:
|
||||
# Invar
|
||||
X31976:
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 375
|
||||
29
extras/mods/1.6.x/thermalexpansion.blocks.yml
Normal file
29
extras/mods/1.6.x/thermalexpansion.blocks.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Thermal Expansion 3.0.0.7
|
||||
Mining:
|
||||
# Copper
|
||||
X4064|0:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Tin
|
||||
X4064|1:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Silver
|
||||
X4064|2:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Lead
|
||||
X4064|3:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Ferrous
|
||||
X4064|4:
|
||||
XP_Gain: 300
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
66
extras/mods/1.6.x/thermalexpansion.tools.yml
Normal file
66
extras/mods/1.6.x/thermalexpansion.tools.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Thermal Expansion 3.0.0.7
|
||||
Axes:
|
||||
# Invar
|
||||
X31969:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 450
|
||||
|
||||
Hoes:
|
||||
# Invar
|
||||
X31968:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 450
|
||||
|
||||
Pickaxes:
|
||||
# Invar
|
||||
X31970:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 3
|
||||
Durability: 450
|
||||
|
||||
Shovels:
|
||||
# Invar
|
||||
X31971:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 1
|
||||
Durability: 450
|
||||
|
||||
Swords:
|
||||
# Invar
|
||||
X31972:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 3
|
||||
Repairable: true
|
||||
Repair_Material: X31978
|
||||
Repair_Material_Pretty_Name: "Invar Ingot"
|
||||
Repair_Material_Data_Value: 71
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 450
|
||||
74
extras/mods/1.6.x/tinkersconstruct.armor.yml
Normal file
74
extras/mods/1.6.x/tinkersconstruct.armor.yml
Normal file
@@ -0,0 +1,74 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Up to date as of Tinker's Construct 1.5.5.7
|
||||
# Also covers Tinker's Steelworks 0.0.4.2-fix2
|
||||
Boots:
|
||||
# Wooden (Repaired with Oak Wood)
|
||||
X14366:
|
||||
Repairable: true
|
||||
Repair_Material: LOG
|
||||
Repair_Material_Pretty_Name: "Oak Wood"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 26
|
||||
# Steel
|
||||
X14771:
|
||||
Repairable: true
|
||||
Repair_Material: X14276
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 16
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 325
|
||||
|
||||
Chestplates:
|
||||
# Wooden (Repaired with Oak Wood)
|
||||
X14364:
|
||||
Repairable: true
|
||||
Repair_Material: LOG
|
||||
Repair_Material_Pretty_Name: "Oak Wood"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 32
|
||||
# Steel
|
||||
X14769:
|
||||
Repairable: true
|
||||
Repair_Material: X14276
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 16
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 400
|
||||
|
||||
Helmets:
|
||||
# Wooden (Repaired with Oak Wood)
|
||||
X14362:
|
||||
Repairable: true
|
||||
Repair_Material: LOG
|
||||
Repair_Material_Pretty_Name: "Oak Wood"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 22
|
||||
# Steel
|
||||
X14768:
|
||||
Repairable: true
|
||||
Repair_Material: X14276
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 16
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 275
|
||||
|
||||
Leggings:
|
||||
# Wooden (Repaired with Oak Wood)
|
||||
X14362:
|
||||
Repairable: true
|
||||
Repair_Material: LOG
|
||||
Repair_Material_Pretty_Name: "Oak Wood"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 30
|
||||
# Steel
|
||||
X14768:
|
||||
Repairable: true
|
||||
Repair_Material: X14276
|
||||
Repair_Material_Pretty_Name: "Steel Ingot"
|
||||
Repair_Material_Data_Value: 16
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 375
|
||||
55
extras/mods/1.6.x/tinkersconstruct.blocks.yml
Normal file
55
extras/mods/1.6.x/tinkersconstruct.blocks.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Possibly incomplete. Only covers ores
|
||||
# Up to date as of Tinker's Construct 1.5.5.7
|
||||
Excavation:
|
||||
# Iron
|
||||
X1488|0:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
# Gold
|
||||
X1488|1:
|
||||
XP_Gain: 350
|
||||
Double_Drops_Enabled: true
|
||||
# Copper
|
||||
X1488|2:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
# Tin
|
||||
X1488|3:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
# Aluminum
|
||||
X1488|4:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
# Cobalt
|
||||
X1488|5:
|
||||
XP_Gain: 500
|
||||
Double_Drops_Enabled: true
|
||||
|
||||
Mining:
|
||||
# Cobalt
|
||||
X1475|1:
|
||||
XP_Gain: 500
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Ardite
|
||||
X1475|2:
|
||||
XP_Gain: 500
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Copper
|
||||
X1475|3:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Tin
|
||||
X1475|4:
|
||||
XP_Gain: 175
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
# Aluminium
|
||||
X1475|5:
|
||||
XP_Gain: 250
|
||||
Double_Drops_Enabled: true
|
||||
Is_Ore: true
|
||||
149
extras/mods/1.6.x/tinkersconstruct.tools.yml
Normal file
149
extras/mods/1.6.x/tinkersconstruct.tools.yml
Normal file
@@ -0,0 +1,149 @@
|
||||
# Config wrote by M1cr0man
|
||||
# Abilites for Pickaxes and Shovels disabled due to a bug
|
||||
# Repair disabled as mcMMO does not support NBTTag - based tools
|
||||
# Up to date as of Tinker's Construct 1.5.5.7
|
||||
# Also covers Tinker's Steelworks 0.0.4.2-fix2
|
||||
Axes:
|
||||
# Hatchets
|
||||
X14309:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Mattocks
|
||||
X14316:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Lumber Axes
|
||||
X14317:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Battle Axes
|
||||
X14327:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
|
||||
Bows:
|
||||
# Shortbows
|
||||
X14319:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
|
||||
Hoes:
|
||||
# Mattocks
|
||||
X14316:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Scythes
|
||||
X14323:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
|
||||
Pickaxes:
|
||||
# Pickaxes
|
||||
X14307:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: false
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Hammers
|
||||
X14326:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: false
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
|
||||
Shovels:
|
||||
# Shovels
|
||||
X14308:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: false
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Mattocks
|
||||
X14316:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: false
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Excavators
|
||||
X14325:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: false
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
|
||||
Swords:
|
||||
# Broadswords
|
||||
X14311:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Longswords
|
||||
X14312:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Rapiers
|
||||
X14313:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Daggers
|
||||
X14321:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Cleavers
|
||||
X14324:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Battle Axes
|
||||
X14327:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
# Cutlasses
|
||||
X14328:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 2
|
||||
Repairable: false
|
||||
Durability: 500
|
||||
@@ -1,134 +1,161 @@
|
||||
# Config created by Dragyn
|
||||
# Created For twilightforest-1.20.3
|
||||
#
|
||||
#
|
||||
# Settings for Boots
|
||||
###
|
||||
Boots:
|
||||
# Config wrote by Dragyn, updated by M1cr0man
|
||||
# Up to date as of Twilight Forest 1.20.5
|
||||
Boots:
|
||||
# Ironwood
|
||||
X27978:
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 260
|
||||
# Fiery
|
||||
X27995:
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Pretty_Name: "Fiery Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 325
|
||||
# Stealeaf
|
||||
X28002:
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 260
|
||||
# Knightmetal
|
||||
X28037:
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
|
||||
#
|
||||
# Settings for Chestplates
|
||||
###
|
||||
Repair_Material_Quantity: 4
|
||||
Durability: 260
|
||||
|
||||
Chestplates:
|
||||
# Ironwood
|
||||
X27976:
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 320
|
||||
# Naga Scale
|
||||
X27958:
|
||||
Repairable: true
|
||||
Repair_Material: X27957
|
||||
Repair_Material_Pretty_Name: "Naga Scale"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 336
|
||||
# Fiery
|
||||
X27993:
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Pretty_Name: "Fiery Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 400
|
||||
# Stealeaf
|
||||
X28000:
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 320
|
||||
# Knightmetal
|
||||
X28035:
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 8
|
||||
Durability: 320
|
||||
# Phantom
|
||||
X28035:
|
||||
Repairable: false
|
||||
Durability: 480
|
||||
|
||||
#
|
||||
# Settings for Helmets
|
||||
###
|
||||
Helmets:
|
||||
# Ironwood
|
||||
X27975:
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 220
|
||||
# Fiery
|
||||
X27992:
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Pretty_Name: "Fiery Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 275
|
||||
# Stealeaf
|
||||
X27999:
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 220
|
||||
# Knightmetal
|
||||
X28034:
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 5
|
||||
Durability: 220
|
||||
# Phantom
|
||||
X28034:
|
||||
Repairable: false
|
||||
Durability: 330
|
||||
|
||||
#
|
||||
# Settings for Leggings
|
||||
###
|
||||
Leggings:
|
||||
# Ironwood
|
||||
X27977:
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 300
|
||||
# Naga Scale
|
||||
X27959:
|
||||
Repairable: true
|
||||
Repair_Material: X27957
|
||||
Repair_Material_Pretty_Name: "Naga Scale"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 315
|
||||
# Fiery
|
||||
X27994:
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Pretty_Name: "Fiery Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 375
|
||||
# Stealeaf
|
||||
X28001:
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 300
|
||||
# Knightmetal
|
||||
X28036:
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repair_Material_Quantity: 7
|
||||
Durability: 300
|
||||
@@ -1,186 +1,181 @@
|
||||
# Config created by Dragyn
|
||||
# Created For twilightforest-1.20.3
|
||||
#
|
||||
#
|
||||
# Settings for Axes
|
||||
###
|
||||
# Config wrote by Dragyn, updated by M1cr0man
|
||||
# Up to date as of Twilight Forest 1.20.5
|
||||
Axes:
|
||||
# Ironwood
|
||||
X27982:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Steeleaf
|
||||
X31989:
|
||||
XP_Modifer: 1.0
|
||||
X28006:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 131
|
||||
# Knightmetal
|
||||
X28040:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Minotaur
|
||||
X31984:
|
||||
XP_Modifer: 1.0
|
||||
X28008:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X264
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Repairable: false
|
||||
Durability: 1561
|
||||
|
||||
|
||||
#
|
||||
# Settings for Hoes
|
||||
###
|
||||
Hoes:
|
||||
# Ironwood
|
||||
X27983:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Steeleaf
|
||||
X31988:
|
||||
XP_Modifer: 1.0
|
||||
X28007:
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 131
|
||||
|
||||
#
|
||||
# Settings for Pickaxes
|
||||
###
|
||||
Pickaxes:
|
||||
# Ironwood
|
||||
X27981:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Fiery
|
||||
X27997:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 1024
|
||||
# Steeleaf
|
||||
X28005:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 131
|
||||
# Knightmetal
|
||||
X28039:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Shovels
|
||||
###
|
||||
Durability: 512
|
||||
|
||||
Shovels:
|
||||
# Ironwood
|
||||
X27980:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Steeleaf
|
||||
X28004:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
#
|
||||
# Settings for Swords
|
||||
###
|
||||
Durability: 131
|
||||
|
||||
Swords:
|
||||
# Ironwood
|
||||
X27979:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27974
|
||||
Repair_Material_Pretty_Name: "Ironwood Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
# Fiery
|
||||
X27996:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27991
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 1024
|
||||
# Steeleaf
|
||||
X28003:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X27998
|
||||
Repair_Material_Pretty_Name: "Steeleaf"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 131
|
||||
# Knightmetal
|
||||
X28038:
|
||||
XP_Modifer: 1.0
|
||||
XP_Modifier: 1.0
|
||||
Ability_Enabled: true
|
||||
Tier: 1
|
||||
Repairable: true
|
||||
Repair_Material: X28032
|
||||
Repair_Material_Pretty_Name: "Knightmetal Ingot"
|
||||
Repair_Material_Data_Value: 0
|
||||
Repair_Material_Quantity: 2
|
||||
Durability: 500
|
||||
Durability: 512
|
||||
4
pom.xml
4
pom.xml
@@ -131,9 +131,9 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
||||
@@ -11,34 +11,106 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Berserk" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Berserk" is active
|
||||
*/
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Giga Drill Breaker" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Giga Drill Breaker" is active
|
||||
*/
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Green Terra" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Green Terra" is active
|
||||
*/
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Serrated Strikes" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Serrated Strikes" is active
|
||||
*/
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Skull Splitter" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Skull Splitter" is active
|
||||
*/
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Super Breaker" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Super Breaker" is active
|
||||
*/
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the ability "Tree Feller" is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if "Tree Feller" is active
|
||||
*/
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if any ability is active.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
*
|
||||
* @return true if any ability is active
|
||||
*/
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
@@ -51,38 +123,110 @@ public final class AbilityAPI {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the ability cooldowns for a player
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to reset the cooldowns for
|
||||
*/
|
||||
public static void resetCooldowns(Player player) {
|
||||
UserManager.getPlayer(player).resetCooldowns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Berserk" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setBerserkCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.BERSERK, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Giga Drill Breaker" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GIGA_DRILL_BREAKER, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Green Terra" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.GREEN_TERRA, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Serrated Strikes" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SERRATED_STRIKES, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Skull Splitter" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SKULL_SPLITTER, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Super Breaker" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.SUPER_BREAKER, cooldown);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cooldown for the "Tree Feller" ability
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The {@link Player} to set the cooldown for
|
||||
* @param cooldown The cooldown length to set
|
||||
*/
|
||||
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a LivingEntity is bleeding
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param entity The {@link LivingEntity} to check
|
||||
* @return true if entity is bleeding, false otherwise
|
||||
*/
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
return BleedTimerTask.isBleeding(entity);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
@@ -81,6 +83,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
@@ -91,6 +95,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
@@ -101,6 +107,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
@@ -111,6 +119,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Toggle the party chat mode of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to toggle party chat on.
|
||||
*/
|
||||
@@ -120,6 +130,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Toggle the party chat mode of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to toggle party chat on.
|
||||
*/
|
||||
@@ -129,6 +141,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Toggle the admin chat mode of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to toggle admin chat on.
|
||||
*/
|
||||
@@ -138,6 +152,8 @@ public final class ChatAPI {
|
||||
|
||||
/**
|
||||
* Toggle the admin chat mode of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playerName The name of the player to toggle party chat on.
|
||||
*/
|
||||
|
||||
@@ -6,11 +6,15 @@ import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.api.exceptions.InvalidFormulaTypeException;
|
||||
import com.gmail.nossr50.api.exceptions.InvalidPlayerException;
|
||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||
import com.gmail.nossr50.api.exceptions.InvalidXPGainReasonException;
|
||||
import com.gmail.nossr50.api.exceptions.McMMOPlayerNotFoundException;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
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.skills.XPGainReason;
|
||||
@@ -84,7 +88,30 @@ public final class ExperienceAPI {
|
||||
* @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));
|
||||
addRawXP(player, skillType, XP, xpGainReason, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @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, boolean isUnshared) {
|
||||
if (isUnshared) {
|
||||
getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||
return;
|
||||
}
|
||||
|
||||
getPlayer(player).applyXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +193,7 @@ public final class ExperienceAPI {
|
||||
* @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));
|
||||
getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,9 +243,32 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addModifiedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||
addModifiedXP(player, skillType, XP, xpGainReason, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @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, boolean isUnshared) {
|
||||
SkillType skill = getSkillType(skillType);
|
||||
|
||||
UserManager.getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||
if (isUnshared) {
|
||||
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||
return;
|
||||
}
|
||||
|
||||
getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,7 +322,31 @@ public final class ExperienceAPI {
|
||||
* @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));
|
||||
addXP(player, skillType, XP, xpGainReason, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param isUnshared true if the XP cannot be shared with party members
|
||||
*
|
||||
* @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, boolean isUnshared) {
|
||||
if (isUnshared) {
|
||||
getPlayer(player).beginUnsharedXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||
return;
|
||||
}
|
||||
|
||||
getPlayer(player).beginXpGain(getSkillType(skillType), XP, getXPGainReason(xpGainReason));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,7 +362,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXP(Player player, String skillType) {
|
||||
return UserManager.getPlayer(player).getSkillXpLevel(getNonChildSkillType(skillType));
|
||||
return getPlayer(player).getSkillXpLevel(getNonChildSkillType(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,7 +413,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static float getXPRaw(Player player, String skillType) {
|
||||
return UserManager.getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType));
|
||||
return getPlayer(player).getSkillXpLevelRaw(getNonChildSkillType(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,7 +464,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static int getXPToNextLevel(Player player, String skillType) {
|
||||
return UserManager.getPlayer(player).getXpToLevel(getNonChildSkillType(skillType));
|
||||
return getPlayer(player).getXpToLevel(getNonChildSkillType(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,7 +517,7 @@ public final class ExperienceAPI {
|
||||
public static int getXPRemaining(Player player, String skillType) {
|
||||
SkillType skill = getNonChildSkillType(skillType);
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
PlayerProfile profile = getPlayer(player).getProfile();
|
||||
|
||||
return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill);
|
||||
}
|
||||
@@ -501,7 +575,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static void addLevel(Player player, String skillType, int levels) {
|
||||
UserManager.getPlayer(player).addLevels(getSkillType(skillType), levels);
|
||||
getPlayer(player).addLevels(getSkillType(skillType), levels);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,7 +653,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static int getLevel(Player player, String skillType) {
|
||||
return UserManager.getPlayer(player).getSkillLevel(getSkillType(skillType));
|
||||
return getPlayer(player).getSkillLevel(getSkillType(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -624,7 +698,7 @@ public final class ExperienceAPI {
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public static int getPowerLevel(Player player) {
|
||||
return UserManager.getPlayer(player).getPowerLevel();
|
||||
return getPlayer(player).getPowerLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -775,7 +849,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidSkillException if the given skill is not valid
|
||||
*/
|
||||
public static void setLevel(Player player, String skillType, int skillLevel) {
|
||||
UserManager.getPlayer(player).modifySkill(getSkillType(skillType), skillLevel);
|
||||
getPlayer(player).modifySkill(getSkillType(skillType), skillLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -824,7 +898,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void setXP(Player player, String skillType, int newValue) {
|
||||
UserManager.getPlayer(player).setSkillXpLevel(getNonChildSkillType(skillType), newValue);
|
||||
getPlayer(player).setSkillXpLevel(getNonChildSkillType(skillType), newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -875,7 +949,7 @@ public final class ExperienceAPI {
|
||||
* @throws UnsupportedOperationException if the given skill is a child skill
|
||||
*/
|
||||
public static void removeXP(Player player, String skillType, int xp) {
|
||||
UserManager.getPlayer(player).removeXp(getNonChildSkillType(skillType), xp);
|
||||
getPlayer(player).removeXp(getNonChildSkillType(skillType), xp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -913,6 +987,33 @@ public final class ExperienceAPI {
|
||||
getOfflineProfile(uuid).removeXp(getNonChildSkillType(skillType), xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check how much XP is needed for a specific level with the selected level curve.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param level The level to get the amount of XP for
|
||||
*
|
||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||
*/
|
||||
public static int getXpNeededToLevel(int level) {
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, ExperienceConfig.getInstance().getFormulaType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check how much XP is needed for a specific level with the provided level curve.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param level The level to get the amount of XP for
|
||||
* @param formulaType The formula type to get the amount of XP for
|
||||
*
|
||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||
*/
|
||||
public static int getXpNeededToLevel(int level, String formulaType) {
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, getFormulaType(formulaType));
|
||||
}
|
||||
|
||||
// Utility methods follow.
|
||||
private static void addOfflineXP(UUID playerUniqueId, SkillType skill, int XP) {
|
||||
PlayerProfile profile = getOfflineProfile(playerUniqueId);
|
||||
@@ -980,4 +1081,22 @@ public final class ExperienceAPI {
|
||||
|
||||
return xpGainReason;
|
||||
}
|
||||
|
||||
private static FormulaType getFormulaType(String formula) throws InvalidFormulaTypeException {
|
||||
FormulaType formulaType = FormulaType.getFormulaType(formula);
|
||||
|
||||
if (formulaType == null) {
|
||||
throw new InvalidFormulaTypeException();
|
||||
}
|
||||
|
||||
return formulaType;
|
||||
}
|
||||
|
||||
private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
throw new McMMOPlayerNotFoundException(player);
|
||||
}
|
||||
|
||||
return UserManager.getPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@@ -79,7 +82,7 @@ public final class PartyAPI {
|
||||
Party party = PartyManager.getParty(partyName);
|
||||
|
||||
if (party == null) {
|
||||
party = new Party(player.getName(), partyName);
|
||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||
}
|
||||
|
||||
PartyManager.addToParty(UserManager.getPlayer(player), party);
|
||||
@@ -105,7 +108,7 @@ public final class PartyAPI {
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
return PartyManager.getPartyLeader(partyName);
|
||||
return PartyManager.getPartyLeaderName(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,10 +117,11 @@ public final class PartyAPI {
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param player The player to set as leader
|
||||
* @param playerName The playerName to set as leader
|
||||
*/
|
||||
public static void setPartyLeader(String partyName, String player) {
|
||||
PartyManager.setPartyLeader(player, PartyManager.getParty(partyName));
|
||||
@Deprecated
|
||||
public static void setPartyLeader(String partyName, String playerName) {
|
||||
PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,8 +136,8 @@ public final class PartyAPI {
|
||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
||||
List<OfflinePlayer> members = new ArrayList<OfflinePlayer>();
|
||||
|
||||
for (String memberName : PartyManager.getAllMembers(player)) {
|
||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberName);
|
||||
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
|
||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
|
||||
members.add(member);
|
||||
}
|
||||
return members;
|
||||
@@ -147,7 +151,20 @@ public final class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return all the player names in the player's party
|
||||
*/
|
||||
@Deprecated
|
||||
public static LinkedHashSet<String> getMembers(Player player) {
|
||||
return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all player names and uuids in this player's party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return all the player names and uuids in the player's party
|
||||
*/
|
||||
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
||||
return PartyManager.getAllMembers(player);
|
||||
}
|
||||
|
||||
@@ -175,6 +192,14 @@ public final class PartyAPI {
|
||||
return PartyManager.getOnlineMembers(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is a certain party has an ally
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param partyName The name of the party to check
|
||||
* @return true if the party has an ally, false otherwise
|
||||
*/
|
||||
public static boolean hasAlly(String partyName) {
|
||||
return getAllyName(partyName) != null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
public class InvalidFormulaTypeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 3368670229490121886L;
|
||||
|
||||
public InvalidFormulaTypeException() {
|
||||
super("That is not a valid FormulaType.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class McMMOPlayerNotFoundException extends RuntimeException {
|
||||
private static final long serialVersionUID = 761917904993202836L;
|
||||
|
||||
public McMMOPlayerNotFoundException(Player player) {
|
||||
super("McMMOPlayer object was not found for: " + player.getName() + " " + player.getUniqueId());
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,10 @@ public class KrakenCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
UserManager.getPlayer(sender.getName()).getFishingManager().unleashTheKraken();
|
||||
return true;
|
||||
|
||||
|
||||
351
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
351
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
@@ -0,0 +1,351 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.ModConfigType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class McImportCommand implements CommandExecutor {
|
||||
int fileAmount;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
importModConfig();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean importModConfig() {
|
||||
String importFilePath = mcMMO.getModDirectory() + File.separator + "import";
|
||||
File importFile = new File(importFilePath, "import.log");
|
||||
mcMMO.p.getLogger().info("Starting import of mod materials...");
|
||||
fileAmount = 0;
|
||||
|
||||
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<ModConfigType, ArrayList<String>>();
|
||||
|
||||
BufferedReader in = null;
|
||||
|
||||
try {
|
||||
// Open the file
|
||||
in = new BufferedReader(new FileReader(importFile));
|
||||
|
||||
String line;
|
||||
String materialName;
|
||||
String modName;
|
||||
|
||||
// While not at the end of the file
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] split1 = line.split("material ");
|
||||
|
||||
if (split1.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split2 = split1[1].split(" with");
|
||||
|
||||
if (split2.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
materialName = split2[0];
|
||||
|
||||
// Categorise each material under a mod config type
|
||||
ModConfigType type = ModConfigType.getModConfigType(materialName);
|
||||
|
||||
if (!materialNames.containsKey(type)) {
|
||||
materialNames.put(type, new ArrayList<String>());
|
||||
}
|
||||
|
||||
materialNames.get(type).add(materialName);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)");
|
||||
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
tryClose(in);
|
||||
}
|
||||
|
||||
createOutput(materialNames);
|
||||
|
||||
mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
|
||||
for (ModConfigType modConfigType : materialNames.keySet()) {
|
||||
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
for (String materialName : materialNames.get(modConfigType)) {
|
||||
String modName = Misc.getModName(materialName);
|
||||
|
||||
if (!materialNamesType.containsKey(modName)) {
|
||||
materialNamesType.put(modName, new ArrayList<String>());
|
||||
}
|
||||
|
||||
materialNamesType.get(modName).add(materialName);
|
||||
}
|
||||
|
||||
createOutput(modConfigType, materialNamesType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tryClose(Closeable c) {
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
c.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createOutput(ModConfigType modConfigType, HashMap<String, ArrayList<String>> materialNames) {
|
||||
File outputFilePath = new File(mcMMO.getModDirectory() + File.separator + "output");
|
||||
if (!outputFilePath.exists() && !outputFilePath.mkdirs()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output directory! " + outputFilePath.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileWriter out = null;
|
||||
String type = modConfigType.name().toLowerCase();
|
||||
|
||||
for (String modName : materialNames.keySet()) {
|
||||
File outputFile = new File(outputFilePath, modName + "." + type + ".yml");
|
||||
mcMMO.p.getLogger().info("Creating " + outputFile.getName());
|
||||
try {
|
||||
if (outputFile.exists() && !outputFile.delete()) {
|
||||
mcMMO.p.getLogger().severe("Not able to delete old output file! " + outputFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!outputFile.createNewFile()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output file! " + outputFile.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
|
||||
StringBuilder writer = new StringBuilder();
|
||||
HashMap<String, ArrayList<String>> configSections = getConfigSections(modConfigType, modName, materialNames);
|
||||
|
||||
if (configSections == null) {
|
||||
mcMMO.p.getLogger().severe("Something went wrong!! type is " + type);
|
||||
return;
|
||||
}
|
||||
|
||||
// Write the file, go through each skill and write all the materials
|
||||
for (String configSection : configSections.keySet()) {
|
||||
if (configSection.equals("UNIDENTIFIED")) {
|
||||
writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n");
|
||||
writer.append("# copy and pasted to a valid section of this config file.").append("\r\n");
|
||||
}
|
||||
writer.append(configSection).append(":").append("\r\n");
|
||||
|
||||
for (String line : configSections.get(configSection)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
|
||||
writer.append("\r\n");
|
||||
}
|
||||
|
||||
out = new FileWriter(outputFile);
|
||||
out.write(writer.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
tryClose(out);
|
||||
fileAmount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSections(ModConfigType type, String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
switch (type) {
|
||||
case BLOCKS:
|
||||
return getConfigSectionsBlocks(modName, materialNames);
|
||||
case TOOLS:
|
||||
return getConfigSectionsTools(modName, materialNames);
|
||||
case ARMOR:
|
||||
return getConfigSectionsArmor(modName, materialNames);
|
||||
case UNKNOWN:
|
||||
return getConfigSectionsUnknown(modName, materialNames);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under a skill
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String skillName = "UNIDENTIFIED";
|
||||
if (materialName.contains("ORE")) {
|
||||
skillName = "Mining";
|
||||
}
|
||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||
skillName = "Woodcutting";
|
||||
}
|
||||
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
||||
skillName = "Herbalism";
|
||||
}
|
||||
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
||||
skillName = "Excavation";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(skillName)) {
|
||||
configSections.put(skillName, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(skillName);
|
||||
skillContents.add(" " + materialName + "|0:");
|
||||
skillContents.add(" " + " " + "XP_Gain: 99");
|
||||
skillContents.add(" " + " " + "Double_Drops_Enabled: true");
|
||||
|
||||
if (skillName.equals("Mining")) {
|
||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||
}
|
||||
else if (skillName.equals("Woodcutting")) {
|
||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||
}
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under a tool type
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("PICKAXE")) {
|
||||
toolType = "Pickaxes";
|
||||
}
|
||||
else if (materialName.contains("AXE")) {
|
||||
toolType = "Axes";
|
||||
}
|
||||
else if (materialName.contains("BOW")) {
|
||||
toolType = "Bows";
|
||||
}
|
||||
else if (materialName.contains("HOE")) {
|
||||
toolType = "Hoes";
|
||||
}
|
||||
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||
toolType = "Shovels";
|
||||
}
|
||||
else if (materialName.contains("SWORD")) {
|
||||
toolType = "Swords";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
skillContents.add(" " + " " + "XP_Modifier: 1.0");
|
||||
skillContents.add(" " + " " + "Tier: 1");
|
||||
skillContents.add(" " + " " + "Ability_Enabled: true");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under an armor type
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||
toolType = "Boots";
|
||||
}
|
||||
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||
toolType = "Chestplates";
|
||||
}
|
||||
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||
toolType = "Helmets";
|
||||
}
|
||||
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
||||
toolType = "Leggings";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private void addRepairableLines(String materialName, ArrayList<String> skillContents) {
|
||||
skillContents.add(" " + " " + "Repairable: true");
|
||||
skillContents.add(" " + " " + "Repair_Material: REPAIR_MATERIAL_NAME");
|
||||
skillContents.add(" " + " " + "Repair_Material_Data_Value: 0");
|
||||
skillContents.add(" " + " " + "Repair_Material_Quantity: 9");
|
||||
skillContents.add(" " + " " + "Repair_Material_Pretty_Name: Repair Item Name");
|
||||
skillContents.add(" " + " " + "Repair_MinimumLevel: 0");
|
||||
skillContents.add(" " + " " + "Repair_XpMultiplier: 1.0");
|
||||
|
||||
Material material = Material.matchMaterial(materialName);
|
||||
short durability = (material == null) ? (short) 9999 : material.getMaxDurability();
|
||||
skillContents.add(" " + " " + "Durability: " + ((durability > 0) ? durability : (short) 9999));
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and print them
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String configKey = "UNIDENTIFIED";
|
||||
|
||||
if (!configSections.containsKey(configKey)) {
|
||||
configSections.put(configKey, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(configKey);
|
||||
skillContents.add(" " + materialName);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "tft_02@hotmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
if (Permissions.showversion(sender)) {
|
||||
|
||||
@@ -37,6 +37,10 @@ public class MobhealthCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
try {
|
||||
|
||||
@@ -28,6 +28,10 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyCommandAction(UserManager.getPlayer(sender.getName()));
|
||||
return true;
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
|
||||
if (mcMMOPlayer.isChatEnabled(chatMode)) {
|
||||
@@ -53,6 +57,10 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[0])) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
mcMMO.getDatabaseManager().saveUser(profile);
|
||||
}
|
||||
|
||||
new PlayerProfileLoadingTask(player).runTaskTimerAsynchronously(mcMMO.p, 1, 20); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
new PlayerProfileLoadingTask(player).runTaskTimerAsynchronously(mcMMO.p, 1, 20); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
@@ -18,13 +20,14 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
case 2:
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
|
||||
|
||||
if (!playerParty.getMembers().contains(targetName)) {
|
||||
if (!playerParty.hasMember(target.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.setPartyLeader(targetName, playerParty);
|
||||
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@@ -71,6 +71,11 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (args.length < 1) {
|
||||
@@ -129,7 +134,7 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
// Party leader commands
|
||||
if (!mcMMOPlayer.getParty().getLeader().equalsIgnoreCase(player.getName())) {
|
||||
if (!mcMMOPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
|
||||
if (!playerParty.getMembers().contains(targetName)) {
|
||||
if (!playerParty.hasMember(targetName)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
String leaderName = playerParty.getLeader();
|
||||
String leaderName = playerParty.getLeader().getPlayerName();
|
||||
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcMMOTarget.getParty().getLeader().equalsIgnoreCase(targetName)) {
|
||||
if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
|
||||
@@ -34,6 +34,10 @@ public class InspectCommand implements TabExecutor {
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
|
||||
|
||||
if (!CommandUtils.isLoaded(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ public class MccooldownCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -34,6 +35,10 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
display(sender, sender.getName());
|
||||
|
||||
return true;
|
||||
@@ -44,6 +49,10 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
@@ -88,6 +97,13 @@ public class McrankCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ public class McstatsCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -19,7 +20,6 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class MctopCommand implements TabExecutor {
|
||||
@@ -83,6 +83,10 @@ public class MctopCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
@@ -91,6 +95,13 @@ public class MctopCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class TamingCommand extends SkillCommand {
|
||||
private String goreChance;
|
||||
@@ -91,9 +92,13 @@ public class TamingCommand extends SkillCommand {
|
||||
|
||||
if (canCallWild) {
|
||||
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().getTamingCOTWCost(EntityType.OCELOT)));
|
||||
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWCost(EntityType.WOLF)));
|
||||
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWCost(EntityType.HORSE)));
|
||||
int costOcelot = Config.getInstance().getTamingCOTWCost(EntityType.OCELOT);
|
||||
String itemOcelot = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.OCELOT));
|
||||
int costWolf = Config.getInstance().getTamingCOTWCost(EntityType.WOLF);
|
||||
String itemWolf = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.WOLF));
|
||||
int costHorse = Config.getInstance().getTamingCOTWCost(EntityType.HORSE);
|
||||
String itemHorse = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.HORSE));
|
||||
messages.add(LocaleLoader.getString("Taming.Effect.14", costOcelot, itemOcelot, costWolf, itemWolf, costHorse, itemHorse));
|
||||
}
|
||||
|
||||
return messages;
|
||||
|
||||
@@ -420,8 +420,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getAdvancedSalvageUnlockLevel() < 1) {
|
||||
reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 1!");
|
||||
if (getAdvancedSalvageUnlockLevel() < 0) {
|
||||
reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 0!");
|
||||
}
|
||||
|
||||
List<Salvage.Tier> salvageTierList = Arrays.asList(Salvage.Tier.values());
|
||||
@@ -442,8 +442,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
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 (getArcaneSalvageRankLevel(tier) > getArcaneSalvageRankLevel(nextTier)) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextTier.toNumerical() + "!");
|
||||
}
|
||||
|
||||
if (getArcaneSalvageExtractFullEnchantsChance(tier) > getArcaneSalvageExtractFullEnchantsChance(nextTier)) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.gmail.nossr50.database.SQLDatabaseManager.PoolIdentifier;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
@@ -41,6 +42,16 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
reason.add("General.Save_Interval should be greater than 0!");
|
||||
}
|
||||
|
||||
/* MySQL Settings */
|
||||
for (PoolIdentifier identifier : PoolIdentifier.values()) {
|
||||
if (getMySQLMaxConnections(identifier) <= 0) {
|
||||
reason.add("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
|
||||
}
|
||||
if (getMySQLMaxPoolSize(identifier) <= 0) {
|
||||
reason.add("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
|
||||
}
|
||||
}
|
||||
|
||||
/* Mob Healthbar */
|
||||
if (getMobHealthbarTime() == 0) {
|
||||
reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
|
||||
@@ -252,6 +263,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
|
||||
|
||||
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
|
||||
public boolean getRefreshChunksEnabled() { return config.getBoolean("General.Refresh_Chunks", false); }
|
||||
|
||||
/* Mob Healthbar */
|
||||
public MobHealthbarType getMobHealthbarDefault() {
|
||||
@@ -270,6 +282,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
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 getShowAbilityNames() { return config.getBoolean("Scoreboard.Ability_Names", true); }
|
||||
|
||||
public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
|
||||
public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }
|
||||
@@ -314,8 +327,8 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
|
||||
public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
|
||||
public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
|
||||
public int getMySQLMaxConnections() { return config.getInt("MySQL.Database.MaxConnections"); }
|
||||
public int getMySQLMaxPoolSize() { return config.getInt("MySQL.Database.MaxPoolSize"); }
|
||||
public int getMySQLMaxConnections(PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30); }
|
||||
public int getMySQLMaxPoolSize(PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10); }
|
||||
|
||||
private String getStringIncludingInts(String key) {
|
||||
String str = config.getString(key);
|
||||
@@ -370,6 +383,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); }
|
||||
public boolean getBleedEffectEnabled() { return config.getBoolean("Particles.Bleed", true); }
|
||||
public boolean getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); }
|
||||
public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); }
|
||||
public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); }
|
||||
public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); }
|
||||
public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
|
||||
@@ -483,6 +497,8 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||
public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
|
||||
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
|
||||
public int getTamingCOTWLength(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Length"); }
|
||||
public int getTamingCOTWMaxAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Max_Amount"); }
|
||||
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
|
||||
|
||||
/* Woodcutting */
|
||||
|
||||
@@ -6,16 +6,17 @@ import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class HiddenConfig {
|
||||
private static HiddenConfig instance;
|
||||
private static String fileName;
|
||||
private static YamlConfiguration config;
|
||||
private static boolean chunkletsEnabled;
|
||||
private static int conversionRate;
|
||||
private static boolean useEnchantmentBuffs;
|
||||
private static boolean resendChunksAfterBlockAbility;
|
||||
private static int uuidConvertAmount;
|
||||
private String fileName;
|
||||
private YamlConfiguration config;
|
||||
private boolean chunkletsEnabled;
|
||||
private int conversionRate;
|
||||
private boolean useEnchantmentBuffs;
|
||||
private int uuidConvertAmount;
|
||||
private int mojangRateLimit;
|
||||
private long mojangLimitPeriod;
|
||||
|
||||
public HiddenConfig(String fileName) {
|
||||
HiddenConfig.fileName = fileName;
|
||||
this.fileName = fileName;
|
||||
load();
|
||||
}
|
||||
|
||||
@@ -33,8 +34,9 @@ public class HiddenConfig {
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
resendChunksAfterBlockAbility = config.getBoolean("Options.RefreshChunks", false);
|
||||
uuidConvertAmount = config.getInt("Options.UUIDConvertAmount", 5);
|
||||
mojangRateLimit = config.getInt("Options.MojangRateLimit", 50000);
|
||||
mojangLimitPeriod = config.getLong("Options.MojangLimitPeriod", 600000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +52,15 @@ public class HiddenConfig {
|
||||
return useEnchantmentBuffs;
|
||||
}
|
||||
|
||||
public boolean resendChunksAfterBlockAbility() {
|
||||
return resendChunksAfterBlockAbility;
|
||||
}
|
||||
|
||||
public int getUUIDConvertAmount() {
|
||||
return uuidConvertAmount;
|
||||
}
|
||||
|
||||
public int getMojangRateLimit() {
|
||||
return mojangRateLimit;
|
||||
}
|
||||
|
||||
public long getMojangLimitPeriod() {
|
||||
return mojangLimitPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +179,11 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
/* Custom XP perk */
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
|
||||
/* Diminished Returns */
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(SkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
|
||||
/* Conversion */
|
||||
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
||||
|
||||
@@ -207,6 +212,41 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
/* Alchemy */
|
||||
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||
|
||||
/* Excavation */
|
||||
public int getDirtAndSandXp(MaterialData data) {
|
||||
Material type = data.getItemType();
|
||||
|
||||
if (type == Material.DIRT) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Excavation.Dirt", 40);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Excavation.Coarse_Dirt", 40);
|
||||
|
||||
case 0x2:
|
||||
return config.getInt("Experience.Excavation.Podzol", 40);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (type == Material.SAND) {
|
||||
switch (data.getData()) {
|
||||
case 0x0:
|
||||
return config.getInt("Experience.Excavation.Sand", 40);
|
||||
|
||||
case 0x1:
|
||||
return config.getInt("Experience.Excavation.Red_Sand", 40);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Fishing */
|
||||
public int getFishXp(MaterialData data) {
|
||||
switch (data.getData()) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
|
||||
Material repairMaterial = Material.matchMaterial(config.getString(armorType + "." + armorName + ".Repair_Material", ""));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
if (repairable && (repairMaterial == null)) {
|
||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
||||
repairable = false;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||
|
||||
if (repairQuantity == 0) {
|
||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2);
|
||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
||||
}
|
||||
|
||||
String repairItemName = config.getString(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
boolean repairable = config.getBoolean(toolType + "." + toolName + ".Repairable");
|
||||
Material repairMaterial = Material.matchMaterial(config.getString(toolType + "." + toolName + ".Repair_Material", ""));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
if (repairable && (repairMaterial == null)) {
|
||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + toolName);
|
||||
repairable = false;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
||||
|
||||
if (repairQuantity == 0) {
|
||||
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Quantity", 2);
|
||||
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Quantity", 2);
|
||||
}
|
||||
|
||||
String repairItemName = config.getString(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
|
||||
|
||||
@@ -11,8 +11,8 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public interface DatabaseManager {
|
||||
// One month in milliseconds
|
||||
public final long PURGE_TIME = 2630000000L * Config.getInstance().getOldUsersCutoff();
|
||||
// One month in seconds
|
||||
public final long PURGE_TIME = 2630000L * Config.getInstance().getOldUsersCutoff();
|
||||
// During convertUsers, how often to output a status
|
||||
public final int progressInterval = 200;
|
||||
|
||||
@@ -55,7 +55,7 @@ public interface DatabaseManager {
|
||||
/**
|
||||
* Retrieve rank info into a HashMap from SkillType to the rank.
|
||||
* <p>
|
||||
* The special value <code>null</code> is used to represent the Power
|
||||
* The special value {@code null} is used to represent the Power
|
||||
* Level rank (the combination of all skill levels).
|
||||
*
|
||||
* @param playerName The name of the user to retrieve the rankings for
|
||||
@@ -67,8 +67,9 @@ public interface DatabaseManager {
|
||||
* Add a new user to the database.
|
||||
*
|
||||
* @param playerName The name of the player to be added to the database
|
||||
* @param uuid The uuid of the player to be added to the database
|
||||
*/
|
||||
public void newUser(String playerName, String uuid);
|
||||
public void newUser(String playerName, UUID uuid);
|
||||
|
||||
/**
|
||||
* Load a player from the database.
|
||||
|
||||
@@ -86,7 +86,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
else {
|
||||
purgedUsers++;
|
||||
Misc.profileCleanup(character[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +154,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
if (currentTime - lastPlayed > PURGE_TIME) {
|
||||
removedPlayers++;
|
||||
Misc.profileCleanup(name);
|
||||
}
|
||||
else {
|
||||
if (rewrite) {
|
||||
@@ -367,7 +365,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
public Map<SkillType, Integer> readRank(String playerName) {
|
||||
updateLeaderboards();
|
||||
|
||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class);
|
||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
||||
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
||||
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
||||
@@ -378,7 +376,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
return skills;
|
||||
}
|
||||
|
||||
public void newUser(String playerName, String uuid) {
|
||||
public void newUser(String playerName, UUID uuid) {
|
||||
BufferedWriter out = null;
|
||||
synchronized (fileWritingLock) {
|
||||
try {
|
||||
@@ -427,7 +425,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
out.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD
|
||||
out.append("0:"); // Alchemy
|
||||
out.append("0:"); // AlchemyXp
|
||||
out.append(uuid).append(":"); // UUID
|
||||
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
|
||||
|
||||
// Add more in the same format as the line above
|
||||
|
||||
@@ -451,18 +449,14 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
@Deprecated
|
||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||
return loadPlayerProfile(playerName, "", false);
|
||||
return loadPlayerProfile(playerName, null, false);
|
||||
}
|
||||
|
||||
public PlayerProfile loadPlayerProfile(UUID uuid) {
|
||||
return loadPlayerProfile("", uuid.toString(), false);
|
||||
return loadPlayerProfile("", uuid, false);
|
||||
}
|
||||
|
||||
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
||||
return loadPlayerProfile(playerName, uuid.toString(), create);
|
||||
}
|
||||
|
||||
private PlayerProfile loadPlayerProfile(String playerName, String uuid, boolean create) {
|
||||
BufferedReader in = null;
|
||||
String usersFilePath = mcMMO.getUsersFilePath();
|
||||
|
||||
@@ -476,7 +470,15 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
// Find if the line contains the player we want.
|
||||
String[] character = line.split(":");
|
||||
|
||||
if (!character[41].equalsIgnoreCase(uuid) && !character[0].equalsIgnoreCase(playerName)) {
|
||||
// Compare names because we don't have a valid uuid for that player even
|
||||
// if input uuid is not null
|
||||
if (character[41].equalsIgnoreCase("NULL")) {
|
||||
if (!character[0].equalsIgnoreCase(playerName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// If input uuid is not null then we should compare uuids
|
||||
else if ((uuid != null && !character[41].equalsIgnoreCase(uuid.toString())) || (uuid == null && !character[0].equalsIgnoreCase(playerName))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -491,13 +493,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
// Didn't find the player, create a new one
|
||||
if (create) {
|
||||
if (uuid.isEmpty()) {
|
||||
if (uuid == null) {
|
||||
newUser(playerName, uuid);
|
||||
return new PlayerProfile(playerName, true);
|
||||
}
|
||||
|
||||
newUser(playerName, uuid);
|
||||
return new PlayerProfile(playerName, UUID.fromString(uuid), true);
|
||||
return new PlayerProfile(playerName, uuid, true);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -518,11 +520,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
// Return unloaded profile
|
||||
if (uuid.isEmpty()) {
|
||||
if (uuid == null) {
|
||||
return new PlayerProfile(playerName);
|
||||
}
|
||||
|
||||
return new PlayerProfile(playerName, UUID.fromString(uuid));
|
||||
return new PlayerProfile(playerName, uuid);
|
||||
}
|
||||
|
||||
public void convertUsers(DatabaseManager destination) {
|
||||
@@ -641,10 +643,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
if (character.length < 42) {
|
||||
mcMMO.p.getLogger().severe("Could not update UUID for " + character[0] + "!");
|
||||
mcMMO.p.getLogger().severe("Database entry is invalid.");
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
line = line.replace(character[41], fetchedUUIDs.remove(character[0]).toString());
|
||||
character[41] = fetchedUUIDs.remove(character[0]).toString();
|
||||
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
|
||||
}
|
||||
|
||||
writer.append(line).append("\r\n");
|
||||
@@ -943,8 +946,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
if (character.length <= 41) {
|
||||
// Addition of UUIDs
|
||||
// Version 1.5.01
|
||||
// Add a space because otherwise it gets removed
|
||||
newLine.append(" :");
|
||||
// Add a value because otherwise it gets removed
|
||||
newLine.append("NULL:");
|
||||
if (oldVersion == null) {
|
||||
oldVersion = "1.5.01";
|
||||
}
|
||||
|
||||
@@ -7,13 +7,15 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@@ -33,12 +35,15 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
|
||||
private final int POOL_FETCH_TIMEOUT = 0; // How long a method will wait for a connection. Since none are on main thread, we can safely say wait for as long as you like.
|
||||
private final int POOL_FETCH_TIMEOUT = 360000;
|
||||
|
||||
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
|
||||
private final Map<String, Integer> cachedUserIDsByName = new HashMap<String, Integer>();
|
||||
|
||||
private ConnectionPool connectionPool;
|
||||
private ConnectionPool miscPool;
|
||||
private ConnectionPool loadPool;
|
||||
private ConnectionPool savePool;
|
||||
|
||||
private ReentrantLock massUpdateLock = new ReentrantLock();
|
||||
|
||||
protected SQLDatabaseManager() {
|
||||
String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
|
||||
@@ -56,63 +61,70 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
Properties connectionProperties = new Properties();
|
||||
connectionProperties.put("user", Config.getInstance().getMySQLUserName());
|
||||
connectionProperties.put("password", Config.getInstance().getMySQLUserPassword());
|
||||
connectionProperties.put("autoReconnect", "false");
|
||||
connectionProperties.put("autoReconnect", "true");
|
||||
connectionProperties.put("cachePrepStmts", "true");
|
||||
connectionProperties.put("prepStmtCacheSize", "64");
|
||||
connectionProperties.put("prepStmtCacheSqlLimit", "2048");
|
||||
connectionProperties.put("useServerPrepStmts", "true");
|
||||
connectionPool = new ConnectionPool("mcMMO-Pool",
|
||||
1 /*Minimum of one*/,
|
||||
Config.getInstance().getMySQLMaxPoolSize() /*max pool size */,
|
||||
Config.getInstance().getMySQLMaxConnections() /*max num connections*/,
|
||||
0 /* idle timeout of connections */,
|
||||
miscPool = new ConnectionPool("mcMMO-Misc-Pool",
|
||||
0 /*No Minimum really needed*/,
|
||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC) /*max pool size */,
|
||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC) /*max num connections*/,
|
||||
400 /* idle timeout of connections */,
|
||||
connectionString,
|
||||
connectionProperties);
|
||||
connectionPool.init(); // Init first connection
|
||||
connectionPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
||||
loadPool = new ConnectionPool("mcMMO-Load-Pool",
|
||||
1 /*Minimum of one*/,
|
||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD) /*max pool size */,
|
||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD) /*max num connections*/,
|
||||
400 /* idle timeout of connections */,
|
||||
connectionString,
|
||||
connectionProperties);
|
||||
savePool = new ConnectionPool("mcMMO-Save-Pool",
|
||||
1 /*Minimum of one*/,
|
||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE) /*max pool size */,
|
||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE) /*max num connections*/,
|
||||
400 /* idle timeout of connections */,
|
||||
connectionString,
|
||||
connectionProperties);
|
||||
miscPool.init(); // Init first connection
|
||||
miscPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
||||
loadPool.init();
|
||||
loadPool.registerShutdownHook();
|
||||
savePool.init();
|
||||
savePool.registerShutdownHook();
|
||||
|
||||
checkStructure();
|
||||
|
||||
}
|
||||
|
||||
public void purgePowerlessUsers() {
|
||||
massUpdateLock.lock();
|
||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
||||
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
List<String> usernames = new ArrayList<String>();
|
||||
int purged = 0;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT u.user FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE s.user_id = u.id AND (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0");
|
||||
|
||||
while (resultSet.next()) {
|
||||
usernames.add(resultSet.getString("user"));
|
||||
}
|
||||
purged = statement.executeUpdate("DELETE FROM " + tablePrefix + "skills WHERE "
|
||||
+ "taming = 0 AND mining = 0 AND woodcutting = 0 AND repair = 0 "
|
||||
+ "AND unarmed = 0 AND herbalism = 0 AND excavation = 0 AND "
|
||||
+ "archery = 0 AND swords = 0 AND axes = 0 AND acrobatics = 0 "
|
||||
+ "AND fishing = 0 AND alchemy = 0;");
|
||||
|
||||
resultSet.close();
|
||||
|
||||
statement.executeUpdate("DELETE FROM u, e, h, s, c USING " + tablePrefix + "users u " +
|
||||
"JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " +
|
||||
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
|
||||
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
|
||||
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
|
||||
"WHERE (s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing) = 0");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "experience`.`user_id` = `s`.`user_id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "huds`.`user_id` = `s`.`user_id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `s`.`user_id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "users` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "skills` `s` WHERE `" + tablePrefix + "users`.`id` = `s`.`user_id`)");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
@@ -129,53 +141,35 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
massUpdateLock.unlock();
|
||||
}
|
||||
|
||||
if (!usernames.isEmpty()) {
|
||||
processPurge(usernames);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Purged " + usernames.size() + " users from the database.");
|
||||
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
|
||||
}
|
||||
|
||||
public void purgeOldUsers() {
|
||||
mcMMO.p.getLogger().info("Purging old users...");
|
||||
massUpdateLock.lock();
|
||||
mcMMO.p.getLogger().info("Purging inactive users older than " + (PURGE_TIME / 2630000L) + " months...");
|
||||
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
List<String> usernames = new ArrayList<String>();
|
||||
int purged = 0;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT user FROM " + tablePrefix + "users WHERE ((NOW() - lastlogin * " + Misc.TIME_CONVERSION_FACTOR + ") > " + PURGE_TIME + ")");
|
||||
|
||||
while (resultSet.next()) {
|
||||
usernames.add(resultSet.getString("user"));
|
||||
}
|
||||
|
||||
resultSet.close();
|
||||
|
||||
statement.executeUpdate("DELETE FROM u, e, h, s, c USING " + tablePrefix + "users u " +
|
||||
purged = statement.executeUpdate("DELETE FROM u, e, h, s, c USING " + tablePrefix + "users u " +
|
||||
"JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " +
|
||||
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
|
||||
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
|
||||
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
|
||||
"WHERE ((NOW() - lastlogin * " + Misc.TIME_CONVERSION_FACTOR + ") > " + PURGE_TIME + ")");
|
||||
"WHERE ((UNIX_TIMESTAMP() - lastlogin) > " + PURGE_TIME + ")");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
@@ -192,13 +186,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
massUpdateLock.unlock();
|
||||
}
|
||||
|
||||
if (!usernames.isEmpty()) {
|
||||
processPurge(usernames);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Purged " + usernames.size() + " users from the database.");
|
||||
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
|
||||
}
|
||||
|
||||
public boolean removeUser(String playerName) {
|
||||
@@ -207,7 +198,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("DELETE FROM u, e, h, s, c " +
|
||||
"USING " + tablePrefix + "users u " +
|
||||
"JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) " +
|
||||
@@ -255,20 +246,19 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.SAVE);
|
||||
|
||||
int id = getUserID(connection, profile.getUniqueId());
|
||||
int id = getUserID(connection, profile.getPlayerName(), profile.getUniqueId());
|
||||
|
||||
if (id == -1) {
|
||||
newUser(profile.getPlayerName(), profile.getUniqueId().toString());
|
||||
id = getUserID(connection, profile.getUniqueId());
|
||||
id = newUser(connection, profile.getPlayerName(), profile.getUniqueId());
|
||||
if (id == -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "users SET lastlogin = UNIX_TIMESTAMP() WHERE uuid = ?");
|
||||
statement.setString(1, profile.getUniqueId().toString());
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "users SET lastlogin = UNIX_TIMESTAMP() WHERE id = ?");
|
||||
statement.setInt(1, id);
|
||||
success &= (statement.executeUpdate() != 0);
|
||||
statement.close();
|
||||
|
||||
@@ -336,6 +326,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.setString(1, profile.getMobHealthbarType() == null ? Config.getInstance().getMobHealthbarDefault().name() : profile.getMobHealthbarType().name());
|
||||
statement.setInt(2, id);
|
||||
success = (statement.executeUpdate() != 0);
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
@@ -371,7 +362,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT ?, ?");
|
||||
statement.setInt(1, (pageNumber * statsPerPage) - statsPerPage);
|
||||
statement.setInt(2, statsPerPage);
|
||||
@@ -421,14 +412,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
public Map<SkillType, Integer> readRank(String playerName) {
|
||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class);
|
||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
String skillName = skillType.name().toLowerCase();
|
||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||
@@ -535,11 +526,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
return skills;
|
||||
}
|
||||
|
||||
public void newUser(String playerName, String uuid) {
|
||||
public void newUser(String playerName, UUID uuid) {
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
newUser(connection, playerName, uuid);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
@@ -557,24 +548,24 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void newUser(Connection connection, String playerName, String uuid) {
|
||||
private int newUser(Connection connection, String playerName, UUID uuid) {
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("INSERT INTO " + tablePrefix + "users (user, uuid, lastlogin) VALUES (?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||
statement = connection.prepareStatement("INSERT INTO " + tablePrefix + "users (user, uuid, lastlogin) VALUES (?, ?, UNIX_TIMESTAMP())", Statement.RETURN_GENERATED_KEYS);
|
||||
statement.setString(1, playerName);
|
||||
statement.setString(2, uuid);
|
||||
statement.setLong(3, System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.executeUpdate();
|
||||
|
||||
resultSet = statement.getGeneratedKeys();
|
||||
|
||||
if (!resultSet.next()) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
writeMissingRows(connection, resultSet.getInt(1));
|
||||
return resultSet.getInt(1);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
@@ -597,131 +588,42 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a fallback method to provide the old way of getting a
|
||||
* PlayerProfile in case there is no UUID match found
|
||||
*/
|
||||
private PlayerProfile loadPlayerNameProfile(String playerName, String uuid, boolean create, boolean retry) {
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
int id = getUserID(connection, playerName);
|
||||
|
||||
if (id == -1) {
|
||||
// There is no such user
|
||||
if (create) {
|
||||
newUser(playerName, uuid);
|
||||
return loadPlayerNameProfile(playerName, uuid, false, false);
|
||||
}
|
||||
|
||||
// Return unloaded profile if can't create
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
// There is such a user
|
||||
writeMissingRows(connection, id);
|
||||
|
||||
statement = connection.prepareStatement(
|
||||
"SELECT "
|
||||
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
|
||||
+ "e.taming, e.mining, e.repair, e.woodcutting, e.unarmed, e.herbalism, e.excavation, e.archery, e.swords, e.axes, e.acrobatics, e.fishing, e.alchemy, "
|
||||
+ "c.taming, c.mining, c.repair, c.woodcutting, c.unarmed, c.herbalism, c.excavation, c.archery, c.swords, c.axes, c.acrobatics, c.blast_mining, "
|
||||
+ "h.mobhealthbar, u.uuid "
|
||||
+ "FROM " + tablePrefix + "users u "
|
||||
+ "JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) "
|
||||
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
|
||||
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
|
||||
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
|
||||
+ "WHERE u.user = ?");
|
||||
statement.setString(1, playerName);
|
||||
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
try {
|
||||
PlayerProfile ret = loadFromResult(playerName, resultSet);
|
||||
return ret;
|
||||
}
|
||||
catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Problem, nothing was returned
|
||||
|
||||
// Quit if this is second time around
|
||||
if (!retry) {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
// Retry, and abort on re-failure
|
||||
return loadPlayerNameProfile(playerName, uuid, create, false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PlayerProfile loadPlayerProfile(String playerName, boolean create) {
|
||||
return loadPlayerProfile(playerName, "", false, true);
|
||||
return loadPlayerProfile(playerName, null, false, true);
|
||||
}
|
||||
|
||||
public PlayerProfile loadPlayerProfile(UUID uuid) {
|
||||
return loadPlayerProfile("", uuid.toString(), false, true);
|
||||
return loadPlayerProfile("", uuid, false, true);
|
||||
}
|
||||
|
||||
public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) {
|
||||
return loadPlayerProfile(playerName, uuid.toString(), create, true);
|
||||
return loadPlayerProfile(playerName, uuid, create, true);
|
||||
}
|
||||
|
||||
private PlayerProfile loadPlayerProfile(String playerName, String uuid, boolean create, boolean retry) {
|
||||
private PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create, boolean retry) {
|
||||
PreparedStatement statement = null;
|
||||
Connection connection = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
int id = getUserID(connection, playerName);
|
||||
connection = getConnection(PoolIdentifier.LOAD);
|
||||
int id = getUserID(connection, playerName, uuid);
|
||||
|
||||
if (id == -1) {
|
||||
// There is no such user
|
||||
if (create) {
|
||||
newUser(playerName, uuid);
|
||||
return loadPlayerNameProfile(playerName, uuid, false, false);
|
||||
id = newUser(connection, playerName, uuid);
|
||||
create = false;
|
||||
if (id == -1) {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
} else {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
// Return unloaded profile if can't create
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
// There is such a user
|
||||
writeMissingRows(connection, id);
|
||||
@@ -737,8 +639,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ "JOIN " + tablePrefix + "experience e ON (u.id = e.user_id) "
|
||||
+ "JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) "
|
||||
+ "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) "
|
||||
+ "WHERE u.uuid = ?");
|
||||
statement.setString(1, uuid);
|
||||
+ "WHERE u.id = ?");
|
||||
statement.setInt(1, id);
|
||||
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
@@ -751,10 +653,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
if (!playerName.isEmpty() && !profile.getPlayerName().isEmpty()) {
|
||||
statement = connection.prepareStatement(
|
||||
"UPDATE `" + tablePrefix + "users` "
|
||||
+ "SET user = ? "
|
||||
+ "WHERE uuid = ?");
|
||||
+ "SET user = ?, uuid = ? "
|
||||
+ "WHERE id = ?");
|
||||
statement.setString(1, playerName);
|
||||
statement.setString(2, uuid);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.setInt(3, id);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
@@ -798,9 +701,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
// Problem, nothing was returned
|
||||
|
||||
// Retry the old fashioned way if this is second time around
|
||||
// return unloaded profile
|
||||
if (!retry) {
|
||||
return loadPlayerNameProfile(playerName, uuid, create, true);
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
// Retry, and abort on re-failure
|
||||
@@ -813,7 +716,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement(
|
||||
"SELECT "
|
||||
+ "s.taming, s.mining, s.repair, s.woodcutting, s.unarmed, s.herbalism, s.excavation, s.archery, s.swords, s.axes, s.acrobatics, s.fishing, s.alchemy, "
|
||||
@@ -881,7 +784,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement(
|
||||
"UPDATE `" + tablePrefix + "users` SET "
|
||||
+ " uuid = ? WHERE user = ?");
|
||||
@@ -921,7 +824,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "users SET uuid = ? WHERE user = ?");
|
||||
|
||||
for (Map.Entry<String, UUID> entry : fetchedUUIDs.entrySet()) {
|
||||
@@ -976,7 +879,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT user FROM " + tablePrefix + "users");
|
||||
while (resultSet.next()) {
|
||||
@@ -1021,14 +924,22 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
*/
|
||||
private void checkStructure() {
|
||||
|
||||
Statement statement = null;
|
||||
PreparedStatement statement = null;
|
||||
Statement createStatement = null;
|
||||
ResultSet resultSet = null;
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
connection = connectionPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
statement = connection.createStatement();
|
||||
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` ("
|
||||
connection = getConnection(PoolIdentifier.MISC);
|
||||
statement = connection.prepareStatement("SELECT table_name FROM INFORMATION_SCHEMA.TABLES"
|
||||
+ " WHERE table_schema = ?"
|
||||
+ " AND table_name = ?");
|
||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
||||
statement.setString(2, tablePrefix + "users");
|
||||
resultSet = statement.executeQuery();
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` ("
|
||||
+ "`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`uuid` varchar(36) NULL DEFAULT NULL,"
|
||||
@@ -1036,76 +947,121 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "UNIQUE KEY `user` (`user`),"
|
||||
+ "UNIQUE KEY `uuid` (`uuid`)) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
createStatement.close();
|
||||
}
|
||||
resultSet.close();
|
||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
||||
statement.setString(2, tablePrefix + "huds");
|
||||
resultSet = statement.executeQuery();
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
createStatement.close();
|
||||
}
|
||||
resultSet.close();
|
||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
||||
statement.setString(2, tablePrefix + "cooldowns");
|
||||
resultSet = statement.executeQuery();
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
createStatement.close();
|
||||
}
|
||||
resultSet.close();
|
||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
||||
statement.setString(2, tablePrefix + "skills");
|
||||
resultSet = statement.executeQuery();
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
createStatement.close();
|
||||
}
|
||||
resultSet.close();
|
||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
||||
statement.setString(2, tablePrefix + "experience");
|
||||
resultSet = statement.executeQuery();
|
||||
if (!resultSet.next()) {
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` ("
|
||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`fishing` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`alchemy` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) "
|
||||
+ "DEFAULT CHARSET=latin1;");
|
||||
createStatement.close();
|
||||
}
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
|
||||
for (UpgradeType updateType : UpgradeType.values()) {
|
||||
checkDatabaseStructure(connection, updateType);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Killing orphans");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "experience`.`user_id` = `u`.`id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "huds`.`user_id` = `u`.`id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `u`.`id`)");
|
||||
statement.executeUpdate("DELETE FROM `" + tablePrefix + "skills` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "skills`.`user_id` = `u`.`id`)");
|
||||
createStatement = connection.createStatement();
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "experience` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "experience`.`user_id` = `u`.`id`)");
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "huds` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "huds`.`user_id` = `u`.`id`)");
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "cooldowns` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "cooldowns`.`user_id` = `u`.`id`)");
|
||||
createStatement.executeUpdate("DELETE FROM `" + tablePrefix + "skills` WHERE NOT EXISTS (SELECT * FROM `" + tablePrefix + "users` `u` WHERE `" + tablePrefix + "skills`.`user_id` = `u`.`id`)");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
@@ -1114,6 +1070,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (createStatement != null) {
|
||||
try {
|
||||
createStatement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
@@ -1126,6 +1090,25 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
}
|
||||
|
||||
private Connection getConnection(PoolIdentifier identifier) throws SQLException {
|
||||
Connection connection = null;
|
||||
switch (identifier) {
|
||||
case LOAD:
|
||||
connection = loadPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
break;
|
||||
case MISC:
|
||||
connection = miscPool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
break;
|
||||
case SAVE:
|
||||
connection = savePool.getConnection(POOL_FETCH_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
if (connection == null) {
|
||||
throw new RuntimeException("getConnection() for " + identifier.name().toLowerCase() + " pool timed out. Increase max connections settings.");
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database structure for necessary upgrades.
|
||||
*
|
||||
@@ -1237,12 +1220,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void processPurge(Collection<String> usernames) {
|
||||
for (String user : usernames) {
|
||||
Misc.profileCleanup(user);
|
||||
}
|
||||
}
|
||||
|
||||
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||
Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
||||
Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
||||
@@ -1316,7 +1293,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
private void printErrors(SQLException ex) {
|
||||
StackTraceElement element = ex.getStackTrace()[0];
|
||||
mcMMO.p.getLogger().severe("Location: " + element.getMethodName() + " " + element.getLineNumber());
|
||||
mcMMO.p.getLogger().severe("Location: " + element.getClassName() + " " + element.getMethodName() + " " + element.getLineNumber());
|
||||
mcMMO.p.getLogger().severe("SQLException: " + ex.getMessage());
|
||||
mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState());
|
||||
mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode());
|
||||
@@ -1406,7 +1383,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
private void checkUpgradeAddUUIDs(final Statement statement) {
|
||||
List<String> names = new ArrayList<String>();
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try {
|
||||
@@ -1442,29 +1418,57 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
resultSet = statement.executeQuery("SELECT `user` FROM `" + tablePrefix + "users` WHERE `uuid` IS NULL");
|
||||
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
|
||||
}
|
||||
|
||||
while (resultSet.next()) {
|
||||
names.add(resultSet.getString("user"));
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
private class GetUUIDUpdatesRequired extends BukkitRunnable {
|
||||
public void run() {
|
||||
massUpdateLock.lock();
|
||||
List<String> names = new ArrayList<String>();
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
connection = miscPool.getConnection();
|
||||
statement = connection.createStatement();
|
||||
resultSet = statement.executeQuery("SELECT `user` FROM `" + tablePrefix + "users` WHERE `uuid` IS NULL");
|
||||
|
||||
if (!names.isEmpty()) {
|
||||
new UUIDUpdateAsyncTask(mcMMO.p, names).runTaskAsynchronously(mcMMO.p);
|
||||
while (resultSet.next()) {
|
||||
names.add(resultSet.getString("user"));
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
} finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
} catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
} catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!names.isEmpty()) {
|
||||
new UUIDUpdateAsyncTask(mcMMO.p, names).run();;
|
||||
}
|
||||
} finally {
|
||||
massUpdateLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1540,61 +1544,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
private int getUserID(final Connection connection, final String playerName) {
|
||||
Integer id = cachedUserIDsByName.get(playerName.toLowerCase());
|
||||
if (id != null) {
|
||||
return id;
|
||||
}
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, uuid FROM " + tablePrefix + "users WHERE user = ?");
|
||||
statement.setString(1, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
id = resultSet.getInt("id");
|
||||
|
||||
cachedUserIDsByName.put(playerName.toLowerCase(), id);
|
||||
|
||||
try {
|
||||
cachedUserIDs.put(UUID.fromString(resultSet.getString("uuid")), id);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
finally {
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
if (statement != null) {
|
||||
try {
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int getUserID(final Connection connection, final UUID uuid) {
|
||||
private int getUserID(final Connection connection, final String playerName, final UUID uuid) {
|
||||
if (cachedUserIDs.containsKey(uuid)) {
|
||||
return cachedUserIDs.get(uuid);
|
||||
}
|
||||
@@ -1603,15 +1553,15 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
PreparedStatement statement = null;
|
||||
|
||||
try {
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE uuid = ?");
|
||||
statement = connection.prepareStatement("SELECT id, user FROM " + tablePrefix + "users WHERE uuid = ? OR (uuid IS NULL AND user = ?)");
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, playerName);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
int id = resultSet.getInt("id");
|
||||
|
||||
cachedUserIDs.put(uuid, id);
|
||||
cachedUserIDsByName.put(resultSet.getString("user").toLowerCase(), id);
|
||||
|
||||
return id;
|
||||
}
|
||||
@@ -1643,6 +1593,15 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
connectionPool.release();
|
||||
mcMMO.p.debug("Releasing connection pool resource...");
|
||||
miscPool.release();
|
||||
loadPool.release();
|
||||
savePool.release();
|
||||
}
|
||||
|
||||
public enum PoolIdentifier {
|
||||
MISC,
|
||||
LOAD,
|
||||
SAVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,6 @@ public enum UpgradeType {
|
||||
DROP_SQL_PARTY_NAMES,
|
||||
DROP_SPOUT,
|
||||
ADD_ALCHEMY,
|
||||
ADD_UUIDS;
|
||||
ADD_UUIDS,
|
||||
ADD_UUIDS_PARTY;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.gmail.nossr50.datatypes.experience;
|
||||
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public class SkillXpGain implements Delayed {
|
||||
private final long expiryTime;
|
||||
private final float xp;
|
||||
private final SkillType type;
|
||||
|
||||
public SkillXpGain(SkillType type, float xp) {
|
||||
this.expiryTime = System.currentTimeMillis() + getDuration();
|
||||
this.xp = xp;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SkillType getSkill() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public float getXp() {
|
||||
return xp;
|
||||
}
|
||||
|
||||
private static long getDuration() {
|
||||
return TimeUnit.MINUTES.toMillis(ExperienceConfig.getInstance().getDiminishedReturnsTimeInterval());
|
||||
}
|
||||
|
||||
public int compareTo(SkillXpGain other) {
|
||||
if (this.expiryTime < other.expiryTime) {
|
||||
return -1;
|
||||
}
|
||||
else if (this.expiryTime > other.expiryTime) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Delayed other) {
|
||||
if (other instanceof SkillXpGain) {
|
||||
// Use more efficient method if possible (private fields)
|
||||
return this.compareTo((SkillXpGain) other);
|
||||
}
|
||||
return (int) (getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit arg0) {
|
||||
return arg0.convert(expiryTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
@@ -20,9 +22,10 @@ import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class Party {
|
||||
private final LinkedHashSet<String> members = new LinkedHashSet<String>();
|
||||
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<UUID, String>();
|
||||
private final List<Player> onlineMembers = new ArrayList<Player>();
|
||||
|
||||
private String leader;
|
||||
private PartyLeader leader;
|
||||
private String name;
|
||||
private String password;
|
||||
private boolean locked;
|
||||
@@ -43,14 +46,14 @@ public class Party {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Party(String leader, String name) {
|
||||
public Party(PartyLeader leader, String name) {
|
||||
this.leader = leader;
|
||||
this.name = name;
|
||||
this.locked = true;
|
||||
this.level = 0;
|
||||
}
|
||||
|
||||
public Party(String leader, String name, String password) {
|
||||
public Party(PartyLeader leader, String name, String password) {
|
||||
this.leader = leader;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
@@ -58,7 +61,7 @@ public class Party {
|
||||
this.level = 0;
|
||||
}
|
||||
|
||||
public Party(String leader, String name, String password, boolean locked) {
|
||||
public Party(PartyLeader leader, String name, String password, boolean locked) {
|
||||
this.leader = leader;
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
@@ -66,21 +69,11 @@ public class Party {
|
||||
this.level = 0;
|
||||
}
|
||||
|
||||
public LinkedHashSet<String> getMembers() {
|
||||
public LinkedHashMap<UUID, String> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public List<Player> getOnlineMembers() {
|
||||
List<Player> onlineMembers = new ArrayList<Player>();
|
||||
|
||||
for (String memberName : members) {
|
||||
Player member = mcMMO.p.getServer().getPlayerExact(memberName);
|
||||
|
||||
if (member != null) {
|
||||
onlineMembers.add(member);
|
||||
}
|
||||
}
|
||||
|
||||
return onlineMembers;
|
||||
}
|
||||
|
||||
@@ -97,11 +90,19 @@ public class Party {
|
||||
return onlinePlayerNames;
|
||||
}
|
||||
|
||||
public boolean addOnlineMember(Player player) {
|
||||
return onlineMembers.add(player);
|
||||
}
|
||||
|
||||
public boolean removeOnlineMember(Player player) {
|
||||
return onlineMembers.remove(player);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getLeader() {
|
||||
public PartyLeader getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ public class Party {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setLeader(String leader) {
|
||||
public void setLeader(PartyLeader leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
@@ -220,7 +221,8 @@ public class Party {
|
||||
}
|
||||
|
||||
if (!Config.getInstance().getPartyInformAllMembers()) {
|
||||
Player leader = mcMMO.p.getServer().getPlayer(this.leader);
|
||||
Player leader = mcMMO.p.getServer().getPlayer(this.leader.getUniqueId());
|
||||
|
||||
if (leader != null) {
|
||||
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
|
||||
|
||||
@@ -303,13 +305,24 @@ public class Party {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasMember(String memberName) {
|
||||
return this.getMembers().values().contains(memberName);
|
||||
}
|
||||
|
||||
public boolean hasMember(UUID uuid) {
|
||||
return this.getMembers().keySet().contains(uuid);
|
||||
}
|
||||
|
||||
public String createMembersList(String playerName, List<Player> nearMembers) {
|
||||
StringBuilder memberList = new StringBuilder();
|
||||
|
||||
for (String memberName : this.getMembers()) {
|
||||
Player member = mcMMO.p.getServer().getPlayerExact(memberName);
|
||||
for (Entry<UUID, String> memberEntry : this.getMembers().entrySet()) {
|
||||
UUID uuid = memberEntry.getKey();
|
||||
String memberName = memberEntry.getValue();
|
||||
|
||||
if (this.getLeader().equalsIgnoreCase(memberName)) {
|
||||
Player member = mcMMO.p.getServer().getPlayer(uuid);
|
||||
|
||||
if (this.getLeader().getUniqueId().equals(uuid)) {
|
||||
memberList.append(ChatColor.GOLD);
|
||||
|
||||
if (member == null) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PartyLeader {
|
||||
private UUID uuid;
|
||||
private String playerName;
|
||||
|
||||
public PartyLeader(UUID uuid, String playerName) {
|
||||
this.uuid = uuid;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
public UUID getUniqueId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return playerName;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,10 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
@@ -100,9 +98,13 @@ public class McMMOPlayer {
|
||||
this.player = player;
|
||||
playerMetadata = new FixedMetadataValue(mcMMO.p, playerName);
|
||||
this.profile = profile;
|
||||
party = PartyManager.getPlayerParty(playerName);
|
||||
party = PartyManager.getPlayerParty(playerName, uuid);
|
||||
ptpRecord = new PartyTeleportRecord();
|
||||
|
||||
if (inParty()) {
|
||||
loginParty();
|
||||
}
|
||||
|
||||
if (profile.getUniqueId() == null) {
|
||||
profile.setUniqueId(uuid);
|
||||
}
|
||||
@@ -579,6 +581,14 @@ public class McMMOPlayer {
|
||||
allianceInvite = null;
|
||||
}
|
||||
|
||||
public void loginParty() {
|
||||
party.addOnlineMember(this.getPlayer());
|
||||
}
|
||||
|
||||
public void logoutParty() {
|
||||
party.removeOnlineMember(this.getPlayer());
|
||||
}
|
||||
|
||||
public int getItemShareModifier() {
|
||||
if (itemShareModifier < 10) {
|
||||
setItemShareModifier(10);
|
||||
|
||||
@@ -4,12 +4,14 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||
@@ -32,6 +34,10 @@ public class PlayerProfile {
|
||||
private final Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
|
||||
private final Map<AbilityType, Integer> abilityDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
|
||||
|
||||
// Store previous XP gains for deminished returns
|
||||
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
|
||||
private HashMap<SkillType, Float> rollingSkillsXp = new HashMap<SkillType, Float>();
|
||||
|
||||
@Deprecated
|
||||
public PlayerProfile(String playerName) {
|
||||
this(playerName, null);
|
||||
@@ -214,6 +220,16 @@ public class PlayerProfile {
|
||||
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
||||
}
|
||||
|
||||
public void removeXp(SkillType skill, float xp) {
|
||||
if (skill.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
|
||||
changed = true;
|
||||
|
||||
skillsXp.put(skill, skillsXp.get(skill) - xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a skill level.
|
||||
*
|
||||
@@ -264,7 +280,46 @@ public class PlayerProfile {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total amount of Xp before the next level.
|
||||
* Get the registered amount of experience gained
|
||||
* This is used for diminished XP returns
|
||||
*
|
||||
* @return xp Experience amount registered
|
||||
*/
|
||||
public float getRegisteredXpGain(SkillType skillType) {
|
||||
float xp = 0F;
|
||||
|
||||
if (rollingSkillsXp.get(skillType) != null) {
|
||||
xp = rollingSkillsXp.get(skillType);
|
||||
}
|
||||
|
||||
return xp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an experience gain
|
||||
* This is used for diminished XP returns
|
||||
*
|
||||
* @param skillType Skill being used
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void registerXpGain(SkillType skillType, float xp) {
|
||||
gainedSkillsXp.add(new SkillXpGain(skillType, xp));
|
||||
rollingSkillsXp.put(skillType, getRegisteredXpGain(skillType) + xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove experience gains older than a given time
|
||||
* This is used for diminished XP returns
|
||||
*/
|
||||
public void purgeExpiredXpGains() {
|
||||
SkillXpGain gain;
|
||||
while ((gain = gainedSkillsXp.poll()) != null) {
|
||||
rollingSkillsXp.put(gain.getSkill(), getRegisteredXpGain(gain.getSkill()) - gain.getXp());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of Xp remaining before the next level.
|
||||
*
|
||||
* @param skillType Type of skill to check
|
||||
* @return the total amount of Xp until next level
|
||||
|
||||
@@ -85,30 +85,67 @@ public enum AbilityType {
|
||||
this.abilityPlayerOff = abilityPlayerOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cooldown time in seconds for this ability
|
||||
*
|
||||
* @return cooldown time in seconds
|
||||
*/
|
||||
public int getCooldown() {
|
||||
return Config.getInstance().getCooldown(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum length in seconds for this ability
|
||||
*
|
||||
* @return maximum length in seconds
|
||||
*/
|
||||
public int getMaxLength() {
|
||||
return Config.getInstance().getMaxLength(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale string for when the ability activates
|
||||
*
|
||||
* @return localized activation message
|
||||
*/
|
||||
public String getAbilityOn() {
|
||||
return LocaleLoader.getString(this.abilityOn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale string for when the ability deactivates
|
||||
*
|
||||
* @return localized deactivation message
|
||||
*/
|
||||
public String getAbilityOff() {
|
||||
return LocaleLoader.getString(this.abilityOff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale string for nearby players when someone activates this ability
|
||||
*
|
||||
* @param player {@link Player} object that activates this ability
|
||||
* @return localized activation message
|
||||
*/
|
||||
public String getAbilityPlayer(Player player) {
|
||||
return LocaleLoader.getString(this.abilityPlayer, player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale string for nearby players when someone deactivates this ability
|
||||
*
|
||||
* @param player {@link Player} object that deactivates this ability
|
||||
* @return localized deactivation message
|
||||
*/
|
||||
public String getAbilityPlayerOff(Player player) {
|
||||
return LocaleLoader.getString(this.abilityPlayerOff, player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ability refresh message
|
||||
*
|
||||
* @return Localized ability refresh message
|
||||
*/
|
||||
public String getAbilityRefresh() {
|
||||
return LocaleLoader.getString(this.abilityRefresh);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
public enum ModConfigType {
|
||||
BLOCKS,
|
||||
TOOLS,
|
||||
ARMOR,
|
||||
UNKNOWN;
|
||||
|
||||
public static ModConfigType getModConfigType(String materialName) {
|
||||
if (materialName.contains("HELM") || (materialName.contains("CHEST") && !materialName.contains("CHESTNUT")) || materialName.contains("LEGS") || materialName.contains("LEGGINGS") || materialName.contains("BOOT")) {
|
||||
return ARMOR;
|
||||
}
|
||||
else if (materialName.contains("PICKAXE") || materialName.contains("AXE") || (materialName.contains("BOW") && !materialName.contains("BOWL")) || materialName.contains("HOE") || materialName.contains("SHOVEL") || materialName.contains("SWORD")) {
|
||||
return TOOLS;
|
||||
}
|
||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES") || materialName.contains("FLOWER") || materialName.contains("PLANT") || materialName.contains("CROP") || materialName.contains("ORE") || materialName.contains("DIRT") || materialName.contains("SAND") || materialName.contains("GRASS")) {
|
||||
return BLOCKS;
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ public enum SecondaryAbility {
|
||||
SHARPENED_CLAWS,
|
||||
SHOCK_PROOF,
|
||||
THICK_FUR,
|
||||
PUMMEL,
|
||||
|
||||
/* Unarmed */
|
||||
BLOCK_CRACKER,
|
||||
|
||||
@@ -48,7 +48,7 @@ public enum SkillType {
|
||||
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)),
|
||||
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, SecondaryAbility.PUMMEL)),
|
||||
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
|
||||
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
|
||||
|
||||
|
||||
@@ -1,18 +1,47 @@
|
||||
package com.gmail.nossr50.events.hardcore;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancellable {
|
||||
private HashMap<String, Integer> levelChanged;
|
||||
private HashMap<String, Float> experienceChanged;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerDeathPenaltyEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
|
||||
super(player);
|
||||
this.levelChanged = levelChanged;
|
||||
this.experienceChanged = experienceChanged;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public McMMOPlayerDeathPenaltyEvent(Player player) {
|
||||
super(player);
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getLevelChanged() {
|
||||
return levelChanged;
|
||||
}
|
||||
|
||||
public void setLevelChanged(HashMap<String, Integer> levelChanged) {
|
||||
this.levelChanged = levelChanged;
|
||||
}
|
||||
|
||||
public HashMap<String, Float> getExperienceChanged() {
|
||||
return experienceChanged;
|
||||
}
|
||||
|
||||
public void setExperienceChanged(HashMap<String, Float> experienceChanged) {
|
||||
this.experienceChanged = experienceChanged;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.gmail.nossr50.events.hardcore;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class McMMOPlayerPreDeathPenaltyEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerPreDeathPenaltyEvent(Player player) {
|
||||
super(player);
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.gmail.nossr50.events.hardcore;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class McMMOPlayerStatLossEvent extends McMMOPlayerDeathPenaltyEvent {
|
||||
|
||||
public McMMOPlayerStatLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
|
||||
super(player, levelChanged, experienceChanged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.gmail.nossr50.events.hardcore;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class McMMOPlayerVampirismEvent extends McMMOPlayerDeathPenaltyEvent {
|
||||
private boolean isVictim;
|
||||
|
||||
public McMMOPlayerVampirismEvent(Player player, boolean isVictim, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
|
||||
super(player, levelChanged, experienceChanged);
|
||||
this.isVictim = isVictim;
|
||||
}
|
||||
|
||||
public boolean isVictim() {
|
||||
return isVictim;
|
||||
}
|
||||
}
|
||||
@@ -615,7 +615,7 @@ public class EntityListener implements Listener {
|
||||
Player player = (Player) target;
|
||||
Tameable tameable = (Tameable) entity;
|
||||
|
||||
if (!CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +140,8 @@ public class PlayerListener implements Listener {
|
||||
|
||||
Player killer = killedPlayer.getKiller();
|
||||
|
||||
|
||||
if (statLossEnabled || (killer != null && vampirismEnabled)) {
|
||||
if (EventUtils.callDeathPenaltyEvent(killedPlayer).isCancelled()) {
|
||||
if (EventUtils.callPreDeathPenaltyEvent(killedPlayer).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -368,6 +367,10 @@ public class PlayerListener implements Listener {
|
||||
mcMMOPlayer.getProfile().scheduleAsyncSave();
|
||||
UserManager.remove(player);
|
||||
ScoreboardManager.teardownPlayer(player);
|
||||
|
||||
if (mcMMOPlayer.inParty()) {
|
||||
mcMMOPlayer.logoutParty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +390,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
new PlayerProfileLoadingTask(player).runTaskTimerAsynchronously(mcMMO.p, 1, 20); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
Motd.displayAll(player);
|
||||
@@ -464,6 +467,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
||||
if (!(heldItem.getEnchantments().size() > 0) || salvageManager.checkConfirmation(true)) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
salvageManager.handleSalvage(block.getLocation(), heldItem);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
@@ -6,10 +6,13 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
public class SelfListener implements Listener {
|
||||
@@ -38,4 +41,46 @@ public class SelfListener implements Listener {
|
||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
SkillType skillType = event.getSkill();
|
||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
|
||||
|
||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
// Diminished returns is turned off
|
||||
return;
|
||||
}
|
||||
|
||||
final float rawXp = event.getRawXpGained();
|
||||
if (rawXp < 0) {
|
||||
// Don't calculate for XP subtraction
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (skillType.isChildSkill()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float modifiedThreshold = (float) (threshold / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(skillType) - modifiedThreshold) / modifiedThreshold;
|
||||
|
||||
if (difference > 0) {
|
||||
// System.out.println("Total XP Earned: " + mcMMOPlayer.getProfile().getRegisteredXpGain(skillType) + " / Threshold value: " + threshold);
|
||||
// System.out.println(difference * 100 + "% over the threshold!");
|
||||
// System.out.println("Previous: " + event.getRawXpGained());
|
||||
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
||||
float newValue = rawXp - (rawXp * difference);
|
||||
|
||||
if (newValue > 0) {
|
||||
event.setRawXpGained(newValue);
|
||||
}
|
||||
else {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
||||
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||
@@ -38,6 +39,7 @@ import com.gmail.nossr50.runnables.UpdaterResultAsyncTask;
|
||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||
import com.gmail.nossr50.runnables.database.UserPurgeTask;
|
||||
import com.gmail.nossr50.runnables.party.PartyAutoKickTask;
|
||||
import com.gmail.nossr50.runnables.player.ClearRegisteredXPGainTask;
|
||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.runnables.player.PowerLevelUpdatingTask;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
@@ -116,6 +118,7 @@ public class mcMMO extends JavaPlugin {
|
||||
public final static String playerDataKey = "mcMMO: Player Data";
|
||||
public final static String greenThumbDataKey = "mcMMO: Green Thumb";
|
||||
public final static String pistonDataKey = "mcMMO: Piston State";
|
||||
public final static String databaseCommandKey = "mcMMO: Processing Database Command";
|
||||
|
||||
public static FixedMetadataValue metadataValue;
|
||||
|
||||
@@ -168,7 +171,7 @@ public class mcMMO extends JavaPlugin {
|
||||
holidayManager = new HolidayManager();
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
new PlayerProfileLoadingTask(player).runTaskTimerAsynchronously(mcMMO.p, 1, 20); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
debug("Version " + getDescription().getVersion() + " is enabled!");
|
||||
@@ -469,10 +472,10 @@ public class mcMMO extends JavaPlugin {
|
||||
long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||
|
||||
if (purgeIntervalTicks == 0) {
|
||||
new UserPurgeTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
}
|
||||
else if (purgeIntervalTicks > 0) {
|
||||
new UserPurgeTask().runTaskTimer(this, purgeIntervalTicks, purgeIntervalTicks);
|
||||
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
|
||||
}
|
||||
|
||||
// Automatically remove old members from parties
|
||||
@@ -491,6 +494,11 @@ public class mcMMO extends JavaPlugin {
|
||||
if (getHolidayManager().nearingAprilFirst()) {
|
||||
new CheckDateTask().runTaskTimer(this, 10L * Misc.TICK_CONVERSION_FACTOR, 1L * 60L * 60L * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
// Clear the registered XP data so players can earn XP again
|
||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkModConfigs() {
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.gmail.nossr50.party;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
@@ -13,10 +15,13 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
@@ -132,10 +137,10 @@ public final class PartyManager {
|
||||
* @param player The player to check
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
public static LinkedHashSet<String> getAllMembers(Player player) {
|
||||
public static LinkedHashMap<UUID, String> getAllMembers(Player player) {
|
||||
Party party = getParty(player);
|
||||
|
||||
return party == null ? new LinkedHashSet<String>() : party.getMembers();
|
||||
return party == null ? new LinkedHashMap<UUID, String>() : party.getMembers();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,9 +189,33 @@ public final class PartyManager {
|
||||
* @param playerName The members name
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
@Deprecated
|
||||
public static Party getPlayerParty(String playerName) {
|
||||
for (Party party : parties) {
|
||||
if (party.getMembers().contains(playerName)) {
|
||||
if (party.getMembers().keySet().contains(playerName)) {
|
||||
return party;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a party by a members uuid
|
||||
*
|
||||
* @param uuid The members uuid
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
public static Party getPlayerParty(String playerName, UUID uuid) {
|
||||
for (Party party : parties) {
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
if (members.keySet().contains(uuid) || members.values().contains(playerName)) {
|
||||
|
||||
// Name changes
|
||||
if (members.get(uuid) == null || !members.get(uuid).equals(playerName)) {
|
||||
members.put(uuid, playerName);
|
||||
}
|
||||
|
||||
return party;
|
||||
}
|
||||
}
|
||||
@@ -222,18 +251,22 @@ public final class PartyManager {
|
||||
* @param party The party
|
||||
*/
|
||||
public static void removeFromParty(OfflinePlayer player, Party party) {
|
||||
LinkedHashSet<String> members = party.getMembers();
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
String playerName = player.getName();
|
||||
|
||||
members.remove(playerName);
|
||||
members.remove(player.getUniqueId());
|
||||
|
||||
if (player.isOnline()) {
|
||||
party.getOnlineMembers().remove(player.getPlayer());
|
||||
}
|
||||
|
||||
if (members.isEmpty()) {
|
||||
parties.remove(party);
|
||||
}
|
||||
else {
|
||||
// If the leaving player was the party leader, appoint a new leader from the party members
|
||||
if (party.getLeader().equalsIgnoreCase(playerName)) {
|
||||
setPartyLeader(members.iterator().next(), party);
|
||||
if (party.getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
setPartyLeader(members.keySet().iterator().next(), party);
|
||||
}
|
||||
|
||||
informPartyMembersQuit(party, playerName);
|
||||
@@ -277,9 +310,8 @@ public final class PartyManager {
|
||||
*/
|
||||
public static void createParty(McMMOPlayer mcMMOPlayer, String partyName, String password) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
String playerName = player.getName();
|
||||
|
||||
Party party = new Party(playerName, partyName.replace(".", ""), password);
|
||||
Party party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName.replace(".", ""), password);
|
||||
|
||||
if (password != null) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Password.Set", password));
|
||||
@@ -408,11 +440,13 @@ public final class PartyManager {
|
||||
* @param party The party
|
||||
*/
|
||||
public static void addToParty(McMMOPlayer mcMMOPlayer, Party party) {
|
||||
String playerName = mcMMOPlayer.getPlayer().getName();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
String playerName = player.getName();
|
||||
|
||||
informPartyMembersJoin(party, playerName);
|
||||
mcMMOPlayer.setParty(party);
|
||||
party.getMembers().add(playerName);
|
||||
party.getMembers().put(player.getUniqueId(), player.getName());
|
||||
party.getOnlineMembers().add(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,36 +455,37 @@ public final class PartyManager {
|
||||
* @param partyName The party name
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
public static String getPartyLeaderName(String partyName) {
|
||||
Party party = getParty(partyName);
|
||||
|
||||
return party == null ? null : party.getLeader();
|
||||
return party == null ? null : party.getLeader().getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the leader of a party.
|
||||
*
|
||||
* @param playerName The name of the player to set as leader
|
||||
* @param uuid The uuid of the player to set as leader
|
||||
* @param party The party
|
||||
*/
|
||||
public static void setPartyLeader(String playerName, Party party) {
|
||||
String leaderName = party.getLeader();
|
||||
public static void setPartyLeader(UUID uuid, Party party) {
|
||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
||||
UUID leaderUniqueId = party.getLeader().getUniqueId();
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
String memberName = member.getName();
|
||||
UUID memberUniqueId = member.getUniqueId();
|
||||
|
||||
if (memberName.equalsIgnoreCase(playerName)) {
|
||||
if (memberUniqueId.equals(player.getUniqueId())) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.Player"));
|
||||
}
|
||||
else if (memberName.equalsIgnoreCase(leaderName)) {
|
||||
else if (memberUniqueId.equals(leaderUniqueId)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.NotLeader"));
|
||||
}
|
||||
else {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.New", playerName));
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.New", player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
party.setLeader(playerName);
|
||||
party.setLeader(new PartyLeader(player.getUniqueId(), player.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,7 +496,7 @@ public final class PartyManager {
|
||||
public static boolean canInvite(McMMOPlayer mcMMOPlayer) {
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
return !party.isLocked() || party.getLeader().equalsIgnoreCase(mcMMOPlayer.getPlayer().getName());
|
||||
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,6 +507,11 @@ public final class PartyManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.ADD_UUIDS_PARTY)) {
|
||||
loadAndUpgradeParties();
|
||||
return;
|
||||
}
|
||||
|
||||
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);
|
||||
|
||||
ArrayList<Party> hasAlly = new ArrayList<Party>();
|
||||
@@ -479,7 +519,8 @@ public final class PartyManager {
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
Party party = new Party(partyName);
|
||||
|
||||
party.setLeader(partiesFile.getString(partyName + ".Leader"));
|
||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||
party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
@@ -496,18 +537,19 @@ public final class PartyManager {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
}
|
||||
|
||||
List<String> memberNames = partiesFile.getStringList(partyName + ".Members");
|
||||
LinkedHashSet<String> members = party.getMembers();
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberName : memberNames) {
|
||||
members.add(memberName);
|
||||
for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
|
||||
String[] memberSplit = memberEntry.split("[|]");
|
||||
members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
}
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
||||
for (Party party : hasAlly) {
|
||||
party.setAlly(getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,8 +569,9 @@ public final class PartyManager {
|
||||
mcMMO.p.debug("Saving Parties... (" + parties.size() + ")");
|
||||
for (Party party : parties) {
|
||||
String partyName = party.getName();
|
||||
PartyLeader leader = party.getLeader();
|
||||
|
||||
partiesFile.set(partyName + ".Leader", party.getLeader());
|
||||
partiesFile.set(partyName + ".Leader", leader.getUniqueId().toString() + "|" + leader.getPlayerName());
|
||||
partiesFile.set(partyName + ".Password", party.getPassword());
|
||||
partiesFile.set(partyName + ".Locked", party.isLocked());
|
||||
partiesFile.set(partyName + ".Level", party.getLevel());
|
||||
@@ -541,15 +584,18 @@ public final class PartyManager {
|
||||
partiesFile.set(partyName + ".ItemShareType." + itemShareType.toString(), party.sharingDrops(itemShareType));
|
||||
}
|
||||
|
||||
List<String> memberNames = new ArrayList<String>();
|
||||
List<String> members = new ArrayList<String>();
|
||||
|
||||
for (String member : party.getMembers()) {
|
||||
if (!memberNames.contains(member)) {
|
||||
memberNames.add(member);
|
||||
for (Entry<UUID, String> memberEntry : party.getMembers().entrySet()) {
|
||||
String memberUniqueId = memberEntry.getKey() == null ? "" : memberEntry.getKey().toString();
|
||||
String memberName = memberEntry.getValue();
|
||||
|
||||
if (!members.contains(memberName)) {
|
||||
members.add(memberUniqueId + "|" + memberName);
|
||||
}
|
||||
}
|
||||
|
||||
partiesFile.set(partyName + ".Members", memberNames);
|
||||
partiesFile.set(partyName + ".Members", members);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -560,6 +606,73 @@ public final class PartyManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadAndUpgradeParties() {
|
||||
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);
|
||||
|
||||
if (!partyFile.renameTo(new File(mcMMO.getFlatFileDirectory() + "parties.yml.converted"))) {
|
||||
mcMMO.p.getLogger().severe("Could not rename parties.yml to parties.yml.converted!");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<Party> hasAlly = new ArrayList<Party>();
|
||||
|
||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||
Party party = new Party(partyName);
|
||||
|
||||
String leaderName = partiesFile.getString(partyName + ".Leader");
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(leaderName, false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
mcMMO.p.getLogger().warning("Could not find UUID in database for party leader " + leaderName + " in party " + partyName);
|
||||
continue;
|
||||
}
|
||||
|
||||
UUID leaderUniqueId = profile.getUniqueId();
|
||||
|
||||
party.setLeader(new PartyLeader(leaderUniqueId, leaderName));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setLevel(partiesFile.getInt(partyName + ".Level"));
|
||||
party.setXp(partiesFile.getInt(partyName + ".Xp"));
|
||||
|
||||
if (partiesFile.getString(partyName + ".Ally") != null) {
|
||||
hasAlly.add(party);
|
||||
}
|
||||
|
||||
party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
|
||||
party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));
|
||||
|
||||
for (ItemShareType itemShareType : ItemShareType.values()) {
|
||||
party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
|
||||
}
|
||||
|
||||
LinkedHashMap<UUID, String> members = party.getMembers();
|
||||
|
||||
for (String memberName : partiesFile.getStringList(partyName + ".Members")) {
|
||||
PlayerProfile memberProfile = mcMMO.getDatabaseManager().loadPlayerProfile(memberName, false);
|
||||
|
||||
if (!memberProfile.isLoaded()) {
|
||||
mcMMO.p.getLogger().warning("Could not find UUID in database for party member " + memberName + " in party " + partyName);
|
||||
continue;
|
||||
}
|
||||
|
||||
UUID memberUniqueId = memberProfile.getUniqueId();
|
||||
|
||||
members.put(memberUniqueId, memberName);
|
||||
}
|
||||
|
||||
parties.add(party);
|
||||
}
|
||||
|
||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||
|
||||
for (Party party : hasAlly) {
|
||||
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
|
||||
}
|
||||
|
||||
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS_PARTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle party change event.
|
||||
*
|
||||
|
||||
@@ -37,6 +37,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
if (useChat) {
|
||||
displayChat();
|
||||
}
|
||||
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
|
||||
}
|
||||
|
||||
private void displayChat() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@@ -41,6 +42,9 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
displayChat();
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@@ -17,6 +18,9 @@ import com.gmail.nossr50.util.uuid.UUIDFetcher;
|
||||
public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
private mcMMO plugin;
|
||||
private static final int MAX_LOOKUP = Math.max(HiddenConfig.getInstance().getUUIDConvertAmount(), 100);
|
||||
private static final int RATE_LIMIT = HiddenConfig.getInstance().getMojangRateLimit();
|
||||
private static final long LIMIT_PERIOD = HiddenConfig.getInstance().getMojangLimitPeriod();
|
||||
private static final int BATCH_SIZE = 5000;
|
||||
|
||||
private List<String> userNames;
|
||||
private int size;
|
||||
@@ -41,6 +45,16 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
Map<String, UUID> fetchedUUIDs = new HashMap<String, UUID>();
|
||||
|
||||
while (size != 0) {
|
||||
if (checkedUsers + 100 > RATE_LIMIT) {
|
||||
try {
|
||||
Thread.sleep(LIMIT_PERIOD);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
startMillis = System.currentTimeMillis();
|
||||
checkedUsers = 0;
|
||||
}
|
||||
if (size > MAX_LOOKUP) {
|
||||
userNamesSection = userNames.subList(size - MAX_LOOKUP, size);
|
||||
size -= MAX_LOOKUP;
|
||||
@@ -54,7 +68,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
|
||||
}
|
||||
catch (Exception e) {
|
||||
plugin.getLogger().severe("Unable to fetch UUIDs!");
|
||||
plugin.getLogger().log(Level.SEVERE, "Unable to fetch UUIDs!", e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,9 +77,13 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
||||
size = userNames.size();
|
||||
|
||||
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);
|
||||
if (fetchedUUIDs.size() > BATCH_SIZE) {
|
||||
mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs);
|
||||
fetchedUUIDs = new HashMap<String, UUID>();
|
||||
}
|
||||
}
|
||||
|
||||
if (mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) {
|
||||
if (fetchedUUIDs.size() == 0 || mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) {
|
||||
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
|
||||
plugin.getLogger().info("UUID upgrade completed!");
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.gmail.nossr50.runnables.database;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
|
||||
public class UserPurgeTask extends BukkitRunnable {
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
@Override
|
||||
public void run() {
|
||||
lock.lock();
|
||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
mcMMO.getDatabaseManager().purgeOldUsers();
|
||||
}
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -19,21 +20,21 @@ public class PartyAutoKickTask extends BukkitRunnable {
|
||||
@Override
|
||||
public void run() {
|
||||
HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
|
||||
List<String> processedPlayers = new ArrayList<String>();
|
||||
List<UUID> processedPlayers = new ArrayList<UUID>();
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
for (Party party : PartyManager.getParties()) {
|
||||
for (String memberName : party.getMembers()) {
|
||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberName);
|
||||
boolean isProcessed = processedPlayers.contains(memberName);
|
||||
for (UUID memberUniqueId : party.getMembers().keySet()) {
|
||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
|
||||
boolean isProcessed = processedPlayers.contains(memberUniqueId);
|
||||
|
||||
if ((!member.isOnline() && (currentTime - member.getLastPlayed() > KICK_TIME)) || isProcessed) {
|
||||
toRemove.put(member, party);
|
||||
}
|
||||
|
||||
if (!isProcessed) {
|
||||
processedPlayers.add(memberName);
|
||||
processedPlayers.add(memberUniqueId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PartyChatTask extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader())) {
|
||||
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader().getPlayerName())) {
|
||||
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gmail.nossr50.runnables.player;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class ClearRegisteredXPGainTask extends BukkitRunnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
mcMMOPlayer.getProfile().purgeExpiredXpGains();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.runnables.player;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -20,29 +18,23 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
private static final int MAX_TRIES = 5;
|
||||
private final Player player;
|
||||
private int attempt = 0;
|
||||
private ReentrantLock lock = new ReentrantLock();
|
||||
private boolean cancelled = false;
|
||||
|
||||
public PlayerProfileLoadingTask(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
private PlayerProfileLoadingTask(Player player, int attempt) {
|
||||
this.player = player;
|
||||
this.attempt = attempt;
|
||||
}
|
||||
|
||||
// WARNING: ASYNC TASK
|
||||
// DO NOT MODIFY THE McMMOPLAYER FROM THIS CODE
|
||||
@Override
|
||||
public void run() {
|
||||
lock.lock();
|
||||
|
||||
if (this.cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Quit if they logged out
|
||||
if (!player.isOnline()) {
|
||||
mcMMO.p.getLogger().info("Aborting profile loading recovery for " + player.getName() + " - player logged out");
|
||||
this.cancel();
|
||||
cancelled = true;
|
||||
lock.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,9 +45,6 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
// If successful, schedule the apply
|
||||
if (profile.isLoaded()) {
|
||||
new ApplySuccessfulProfile(profile).runTask(mcMMO.p);
|
||||
this.cancel();
|
||||
cancelled = true;
|
||||
lock.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,12 +53,9 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
mcMMO.p.getLogger().severe("Giving up on attempting to load the PlayerProfile for " + player.getName());
|
||||
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Profile.Loading.AdminFailureNotice", player.getName()), Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
player.sendMessage(LocaleLoader.getString("Profile.Loading.Failure").split("\n"));
|
||||
this.cancel();
|
||||
cancelled = true;
|
||||
lock.unlock();
|
||||
return;
|
||||
}
|
||||
lock.unlock();
|
||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, 100 * attempt);
|
||||
}
|
||||
|
||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
||||
@@ -104,5 +90,3 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
@@ -39,7 +39,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
||||
// Fallthrough
|
||||
|
||||
case BERSERK:
|
||||
if (HiddenConfig.getInstance().resendChunksAfterBlockAbility()) {
|
||||
if (Config.getInstance().getRefreshChunksEnabled()) {
|
||||
resendChunkRadiusAt(player, 1);
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
@@ -19,10 +19,26 @@ public final class Acrobatics {
|
||||
|
||||
private Acrobatics() {};
|
||||
|
||||
/**
|
||||
* Calculates how much damage should be dealt when Dodging
|
||||
*
|
||||
* @param damage the base damage
|
||||
* @param damageModifier the damage modifier
|
||||
*
|
||||
* @return modified damage
|
||||
*/
|
||||
protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) {
|
||||
return Math.max(damage / damageModifier, 1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates how much damage should be dealt when Rolling
|
||||
*
|
||||
* @param damage the base damage
|
||||
* @param damageThreshold the damage threshold
|
||||
*
|
||||
* @return modified damage
|
||||
*/
|
||||
protected static double calculateModifiedRollDamage(double damage, double damageThreshold) {
|
||||
return Math.max(damage - damageThreshold, 0.0);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,22 @@ public class AcrobaticsManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.ACROBATICS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player is allowed to use Roll,
|
||||
* checks permissions and exploit prevention.
|
||||
*
|
||||
* @return true if the player is allowed to use Roll
|
||||
*/
|
||||
public boolean canRoll() {
|
||||
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ROLL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player is allowed to use Dodge
|
||||
*
|
||||
* @param damager {@link Entity} that caused damage
|
||||
* @return true if the player can Dodge damage from damager
|
||||
*/
|
||||
public boolean canDodge(Entity damager) {
|
||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
|
||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||
@@ -142,19 +154,33 @@ public class AcrobaticsManager extends SkillManager {
|
||||
}
|
||||
|
||||
Location fallLocation = player.getLocation();
|
||||
int maxTries = Config.getInstance().getAcrobaticsAFKMaxTries();
|
||||
|
||||
boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2));
|
||||
|
||||
fallTries = sameLocation ? fallTries + 1 : Math.max(fallTries - 1, 0);
|
||||
fallTries = sameLocation ? Math.min(fallTries + 1, maxTries) : Math.max(fallTries - 1, 0);
|
||||
lastFallLocation = fallLocation;
|
||||
|
||||
return fallTries > Config.getInstance().getAcrobaticsAFKMaxTries();
|
||||
return fallTries + 1 > maxTries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a fall is fatal
|
||||
*
|
||||
* @param damage amount of damage taken from the fall
|
||||
* @return true if the fall is fatal, false otherwise
|
||||
*/
|
||||
private boolean isFatal(double damage) {
|
||||
return getPlayer().getHealth() - damage <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the amount of XP gained from falling
|
||||
*
|
||||
* @param damage amount of damage taken in the fall
|
||||
* @param isRoll boolean if the player was rolling
|
||||
* @return amount of XP gained
|
||||
*/
|
||||
private float calculateRollXP(double damage, boolean isRoll) {
|
||||
ItemStack boots = getPlayer().getInventory().getBoots();
|
||||
float xp = (float) (damage * (isRoll ? Acrobatics.rollXpModifier : Acrobatics.fallXpModifier));
|
||||
|
||||
@@ -134,7 +134,10 @@ public final class AlchemyPotionBrewer {
|
||||
|
||||
if (output != null && player != null) {
|
||||
PotionStage potionStage = PotionStage.getPotionStage(input, output);
|
||||
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
|
||||
|
||||
if (UserManager.hasPlayerDataKey(player)) {
|
||||
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ public class Archery {
|
||||
|
||||
public static final double DISTANCE_XP_MULTIPLIER = 0.025;
|
||||
|
||||
/**
|
||||
* Increment tracked arrow count for a LivingEntity,
|
||||
* if the entity isn't tracked yet it will get added to the tracker.
|
||||
*
|
||||
* @param livingEntity the {@link LivingEntity} to increment the arrow count for
|
||||
*/
|
||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||
if (trackedEntity.getLivingEntity().getEntityId() == livingEntity.getEntityId()) {
|
||||
@@ -34,6 +40,11 @@ public class Archery {
|
||||
addToTracker(livingEntity); // If the entity isn't tracked yet
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a LivingEntity to the tracker.
|
||||
*
|
||||
* @param livingEntity the {@link LivingEntity} to add.
|
||||
*/
|
||||
protected static void addToTracker(LivingEntity livingEntity) {
|
||||
TrackedEntity trackedEntity = new TrackedEntity(livingEntity);
|
||||
|
||||
@@ -41,6 +52,11 @@ public class Archery {
|
||||
trackedEntities.add(trackedEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a TrackedEntity from the tracker.
|
||||
*
|
||||
* @param trackedEntity the {@link TrackedEntity} to remove.
|
||||
*/
|
||||
protected static void removeFromTracker(TrackedEntity trackedEntity) {
|
||||
trackedEntities.remove(trackedEntity);
|
||||
}
|
||||
|
||||
@@ -23,14 +23,30 @@ public class ArcheryManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the target can be dazed. Checks if target is valid and if the player has sufficient permissions.
|
||||
*
|
||||
* @param target the {@link LivingEntity} object of the target to check
|
||||
* @return true if the target can be dazed, false otherwise
|
||||
*/
|
||||
public boolean canDaze(LivingEntity target) {
|
||||
return target instanceof Player && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DAZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player can use SkillShot.
|
||||
*
|
||||
* @return true if the player can use SkillShot, false otherwise
|
||||
*/
|
||||
public boolean canSkillShot() {
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SKILL_SHOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player can use RetrieveArrows.
|
||||
*
|
||||
* @return true if the player can use RetrieveArrows, false otherwise
|
||||
*/
|
||||
public boolean canRetrieveArrows() {
|
||||
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.RETRIEVE);
|
||||
}
|
||||
@@ -67,6 +83,8 @@ public class ArcheryManager extends SkillManager {
|
||||
* Handle the effects of the Daze ability
|
||||
*
|
||||
* @param defender The {@link Player} being affected by the ability
|
||||
*
|
||||
* @return amount of damage from Daze
|
||||
*/
|
||||
public double daze(Player defender) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
|
||||
@@ -94,6 +112,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* Handle the effects of the Skill Shot ability
|
||||
*
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return amount of damage from Skill Shot
|
||||
*/
|
||||
public double skillShot(double damage) {
|
||||
if (!SkillUtils.activationSuccessful(SecondaryAbility.SKILL_SHOT, getPlayer())) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user