Compare commits

..

172 Commits
dev ... master

Author SHA1 Message Date
c3dff18aef Force version number change. 2018-07-04 02:35:43 -05:00
862b7399d6 Rename version to 3.X. Remove daily bot message spam. 2018-07-04 02:33:15 -05:00
fb8d30b9c5 Recycling Center search improved with Recycling Centers getting names.
Damage limits added for all boss monsters.
2017-10-11 21:19:58 -05:00
1a285cbf7d Add the '!search' bot command fix to master. 2017-10-03 18:59:52 -05:00
ea59b4890c Implement basic Pet AI behaviors. Add /search command. 2017-10-03 18:31:40 -05:00
8e9053f308 Baseline commit. 2017-10-02 17:35:43 -05:00
bca56c165c Implementation of glow control, and targeting via looking at mobs. 2017-10-01 02:26:33 -05:00
6d82052571 Made Labels smoother and implemented better. Implemented Custom Models
and fixed a bug allowing Slayers to get HP from the Dawntracker set.
2017-09-29 00:01:12 -05:00
ae2148bed7 Habitat levels properly work again. 2017-09-28 21:03:46 -05:00
65f025a640 Emergency Patch. Items disappearing glitch. 2017-09-28 00:52:57 -05:00
506661479c Update version number. 2017-09-27 23:39:09 -05:00
ffe7d5adb5 Defender rework complete.
+>Defenders have been reworked!
+>Defenders now change their playstyle based on whether they are
blocking/sneaking.
+>See website/wiki (http://45.33.13.215/wiki/index.php/Modes#Defender)
or in-game Defender link (Click Defender in '/stats') for more info.
+>Songsteel set now improves Threat Generation.
+>Songsteel base HP for 2-piece set increased.
+>Songsteel base Defense for 4-piece set increased.
+>Protector set base Defense increased.
+>Sustenance set base Health increased.
+>Added Songsteel set 5-piece stat bonuses: Extra Damage Reduction +
Bonus Health
+>Sustenance set new 5-piece effect:
	Increases the Regeneration Pool for other party members by X whenever
you get hit. When party members are below half health, they will slowly
steal health from you as long as your Health is above 50%.
+>Striker passive damage increased from 10% -> 20%.
+>Striker critical strike chance increased from 20% -> 40%.
+>Line Drive cooldown decreased from 12 -> 6 seconds.
+>World Shop item prices are now consistent regardless of world
location.
+>New players that join are now given a Command guide and a Survival
guide that they can read to learn about the server!
+>When clicking the mode in '/stats' to learn about the perks, you are
given a book to read instead so there is less clutter.
>Protector set now requires you to use Unstoppable Team while
Rejuvenation is on cooldown (Since they use the same key input).
>Protector set 5-piece stat bonuses changed from Armor
Penetration+Damage to Party Damage Reduction+Bonus Party Health.
>Sustenance set 5-piece stat bonuses changed from Armor
Penetration+Damage to Lifesteal+Bonus Health.
>Fixed a bug where setting the damage of EntityDamagedEvent did not
reflect the changes in the damage formula.
>Fixed a bug causing certain damage calculations to not be applied for
basic attacking.
>Fixed a bug causing Ranger mode to not activate without set gear /
artifact gear.
->Absorption Health is now capped to your Maximum Health.
->All old Defender perks no longer apply. See 'Defender Rework' info
above.
->Songsteel set no longer provides Block Chance.
2017-09-27 23:36:56 -05:00
b0f634c1d8 Merge branch 'daily_nerf'
Conflicts:
	TwosideKeeper.jar
2017-09-27 18:26:29 -05:00
20a4a5dd14 Implement Item Queue Max Buffer to Filter Cube Handling. 2017-09-27 18:22:40 -05:00
bfd185d562 Implement max item queue buffer to Filter Cube handling. 2017-09-27 18:21:28 -05:00
ffb784dcd2 Merge branch 'daily_nerf'
Conflicts:
	TwosideKeeper.jar
2017-09-26 01:52:33 -05:00
85ec1bf6fc Reduce the number of item operations and damage operations allowed in
one tick to help circumvent possible lag.
2017-09-26 01:43:33 -05:00
b4e8aed1f3 Merge branch 'daily_nerf'
Conflicts:
	TwosideKeeper.jar

	
Continued work on Defender Revamp.
2017-09-26 01:09:08 -05:00
64901cd703 -Nerf Daily Challenge Loot, making passive daily rewards a lot less
valuable while awarding players that actually do them actively.
-Added !roll bot command.
2017-09-18 09:58:56 -05:00
ba7af310ac Defender Updates included here. More to be announced. 2017-09-18 09:46:27 -05:00
5bcf1a2dea Merge remote-tracking branch 'origin/vogog'
Conflicts:
	TwosideKeeper.jar
2017-09-04 00:22:27 -05:00
aa1b74716a Implement Defender Stances. Begin work on Defender Rework. 2017-09-03 23:36:23 -05:00
Vogog
6b7ca1808f Slayer mode backstabs now deal 4x damage, up from 3x. The Assassin set
backstab damage multiplier is now 8x damage, up from 6x.
2017-09-04 16:19:31 +12:00
Vogog
1c79e6a3a0 Slayer mode backstabs now deal 4x damage, up from 3x. 2017-09-04 16:11:17 +12:00
9874633e69 Fixed AOE bug and Earth Wave vehicle bug. 2017-09-03 04:26:44 -05:00
3d9479b9f2 Implement aggro mechanics for monsters. 2017-09-02 19:31:40 -05:00
7a87c6ce4f Updates to PVP, team PVP clarity, bugfixes, balance changes. 2017-06-15 23:17:27 -05:00
15e872803f Fixed double death message bug. 2017-06-14 22:46:24 -05:00
abe745c0ac Added things to make Team PvP more distinguishable. Added custom PVP
spawnzones.
2017-06-14 22:10:23 -05:00
f438d3e16f Implemented custom item displays using server PHP GD system. Modified
detection of linked items to allow for multiple items to be linked at
once and have proper detection. Added new ways to link items. Fixed bugs
related to PvP and finally found a good fix for Bow Cooldown packet
sending without loss of bow usage.
2017-06-14 19:09:15 -05:00
7789fbe900 PvP Implementation completed. Rewards and loot are now taken care of. 2017-06-11 18:26:24 -05:00
abc03b5dc7 Implemented PVP Arenas, improved on PVP Balancing, fixed PVP bugs. 2017-06-11 05:31:27 -05:00
8570e2706f Added PVP Scoreboard displays, fleshed out more PVP bugs. Added
experimental anti-lag block breaking code in hopes of making Efficiency
X tools much better to use.
2017-06-07 21:12:55 -05:00
245b3f5e07 Added tank buffs. Minor bugfixes. Improvements. 2017-06-06 21:18:20 -05:00
28d1bca571 Vacuum Cube optimization. 2017-06-05 22:40:42 -05:00
d5969900b0 +>Alustine 3 set bonus now resists Infection, Bleeding, Burn, and
Shrapnel DoT effects.
 >Fixed UUID issues with World Shops and Daily Challenge scoreboards.
 >Minibosses no longer spawn in player-built locations (Similar to Elite
spawning behavior.)
2017-06-05 21:45:49 -05:00
2dbb09c8e0 Basic PvP System incorporated. All attacks are working as intended and
dealing damage appropriately. Damage Balances / Adjustments were made
based on basic judgements. Basic PvP setup / voting system was made to
initialize PvP with other players.
2017-06-04 16:48:35 -05:00
f5369018aa Bugfixes and Behavior fixes for Minibosses. Modified DPS Room and Tank
Room to better match their descriptions.
2017-06-04 12:37:14 -05:00
1a3ab570eb Maintenance / Quick Fixes to many bugs. 2017-05-31 22:11:30 -05:00
0869df5fad Daily Challenge Rooms completed, Rewards distribution system finished.
Fixed bugs with Minibosses, enabled spawning for them. All loot is
setup. Added Daily challenge tokens, added new signs for daily
challenges. Created notifications for scoreboard resets. Added
scoreboards/record-keeping system for each daily challenge.
2017-05-30 02:16:27 -05:00
51b39cc298 Implemented instanced room system in preparation for Challenge Rooms. 2017-05-28 23:19:33 -05:00
05582519fc Organized common attributes of Bosses into a GenericBoss class.
Completed Personal Loot system for defeating bosses. Implemented all
loot for new minibosses.
2017-05-28 17:38:22 -05:00
f404d2fd73 Finished implementation of Sniper Skeletons. 2017-05-27 22:51:31 -05:00
ab164df286 Finished Knight mechanic implementation. 2017-05-27 00:37:16 -05:00
5b4b52d56d Fixed all bug reports that came in earlier today. Filter Cubes work
properly again, Vacuum Cube bugs are gone (for players with old profiles
and /vac turned off), and shooting mobs above their heads is fixed.
2017-05-25 19:59:16 -05:00
f5641c7e88 Fixed a Glow bug and ConcurrentModification buff removal bug that was
introduced. Continued to implement Knight features.
2017-05-24 22:22:50 -05:00
7bafd04a6e Added Provoke ability to Artifact Axes. Created and began implementation
of Knight and Dark Spider.
2017-05-22 20:09:14 -05:00
80adc60e12 Finished implementation of all new Item Sets. Fixed soup eating bugs. 2017-05-21 01:15:10 -05:00
ed2f549416 Implemented PRIDE set. Began work on Assassin sword set. Fixed bug with
damage numbers not changing color with different attributes.
2017-05-20 19:57:12 -05:00
91841bba18 Majorly improved overlay system to have multiple sections that are timed
separately.
2017-05-20 01:06:49 -05:00
d83be25465 Fixed Barbarian mode. Implemented Legion Barb Set. Fixed bugs with enemy
display names. Enabled all buffs to display regardless of tier.
2017-05-19 00:02:56 -05:00
55b6d99e91 Fixed bug involving consuming of soup stacks in off-hand. 2017-05-17 18:57:50 -05:00
6ba5c21dfd Added Channeling system, fixed Suppression movement stopping for
Players, disable flight for Players that become suppressed. Channeling
system uses Suppression. Players cannot swap hotbar items while
Suppressed anymore. Added adaptive old creature name conversion.
Improved structure of LivingEntityDifficulty.
2017-05-16 21:51:23 -05:00
b3e44fdcda Updated naming scheme for monsters. Fixed minor bugs with setting
monster's difficulties. Implemented most of Protector set. Fixed bugs
with Suppression not working on players.
2017-05-15 22:10:02 -05:00
c75d629eb3 Updates to API, ranger mode is now remembered upon logging back in. 2017-05-15 17:54:47 -05:00
826467da8e Forgot getBuff() in API. 2017-05-14 11:53:55 -07:00
5e14364761 Added buff methods to API. Fixed minor issues with buff system. Fixed
implementation of Toxin set.
2017-05-14 11:48:32 -07:00
dcf5629e76 Remove certain Item sets from rerollable item set list. 2017-05-13 17:55:14 -07:00
c86785c16b Fixed a bug causing items to vanish while picking up partial stacks that
enter a player's inventory.
2017-05-10 03:52:51 -07:00
30915bb6b6 Toxin Set Implementation almost completed. Fixed a major bug with item
drops not working.
2017-05-09 19:56:54 -07:00
f9f4935463 Added functionality for Ranger sets. 2017-05-06 02:03:28 -05:00
51b6759d7f Test Gitignore 2017-05-04 18:37:32 -05:00
248bdd16ad Ignore more files. 2017-05-04 18:29:53 -05:00
ef43bea3a0 Update TwosideKeeper .gitignore to prevent project modifications for
future committers.
2017-05-04 18:25:39 -05:00
1c1b9af6f5 Parkour code added. 2017-05-04 18:15:21 -05:00
19a418d1e0 Implemented two new Striker sets, Windry and Luci. 2017-05-03 23:59:28 -05:00
17c29a33df Implemented Temporary Block system for future combat purposes. Added
Wind Slash effect and mechanic. Optimized functions.
2017-05-02 22:14:52 -05:00
6b2c6e3d11 Improved calculation speed for damage dealing formulas and checking for
item set conditions. Should improve fluidity of combat in regards to the
server significantly.
2017-05-01 00:33:00 -05:00
25bb73a670 Prevent Test Dummies from giving Artifact EXP and Tactics EXP. 2017-04-18 21:27:06 -05:00
bf62dccbdb Allow dummies to automatically be removed. 2017-04-18 21:06:50 -05:00
46b7cb9779 +>Test Dummies have been scattered throughout various areas in towns.
You can use these to freely test DPS. They will announce DPS results
after you stop hitting them.
+>Fixed Debilitation mode poison application issues. No longer resets
the level of poison on a target when you miss a headshot on a high
poison stack target.
+>Poison deals a true damage DoT based on number of poison stacks every
second. Poison damage ticks are twice as slow on Undead monsters.
(Zombies, Skeletons, Wither)
+>The healthbar of Elite monsters and boss monsters now appears when you
are nearby them.
>Removed the reliance on Minecraft's poison system and debuff system to
determine if a monster is poisoned or not.
2017-04-18 21:03:23 -05:00
ec0fb8e22b +>Added damage display indicators.
+>Decreased the chance Infinity gets knocked off of Bows.
+>Added buff display indicators and improved handling of custom
buffs/debuffs.
+>Protection enchantment on shields now works properly when calculating
Damage Reduction.
>Increased Earth Wave artifact ability's level cap from 100 to 10000.
>Fixed a bug causing dodge chance to be incorrectly calculated.
>Fixed a duping bug with Vacuum Cubes.
>Improved efficiency of Filter Cube code so it causes less lag when
processing.
>Fixed a bug with duplicating ender cubes not working.
>Fixed a bug with Tumble cooldown being incorrect visually when the
player also had Cooldown Reduction.
>Re-did handling of Death Mark stack application. Now works on all
enemies.
2017-04-17 18:54:03 -05:00
44c1d79072 Added Damage Indicators. 2017-04-14 20:53:36 -05:00
91c05a9580 Removed old graph implementation. Fixed item pickup bugs. 2017-04-09 05:13:31 -05:00
c8abd91f50 Buggy graph system implementation 2017-04-07 23:48:59 -05:00
a8aa59ed25 Graph system fully implemented. Pending testing of all types of
inventories.
2017-04-05 00:00:50 -05:00
87dbf99a31 Implementation of Graph data structure inside Item Cubes. Fully
functional and bug-free.
2017-04-04 21:59:28 -05:00
1fa2a080c8 Implemented Graphs to prevent Item Cube nesting loss and optimized
Vacuum and Filter Cubes.
2017-04-03 23:45:45 -05:00
942654e0d1 Fix major Item Duping bug. Include framework for new artifact abilities. 2017-04-03 12:28:50 -05:00
84ead5b445 Arrow Barrage bug fix. 2017-03-03 12:25:33 -06:00
a5000283d3 Make auto equipping function with a full inventory. 2017-03-02 20:08:12 -06:00
310f5c687f >Increased Earth Wave artifact ability's level cap from 100 to 10000.
>Fixed a bug causing dodge chance to be incorrectly calculated.
2017-03-02 18:40:27 -06:00
73e685092f +>Added pickup animation for picking up arrows.
+>Improved stats of many artifact abilities. Scaling is much more
progressive and less random than previously. Percentage-based artifact
abilities have a cap of 100 artifact levels now.
>Fixed the bug allowing Slayers to continue to perfect dodge when hit by
non-entity damage sources.
>Dodge Chance, Critical Strike Chance, Cooldown Reduction, and Debuff
Resistance all now apply their stats multiplicatively instead of
additively.
>The particles for Piercing arrows now starts further away from the
player so their view is no longer obscured by them.
>Fixed a display bug with the particles of Piercing arrows going through
solid blocks.
->The Dodge Artifact Ability now requires 2 AP per level.
2017-01-29 23:52:26 -06:00
5d6182a393 Continued Implementation of Elite Guardian. 2017-01-27 01:56:14 -06:00
1c01ad595d Accept regular damage calls when there is nothing left in the damage
queue. Forgot to reset it.
2017-01-24 02:40:23 -06:00
40ceacb6a9 Added the DamageStructure to help delay hundreds of damage calls at once
to ease the load on the server when dealing damage, especially when
mobbing. Huge performance improvement.
2017-01-24 02:08:24 -06:00
417a4273a1 +>Rejuvenation no longer applies Regeneration X for 10 seconds, but
instead heals 5 HP (2.5 Hearts) every 0.5 seconds for 10 seconds.
+>Critical Rate of Wolfsbane trinkets increased from 2+(1*tier)% to
3+(2*tier)%.
+>Crit Damage of Moonshadow trinkets increased from 3+(2*tier)% to
6+(3*tier)%.
+>Lorasys Set has been revamped to gain power based on total tier level
of trinkets.
+>Dawntracker Set now has a 6 piece set bonus.
+>Artifact calculations have been revamped. In short: Multipliers were
nerfed, base damage / flat numbers were buffed. This also improves the
calculation speed of artifact abilities internally. Most artifact
abilities now go up to Level 10000, requiring a lot more grinding for
levels than before.
+>The proper item pickup animation now plays when picking up items. (A
visual effect that was never added back in.)
>Fixed application of potion effects to prevent unnecessary overriding
with potion effects that are clearly superior to current buffs.
>Fixed a bug causing Artifacts to take away 10% of total Potential per
level up, instead of 10% of remaining Potential per level up.
>Fixed a bug allowing players to use the swap key on a Bauble Pouch to
gain 10 extra Health when swapping to Slayer mode.
>Drops from suppressed mobs now appear immediately instead of after a
delay.
>Fixed localization of Prismarine, Prismarine Bricks, Dark Prismarine.
>Fixed a bug preventing multiple items from being picked up at the same
time due to automatic pickup.
>Fixed a bug causing Cooldown Reduction to make successful
assassinations increase the cooldown of Assassinate instead of resetting
it.
>Fixed a bug causing Regeneration multipliers to not properly multiply
base regeneration.
->Line Drive no longer goes through walls or solid areas.
2017-01-24 01:34:49 -06:00
5ac899616e Artifact Ability points have been redone. Uses a different formula, and
many values are now completely changed.
2017-01-20 01:45:15 -06:00
76bb197cca Make the activation of the Rocket Booster more responsive when in the
air.
2017-01-19 21:46:10 -06:00
09919b5ac8 Increase range slightly more. 2017-01-19 20:50:20 -06:00
90f12b6848 Prioritize Filter Cubes over Vacuum Cubes. Increase automatic pickup
radius.
2017-01-19 20:41:51 -06:00
7e0b4bddcc Allow all items to be manually inserted into vacuum 2017-01-19 19:20:38 -06:00
f52b17864e Fixed a bug preventing Luck of the Sea from being applied to artifacts
properly.
2017-01-19 17:23:44 -06:00
33b8f6b6e2 Fix Eruption knockup casting on nearby players. 2017-01-19 00:30:21 -06:00
7b45ad4ca3 Fix Provoke not provoking monsters. 2017-01-19 00:19:13 -06:00
35ada09a50 ArrayIndexOutOfBoundsexception fix for artifact growth leveling. 2017-01-19 00:08:27 -06:00
28bb2cc3fe ESSENCES. 2017-01-18 22:49:27 -06:00
6fb872b5ee Improved the high and low count statistics by only including the last
high and low from 60 seconds ago.
2017-01-18 17:37:21 -06:00
392e89a724 Fixed issues with the debug report not uploading from a proper filename. 2017-01-18 12:43:02 -06:00
cbb363c11d Fixed Armor pen from Tactics not being in calculations. Remove color
codes when writing debug reports to file.
2017-01-18 08:45:14 -06:00
fcaa8a49d0 Fixed Armor pen from Tactics not being in calculations. Remove color
codes when writing debug reports to file.
2017-01-18 08:45:14 -06:00
45ec9bf301 Make Item Pickups auto update Cube inventory lists. 2017-01-17 21:32:52 -06:00
c6ac33e728 Fixed a limitation of 128 max stack size. 2017-01-17 21:21:48 -06:00
13a77ab9e0 Fixes to Filtering list. 2017-01-17 20:44:14 -06:00
e5b96b3924 +>Item Cubes now display their contents
+>Filter Cubes now display what they are filtering.
+>Magic chests picked up via Mover Wand can now be directly crafted as a
replacement for the normal chest slot and will automatically create an
item cube filled with the contents! This works for all Item Cube recipes
with a normal chest: Item Cube, Large Item Cube, and Filter Cubes.
>Heavily optimized the speed of the server heartbeat, improving server
performance.
>Fixed a bug causing Elite Zombies converting blocks broken using their
data values improperly.
->Modified 'Growth' to set Potential of an artifact to 20% instead of
increasing the Potential by 20%.
2017-01-17 20:26:49 -06:00
336a84e93d Fixed Artifact Leveling bugs. Renamed the hopper and filter inventories
that opened up for Bauble pouches and Filter Cube inventories.
2017-01-17 13:09:33 -06:00
f8a64d792d Largely improved efficiency of glows on monsters and improved efficiency
of the bar created on the scoreboard.
2017-01-17 03:56:48 -06:00
4b53d3a837 Added Heartbeat debug logging. 2017-01-17 02:20:06 -06:00
eabadc9091 Fix WorldShop Display Items being in the world. 2017-01-16 19:52:48 -06:00
c0bde3fe8a Fix an issue with World Shop Display Items being sent to the Recycling
Center.
2017-01-16 07:29:02 -06:00
26a465adea Artifact tiers are no longer tied to the "Luck of the Sea" enchantment
and have their own line to track tier now.
2017-01-16 07:21:49 -06:00
bcf29de763 +>Rangers do not lose any durability when dodging attacks.
+>Extra Recipes from Jobs now show up in the Misc Items Category of the
'/craft' menu.
+>The Bauble Pouch has been added. The Pouch is crafted with 8 leather +
1 Chorus Flower and holds up to 9 items inside. The Bauble Pouch is now
a requirement in the off hand slot for Slayer Mode to activate.
	Bauble Pouches are opened just like Item Cubes, and can be interacted
with in similar ways. You can click items directly into them, or open up
their inventories to insert/remove items.
>Fixed a bug causing money transactions to not work properly.
>Mode Switching for Bows can only be done via left-click now. The order
of the old right-click version is now the left-click version: CLOSE ->
SNIPE -> DEBILITATION -> CLOSE
>Fixed a bug where Slayers would benefit from perks of a Lorasys Sword
even when not currently holding one (Just by letting it sit in the
hotbar).
>Fixed a bug causing the Backstab sound to play when viewing '/stats' as
a Slayer.
>Updated in-game Slayer description: "->Players are identified as
'Slayers' by wearing no armor, and wearing a Bauble Pouch in their off
hand."
>Updated the descriptions of Baubles.
>Improved efficiency of Hellfire leader code and Magma cube checking
code, leading to less overhead and lag with these scenarios.
->Baubles no longer function when in the hotbar of a player's inventory.
->Dodge Chance now reduces durability of all armor by 3+(1% Durability)
per dodge. (This does not apply to block chance.)
->Defenders now lose durability on their shields as they block attacks.
->The Alustine Set no longer increases base damage. It now applies true
damage on each hit instead.
2017-01-16 05:55:03 -06:00
22e31e2b8c >Essences now drop in the Overworld while Cores drop in the Nether from
basic monsters.
2017-01-14 05:15:20 -06:00
37dbd8b417 +>Added the /vac, /equip_weapons, and /equip_armor commands. These
commands are toggles to turn on/off Vacuum Cube suction, Auto-Equipping
weapons, and Auto-Equipping armor functionality.
+>Base Regeneration Level for Defenders increased. Not Blocking:
Regeneration 1 -> Regeneration 2, Blocking: Regeneration 2 ->
Regeneration 4
>Sleep voting system now works for thunderstorm weather conditions.
>Armor Stands properly subtract health when taking damage now.
->Regen Pool is now hard capped to your maximum health.
->Arrow Quivers no longer equip to your off-hand when viewing other
inventories.
->Vendetta Stacks reset if revival is triggered.
2017-01-14 04:36:59 -06:00
d8f2edd51e Lifesteal and Regeneration Mechanic Update
+>"Regeneration" has been added. The regeneration stat can be seen in
/stats.
    Regeneration will naturally heal your player by the amount displayed
every 5 seconds if your hunger is full enough.
+>The Regeneration Potion Effect now increases your Regeneration by 2
per level.
+>Lifesteal now sends the stolen health amount to a Regeneration Pool.
The Regeneration pool shows up in your action bar.
+>Players with a Regeneration Pool will heal HP equal to your
Regeneration every second, instead of every 5 seconds. This amount is
then removed from your Regeneration pool.
+>Barbarians will not fill their Regeneration Pool when lifestealing
until they remove points from their Damage Pool first. Points from their
Regeneration Pool get automatically converted to Damage Pool reduction.
>Swapped the <player> and all/equip arguments for /stats when viewing
other players. They are now /stats equip <player> and /stats all
<player>
->The Regeneration stat from the Alikahn set has been nerfed
significantly.
->Natural Regeneration Rate is no longer 2 Health + 5% of your Maximum
Health.
->The Regeneration potion effect no longer increases the healing rate.
->Lifesteal no longer provides health directly to the player.
2017-01-12 00:47:41 -06:00
b14d73c4ac Fixed rate of Lorasys drops being abysmal unintentionally. 2017-01-10 12:08:32 -06:00
3265a09f46 Fixed artifact abilities not being able to be leveled. Added Equipment
to /stats list. Removed gigantic level up spam for Artifacts. Removed
accidental Elite Guardian activation.
2017-01-09 23:08:23 -06:00
e7bfc1324e Adjusted how Leader Withers spawned loot containers to allow players
more chances at getting items from individual containers. More
participants in a fight lead to more rewards.
2017-01-09 12:40:29 -06:00
1fc4adb469 Fixed artifact ability leveling for Graceful Dodge / Dodge (Or any
similarly-named artifact abilities in general. Made AoE less useful for
gaining artifact XP.
2017-01-09 00:48:47 -06:00
6bfec6a3ce Added jockeys and chickens to the list of spawn rules that must comply.
Fixed set bows not properly dropping from monsters.
2017-01-09 00:14:04 -06:00
fd495c8ea5 Fixed coloring of leather armor sets so that they do not error out with
bows.
2017-01-08 23:34:44 -06:00
c7375a24b7 Make updates to general project so it will work when imported elsewhere. 2017-01-08 23:18:35 -06:00
419b04cd17 +>Display Applied Damage for players to reveal how much damage is dealt
with buffs and bonuses on.
+>Rangers now see their base damage and applied damage properly.
+>Added isArtifactDust(), getArtifactDustTime(), setArtifactDustTime(),
and addArtifactDustTime() to the API.
>Fixed a bug causing certain artifact pieces to be duplicated when
turned to dust while other artifact pieces were not.
>Fixed a bug preventing damage breakdown from showing when only a single
player was online and attempting to solo elites/bosses and dies in the
process.
2017-01-07 20:27:31 -06:00
ad79fef027 +>'/fix price' and '/fix price <price>' commands have been added. These
commands lets you view the base price of the item you are holding at a
world shop, and allows you to set the price to a different amount. (Only
Aristo has permission to do this)
>Special Arrows being shot from a quiver has been fixed.
>Cooldowns are now saved between logins. This means you will login with
the cooldowns you last had instead of it resetting on each relog.
>Leader Wither now displays a Damage Breakdown when the fight is won or
lost.
>Applied a new Assassinate algorithm.
>Fixed Fireworks from Christmas Boxes and Dimensional Boxes from having
no effects.
>The Leader Wither no longer drops down as dramatically when reaching
the upper boundary of the Nether.
>Significantly decreased the block destruction capabilities of End,
Hellfire, and Deadly tier monster afterdeath explosions.
>Increased the damage dealt by afterdeath explosions of End, Hellfire,
and Deadly tier monsters.
>Deal of the Day price sale percentages can now vary by more than 20%.
>Hellfire Zombie and Pig Zombie behavior slightly modified.
2017-01-06 06:45:20 -06:00
bb59525e12 Fixed nasty loop causing server crash. 2017-01-05 03:34:38 -06:00
ac3cf8846c Fixed and updated bugs and issues with Elite Zombies / Vendetta. 2017-01-05 02:16:38 -06:00
d35942b678 >Fixed Hellfire Blaze Fireballs not causing Temporary Lava to disappear
properly.
>Fixed Bad Memory leaks that caused eventual server slowdowns.
>Leader Wither loot now appears in a series of chests for collection
rather than being dispersed all over the ground.
>The Elite Zombie no longer completely stops players it is leashing
onto, but instead slowing them down.
>The Elite Zombie's running speed has been decreased by 35%.
>The Elite Zombie's cooldowns and timings on mechanics have been
modified.
>The Elite Zombie's Stored Energy attack now knocks the player hit very
far back.
>The Elite Zombie's health has been increased dramatically. The Elite
Zombie no longer has a Resistance IX buff.
2017-01-04 11:38:03 -06:00
341a330d6b Implemented all requested Item Cube API methods. 2016-12-29 21:50:30 -06:00
94037dbea6 +>Added isItemCube(item), getCubeType(id), getItemCubeContents(id), and
insertItemsIntoItemCube(id,items) to the API.
>All sets are now categorized internally for re-rolling purposes.
>All types of Item Cubes can no longer be moved or clicked on while
viewing the contents of their inventories. This reduces the risk of
players throwing item cubes into themselves.
>PlayerDodgeEvent() now has getRawDamage() as a returned value. 
>Fixed spawnAdjustedLivingEntity() in the API to accept a proper
EntityType instead.
>Grammar in sentence fixed for inserting items into a chest.
2016-12-29 19:42:14 -06:00
02a309d86a Forgot to apply the +15 damage bonus to the 5-piece Item Set bonuses. 2016-12-29 13:49:25 -06:00
d287ccfbd5 Commit jar 2016-12-29 03:21:59 -06:00
fc6dbded2c Include off-hand for Dawntracker set checks. 2016-12-29 03:21:42 -06:00
5aa4319a86 Fix Feather Falling formula. 2016-12-29 02:51:07 -06:00
6e6388d3af Include Barbarian Mode mechanic change updates in description. 2016-12-29 02:34:34 -06:00
25e4ffbb47 Holiday candy and Revival Holiday candies are now on separate cooldowns,
more intuitive behavior.
2016-12-29 02:24:09 -06:00
617d85d9c7 Forgot Firework Rocket item linking updates. 2016-12-29 02:09:01 -06:00
d752c06ce1 +>Barbarians can now activate Forceful Strike (Shift+Left-Click) and
Sweep Up (Shift+Right-Click) without clicking on a monster target
anymore.
+>Barbarians that have excess health from lifesteal will convert it to
their damage pool, lowering their damage pool by the health amount
healed.
+>Added Fireworks parser when linking items.
+>5-piece set bonuses for Striker, Slayer, Barbarian, and Ranger modes
now include 50% Armor Penetration and +15 more damage.
>Fixed Rocket Boosters in the last slot of your hotbar not recharging
properly.
>Fixed Barbarian Bugs relating to Damage Pool being randomly removed
from players.
>Optimizations made to Filter Cube and Vacuum Cube pickup operations to
increase server performance.
>Localized Raw Fish and Cooked Fish.
>Fixed a bug where extra duplicate enchantments were showing when
linking artifact armor.
>Fixed a bug causing Barbarians to heal health when taking damage from
their damage pool if wearing certain type of equipment.
>Updated Display Text for Barbarian Mode to reflect new changes.
->Barbarians now take 1% of their damage pool as additional true damage
per hit.
2016-12-29 01:52:06 -06:00
d7fbbb6619 Filter Cube compatibility added, Adventurer Mode added, Artifact Dust
now shows time on interaction.
2016-12-28 01:56:30 -06:00
9b22eb4bb3 +> Fixed Ranger Mode issues and controls with Rangers not being able to
use their bow when cooldown meters were displayed.
+> Elite Monsters now gain 25% more health and 5% more base damage for
every player that joins after the 4th when fighting Elite Monsters.
>Party buff maximum cap reduced from 90% Bonus Damage/Defense to 60%
Bonus Damage/Defense Max.
>Fixed a bug causing Poison to kill players. This is unintended.
>Fixed a bug causing players in Slayer mode to not be revived properly.
>Fixed a bug causing players to be teleported above their revival
location on automatic buy-back thanks to the Sweet Candies.
2016-12-27 18:23:49 -06:00
464531b06e Re-Enabled Rocket Booster when Christmas Event is Deactivated. 2016-12-26 14:58:51 -06:00
6b5ad31745 Holiday event over. "Limited Christmas Mode" is now active. Fixed major
loop issue with Cupid and Defender interaction. Minor bugfixes and
improvements.
2016-12-26 02:57:31 -06:00
374b045623 Final commit including all changes necessary to make the Holiday Event
completely functional!
2016-12-25 07:53:15 -06:00
b1adb5eeac Setup code for the Christmas Holiday Event. 2016-12-23 00:09:29 -06:00
c94ae9836f No longer uses any of the pluginupdater tasks from the old updating
system.
2016-12-20 02:04:40 -06:00
36a42076e8 Added compatibility link with AutoUpdatePlugin. 2016-12-20 01:54:20 -06:00
1a1131d499 Further optimizations to Lava Plume creation. 2016-12-19 23:41:39 -06:00
f3fdcdfc38 Decreased the impact Lava Plumes had on server performance. 2016-12-19 22:31:32 -06:00
03876eec32 Fix Defender mechanics. Fix various debug messages. Tons of bugfixes. 2016-12-19 18:46:57 -06:00
1e77b8abeb Hotfix for leader chain spawning in the Nether. 2016-12-18 17:43:29 -06:00
ebace20b24 Minor optimization fixes. 2016-12-18 16:14:42 -06:00
e511406a0c Fixed a lot of major reported bugs. 2016-12-16 16:56:27 -06:00
b713263a66 Fixed a major item dropping bug. Items collected were not guaranteed to
end up in a player's inventory, losing items forever.
2016-12-13 23:56:45 -06:00
77021cf042 Fixed Death drop bugs. Fixed Autoforging bugs. Modified Sound pickup
algorithm to sound less plain and more varied.
2016-12-13 20:53:15 -06:00
cee9753b7f Fixexd bug with poison killing players. Possibly fixed bug with double
death messages relating to poison.
2016-12-13 18:45:21 -06:00
f1cc45e9e5 Fix bug with Poison killing players. 2016-12-13 18:16:43 -06:00
8752760670 Fixed behavior of Filter Cubes not filtering same types of material. 2016-12-12 23:31:35 -06:00
bdd45d404c >Modified Vendetta stacks to persist on relogs as well.
>Fixed a bug causing the off-hand weapon of a Barbarian to never
disappear when broken.
>Fixed an exploit allowing Barbarians to relog and reset their buffs to
0 stacks.
>Fixed a bug causing players with newer profiles to bug out when leaving
and relogging after death.
>Fixed a bug causing Filter Cube filter inventories to close
occasionally at random when a player still had the Filter inventory
open.
2016-12-12 17:43:40 -06:00
640ea50149 Make regular item pickup sound global. 2016-12-11 20:30:00 -06:00
8f9f537389 Increased priority of item pickup event so it is handled through the
Jobs plugin first to prevent conflicts with the filter cubes/vacuum
cubes.
2016-12-11 15:31:41 -06:00
bc8b73977f Prevent renaming of all Living Entities to established monster types. 2016-12-11 15:10:32 -06:00
975470d6fa Added Filter Cube recipe to '/craft' menu. 2016-12-11 14:50:24 -06:00
a15d7dd735 Implemented all new mechanics for Hellfire monsters. Cleanup and minor
bugs added. Full Notes:

+>Party Matching now does not create a party until at least two players
are within the vicinity of each other. This effectively increases the
cap of players in parties from 16 players to 32 players, if all 16
parties were filled with 2 players each.
+>Added the EntityDamagedEvent which returns the amount of damage an
entity takes and the cause of the damage. This is also cancellable which
will prevent the entity from losing health and prevents on-hit effects
from being applied.
+>Added isWorldShopSign() to the API to detect if a sign is attached to
a world shop.
+>Added getWorldShopItemBasePrice() to the API. Returns the base price
of any item using the new world shop pricing system.
+>Added LivingEntity versions of all Monster commands to the API.
+>The beginning stages of gearing can be a pain as you can get one shot
by most mobs at the Dangerous tier even with some iron pieces. While one
solution may be to lower the damage
output of Dangerous monsters, it seems the drops are good enough to
justify the difficulty of this range. Instead we decided to decrease the
gearing gap between Leather/Iron versus Diamond/Gold.
This provides players with more meaningful upgrade routes and makes
damage reduction feel more impactful early game. After all, the first
30% of defense hardly matters.

The scale went from looking like this:
	L3<I5<LH6<D8<G10<IH10<DH16<GH20 
TO THIS: 
	L6<I7<D8<G10<LH12<IH14<DH16<GH20

Progression-wise, the second scale makes more sense as it keeps the
armor upgrades in the same order while emphasizing that any Hardened
piece is automatically
better than a regular Gold piece.

+>Flat Damage Reduction from Leather armor increased from 3/6% per piece
(Regular/Hardened) to 6/12% per piece.
+>Flat Damage Reduction from Iron armor increased from 5/10% per piece
to 7/14% per piece.
+>Fire eruptions now occur in the Nether to liven up the tame lava seas.
+>Fire Protection now actually reduces damage dealt	by fires. This is
actually very important with the update below!
+>Fire and Lava now increases your fire ticks indefinitely, therefore
the longer you stay in lava, the longer you will burn until it gets
removed!
+>Fire ticks will deal more damage the larger your fire tick count is!
This is mitigated heavily by Fire Protection on armor. Do NOT stand in
fire too long or YOU WILL die!
+>Fire tick stacks now show up in the action bar.
+>World Shops have been revamped. World Shop prices are now controlled
externally and can be rebalanced and modified at any time. Signs will
reflect these changes when viewing the items.
+>Any player can now place and remove world shops, the shop will
automatically be setup. Crafting Recipe for a world shop is
<ITEM>+Chest/Trapped Chest+Sign. <ITEM> can be any item.
+>Prices of World Shops dynamically change based on the location the
shop in relation to the center of Twoside. Every 10000 blocks away
doubles the price of the item. Going underground increases the price by
50% per difficulty level. Placing a world shop in another dimension
multiplies the price by x4.
+>The 'Deal of the Day' has been added as an incentive to purchase items
from world shops on certain days. Keep an eye out for an item you may
want to purchase! The item will be discounted everywhere regardless of
location!
+>Players that can attack on a moment's notice can make the most use of
a weapon's damage. Sprinting and attacking from mid-air deals 20% more
damage.
+>Some sound effects regarding combat has been globalized so all nearby
players can hear the action that is going on.
+>The Tactics job now has bonuses activated on all combat stats.
+>Fixed Localization of the different versions of the Anvil. (Slightly
Damaged and Very Damaged)
+>Added a new version of the 'Earth Wave' artifact ability. Damage
scaling decreased, but has huge AoE potential and deals double damage on
soft ground. Has no cooldown, but difficult to use without a height
advantage.
+>Added in Vacuum Cubes and Filter Cubes. See '/craft' for the crafting
recipes of these two new Cubes.
	Vacuum Cubes only store placeable blocks and suck up all nearby items.
	Filter Cubes have a special inventory accessed by shift-right clicking
which will automatically insert items of the same type into its
inventory automatically!
+>All entity types can now be modified with difficulty tags, this means
Deadly Horses, Dangerous Wolves, and Hellfire Slimes (and many more!)
are now a thing.
+>Nether difficulty spawning rules have been added: As you get further
and further away from the main hub in the Nether, the monsters increase
in difficulty. No longer depth-dependent like in the Overworld.
+>Health of all monsters within the Nether world have been increased
significantly.
+>Hellfire Ghast behavior has been modified. They now shoot faster
fireballs and at a much faster rate. They will also attempt to suicide
when low.
+>Blaze behavior has been modified. Blazes fire more fireballs, and they
explode on contact now. In addition, Hellfire Blazes now set the area on
fire temporarily.
+>Magma Cubes now buff all nearby monsters with higher defenses.
20%/40%/60%/80% damage reduction for Normal/Dangerous/Deadly/Hellfire
tiers respectively.
+>The item drop rate in the Nether has been increased by 30%.
>Diamond armor (8/16% per piece) and Gold armor (10/20% per piece)
defense values remain the same.
>The Hunter's Compass is now more aggressive at looking for Elite spawn
locations.
>Fixed a bug causing the artifact ability leveling menu to never appear
for artifacts T11 or higher.
>Fixed a bug causing shop purchase notifications to crash the server if
certain conditions are met.
>Fixed a bug causing arrow quivers to mysteriously vanish from players'
inventories when running out of arrows.
>Fixed a bug causing Ranger gear to drop with a lower tier rate than
other items.
>Fixed a bug causing Non-Monster creatures to create errors when
attempting to use Eruption on them.
>Fixed a bug causing the party bonus to not increase damage to party
members.
>Fixed a bug preventing Artifact armor from losing durability from all
sources of damage.
>Fixed a bug causing errors when using name tags on non-hostile
creatures.
>Fixed a bug where the cooldown indicator for the Eruption ability was
not properly adjusting with increased cooldown reduction.
>Fixed a bug preventing players from inserting items into Item Cubes
when the ID of the Item Cube window they are viewing is the same as the
ID of the cube they are inserting into.
>Fixed a bug where players were receiving damage reduction by holding
armor in their hand.
>Moved Arrow Quivers from the Misc. Items category to the Containers
category in the /craft menu.
>Modified heart display of mobs to display transparent hearts for
missing health. 
>Fixed bugs relating to players being unable to obtain all achievements
due to plugins manipulating them.
>Fixed a bug preventing Slime and Magma Cube splits from happening
properly when they die.
->Decreased the chance Coal dropped from monsters significantly.
->Decreased the chance Ender Chests dropped from monsters significantly.
->Decreased the drop rate of tier-less/surface monsters.
->Ranger Base Dodge Chance decreased from 50%->40%.
->Proper footing is important to maximizing damage. Attacks from mid-air
now deal 20% less damage when not sprinting.
->Ranger Invincibility Time on Tumble with a full set decreased from 3
seconds -> 1.5 seconds.
->Deprecated all Monster versions of the Monster commands in the API.
The newer system uses Living Entities instead.
2016-12-11 14:28:07 -06:00
aa25cf1792 Fixed Achievment Bugs. Modified Ghast behavior and firing rates. 2016-12-09 21:44:32 -06:00
68cf1f8500 Fully implemented and bug-free version of Filter and Vacuum Cubes 2016-12-07 21:52:59 -06:00
71c1d51d76 Prep for Filter Cube development. 2016-12-06 18:16:57 -06:00
5507546ac5 Vacuum Cube implementation completed. 2016-12-04 23:12:55 -06:00
e100ccaadc Attempted to add Vacuum Cube. 2016-12-04 19:22:18 -06:00
22816a8022 Online commit to continue work portably. Updated Earth Wave and world
shop behavior slightly.
2016-12-02 21:36:04 -06:00
06bd56e661 World Shops completed. Deal of the day feature now exists! 2016-12-01 18:43:32 -06:00
213dcfc7dc World Shop basic crafting and placing added. Still needs a few bugfixes.
Implemented all Tactics' bonuses to combat related areas. Fixed Anvil
localization.
2016-11-28 22:50:23 -06:00
BuildTools
1df9b0765d Merge branch 'dev' 2016-11-28 18:51:23 -06:00
6b50cdd748 First merge with basic master branch. 2016-11-28 18:49:58 -06:00
179 changed files with 36500 additions and 3708 deletions

12
.classpath Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="jgrapht"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/>
<classpathentry kind="lib" path="D:/Documents/GlowAPI_v1.4.4.jar"/>
<classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="D:/Documents/aPlugin.jar"/>
<classpathentry kind="src" path="/AutoPluginUpdate"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${resource}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/TwosideKeeper"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TwosideKeeper"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/TwosideKeeper/projectBuilder.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/TwosideKeeper}"/>
</launchConfiguration>

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.*
/bin

27
.project Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TwosideKeeper</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java=UTF-8
encoding//src/sig/plugin/TwosideKeeper/TwosideKeeper.java=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

Binary file not shown.

View File

@ -1,6 +1,7 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.9.0a version: 3.X
loadbefore: [aPlugin]
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.
@ -122,3 +123,73 @@ commands:
usage: /craft ITEM usage: /craft ITEM
permission: TwosideKeeper.money permission: TwosideKeeper.money
permission-message: No permissions! permission-message: No permissions!
weather:
description: Toggles the sending of a weather warning message to the player.
usage: /weather <DISCORD NAME>
permission: TwosideKeeper.money
permission-message: No permissions!
red:
description: Ready up for the ice skating race.
usage: /red
permission: TwosideKeeper.money
permission-message: No permissions!
ready:
description: Ready up for the tree climbing race.
usage: /ready
permission: TwosideKeeper.money
permission-message: No permissions!
habitat:
description: View the habitat levels within the area.
usage: /habitat
permission: TwosideKeeper.money
permission-message: No permissions!
debugreport:
description: View a full debug report of the Server.
usage: /debugreport
permission: TwosideKeeper.fulldebugreport
permission-message: No permissions!
equip_weapon:
description: Toggle Automatic Equipping of Weapons
usage: /equip_weapon
permission: TwosideKeeper.money
permission-message: No permissions!
equip_armor:
description: Toggle Automatic Equipping of Armor
usage: /equip_armor
permission: TwosideKeeper.money
permission-message: No permissions!
options:
description: Displays a menu to toggle plugin-specific options.
usage: /options
permission: TwosideKeeper.money
permission-message: No permissions!
settings:
description: Displays a menu to toggle plugin-specific options.
usage: /settings
permission: TwosideKeeper.money
permission-message: No permissions!
damage_numbers:
description: Toggles the damage numbers that display while dealing damage.
usage: /damage_numbers
permission: TwosideKeeper.money
permission-message: No permissions!
dailyloot:
description: Loots a certain box.
usage: /dailyloot <UUID>
permission: TwosideKeeper.money
permission-message: No permissions!
pvp:
description: Declare PvP to a player.
usage: /pvp
permission: TwosideKeeper.money
permission-message: No permissions!
fb:
description: Determine if a player is a fresh blood player or not.
usage: /fb <player>
permission: TwosideKeeper.money
permission-message: No permissions!
search:
description: Displays a listing of items in Recycling Centers. Supply an argument to search for a specific item.
usage: /search [Item Name]
permission: TwosideKeeper.money
permission-message: No permissions!

View File

@ -1,24 +1,35 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.util.HashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ActionBarBuffUpdater{ public class ActionBarBuffUpdater{
/*
* LIST OF BUFFS:
* basename / icon string
*
* Poison ChatColor.YELLOW+""
* DeathMark ChatColor.DARK_RED+""
*/
public static String getActionBarPrefix(LivingEntity p) { public static String getActionBarPrefix(LivingEntity p) {
StringBuilder actionbardisplay = new StringBuilder(""); StringBuilder actionbardisplay = new StringBuilder("");
for (PotionEffect pe : p.getActivePotionEffects()) { for (PotionEffect pe : p.getActivePotionEffects()) {
if (pe.getAmplifier()>3) { actionbardisplay.append(ParseEffect(p,pe));
actionbardisplay.append(ParseEffect(p,pe));
}
} }
actionbardisplay.append(AddAdditionalEffects(p)); actionbardisplay.append(AddAdditionalEffects(p));
//TwosideKeeper.log(actionbardisplay.toString(), 0);
if (actionbardisplay.toString().contains(" ")) { if (actionbardisplay.toString().contains(" ")) {
return actionbardisplay.toString().substring(0, actionbardisplay.toString().lastIndexOf(" ")); return actionbardisplay.toString().substring(0, actionbardisplay.toString().lastIndexOf(" "));
} else { } else {
@ -30,27 +41,83 @@ public class ActionBarBuffUpdater{
StringBuilder effectString=new StringBuilder(""); StringBuilder effectString=new StringBuilder("");
if (p instanceof Player) { if (p instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)p); PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)p);
if (pd.lifestealstacks>4) { if (p.getFireTicks()>0) {
effectString.append(ChatColor.AQUA+""); effectString.append(ChatColor.GOLD);
effectString.append("");
effectString.append(AppendAmplifier((p.getFireTicks()/20)-1,false));
effectString.append(" ");
}
/*if (pd.lifestealstacks>0) {
effectString.append(ChatColor.AQUA);
effectString.append("");
effectString.append(AppendAmplifier(pd.lifestealstacks-1)); effectString.append(AppendAmplifier(pd.lifestealstacks-1));
effectString.append(" "); effectString.append(" ");
} }*/
if (pd.weaponcharges>4) { /*if (pd.weaponcharges>0) {
effectString.append(ChatColor.DARK_AQUA+""); effectString.append(ChatColor.DARK_AQUA);
effectString.append("");
effectString.append(AppendAmplifier(pd.weaponcharges-1)); effectString.append(AppendAmplifier(pd.weaponcharges-1));
effectString.append(" "); effectString.append(" ");
} }*/
if (pd.damagepool>4) { /*if (pd.damagepool>0) {
effectString.append(ChatColor.DARK_PURPLE+""); effectString.append(ChatColor.DARK_PURPLE);
effectString.append("");
effectString.append(AppendAmplifier((int)(pd.damagepool-1))); effectString.append(AppendAmplifier((int)(pd.damagepool-1)));
effectString.append(" "); effectString.append(" ");
}*/
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() &&
ItemSet.hasFullSet((Player)p, ItemSet.SONGSTEEL)) {
effectString.append(ChatColor.GRAY);
effectString.append("");
effectString.append(AppendAmplifier(((int)((pd.lastvendettastack+200)-TwosideKeeper.getServerTickTime())/20)-1,false));
effectString.append(" ");
} }
if (pd.swiftaegisamt>4) { if (pd.swiftaegisamt>0) {
effectString.append(ChatColor.YELLOW+""); effectString.append(ChatColor.YELLOW);
effectString.append("");
effectString.append(AppendAmplifier((int)(GenericFunctions.getSwiftAegisAmt((Player)p)-1))); effectString.append(AppendAmplifier((int)(GenericFunctions.getSwiftAegisAmt((Player)p)-1)));
effectString.append(" "); effectString.append(" ");
} }
if (pd.regenpool>0) {
effectString.append(ChatColor.BLUE);
effectString.append(ChatColor.BOLD);
effectString.append("");
effectString.append(AppendAmplifier((int)(pd.regenpool)));
effectString.append(" ");
}
if (pd.vendetta_amt>0 && effectString.length()==0) {
}
if (pd.lastusedRejuvenation+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATION_COOLDOWN, (Player)p)>TwosideKeeper.getServerTickTime()) {
effectString.append(ChatColor.GREEN);
effectString.append(ChatColor.BOLD);
effectString.append(ChatColor.UNDERLINE);
effectString.append("Rejuvenation");
int timeRemaining = (int)((pd.lastusedRejuvenation+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATION_COOLDOWN, (Player)p))-TwosideKeeper.getServerTickTime());
effectString.append(ConvertBuffTimeToIcon(timeRemaining));
effectString.append(ChatColor.RESET);
effectString.append(" ");
}
} }
HashMap<String,Buff> buffMap = Buff.getBuffData(p);
for (String s : buffMap.keySet()) {
Buff b = buffMap.get(s);
if (b.getRemainingBuffTime()>0) {
effectString.append(b.getBuffIcon());
effectString.append(" ");
if (p instanceof Player) {
effectString.append(b.getDisplayName());
}
effectString.append(ConvertBuffAmplifierToIcon(b.getAmplifier()));
effectString.append(" ");
if (b.getRemainingBuffTime()<=200 || b.getDisplayTimerAlways()) {
effectString.append(ConvertBuffTimeToIcon(b.getRemainingBuffTime()));
}
effectString.append(" ");
}
}
if (effectString.length()>0) { if (effectString.length()>0) {
return effectString.toString()+ChatColor.RESET; return effectString.toString()+ChatColor.RESET;
} else { } else {
@ -58,33 +125,122 @@ public class ActionBarBuffUpdater{
} }
} }
private static String ConvertBuffAmplifierToIcon(int amplifier) {
if (amplifier==1) {
return "";
} else
if (amplifier==2) {
return "";
} else
if (amplifier==3) {
return "";
} else
if (amplifier==4) {
return "";
} else
if (amplifier==5) {
return "";
} else
if (amplifier==6) {
return "";
} else
if (amplifier==7) {
return "";
} else
if (amplifier==8) {
return "";
} else
if (amplifier==9) {
return "";
} else
if (amplifier==10) {
return "";
} else
if (amplifier==11) {
return "";
} else
if (amplifier==12) {
return "";
} else {
if (amplifier!=0) {
return Integer.toString(amplifier);
} else {
return "";
}
}
}
private static String ConvertBuffTimeToIcon(long remainingBuffTime) {
if (remainingBuffTime>200) {
return Long.toString(remainingBuffTime/20);
} else
if (remainingBuffTime>180) {
return "";
} else
if (remainingBuffTime>160) {
return "";
} else
if (remainingBuffTime>140) {
return "";
} else
if (remainingBuffTime>120) {
return "";
} else
if (remainingBuffTime>100) {
return "";
} else
if (remainingBuffTime>80) {
return "";
} else
if (remainingBuffTime>60) {
return "";
} else
if (remainingBuffTime>40) {
return "";
} else
if (remainingBuffTime>20) {
return "";
} else
{
return "";
}
}
private static String ParseEffect(LivingEntity p, PotionEffect pe) { private static String ParseEffect(LivingEntity p, PotionEffect pe) {
StringBuilder effectString=new StringBuilder(""); StringBuilder effectString=new StringBuilder("");
PotionEffectType pet = pe.getType(); PotionEffectType pet = pe.getType();
if (pet.equals(PotionEffectType.INCREASE_DAMAGE)) { if (pet.equals(PotionEffectType.INCREASE_DAMAGE)) {
effectString.append(ChatColor.GOLD+""); effectString.append(ChatColor.GOLD);
effectString.append("");
} else } else
if (pet.equals(PotionEffectType.DAMAGE_RESISTANCE)) { if (pet.equals(PotionEffectType.DAMAGE_RESISTANCE)) {
effectString.append(ChatColor.BLUE+""); effectString.append(ChatColor.BLUE);
effectString.append("");
} else } else
if (pet.equals(PotionEffectType.REGENERATION)) { if (pet.equals(PotionEffectType.REGENERATION)) {
effectString.append(ChatColor.GREEN+""); effectString.append(ChatColor.GREEN);
effectString.append("");
} else } else
if (pet.equals(PotionEffectType.SPEED)) { if (pet.equals(PotionEffectType.SPEED)) {
effectString.append(ChatColor.WHITE+""); effectString.append(ChatColor.WHITE);
effectString.append("");
} else } else
if (pet.equals(PotionEffectType.POISON) || /*if (pet.equals(PotionEffectType.POISON) ||
(pet.equals(PotionEffectType.BLINDNESS) && (p instanceof LivingEntity && !(p instanceof Player)))) { (pet.equals(PotionEffectType.BLINDNESS) && (p instanceof LivingEntity && !(p instanceof Player)))) {
effectString.append(ChatColor.YELLOW+""); effectString.append(ChatColor.YELLOW);
} else effectString.append("");
if ((pet.equals(PotionEffectType.UNLUCK) && (p instanceof LivingEntity && !(p instanceof Player)))) { } else*/
effectString.append(ChatColor.DARK_RED+""); /*if ((pet.equals(PotionEffectType.UNLUCK) && (p instanceof LivingEntity && !(p instanceof Player)))) {
} else effectString.append(ChatColor.DARK_RED);
effectString.append("");
} else*/
if (pet.equals(PotionEffectType.SLOW)) { if (pet.equals(PotionEffectType.SLOW)) {
effectString.append(ChatColor.DARK_AQUA+""); effectString.append(ChatColor.DARK_AQUA);
effectString.append("");
} else } else
if (pet.equals(PotionEffectType.WEAKNESS) || pet.equals(PotionEffectType.SLOW_DIGGING)) { if (pet.equals(PotionEffectType.WEAKNESS) || pet.equals(PotionEffectType.SLOW_DIGGING)) {
effectString.append(ChatColor.RED+""); effectString.append(ChatColor.RED);
effectString.append("");
} }
if (effectString.length()>0) { if (effectString.length()>0) {
effectString.append(AppendAmplifier(pe.getAmplifier())); effectString.append(AppendAmplifier(pe.getAmplifier()));
@ -98,8 +254,12 @@ public class ActionBarBuffUpdater{
} }
private static String AppendAmplifier(int amplifier) { private static String AppendAmplifier(int amplifier) {
return AppendAmplifier(amplifier,true);
}
private static String AppendAmplifier(int amplifier, boolean romanNumerals) {
StringBuilder amp = new StringBuilder(" "); StringBuilder amp = new StringBuilder(" ");
if (amplifier+1<=10) { if (amplifier+1<=10 && romanNumerals) {
amp.append(ChatColor.GRAY+""+WorldShop.toRomanNumeral(amplifier+1)); amp.append(ChatColor.GRAY+""+WorldShop.toRomanNumeral(amplifier+1));
} else { } else {
amp.append(ChatColor.GRAY+""+(amplifier+1)); amp.append(ChatColor.GRAY+""+(amplifier+1));

View File

@ -12,6 +12,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
public class Artifact { public class Artifact {
public static ItemStack createArtifactItem(ArtifactItem type) { public static ItemStack createArtifactItem(ArtifactItem type) {
@ -133,6 +135,9 @@ public class Artifact {
} }
if (reprint_lore) { if (reprint_lore) {
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item"); l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item");
if (GenericFunctions.isEquip(item)) {
l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T1 Artifact");
}
if (type==ArtifactItem.MALLEABLE_BASE) { if (type==ArtifactItem.MALLEABLE_BASE) {
l.add(ChatColor.YELLOW+" Right-click to activate"); l.add(ChatColor.YELLOW+" Right-click to activate");
l.add(ChatColor.YELLOW+" this base."); l.add(ChatColor.YELLOW+" this base.");
@ -172,11 +177,11 @@ public class Artifact {
if (item.getItemMeta().hasLore()) { if (item.getItemMeta().hasLore()) {
l = item.getItemMeta().getLore(); l = item.getItemMeta().getLore();
} }
l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(ait.getItemName())+" Artifact"); l.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item"); l.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item");
m.setLore(l); m.setLore(l);
item.setItemMeta(m); item.setItemMeta(m);
item.addUnsafeEnchantment(Enchantment.LUCK, tier); //item.addUnsafeEnchantment(Enchantment.LUCK, tier);
return item; return item;
} }
public static boolean isArtifact(ItemStack item) { public static boolean isArtifact(ItemStack item) {
@ -185,7 +190,9 @@ public class Artifact {
item.hasItemMeta() && item.hasItemMeta() &&
item.getItemMeta().hasLore() && item.getItemMeta().hasLore() &&
(GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") || (GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item"))) { item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item") ||
(ItemUtils.LoreContainsSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T") &&
ItemUtils.LoreContainsSubstring(item, " Artifact") && TextUtils.hasNoSpaceBeforeAndAfter(ChatColor.GOLD+""+ChatColor.BOLD+"T"," Artifact",item.getItemMeta().getLore())))) {
//This is an artifact. //This is an artifact.
return true; return true;
} else { } else {
@ -237,6 +244,7 @@ public class Artifact {
m.setLore(lore); m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe"); m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
newitem.setItemMeta(m); newitem.setItemMeta(m);
newitem.addUnsafeEnchantment(Enchantment.LUCK, tier);
return newitem.clone(); return newitem.clone();
} }
} }

View File

@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@Deprecated
public class AutoUpdatePlugin implements Runnable { public class AutoUpdatePlugin implements Runnable {
List<Plugin> plugins; List<Plugin> plugins;
boolean restarting=false; boolean restarting=false;
@ -79,7 +80,7 @@ public class AutoUpdatePlugin implements Runnable {
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately.");
} }
if (restarting) { if (restarting) {
TwosideKeeper.updateServer(); //TwosideKeeper.updateServer();
} }
}},1); }},1);
TwosideKeeper.log("New hash: "+md5, 2); TwosideKeeper.log("New hash: "+md5, 2);

View File

@ -12,9 +12,14 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class AwakenedArtifact { public class AwakenedArtifact {
int experience_points=0; int experience_points=0;
@ -89,11 +94,12 @@ public class AwakenedArtifact {
if (totalval>=1000) { if (totalval>=1000) {
//LEVEL UP! //LEVEL UP!
ItemStack item = addLV(artifact,totalval/1000, p); ItemStack item = addLV(artifact,totalval/1000, p);
item = addMaxAP(item,totalval/1000);
item = setEXP(item,totalval%1000); item = setEXP(item,totalval%1000);
item = addAP(item,totalval/1000); item = addAP(item,totalval/1000);
double potentialred = 10.0d; double potentialred = 0.1d * getPotential(item); //5
potentialred *= 1 - GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d; potentialred *= 1d - (5d+GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact,p))/100d;
TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4); TwosideKeeper.log("Potential is reduced by "+(potentialred)+"% from "+getPotential(item), 0);
if (getPotential(item)>potentialred) { if (getPotential(item)>potentialred) {
item = setPotential(item,(int)(getPotential(item)-potentialred)); item = setPotential(item,(int)(getPotential(item)-potentialred));
if (Math.random() < (potentialred % 1)) { if (Math.random() < (potentialred % 1)) {
@ -105,16 +111,20 @@ public class AwakenedArtifact {
} }
} }
p.sendMessage("Your "+artifact.getItemMeta().getDisplayName()+ChatColor.RESET+" has upgraded to "+ChatColor.YELLOW+"Level "+getLV(artifact)+"!"); p.sendMessage("Your "+artifact.getItemMeta().getDisplayName()+ChatColor.RESET+" has upgraded to "+ChatColor.YELLOW+"Level "+getLV(artifact)+"!");
p.sendMessage("You have "+getAP(item)+" Ability Point"+((getAP(item)==1)?"":"s")+" to spend!"); TextComponent tc1 = new TextComponent("You have "+getAP(item)+" Ability Point"+((getAP(item)==1)?"":"s")+" to spend!");
TextComponent tc = new TextComponent(ChatColor.GREEN+"["+Character.toString((char)0x25b2)+"]");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to upgrade abilities on this artifact. "+ChatColor.GREEN+"Available AP: "+ChatColor.BLUE+AwakenedArtifact.getAP(item)).create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact menu "+GenericFunctions.CalculateSlot(item,p)));
/*TextComponent tc = new TextComponent("Click "); /*TextComponent tc = new TextComponent("Click ");
TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE); TextComponent ac = new TextComponent(ChatColor.GREEN+"[HERE]"+ChatColor.WHITE);
ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create())); ac.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(ChatColor.ITALIC+"Click to add another skill point!").create()));
ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact")); ac.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/awakenedartifact"));
tc.addExtra(ac); tc.addExtra(ac);
tc.addExtra(" to open up the ability upgrade menu."); tc.addExtra(" to open up the ability upgrade menu.");*/
p.spigot().sendMessage(tc);*/ tc1.addExtra(tc);
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(artifact, p, null), artifact,GenericFunctions.CalculateSlot(artifact,p))); p.spigot().sendMessage(tc1);
//p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(artifact, p, null), artifact,GenericFunctions.CalculateSlot(artifact,p)));
return item; return item;
} else { } else {
return setEXP(artifact,totalval); return setEXP(artifact,totalval);
@ -153,7 +163,7 @@ public class AwakenedArtifact {
List<String> lore = m.getLore(); List<String> lore = m.getLore();
DecimalFormat df = new DecimalFormat("000"); DecimalFormat df = new DecimalFormat("000");
lore.set(findLVLine(lore), ChatColor.GRAY+"Level "+df.format(amt)); lore.set(findLVLine(lore), ChatColor.GRAY+"Level "+df.format(amt));
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt); //lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt);
m.setLore(lore); m.setLore(lore);
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
@ -382,7 +392,10 @@ public class AwakenedArtifact {
//AP is on line 7 (element 6) //AP is on line 7 (element 6)
m.setLore(lore); m.setLore(lore);
item.setItemMeta(m); item.setItemMeta(m);
item.addUnsafeEnchantment(Enchantment.LUCK, tier); //ItemUtils.addLoreLineUnderneathLineContainingSubstring(artifact, "Artifact Crafting Item", ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
item=ItemUtils.ModifyLoreLineContainingSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T", ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Artifact");
//item.addUnsafeEnchantment(Enchantment.LUCK, tier);
item.removeEnchantment(Enchantment.LUCK);
return item; return item;
} }

View File

@ -0,0 +1,292 @@
package sig.plugin.TwosideKeeper.Boss;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.Box;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MaterialData;
/**
* Holds data about an arena.
* @param <E>
*/
public class Arena<E> {
HashMap<Block,MaterialData> oldblocklist = new HashMap<Block,MaterialData>();
List<Material> wallmats = new ArrayList<Material>();
List<Material> floormats = new ArrayList<Material>();
List<Material> roofmats = new ArrayList<Material>();
List<Material> insidemats = new ArrayList<Material>();
List<Chunk> temporarychunks = new ArrayList<Chunk>();
List<Player> arenaplayers = new ArrayList<Player>();
Box box;
World world;
E test;
public Arena(World world, int x, int y, int z, int w, int h, int d,Material arena_mat) {
this.world = world;
this.box = new Box(x,y,z,w,h,d);
this.wallmats.add(arena_mat);
this.floormats.add(arena_mat);
this.roofmats.add(arena_mat);
}
public Arena(World world, int x, int y, int z, int w, int h, int d,Material...arena_mats) {
this.world = world;
this.box = new Box(x,y,z,w,h,d);
for (Material mat : arena_mats) {
this.wallmats.add(mat);
this.floormats.add(mat);
this.roofmats.add(mat);
}
}
public Arena(World world, int x, int y, int z, int w, int h, int d,Material insidemat, Material...arena_mats) {
this.world = world;
this.box = new Box(x,y,z,w,h,d);
for (Material mat : arena_mats) {
this.wallmats.add(mat);
this.floormats.add(mat);
this.roofmats.add(mat);
}
this.insidemats.add(insidemat);
}
public Arena(World world, int x, int y, int z, int w, int h, int d,Material insidemat, Material wallmat, Material floormat, Material roofmat) {
this.world = world;
this.box = new Box(x,y,z,w,h,d);
this.wallmats.add(wallmat);
this.floormats.add(floormat);
this.roofmats.add(roofmat);
this.insidemats.add(insidemat);
}
public Arena(World world, int x, int y, int z, int w, int h, int d, Material[] insidemats, Material[] wallmats, Material[] floormats, Material[] roofmats) {
this.world = world;
this.box = new Box(x,y,z,w,h,d);
for (Material mat : wallmats) {
this.wallmats.add(mat);
}
for (Material mat : floormats) {
this.floormats.add(mat);
}
for (Material mat : roofmats) {
this.roofmats.add(mat);
}
for (Material mat : insidemats) {
this.insidemats.add(mat);
}
}
public void runTick() {
for (Player p : arenaplayers) {
if (p==null || !p.isValid()) {
TwosideKeeper.ScheduleRemoval(arenaplayers,p);
}
}
for (Player p : Bukkit.getOnlinePlayers()) {
TwosideKeeper.log("Checking for "+p.getName(), 0);
if (p.getGameMode()==GameMode.SURVIVAL) {
if (arenaplayers.contains(p)) {
if (!insideBoundaries(p)) {
p.teleport(new Location(world,box.getX()+(box.getWidth()/2),box.getY()+(box.getHeight()/2),box.getZ()+(box.getDepth()/2)));
p.sendMessage(ChatColor.GREEN+"You cannot leave this arena!");
}
} else {
if (insideBoundaries(p)) {
p.teleport(new Location(world,box.getX()+(box.getWidth()/2),box.getY()+(box.getHeight()*2),box.getZ()+(box.getDepth()/2)));
p.sendMessage(ChatColor.GREEN+"You cannot enter this arena!");
}
}
}
}
}
private boolean insideBoundaries(Player p) {
int x = p.getLocation().getBlockX();
int y = p.getLocation().getBlockY();
int z = p.getLocation().getBlockZ();
return (x>=box.getX() && x<=box.getX()+box.getWidth() &&
y>=box.getY() && y<=box.getY()+box.getHeight() &&
z>=box.getZ() && z<=box.getZ()+box.getDepth());
}
public void AddPlayers(Player...players) {
for (Player p : players) {
arenaplayers.add(p);
}
}
public void RemovePlayers(Player...players) {
for (Player p : players) {
arenaplayers.remove(p);
}
}
public void AssembleArena() {
final int x = box.getX();
final int y = box.getY();
final int z = box.getZ();
AssembleArena(x,y,z,box.clone());
}
public void DisassembleArena() {
DisassembleArena(-1);
}
public void DisassembleArena(int amt) {
//amt is how many blocks to process in one tick.
int processed=0;
for (Block b : oldblocklist.keySet()) {
Chunk c = b.getChunk();
if (!TwosideKeeper.temporary_chunks.contains(c)) {
TwosideKeeper.temporary_chunks.add(c);
}
c.load();
if (!temporarychunks.contains(c)) {
temporarychunks.add(c);
}
MaterialData dat = oldblocklist.get(b);
if (b.getType()!=dat.getType() || b.getData()!=dat.getData()) {
b.setType(dat.getType());
b.setData(dat.getData());
}
if (amt!=-1) {TwosideKeeper.ScheduleRemoval(oldblocklist, b);}
processed++;
if (processed>amt && amt!=-1) {
break;
}
}
if (amt!=-1 && oldblocklist.size()>0) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{DisassembleArena(amt);}, 1);
}
}
private void AssembleArena(int curx, int cury, int curz, Box box) {
for (int i=0;i<8;i++) {
Block b = world.getBlockAt(curx, cury, curz);
Chunk c = b.getChunk();
if (!TwosideKeeper.temporary_chunks.contains(c)) {
TwosideKeeper.temporary_chunks.add(c);
}
c.load();
if (!temporarychunks.contains(c)) {
temporarychunks.add(c);
}
while (b.getState()!=null && b.getState() instanceof InventoryHolder) {
if (curx>box.getX()+box.getWidth()) {
curx=box.getX();
cury++;
}
if (cury>box.getY()+box.getHeight()) {
cury=box.getY();
curz++;
}
if (curz<box.getZ()+box.getDepth()) {
ConvertBlock(curx, cury, curz, box, b);
curx++;
}
}
if (curx>box.getX()+box.getWidth()) {
curx=box.getX();
cury++;
}
if (cury>box.getY()+box.getHeight()) {
cury=box.getY();
curz++;
}
if (curz<box.getZ()+box.getDepth()) {
ConvertBlock(curx, cury, curz, box, b);
curx++;
}
}
if (curz<=box.getZ()+box.getDepth()) {
final int x = curx;
final int y = cury;
final int z = curz;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
AssembleArena(x,y,z,box);
}, 1);
} else {
ClearAllTemporaryChunks();
}
}
private void ResetBlock(int curx, int cury, int curz, Box box, Block b) {
if (oldblocklist.containsKey(b)) {
MaterialData dat = oldblocklist.get(b);
if (b.getType()!=dat.getType() || b.getData()!=dat.getData()) {
b.setType(dat.getType());
b.setData(dat.getData());
}
oldblocklist.remove(b);
}
}
public void ConvertBlock(int curx, int cury, int curz, Box box, Block b) {
if (isWallBlock(curx,cury,curz,box)) {
oldblocklist.put(b,new MaterialData(b.getType(),b.getData()));
b.setType(wallmats.get((int)(Math.random()*wallmats.size())));
} else
if (isRoofBlock(curx,cury,curz,box)) {
oldblocklist.put(b,new MaterialData(b.getType(),b.getData()));
b.setType(roofmats.get((int)(Math.random()*roofmats.size())));
} else
if (isFloorBlock(curx,cury,curz,box)) {
oldblocklist.put(b,new MaterialData(b.getType(),b.getData()));
b.setType(floormats.get((int)(Math.random()*floormats.size())));
} else
{
oldblocklist.put(b,new MaterialData(b.getType(),b.getData()));
if (insidemats.size()>0) {
if (b.getType()!=Material.AIR && !b.isLiquid()) {
SoundUtils.playGlobalSound(b.getLocation(), Sound.BLOCK_METAL_BREAK, 0.3f, 0.3f);
}
b.setType(insidemats.get((int)(Math.random()*insidemats.size())));
} else {
b.setType(Material.AIR);
}
}
/*final int x = curx++;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
AssembleArena(x,cury,curz,box);
}, 1);*/
}
private boolean isFloorBlock(int curx, int cury, int curz, Box box2) {
return cury==box.getY();
}
private boolean isRoofBlock(int curx, int cury, int curz, Box box2) {
return cury==box.getY()+box.getHeight();
}
private boolean isWallBlock(int curx, int cury, int curz, Box box) {
return curx==box.getX() || curx==box.getWidth()+box.getX() ||
curz==box.getZ() || curz==box.getZ()+box.getDepth();
}
public void Cleanup() {
//ClearAllTemporaryChunks();
DisassembleArena();
}
private void ClearAllTemporaryChunks() {
TwosideKeeper.temporary_chunks.removeAll(temporarychunks);
temporarychunks.clear();
}
}

View File

@ -0,0 +1,160 @@
package sig.plugin.TwosideKeeper.Boss;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.Camera;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class EliteGuardian extends EliteMonster{
Location firstHitLoc = null;
boolean cutsceneplayed=false;
STATE state = STATE.WAITINGFORCUTSCENE;
int cutscenetimer=0;
Camera cam;
Arena arena;
Location startedspot;
public EliteGuardian(Monster m) {
super(m);
}
public void runTick() {
//This monster constantly gives itself its buffs as it may lose some (Debilitation mode).
increaseBarTextScroll();
dontDrown();
regenerateHealth();
resetToSpawn();
createBossHealthbar();
ignoreAllOtherTargets();
runStateMachine();
if (m.isValid() && targetlist.size()>0) {
getGlow();
}
runArenaTick();
}
private void runArenaTick() {
if (arena!=null) {
arena.runTick();
}
}
private void runStateMachine() {
switch (state) {
case PASSIVE:
m.setAI(true);
m.setInvulnerable(false);
break;
case WAITINGFORCUTSCENE:
m.setInvulnerable(true);
List<Player> nearby = GenericFunctions.getNearbyPlayers(m.getLocation(), 4);
if (nearby.size()>0) {
boolean hasLineOfSight=false;
for (Player p : nearby) {
if (p.hasLineOfSight(m)) {
hasLineOfSight=true;
break;
}
}
if (hasLineOfSight) {
List<Player> nearby2 = GenericFunctions.getNearbyPlayers(m.getLocation(), 16);
//Play the cutscene for all of these players.
/*for (Player p : nearby2) {
p.setVelocity(new Vector(0,0,0));
targetlist.add(p);
if (cutscenetimer==0) {
p.setGameMode(GameMode.SPECTATOR);
p.setSpectatorTarget(m);
}
}
if (cutscenetimer==0) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 40, 1, m);
}*/
cam = new Camera(m.getLocation(),nearby2.toArray(new Player[nearby2.size()]));
targetlist.addAll(nearby2);
TwosideKeeper.cameras.add(cam);
cutscenetimer=0;
state = STATE.RUNNINGCUTSCENE;
TwosideKeeper.log("Monster Location: "+m.getLocation(),5);
cam.rotateAroundPointWithZoom(0.55, 350, m.getLocation(), 8, 0.04, 1, 4);
//cam.rotateAroundPoint(0.55, 200, m.getLocation(), 8, 4);
arena = new Arena(m.getWorld(),
m.getLocation().getBlockX()-10,m.getLocation().getBlockY()-2,m.getLocation().getBlockZ()-10,
20,7,20,
Material.PRISMARINE);
arena.AddPlayers(nearby2.toArray(new Player[nearby2.size()]));
arena.AssembleArena();
TwosideKeeper.arenas.add(arena);
startedspot = m.getLocation().clone();
}
}
m.setAI(false);
m.setVelocity(new Vector(0,0,0));
break;
case RUNNINGCUTSCENE:
cutscenetimer++;
if (cutscenetimer>60) {
state=STATE.PASSIVE;
cam.Cleanup();
}
m.setAI(false);
m.setVelocity(new Vector(0,0,0));
m.teleport(startedspot);
break;
default:
break;
}
for (Player p : targetlist) {
adjustMiningFatigue(p);
}
}
private void adjustMiningFatigue(Player p) {
if (p.hasPotionEffect(PotionEffectType.SLOW_DIGGING) && ((GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW_DIGGING, p)==2 && GenericFunctions.getPotionEffectDuration(PotionEffectType.SLOW_DIGGING, p)>=4800) || (GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW_DIGGING, p)==20 && GenericFunctions.getPotionEffectDuration(PotionEffectType.SLOW_DIGGING, p)<4800))) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW_DIGGING, 6000, 20, p, true);
}
}
public void runHitEvent(LivingEntity damager, double dmg) {
super.runHitEvent(damager,dmg);
}
public void Cleanup() {
super.Cleanup();
if (arena!=null) {
arena.DisassembleArena();
TwosideKeeper.arenas.remove(arena);
}
}
public void AnnounceFailedTakedown() {
super.AnnounceFailedTakedown();
if (dpslist.size()>0 && !m.isDead()) {
if (arena!=null) {
arena.DisassembleArena();
TwosideKeeper.arenas.remove(arena);
arena=null;
}
state=STATE.WAITINGFORCUTSCENE;
cutscenetimer=0;
}
}
enum STATE {
PASSIVE, //Just works like vanilla Minecraft behavior.
WAITINGFORCUTSCENE, //A mode where the game is waiting for a cutscene to occur. The Elite Guardian does not move during this time.
RUNNINGCUTSCENE,
}
}

View File

@ -32,24 +32,31 @@ import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.EliteMonster; import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.APIUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class EliteZombie extends EliteMonster{ public class EliteZombie extends EliteMonster{
static int REFRESH_BUFFS = 20*30; static int REFRESH_BUFFS = 20*30;
static float FAST_MOVE_SPD = 0.65f; static float FAST_MOVE_SPD = 0.575f;
static long BURST_TIME = 20*3; static long BURST_TIME = 20*3;
static float BURST_LIMIT = 10f; static float BURST_LIMIT = 10f;
static int WEAKNESS_DURATION = 20*10; static int WEAKNESS_DURATION = 20*10;
static int POISON_DURATION = 20*10; static int POISON_DURATION = 20*10;
static int LEAP_COOLDOWN = 20*40; static int LEAP_COOLDOWN = 20*20;
static int ENRAGE_COOLDOWN = 20*60; static int ENRAGE_COOLDOWN = 20*60;
static int STORINGENERGY_COOLDOWN = 20*50; static int STORINGENERGY_COOLDOWN = 20*45;
static int WILLPOWER_COOLDOWN = 20*50; static int WILLPOWER_COOLDOWN = 20*30;
static int GLOW_TIME = 20*1; static int GLOW_TIME = 20*1;
private long stuckTimer=0;
private Location lastLoc = null;
long last_rebuff_time=0; long last_rebuff_time=0;
long last_burstcheck_time=0; long last_burstcheck_time=0;
long last_applyglow_time=0; long last_applyglow_time=0;
@ -88,14 +95,17 @@ public class EliteZombie extends EliteMonster{
protected void createBossHealthbar() { protected void createBossHealthbar() {
List<Player> currentplayers = bar.getPlayers(); List<Player> currentplayers = bar.getPlayers();
for (int i=0;i<currentplayers.size();i++) { /*for (int i=0;i<currentplayers.size();i++) {
if (!targetlist.contains(currentplayers.get(i))) { if (!targetlist.contains(currentplayers.get(i))) {
bar.removePlayer(currentplayers.get(i)); bar.removePlayer(currentplayers.get(i));
willpower_bar.removePlayer(currentplayers.get(i)); willpower_bar.removePlayer(currentplayers.get(i));
} }
} }*/
bar.removeAll();
willpower_bar.removeAll();
bar.setProgress(m.getHealth()/m.getMaxHealth()); bar.setProgress(m.getHealth()/m.getMaxHealth());
bar.setTitle(GenericFunctions.getDisplayName(m) + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):"")); bar.setTitle(GenericFunctions.getDisplayName(m) + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):""));
displayHealthbarToNearbyPlayers();
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
if (!currentplayers.contains(targetlist.get(i))) { if (!currentplayers.contains(targetlist.get(i))) {
bar.addPlayer(targetlist.get(i)); bar.addPlayer(targetlist.get(i));
@ -136,12 +146,12 @@ public class EliteZombie extends EliteMonster{
lp.setReapplicationDelay(20); lp.setReapplicationDelay(20);
lp.setBasePotionData(new PotionData(PotionType.POISON)); lp.setBasePotionData(new PotionData(PotionType.POISON));
lp.setParticle(Particle.SPELL); lp.setParticle(Particle.SPELL);
loc.getWorld().playSound(loc, Sound.ENTITY_HOSTILE_SPLASH, 1.0f, 1.0f); SoundUtils.playGlobalSound(loc, Sound.ENTITY_HOSTILE_SPLASH, 1.0f, 1.0f);
} }
private void adjustWillpower() { private void adjustWillpower() {
//Check for nearby mobs. Each mob increases willpower by 1. //Check for nearby mobs. Each mob increases willpower by 1.
if (Math.random()<=0.3 && !leaping && !storingenergy) { if (Math.random()<=0.5 && !leaping && !storingenergy) {
int mobcount=0; int mobcount=0;
List<Monster> monsterlist = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(10, 10, 10)); List<Monster> monsterlist = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(10, 10, 10));
mobcount=monsterlist.size()-1; mobcount=monsterlist.size()-1;
@ -246,8 +256,8 @@ public class EliteZombie extends EliteMonster{
p.setVelocity(new Vector(0,-1,0)); p.setVelocity(new Vector(0,-1,0));
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p);
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f); SoundUtils.playLocalSound(p, Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
p.playSound(p.getLocation(), Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f); SoundUtils.playLocalSound(p, Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
} }
} }
@ -267,13 +277,13 @@ public class EliteZombie extends EliteMonster{
} }
} }
if (!storingenergy) { if (!storingenergy) {
if (storingenergy_hit>0) { /*if (storingenergy_hit>0) {
storingenergy_hit/=1.04f; //storingenergy_hit/=1.04f;
if (storingenergy_hit<10) { if (storingenergy_hit<10) {
storingenergy_hit=0; storingenergy_hit=0;
} }
} } */
if (l.getLocation().distanceSquared(m.getLocation())>4096 && !leaping) { if (l.getLocation().distanceSquared(m.getLocation())>8192 && !leaping && last_leap_time+20<TwosideKeeper.getServerTickTime()) {
//Lose the target. //Lose the target.
targetlist.remove(l); targetlist.remove(l);
if (targetlist.size()>0) { if (targetlist.size()>0) {
@ -284,12 +294,12 @@ public class EliteZombie extends EliteMonster{
} }
} else } else
if (l.getLocation().distanceSquared(m.getLocation())>100 && !leaping) { if (l.getLocation().distanceSquared(m.getLocation())>100 && !leaping) {
l.getWorld().playSound(l.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 1.0f); SoundUtils.playGlobalSound(l.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 1.0f);
chasing=true; chasing=true;
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() { public void run() {
m.teleport(l.getLocation().add(Math.random(),Math.random(),Math.random())); m.teleport(l.getLocation().add(Math.random(),Math.random(),Math.random()));
l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20*5,7)); l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20*5,4));
l.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*1,7)); l.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*1,7));
chasing=false; chasing=false;
} }
@ -299,11 +309,27 @@ public class EliteZombie extends EliteMonster{
} else { } else {
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD); m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(DEFAULT_MOVE_SPD);
} }
}
if (l.getLocation().getY()>m.getLocation().getY()+1) { if (l.getLocation().getY()>m.getLocation().getY()+1) {
//Jump up to compensate. Move towards the player too. //Jump up to compensate. Move towards the player too.
m.setVelocity((m.getLocation().getDirection()).add(new Vector(0,0.2*(l.getLocation().getY()-m.getLocation().getY()),0))); m.setVelocity((m.getLocation().getDirection()).add(new Vector(0,0.2*(l.getLocation().getY()-m.getLocation().getY()),0)));
}
if (lastLoc!=null && lastLoc.distance(m.getLocation())<=0.4) {
stuckTimer++;
//TwosideKeeper.log("Stuck. "+stuckTimer, 0);
} else {
stuckTimer=0;
}
lastLoc = m.getLocation().clone();
if (stuckTimer>5) {
//Teleport randomly.
m.teleport(getNearbyFreeLocation(m.getLocation()));
stuckTimer=0;
}
}
if (l instanceof Player) {
Player pl = (Player)l;
pl.setFlying(false);
} }
} else { } else {
targetlist.remove(l); targetlist.remove(l);
@ -314,7 +340,7 @@ public class EliteZombie extends EliteMonster{
private void rebuff() { private void rebuff() {
if (last_rebuff_time+REFRESH_BUFFS<=TwosideKeeper.getServerTickTime()) { if (last_rebuff_time+REFRESH_BUFFS<=TwosideKeeper.getServerTickTime()) {
last_rebuff_time=TwosideKeeper.getServerTickTime(); last_rebuff_time=TwosideKeeper.getServerTickTime();
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8),true); //m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8),true);
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,8),true); m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,8),true);
//m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,2),true); //m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,2),true);
ItemStack helm = new ItemStack(Material.GOLD_AXE); ItemStack helm = new ItemStack(Material.GOLD_AXE);
@ -340,6 +366,11 @@ public class EliteZombie extends EliteMonster{
bar.setColor(BarColor.RED); bar.setColor(BarColor.RED);
if (!targetlist.contains(damager) && (damager instanceof Player)) { if (!targetlist.contains(damager) && (damager instanceof Player)) {
targetlist.add((Player)damager); targetlist.add((Player)damager);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
GenericFunctions.HealEntity(m,hpgain);
}
} }
if (!participantlist.contains(damager) && (damager instanceof Player)) { if (!participantlist.contains(damager) && (damager instanceof Player)) {
participantlist.add((Player)damager); participantlist.add((Player)damager);
@ -358,12 +389,12 @@ public class EliteZombie extends EliteMonster{
} }
last_regen_time=TwosideKeeper.getServerTickTime(); last_regen_time=TwosideKeeper.getServerTickTime();
double randomrate = 0d; double randomrate = 0d;
if (!chasing && CustomDamage.getPercentHealthRemaining(m)<=50) { if (!chasing && CustomDamage.getPercentHealthRemaining(m)<=90) {
if (last_leap_time+LEAP_COOLDOWN<=TwosideKeeper.getServerTickTime()) { if (last_leap_time+LEAP_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
performLeap(); performLeap();
} }
} }
if (CustomDamage.getPercentHealthRemaining(m)<=25) { if (CustomDamage.getPercentHealthRemaining(m)<=65) {
if (!leaping && !chasing && if (!leaping && !chasing &&
last_storingenergy_time+STORINGENERGY_COOLDOWN<=TwosideKeeper.getServerTickTime()) { last_storingenergy_time+STORINGENERGY_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
last_storingenergy_time=TwosideKeeper.getServerTickTime(); last_storingenergy_time=TwosideKeeper.getServerTickTime();
@ -371,6 +402,7 @@ public class EliteZombie extends EliteMonster{
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+" is absorbing energy!"); targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+" is absorbing energy!");
} }
Channel.createNewChannel(m, "Storing Energy", 20);
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f); m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0f);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() { public void run() {
@ -381,7 +413,7 @@ public class EliteZombie extends EliteMonster{
Player target = ChooseRandomTarget(); Player target = ChooseRandomTarget();
if (target!=null) { if (target!=null) {
if (last_storingenergy_health-m.getHealth()>0) { if (last_storingenergy_health-m.getHealth()>0) {
storingenergy_hit=(last_storingenergy_health-m.getHealth())*500d; storingenergy_hit=(last_storingenergy_health-m.getHealth());
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+"'s next hit is stronger!"); targetlist.get(i).sendMessage(ChatColor.GOLD+"The "+GenericFunctions.getDisplayName(m)+ChatColor.GOLD+"'s next hit is stronger!");
targetlist.get(i).sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+" \"DIE "+target.getName()+ChatColor.DARK_RED+"! DIEE!\""); targetlist.get(i).sendMessage(ChatColor.DARK_RED+""+ChatColor.ITALIC+" \"DIE "+target.getName()+ChatColor.DARK_RED+"! DIEE!\"");
@ -398,7 +430,7 @@ public class EliteZombie extends EliteMonster{
},6*20); },6*20);
} }
} }
if (CustomDamage.getPercentHealthRemaining(m)<=10) { if (CustomDamage.getPercentHealthRemaining(m)<=20) {
if (last_enrage_time+ENRAGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) { if (last_enrage_time+ENRAGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
last_enrage_time=TwosideKeeper.getServerTickTime(); last_enrage_time=TwosideKeeper.getServerTickTime();
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
@ -420,12 +452,12 @@ public class EliteZombie extends EliteMonster{
}},20*20); }},20*20);
} }
} }
if (CustomDamage.getPercentHealthRemaining(m)<=75 && if (CustomDamage.getPercentHealthRemaining(m)<=90 &&
CustomDamage.getPercentHealthRemaining(m)>50) { CustomDamage.getPercentHealthRemaining(m)>75) {
randomrate = 1/16d; randomrate = 1/16d;
} else } else
if (CustomDamage.getPercentHealthRemaining(m)<=50 && if (CustomDamage.getPercentHealthRemaining(m)<=75 &&
CustomDamage.getPercentHealthRemaining(m)>25) { CustomDamage.getPercentHealthRemaining(m)>50) {
randomrate = 1/8d; randomrate = 1/8d;
} else } else
{ {
@ -453,7 +485,8 @@ public class EliteZombie extends EliteMonster{
Monster nm = (Monster)m.getWorld().spawnEntity(getNearbyFreeLocation(m.getLocation()),choice); Monster nm = (Monster)m.getWorld().spawnEntity(getNearbyFreeLocation(m.getLocation()),choice);
Player target = targetlist.get((int)(Math.random() * targetlist.size())); Player target = targetlist.get((int)(Math.random() * targetlist.size()));
nm.setTarget(target); nm.setTarget(target);
MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE); //MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
MonsterController.convertLivingEntity(nm, LivingEntityDifficulty.HELLFIRE);
} }
if (CustomDamage.getPercentHealthRemaining(m)<10) { if (CustomDamage.getPercentHealthRemaining(m)<10) {
Player target = targetlist.get((int)(Math.random() * targetlist.size())); Player target = targetlist.get((int)(Math.random() * targetlist.size()));
@ -462,14 +495,15 @@ public class EliteZombie extends EliteMonster{
nm.setPowered(true); nm.setPowered(true);
} }
nm.setTarget(target); nm.setTarget(target);
MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE); //MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
MonsterController.convertLivingEntity(nm, LivingEntityDifficulty.HELLFIRE);
} }
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private void performLeap() { private void performLeap() {
last_leap_time = TwosideKeeper.getServerTickTime(); last_leap_time = TwosideKeeper.getServerTickTime();
int radius = (int)(6*(CustomDamage.getPercentHealthMissing(m)/100d))+1; int radius = (int)(5*(CustomDamage.getPercentHealthMissing(m)/100d))+4;
//Choose a target randomly. //Choose a target randomly.
Player target = ChooseRandomTarget(); Player target = ChooseRandomTarget();
m.setTarget(target); m.setTarget(target);
@ -496,7 +530,7 @@ public class EliteZombie extends EliteMonster{
} }
} }
TwosideKeeper.log("Selected block "+b.toString(), 5); TwosideKeeper.log("Selected block "+b.toString(), 5);
if (!aPlugin.API.isExplosionProof(b) && b.getType()!=Material.STAINED_GLASS) { if (!APIUtils.isExplosionProof(b) && b.getType()!=Material.STAINED_GLASS) {
Material type = b.getType(); Material type = b.getType();
Byte data = b.getData(); Byte data = b.getData();
storedblocks.put(b, type); storedblocks.put(b, type);
@ -524,12 +558,13 @@ public class EliteZombie extends EliteMonster{
b.setType(Material.AIR); b.setType(Material.AIR);
} else { } else {
b.setType(storedblocks.get(b)); b.setType(storedblocks.get(b));
b.setData(storedblockdata.get(b));
} }
aPlugin.API.sendSoundlessExplosion(target_leap_loc, 4); SoundUtils.playGlobalSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
b.getLocation().getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
} }
aPlugin.API.sendSoundlessExplosion(target_leap_loc, 4);
storedblocks.clear(); storedblocks.clear();
m.getLocation().getWorld().playSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f); SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
List<Player> nearbyplayers = GenericFunctions.getNearbyPlayers(target_leap_loc, radius); List<Player> nearbyplayers = GenericFunctions.getNearbyPlayers(target_leap_loc, radius);
for (int i=0;i<nearbyplayers.size();i++) { for (int i=0;i<nearbyplayers.size();i++) {
GenericFunctions.removeNoDamageTick(nearbyplayers.get(i), m); GenericFunctions.removeNoDamageTick(nearbyplayers.get(i), m);
@ -541,13 +576,18 @@ public class EliteZombie extends EliteMonster{
//GenericFunctions.DealDamageToNearbyPlayers(target_leap_loc, 5*200, radius, true, 2, m, "Leap",false); //GenericFunctions.DealDamageToNearbyPlayers(target_leap_loc, 5*200, radius, true, 2, m, "Leap",false);
//GenericFunctions.getNear //GenericFunctions.getNear
} }
},(int)(((20*3)*(CustomDamage.getPercentHealthRemaining(m)/100d))+30)); },(int)(((20*1.5)*(CustomDamage.getPercentHealthRemaining(m)/100d))+30));
} }
//Triggers when this mob hits something. //Triggers when this mob hits something.
public void hitEvent(LivingEntity ent) { public void hitEvent(LivingEntity ent) {
if (!targetlist.contains(ent) && (ent instanceof Player)) { if (!targetlist.contains(ent) && (ent instanceof Player)) {
targetlist.add((Player)ent); targetlist.add((Player)ent);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
if (Math.random()<=0.33) { if (Math.random()<=0.33) {
if (ent.hasPotionEffect(PotionEffectType.POISON)) { if (ent.hasPotionEffect(PotionEffectType.POISON)) {
@ -562,13 +602,14 @@ public class EliteZombie extends EliteMonster{
if (ent instanceof Player) { if (ent instanceof Player) {
Player p = (Player)ent; Player p = (Player)ent;
if (storingenergy_hit>0) { if (storingenergy_hit>0) {
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f); SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,20*4,0,p); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,20*4,0,p);
TwosideKeeper.log("Got hit for "+storingenergy_hit+" damage!", 2); TwosideKeeper.log("Got hit for "+storingenergy_hit+" damage!", 2);
GenericFunctions.removeNoDamageTick(p, m); //GenericFunctions.removeNoDamageTick(p, m);
if (CustomDamage.ApplyDamage(storingenergy_hit, m, p, null, "Stored Energy", CustomDamage.IGNOREDODGE)) { if (CustomDamage.ApplyDamage(storingenergy_hit, m, p, null, "Stored Energy", CustomDamage.TRUEDMG|CustomDamage.IGNOREDODGE|CustomDamage.IGNORE_DAMAGE_TICK)) {
//TwosideKeeperAPI.DealDamageToEntity(.CalculateDamageReduction(storingenergy_hit,p,m),p,m); //TwosideKeeperAPI.DealDamageToEntity(.CalculateDamageReduction(storingenergy_hit,p,m),p,m);
storingenergy_hit=0; storingenergy_hit=0;
p.setVelocity(m.getLocation().getDirection().multiply(2.0f));
} }
} }
} }

View File

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.Boss; package sig.plugin.TwosideKeeper.Boss;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@ -7,6 +8,7 @@ import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.ChargeZombie; import sig.plugin.TwosideKeeper.ChargeZombie;
import sig.plugin.TwosideKeeper.EliteMonster; import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class MegaWither extends EliteMonster{ public class MegaWither extends EliteMonster{
@ -27,6 +29,11 @@ public class MegaWither extends EliteMonster{
ignoreAllOtherTargets(); ignoreAllOtherTargets();
randomlyDropDown(); randomlyDropDown();
destroyNearbyBlocks(); destroyNearbyBlocks();
setupName();
}
private void setupName() {
TwosideKeeperAPI.setCustomLivingEntityName(m, ChatColor.DARK_RED+"Mega Wither");
} }
private void destroyNearbyBlocks() { private void destroyNearbyBlocks() {

View File

@ -0,0 +1,31 @@
package sig.plugin.TwosideKeeper.Boss;
import org.bukkit.Bukkit;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class SendMiningFatigueToAllNearbyElderGuardians extends BukkitRunnable {
@Override
public void run() {
for (EliteMonster em : TwosideKeeper.elitemonsters) {
if (em.getMonster() instanceof Guardian) {
//Apply Mining Fatigue 100 to all players.
for (Player p : Bukkit.getOnlinePlayers()) {
if (!p.hasPotionEffect(PotionEffectType.SLOW_DIGGING) || GenericFunctions.getPotionEffectDuration(PotionEffectType.SLOW_DIGGING,p)<1200 ||
GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW_DIGGING, p)<20) {
//p.getWorld().playEffect(p.getLocation(), Effect., arg2);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW_DIGGING, 6000, 20, p, true);
}
}
}
}
}
}

View File

@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag; import org.bukkit.boss.BarFlag;
@ -17,6 +18,7 @@ import org.bukkit.potion.PotionEffect;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@Deprecated
public class BossMonster { public class BossMonster {
private String name; private String name;
private double maxhp; private double maxhp;
@ -41,7 +43,7 @@ public class BossMonster {
this.m = m; this.m = m;
this.damagereduction=0.0; this.damagereduction=0.0;
this.buffs=null; this.buffs=null;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd; this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
this.hp_regen=0; this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG); this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
} }
@ -54,7 +56,7 @@ public class BossMonster {
this.attackstrength = attackstrength; this.attackstrength = attackstrength;
this.m = m; this.m = m;
this.buffs=null; this.buffs=null;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd; this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
this.hp_regen=0; this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG); this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
} }
@ -68,7 +70,7 @@ public class BossMonster {
this.attackstrength = attackstrength; this.attackstrength = attackstrength;
this.m = m; this.m = m;
this.buffs = buffs; this.buffs = buffs;
this.movespd=LivingEntityStructure.getLivingEntityStructure(m).original_movespd; this.movespd=LivingEntityStructure.GetLivingEntityStructure(m).original_movespd;
this.hp_regen=0; this.hp_regen=0;
this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG); this.bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SOLID, BarFlag.CREATE_FOG);
} }
@ -150,13 +152,15 @@ public class BossMonster {
protected void createBossHealthbar() { protected void createBossHealthbar() {
List<Player> currentplayers = bar.getPlayers(); List<Player> currentplayers = bar.getPlayers();
for (int i=0;i<currentplayers.size();i++) { /*for (int i=0;i<currentplayers.size();i++) {
if (!targetlist.contains(currentplayers.get(i))) { if (!targetlist.contains(currentplayers.get(i))) {
bar.removePlayer(currentplayers.get(i)); bar.removePlayer(currentplayers.get(i));
} }
} }*/
bar.removeAll();
bar.setProgress(m.getHealth()/m.getMaxHealth()); bar.setProgress(m.getHealth()/m.getMaxHealth());
bar.setTitle(GenericFunctions.getDisplayName(m) + ((m instanceof Monster && ((Monster)m).getTarget()!=null && (((Monster)m).getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)((Monster)m).getTarget()).getName()):"")); bar.setTitle(GenericFunctions.getDisplayName(m) + ((m instanceof Monster && ((Monster)m).getTarget()!=null && (((Monster)m).getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)((Monster)m).getTarget()).getName()):""));
displayHealthbarToNearbyPlayers();
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
if (!currentplayers.contains(targetlist.get(i))) { if (!currentplayers.contains(targetlist.get(i))) {
bar.addPlayer(targetlist.get(i)); bar.addPlayer(targetlist.get(i));
@ -164,4 +168,12 @@ public class BossMonster {
} }
} }
private void displayHealthbarToNearbyPlayers() {
for (Player p : Bukkit.getOnlinePlayers()) {
if (m.getLocation().distanceSquared(p.getLocation())<=2500) {
bar.addPlayer(p);
}
}
}
} }

View File

@ -0,0 +1,433 @@
package sig.plugin.TwosideKeeper;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.HelperStructures.BuffTemplate;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
public class Buff {
private String displayName;
private long expireTime;
private int level;
private Color col;
private String icon;
private boolean isGoodBuff; //If false, it's a debuff.
private boolean permanentBuff; //Whether or not this buff/debuff cannot be removed by normal means.
private boolean displayTimer;
/**
* Creates a new Buff structure.
* @param displayName The name that will show up in the action bar for players if they have this buff.
* @param duration The amount of time in ticks the buff will remain active.
* @param amplifier The amplifier/level/stack amount of this buff.
* @param buffcolor The color of the particles this buff creates.
* @param icon An icon that appears for the buff in the action bar and status bar for monster name tags. This typically includes a chat color code as well to distinguish this buff's color.
* @param isGoodBuff Whether or not this is a good buff. Debuffs should have this set to false.
*/
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff) {
this.displayName=displayName;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
this.level=amplifier;
this.col=buffcolor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=false;
this.displayTimer=false;
}
/**
* Creates a new Buff structure.
* @param displayName The name that will show up in the action bar for players if they have this buff.
* @param duration The amount of time in ticks the buff will remain active.
* @param amplifier The amplifier/level/stack amount of this buff.
* @param buffcolor The color of the particles this buff creates.
* @param icon An icon that appears for the buff in the action bar and status bar for monster name tags. This typically includes a chat color code as well to distinguish this buff's color.
* @param isGoodBuff Whether or not this is a good buff. Debuffs should have this set to false.
* @param permanentBuff Whether or not this buff cannot be removed. When set to true, the method buffCanBeRemoved() returns false, notifying the programmers that this buff should not be removed. This make the use of removeBuff() for this buff do absolutely nothing.
*/
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff, boolean permanentBuff) {
this.displayName=displayName;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
this.level=amplifier;
this.col=buffcolor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=permanentBuff;
this.displayTimer=false;
}
/**
* Creates a new Buff structure.
* @param displayName The name that will show up in the action bar for players if they have this buff.
* @param duration The amount of time in ticks the buff will remain active.
* @param amplifier The amplifier/level/stack amount of this buff.
* @param buffcolor The color of the particles this buff creates.
* @param icon An icon that appears for the buff in the action bar and status bar for monster name tags. This typically includes a chat color code as well to distinguish this buff's color.
* @param isGoodBuff Whether or not this is a good buff. Debuffs should have this set to false.
* @param permanentBuff Whether or not this buff cannot be removed. When set to true, the method buffCanBeRemoved() returns false, notifying the programmers that this buff should not be removed. This make the use of removeBuff() for this buff do absolutely nothing.
* @param displayTimer Whether or not to display the countdown timer even if the duration is greater than 10 seconds.
*/
public Buff(String displayName, long duration, int amplifier, Color buffcolor, String icon, boolean isGoodBuff, boolean permanentBuff, boolean displayTimer) {
this.displayName=displayName;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
this.level=amplifier;
this.col=buffcolor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=permanentBuff;
this.displayTimer=displayTimer;
}
public static boolean hasBuffInHashMap(LivingEntity l, String name) {
if (l instanceof Player) {
Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return pd.buffs.containsKey(name);
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.buffs.containsKey(name);
}
}
public static boolean hasBuff(LivingEntity l, BuffTemplate buff) {
return hasBuff(l,buff.getKeyName());
}
public static boolean hasBuff(LivingEntity l, String name) {
if (l instanceof Player) {
Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.buffs.containsKey(name)) {
Buff b = pd.buffs.get(name);
return hasBuffExpired(b);
} else {
return false;
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
if (les.buffs.containsKey(name)) {
Buff b = les.buffs.get(name);
return hasBuffExpired(b);
} else {
return false;
}
}
}
public static void outputBuffs(LivingEntity l) {
if (l instanceof Player) {
Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
TwosideKeeper.log(TextUtils.outputHashmap(pd.buffs),0);
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
TwosideKeeper.log(TextUtils.outputHashmap(les.buffs),0);
}
}
public static HashMap<String,Buff>getBuffData(LivingEntity l) {
if (l instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
return pd.buffs;
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.buffs;
}
}
/**
* Returns <b>null</b> if no buff found! Use <b>hasBuff()</b> to verify they have
* a buff beforehand.
*
* This version of the method uses a BuffTemplate, which allows you to use an already defined setup for
* a Buff's appearance and display.
*/
public static Buff getBuff(LivingEntity l, BuffTemplate buff) {
return getBuff(l,buff.getKeyName());
}
/**
* Returns <b>null</b> if no buff found! Use <b>hasBuff()</b> to verify they have
* a buff beforehand.
*/
public static Buff getBuff(LivingEntity l, String name) {
if (hasBuff(l,name)) {
if (l instanceof Player) {
Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.buffs.containsKey(name)) {
return pd.buffs.get(name);
} else {
return null;
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
if (les.buffs.containsKey(name)) {
Buff b = les.buffs.get(name);
return b;
} else {
return null;
}
}
} else {
return null;
}
}
public void setDisplayTimerAlways(boolean displayTimerAlways) {
this.displayTimer=displayTimerAlways;
}
public boolean getDisplayTimerAlways() {
return displayTimer;
}
/**
* Attempts to add a buff to the target. This will not necessarily add the buff if the amplifier
* is weaker than what is currently applied, or the amplifier is the same but the duration is less.
* This follows the same rules established by all other buff mechanics added previously to the server.
*
* This version of the method uses a BuffTemplate, which allows you to use an already defined setup for
* a Buff's appearance and display.
*/
public static void addBuff(LivingEntity l, long duration, int amplifier, BuffTemplate buff, boolean stacking) {
addBuff(l,buff.getKeyName(),new Buff(
buff.getDisplayName(),
duration,
amplifier,
buff.getParticleColor(),
buff.getIcon(),
buff.isGoodBuff(),
buff.isPermanentBuff(),
buff.isDisplayTimer()
),stacking);
}
public static void addBuff(LivingEntity ent, int duration, int amplifier, BuffTemplate buff) {
addBuff(ent,duration,amplifier,buff,false);
}
public static void addBuff(LivingEntity l, String name, Buff buff) {
addBuff(l,name,buff,false);
}
/**
* Attempts to add a buff to the target. This will not necessarily add the buff if the amplifier
* is weaker than what is currently applied, or the amplifier is the same but the duration is less.
* This follows the same rules established by all other buff mechanics added previously to the server.
*/
public static void addBuff(LivingEntity l, String name, Buff buff, boolean stacking) {
if (l instanceof Player) {
Player p = (Player)l;
if (PVP.isPvPing(p)) {
buff.setDuration((int)((buff.expireTime-TwosideKeeper.getServerTickTime()) / 2));
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
int oldlv = 0;
long oldduration = 0;
if (hasBuff(p,name)) {
oldlv = pd.buffs.get(name).getAmplifier();
oldduration = pd.buffs.get(name).getRemainingBuffTime();
if (stacking) {
if (PVP.isPvPing(p)) {
oldlv=1;
}
buff.setStacks(buff.getAmplifier()+oldlv);
pd.buffs.put(name, buff);
return;
}
} else {
pd.buffs.put(name, buff);
return;
}
if (buff.getAmplifier()>=oldlv) {
if (buff.getAmplifier()==oldlv) { //Check if duration is longer or same.
if (buff.getRemainingBuffTime()>=oldduration) {
pd.buffs.put(name, buff);
}
} else {
pd.buffs.put(name, buff); //If Buff level is greater than old level.
}
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
int oldlv = 0;
long oldduration = 0;
if (hasBuff(l,name)) {
oldlv = les.buffs.get(name).getAmplifier();
oldduration = les.buffs.get(name).getRemainingBuffTime();
if (stacking) {
buff.setStacks(buff.getAmplifier()+oldlv);
les.buffs.put(name, buff);
return;
}
} else {
les.buffs.put(name, buff);
return;
}
if (buff.getAmplifier()>=oldlv) {
if (buff.getAmplifier()==oldlv) { //Check if duration is longer or same.
if (buff.getRemainingBuffTime()>=oldduration) {
les.buffs.put(name, buff);
}
} else {
les.buffs.put(name, buff); //If Buff level is greater than old level.
}
}
}
}
public static void removeBuff(LivingEntity l, BuffTemplate buff) {
removeBuff(l,buff.getKeyName());
}
public static void removeBuff(LivingEntity l, String name) {
if (l instanceof Player) {
Player p = (Player)l;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
Buff b = pd.buffs.remove(name);
if (b!=null && !b.buffCanBeRemoved()) {
pd.buffs.put(name, b);
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
Buff b = les.buffs.remove(name);
if (b!=null && !b.buffCanBeRemoved()) {
les.buffs.put(name, b);
}
}
}
/**
* Increases the level relative to the amt provided.
*/
public void increaseStacks(int amt) {
level+=amt;
}
/**
* Decreases the level relative to the amt provided. Can go negative.
*/
public void decreaseStacks(int amt) {
level-=amt;
}
/**
* Sets the level of the buff directly to amt.
*/
public void setStacks(int amt) {
level=amt;
}
/**
* Increases the duration of the buff by <b>duration</b> number of ticks.
*/
public void increaseDuration(int duration) {
expireTime+=duration;
}
/**
* Decreases duration of the buff by <b>duration</b> number of ticks.
*/
public void decreaseDuration(int duration) {
expireTime-=duration;
}
/**
* Sets the duration of the buff to <b>duration</b> ticks.
*/
public void setDuration(int duration) {
refreshDuration(duration);
}
/**
* Refreshes the buff's duration so time starts at the original duration again.
*/
public void refreshDuration(int duration) {
expireTime=TwosideKeeper.getServerTickTime()+duration;
}
/**
* Whether or not this is considered a good buff (true) or a bad buff (false)
*/
public boolean isGoodBuff() {
return isGoodBuff;
}
/**
* Whether or not this is considered a bad buff (true) or a good buff (false)
*/
public boolean isDebuff() {
return !isGoodBuff;
}
/**
* Whether or not this buff has ran out of time.
*/
public static boolean hasBuffExpired(Buff b) {
if (b.expireTime<TwosideKeeper.getServerTickTime()) {
return false;
} else {
return true;
}
}
/**
* Gets the name that shows up in the action bar for the player.
*/
public String getDisplayName() {
return displayName;
}
/**
* Gets the expiration time of the buff in ticks, to be compared with TwosideKeeper.getServerTickTime().
*/
public long getExpireTime() {
return expireTime;
}
/**
* Gets the level/amplifier/stack amount of this buff.
*/
public int getAmplifier() {
return level;
}
/**
* Gets the swirly particle colors that appear when this buff is applied.
*/
public Color getBuffParticleColor() {
return col;
}
/**
* Gets the remaining amount of time this buff is still active on this entity. Returns 0 if it has already expired.
*/
public long getRemainingBuffTime() {
return Math.max(expireTime-TwosideKeeper.getServerTickTime(),0);
}
/**
* Returns a print-friendly version of this structure.
*/
public String toString() {
return "Buff(Name="+displayName+",Time="+expireTime+",Level="+level+",Color="+col+",Icon="+getBuffIcon()+")";
}
/**
* Returns the string that consistss of the buff icon for this buff. Usually includes a chat color code.
*/
public String getBuffIcon() {
return icon;
}
/**
* Whether or not this buff can be removed.
*/
public boolean buffCanBeRemoved() {
return !permanentBuff;
}
/**
* Whether or not the specified buff can be removed.
*/
public static boolean buffCanBeRemoved(Buff b) {
return !b.permanentBuff;
}
}

View File

@ -0,0 +1,163 @@
package sig.plugin.TwosideKeeper;
import java.io.File;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ChallengeReward {
public static boolean hasRewards(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return pd.rewards.length()>0;
}
public static void rewardAwards(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
GlobalLoot gl = GlobalLoot.spawnGlobalLoot(p.getLocation(), ChatColor.GREEN+"Daily Challenge Loot");
String[] awards = pd.rewards.split(",");
for (String s : awards) {
int rank = Integer.parseInt(s);
if (pd.isFirstReward) {
gl.addNewDropInventory(p.getUniqueId(), getAward(rank));
pd.isFirstReward=false;
}
gl.addNewDropInventory(p.getUniqueId(), getAward(rank));
}
pd.rewards="";
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.2f);
}
public static void provideAwards() {
provideAwards(TwosideKeeper.dpschallenge_records);
provideHOFAwards(TwosideKeeper.dpschallenge_recordsHOF);
provideAwards(TwosideKeeper.tankchallenge_records);
provideHOFAwards(TwosideKeeper.tankchallenge_recordsHOF);
provideAwards(TwosideKeeper.parkourchallenge_records);
provideHOFAwards(TwosideKeeper.parkourchallenge_recordsHOF);
}
private static void provideAwards(RecordKeeping r) {
for (int i=0;i<r.recordlist.size();i++) {
Record rec = r.recordlist.get(i);
int rank = i+1;
Player p = Bukkit.getPlayer(rec.getName());
if (p!=null && p.isOnline()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (hasRewards(p)) {
pd.rewards+=","+rank;
} else {
pd.rewards=Integer.toString(rank);
}
} else {
File config;
config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getOfflinePlayer(rec.getName()).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) {
//Something bad happened if we got here.
TwosideKeeper.log("[WARNING] Could not find the correct player data file for "+p+" to get money data from.",1);
} else {
String rewards = workable.getString("rewards");
if (rewards.length()>0) {
rewards+=","+rank;
} else {
rewards=Integer.toString(rank);
}
workable.set("rewards", rewards);
try {
workable.save(config);
} catch (IOException e) {
TwosideKeeper.log("[WARNING] Could not find the correct player data file for "+p+" to get money data from.",1);
e.printStackTrace();
}
}
}
}
}
private static void provideHOFAwards(RecordKeeping r) {
if (r.recordlist.size()>0) {
Record rec = r.recordlist.get(0);
Player p = Bukkit.getPlayer(rec.getName());
if (p!=null && p.isOnline()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (hasRewards(p)) {
pd.rewards+=","+438190894;
} else {
pd.rewards=Integer.toString(438190894);
}
} else {
File config;
config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getOfflinePlayer(rec.getName()).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) {
//Something bad happened if we got here.
TwosideKeeper.log("[WARNING] Could not find the correct player data file for "+p+" to get money data from.",1);
} else {
String rewards = workable.getString("rewards");
if (rewards.length()>0) {
rewards+=","+438190894;
} else {
rewards=Integer.toString(438190894);
}
workable.set("rewards", rewards);
try {
workable.save(config);
} catch (IOException e) {
TwosideKeeper.log("[WARNING] Could not find the correct player data file for "+p+" to get money data from.",1);
e.printStackTrace();
}
}
}
}
}
public static ItemStack[] getAward(int rank) {
switch (rank) {
case 1:{
return new ItemStack[]{
Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE,2),
Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,2),
Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE,1),
};
}
case 2:{
return new ItemStack[]{
Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE,1),
Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,1),
};
}
case 3:{
return new ItemStack[]{
Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE,1),
};
}
case 438190894:{
return new ItemStack[]{
Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE,2),
};
}
default:{
return new ItemStack[]{
Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),
};
}
}
}
}

View File

@ -6,8 +6,14 @@ import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlock;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ChargeZombie { public class ChargeZombie {
Monster m; Monster m;
long stuckTimer=0;
Location lastLoc = null;
public boolean canBreak=true;
public ChargeZombie(Monster m) { public ChargeZombie(Monster m) {
this.m=m; this.m=m;
@ -31,10 +37,36 @@ public class ChargeZombie {
if (Math.abs(x)<outerradius && if (Math.abs(x)<outerradius &&
Math.abs(y)<outerradius+1 && Math.abs(y)<outerradius+1 &&
Math.abs(z)<outerradius && Math.abs(z)<outerradius &&
aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) || (aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) { m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN)) {
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava. if (m.getTarget()!=null && m.getTarget().isValid()) {
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player. if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
boolean brokeliquid = false;
//Break it.
if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) {
if (m.getLocation().add(x,y,z).getBlock().getType()==Material.WATER ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_WATER ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.LAVA ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
brokeliquid=true;
if (m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
m.getLocation().add(x,y,z).getBlock().setType(Material.OBSIDIAN);
SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
}
}
if (!brokeliquid) {
SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
}
m.getLocation().add(x,y,z).getBlock().breakNaturally();
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1);
} else {
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), (int)(Math.random()*6)+3);
}
}
}
} else {
if (y>=0) {
boolean brokeliquid = false; boolean brokeliquid = false;
//Break it. //Break it.
if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) { if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) {
@ -45,11 +77,11 @@ public class ChargeZombie {
brokeliquid=true; brokeliquid=true;
if (m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) { if (m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
m.getLocation().add(x,y,z).getBlock().setType(Material.OBSIDIAN); m.getLocation().add(x,y,z).getBlock().setType(Material.OBSIDIAN);
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f); SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
} }
} }
if (!brokeliquid) { if (!brokeliquid) {
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f); SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
} }
m.getLocation().add(x,y,z).getBlock().breakNaturally(); m.getLocation().add(x,y,z).getBlock().breakNaturally();
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1); aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1);
@ -93,11 +125,11 @@ public class ChargeZombie {
brokeliquid=true; brokeliquid=true;
if (l.add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) { if (l.add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
l.add(x,y,z).getBlock().setType(Material.OBSIDIAN); l.add(x,y,z).getBlock().setType(Material.OBSIDIAN);
l.getWorld().playSound(l.add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f); SoundUtils.playGlobalSound(l.add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
} }
} }
if (!brokeliquid) { if (!brokeliquid) {
l.getWorld().playSound(l.add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f); SoundUtils.playGlobalSound(l.add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
} }
l.add(x,y,z).getBlock().breakNaturally(); l.add(x,y,z).getBlock().breakNaturally();
aPlugin.API.sendBlockBreakPacket(l.add(x,y,z).getBlock(), -1); aPlugin.API.sendBlockBreakPacket(l.add(x,y,z).getBlock(), -1);
@ -121,12 +153,18 @@ public class ChargeZombie {
public static boolean ChanceToBreak(Block b) { public static boolean ChanceToBreak(Block b) {
int blocktoughness = 0; int blocktoughness = 0;
if (TemporaryBlock.isTemporaryBlock(b) || !aPlugin.API.isDestroyable(b)) {
return false;
}
switch (b.getType()) { switch (b.getType()) {
case BEDROCK: {
blocktoughness=999999;
}break;
case OBSIDIAN:{ case OBSIDIAN:{
blocktoughness=100; blocktoughness=100;
}break; }break;
case ENDER_CHEST:{ case ENDER_CHEST:{
blocktoughness=44; blocktoughness=999999;
}break; }break;
case ANVIL:{ case ANVIL:{
blocktoughness=10; blocktoughness=10;
@ -224,7 +262,7 @@ public class ChargeZombie {
case CHEST: case CHEST:
case TRAPPED_CHEST: case TRAPPED_CHEST:
case WORKBENCH:{ case WORKBENCH:{
blocktoughness=5; blocktoughness=999999;
}break; }break;
case BRICK_STAIRS: case BRICK_STAIRS:
case BRICK: case BRICK:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
package sig.plugin.TwosideKeeper;
import java.io.File;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.inventivetalent.glow.GlowAPI.Color;
import sig.plugin.TwosideKeeper.Events.EntityChannelCastEvent;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class CustomMonster {
protected LivingEntity m;
public CustomMonster(LivingEntity m) {
super();
this.m=m;
}
public LivingEntity GetMonster() {
return m;
}
public boolean isAlive() {
return !m.isDead();
}
public MixedDamage getBasicAttackDamage() {
return MixedDamage.v(0,0,0);
}
/*
public boolean hasTarget() {
return (m.getTarget()!=null)?true:false;
}*/
public static CustomMonster getCustomMonster(LivingEntity m) {
if (TwosideKeeper.custommonsters.containsKey(m.getUniqueId())) {
return TwosideKeeper.custommonsters.get(m.getUniqueId());
} else {
return null;
}
}
/*public boolean recognizeMonsterConditions(LivingEntity m) {
return false;
}*/
public void runTick() {
}
public void customHitHandler() {
}
public void customHitHandler(double dmg) {
}
public void onHitEvent(LivingEntity damager, double damage) {
}
public void onPlayerSlayEvent(Player p, String reason) {
}
public boolean isImmuneToSuppression() {
return false;
}
public void cleanup() {
}
public void entityCleanup() {
}
public void runChannelCastEvent(EntityChannelCastEvent ev) {
}
public void runProjectileLaunchEvent(ProjectileLaunchEvent ev) {
}
public void onDeathEvent() {
}
public Color getGlowColor() {
return null;
}
public boolean isInIframe() {
return false;
}
public void bloodPoolSpawnedEvent(LivingEntity target) {
}
public void AnnounceDPSBreakdown() {
}
/**
* 0.0 means cannot be moved, 1.0 means normal knockback.
*/
public double getKnockbackMult() {
return 1.0;
}
}

View File

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -15,6 +16,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class DeathManager { public class DeathManager {
@ -25,25 +27,29 @@ public class DeathManager {
public static List<DeathStructure> ds = new ArrayList<DeathStructure>(); public static List<DeathStructure> ds = new ArrayList<DeathStructure>();
public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) { public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) {
ds.add(new DeathStructure(deathinv,deathloc,p)); ds.add(new DeathStructure(deathinv,deathloc.clone(),p));
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),5); TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),0);
} }
public static void removeDeathStructure(Player p) { public static void removeDeathStructure(Player p) {
ds.remove(getDeathStructure(p)); ds.remove(getDeathStructure(p));
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION,15,-2,p,true); //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION,15,-2,p,true);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.JUMP,15,100,p,true); //GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.JUMP,15,100,p,true);
p.setVelocity(new Vector(0,0,0)); p.setVelocity(new Vector(0,0,0));
CustomDamage.removeIframe(p); CustomDamage.removeIframe(p);
Location loc = p.getLocation(); Location loc = p.getLocation();
if (p.getBedSpawnLocation()!=null) {loc.setY(p.getBedSpawnLocation().getY());} if (p.getBedSpawnLocation()!=null) {loc.setY(p.getBedSpawnLocation().getY());}
p.teleport(loc); p.teleport(loc);
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p);
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.JUMP,p);
}},1); }},1);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
//pd.deathloot.clear(); //pd.deathloot.clear();
pd.hasDied=false; if (pd!=null) {
pd.hasDied=false;
}
p.setCollidable(true); p.setCollidable(true);
} }
public static boolean deathStructureExists(Player p) { public static boolean deathStructureExists(Player p) {
@ -112,23 +118,31 @@ public class DeathManager {
Inventory deathinv = Bukkit.getServer().createInventory(p, 45, "Death Loot"); Inventory deathinv = Bukkit.getServer().createInventory(p, 45, "Death Loot");
GenericFunctions.TransferItemsToInventory(p.getInventory(), deathinv); GenericFunctions.TransferItemsToInventory(p.getInventory(), deathinv);
double totalmoney = TwosideKeeper.getPlayerMoney(Bukkit.getPlayer(p.getName()))+TwosideKeeper.getPlayerBankMoney(Bukkit.getPlayer(p.getName())); double totalmoney = TwosideKeeper.getPlayerMoney(Bukkit.getPlayer(p.getName()))+TwosideKeeper.getPlayerBankMoney(Bukkit.getPlayer(p.getName()));
int price = 1; double price = 1;
if (structure.deathloc.getBlockY()<=60) { if (structure.deathloc.getBlockY()<=60) {
price += 24-(structure.deathloc.getBlockY()/2.5); price += 24-(structure.deathloc.getBlockY()/2.5);
} }
PlayerStructure pd = PlayerStructure.GetPlayerStructure(Bukkit.getPlayer(p.getName())); PlayerStructure pd = PlayerStructure.GetPlayerStructure(Bukkit.getPlayer(p.getName()));
if (pd.playermode_on_death==PlayerMode.NORMAL) {
price /= 2d;
}
pd.hasDied=false; pd.hasDied=false;
DecimalFormat df = new DecimalFormat("0.00");
p.openInventory(deathinv); p.openInventory(deathinv);
p.sendMessage(ChatColor.AQUA+"You can buy back up to "+ChatColor.YELLOW+(int)(totalmoney/price)+ChatColor.AQUA+" items, costing $"+ChatColor.GREEN+price+ChatColor.WHITE+" per item."); p.sendMessage(ChatColor.AQUA+"You can buy back up to "+ChatColor.YELLOW+(int)(totalmoney/price)+ChatColor.AQUA+" items, costing $"+ChatColor.GREEN+df.format(price)+ChatColor.WHITE+" per item.");
p.sendMessage(" The rest will drop at your death location."); p.sendMessage(" The rest will drop at your death location.");
p.sendMessage(ChatColor.GRAY+"Close your inventory once you've picked your items."); p.sendMessage(ChatColor.GRAY+"Close your inventory once you've picked your items.");
} }
public static int CalculateDeathPrice(Player p) { public static double CalculateDeathPrice(Player p) {
DeathStructure ds = getDeathStructure(p); DeathStructure ds = getDeathStructure(p);
return (int)(1+((ds.deathloc.getBlockY()<=60)?(24-(ds.deathloc.getBlockY()/2.5)):0)); double price = (1+((ds.deathloc.getBlockY()<=60)?(24-(ds.deathloc.getBlockY()/2.5)):0));
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.playermode_on_death==PlayerMode.NORMAL) {
price /= 2d;
}
return price;
} }
public static int CountOccupiedSlots(Inventory inv) { public static int CountOccupiedSlots(Inventory inv) {
int occupiedslots = 0; int occupiedslots = 0;

View File

@ -12,7 +12,8 @@ public class DiscordStatusUpdater implements Runnable{
@Override @Override
public void run() { public void run() {
DiscordMessageSender.setPlaying(ProduceMessage()); //DiscordMessageSender.setPlaying(ProduceMessage());
aPlugin.API.discordSetPlaying(ProduceMessage());
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), this, 300l); Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), this, 300l);
} }

View File

@ -1,46 +1,93 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
public class DropDeathItems implements Runnable{ public class DropDeathItems implements Runnable{
Player p = null; Player p = null;
Location deathloc = null; Location deathloc = null;
List<ItemStack> contents; List<ItemStack> contents;
Inventory inv_contents;
DropDeathItems(Player p, List<ItemStack> contents, Location deathloc) { DropDeathItems(Player p, List<ItemStack> contents, Location deathloc) {
this.p=p; this.p=p;
this.deathloc=deathloc; this.deathloc=deathloc;
this.contents=contents; this.contents=contents;
this.inv_contents = Bukkit.createInventory(p, 63);
for (ItemStack it : contents) {
if (it!=null) {
inv_contents.addItem(it);
}
}
} }
@Override @Override
public void run() { public void run() {
if (!AttemptToDropItems(p,deathloc)) { if (!AttemptToDropItems(p,deathloc)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,contents,deathloc),1); //Keep trying until the chunk is loaded!!! TwosideKeeper.log("Re-running...",0);
List<ItemStack> tempcontents = new ArrayList<ItemStack>();
for (ItemStack it : inv_contents.getContents()) {
if (it!=null && it.getType()!=Material.AIR) {
tempcontents.add(it);
}
}
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,tempcontents,deathloc),1); //Keep trying until the chunk is loaded!!!
TwosideKeeper.temporary_chunks.clear();
} }
} }
public boolean AttemptToDropItems(Player p, Location deathloc) { public boolean AttemptToDropItems(Player p, Location deathloc) {
deathloc.getWorld().loadChunk(deathloc.getChunk()); TwosideKeeper.temporary_chunks.add(deathloc.getChunk());
deathloc.getChunk().load();
if (deathloc.getChunk().isLoaded()) { if (deathloc.getChunk().isLoaded()) {
TwosideKeeper.log("Respawn and Dropping...", 2); TwosideKeeper.log("Respawn and Dropping...", 2);
while (contents.size()>0) { while (!InventoryUtils.hasEmptyInventory(inv_contents)) {
if (deathloc.getChunk().isLoaded()) { if (deathloc.getChunk().isLoaded()) {
Item it = deathloc.getWorld().dropItemNaturally(deathloc, contents.get(0)); Item it = deathloc.getWorld().dropItemNaturally(deathloc, InventoryUtils.getFirstItemThatIsNotEmpty(inv_contents));
it.setInvulnerable(true);
if (it!=null && it.isValid()) {
inv_contents.removeItem(it.getItemStack());
TwosideKeeper.log("Dropping "+it.getItemStack().toString()+" at Death location "+deathloc,2);
} else {
TwosideKeeper.log("Item did not spawn! Will try again.",0);
return false;
}
} else {
TwosideKeeper.log("Chunk is not loaded! Will try again.",0);
return false;
}
}
/*while (contents.size()>0) {
if (deathloc.getChunk().isLoaded()) {
Item it = null;
do {
deathloc.getWorld().loadChunk(deathloc.getChunk());
it=deathloc.getWorld().dropItemNaturally(deathloc, contents.get(0));
TwosideKeeper.temporary_chunks.add(deathloc.getChunk());} while (it==null || !it.isValid());
it.setInvulnerable(true); it.setInvulnerable(true);
TwosideKeeper.log("Dropping "+contents.get(0).toString()+" at Death location "+deathloc,2); TwosideKeeper.log("Dropping "+contents.get(0).toString()+" at Death location "+deathloc,2);
contents.remove(0); //contents.remove(0);
} else { } else {
deathloc.getWorld().loadChunk(deathloc.getChunk()); deathloc.getWorld().loadChunk(deathloc.getChunk());
} }
}*/
for (Chunk c : TwosideKeeper.temporary_chunks) {
c.unload(true);
} }
TwosideKeeper.temporary_chunks.clear();
DeathManager.removeDeathStructure(p); DeathManager.removeDeathStructure(p);
return true; return true;
} }

View File

@ -0,0 +1,26 @@
package sig.plugin.TwosideKeeper.Drops;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import aPlugin.Drop;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class DropRandomFirework extends Drop {
int min,max;
public DropRandomFirework(int min, int max, int weight) {
super(min,max,weight,"Holiday Firework");
this.min=min;
this.max=max;
}
@Override
public ItemStack getItemStack() {
ItemStack randomfirework = ItemUtils.createRandomFirework();
randomfirework.setAmount((int)(((Math.random()*(max-min))+min)));
return randomfirework;
}
}

View File

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.Drops; package sig.plugin.TwosideKeeper.Drops;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -7,6 +8,7 @@ import org.bukkit.inventory.ItemStack;
import aPlugin.Drop; import aPlugin.Drop;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
@ -24,11 +26,11 @@ public class SigDrop extends Drop{
boolean isHardened; //If set to false, it has no breaks remaining. boolean isHardened; //If set to false, it has no breaks remaining.
boolean isSet; //If set to false, it's non-set. boolean isSet; //If set to false, it's non-set.
int isWeapon; //0: Armor, 1: Weapon, 2: Tool int isWeapon; //0: Armor, 1: Weapon, 2: Tool
MonsterDifficulty diff; LivingEntityDifficulty diff;
public SigDrop(int amount, int weight, String description, boolean isHardened, boolean isSet, int isWeapon, MonsterDifficulty diff) { public SigDrop(int amount, int weight, String description, boolean isHardened, boolean isSet, int isWeapon, LivingEntityDifficulty normal) {
super(amount, weight, super(amount, weight,
"["+GenericFunctions.CapitalizeFirstLetters(diff.name().replace("_", " "))+"]"+ "["+GenericFunctions.CapitalizeFirstLetters(normal.name().replace("_", " "))+"]"+
((isHardened)?" Hardened":"")+ ((isHardened)?" Hardened":"")+
" Mega"+ " Mega"+
(isSet?" Set":"")+ (isSet?" Set":"")+
@ -37,7 +39,7 @@ public class SigDrop extends Drop{
this.isHardened=isHardened; this.isHardened=isHardened;
this.isSet=isSet; this.isSet=isSet;
this.isWeapon=isWeapon; this.isWeapon=isWeapon;
this.diff=diff; this.diff=normal;
} }
@Override @Override
@ -133,18 +135,28 @@ public class SigDrop extends Drop{
item = Loot.GenerateMegaPiece(item.getType(), isHardened); item = Loot.GenerateMegaPiece(item.getType(), isHardened);
}break; }break;
default:{ default:{
TwosideKeeper.log("Something went terrible wrong generating the item! DIRT is being returned! Check your switch statement for 'isWeapon'.", 0); TwosideKeeper.log("Something went terribly wrong generating the item! DIRT is being returned! Check your switch statement for 'isWeapon'.", 0);
item = new ItemStack(Material.DIRT); item = new ItemStack(Material.DIRT);
} }
} }
return item; return item;
} }
public ItemStack CreateModifiedLootPiece(Player p, ItemStack item, MonsterDifficulty md) { public ItemStack CreateModifiedLootPiece(Player p, ItemStack item, LivingEntityDifficulty diff2) {
if (isSet) { if (isSet) {
ItemSet set = MonsterDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),md); //This is the set we have to generate. ItemSet set = ItemSet.PANROS;
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
if (Math.random()<=0.01) {
set = LivingEntityDifficulty.PickAHolidayItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
}
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
}
TwosideKeeper.log("Set Chosen: "+set, 5);
//Turn it into the appropriate piece if necessary. //Turn it into the appropriate piece if necessary.
item = MonsterDifficulty.ConvertSetPieceIfNecessary(item, set); item = LivingEntityDifficulty.ConvertSetPieceIfNecessary(item, set);
int tierbonus=0; int tierbonus=0;
if (item.getType().name().contains("LEATHER")) { if (item.getType().name().contains("LEATHER")) {
@ -152,14 +164,15 @@ public class SigDrop extends Drop{
} }
item = Loot.GenerateSetPiece(item, set, isHardened, tierbonus); item = Loot.GenerateSetPiece(item, set, isHardened, tierbonus);
TwosideKeeper.log("Final Item: "+item, 5);
} else { } else {
item = Loot.GenerateMegaPiece(item.getType(), isHardened); item = Loot.GenerateMegaPiece(item.getType(), isHardened);
} }
return item; return item;
} }
private int GetTierBonusBasedOnDifficulty(MonsterDifficulty dif) { private int GetTierBonusBasedOnDifficulty(LivingEntityDifficulty diff2) {
switch (dif) { switch (diff2) {
case DANGEROUS:{ case DANGEROUS:{
if (Math.random()<=1/3d) { if (Math.random()<=1/3d) {
return 1; return 1;
@ -192,7 +205,12 @@ public class SigDrop extends Drop{
@Override @Override
public ItemStack getItemStack() { public ItemStack getItemStack() {
TwosideKeeper.log("Something went terribly wrong with getItemStack() call. Check to make sure you are using getSingleDrop(Player) and not getSingleDrop()!!!", 0); if (Bukkit.getOnlinePlayers().size()>0) {
return null; int random = (int)(Math.random()*(Bukkit.getOnlinePlayers().size()));
Player picked = (Player)(Bukkit.getOnlinePlayers().toArray()[random]);
return getItemStack(picked);
} else {
return null;
}
} }
} }

View File

@ -25,7 +25,9 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI; import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class EliteMonster { public class EliteMonster {
protected static float DEFAULT_MOVE_SPD = 0.3f; protected static float DEFAULT_MOVE_SPD = 0.3f;
@ -49,6 +51,7 @@ public class EliteMonster {
protected boolean chasing=false; protected boolean chasing=false;
protected boolean enraged=false; protected boolean enraged=false;
protected boolean storingenergy=false; protected boolean storingenergy=false;
public double baseHP = 0.0;
protected List<Player> targetlist = new ArrayList<Player>(); protected List<Player> targetlist = new ArrayList<Player>();
protected List<Player> participantlist = new ArrayList<Player>(); protected List<Player> participantlist = new ArrayList<Player>();
@ -62,6 +65,7 @@ public class EliteMonster {
this.myspawn=m.getLocation(); this.myspawn=m.getLocation();
bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG); bar = m.getServer().createBossBar(GenericFunctions.getDisplayName(m), BarColor.WHITE, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG); willpower_bar = m.getServer().createBossBar("Willpower", BarColor.PINK, BarStyle.SOLID, BarFlag.CREATE_FOG);
this.baseHP = m.getMaxHealth();
} }
public void runTick() { public void runTick() {
@ -109,11 +113,13 @@ public class EliteMonster {
} }
protected void createBossHealthbar() { protected void createBossHealthbar() {
if (m instanceof Wither || m instanceof EnderDragon) { /*if (m instanceof Wither || m instanceof EnderDragon) {
bar.removeAll(); bar.removeAll();
willpower_bar.removeAll(); willpower_bar.removeAll();
return; return;
} }*/
bar.removeAll();
willpower_bar.removeAll();
List<Player> currentplayers = bar.getPlayers(); List<Player> currentplayers = bar.getPlayers();
for (int i=0;i<currentplayers.size();i++) { for (int i=0;i<currentplayers.size();i++) {
if (!targetlist.contains(currentplayers.get(i))) { if (!targetlist.contains(currentplayers.get(i))) {
@ -122,7 +128,10 @@ public class EliteMonster {
} }
} }
bar.setProgress(m.getHealth()/m.getMaxHealth()); bar.setProgress(m.getHealth()/m.getMaxHealth());
bar.setTitle(GenericFunctions.getDisplayName(m) + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):"")); bar.setTitle((Channel.isChanneling(m)?LivingEntityStructure.getChannelingBar(m):GenericFunctions.getDisplayName(m)) + ((m.getTarget()!=null && (m.getTarget() instanceof Player))?(ChatColor.DARK_AQUA+" "+arrow+" "+ChatColor.YELLOW+((Player)m.getTarget()).getName()):""));
if (!(m instanceof Wither || m instanceof EnderDragon)) {
displayHealthbarToNearbyPlayers();
}
for (int i=0;i<targetlist.size();i++) { for (int i=0;i<targetlist.size();i++) {
if (!currentplayers.contains(targetlist.get(i))) { if (!currentplayers.contains(targetlist.get(i))) {
bar.addPlayer(targetlist.get(i)); bar.addPlayer(targetlist.get(i));
@ -130,6 +139,18 @@ public class EliteMonster {
} }
} }
protected void displayHealthbarToNearbyPlayers() {
try {
for (Player p : Bukkit.getOnlinePlayers()) {
if (m.getLocation().getWorld().equals(p.getLocation().getWorld()) && m.getLocation().distanceSquared(p.getLocation())<=2500) {
bar.addPlayer(p);
}
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
protected void resetToSpawn() { protected void resetToSpawn() {
if (!leaping && targetlist.size()==0 && m.getLocation().getWorld().equals(myspawn.getWorld()) && m.getLocation().distanceSquared(myspawn)>81) { if (!leaping && targetlist.size()==0 && m.getLocation().getWorld().equals(myspawn.getWorld()) && m.getLocation().distanceSquared(myspawn)>81) {
while (myspawn.getBlock().getRelative(0, -1, 0).getType()==Material.AIR && myspawn.getY()>1) { while (myspawn.getBlock().getRelative(0, -1, 0).getType()==Material.AIR && myspawn.getY()>1) {
@ -137,15 +158,9 @@ public class EliteMonster {
} }
m.teleport(myspawn); m.teleport(myspawn);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
if (dpslist.size()>0) { AnnounceFailedTakedown();
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed...");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(generateDPSReport());
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
}
bar.setColor(BarColor.WHITE); bar.setColor(BarColor.WHITE);
first_willpower_notification=false; first_willpower_notification=false;
dpslist.clear();
willpower=0; willpower=0;
bar.removeAll(); bar.removeAll();
willpower_bar.removeAll(); willpower_bar.removeAll();
@ -155,6 +170,24 @@ public class EliteMonster {
if (!m.getLocation().getWorld().equals(myspawn.getWorld())) { if (!m.getLocation().getWorld().equals(myspawn.getWorld())) {
myspawn = m.getLocation(); //Then this is my new spawn... myspawn = m.getLocation(); //Then this is my new spawn...
} }
for (Player p : targetlist) {
if (p.isDead()) {
targetlist.remove(p);
}
}
if (targetlist.size()==0) {
participantlist.clear();
}
}
public void AnnounceFailedTakedown() {
if (dpslist.size()>0 && !m.isDead()) {
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed...");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(generateDPSReport());
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
dpslist.clear();
}
} }
protected void dontDrown() { protected void dontDrown() {
@ -168,6 +201,9 @@ public class EliteMonster {
public GlowAPI.Color getGlow() { public GlowAPI.Color getGlow() {
GlowAPI.Color col = GlowAPI.Color.DARK_PURPLE; GlowAPI.Color col = GlowAPI.Color.DARK_PURPLE;
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
col = GlowAPI.Color.DARK_BLUE;
}
if (Channel.isChanneling(m)) {
col = GlowAPI.Color.YELLOW; col = GlowAPI.Color.YELLOW;
} }
if (storingenergy) { if (storingenergy) {
@ -203,8 +239,8 @@ public class EliteMonster {
p.setVelocity(new Vector(0,-1,0)); p.setVelocity(new Vector(0,-1,0));
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p);
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f); SoundUtils.playLocalSound(p, Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
p.playSound(p.getLocation(), Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f); SoundUtils.playLocalSound(p, Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
} }
} }
@ -213,6 +249,12 @@ public class EliteMonster {
bar.setColor(BarColor.GREEN); bar.setColor(BarColor.GREEN);
m.setHealth(Math.min(m.getHealth()+1,m.getMaxHealth())); m.setHealth(Math.min(m.getHealth()+1,m.getMaxHealth()));
} }
if (m.getMaxHealth()>(baseHP+(baseHP*(0.25*((targetlist.size()>4)?(targetlist.size()-4):0))))) {
m.setMaxHealth((baseHP+(baseHP*(0.25*((targetlist.size()>4)?(targetlist.size()-4):0)))));
if (m.getHealth()>m.getMaxHealth()) {
m.setHealth(m.getMaxHealth());
}
}
} }
public void runPlayerLeaveEvent(Player p) { public void runPlayerLeaveEvent(Player p) {
@ -226,6 +268,11 @@ public class EliteMonster {
bar.setColor(BarColor.RED); bar.setColor(BarColor.RED);
if (!targetlist.contains(damager) && (damager instanceof Player)) { if (!targetlist.contains(damager) && (damager instanceof Player)) {
targetlist.add((Player)damager); targetlist.add((Player)damager);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
if (!participantlist.contains(damager) && (damager instanceof Player)) { if (!participantlist.contains(damager) && (damager instanceof Player)) {
participantlist.add((Player)damager); participantlist.add((Player)damager);
@ -237,6 +284,7 @@ public class EliteMonster {
currentdps = dpslist.get(p.getName()); currentdps = dpslist.get(p.getName());
} }
dpslist.put(p.getName(), currentdps+dmg); dpslist.put(p.getName(), currentdps+dmg);
TwosideKeeper.log(p.getName()+"'s Damage: "+dpslist.get(p.getName()), 5);
} }
last_regen_time=TwosideKeeper.getServerTickTime(); last_regen_time=TwosideKeeper.getServerTickTime();
} }
@ -260,8 +308,13 @@ public class EliteMonster {
//Triggers when this mob hits something. //Triggers when this mob hits something.
public void hitEvent(LivingEntity ent) { public void hitEvent(LivingEntity ent) {
if (!targetlist.contains(ent) && (ent instanceof Player)) { if (!targetlist.contains(ent) && (ent instanceof Player) && !ent.isDead()) {
targetlist.add((Player)ent); targetlist.add((Player)ent);
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
}
} }
} }
@ -270,6 +323,8 @@ public class EliteMonster {
Player p = targetlist.get((int)(Math.random() * targetlist.size())); Player p = targetlist.get((int)(Math.random() * targetlist.size()));
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS,20*1,7,p); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS,20*1,7,p);
m.setTarget(p); m.setTarget(p);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.increaseAggroWhileMultiplyingAllOthers(p, 0, 0.25);
TwosideKeeper.log("Set new target to "+p.getName(), 2); TwosideKeeper.log("Set new target to "+p.getName(), 2);
return p; return p;
} else { } else {
@ -331,6 +386,7 @@ public class EliteMonster {
public void Cleanup() { public void Cleanup() {
// Remove all healthbars before destroying. // Remove all healthbars before destroying.
AnnounceFailedTakedown();
removeAllHealthbars(); removeAllHealthbars();
} }
} }

View File

@ -0,0 +1,34 @@
package sig.plugin.TwosideKeeper.Events;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class EntityChannelCastEvent extends Event{
private LivingEntity l;
private String abilityName;
private static final HandlerList handlers = new HandlerList();
public EntityChannelCastEvent(LivingEntity l, String abilityName) {
this.l=l;
this.abilityName=abilityName;
}
public LivingEntity getLivingEntity() {
return l;
}
public String getAbilityName() {
return abilityName;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -0,0 +1,92 @@
package sig.plugin.TwosideKeeper.Events;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class EntityDamagedEvent extends Event implements Cancellable{
private static final HandlerList handlers = new HandlerList();
private LivingEntity ent;
private Entity damager;
private double damage;
private String reason;
public LivingEntity getEntity() {
return ent;
}
public Entity getDamager() {
return damager;
}
public void setDamager(Entity damager) {
this.damager = damager;
}
public double getDamage() {
return damage;
}
public void setDamage(double damage) {
this.damage = damage;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getFlags() {
return flags;
}
public void setFlags(int flags) {
this.flags = flags;
}
private int flags;
private boolean cancelled=false;
/**
* Called anytime an Entity is damaged.
* <br><br>
* <b>This event is cancellable.</b> Cancelling the event prevents the damage from being applied to the damaged entity and all on-hit effects will not apply.
* @param ent The entity being damaged.
* @param damager The entity that caused the damage, can be null.
* @param damage The amount of actual damage taken, after all calculations are applied.
* @param reason The reason the damage was taken.
* @param flags The flags set by this event.
*/
public EntityDamagedEvent(LivingEntity ent, Entity damager, double damage, String reason, int flags) {
this.ent=ent;
this.damager=damager;
this.damage=damage;
this.reason=reason;
this.flags=flags;
}
@Override
public boolean isCancelled() {
return this.cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled=cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -0,0 +1,57 @@
package sig.plugin.TwosideKeeper.Events;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class InventoryUpdateEvent extends Event{
private Player p;
private ItemStack item;
private static final HandlerList handlers = new HandlerList();
private UpdateReason reason;
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public InventoryUpdateEvent(Player p, ItemStack item, UpdateReason reason) {
this.p=p;
this.item=item;
this.reason=reason;
}
public Player getPlayer() {
return p;
}
public ItemStack getItemStack() {
return item;
}
public UpdateReason getReason() {
return reason;
}
public static void TriggerUpdateInventoryEvent(Player p, ItemStack item, UpdateReason reason) {
if (item!=null) {
InventoryUpdateEvent ev = new InventoryUpdateEvent(p, item, reason);
Bukkit.getPluginManager().callEvent(ev);
}
//TwosideKeeper.log("Triggered because of "+reason, 0);
}
public enum UpdateReason {
INVENTORYUPDATE,
PICKEDUPITEM,
DROPPEDITEM
}
}

View File

@ -12,14 +12,24 @@ public class PlayerDodgeEvent extends Event implements Cancellable{
private Entity damager; private Entity damager;
private String reason; private String reason;
private int flags; private int flags;
private boolean cancelled; private double damage;
private boolean cancelled=false;
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@Deprecated
public PlayerDodgeEvent(Player p, Entity damager, String reason, int flags) { public PlayerDodgeEvent(Player p, Entity damager, String reason, int flags) {
this.p=p; this.p=p;
this.damager=damager; this.damager=damager;
this.reason=reason; this.reason=reason;
this.flags=flags; this.flags=flags;
this.damage=0;
}
public PlayerDodgeEvent(Player p, double damage, Entity damager, String reason, int flags) {
this.p=p;
this.damager=damager;
this.reason=reason;
this.flags=flags;
} }
public Player getPlayer() { public Player getPlayer() {
@ -38,6 +48,10 @@ public class PlayerDodgeEvent extends Event implements Cancellable{
return flags; return flags;
} }
public double getRawDamage() {
return damage;
}
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;

View File

@ -7,7 +7,7 @@ import org.bukkit.event.HandlerList;
public final class PlayerLineDriveEvent extends Event implements Cancellable{ public final class PlayerLineDriveEvent extends Event implements Cancellable{
private Player p; private Player p;
private boolean cancelled; private boolean cancelled=false;
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public PlayerLineDriveEvent(Player p) { public PlayerLineDriveEvent(Player p) {

View File

@ -7,7 +7,7 @@ import org.bukkit.event.HandlerList;
public class PlayerTumbleEvent extends Event implements Cancellable{ public class PlayerTumbleEvent extends Event implements Cancellable{
private Player p; private Player p;
private boolean cancelled; private boolean cancelled=false;
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public PlayerTumbleEvent(Player p) { public PlayerTumbleEvent(Player p) {

View File

@ -0,0 +1,61 @@
package sig.plugin.TwosideKeeper.Generators;
import java.util.Random;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
public class DPSRoom extends Room{
public DPSRoom(int width,int length) {
super(width,length);
}
@Override
public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
byte[] result = new byte[65536];
if (chunkx<ROOM_WIDTH/16 &&
chunkz<ROOM_LENGTH/16 &&
chunkx>=0 &&
chunkz>=0) {
for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
//result[xyzToByte(x,255,z)] = (byte) Material.BARRIER.getId();
}
}
GenerateOuterWalls(chunkx, chunkz, result);
}
/*for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
}
}*/
return result;
}
protected void GenerateOuterWalls(int chunkx, int chunkz, byte[] result) {
int wallslotx = Math.floorMod(chunkx,ROOM_WIDTH/16);
int wallslotz = Math.floorMod(chunkz,ROOM_LENGTH/16);
for (int y=1;y<20;y++) {
for(int x=0; x<16; x++){
for (int z=0;z<16;z++) {
if (wallslotx==0) {
result[xyzToByte(0,y,z)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotx==(ROOM_WIDTH/16)-1){
result[xyzToByte(15,y,z)] = (byte) Material.BEDROCK.getId();
}
if (wallslotz==0) {
result[xyzToByte(x,y,0)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotz==(ROOM_LENGTH/16)-1){
result[xyzToByte(x,y,15)] = (byte) Material.BEDROCK.getId();
}
}
}
}
}
}

View File

@ -0,0 +1,61 @@
package sig.plugin.TwosideKeeper.Generators;
import java.util.Random;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
public class ParkourRoom extends Room{
public ParkourRoom(int width,int length) {
super(width,length);
}
@Override
public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
byte[] result = new byte[65536];
if (chunkx<ROOM_WIDTH/16 &&
chunkz<ROOM_LENGTH/16 &&
chunkx>=0 &&
chunkz>=0) {
for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
//result[xyzToByte(x,255,z)] = (byte) Material.BARRIER.getId();
}
}
GenerateOuterWalls(chunkx, chunkz, result);
}
/*for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
}
}*/
return result;
}
protected void GenerateOuterWalls(int chunkx, int chunkz, byte[] result) {
int wallslotx = Math.floorMod(chunkx,ROOM_WIDTH/16);
int wallslotz = Math.floorMod(chunkz,ROOM_LENGTH/16);
for (int y=1;y<80;y++) {
for(int x=0; x<16; x++){
for (int z=0;z<16;z++) {
if (wallslotx==0) {
result[xyzToByte(0,y,z)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotx==(ROOM_WIDTH/16)-1){
result[xyzToByte(15,y,z)] = (byte) Material.BEDROCK.getId();
}
if (wallslotz==0) {
result[xyzToByte(x,y,0)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotz==(ROOM_LENGTH/16)-1){
result[xyzToByte(x,y,15)] = (byte) Material.BEDROCK.getId();
}
}
}
}
}
}

View File

@ -0,0 +1,83 @@
package sig.plugin.TwosideKeeper.Generators;
import java.util.Random;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
public class Room extends ChunkGenerator{
int ROOM_WIDTH = 32;
int ROOM_LENGTH = 32;
public Room() {
}
public Room(int width, int length) {
ROOM_WIDTH=width;
ROOM_LENGTH=length;
}
@Override
public boolean canSpawn(World world, int x, int z) {
return true;
}
public int xyzToByte(int x, int y, int z) {
return (x * 16 + z) * 256 + y;
}
@Override
public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
byte[] result = new byte[65536];
if (chunkx<ROOM_WIDTH/16 &&
chunkz<ROOM_LENGTH/16 &&
chunkx>=0 &&
chunkz>=0) {
for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
}
}
GenerateOuterWalls(chunkx, chunkz, result);
}
/*for(int x=0; x<16; x++){
for(int z=0; z<16; z++) {
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
}
}*/
return result;
}
protected void GenerateOuterWalls(int chunkx, int chunkz, byte[] result) {
int wallslotx = Math.floorMod(chunkx,ROOM_WIDTH/16);
int wallslotz = Math.floorMod(chunkz,ROOM_LENGTH/16);
for (int y=1;y<255;y++) {
for(int x=0; x<16; x++){
for (int z=0;z<16;z++) {
if (wallslotx==0) {
result[xyzToByte(0,y,z)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotx==(ROOM_WIDTH/16)-1){
result[xyzToByte(15,y,z)] = (byte) Material.BEDROCK.getId();
}
if (wallslotz==0) {
result[xyzToByte(x,y,0)] = (byte) Material.BEDROCK.getId();
} else
if (wallslotz==(ROOM_LENGTH/16)-1){
result[xyzToByte(x,y,15)] = (byte) Material.BEDROCK.getId();
}
}
}
}
}
public int getRoomWidth() {
return ROOM_WIDTH;
}
public int getRoomLength() {
return ROOM_LENGTH;
}
}

View File

@ -0,0 +1,132 @@
package sig.plugin.TwosideKeeper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
public class GlobalLoot {
Item item;
public static List<Chunk> chunks = new ArrayList<Chunk>();
Chunk c;
String lootname;
UUID item_uuid;
HashMap<UUID,Inventory> drop_inventories = new HashMap<UUID,Inventory>();
HashMap<UUID,Long> last_opened_loot = new HashMap<UUID,Long>();
GlobalLoot(Location spawnLoc, String lootName) {
Chunk c = spawnLoc.getChunk();
if (!chunks.contains(c)) {
chunks.add(c);
c.load();
}
TwosideKeeper.temporary_chunks.add(c);
item = (Item)spawnLoc.getWorld().dropItemNaturally(spawnLoc, new ItemStack(Material.CHEST));
//item = GenericFunctions.dropItem(new ItemStack(Material.CHEST), spawnLoc);
item_uuid = item.getUniqueId();
item.setCustomName(TextUtils.RandomColor()+ChatColor.stripColor(lootName));
item.setCustomNameVisible(true);
item.setPickupDelay(Integer.MAX_VALUE);
item.setInvulnerable(true);
this.lootname = lootName;
TwosideKeeper.temporary_chunks.remove(c);
}
public void runInventoryCloseEvent(InventoryCloseEvent ev) {
Player p = (Player)ev.getPlayer();
if (drop_inventories.containsKey(p.getUniqueId()) &&
ev.getInventory().getTitle()!=null &&
ev.getInventory().getTitle().equalsIgnoreCase(lootname)) {
last_opened_loot.put(p.getUniqueId(), TwosideKeeper.getServerTickTime());
}
}
public boolean runTick() {
if ((item!=null && item.isValid())) {
List<Player> players = GenericFunctions.getNearbyPlayers(item.getLocation(), 1.5);
for (Player p : players) {
if (p.getOpenInventory().getType()==InventoryType.CRAFTING &&
drop_inventories.containsKey(p.getUniqueId())) {
if ((!last_opened_loot.containsKey(p.getUniqueId()) ||
last_opened_loot.get(p.getUniqueId())+100<=TwosideKeeper.getServerTickTime()) &&
!InventoryUtils.hasEmptyInventory(drop_inventories.get(p.getUniqueId()))) {
last_opened_loot.put(p.getUniqueId(), TwosideKeeper.getServerTickTime());
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\"<"+p.getName()+"> \"},{\"text\":\""+ChatColor.GREEN+"A "+item.getCustomName()+" is nearby! "+ChatColor.BOLD+"[\"},{\"text\":\"[Click Here]"+ChatColor.RESET+ChatColor.GREEN+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+""+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand()).replace("\"", "\\\"")+"\"}},{\"text\":\""+ev.getMessage().substring(pos)+"\"}]");
TextComponent tc = new TextComponent(ChatColor.GREEN+"A "+item.getCustomName()+ChatColor.RESET+ChatColor.GREEN+" is nearby! ");
TextComponent tc2 = new TextComponent(ChatColor.YELLOW+""+ChatColor.BOLD+"[Click here]");
tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/dailyloot "+item.getUniqueId()));
tc.addExtra(tc2);
tc2 = new TextComponent(ChatColor.RESET+""+ChatColor.GREEN+" to open its contents.");
tc.addExtra(tc2);
p.spigot().sendMessage(tc);
//p.openInventory(drop_inventories.get(p.getUniqueId()));
}
}/* else {
if (!drop_inventories.containsKey(p.getUniqueId())) {
TwosideKeeper.log("WARNING! Could not find UUID "+p.getUniqueId()+". UUID List: "+TextUtils.outputHashmap(drop_inventories), 1);
}
}*/
}
return true;
} else {
chunks.remove(c);
return false;
}
}
public Item getItem() {
return item;
}
public UUID getItemUniqueID() {
return item_uuid;
}
public void addNewDropInventory(UUID id, ItemStack...lootitems) {
if (drop_inventories.containsKey(id)) {
Inventory inv = drop_inventories.get(id);
inv.addItem(lootitems);
} else {
Inventory newinv = Bukkit.createInventory(null, ((((lootitems.length-1)/9)+1)*9),this.lootname);
newinv.addItem(lootitems);
drop_inventories.put(id, newinv);
}
}
public void openDropInventory(Player p) {
if (drop_inventories.containsKey(p.getUniqueId()) &&
!InventoryUtils.hasEmptyInventory(drop_inventories.get(p.getUniqueId()))) {
p.openInventory(drop_inventories.get(p.getUniqueId()));
} else {
TwosideKeeper.log("WARNING! Drop Inventory for Player with UUID <"+p.getUniqueId()+"> does not have an associated inventory with Global Loot <"+item.getUniqueId()+">. THIS SHOULD NOT BE HAPPENING!!", 1);
p.sendMessage(ChatColor.RED+"Something terrible has happened! "+ChatColor.RESET+"Please let the server administrator know about this.");
}
}
public static GlobalLoot spawnGlobalLoot(Location loc, String lootName) {
GlobalLoot loot = new GlobalLoot(loc,lootName);
TwosideKeeper.globalloot.put(loot.getItem().getUniqueId(), loot);
return loot;
}
}

View File

@ -1,22 +0,0 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.entity.Monster;
public class HellfireSpider {
Monster m;
public HellfireSpider(Monster m) {
this.m=m;
}
public Monster GetSpider() {
return m;
}
public boolean isAlive() {
return !m.isDead();
}
public boolean hasTarget() {
return (m.getTarget()!=null)?true:false;
}
}

View File

@ -0,0 +1,176 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
public class AdvancedTitle {
TitlePart large_lefttitle = new TitlePart("",0);
TitlePart large_centertitle = new TitlePart("",0);
TitlePart large_righttitle = new TitlePart("",0);
TitlePart small_centertitle = new TitlePart("",0);
Player p;
public AdvancedTitle(Player p) {
this.p=p;
}
public void modifyLargeLeftTitle(String title, int duration) {
large_lefttitle.setTitle(title);
large_lefttitle.setDuration(duration);
update();
}
public void modifyLargeCenterTitle(String title, int duration) {
large_centertitle.setTitle(title);
large_centertitle.setDuration(duration);
update();
}
public void modifyLargeRightTitle(String title, int duration) {
large_righttitle.setTitle(title);
large_righttitle.setDuration(duration);
update();
}
public void modifySmallCenterTitle(String title, int duration) {
small_centertitle.setTitle(title);
small_centertitle.setDuration(duration);
update();
}
public void checkExpiredTitles() {
boolean refreshnames=false;
if (large_lefttitle.isExpired()) {
large_lefttitle.clear();
refreshnames=true;
}
if (large_centertitle.isExpired()) {
large_centertitle.clear();
refreshnames=true;
}
if (large_righttitle.isExpired()) {
large_righttitle.clear();
refreshnames=true;
}
if (small_centertitle.isExpired()) {
small_centertitle.clear();
refreshnames=true;
}
if (refreshnames) {
update();
}
}
public void update() {
p.sendTitle(combineLargeTitles(), combineSmallTitles());
}
private String combineSmallTitles() {
StringBuilder sb = new StringBuilder(small_centertitle.getTitle());
return sb.toString();
}
private String combineLargeTitles() {
StringBuilder sb = new StringBuilder(large_lefttitle.getTitle());
sb.append(ChatColor.RESET);
if (large_lefttitle.getTitle().length()>0 ||
large_righttitle.getTitle().length()>0) {
if (large_centertitle.getTitle().length()==0) {
sb.append(" ");
} else {
sb.append(" ");
sb.append(large_centertitle.getTitle());
sb.append(ChatColor.RESET);
sb.append(" ");
}
} else {
sb.append(large_centertitle.getTitle());
sb.append(ChatColor.RESET);
}
sb.append(large_righttitle.getTitle());
return sb.toString();
}
public void updateCombatBar(Player p, LivingEntity target) {
updateSideTitleStats(p);
TwosideKeeper.updateHealthbarDisplay(p, target);
update();
}
public void updateCombatBar(Player p, LivingEntity target, double damage, int flags) {
updateSideTitleStats(p);
TwosideKeeper.updateHealthbarDisplay(p, target, damage, flags);
update();
}
public void updateSideTitleStats(Player p) {
//DebugUtils.showStackTrace();
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN) {
modifyLargeLeftTitle(ChatColor.DARK_AQUA+""+Integer.toString((int)pd.weaponcharges),100);
modifyLargeRightTitle(ChatColor.DARK_PURPLE+Integer.toString((int)pd.damagepool)+"",100);
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) {
if (ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
modifyLargeLeftTitle(ChatColor.YELLOW+Integer.toString((int)pd.vendetta_amt),100);
}
//modifyLargeRightTitle(ChatColor.GOLD+Integer.toString((int)pd.thorns_amt),100);
modifyLargeRightTitle(ChatColor.DARK_AQUA+Integer.toString(pd.blockStacks)+"",100);
}
}
public String[] getTitles() {
return new String[]{large_lefttitle.getTitle(),large_centertitle.getTitle(),large_righttitle.getTitle()};
}
}
class TitlePart {
String title;
long expiretime;
boolean hasExpired=false;
TitlePart(String title, int duration) {
this.title=title;
this.expiretime=TwosideKeeper.getServerTickTime()+duration;
}
public void clear() {
title="";
hasExpired=true;
}
void setTitle(String title) {
this.title=title;
}
void setDuration(int duration) {
this.expiretime=TwosideKeeper.getServerTickTime()+duration;
hasExpired=false;
}
boolean alreadyExpired() {
return hasExpired;
}
boolean isExpired() {
return !hasExpired && expiretime<=TwosideKeeper.getServerTickTime();
}
String getTitle() {
return title;
}
long getExpirationTime() {
return expiretime;
}
}

View File

@ -30,7 +30,7 @@ public class AnvilItem {
if (validitem(olditem) && validitem(newitem)) { if (validitem(olditem) && validitem(newitem)) {
//Input Item : ᶲ2+Test New Item: 2Jelly //Input Item : ᶲ2+Test New Item: 2Jelly
String var = getColorCodes(); //var = ChatColor.RED (ᶲ2) String var = getColorCodes(); //var = ChatColor.RED (ᶲ2)
TwosideKeeper.log("var = "+var, 2); TwosideKeeper.log("var = "+var, 5);
String newcol = newitem.getItemMeta().getDisplayName(); //2Jelly String newcol = newitem.getItemMeta().getDisplayName(); //2Jelly
String colors = ""; String colors = "";
if (var.length()>=2) { if (var.length()>=2) {

View File

@ -1,11 +1,16 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ArrowBarrage implements Runnable{ public class ArrowBarrage implements Runnable{
@ -23,13 +28,19 @@ public class ArrowBarrage implements Runnable{
public void run() { public void run() {
shots_left--; shots_left--;
Arrow arr = p.launchProjectile(Arrow.class); Arrow arr = p.launchProjectile(Arrow.class);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.rangermode=BowMode.SNIPE;
arr.setVelocity(p.getLocation().getDirection().multiply(2)); arr.setVelocity(p.getLocation().getDirection().multiply(2));
TwosideKeeper.ShootPiercingArrow(arr, p); TwosideKeeper.ShootPiercingArrow(arr, p);
arr.remove(); arr.remove();
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 4, 9, p, true); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 4, 9, p, true);
if (shots_left>0) { if (shots_left>0) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, this, 3); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, this, 3);
} else {
aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, 1));
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
aPluginAPIWrapper.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, TwosideKeeper.ARROWBARRAGE_COOLDOWN));
}, 1);
} }
} }
} }

View File

@ -17,8 +17,11 @@ import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.AwakenedArtifact; import sig.plugin.TwosideKeeper.AwakenedArtifact;
import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.PVP;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Common.PVPValue;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
public enum ArtifactAbility { public enum ArtifactAbility {
//Enum Structure: //Enum Structure:
@ -26,127 +29,148 @@ public enum ArtifactAbility {
//Temporary abilities: Work for 1 level and wear off afterward. //Temporary abilities: Work for 1 level and wear off afterward.
//Weapon Abilities //Weapon Abilities
DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,8.0,9.0,10.0}, DAMAGE("Strike","Improves Base Damage by [VAL]",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), new PVPValue(15,1.0),10000,1,UpgradePath.BASIC,1),
ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{0.4,0.8,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.7,6.4,7.5}, ARMOR_PEN("Piercing","[VAL]% of your damage is ignored by resistances. ([PENDMG] damage)",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), new PVPValue(30,1.0),100,1,UpgradePath.BASIC,1),
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.45,0.6,0.75,0.9,1.05,1.2,1.35,1.50,1.65,1.80,1.95,2.10,2.40,2.70}, EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC), new PVPValue(30,0.3),10000,1,UpgradePath.BASIC,1),
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.8,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.6,6.4,7.2,8.0,8.8}, LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.75,0.75,0.7,0.7,0.6,0.6,0.5,0.5,0.4},100,1,UpgradePath.WEAPON), new PVPValue(15,0.1),1000,1,UpgradePath.WEAPON,1),
CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{1.0,1.25,1.5,1.75,2.0,2.25,2.50,2.75,3.0,3.25,3.50,3.75,4.00,4.25,4.50}, CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.825,0.8,0.75,0.7,0.65,0.6,0.55,0.5},100,1,UpgradePath.WEAPON), new PVPValue(30,0.5),100,1,UpgradePath.WEAPON,1),
CRIT_DMG("Crit Damage","Critical Strikes deal [200VAL]% damage.",new double[]{0.5,1.0,2.0,4.0,6.0,10.0,15.0,19.0,22.0,26.0,30.0,35.0,40.0,45.0,60.0}, CRIT_DMG("Crit Damage","Critical Strikes deal [200VAL]% damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{3.0,2.9,2.8,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2.0,1.8,1.6,1.4,1.0},100,1,UpgradePath.WEAPON), new PVPValue(30,1.0),10000,1,UpgradePath.WEAPON,1),
HIGHWINDER("Highwinder","While moving fast or sprinting, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.18,0.225,0.27,0.315,0.36,0.405,0.45,0.495,0.54,0.61,0.79,0.99,1.30,1.70,2.50}, HIGHWINDER("Highwinder","While moving fast or sprinting, you deal [VAL] extra damage for every 1m of speed.",new double[]{0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05},
new double[]{0.675,0.65,0.625,0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375,0.35,0.30},100,15,UpgradePath.WEAPON), new PVPValue(1,0.5),10000,15,UpgradePath.WEAPON,1),
//Bow Abilities //Bow Abilities
MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{10.0,15,20,25,30,35,40,45,50,55,60,70,80,90,100}, MARKSMAN("Marksman","Increases headshot hitbox size by [VAL]% .",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,0.975,0.95,0.875,0.85,0.825,0.8,0.775,0.75,0.725,0.70,0.675,0.65,0.55,0.45},10,15,UpgradePath.BOW), new PVPValue(30,1.0),10000,15,UpgradePath.BOW,1),
SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n" /*SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n"
+ "Applies Slowness V and Resistance VI. While in Siege Stance you fire clusters of 7 arrows per shot. Each arrow deals [VAL] damage.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0}, + "Applies Slowness V and Resistance VI. While in Siege Stance you fire clusters of 7 arrows per shot. Each arrow deals [VAL] damage.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.BOW), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.BOW,1),
ARROWSHOWER("Arrow Shower",ChatColor.GRAY+"[Unimplemented] Shift-Left Click to activate. Applies Slowness X for three seconds while firing arrows into the sky and onto enemies in a large area in front of you. Each arrow deals [VAL] damage.",new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7}, ARROWSHOWER("Arrow Shower",ChatColor.GRAY+"[Unimplemented] Shift-Left Click to activate. Applies Slowness X for three seconds while firing arrows into the sky and onto enemies in a large area in front of you. Each arrow deals [VAL] damage.",new double[]{0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7,0.7},
new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},100,1000,UpgradePath.BOW), new double[]{0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4},100,1000,UpgradePath.BOW,1),
TARGETING("Targeting",ChatColor.GRAY+"[Unimplemented] Left-click a mob to target them. Fire arrows to release homing missiles at your target. Each missile explodes and deals [VAL] damage.",new double[]{10,10,10,10,10,10,10,10,10,10}, TARGETING("Targeting",ChatColor.GRAY+"[Unimplemented] Left-click a mob to target them. Fire arrows to release homing missiles at your target. Each missile explodes and deals [VAL] damage.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,1000,UpgradePath.BOW), new double[]{0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3},100,1000,UpgradePath.BOW,1),
ENDERTURRET("Ender Turret",ChatColor.GRAY+"[Unimplemented] Place Eyes of Ender in your hotbar to use as ammo. Each eye fired launches forward and upward before releasing a barrage of homing missiles that lock onto enemy targets. Each missile explodes and deals [VAL] damage.",new double[]{25,25,25,25,25,25,25,25,25,25}, ENDERTURRET("Ender Turret",ChatColor.GRAY+"[Unimplemented] Place Eyes of Ender in your hotbar to use as ammo. Each eye fired launches forward and upward before releasing a barrage of homing missiles that lock onto enemy targets. Each missile explodes and deals [VAL] damage.",new double[]{25,25,25,25,25,25,25,25,25,25},
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,1000,UpgradePath.BOW), new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},100,1000,UpgradePath.BOW,1),*/
//Armor abilities //Armor abilities
DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.1,5.2,5.25,5.3,5.35,5.5}, DAMAGE_REDUCTION("Defense","Increases Base Damage reduction by [VAL]%\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245,0.245},
new double[]{2.2,2.1,2.0,1.9,1.8,1.7,1.6,1.55,1.5,1.475,1.45,1.425,1.4,1.35,1.3},100,1,UpgradePath.ARMOR), new PVPValue(50,0.245),100,1,UpgradePath.ARMOR,1),
HEALTH("Health","Increases Maximum Health by [VAL].\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.35,0.70,1.05,1.40,1.70,2.0,2.3,2.6,2.9,3.0,3.1,3.2,3.3,3.4,3.6}, HEALTH("Health","Increases Maximum Health by [VAL].\n\n"+PlayerMode.RANGER.getColor()+PlayerMode.RANGER.getName()+" Mode "+ChatColor.WHITE+" only receives half the effect.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25},
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.75,0.7,0.675,0.65,0.625,0.6,0.55,0.5},100,1,UpgradePath.ARMOR), new PVPValue(30,0.25),10000,1,UpgradePath.ARMOR,1),
HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.03125,0.0625,0.09375,0.125,0.15625,0.1875,0.29166666666666666666666666666667,0.33333333333333333333333333333333,0.375,0.4,0.42,0.44,0.46,0.48,0.55}, HEALTH_REGEN("Regeneration","Regenerates an extra [VAL] health every 5 seconds.",new double[]{0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125},
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.475,0.45,0.425,0.4},100,1,UpgradePath.ARMOR), new PVPValue(1,0.125),10000,1,UpgradePath.ARMOR,1),
STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.1,7.2,7.3,7.4,7.45,7.5}, STATUS_EFFECT_RESISTANCE("Resistance","When a debuff is applied, there is a [VAL]% chance to remove it.",new double[]{0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25},
new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.775,2.75,2.725,2.7,2.675,2.65},100,1,UpgradePath.ARMOR), new PVPValue(40,0.25),100,1,UpgradePath.ARMOR,1),
SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2},
new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.65,0.625,0.6,0.585,0.565,0.55},100,10,UpgradePath.ARMOR), new PVPValue(0,0.2),100,100,UpgradePath.ARMOR,1),
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consumes this ability, removes all debuffs, and restores your health by [VAL]%"+TemporarySkill(),new double[]{4,4.25,4.5,4.75,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10}, SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consumes this ability, removes all debuffs, and restores your health by [VAL]%"+TemporarySkill(true),new double[]{10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,25,UpgradePath.ARMOR), new PVPValue(0,10),10,25,UpgradePath.ARMOR,1),
DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{0.1,0.125,0.15,0.175,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.45,0.5,0.55}, DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source."+LevelCost(2),new double[]{0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.2},
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.45,0.35,0.25,0.2},100,40,UpgradePath.ARMOR), new PVPValue(0,0.2),100,40,UpgradePath.ARMOR,2),
GRACEFULDODGE("Graceful Dodge","Whenever a dodge occurs, you will gain [VAL] seconds of invulnerability."+LevelCost(10),new double[]{0.1,0.105,0.11,0.115,0.12,0.125,0.13,0.135,0.14,0.145,0.15,0.155,0.165,0.18,0.2}, GRACEFULDODGE("Graceful Dodge","Whenever a dodge occurs, you will gain [GRACEFULVAL] seconds of invulnerability."+LevelCost(10),new double[]{0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05},
new double[]{1.8,1.79,1.78,1.77,1.76,1.75,1.74,1.73,1.72,1.71,1.70,1.69,1.67,1.65,1.62},10,40,UpgradePath.ARMOR), new PVPValue(0,0.05),100,40,UpgradePath.ARMOR,10),
//Sword abilities //Sword abilities
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,15.0}, PROVOKE("Provoke","Your attacks increase Aggression by [VAL].",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5},
new double[]{3.0,2.9,2.8,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.2,1.1},100,10,UpgradePath.SWORD), new PVPValue(0,1.0),10000,10,UpgradePath.PROVOKE,1),
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.25,3.5,4.0,5.5}, COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.825,0.8,0.75,0.7,0.65,0.6,0.55,0.5},100,40,UpgradePath.SWORD), new PVPValue(50,0.1),10000,40,UpgradePath.SWORD,1),
//Pickaxe abilities //Pickaxe abilities
SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, /*SCAVENGE("Scavenge",ChatColor.GRAY+"[Unimplemented] Breaks off resources from armor. [VAL]% chance per hit.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1),
MINES("Land Mine",ChatColor.GRAY+"[Unimplemented]While in combat, throw your pickaxe to send land mines towards your enemies. On contact they deal [VAL] damage.",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}, MINES("Land Mine",ChatColor.GRAY+"[Unimplemented]While in combat, throw your pickaxe to send land mines towards your enemies. On contact they deal [VAL] damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.PICKAXE,1),*/
MINES("Land Mine",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" air to place down a land mine. Land mines detonate when enemies step near the mine location, dealing [VAL] damage. Mines will automatically detonate after 15 seconds of no activity.\n\nYou can place a maximum of "+ChatColor.GOLD+"[MINEAMT]"+ChatColor.RESET+" mine[MINEAMTPLURAL] at once.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(100,1.0),10000,40,UpgradePath.PICKAXE,1),
OREHARVESTER("Ore Harvester",ChatColor.GOLD+"Shift+Right-click"+ChatColor.RESET+" an ore block to convert the block into a temporary buff. The buff lasts for [VAL] seconds. Duration can be stacked for longer buffs.\n\n "+DisplayOreBonus("Coal Ore","+[COALORE_BONUS]% Critical Damage")+"\n"+DisplayOreBonus("Iron Ore","+[IRONORE_BONUS]% Block Chance")+"\n"+DisplayOreBonus("Gold Ore","+[GOLDORE_BONUS]% Critical Strike Chance")+"\n"+DisplayOreBonus("Redstone Ore","+[REDSTONEORE_BONUS] Maximum Health")+"\n"+DisplayOreBonus("Lapis Lazuli Ore","+[LAPISORE_BONUS] Health Regeneration")+"\n"+DisplayOreBonus("Diamond Ore","+[COALORE_BONUS]% Damage Reduction")+"\n"+DisplayOreBonus("Emerald Ore","+[COALORE_BONUS] Base Damage")+"\n"+LevelCost(40),new double[]{10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0},
new PVPValue(100,10.0),10000,100,UpgradePath.PICKAXE,40),
IMPACT("Impact","Damaging an enemy deals [VAL]% of an enemy's health as bonus physical damage on hit."+LevelCost(5),new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new PVPValue(100,1.0),250,20,UpgradePath.PICKAXE,5),
FORCESTRIKE("Force Strike","Perform an attack that slams an enemy against a wall. Enemies take [FORCESTRIKEVAL] damage on a successful slam, crumbling the walls behind them.\n\n"+ChatColor.YELLOW+"15 second cooldown",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new PVPValue(100,2.0),10000,350,UpgradePath.PICKAXE,1),
//Shovel abilities //Shovel abilities
SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n" SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n"
+ "Suppression prevents movement, attacking, exploding, and teleportation."+LevelCost(10),new double[]{0.1,0.12,0.14,0.16,0.18,0.2,0.22,0.24,0.26,0.28,0.3,0.34,0.38,0.42,0.5}, + "Suppression prevents movement, attacking, exploding, and teleportation."+LevelCost(10),new double[]{0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,10,UpgradePath.SHOVEL), new PVPValue(10,0.02),100,10,UpgradePath.SHOVEL,10),
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [VAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{11.0,12.0,13.0,14.0,16.0,18.0,20.0,23,26.0,29,32.0,35.0,37.5,39.5,50}, ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [ERUPTIONVAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3},100,40,UpgradePath.SHOVEL), new PVPValue(15,3.0),10000,40,UpgradePath.SHOVEL,1),
EARTHWAVE("Earth Wave","While in combat, destroy a block to send a wave of earth towards your enemies. Enemies standing inside of the waves take [VAL] damage every second.",new double[]{10,12,14,16,18,20,22,24,26,30,35,40,45,50,70}, EARTHWAVE("Earth Wave","While in mid-air, right-click to instantly slam into the ground and launch soft blocks. This attack ignores fall damage. The larger the fall, the larger the wave.\n\nDeals [EARTHWAVEVAL] damage to every enemy hit by the wave. Deals double damage and knocks up on soft blocks.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2,1.1,1.0,0.9,0.8,0.7},100,100,UpgradePath.SHOVEL), new PVPValue(15,2.0),10000,100,UpgradePath.SHOVEL,1),
//Axe abilities //Axe abilities
BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3}, /*BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.AXE), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.AXE,1),
BUTCHERY("Butchery",ChatColor.GRAY+"[Unimplemented] Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10}, BUTCHERY("Butchery",ChatColor.GRAY+"[Unimplemented] Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE), new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE,1),*/
DAMAGEPOOL("Damage Pool Recovery","Removes [VAL] points from Barbarian's Damage Pool with each attack.",
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new PVPValue(30,0.5),10000,1,UpgradePath.AXE,1),
LIFESTACK("Life Stack","Increases Barbarian's lifesteal stacks by [VAL] per hit.",
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new PVPValue(30,0.5),10000,1,UpgradePath.AXE,1),
LIFESUCK("Life Sucker","Directly heals [VAL]% of damage dealt as health, with a maximum of [LIFESUCKVAL] health healed per hit."+LevelCost(3),
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},
new PVPValue(30,0.8),100,40,UpgradePath.AXE,3),
HIGHDIVE("High Dive","Sneak while pressing the drop key to become rooted for 3 seconds, storing [VAL]% damage taken and gaining 100% knockback resistance. Then leap up high into the air and slam the ground. High Dive increases the base damage of Barbarian's Leaping Strike by the amount of damage stored."+LevelCost(3),
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},
new PVPValue(30,0.8),100,100,UpgradePath.AXE,3),
//Scythe abilities //Scythe abilities
AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.4,0.45,0.5,0.55,0.6,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10}, AOE("Area of Effect","Deals damage to targets up to [AOEVAL]m from the main target hit.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.9,0.7,0.5},100,1,UpgradePath.SCYTHE), new PVPValue(5,1.0),10000,1,UpgradePath.SCYTHE,1),
DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Targets killed with Death Mark resets the cooldown. Targets not killed lose half their Death Mark stacks.\n\n Each death mark stack applied deals [VAL] true damage.",new double[]{0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.5,3.0,3.5,4.0,5.0}, DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Targets killed with Death Mark resets the cooldown. Targets not killed lose half their Death Mark stacks.\n\n Each death mark stack applied deals [VAL] true damage.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3,0.275,0.25},100,10,UpgradePath.SCYTHE), new PVPValue(10,1.0),10000,10,UpgradePath.SCYTHE,1),
CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1,2,3,4,5,6,7,8,10,12}, CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,1000,UpgradePath.SCYTHE), new PVPValue(1,1.0),100,1000,UpgradePath.SCYTHE,1),
//General abilities //General abilities
AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,10,15}, AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL), new PVPValue(30,1.0),10000,1,UpgradePath.ALL,1),
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each kill has a [GREEDCHANCE]% chance to consume the Greed buff."+TemporarySkill(),new double[]{1,2,3,4,5,7,9,11,13,15,17,19,25,35,50}, GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each kill has a [GREEDCHANCE]% chance to consume the Greed buff."+TemporarySkill(true),new double[]{10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,15.0,15.0,15.0,20.0,25.0,30.0,40.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,10,UpgradePath.ALL), new PVPValue(0,10.0),10,10,UpgradePath.ALL,1),
/*GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100}, GROWTH("Growth","Sets the Potential of your Artifact to 20%."+TemporarySkill(false),new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),*/ new PVPValue(0,1.0),1,10,UpgradePath.ALL,1),
REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0}, /*REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL), new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),*/
PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.25,1.5,1.75,2.0,2.25,2.5,2.75,3.0,3.25,3.50,3.75,4.0,4.25,4.5}, PRESERVATION("Preservation","Potential decays [POTVAL]% slower.",new double[]{0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90,0.90},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1,UpgradePath.ALL), new PVPValue(100,0.9),100,1,UpgradePath.ALL,1),
EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5}, /*EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),*/
//Bad stuff //Bad stuff
REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8}, REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,3,UpgradePath.ALL), new PVPValue(30,8),100,3,UpgradePath.ALL,1),
REDUCEDEF("Imperil","[VAL]% Decrease in Damage Reduction",new double[]{8,8,8,8,8,8,8,8,8,8}, REDUCEDEF("Imperil","[VAL]% Decrease in Damage Reduction",new double[]{8,8,8,8,8,8,8,8,8,8},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL), new PVPValue(30,8),100,5,UpgradePath.ALL,1),
LIFE_REDUCTION("Health Cut","[VAL]% decrease in maximum health.",new double[]{30,30,30,30,30,30,30,30,30,30}, LIFE_REDUCTION("Health Cut","[VAL]% decrease in maximum health.",new double[]{30,30,30,30,30,30,30,30,30,30},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL), new PVPValue(30,30),100,5,UpgradePath.ALL,1),
LOWER_DEFENSE("Debilitate","[VAL]% decrease in damage reduction.",new double[]{30,30,30,30,30,30,30,30,30,30}, LOWER_DEFENSE("Debilitate","[VAL]% decrease in damage reduction.",new double[]{30,30,30,30,30,30,30,30,30,30},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,5,UpgradePath.ALL), new PVPValue(30,30),100,5,UpgradePath.ALL,1),
TELEPORT("Teleport","[VAL]% chance to teleport the player to a random location on artifact experience gain.",new double[]{3,3,3,3,3,3,3,3,3,3}, TELEPORT("Teleport","[VAL]% chance to teleport the player to a random location on artifact experience gain.",new double[]{3,3,3,3,3,3,3,3,3,3},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL), new PVPValue(30,3),100,10,UpgradePath.ALL,1),
DRAINING("Draining","[VAL]% chance to remove a level of experience on artifact experience gain.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, DRAINING("Draining","[VAL]% chance to remove a level of experience on artifact experience gain.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,10,UpgradePath.ALL), new PVPValue(30,1.0),100,10,UpgradePath.ALL,1),
NOREGEN("Weary","No health regenerates.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, NOREGEN("Weary","No health regenerates.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,15,UpgradePath.ALL), new PVPValue(30,1.0),100,15,UpgradePath.ALL,1),
STARVATION("Starvation","[VAL]% chance to cause [HUNGERVAL] seconds of Hunger on experience gain.",new double[]{5,5,5,5,5,5,5,5,5,5}, STARVATION("Starvation","[VAL]% chance to cause [HUNGERVAL] seconds of Hunger on experience gain.",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},100,15,UpgradePath.ALL), new PVPValue(30,5),100,15,UpgradePath.ALL,1),
BURN("Flammable","All burn damage deals x[VAL] damage.",new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0}, BURN("Flammable","All burn damage deals x[VAL] damage.",new double[]{4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,25,UpgradePath.ALL), new PVPValue(30,0.4),100,25,UpgradePath.ALL,1),
FROZEN("Frozen","Player will be inflicted with increasing levels of slowness and fatigue until finally frozen and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, FROZEN("Frozen","Player will be inflicted with increasing levels of slowness and fatigue until finally frozen and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL), new PVPValue(30,1.0),1,45,UpgradePath.ALL,1),
PETRIFICATION("Petrification","Player will be inflicted with increasing levels of slowness and fatigue until finally petrified and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, PETRIFICATION("Petrification","Player will be inflicted with increasing levels of slowness and fatigue until finally petrified and killed.",new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},1,45,UpgradePath.ALL), new PVPValue(30,1.0),1,45,UpgradePath.ALL,1),
; ;
final static double[] decayvals = new double[]{0.5,0.588,0.6505,0.6990,0.7386,0.7720,0.8010,0.8266,0.8495,0.8702,0.8891,0.9225,0.9515,0.9771,1.0};
public static int LINE_SIZE=50; public static int LINE_SIZE=50;
String name; String name;
String desc; String desc;
@ -155,25 +179,36 @@ public enum ArtifactAbility {
int maxlv; int maxlv;
int requirement; int requirement;
UpgradePath upgrade; UpgradePath upgrade;
int apcost;
PVPValue pvpval;
ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement, UpgradePath upgrade) { ArtifactAbility(String name, String desc, double[] baseval, PVPValue pvpval, int maxlv, int requirement, UpgradePath upgrade, int apcost) {
this.name=name; this.name=name;
this.desc=desc; this.desc=desc;
this.baseval=baseval; this.baseval=baseval;
this.decayval=decayval;
this.maxlv=maxlv; this.maxlv=maxlv;
this.requirement=requirement; this.requirement=requirement;
AwakenedArtifact.ability_map.put(this,this.name); AwakenedArtifact.ability_map.put(this,this.name);
AwakenedArtifact.name_map.put(this.name,this); AwakenedArtifact.name_map.put(this.name,this);
this.upgrade=upgrade; this.upgrade=upgrade;
this.apcost=apcost;
this.pvpval=pvpval;
}
public PVPValue getPVPValue() {
return pvpval;
} }
private static String LevelCost(int i) { private static String LevelCost(int i) {
return "\n\n"+ChatColor.RED+"Costs "+i+" AP"; return "\n\n"+ChatColor.RED+"Costs "+i+" AP";
} }
private static String TemporarySkill() { private static String TemporarySkill(boolean knockoff) {
return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point when knocked off."; return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point"+((knockoff)?" when knocked off.":"");
}
public int getAPCost() {
return this.apcost;
} }
public String GetName() { public String GetName() {
@ -186,12 +221,22 @@ public enum ArtifactAbility {
public double GetBaseValue(int tier) { public double GetBaseValue(int tier) {
if (tier<=0) {tier=1;} if (tier<=0) {tier=1;}
return this.baseval[tier-1]; if (tier-1<this.baseval.length) {
return this.baseval[tier-1];
} else {
TwosideKeeper.log("WARNING! Base value for tier "+tier+" does not exist for ability "+this.name()+"! Falling back to highest possible value.", 1);
return this.baseval[this.baseval.length-1];
}
} }
public double GetDecayValue(int tier) { public double GetDecayValue(int tier) {
if (tier<=0) {tier=1;} if (tier<=0) {tier=1;}
return this.decayval[tier-1]; if (tier-1<decayvals.length) {
return decayvals[tier-1];
} else {
TwosideKeeper.log("WARNING! Decay value for tier "+tier+" does not exist for decayvals array! Falling back to highest possible value.", 1);
return decayvals[decayvals.length-1];
}
} }
public int GetMaxLevel() { public int GetMaxLevel() {
@ -202,21 +247,6 @@ public enum ArtifactAbility {
return requirement; return requirement;
} }
public static double calculateValue(ArtifactAbility ability, int artifacttier, int abilitylevel) {
double sum=0;
TwosideKeeper.log("Ability "+ability.GetName(), 4);
for(int i=0;i<abilitylevel;i++){
TwosideKeeper.log("Old Sum:"+sum+"::i:"+i, 5);
sum+=1d/(1d+(ability.GetDecayValue(artifacttier)*(double)i));
TwosideKeeper.log("New Sum:"+sum+"::i:"+i, 5);
}
TwosideKeeper.log("Sum is "+sum, 5);
TwosideKeeper.log("Base value is "+ability.GetBaseValue(artifacttier), 4);
return sum*ability.GetBaseValue(artifacttier);
}
public static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) { public static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) {
HashMap<ArtifactAbility,Integer> abilities = new HashMap<ArtifactAbility,Integer>(); HashMap<ArtifactAbility,Integer> abilities = new HashMap<ArtifactAbility,Integer>();
if (GenericFunctions.isArtifactEquip(item)) { if (GenericFunctions.isArtifactEquip(item)) {
@ -234,7 +264,6 @@ public enum ArtifactAbility {
newstring+=" "+splitstring[j]; newstring+=" "+splitstring[j];
} }
} }
TwosideKeeper.log(newstring,5);
//This is the name of the enchantment. Now connect it with the name map we made. //This is the name of the enchantment. Now connect it with the name map we made.
abilities.put(AwakenedArtifact.name_map.get(ChatColor.stripColor(newstring)),Integer.parseInt(splitstring[splitstring.length-1])); abilities.put(AwakenedArtifact.name_map.get(ChatColor.stripColor(newstring)),Integer.parseInt(splitstring[splitstring.length-1]));
} }
@ -257,11 +286,20 @@ public enum ArtifactAbility {
List<String> lore = m.getLore(); List<String> lore = m.getLore();
if (containsEnchantment(ability,item)) { if (containsEnchantment(ability,item)) {
//We just need to find the line and upgrade it then. //We just need to find the line and upgrade it then.
boolean belowartifactline=false;
for (int i=0;i<lore.size();i++) { for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(ability.GetName())) { if (!belowartifactline) {
//This is the line! Modify it. if (lore.get(i).contains(ChatColor.GOLD+"Ability Points:")) {
lore.set(i, ChatColor.YELLOW+" "+ability.GetName()+" "+(lv)); belowartifactline=true;
break; }
} else {
String filterstring = ChatColor.stripColor(lore.get(i).replaceFirst(" ", "").substring(0, lore.get(i).lastIndexOf(" ")-1));
//TwosideKeeper.log("CHECKING _"+filterstring+"_ TO _"+ability.GetName()+"_", 0);
if (filterstring.equalsIgnoreCase(ability.GetName())) {
//This is the line! Modify it.
lore.set(i, ChatColor.YELLOW+" "+ability.GetName()+" "+(lv));
break;
}
} }
} }
m.setLore(lore); m.setLore(lore);
@ -282,7 +320,7 @@ public enum ArtifactAbility {
if (containsEnchantment(ability,item)) { if (containsEnchantment(ability,item)) {
for (int i=0;i<lore.size();i++) { for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(ability.GetName())) { if (lore.get(i).contains(ability.GetName())) {
TwosideKeeper.log("Removed "+ability.GetName(), 2); //TwosideKeeper.log("Removed "+ability.GetName(), 2);
//This is the line! Remove it. //This is the line! Remove it.
lore.remove(i); lore.remove(i);
i--; i--;
@ -297,7 +335,7 @@ public enum ArtifactAbility {
public static ItemStack removeAllEnchantments(ItemStack item) { public static ItemStack removeAllEnchantments(ItemStack item) {
HashMap<ArtifactAbility,Integer> enchants = getEnchantments(item); HashMap<ArtifactAbility,Integer> enchants = getEnchantments(item);
for (ArtifactAbility ab : enchants.keySet()) { for (ArtifactAbility ab : enchants.keySet()) {
TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2); //TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2);
item = removeEnchantment(ab,item); item = removeEnchantment(ab,item);
} }
item = AwakenedArtifact.setAP(item, AwakenedArtifact.getMaxAP(item)); item = AwakenedArtifact.setAP(item, AwakenedArtifact.getMaxAP(item));
@ -324,6 +362,7 @@ public enum ArtifactAbility {
} }
public static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) { public static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) {
//TwosideKeeper.log("Enchantment list: "+getEnchantments(item), 0);
return getEnchantments(item).containsKey(ability); return getEnchantments(item).containsKey(ability);
} }
@ -401,6 +440,13 @@ public enum ArtifactAbility {
return true; return true;
} }
}break; }break;
case PROVOKE:{
if ((item.getType().toString().contains("AXE") && !item.getType().toString().contains("PICKAXE"))
|| item.getType().toString().contains("SWORD")) {
//This is an item that can upgrade with Provoke.
return true;
}
}break;
case BASIC:{ case BASIC:{
if (!item.getType().toString().contains("HELMET") && if (!item.getType().toString().contains("HELMET") &&
!item.getType().toString().contains("CHESTPLATE") && !item.getType().toString().contains("CHESTPLATE") &&
@ -428,7 +474,7 @@ public enum ArtifactAbility {
if (getEnchantmentLevel(ability,item)>1) { //This is more than 1 level, so we just remove one level from it. if (getEnchantmentLevel(ability,item)>1) { //This is more than 1 level, so we just remove one level from it.
//This is allowed. Proceed. //This is allowed. Proceed.
item = applyEnchantment(ability,getEnchantmentLevel(ability,item)-1,item); item = applyEnchantment(ability,getEnchantmentLevel(ability,item)-1,item);
AwakenedArtifact.addAP(item, 1); //AwakenedArtifact.addAP(item, 1);
} else { } else {
//Just remove it completely. //Just remove it completely.
removeEnchantment(ability,item); removeEnchantment(ability,item);
@ -445,16 +491,21 @@ public enum ArtifactAbility {
int level = getEnchantmentLevel(ability,item); int level = getEnchantmentLevel(ability,item);
//Make sure this item is compatible with the enchantment being applied. //Make sure this item is compatible with the enchantment being applied.
if (isCompatibleWithUpgrade(item,ability.upgrade)) { if (isCompatibleWithUpgrade(item,ability.upgrade)) {
if (AwakenedArtifact.getAP(item)>0) { if (AwakenedArtifact.getAP(item)>=ability.getAPCost()) {
if (ability.GetMaxLevel()>level && ability.GetMinLevel()<=AwakenedArtifact.getLV(item)) { if (ability.GetMaxLevel()>level && ability.GetMinLevel()<=AwakenedArtifact.getLV(item)) {
//This is allowed. Proceed. //This is allowed. Proceed.
item = applyEnchantment(ability,level+1,item); item = applyEnchantment(ability,level+1,item);
AwakenedArtifact.addAP(item, -1); AwakenedArtifact.addAP(item, -ability.getAPCost());
p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!"); p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!");
if (ability.equals(ArtifactAbility.GRACEFULDODGE) || /*if (ability.equals(ArtifactAbility.GRACEFULDODGE) ||
ability.equals(ArtifactAbility.SUPPRESS)) { ability.equals(ArtifactAbility.SUPPRESS)) {
//Remove a level from using a temporary ability. //Remove a level from using a temporary ability.
AwakenedArtifact.addAP(item, -9); AwakenedArtifact.addAP(item, -9);
}*/
if (ability.equals(ArtifactAbility.GROWTH)) {
removeEnchantment(ArtifactAbility.GROWTH,item);
AwakenedArtifact.setPotential(item, 20);
AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1);
} }
int apamt = AwakenedArtifact.getAP(item); int apamt = AwakenedArtifact.getAP(item);
if (apamt>0) { if (apamt>0) {
@ -466,7 +517,7 @@ public enum ArtifactAbility {
tc.addExtra(ac); tc.addExtra(ac);
tc.addExtra(" to open up the ability upgrade menu.");;*/ tc.addExtra(" to open up the ability upgrade menu.");;*/
p.spigot().sendMessage(tc); p.spigot().sendMessage(tc);
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(item, p, null), item,GenericFunctions.CalculateSlot(item,p))); p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), CustomDamage.getBaseWeaponDamage(item, p, null), item,GenericFunctions.CalculateSlot(item,p),p));
} }
} else { } else {
if (ability.GetMaxLevel()<=level) { if (ability.GetMaxLevel()<=level) {
@ -484,15 +535,17 @@ public enum ArtifactAbility {
return item; return item;
} }
public static TextComponent DisplayAbility(ArtifactAbility ability, double playerdmgval, ItemStack targetitem, int slot) { public static TextComponent DisplayAbility(ArtifactAbility ability, double playerdmgval, ItemStack targetitem, int slot, Player p) {
boolean unlocked=true; boolean unlocked=true;
String lockedreason = ""; String lockedreason = "";
if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel() || getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel()) { if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel() || getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel() || AwakenedArtifact.getAP(targetitem)<ability.getAPCost()) {
unlocked=false; unlocked=false;
if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel()) { if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel()) {
lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact needs to reach Level "+ability.GetMinLevel()+" to obtain this ability."; lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact needs to reach Level "+ability.GetMinLevel()+" to obtain this ability.";
} else if (getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel()) { } else if (getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel()) {
lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact has reached the maximum level for this ability!"; lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact has reached the maximum level for this ability!";
} else if (AwakenedArtifact.getAP(targetitem)<ability.getAPCost()) {
lockedreason=ChatColor.GRAY+""+ChatColor.ITALIC+"Your Artifact does not have enough ability points to upgrade "+ChatColor.GREEN+ability.GetName()+ChatColor.GRAY+"!";
} }
} }
int enchantlevel=0; int enchantlevel=0;
@ -501,9 +554,9 @@ public enum ArtifactAbility {
} }
String displaystring = ""; String displaystring = "";
if (enchantlevel>0) { if (enchantlevel>0) {
displaystring = displayDescriptionUpgrade(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel,enchantlevel+1,playerdmgval); displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval, PVP.isPvPing(p));
} else { } else {
displaystring = displayDescription(ability,targetitem.getEnchantmentLevel(Enchantment.LUCK),enchantlevel+1,playerdmgval); displaystring = displayDescription(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel+1,playerdmgval, PVP.isPvPing(p));
} }
TextComponent tc = new TextComponent(((unlocked)?ChatColor.GREEN:ChatColor.RED)+"["+ability.GetName()+" "+(enchantlevel+1)+"] "); TextComponent tc = new TextComponent(((unlocked)?ChatColor.GREEN:ChatColor.RED)+"["+ability.GetName()+" "+(enchantlevel+1)+"] ");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ChatColor.BLUE+ability.GetName()+"\n\n"+displaystring+((lockedreason.equalsIgnoreCase(""))?"":"\n\n"),LINE_SIZE,"\n",true)+WordUtils.wrap(lockedreason,LINE_SIZE,"\n"+net.md_5.bungee.api.ChatColor.GRAY,true)).create())); tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(WordUtils.wrap(ChatColor.BLUE+ability.GetName()+"\n\n"+displaystring+((lockedreason.equalsIgnoreCase(""))?"":"\n\n"),LINE_SIZE,"\n",true)+WordUtils.wrap(lockedreason,LINE_SIZE,"\n"+net.md_5.bungee.api.ChatColor.GRAY,true)).create()));
@ -520,11 +573,11 @@ public enum ArtifactAbility {
} }
} }
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem) { public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, Player p) {
return GenerateMenu(path,playerdmgval,targetitem,0); return GenerateMenu(path,playerdmgval,targetitem,0,p);
} }
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, int slot) { public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, int slot, Player p) {
TextComponent msg1 = new TextComponent("Choose an ability to upgrade "+((targetitem.hasItemMeta() && targetitem.getItemMeta().hasDisplayName())?targetitem.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(targetitem))+ChatColor.RESET+":\n\n"); TextComponent msg1 = new TextComponent("Choose an ability to upgrade "+((targetitem.hasItemMeta() && targetitem.getItemMeta().hasDisplayName())?targetitem.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(targetitem))+ChatColor.RESET+":\n\n");
int i=0; int i=0;
TextComponent text = new TextComponent(""); TextComponent text = new TextComponent("");
@ -536,98 +589,128 @@ public enum ArtifactAbility {
path==UpgradePath.FISHING_ROD || path==UpgradePath.FISHING_ROD ||
path==UpgradePath.SCYTHE || path==UpgradePath.SCYTHE ||
path==UpgradePath.BASIC) { path==UpgradePath.BASIC) {
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (path!=UpgradePath.BASIC) { if (path!=UpgradePath.BASIC) {
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(CRITICAL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(CRIT_DMG,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(HIGHWINDER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (path==UpgradePath.SWORD) { if (path==UpgradePath.SWORD) {
text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(COMBO,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else } else
if (path==UpgradePath.AXE) { if (path==UpgradePath.AXE) {
text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
//text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) {
text=DisplayAbility(DAMAGEPOOL,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESTACK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESUCK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HIGHDIVE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
}
} else } else
if (path==UpgradePath.FISHING_ROD) { if (path==UpgradePath.FISHING_ROD) {
} else } else
if (path==UpgradePath.BOW) { if (path==UpgradePath.BOW) {
text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(MARKSMAN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} /*text=DisplayAbility(SIEGESTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ARROWSHOWER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(TARGETING,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ENDERTURRET,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}*/
} else } else
if (path==UpgradePath.SCYTHE) { if (path==UpgradePath.SCYTHE) {
text=DisplayAbility(AOE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(AOE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(DEATHMARK,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} }
} }
} else } else
if (path==UpgradePath.ARMOR //Armor category. if (path==UpgradePath.ARMOR //Armor category.
) { ) {
text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(DAMAGE_REDUCTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(HEALTH,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(HEALTH_REGEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(STATUS_EFFECT_RESISTANCE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(STATUS_EFFECT_RESISTANCE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SHADOWWALKER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(SHADOWWALKER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(SURVIVOR,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(DODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(DODGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(GRACEFULDODGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else } else
if (path==UpgradePath.TOOL || //Tool category. if (path==UpgradePath.TOOL || //Tool category.
path==UpgradePath.SHOVEL || path==UpgradePath.SHOVEL ||
path==UpgradePath.PICKAXE path==UpgradePath.PICKAXE
) { ) {
text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(DAMAGE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ARMOR_PEN,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(EXECUTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (path==UpgradePath.SHOVEL) { if (path==UpgradePath.SHOVEL) {
text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(ERUPTION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(ERUPTION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(EARTHWAVE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else } else
if (path==UpgradePath.PICKAXE) { if (path==UpgradePath.PICKAXE) {
text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(SCAVENGE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) {
text=DisplayAbility(MINES,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(OREHARVESTER,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(IMPACT,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(FORCESTRIKE,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
}
} }
} }
text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(GREED,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
//text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
return msg1; return msg1;
} }
public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for. static String DisplayOreBonus(String oretype, String bonus) {
return ChatColor.LIGHT_PURPLE+oretype+": "+ChatColor.YELLOW+" "+bonus;
}
public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval, boolean pvp) { //Level to display information for.
String msg = ability.GetDescription(); String msg = ability.GetDescription();
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv))+ChatColor.RESET); msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[200VAL]", ChatColor.BLUE+df.format(200+calculateValue(ability,tier,abilitylv))+ChatColor.RESET); msg=msg.replace("[200VAL]", ChatColor.BLUE+df.format(200+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value. msg=msg.replace("[PENDMG]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv,pvp)/100*playerdmgval)+ChatColor.RESET); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[HUNGERVAL]", ChatColor.BLUE+df.format(10*abilitylv)+ChatColor.RESET); msg=msg.replace("[HUNGERVAL]", ChatColor.BLUE+df.format(10*abilitylv)+ChatColor.RESET);
msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET); msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET);
msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET); msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET);
msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET); msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET);
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((16-tier)*0.1d)+ChatColor.RESET); msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET);
msg=msg.replace("[ERUPTIONVAL]", ChatColor.BLUE+df.format(35+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[EARTHWAVEVAL]", ChatColor.BLUE+df.format(20+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[AOEVAL]", ChatColor.BLUE+df.format(1+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[POTVAL]", ChatColor.BLUE+df.format(5+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[GRACEFULVAL]", ChatColor.BLUE+df.format(0.1+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
msg=msg.replace("[FORCESTRIKEVAL]", ChatColor.BLUE+df.format(60+calculateValue(ability,tier,abilitylv,pvp))+ChatColor.RESET);
return msg; return msg;
} }
public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for. public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval, boolean pvp) { //Level to display information for.
String msg = ability.GetDescription(); String msg = ability.GetDescription();
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
msg=msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)),df.format(calculateValue(ability,tier,tolv)))); msg=msg.replace("[VAL]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv,pvp)),df.format(calculateValue(ability,tier,tolv,pvp))));
msg=msg.replace("[200VAL]", ChatColor.BLUE+DisplayChangedValue(df.format(200+calculateValue(ability,tier,fromlv)),df.format(200+calculateValue(ability,tier,tolv)))+ChatColor.RESET); msg=msg.replace("[200VAL]", ChatColor.BLUE+DisplayChangedValue(df.format(200+calculateValue(ability,tier,fromlv,pvp)),df.format(200+calculateValue(ability,tier,tolv,pvp)))+ChatColor.RESET);
msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value. msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv,pvp)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv,pvp)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value.
msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv))); msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv)));
msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv))); msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3)); msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3));
msg=msg.replace("[DODGEVAL]", df.format(tier)); msg=msg.replace("[DODGEVAL]", df.format(tier));
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((100d/tier))+ChatColor.RESET); msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET);
msg=msg.replace("[ERUPTIONVAL]", DisplayChangedValue(df.format(35+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(35+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
msg=msg.replace("[EARTHWAVEVAL]", DisplayChangedValue(df.format(20+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(20+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
msg=msg.replace("[AOEVAL]", DisplayChangedValue(df.format(1+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(1+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
msg=msg.replace("[POTVAL]", DisplayChangedValue(df.format(5+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(5+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
msg=msg.replace("[GRACEFULVAL]", DisplayChangedValue(df.format(0.1+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(0.1+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
msg=msg.replace("[FORCESTRIKEVAL]", DisplayChangedValue(df.format(60+calculateValue(ability,tier,fromlv,pvp))+ChatColor.RESET,df.format(60+calculateValue(ability,tier,tolv,pvp))+ChatColor.RESET));
return msg; return msg;
} }
@ -638,4 +721,23 @@ public enum ArtifactAbility {
return ChatColor.DARK_RED+""+ChatColor.STRIKETHROUGH+val1+ChatColor.RESET+ChatColor.RED+val2+ChatColor.DARK_RED+ChatColor.BOLD+"v"+ChatColor.RESET; return ChatColor.DARK_RED+""+ChatColor.STRIKETHROUGH+val1+ChatColor.RESET+ChatColor.RED+val2+ChatColor.DARK_RED+ChatColor.BOLD+"v"+ChatColor.RESET;
} }
public static double calculateValue(ArtifactAbility ab, int artifactTier, int enchantmentLevel, boolean pvp) {
double sum=0;
TwosideKeeper.log("Ability "+ab.GetName(), 4);
/*for(int i=0;i<abilitylevel;i++){
TwosideKeeper.log("Old Sum:"+sum+"::i:"+i, 5);
sum+=1d/(1d+(ability.GetDecayValue(artifacttier)*(double)i));
TwosideKeeper.log("New Sum:"+sum+"::i:"+i, 5);
}
TwosideKeeper.log("Sum is "+sum, 5);
TwosideKeeper.log("Base value is "+ability.GetBaseValue(artifacttier), 4);
return sum*ability.GetBaseValue(artifacttier);*/
//return Math.pow(ability.GetBaseValue(artifacttier)*abilitylevel, ability.GetDecayValue(artifacttier));
if (pvp) {
return ab.pvpval.getBaseValue() * Math.pow(ab.pvpval.getPointValue(),ab.GetDecayValue(15));
} else {
return ab.GetBaseValue(artifactTier) * Math.pow(enchantmentLevel, ab.GetDecayValue(artifactTier));
}
}
} }

View File

@ -15,5 +15,5 @@ public enum ArtifactItem {
DIVINE_CORE, DIVINE_CORE,
DIVINE_BASE, DIVINE_BASE,
MALLEABLE_BASE, MALLEABLE_BASE,
ARTIFACT_RECIPE ARTIFACT_RECIPE;
} }

View File

@ -491,6 +491,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 1); ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 1);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 1); ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 1);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -518,6 +519,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2); ouritem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 2);
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 2); ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 2);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 1);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -547,6 +549,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3); ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 3);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1); ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 2);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -580,6 +583,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4); ouritem.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1); ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 3);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -614,6 +618,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 2); ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 2);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 1); ouritem.addUnsafeEnchantment(Enchantment.LURE, 1);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 4);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -648,6 +653,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 3); ouritem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 3);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 2); ouritem.addUnsafeEnchantment(Enchantment.LURE, 2);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 5);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -683,6 +689,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 3); ouritem.addUnsafeEnchantment(Enchantment.LURE, 3);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 6);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -721,6 +728,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 4); ouritem.addUnsafeEnchantment(Enchantment.LURE, 4);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 8);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -758,6 +766,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1); ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 5); ouritem.addUnsafeEnchantment(Enchantment.LURE, 5);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 9);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {
@ -796,6 +805,7 @@ public enum ArtifactItemType {
ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2); ouritem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
if (upgrade==UpgradePath.FISHING_ROD) { if (upgrade==UpgradePath.FISHING_ROD) {
ouritem.addUnsafeEnchantment(Enchantment.LURE, 6); ouritem.addUnsafeEnchantment(Enchantment.LURE, 6);
ouritem.addUnsafeEnchantment(Enchantment.LUCK, 10);
} }
} }
if (upgrade==UpgradePath.ARMOR) { if (upgrade==UpgradePath.ARMOR) {

View File

@ -0,0 +1,31 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.io.File;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public enum Book {
BEGINNERSGUIDE("NewPlayerGuide.txt"),
COMMANDGUIDE("CommandGuide.txt"),
STRIKERGUIDE("StrikerGuide.txt"),
DEFENDERGUIDE("DefenderGuide.txt"),
RANGERGUIDE("RangerGuide.txt"),
SLAYERGUIDE("SlayerGuide.txt"),
BARBARIANGUIDE("BarbarianGuide.txt"),
SUMMONERGUIDE("SummonerGuide.txt"),
ADVENTURERGUIDE("AdventurerGuide.txt");
String fileLoc;
Book(String loc) {
this.fileLoc=loc;
}
public File getBookFile() {
return new File(TwosideKeeper.plugin.getDataFolder()+"/books/"+this.fileLoc);
}
public String getBookFilepath() {
return TwosideKeeper.plugin.getDataFolder()+"/books/"+this.fileLoc;
}
}

View File

@ -0,0 +1,21 @@
/*package sig.plugin.TwosideKeeper.HelperStructures.BotCommands;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class stats implements aPlugin.API.DiscordCommandExecutor{
@Override
public void run(String[] args) {
//args[0] is the command!
//TwosideKeeper.log("Length is "+args.length, 0);
if (args.length==2) {
Player p = Bukkit.getPlayer(args[1]);
if (p!=null && p.isOnline()) {
//TwosideKeeper.showP
}
}
}
}
*/

View File

@ -0,0 +1,81 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import sig.plugin.TwosideKeeper.Buff;
public enum BuffTemplate {
POISON("Poison","Poison",Color.YELLOW,ChatColor.YELLOW+"",false),
SHRAPNEL("SHRAPNEL","Shrapnel",Color.RED,ChatColor.RED+"",false),
WINDCHARGES("WINDCHARGE","Wind",Color.GRAY,"",true),
BLEEDING("BLEEDING","Bleed",Color.MAROON,ChatColor.DARK_RED+"",false),
REGENERATION("REGENERATION","Regeneration",Color.GREEN,ChatColor.GREEN+""+ChatColor.BOLD+"",true),
INFECTION("INFECTION","Infection",Color.GRAY,ChatColor.GRAY+"",false),
CRIPPLE("CRIPPLE","Cripple",Color.WHITE,ChatColor.WHITE+"",false),
DARKSUBMISSION("DARKSUBMISSION",ChatColor.GRAY+"Dark Submission"+ChatColor.RESET,Color.BLACK,ChatColor.BLACK+""+ChatColor.MAGIC+""+ChatColor.RESET,false),
CONFUSION("CONFUSION","Confusion",Color.PURPLE,ChatColor.DARK_PURPLE+""+ChatColor.RESET,false),
UNDYINGRAGE_COOLDOWN("COOLDOWN_UNDYING_RAGE","Undying Rage Cooldown",null,ChatColor.WHITE+"",true,true),
UNSTOPPABLETEAM_COOLDOWN("Unstoppable Team Unavailable","Unstoppable Team Unavailable",null,ChatColor.WHITE+"",true,true),
;
String keyName;
String displayName;
Color col;
String icon;
boolean isGoodBuff;
boolean permanentBuff;
boolean displayTimer;
public String getKeyName() {
return keyName;
}
public String getDisplayName() {
return displayName;
}
public Color getParticleColor() {
return col;
}
public String getIcon() {
return icon;
}
public boolean isGoodBuff() {
return isGoodBuff;
}
public boolean isPermanentBuff() {
return permanentBuff;
}
public boolean isDisplayTimer() {
return displayTimer;
}
BuffTemplate(String keyName, String displayName, Color particleColor, String icon, boolean isGoodBuff) {
this.keyName=keyName;
this.displayName=displayName;
this.col=particleColor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=false;
this.displayTimer=false;
}
BuffTemplate(String keyName, String displayName, Color particleColor, String icon, boolean isGoodBuff, boolean isPermanentBuff) {
this.keyName=keyName;
this.displayName=displayName;
this.col=particleColor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=isPermanentBuff;
this.displayTimer=false;
}
BuffTemplate(String keyName, String displayName, Color particleColor, String icon, boolean isGoodBuff, boolean isPermanentBuff, boolean displayTimer) {
this.keyName=keyName;
this.displayName=displayName;
this.col=particleColor;
this.icon=icon;
this.isGoodBuff=isGoodBuff;
this.permanentBuff=isPermanentBuff;
this.displayTimer=displayTimer;
}
//new Buff("Poison",20*20,Integer.parseInt(args[1]),Color.YELLOW,ChatColor.YELLOW+"",false)
}

View File

@ -0,0 +1,28 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.HelperStructures.Common.CastBarItem;
public class CastBar {
List<CastBarItem> castbaritems = new ArrayList<CastBarItem>();
public CastBar(CastBarItem...items) {
castbaritems = Arrays.asList(items);
while (castbaritems.size()<9) {
castbaritems.add(new CastBarItem(Material.AIR));
}
}
public void run(Player p) {
aPlugin.API.setSlot(p, 9);
for (int i=0;i<9;i++) {
aPlugin.API.setItem(p, p.getOpenInventory(), i, castbaritems.get(i).getItemStack());
}
}
}

View File

@ -0,0 +1,166 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarFlag;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Events.EntityChannelCastEvent;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class Channel {
LivingEntity l;
String channelName;
int duration;
long channelStartTime;
BossBar channelBar;
boolean cancelled=false;
public Channel(LivingEntity l, String spellName, int tickDuration) {
this.l=l;
this.channelName=spellName;
this.duration=tickDuration;
this.channelStartTime=TwosideKeeper.getServerTickTime();
if (l instanceof Player) {
Player p = (Player)l;
channelBar = l.getServer().createBossBar(ChatColor.YELLOW+channelName, BarColor.YELLOW, BarStyle.SOLID, BarFlag.CREATE_FOG);
channelBar.addPlayer(p);
UpdateBossBar();
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.currentChannel=this;
} else {
UpdateMobChannelingBar(l);
l.setCustomNameVisible(true);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.currentChannel=this;
}
GenericFunctions.addSuppressionTime(l, duration+5);
AddToStructure();
}
public static Channel createNewChannel(LivingEntity l, String spellName, int channelDuration){
return new Channel(l,spellName,channelDuration);
}
public static boolean isChanneling(LivingEntity l) {
if (l instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
return pd.currentChannel!=null;
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.currentChannel!=null;
}
}
public static void stopChanneling(LivingEntity l) {
if (isChanneling(l)) {
Channel c = getCurrentChannel(l);
c.setCancelled(true);
}
}
public static Channel getCurrentChannel(LivingEntity l) {
if (isChanneling(l)) {
if (l instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
return pd.currentChannel;
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.currentChannel;
}
} else {
return null;
}
}
private void AddToStructure() {
TwosideKeeper.channels.add(this);
}
private void UpdateMobChannelingBar(LivingEntity l) {
LivingEntityStructure.setChannelingBar(l, getMobChannelingBar());
}
private void UpdateBossBar() {
long tickTimeChanneled = TwosideKeeper.getServerTickTime()-channelStartTime;
double ratio = (double)tickTimeChanneled/duration;
channelBar.setProgress(ratio);
}
private String getMobChannelingBar() {
StringBuilder sb = new StringBuilder();
sb.append(ChatColor.YELLOW);
sb.append(channelName);
sb.append("[");
long tickTimeChanneled = TwosideKeeper.getServerTickTime()-channelStartTime;
double ratio = (double)tickTimeChanneled/duration;
int bars = (int)(ratio*10);
for (int i=0;i<bars;i++) {
sb.append("");
}
for (int i=0;i<10-bars;i++) {
sb.append("-");
}
sb.append("]");
sb.append(ChatColor.RESET);
return sb.toString();
}
public void setCancelled(boolean isCancelled) {
cancelled=isCancelled;
LivingEntityStructure.setChannelingBar(l, "");
if (channelBar!=null) {
channelBar.removeAll();
}
}
public String getSpellName() {
return channelName;
}
public LivingEntity getLivingEntity() {
return l;
}
public boolean runTick() {
if (l==null || !l.isValid() || cancelled) {
return false;
}
if (channelStartTime+duration<TwosideKeeper.getServerTickTime()) {
if (channelBar!=null) {
channelBar.removeAll();
} else {
LivingEntityStructure.setChannelingBar(l, "");
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
if (les.suffix_bar.length()==0 && les.prefix.length()>0) {
l.setCustomNameVisible(false);
}
}
if (l instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)l);
pd.currentChannel=null;
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.currentChannel=null;
}
EntityChannelCastEvent ev = new EntityChannelCastEvent(l,channelName);
Bukkit.getPluginManager().callEvent(ev);
return false;
} else {
if (channelBar!=null) {
UpdateBossBar();
} else {
UpdateMobChannelingBar(l);
LivingEntityStructure.UpdateMobName(l);
}
return true;
}
}
}

View File

@ -0,0 +1,207 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MathUtils;
public class ArmorStandProperties {
final public static ArmorStandProperties SCEPTERBASE = new ArmorStandProperties();
final public static ArmorStandProperties SCEPTERTOP = new ArmorStandProperties();
boolean arms = false;
boolean baseplate = false;
EulerAngle bodyPose = EulerAngle.ZERO;
ItemStack boots = new ItemStack(Material.AIR);
ItemStack chestplate = new ItemStack(Material.AIR);
EulerAngle headPose = EulerAngle.ZERO;
ItemStack helmet = new ItemStack(Material.AIR);
ItemStack hand = new ItemStack(Material.AIR);
EulerAngle leftArmPose = EulerAngle.ZERO;
EulerAngle leftLegPose = EulerAngle.ZERO;
ItemStack leggings = new ItemStack(Material.AIR);
boolean marker = false;
EulerAngle rightArmPose = EulerAngle.ZERO;
EulerAngle rightLegPose = EulerAngle.ZERO;
boolean small = false;
boolean visible=true;
boolean customNameVisible=false;
String customName="";
Vector offset = new Vector();
public ArmorStandProperties() {
}
public boolean isArms() {
return arms;
}
public void setArms(boolean arms) {
this.arms = arms;
}
public boolean isBaseplate() {
return baseplate;
}
public void setBaseplate(boolean baseplate) {
this.baseplate = baseplate;
}
public EulerAngle getBodyPose() {
return bodyPose;
}
public void setBodyPose(EulerAngle bodyPose) {
this.bodyPose = bodyPose;
}
public ItemStack getBoots() {
return boots;
}
public void setBoots(ItemStack boots) {
this.boots = boots;
}
public ItemStack getChestplate() {
return chestplate;
}
public void setChestplate(ItemStack chestplate) {
this.chestplate = chestplate;
}
public EulerAngle getHeadPose() {
return headPose;
}
public void setHeadPose(EulerAngle headPose) {
this.headPose = headPose;
}
public ItemStack getHelmet() {
return helmet;
}
public void setHelmet(ItemStack helmet) {
this.helmet = helmet;
}
public ItemStack getHand() {
return hand;
}
public void setHand(ItemStack hand) {
this.hand = hand;
}
public EulerAngle getLeftArmPose() {
return leftArmPose;
}
public void setLeftArmPose(EulerAngle leftArmPose) {
this.leftArmPose = leftArmPose;
}
public EulerAngle getLeftLegPose() {
return leftLegPose;
}
public void setLeftLegPose(EulerAngle leftLegPose) {
this.leftLegPose = leftLegPose;
}
public ItemStack getLeggings() {
return leggings;
}
public void setLeggings(ItemStack leggings) {
this.leggings = leggings;
}
public boolean isMarker() {
return marker;
}
public void setMarker(boolean marker) {
this.marker = marker;
}
public EulerAngle getRightArmPose() {
return rightArmPose;
}
public void setRightArmPose(EulerAngle rightArmPose) {
this.rightArmPose = rightArmPose;
}
public boolean isSmall() {
return small;
}
public void setSmall(boolean small) {
this.small = small;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public boolean isCustomNameVisible() {
return customNameVisible;
}
public void setCustomNameVisible(boolean customNameVisible) {
this.customNameVisible = customNameVisible;
}
public String getCustomName() {
return customName;
}
public void setCustomName(String customName) {
this.customName = customName;
}
public EulerAngle getRightLegPose() {
return rightLegPose;
}
public void setRightLegPose(EulerAngle rightLegPose) {
this.rightLegPose = rightLegPose;
}
public Vector getOffset() {
return offset;
}
public void setOffset(Vector offset) {
this.offset = offset;
}
public static void defineAllModels() {
SetupScepterBase();
SetupScepterTop();
}
private static void SetupScepterTop() {
SCEPTERTOP.rightArmPose = MathUtils.getEulerAngleDegrees(-90, 0, 0);
SCEPTERTOP.hand = new ItemStack(Material.DOUBLE_PLANT);
SCEPTERTOP.offset = new Vector(-0.7,0,0.1);
}
private static void SetupScepterBase() {
SCEPTERBASE.rightArmPose = MathUtils.getEulerAngleDegrees(-90, 90, 0);
SCEPTERBASE.small = true;
SCEPTERBASE.hand = new ItemStack(Material.BONE);
}
}

View File

@ -0,0 +1,83 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.Dropper;
import org.bukkit.block.Hopper;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import net.md_5.bungee.api.ChatColor;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class BaublePouch {
public final static String POUCHID_LINE = ChatColor.DARK_GREEN+"POUCH#";
public static boolean isBaublePouch(ItemStack item) {
return (ItemUtils.isValidItem(item) &&
ItemUtils.LoreContainsSubstring(item, POUCHID_LINE));
}
public static Location getBaublePouchLoc(int id) {
int posx = id % 960;
int posy = 66; //Hoppers are at 64. So these cannot be directly above them as the items will get sucked in.
int posz = id / 960;
return new Location(Bukkit.getWorld("FilterCube"),posx,posy,posz);
}
public static Block getBaublePouchBlock(int id) {
Block b = Bukkit.getWorld("FilterCube").getBlockAt(getBaublePouchLoc(id));
return b;
}
public static Dropper getBaublePouchDropper(int id) {
Dropper h = (Dropper)Bukkit.getWorld("FilterCube").getBlockAt(getBaublePouchLoc(id)).getState();
return h;
}
public static void createNewBaublePouch(int id) {
Block b = getBaublePouchBlock(id);
b.getWorld().getBlockAt(getBaublePouchLoc(id)).setType(Material.DROPPER);
}
public static int getBaublePouchID(ItemStack item) {
if (isBaublePouch(item)) {
String id = ItemUtils.GetLoreLineContainingSubstring(item, POUCHID_LINE).split("#")[1];
return Integer.parseInt(id);
} else {
return -1;
}
}
public static HashMap<Integer,ItemStack> insertItemsIntoBaublePouch(int id, ItemStack...items) {
Dropper d = getBaublePouchDropper(id);
Inventory inv = d.getInventory();
return inv.addItem(items);
}
public static void openBaublePouch(Player p, ItemStack item) {
if (isBaublePouch(item)) {
int id = getBaublePouchID(item);
Dropper d = getBaublePouchDropper(id);
d.getChunk().load();
GenericFunctions.renameDropper(d, ChatColor.stripColor(((ItemUtils.hasDisplayName(item))?ItemUtils.getDisplayName(item):"Bauble Pouch #"+id)));
p.openInventory(d.getInventory());
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_LEATHER, 1.0f, 1.0f);
} else {
p.sendMessage(ChatColor.RED+"Could not open Bauble Pouch! Please let the admin know this did not work.");
}
}
public static List<ItemStack> getBaublePouchContents(int id) {
List<ItemStack> itemlist = new ArrayList<ItemStack>();
Dropper d = getBaublePouchDropper(id);
Inventory inv = d.getInventory();
for (ItemStack item : inv.getContents()) {
if (ItemUtils.isValidItem(item)) {
itemlist.add(item);
}
}
return itemlist;
}
}

View File

@ -0,0 +1,63 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class BlockModifyQueue{
Material checktype; //The material the block should be before converting.
Material finaltype; //The material the block is converting into.
byte checkdata; //Data the block should be before converting.
byte finaldata; //Data the block should be after converting.
boolean usedata=false;
Block b; //The block we are converting.
public BlockModifyQueue(Block b, Material checktype, Material finaltype) {
this.b=b;
this.checktype=checktype;
this.finaltype=finaltype;
this.checkdata=0;
this.finaldata=0;
this.usedata=false;
}
public BlockModifyQueue(Block b, Material checktype, byte checkdata, Material finaltype, byte finaldata) {
this.b=b;
this.checktype=checktype;
this.finaltype=finaltype;
this.checkdata=checkdata;
this.finaldata=finaldata;
this.usedata=true;
}
public void run() {
if ((TypeException(b) || b.getType()==checktype) && (!usedata || b.getData()==checkdata)) {
b.setType(finaltype);
//TwosideKeeper.log("Set Type from Requested "+checktype+" to "+finaltype, 0);
if (usedata) {b.setData(finaldata);}
}
}
public Block getBlock() {
return b;
}
private boolean TypeException(Block b) {
if (b.getType()==Material.STATIONARY_LAVA || b.getType()==Material.LAVA ||
b.getType()==Material.STATIONARY_WATER || b.getType()==Material.WATER) {
return true;
} else {
return false;
}
}
public static void Cleanup(List<BlockModifyQueue> queue) {
for (BlockModifyQueue bmq: queue) {
bmq.run();
}
}
}

View File

@ -0,0 +1,158 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
public class Camera {
//ArmorStand camera_ent;
double degrees=0;
HashMap<UUID,Location> camera_viewerlocs = new HashMap<UUID,Location>();
Chunk startingchunk;
Location startedat;
public Camera(Location startingloc,Player...viewers) {
startingchunk = startingloc.getChunk();
startedat=startingloc.clone();
TwosideKeeper.temporary_chunks.add(startingchunk);
startingchunk.load();
for (Player p : viewers) {
AddCameraViewer(p);
}
}
public boolean containsViewer(Player p) {
return (camera_viewerlocs.containsKey(p.getUniqueId()));
}
public void AddCameraViewer(Player p) {
camera_viewerlocs.put(p.getUniqueId(), p.getLocation().clone());
//TwosideKeeper.log("Set starting loc of "+p.getName()+" to "+camera_viewerlocs.get(p.getUniqueId()), 1);
p.setGameMode(GameMode.SPECTATOR);
p.setSpectatorTarget(null);
}
public Location getStartingLoc(Player p) {
if (containsViewer(p)) {
return camera_viewerlocs.get(p.getUniqueId());
} else {
return null;
}
}
public void removeCameraViewer(Player p) {
if (camera_viewerlocs.containsKey(p.getUniqueId())) {
p.setSpectatorTarget(null);
p.setGameMode(GameMode.SURVIVAL);
p.teleport(camera_viewerlocs.get(p.getUniqueId()));
//TwosideKeeper.log("Teleporting player "+p.getName()+" to "+camera_viewerlocs.get(p.getUniqueId()), 1);
camera_viewerlocs.remove(p.getUniqueId());
}
}
public boolean runTick() {
if (camera_viewerlocs.size()==0) {
return false;
}
for (UUID id : camera_viewerlocs.keySet()) {
Player p = Bukkit.getPlayer(id);
if (p!=null && p.isValid()) {
p.setGameMode(GameMode.SPECTATOR);
if (p.getAllowFlight()) {p.setFlying(true);}
p.setSpectatorTarget(p);
} else {
TwosideKeeper.ScheduleRemoval(camera_viewerlocs, p);
}
//TwosideKeeper.log("offset: "+camera_ent.getLocation().subtract(startedat)+" || Player offset: "+p.getLocation().subtract(startedat), 0);
}
return true;
}
public void Cleanup() {
Cleanup(false);
}
public void Cleanup(boolean isShuttingDown) {
for (UUID id : camera_viewerlocs.keySet()) {
Player p = Bukkit.getPlayer(id);
if (p!=null && p.isValid()) {
p.setSpectatorTarget(null);
p.setGameMode(GameMode.SURVIVAL);
p.teleport(camera_viewerlocs.get(id));
if (!isShuttingDown) {
TwosideKeeper.ScheduleRemoval(camera_viewerlocs, p);
}
} else {
if (!isShuttingDown) {
TwosideKeeper.ScheduleRemoval(camera_viewerlocs, p);
}
}
}
if (!isShuttingDown) {
TwosideKeeper.temporary_chunks.remove(startingchunk);
}
removeAllCameraViewers();
}
private void removeAllCameraViewers() {
camera_viewerlocs.clear();
}
public void pointCameraToLocation(Location fromLoc, Location toLoc) {
//Points a camera to the target location.
if (fromLoc!=null && toLoc!=null && toLoc.getWorld().equals(fromLoc.getWorld())) {
Vector dir = MovementUtils.pointTowardsLocation(fromLoc, toLoc);
Location currloc = fromLoc.clone();
currloc.setDirection(dir);
teleportViewers(currloc);
}
}
private void teleportViewers(Location loc) {
for (UUID id : camera_viewerlocs.keySet()) {
Player p = Bukkit.getPlayer(id);
if (p!=null && p.isValid()) {
p.teleport(loc);
}
}
}
public void setCameraAroundCircle(double radius, double degrees, Location loc, double yoffset) {
double velx = Math.cos(Math.toRadians(degrees));
//double vely = Math.sin(Math.toRadians(degrees));
double velz = Math.sin(Math.toRadians(degrees));
Vector newvector = new Vector(-velx,0,-velz);
newvector.multiply(radius*2);
Location finalloc = loc.clone().add(newvector).add(0,yoffset,0);
//TwosideKeeper.log("offset: "+camera_ent.getLocation().subtract(startedat)+" -> "+finalloc.subtract(startedat),0);
//camera_ent.teleport(finalloc);
teleportViewers(finalloc);
pointCameraToLocation(finalloc,loc);
}
public void rotateAroundPoint(double spd, int duration, Location loc, double radius, double yoffset) {
duration--;
setCameraAroundCircle(radius,degrees,loc,yoffset);
degrees+=spd;
if (duration>0) {
final int dur = duration;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{rotateAroundPoint(spd,dur,loc,radius,yoffset);}, 1);
}
}
public void rotateAroundPointWithZoom(double spd, int duration, Location loc, double startzoom, double zoomspd, double maxzoom, double yoffset) {
duration--;
setCameraAroundCircle(startzoom,degrees,loc,yoffset);
degrees+=spd;
startzoom = Math.max(maxzoom,startzoom-zoomspd);
yoffset = Math.min(yoffset,startzoom);
if (duration>0) {
final int dur = duration;
final double zoom = startzoom;
final double y = yoffset;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{rotateAroundPointWithZoom(spd,dur,loc,zoom,zoomspd,maxzoom,y);}, 1);
}
}
}

View File

@ -0,0 +1,34 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class CastBarItem {
ItemStack item;
public CastBarItem(Material mat) {
this(mat,(short)0,1,null);
}
public CastBarItem(Material mat, short data, String displayName) {
this(mat,data,1,displayName);
}
public CastBarItem(Material mat, short data, int amt, String displayName) {
item = new ItemStack(mat,amt,data);
if (displayName!=null) {
ItemUtils.setDisplayName(item, displayName);
}
}
public CastBarItem(MaterialData matdata, String displayName) {
item = new ItemStack(matdata.getItemType(),1,matdata.getData());
}
public ItemStack getItemStack() {
return item;
}
}

View File

@ -8,6 +8,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -33,7 +34,7 @@ public class Habitation {
if (locationhashes.containsKey(hash)) { if (locationhashes.containsKey(hash)) {
int spawnamt = locationhashes.get(hash); int spawnamt = locationhashes.get(hash);
TwosideKeeper.log("[Habitat]Spawn Amount was "+spawnamt+". "+((0.5/(spawnamt+1))*100)+"% chance to fail.",4); TwosideKeeper.log("[Habitat]Spawn Amount was "+spawnamt+". "+((0.5/(spawnamt+1))*100)+"% chance to fail.",4);
if (Math.random()>(20/(spawnamt+1))) { if (Math.random()>(20/((spawnamt*2)+1))) {
TwosideKeeper.log("[Habitat]It failed.",4); TwosideKeeper.log("[Habitat]It failed.",4);
return false; return false;
} }
@ -45,7 +46,7 @@ public class Habitation {
return true; return true;
} }
public void addKillToLocation(LivingEntity l) { /*public void addKillToLocation(LivingEntity l) {
String hash = getLocationHash(l.getLocation()); String hash = getLocationHash(l.getLocation());
if (startinglocs.containsKey(l.getUniqueId())) { if (startinglocs.containsKey(l.getUniqueId())) {
hash = getLocationHash(startinglocs.get(l.getUniqueId())); hash = getLocationHash(startinglocs.get(l.getUniqueId()));
@ -54,9 +55,9 @@ public class Habitation {
int spawnamt = locationhashes.get(hash); int spawnamt = locationhashes.get(hash);
spawnamt+=1; spawnamt+=1;
locationhashes.put(hash,spawnamt); locationhashes.put(hash,spawnamt);
for (int x=-2;x<3;x++) { for (int x=-4;x<5;x++) {
for (int z=-2;z<3;z++) { for (int z=-4;z<5;z++) {
if (x!=0^z!=0) { if (x!=0 && z!=0) {
addKillToLocation(l.getLocation().add(x*16,0,z*16)); addKillToLocation(l.getLocation().add(x*16,0,z*16));
} }
} }
@ -66,6 +67,7 @@ public class Habitation {
locationhashes.put(hash,1); locationhashes.put(hash,1);
} }
} }
public void addKillToLocation(Location l) { public void addKillToLocation(Location l) {
String hash = getLocationHash(l); String hash = getLocationHash(l);
if (locationhashes.containsKey(hash)) { if (locationhashes.containsKey(hash)) {
@ -78,7 +80,31 @@ public class Habitation {
else { else {
locationhashes.put(hash,1); locationhashes.put(hash,1);
} }
} }*/
public void addKillToLocation(LivingEntity entityKilled) {
for (int offsetMeters = 0; offsetMeters < 64; offsetMeters += 4) {
// Attempt to add 1 habitat to a random chunk within offsetMeters of the death location
// Guaranteed to add at least 1 kill to the chunk that the killed entity was in.
addKillToLocation(getRandomLocationWithinCircle(
// Use entity source location, or death location if not available
startinglocs.getOrDefault(entityKilled.getUniqueId(), entityKilled.getLocation()),
offsetMeters));
}
}
public void addKillToLocation(Location location) {
String locationHash = getLocationHash(location);
//TwosideKeeper.log("Location hash is "+locationHash, 0);
locationhashes.put(locationHash, locationhashes.getOrDefault(locationHash, 0) + 1);
}
private Location getRandomLocationWithinCircle(Location sourceLocation, double radiusMultiplier) {
final double angle = 2 * Math.PI * ThreadLocalRandom.current().nextDouble();
final double temp = ThreadLocalRandom.current().nextDouble() + ThreadLocalRandom.current().nextDouble();
final double radius = temp > 1 ? radiusMultiplier * (2 - temp) : radiusMultiplier * temp;
return sourceLocation.clone().add(radius * Math.cos(angle), 0, radius * Math.sin(angle));
}
public void increaseHabitationLevels() { public void increaseHabitationLevels() {
for(String hash : locationhashes.keySet()) { for(String hash : locationhashes.keySet()) {
@ -105,14 +131,16 @@ public class Habitation {
} }
} }
public String getLocationHash(Location l) { public String getLocationHash(Location location) {
if (l!=null) { if (location != null) {
return (int)(l.getX()/16)+" "+(int)(l.getZ()/16); return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().getName();
} else { } else {
TwosideKeeper.log("[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!", 1); TwosideKeeper.log(
return ""; "[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!",
} 1);
} return "";
}
}
public void saveLocationHashesToConfig() { public void saveLocationHashesToConfig() {
File file = new File(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data"); File file = new File(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data");
@ -133,7 +161,9 @@ public class Habitation {
bw.write((String)locationhashes.keySet().toArray()[i]+","+locationhashes.get((String)locationhashes.keySet().toArray()[i])); bw.write((String)locationhashes.keySet().toArray()[i]+","+locationhashes.get((String)locationhashes.keySet().toArray()[i]));
bw.newLine(); bw.newLine();
} }
TwosideKeeper.log("[Habitat]Saved "+(locationhashes.keySet().toArray().length)+" habitats successfully.",2); if (locationhashes.keySet().toArray().length>0) {
TwosideKeeper.log("[Habitat]Saved "+(locationhashes.keySet().toArray().length)+" habitat"+((locationhashes.keySet().toArray().length)!=1?"s":"")+" successfully.",2);
}
bw.close(); bw.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -144,7 +174,6 @@ public class Habitation {
public void loadLocationHashesFromConfig() { public void loadLocationHashesFromConfig() {
File file = new File(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data"); File file = new File(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data");
// if file doesnt exists, then create it
if (file.exists()) { if (file.exists()) {
try( try(
FileReader fw = new FileReader(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data"); FileReader fw = new FileReader(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data");
@ -171,7 +200,6 @@ public class Habitation {
TwosideKeeper.log("[Habitat]Loaded "+lines+" habitats successfully.",2); TwosideKeeper.log("[Habitat]Loaded "+lines+" habitats successfully.",2);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
//exception handling left as an exercise for the reader
} }
} }
} }

View File

@ -0,0 +1,27 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import org.bukkit.inventory.ItemStack;
//An Itemstack not bound by the limitation of 128 or more items in a stack.
public class ItemContainer {
ItemStack item;
int amt;
public ItemContainer(ItemStack item) {
this.item=item.clone();
this.amt=this.item.getAmount();
this.item.setAmount(1);
}
public void setAmount(int amt) {
this.amt = amt;
}
public int getAmount() {
return this.amt;
}
public ItemStack getItem() {
return this.item;
}
}

View File

@ -0,0 +1,39 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.inventory.Recipe;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class JobRecipe {
String name = "";
Recipe rec;
public JobRecipe(String name, Recipe rec) {
this.name=name;
this.rec=rec;
}
public String getName() {
return name;
}
public String getCommandName() {
return name.replaceAll(" ", "_");
}
public Recipe getRecipe() {
return rec;
}
public static void InitializeJobRecipes() {
Map<String,Recipe> newrecipes = aPlugin.API.getAddedRecipes();
for (String namer : newrecipes.keySet()) {
TwosideKeeper.log("Added recipe: "+namer, 4);
Recipe r = newrecipes.get(namer);
TwosideKeeper.jobrecipes.add(new JobRecipe(namer,r));
}
}
}

View File

@ -0,0 +1,20 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
public class PVPValue {
int points; //Number of points in this value.
double baseval; //The base value of this ability.
public PVPValue(int points, double baseval) {
this.points=points;
this.baseval=baseval;
}
public int getPointValue() {
return points;
}
public double getBaseValue() {
return baseval;
}
}

View File

@ -28,14 +28,26 @@ public enum RecipeLinker {
eic(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Ender Item Cube",new ItemStack[]{ eic(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Ender Item Cube",new ItemStack[]{
CustomItem.EnderItemCube(), CustomItem.EnderItemCube(),
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
new ItemStack(Material.EMERALD),new ItemStack(Material.CHEST),new ItemStack(Material.EMERALD), new ItemStack(Material.EMERALD),new ItemStack(Material.ENDER_CHEST),new ItemStack(Material.EMERALD),
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
}), }),
vacuumcube(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Vacuum Cube",new ItemStack[]{
CustomItem.VacuumCube(),
new ItemStack(Material.DIAMOND_BLOCK),new ItemStack(Material.ELYTRA),new ItemStack(Material.DIAMOND_BLOCK),
new ItemStack(Material.DIAMOND_BLOCK),new ItemStack(Material.ENDER_CHEST),new ItemStack(Material.DIAMOND_BLOCK),
new ItemStack(Material.ENDER_PEARL),new ItemStack(Material.REDSTONE_BLOCK),new ItemStack(Material.ENDER_PEARL)
}),
filtercube(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Filter Cube",new ItemStack[]{
CustomItem.FilterCube(),
new ItemStack(Material.IRON_BLOCK),new ItemStack(Material.IRON_BLOCK),new ItemStack(Material.IRON_BLOCK),
new ItemStack(Material.DIAMOND_BLOCK),new ItemStack(Material.CHEST),new ItemStack(Material.DIAMOND_BLOCK),
new ItemStack(Material.DIAMOND_BLOCK),new ItemStack(Material.HOPPER),new ItemStack(Material.DIAMOND_BLOCK)
}),
dc(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Duplicate Ender Item Cube",new ItemStack[]{ dc(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Duplicate Ender Item Cube",new ItemStack[]{
CustomItem.EnderItemCube(2), CustomItem.EnderItemCube(2),
CustomItem.EnderItemCube(),new ItemStack(Material.NETHER_STAR) CustomItem.EnderItemCube(),new ItemStack(Material.NETHER_STAR)
}), }),
aq(RecipeCategory.MISC_ITEMS,ChatColor.RED,"Arrow Quiver",new ItemStack[]{ aq(RecipeCategory.CONTAINERS,ChatColor.RED,"Arrow Quiver",new ItemStack[]{
CustomItem.ArrowQuiver(), CustomItem.ArrowQuiver(),
null,new ItemStack(Material.LEATHER),new ItemStack(Material.EMERALD_BLOCK), null,new ItemStack(Material.LEATHER),new ItemStack(Material.EMERALD_BLOCK),
new ItemStack(Material.LEATHER),new ItemStack(Material.SPECTRAL_ARROW),new ItemStack(Material.LEATHER), new ItemStack(Material.LEATHER),new ItemStack(Material.SPECTRAL_ARROW),new ItemStack(Material.LEATHER),
@ -361,6 +373,22 @@ public enum RecipeLinker {
Recipes.getArrowFromMeta("PIERCING_ARR"), Recipes.getArrowFromMeta("PIERCING_ARR"),
new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1), new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1),new ItemStack(Material.REDSTONE,1),
new ItemStack(Material.REDSTONE,1),Recipes.getArrowFromMeta("DOUBLE_DAMAGE_ARR"), new ItemStack(Material.REDSTONE,1),Recipes.getArrowFromMeta("DOUBLE_DAMAGE_ARR"),
}),
worldshop(RecipeCategory.MISC_ITEMS,ChatColor.BLUE,"World Shop",new ItemStack[]{
CustomItem.WorldShop(),
new ItemStack(Material.CHEST,1),new ItemStack(Material.SIGN,1),null,
CustomItem.DirtSubstitute(),
}),
worldshop2(RecipeCategory.MISC_ITEMS,ChatColor.BLUE,"World Shop [Trapped Chest]",new ItemStack[]{
CustomItem.WorldShop2(),
new ItemStack(Material.TRAPPED_CHEST,1),new ItemStack(Material.SIGN,1),null,
CustomItem.DirtSubstitute(),
}),
baublepouch(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Bauble Pouch",new ItemStack[]{
CustomItem.BaublePouch(),
new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),
new ItemStack(Material.LEATHER),new ItemStack(Material.CHORUS_FLOWER),new ItemStack(Material.LEATHER),
new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),
}); });
String name = ""; String name = "";

View File

@ -1,5 +1,51 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public enum CubeType { public enum CubeType {
NORMAL,LARGE,ENDER NORMAL(0,9),LARGE(1,27),ENDER(2,27),VACUUM(3,54),FILTER(4,27);
int id=0;
int size=9;
private CubeType(int id, int size) {
this.id=id;
this.size=size;
}
public int getID() {
return this.id;
}
public int getSize() {
return this.size;
}
public static CubeType getCubeTypeFromID(int id) {
for (CubeType ct : CubeType.values()) {
if (ct.getID()==id) {
return ct;
}
}
TwosideKeeper.log("INVALID CUBE ID SPECIFIED: "+id+". THIS SHOULD NOT BE HAPPENING!", 0);
return null;
}
public static int getSlotsFromType(CubeType size) {
switch (size) {
case ENDER:
return 27;
case FILTER:
return 27;
case LARGE:
return 27;
case NORMAL:
return 9;
case VACUUM:
return 54;
default:
return 27;
}
}
} }

View File

@ -24,7 +24,9 @@ import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.Recipes; import sig.plugin.TwosideKeeper.Recipes;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class CustomItem { public class CustomItem {
ItemStack item; ItemStack item;
@ -48,6 +50,8 @@ public class CustomItem {
TwosideKeeper.LARGE_ITEM_CUBE_RECIPE = LargeItemCubeRecipe(); TwosideKeeper.LARGE_ITEM_CUBE_RECIPE = LargeItemCubeRecipe();
TwosideKeeper.ENDER_ITEM_CUBE_RECIPE = EnderItemCubeRecipe(); TwosideKeeper.ENDER_ITEM_CUBE_RECIPE = EnderItemCubeRecipe();
TwosideKeeper.DUPLICATE_ENDER_ITEM_CUBE_RECIPE = DuplicateEnderItemCubeRecipe(); TwosideKeeper.DUPLICATE_ENDER_ITEM_CUBE_RECIPE = DuplicateEnderItemCubeRecipe();
TwosideKeeper.VACUUM_CUBE_RECIPE = VacuumCubeRecipe();
TwosideKeeper.FILTER_CUBE_RECIPE = FilterCubeRecipe();
TwosideKeeper.ARROW_QUIVER_RECIPE = ArrowQuiverRecipe(); TwosideKeeper.ARROW_QUIVER_RECIPE = ArrowQuiverRecipe();
TwosideKeeper.HARDENED_IRON_HELMET_RECIPE = HardenedRecipe(Material.IRON_HELMET,Material.IRON_BLOCK,"aaa","axa","xxx"); TwosideKeeper.HARDENED_IRON_HELMET_RECIPE = HardenedRecipe(Material.IRON_HELMET,Material.IRON_BLOCK,"aaa","axa","xxx");
TwosideKeeper.HARDENED_IRON_CHESTPLATE_RECIPE = HardenedRecipe(Material.IRON_CHESTPLATE,Material.IRON_BLOCK,"axa","aaa","aaa"); TwosideKeeper.HARDENED_IRON_CHESTPLATE_RECIPE = HardenedRecipe(Material.IRON_CHESTPLATE,Material.IRON_BLOCK,"axa","aaa","aaa");
@ -111,6 +115,220 @@ public class CustomItem {
TwosideKeeper.EXPLODING_ARROW_RECIPE = ExplodingArrowRecipe(); TwosideKeeper.EXPLODING_ARROW_RECIPE = ExplodingArrowRecipe();
TwosideKeeper.POISON_ARROW_RECIPE = PoisonArrowRecipe(); TwosideKeeper.POISON_ARROW_RECIPE = PoisonArrowRecipe();
TwosideKeeper.PIERCING_ARROW_RECIPE = PiercingArrowRecipe(); TwosideKeeper.PIERCING_ARROW_RECIPE = PiercingArrowRecipe();
TwosideKeeper.WORLD_SHOP_RECIPE = WorldShopRecipe();
TwosideKeeper.WORLD_SHOP2_RECIPE = WorldShop2Recipe();
TwosideKeeper.BAUBLE_POUCH_RECIPE = BaublePouchRecipe();
}
private static ShapelessRecipe BaublePouchRecipe() {
ShapelessRecipe rec = new ShapelessRecipe(BaublePouch());
rec.addIngredient(4, Material.LEATHER);
rec.addIngredient(1, Material.CHORUS_FLOWER);
rec.addIngredient(4, Material.LEATHER);
return rec;
}
public static ItemStack DailyToken() {
ItemStack token = new ItemStack(Material.COMMAND_CHAIN);
ItemUtils.setDisplayName(token, ChatColor.GREEN+"Daily Challenge Token");
ItemUtils.addLore(token, ChatColor.AQUA+"Allows you to participate in a daily");
ItemUtils.addLore(token, ChatColor.AQUA+"challenge without waiting! Right-click");
ItemUtils.addLore(token, ChatColor.AQUA+"a daily challenge sign with this token");
ItemUtils.addLore(token, ChatColor.AQUA+"in hand to consume the token instead.");
token.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemUtils.hideEnchantments(token);
return token.clone();
}
public static ItemStack BattleToken() {
ItemStack token = new ItemStack(Material.COMMAND);
ItemUtils.setDisplayName(token, ChatColor.GRAY+"| "+ChatColor.DARK_RED+ChatColor.BOLD+"Battle Token"+ChatColor.RESET+ChatColor.GRAY+" |");
ItemUtils.addLore(token, ChatColor.GOLD+"Given to the fiercest of warriors in");
ItemUtils.addLore(token, ChatColor.GOLD+"the world. This token is a symbol of");
ItemUtils.addLore(token, ChatColor.GOLD+"recognition and can be used to obtain");
ItemUtils.addLore(token, ChatColor.GOLD+"special items exclusively from battling.");
token.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemUtils.hideEnchantments(token);
return token.clone();
}
public static boolean isBattleToken(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) &&
item.containsEnchantment(Enchantment.LUCK) &&
item.getType()==Material.COMMAND) {
return true;
} else {
return false;
}
}
public static boolean isDailyToken(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) &&
item.containsEnchantment(Enchantment.LUCK) &&
item.getType()==Material.COMMAND_CHAIN) {
return true;
} else {
return false;
}
}
public static ItemStack BaublePouch() {
ItemStack baublePouch = new ItemStack(Material.CHORUS_FLOWER);
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"A handy 9-slot pouch that");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"can hold Baubles of any");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"sort.");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"");
ItemUtils.addLore(baublePouch, BaublePouch.POUCHID_LINE+"0");
ItemUtils.setDisplayName(baublePouch, ChatColor.GREEN+"Bauble Pouch");
baublePouch.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemUtils.hideEnchantments(baublePouch);
return baublePouch.clone();
}
public static ItemStack VacuumCube() {
ItemStack item_VacuumCube = new ItemStack(Material.ENDER_CHEST);
List<String> item_VacuumCube_lore = new ArrayList<String>();
item_VacuumCube_lore.add("A storage container that sucks");
item_VacuumCube_lore.add("up blocks. Holds 54 block stacks.");
item_VacuumCube_lore.add(ChatColor.GRAY+"Block Collection: "+ChatColor.GREEN+"ON");
ItemMeta item_ItemCube_meta=item_VacuumCube.getItemMeta();
item_ItemCube_meta.setLore(item_VacuumCube_lore);
item_ItemCube_meta.setDisplayName(ChatColor.BLUE+""+ChatColor.BOLD+"Vacuum Cube");
item_VacuumCube.setItemMeta(item_ItemCube_meta);
return item_VacuumCube.clone();
}
public static ItemStack IronMaterialKit() {
ItemStack kit = new ItemStack(Material.IRON_BLOCK);
ItemUtils.setDisplayName(kit, ChatColor.translateAlternateColorCodes('§', "§7§lIron Material Kit"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Converts an item's base material"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7to §rIron§7 and hardens it."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§eIncreases Breaks Remaining."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Right-click an item on a pedestal to use."));
kit.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
ItemUtils.addFlag(kit, ItemFlag.HIDE_ENCHANTS);
return kit.clone();
}
public static ItemStack DiamondMaterialKit() {
ItemStack kit = new ItemStack(Material.DIAMOND_BLOCK);
ItemUtils.setDisplayName(kit, ChatColor.translateAlternateColorCodes('§', "§b§lDiamond Material Kit"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Converts an item's base material"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7to §bDiamond§7."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§aApplies Unbreaking and Mending."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Right-click an item on a pedestal to use."));
kit.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
ItemUtils.addFlag(kit, ItemFlag.HIDE_ENCHANTS);
return kit.clone();
}
public static ItemStack GoldMaterialKit() {
ItemStack kit = new ItemStack(Material.GOLD_BLOCK);
ItemUtils.setDisplayName(kit, ChatColor.translateAlternateColorCodes('§', "§e§lGold Material Kit"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Converts an item's base material"));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7to §eGold§7."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§cMay degrade the item."));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', ""));
ItemUtils.addLore(kit, ChatColor.translateAlternateColorCodes('§', "§7Right-click an item on a pedestal to use."));
kit.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
ItemUtils.addFlag(kit, ItemFlag.HIDE_ENCHANTS);
return kit.clone();
}
private static ShapelessRecipe VacuumCubeRecipe() {
ItemStack item_VacuumCube = VacuumCube();
ShapelessRecipe ItemCube = new ShapelessRecipe(item_VacuumCube);
ItemCube.addIngredient(Material.ENDER_CHEST);
ItemCube.addIngredient(Material.ENDER_PEARL);
ItemCube.addIngredient(Material.ENDER_PEARL);
ItemCube.addIngredient(Material.ELYTRA);
ItemCube.addIngredient(4,Material.DIAMOND_BLOCK);
ItemCube.addIngredient(Material.REDSTONE_BLOCK);
return ItemCube;
}
private static ShapelessRecipe FilterCubeRecipe() {
ItemStack item_FilterCube = FilterCube();
ShapelessRecipe FilterCube = new ShapelessRecipe(item_FilterCube);
FilterCube.addIngredient(Material.CHEST);
FilterCube.addIngredient(Material.HOPPER);
FilterCube.addIngredient(4,Material.DIAMOND_BLOCK);
FilterCube.addIngredient(3,Material.IRON_BLOCK);
return FilterCube;
}
public static ItemStack FilterCube() {
ItemStack item_FilterCube = new ItemStack(Material.HOPPER_MINECART);
List<String> item_FilterCube_lore = new ArrayList<String>();
item_FilterCube_lore.add("A storage container that holds up");
item_FilterCube_lore.add("to 27 items. Shift-Right click to");
item_FilterCube_lore.add("open up a filtered item list.");
ItemMeta item_FilterCube_meta=item_FilterCube.getItemMeta();
item_FilterCube_meta.setLore(item_FilterCube_lore);
item_FilterCube_meta.setDisplayName(ChatColor.GREEN+""+ChatColor.BOLD+"Filter Cube");
item_FilterCube.setItemMeta(item_FilterCube_meta);
return item_FilterCube.clone();
}
private static ShapelessRecipe WorldShopRecipe() {
ItemStack item_worldShop = WorldShop();
ShapelessRecipe recipe_Worldshop = new ShapelessRecipe(item_worldShop);
recipe_Worldshop.addIngredient(Material.CHEST);
recipe_Worldshop.addIngredient(Material.SIGN);
recipe_Worldshop.addIngredient(Material.DIRT);
return recipe_Worldshop;
}
private static ShapelessRecipe WorldShop2Recipe() {
ItemStack item_worldShop = WorldShop2();
ShapelessRecipe recipe_Worldshop = new ShapelessRecipe(item_worldShop);
recipe_Worldshop.addIngredient(Material.TRAPPED_CHEST);
recipe_Worldshop.addIngredient(Material.SIGN);
recipe_Worldshop.addIngredient(Material.DIRT);
return recipe_Worldshop;
}
public static ItemStack DirtSubstitute() {
ItemStack dirtSub = new ItemStack(Material.DIRT);
ItemUtils.addLore(dirtSub, "You can substitute the dirt block");
ItemUtils.addLore(dirtSub, "with any block to create any type");
ItemUtils.addLore(dirtSub, "of World Shop!");
return dirtSub;
}
public static ItemStack WorldShop() {
ItemStack worldShop = new ItemStack(Material.CHEST);
List<String> worldShopLore = new ArrayList<String>();
worldShopLore.add("You can substitute the dirt block");
worldShopLore.add("with any block to create any type");
worldShopLore.add("of World Shop!");
ItemMeta item_ItemCube_meta=worldShop.getItemMeta();
item_ItemCube_meta.setLore(worldShopLore);
item_ItemCube_meta.setDisplayName("Placeable World Shop");
worldShop.setItemMeta(item_ItemCube_meta);
return worldShop.clone();
}
public static ItemStack WorldShop2() {
ItemStack worldShop = new ItemStack(Material.TRAPPED_CHEST);
List<String> worldShopLore = new ArrayList<String>();
worldShopLore.add("You can substitute the dirt block");
worldShopLore.add("with any block to create any type");
worldShopLore.add("of World Shop!");
ItemMeta item_ItemCube_meta=worldShop.getItemMeta();
item_ItemCube_meta.setLore(worldShopLore);
item_ItemCube_meta.setDisplayName("Placeable World Shop");
worldShop.setItemMeta(item_ItemCube_meta);
return worldShop.clone();
} }
private static ShapelessRecipe PiercingArrowRecipe() { private static ShapelessRecipe PiercingArrowRecipe() {
@ -368,7 +586,6 @@ public class CustomItem {
ArrowQuiver.setIngredient('l', Material.LEATHER); ArrowQuiver.setIngredient('l', Material.LEATHER);
ArrowQuiver.setIngredient('e', Material.EMERALD_BLOCK); ArrowQuiver.setIngredient('e', Material.EMERALD_BLOCK);
return ArrowQuiver; return ArrowQuiver;
} }
@ -473,4 +690,18 @@ public class CustomItem {
return item_ItemCube.clone(); return item_ItemCube.clone();
} }
public static boolean isVacuumCube(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) && ItemUtils.LoreContains(item, "A storage container that sucks")) {
return true;
}
return false;
}
public static boolean isFilterCube(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) && ItemUtils.LoreContains(item, "open up a filtered item list.")) {
return true;
}
return false;
}
} }

View File

@ -0,0 +1,55 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArmorStandProperties;
public class CustomModel {
List<ArmorStandProperties> modelParts = new ArrayList<ArmorStandProperties>();
List<ArmorStand> stands = new ArrayList<ArmorStand>();
public CustomModel(Location loc, ArmorStandProperties...modelParts) {
for (ArmorStandProperties asp : modelParts) {
this.modelParts.add(asp);
this.stands.add(setupArmorStand(loc, asp));
}
}
private ArmorStand setupArmorStand(Location loc, ArmorStandProperties asp) {
ArmorStand stand = (ArmorStand)loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
stand.setArms(asp.isArms());
stand.setBasePlate(asp.isBaseplate());
stand.setBodyPose(asp.getBodyPose());
stand.setBoots(asp.getBoots());
stand.setChestplate(asp.getChestplate());
stand.setHeadPose(asp.getHeadPose());
stand.setHelmet(asp.getHelmet());
stand.setItemInHand(asp.getHand());
stand.setLeftArmPose(asp.getLeftArmPose());
stand.setLeftLegPose(asp.getLeftLegPose());
stand.setLeggings(asp.getLeggings());
stand.setMarker(asp.isMarker());
stand.setRightArmPose(asp.getRightArmPose());
stand.setRightLegPose(asp.getRightLegPose());
stand.setSmall(asp.isSmall());
stand.setVisible(asp.isVisible());
stand.setCustomNameVisible(asp.isCustomNameVisible());
stand.setCustomName(asp.getCustomName());
stand.teleport(loc.add(asp.getOffset()));
return stand;
}
public void displayModel(Location loc) {
for (int i=0;i<stands.size();i++) {
if (stands.get(i)!=null && stands.get(i).isValid()) {
stands.get(i).teleport(loc.add(modelParts.get(i).getOffset()));
}
}
}
}

View File

@ -87,11 +87,11 @@ public enum CustomRecipe {
ItemStack newitem = null; ItemStack newitem = null;
ItemStack netherstar = null; ItemStack netherstar = null;
for (int i=1;i<10;i++) { for (int i=1;i<10;i++) {
if (ev.getInventory().getItem(i)!=null && if ((ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR && ev.getInventory().getItem(i).getType()!=Material.AIR &&
(ev.getInventory().getItem(i).getType()==Material.ENDER_CHEST)) { (ev.getInventory().getItem(i).getType()==Material.ENDER_CHEST)) && !CustomItem.isVacuumCube(ev.getInventory().getItem(i))) {
ItemMeta inventory_itemMeta1=ev.getInventory().getItem(i).getItemMeta(); ItemMeta inventory_itemMeta1=ev.getInventory().getItem(i).getItemMeta();
if (inventory_itemMeta1.hasLore() && inventory_itemMeta1.getLore().size()==4) { if (inventory_itemMeta1.hasLore() && inventory_itemMeta1.getLore().size()>=4) {
String loreitem = inventory_itemMeta1.getLore().get(3); String loreitem = inventory_itemMeta1.getLore().get(3);
if (loreitem!=null && loreitem.contains(ChatColor.DARK_PURPLE+"ID#")) { if (loreitem!=null && loreitem.contains(ChatColor.DARK_PURPLE+"ID#")) {
//log("This is an Item Cube. Invalidate recipe.",4); //log("This is an Item Cube. Invalidate recipe.",4);

View File

@ -0,0 +1,46 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
public class DamageLabel{
ArmorStand aec;
double spd;
int duration;
public DamageLabel(ArmorStand aec, double spd, int duration) {
this.aec=aec;
this.spd=spd;
this.duration=duration;
}
public boolean run() {
if (aec.isValid()) {
duration--;
/*if (duration>0) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, new CloudRunnableRemoveLabel(aec.getLocation().add(0,spd,0).clone(),aec.getCustomName(),spd,duration), 1);
}*/
aec.teleport(aec.getLocation().add(0,spd,0));
if (duration<0) {
aec.remove();
return false;
}
return true;
} else {
return false;
}
}
public void cleanup() {
aec.remove();
}
}

View File

@ -0,0 +1,29 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.CustomDamage;
public class DamageStructure {
double damage;
Entity damager;
LivingEntity target;
ItemStack weapon;
String reason;
int flags;
public DamageStructure(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason, int flags) {
this.damage=damage;
this.damager=damager;
this.target=target;
this.weapon=weapon;
this.reason=reason;
this.flags=flags;
}
public void run() {
CustomDamage.ApplyDamage(damage, damager, target, weapon, reason, flags);
}
}

View File

@ -0,0 +1,65 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class DarkSlash extends WindSlash{
final static int EFFECT_DENSITY = 10;
final static Particle EFFECT_PARTICLE = Particle.ENCHANTMENT_TABLE;
final static float SPEED_MULT = 2.5f;
public DarkSlash(Location loc, LivingEntity l, MixedDamage dmg, int tick_duration) {
super(loc, l, dmg, tick_duration);
}
public boolean runTick() {
if (!moveWindSlash()) {
return false;
}
createParticles();
damageNearbyTargets();
if (TwosideKeeper.getServerTickTime()>death_time) {
return false;
}
return true;
}
protected void createParticles() {
//loc.getWorld().spawnParticle(Particle.END_ROD, loc.clone().add(0,-SLASH_SIZE/2,0), 4);
for (int i=0;i<EFFECT_DENSITY;i++) {
Location randloc = loc.clone();
loc.getWorld().spawnParticle(EFFECT_PARTICLE, randloc.add(randloc.getDirection().setY(randloc.getDirection().getY()*2).multiply(Math.random())).clone().add(0,-SLASH_SIZE/2,0), 1);
}
//loc.getWorld().playEffect(loc.clone().add(0,-SLASH_SIZE/2,0), Effect.DRAGON_BREATH, 4);
//loc.getWorld().playEffect(loc.clone().add(0,-SLASH_SIZE/2,0), Effect.COLOURED_DUST, 20);
Location baseloc = loc.clone();
final int density=100;
final int height=30;
for (int j=0;j<density;j++) {
for (int i=0;i<height;i++) {
ColoredParticle.RED_DUST.send(baseloc.clone().add(0,-SLASH_SIZE/2,0).add(0,(2d/height)*i,0)
, 20, 0, 0, 255);
}
baseloc.add(baseloc.getDirection().multiply(SPEED_MULT/density));
}
}
private void damageNearbyTargets() {
//GenericFunctions.DealDamageToNearbyMobs(loc, dmg, SLASH_SIZE, false, 0, sourcep, sourcep.getEquipment().getItemInMainHand(), false, "Dark Slash");
GenericFunctions.DealDamageToNearbyPlayers(loc, dmg.getDmgComponent(), SLASH_SIZE, false, true, 0, l, "Dark Slash", false, false);
if (dmg.getTruePctDmgComponent()>0) {GenericFunctions.DealDamageToNearbyPlayers(loc, dmg.getTruePctDmgComponent(), SLASH_SIZE, false, true, 0, l, "Dark Slash", false, true);}
if (dmg.getTrueDmgComponent()>0) {GenericFunctions.DealDamageToNearbyPlayers(loc, dmg.getTrueDmgComponent(), SLASH_SIZE, false, true, 0, l, "Dark Slash", true, false);}
}
}

View File

@ -0,0 +1,86 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.PVP;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class EarthWaveTask implements Runnable{
Location centerpoint;
int radius;
double vel;
double dmg;
Player damager;
public EarthWaveTask(Location center, int radius, double vel, double dmg, Player damager) {
this.centerpoint=center;
this.radius=radius;
this.vel=vel;
this.dmg=dmg;
this.damager=damager;
}
@Override
public void run() {
if (!damager.isDead()) {
for (int x=-radius;x<=radius;x++) { //Start at the top y.
Block b = centerpoint.getBlock().getRelative(x, 0, -radius);
if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) {
FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData());
fb.setVelocity(new Vector(0,vel,0));
b.setType(Material.AIR);
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg*2, 2, true, vel/1.5d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
} else {
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 0.1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg, 2, true, vel/4d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
}
}
for (int x=-radius;x<=radius;x++) { //Start at the top y.
Block b = centerpoint.getBlock().getRelative(x, 0, radius);
if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) {
FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData());
fb.setVelocity(new Vector(0,vel,0));
b.setType(Material.AIR);
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg*2, 2, true, vel/1.5d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
} else {
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 0.1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg, 2, true, vel/4d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
}
}
for (int y=-radius+1;y<radius;y++) { //Start at the top y.
Block b = centerpoint.getBlock().getRelative(radius, 0, y);
if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) {
FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData());
fb.setVelocity(new Vector(0,vel,0));
b.setType(Material.AIR);
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg*2, 2, true, vel/1.5d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
} else {
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 0.1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg, 2, true, vel/4d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
}
}
for (int y=-radius+1;y<radius;y++) { //Start at the top y.
Block b = centerpoint.getBlock().getRelative(-radius, 0, y);
if (GenericFunctions.isSoftBlock(b) && b.getRelative(0, 1, 0).getType()==Material.AIR && !PVP.isPvPing(damager)) {
FallingBlock fb = centerpoint.getWorld().spawnFallingBlock(b.getLocation().add(0,0,0), b.getType(), b.getData());
fb.setVelocity(new Vector(0,vel,0));
b.setType(Material.AIR);
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg*2, 2, true, vel/1.5d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
} else {
aPlugin.API.sendSoundlessExplosion(b.getLocation().add(0,1,0), 0.1f);
GenericFunctions.DealDamageToNearbyMobs(b.getLocation(), dmg, 2, true, vel/4d, damager, damager.getEquipment().getItemInMainHand(), false, "Earth Wave");
}
}
}
}
}

View File

@ -0,0 +1,35 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Color;
import org.bukkit.Location;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
public class EffectPool {
double radius = 1;
Color col = null;
Location loc = null;
long expireTime=0;
final int PARTICLE_DENSITY = 5;
public EffectPool(Location loc, double radius, int duration, Color col) {
this.loc=loc.clone();
this.radius=radius;
this.col=col;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
TwosideKeeper.effectpools.add(this);
}
public boolean runTick() {
int density = (int)Math.pow(PARTICLE_DENSITY, radius);
for (int i=0;i<density;i++) {
Location particleloc = loc.clone().add(
(Math.random()*(radius+1))-radius,
0.66,
(Math.random()*(radius+1))-radius
);
ColoredParticle.RED_DUST.send(particleloc, 50, col.getRed(), col.getGreen(), col.getBlue());
}
return !(expireTime<=TwosideKeeper.getServerTickTime());
}
}

View File

@ -0,0 +1,67 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ParticleEffect;
public class HighlightCircle {
final Particle PARTICLE = Particle.BLOCK_DUST;
final int PARTICLE_DENSITY = 16;
final int ANGLE_OFFSET = 10;
Location center = null;
double r = 0;
double h = 0;
long expireTime = 0;
/**
* Creates a cylinder zone that will be outline by particles.
* @param l The centered location of the zone.
* @param radius The radius of the zone.
* @param height The height of the zone.
* @param duration The amount of time in ticks the zone will exist.
*/
public HighlightCircle(Location l, double radius, double height, int duration) {
this.center=l.clone();
this.r=radius;
this.h=height;
this.expireTime=TwosideKeeper.getServerTickTime()+duration;
TwosideKeeper.circles.add(this);
}
public Location getCenter() {
return center;
}
public double getRadius() {
return r;
}
public double getHeight() {
return h;
}
public boolean hasExpired() {
return expireTime<TwosideKeeper.getServerTickTime();
}
public boolean runTick() {
for (int j=0;j<h;j++) {
for (int i=0;i<PARTICLE_DENSITY;i++) {
double angle = ((1d/PARTICLE_DENSITY)*360d)*i+(ANGLE_OFFSET*j);
double xamt = Math.sin(Math.toRadians(angle))*r;
double zamt = Math.cos(Math.toRadians(angle))*r;
Location particleloc = center.clone().add(new Location(center.getWorld(),
xamt,
j,
zamt)
);
//TwosideKeeper.log("Location: "+particleloc, 0);
ParticleEffect.CRIT.display(new Vector(0,0,0), 0f, particleloc, 50);
}
}
return !hasExpired();
}
}

View File

@ -0,0 +1,144 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.entity.SmallFireball;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import net.minecraft.server.v1_9_R1.EnumParticle;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class LavaPlume {
FallingBlock fb;
int lavayreached;
int delaytimer;
Location lavaplumeloc;
List<TemporaryLava> lavablocks;
boolean negativevel=false;
boolean state1=true,state2=true,state3=true,state4=true;
/**
*
* @param delay Delay in ticks.
*/
public LavaPlume(int delay, Location loc) {
//this.fb=fb;
this.lavablocks=new ArrayList<TemporaryLava>();
//this.lavayreached=fb.getLocation().getBlockY();
this.delaytimer=(int)((delay/20d)*4);
this.lavaplumeloc = loc.clone().add(0,1,0);
}
/*
* Returns false if this block is invalid.
*/
public boolean runTick() {
if (this.delaytimer>=0) {
this.delaytimer--;
if (this.delaytimer!=0) {
aPluginAPIWrapper.sendParticle(this.lavaplumeloc.clone().add(0,Math.random()*5,0), EnumParticle.DRIP_LAVA, (float)Math.random(),(float)Math.random(),(float)Math.random(), (float)Math.random(), 10);
} else {
FallingBlock fallblock = this.lavaplumeloc.clone().getWorld().spawnFallingBlock(this.lavaplumeloc.clone().add(0,1,0), Material.REDSTONE_BLOCK, (byte)0);
fallblock.setMetadata("DESTROY", new FixedMetadataValue(TwosideKeeper.plugin,true));
fallblock.setVelocity(new Vector(0,(float)((Math.random()*2)+1),0));
fallblock.setDropItem(false);
for (Player pl : Bukkit.getOnlinePlayers()) {
GlowAPI.setGlowing(fallblock, GlowAPI.Color.YELLOW, pl);
}
this.fb = fallblock;
this.lavayreached = this.lavaplumeloc.getBlockY();
return RunLavaTick();
}
return true;
}
else {
return RunLavaTick();
}
}
private boolean RunLavaTick() {
for (TemporaryLava tl : lavablocks) {
if (!tl.runTick()) {
TwosideKeeper.ScheduleRemoval(lavablocks, tl);
}
}
if (fb==null || !fb.isValid()) {
//Load up the chunk and see if we can remove it.
if (this.lavablocks.size()>0) {
return true;
} else {
//Cleared for official deleting.
if (!fb.isValid()) {
fb.remove();
}
return false;
}
} else {
if (fb.getLocation().getY()>lavayreached) {
int tickdelay=0;
for (int y=lavayreached;y<fb.getLocation().getY();y++) {
//Set the 4 blocks around it to lava.
List<Block> blocklist = new ArrayList<Block>();
int rely = (int)(y-fb.getLocation().getY());
if (state1 && !UpdateLavaBlock(fb.getLocation().add(1,rely,0).getBlock(),tickdelay)) {state1=false;}
if (state2 && !UpdateLavaBlock(fb.getLocation().add(-1,rely,0).getBlock(),tickdelay)) {state2=false;}
if (state3 && !UpdateLavaBlock(fb.getLocation().add(0,rely,1).getBlock(),tickdelay)) {state3=false;}
if (state4 && !UpdateLavaBlock(fb.getLocation().add(0,rely,-1).getBlock(),tickdelay)) {state4=false;}
tickdelay++;
}
lavayreached=(int)fb.getLocation().getY();
} else
if (fb.getVelocity().getY()<0) {
fb.remove();
}
return true;
}
}
private boolean UpdateLavaBlock(Block lavamod,int tickdelay) {
if (lavamod.getType()==Material.AIR || lavamod.getType()==Material.LAVA) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (lavamod.getType()==Material.AIR) {
lavamod.setType(Material.LAVA);
lavamod.setData((byte)8);
//TwosideKeeper.blockqueue.add(new BlockModifyQueue(lavamod,Material.AIR,(byte)0,Material.LAVA,(byte)8));
}
},tickdelay);
this.lavablocks.add(new TemporaryLava(lavamod,(int)(3*fb.getVelocity().getY())+6));
if (Math.random()<=0.1) {
SoundUtils.playGlobalSound(lavamod.getLocation(), Sound.ENTITY_BLAZE_SHOOT, 0.6f, 0.6f);
SmallFireball sf = (SmallFireball)fb.getWorld().spawnEntity(lavamod.getLocation(), EntityType.SMALL_FIREBALL);
sf.setDirection(new Vector(Math.random()-0.5,-Math.random()*0.5,Math.random()-0.5));
sf.setVelocity(new Vector(Math.random()-0.5,-Math.random()*0.5,Math.random()-0.5));
}
SoundUtils.playGlobalSound(fb.getLocation(), Sound.BLOCK_LAVA_POP, 1.0f, 1.0f);
return true;
} else {
//TwosideKeeper.log("Triggered for type "+lavamod.getType(), 0);
return false;
}
}
public void Cleanup() {
//Delete the falling block associated with itself.
if (fb!=null) {
fb.remove();
}
//Delete all Temporary Lava associated with this lava plume.
for (TemporaryLava tl : lavablocks) {
tl.Cleanup();
}
}
}

View File

@ -0,0 +1,33 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Material;
import org.bukkit.block.Block;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class ReplaceBlockTask implements Runnable{
String str;
public ReplaceBlockTask(String str) {
this.str=str;
}
@Override
public void run() {
if (TwosideKeeper.temporaryblocks.containsKey(str)) {
TemporaryBlock tb = TwosideKeeper.temporaryblocks.get(str);
CleanupTemporaryBlock(tb);
TwosideKeeper.temporaryblocks.remove(TemporaryBlock.getLocationKey(tb));
TwosideKeeper.temporaryblocks.remove(TemporaryBlock.getLocationKey(tb, false));
}
}
public static void CleanupTemporaryBlock(TemporaryBlock tb) {
if (tb.getBlock()!=null /*&&
tb.getBlock().getType()==tb.getConvertedMaterial() &&
tb.getBlock().getData()==tb.getConvertedData()*/) {
tb.getBlock().setType(tb.getOriginalMaterial());
tb.getBlock().setData(tb.getOriginalData());
}
}
}

View File

@ -0,0 +1,260 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.APIUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
public class TemporaryBlock {
Material origmat;
Material convertedmat;
byte origdata;
byte converteddata;
int duration;
String specialKey;
Block bl;
public Material getOriginalMaterial() {
return origmat;
}
public Material getConvertedMaterial() {
return convertedmat;
}
public byte getOriginalData() {
return origdata;
}
public byte getConvertedData() {
return converteddata;
}
public String getSpecialKey() {
return specialKey;
}
public Block getBlock() {
return bl;
}
public TemporaryBlock(Block b, Material convertedmat, int duration) {
this.origmat = b.getType();
this.convertedmat = convertedmat;
this.origdata = b.getData();
this.converteddata = b.getData();
this.duration = duration;
this.specialKey = "";
this.bl=b;
Block tempblock = getBlockToModify(b);
if (tempblock!=null) {
modifyBlock(this.bl);
}
setupStructureAndScheduler();
}
public TemporaryBlock(Block b, Material convertedmat, byte converteddata, int duration) {
this.origmat = b.getType();
this.convertedmat = convertedmat;
this.origdata = b.getData();
this.converteddata = converteddata;
this.duration = duration;
this.specialKey = "";
this.bl=b;
Block tempblock = getBlockToModify(b);
if (tempblock!=null) {
this.bl = tempblock;
modifyBlock(this.bl);
}
setupStructureAndScheduler();
}
public TemporaryBlock(Block b, Material convertedmat, byte converteddata, int duration, String specialKey) {
this.origmat = b.getType();
this.convertedmat = convertedmat;
this.origdata = b.getData();
this.converteddata = converteddata;
this.duration = duration;
this.specialKey = specialKey;
this.bl=b;
Block tempblock = getBlockToModify(b);
if (tempblock!=null) {
this.bl = tempblock;
modifyBlock(this.bl);
}
setupStructureAndScheduler();
}
private void modifyBlock(Block b) {
if (b!=null && !APIUtils.isExplosionProof(b)) {
b.setType(convertedmat);
b.setData(converteddata);
}
}
private void setupStructureAndScheduler() {
if (bl!=null) {
if (!TwosideKeeper.temporaryblocks.containsKey(getLocationKey(bl))) {
AddToTemporaryBlockStructure(this);
}
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,
new ReplaceBlockTask(getLocationKey(this)),
duration);
//TwosideKeeper.log(TextUtils.outputHashmap(TwosideKeeper.temporaryblocks),0);
}
}
private static void AddToTemporaryBlockStructure(TemporaryBlock tb) {
if (tb.getSpecialKey().length()>0) {
TwosideKeeper.temporaryblocks.put(getLocationKey(tb), tb);
}
TwosideKeeper.temporaryblocks.put(getLocationKey(tb,false), tb);
}
private static String getLocationKey(Block bl) {
return getLocationKey(bl, "");
}
public static String getLocationKey(TemporaryBlock tb) {
return tb.getLocationKey(tb.getBlock(), tb.getSpecialKey());
}
public static String getLocationKey(TemporaryBlock tb, boolean includeSpecialKey) {
return tb.getLocationKey(tb.getBlock(), (includeSpecialKey)?tb.getSpecialKey():"");
}
private static String getLocationKey(Block bl, String specialKey) {
if (bl!=null) {
StringBuilder sb = new StringBuilder(Integer.toString(bl.getLocation().getBlockX()));
sb.append("_");
sb.append(Integer.toString(bl.getLocation().getBlockY()));
sb.append("_");
sb.append(Integer.toString(bl.getLocation().getBlockZ()));
sb.append("_");
sb.append(bl.getLocation().getWorld().getName());
sb.append("_");
sb.append(specialKey);
//TwosideKeeper.log("Checking key: "+sb.toString(), 0);
return sb.toString();
} else {
return "";
}
}
private Block getBlockToModify(Block b) {
//Attempt to detect areas above and below ground to place this modified block.
int yoffset = 0;
while (yoffset<=5) {
Block checkblock = b.getRelative(0, yoffset, 0);
Block checkblock2 = b.getRelative(0, yoffset+1, 0);
if (checkblock!=null && checkblock2!=null) {
if ((checkblock.getType()==Material.AIR || checkblock.isLiquid() || checkblock.getType().isTransparent())) {
yoffset = adjustYOffset(yoffset);
//TwosideKeeper.log(Integer.toString(yoffset), 0);
} else {
if ((checkblock2.getType()==Material.AIR || checkblock2.isLiquid())) {
this.origmat = checkblock.getType();
this.origdata = checkblock.getData();
return b.getRelative(0, yoffset, 0);
} else {
yoffset = adjustYOffset(yoffset);
}
}
} else {
yoffset = adjustYOffset(yoffset);
}
}
return null;
}
private int adjustYOffset(int yoffset) {
yoffset=(yoffset>-5 && yoffset<=0)?(yoffset-1):(yoffset<0)?1:(yoffset+1);
return yoffset;
}
public String toString() {
StringBuilder sb = new StringBuilder("TemporaryBlock{");
sb.append("orig:(");sb.append(origmat);sb.append(",");sb.append(origdata);sb.append(")");
sb.append(",");
sb.append("converted:(");sb.append(convertedmat);sb.append(",");sb.append(converteddata);sb.append(")");
sb.append(",");
sb.append("duration:");sb.append(duration);
sb.append(",");
sb.append("key:");sb.append(specialKey);
sb.append(",");
sb.append("block:");sb.append(bl);
sb.append("}");
return sb.toString();
}
public static boolean isTemporaryBlock(Block b) {
return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
}
public static boolean isStandingOnSpecialBlock(Location l, String specialKey) {
//return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
Block b = l.getBlock().getRelative(0, -1, 0);
//TwosideKeeper.log(b.toString(), 0);
if (b!=null) {
return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b,specialKey));
} else {
return false;
}
}
public static boolean isInRangeOfSpecialBlock(Location l, double range, String specialKey) {
Block b = l.getBlock();
//TwosideKeeper.log(b.toString(), 0);
while (range-->0 && b.getLocation().getBlockY()>0) {
if (TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b,specialKey))) {
return true;
} else {
b = b.getRelative(0, -1, 0);
//TwosideKeeper.log(b.toString(), 0);
}
}
return false;
}
public static TemporaryBlock getTemporaryBlock(Block b) {
if (TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b))) {
return TwosideKeeper.temporaryblocks.get(TemporaryBlock.getLocationKey(b));
} else {
return null;
}
}
public static void createTemporaryBlockCircle(Location center, int radius, Material convertedmat, byte converteddata, int duration, String specialKey) {
int width=0;
for (int i=-radius;i<=radius;i++) {
Location offset = center.clone().add(0,0,i);
for (int j=-width;j<=width;j++) {
Block b = offset.getBlock().getRelative(j, 0, 0);
new TemporaryBlock(b, convertedmat, converteddata, duration, specialKey);
}
if (i<0) {
width++;
} else {
width--;
}
}
}
public static void createTemporaryBlockCircle(Location center, int radius, Material convertedmat, int duration, String specialKey) {
int width=0;
for (int i=-radius;i<=radius;i++) {
Location offset = center.clone().add(0,0,i);
for (int j=-width;j<=width;j++) {
Block b = offset.getBlock().getRelative(j, 0, 0);
new TemporaryBlock(b, convertedmat, duration);
}
if (i<0) {
width++;
} else {
width--;
}
}
}
}

View File

@ -0,0 +1,141 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.Buff;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class TemporaryBlockNode {
Location l;
double range;
int duration;
String specialKey;
Particle effect;
int particleDensity; //Number of particles per second.
long lastAppliedEffect=TwosideKeeper.getServerTickTime();
public TemporaryBlockNode(Location l, double range, int duration, String key) {
this.l=l;
this.range=range;
this.specialKey=key;
this.duration=duration;
this.effect=null;
this.particleDensity=0;
TwosideKeeper.blocknodes.add(this);
}
public TemporaryBlockNode(Location l, double range, int duration, String key, Particle effect, int density) {
this.l=l;
this.range=range;
this.specialKey=key;
this.duration=duration;
this.effect=effect;
this.particleDensity=density;
TwosideKeeper.blocknodes.add(this);
}
public boolean runTick() {
playParticleEffects();
affectEntitiesBasedOnKey();
duration-=5;
if (duration<0) {
return false;
} else {
return true;
}
}
private void affectEntitiesBasedOnKey() {
switch (specialKey) {
case "TESTNODE":{
for (Entity e : getNonPlayersOnNode()) {
if (e instanceof LivingEntity) {
CustomDamage.ApplyDamage(1, null, (LivingEntity)e, null, "Test Damage");
}
}
}break;
case "FIREPOOL":{
if (lastAppliedEffect+20<TwosideKeeper.getServerTickTime()) {
lastAppliedEffect = TwosideKeeper.getServerTickTime();
for (Entity e : getNonPlayersOnNode()) {
if (e instanceof LivingEntity) {
Buff.addBuff((LivingEntity)e, "BURN", new Buff("Burn",100,1,Color.ORANGE,ChatColor.GOLD+"",false),true);
}
}
}
}break;
}
}
private void playParticleEffects() {
if (effect!=null) {
for (int i=0;i<particleDensity/4;i++) {
SpawnParticleInRandomLocation();
}
if (Math.random()<=(particleDensity%20)*0.05) {
SpawnParticleInRandomLocation();
}
}
}
private void SpawnParticleInRandomLocation() {
l.getWorld().spawnParticle(effect, new Location(l.getWorld(),l.getX()+Math.random()*range-(Math.random()*(range*2))
,l.getY()+Math.random()*range-(Math.random()*(range*2))
,l.getZ()+Math.random()*range-(Math.random()*(range*2))), 2);
}
public Entity[] getEntitiesOnNode() {
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
return ents.toArray(new Entity[ents.size()]);
}
public List<Entity> getPlayersOnNode() {
long time = System.nanoTime();
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
List<Entity> list = new ArrayList<Entity>();
for (Entity e : ents) {
if (e instanceof Player) {
list.add(e);
}
}
TwosideKeeper.log("Calculation time via nearby entities: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
public List<Entity> getNonPlayersOnNode() {
long time = System.nanoTime();
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
List<Entity> list = new ArrayList<Entity>();
for (Entity e : ents) {
if (!(e instanceof Player)) {
list.add(e);
}
}
TwosideKeeper.log("Calculation time via nearby entities: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
@Deprecated
public List<Entity> getPlayersOnNodeViaDistanceSearch() {
long time = System.nanoTime();
List<Entity> list = new ArrayList<Entity>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getLocation().distance(l)<=range) {
list.add(p);
}
}
TwosideKeeper.log("Calculation time via distance search: "+(System.nanoTime()-time), TwosideKeeper.TIMINGS_DEBUG);
return list;
}
}

View File

@ -0,0 +1,86 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_9_R1.EnumParticle;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class TemporaryIce {
int lifetime=0;
Entity trappedEntity = null;
Block b;
public TemporaryIce(int life, Block b, Entity trappedent) {
this.lifetime=life;
this.trappedEntity = trappedent;
this.b=b;
if (this.trappedEntity instanceof LivingEntity) {
LivingEntity le = (LivingEntity)this.trappedEntity;
le.setVelocity(new Vector(0,0,0));
}
if (b.getType()==Material.AIR) {
b.setType(Material.PACKED_ICE);
}
}
public TemporaryIce(int life, Block b) {
this.lifetime=life;
this.trappedEntity = null;
this.b=b;
if (b.getType()==Material.AIR) {
b.setType(Material.PACKED_ICE);
}
}
public int getLifetime() {
return lifetime;
}
public Entity getTrappedEntity() {
return trappedEntity;
}
public Block getBlock() {
return b;
}
public boolean run() {
lifetime--;
if (b.getType()==Material.PACKED_ICE) {
aPluginAPIWrapper.sendParticle(b.getLocation(), EnumParticle.FIREWORKS_SPARK, 0, 1, 0, 1.2f, 3);
if (lifetime>10) {
aPlugin.API.sendBlockBreakPacket(b, 2);
} else
if (lifetime>5) {
aPlugin.API.sendBlockBreakPacket(b, 4);
} else
if (lifetime>0) {
aPlugin.API.sendBlockBreakPacket(b, 6);
}
}
if (lifetime<=0) {
Cleanup();
return false;
}
return true;
}
public void Cleanup() {
if (b.getType()==Material.PACKED_ICE) {
b.setType(Material.AIR);
SoundUtils.playGlobalSound(b.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.8f);
}
if (trappedEntity!=null && trappedEntity.isValid()) {
if (trappedEntity instanceof LivingEntity) {
LivingEntity le = (LivingEntity)trappedEntity;
le.setAI(true);
}
}
}
}

View File

@ -0,0 +1,47 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
public class TemporaryLava {
Block b;
int ttl; //Time-to-Live. When this expires it dies.
public TemporaryLava(Block b, int timer) {
this.b=b;
this.ttl=timer;
}
public TemporaryLava(Block b, int timer, boolean convert) {
if (convert) {
if (b.getType()==Material.AIR) {
b.setType(Material.LAVA);
b.setData((byte)8);
//TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,Material.LAVA));
}
}
this.b=b;
this.ttl=timer;
}
public boolean runTick() {
this.ttl--;
if (this.ttl<=0) {
ResetBlock();
return false;
} else {
return true;
}
}
private void ResetBlock() {
if (b.getType()==Material.LAVA || b.getType()==Material.STATIONARY_LAVA) {
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,b.getType(),Material.AIR));
}
}
public void Cleanup() {
ResetBlock();
}
}

View File

@ -0,0 +1,12 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.block.Block;
public class TemporarySnow {
Block b;
int lifetime;
public TemporarySnow(Block b,int lifetime) {
this.b=b;
this.lifetime=lifetime;
}
}

View File

@ -0,0 +1,86 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class WindSlash {
Location loc;
Player sourcep;
LivingEntity l;
MixedDamage dmg;
long lasteffect;
long death_time;
final static int EFFECT_DENSITY = 20;
final static int EFFECT_FREQUENCY = 4;
final static int SLASH_SIZE = 3; //Radius.
final static Particle EFFECT_PARTICLE = Particle.FIREWORKS_SPARK;
final static float SPEED_MULT = 3.5f;
public WindSlash(Location loc, Player p, double dmg, int tick_duration) {
this.loc=loc.clone().add(0,p.getEyeHeight(),0);
this.sourcep=p;
this.dmg=MixedDamage.v(dmg);
this.death_time = TwosideKeeper.getServerTickTime()+tick_duration;
this.lasteffect=TwosideKeeper.getServerTickTime();
SoundUtils.playGlobalSound(loc,Sound.BLOCK_PORTAL_TRIGGER, 0.2f, 2.0f);
}
public WindSlash(Location loc, LivingEntity l, MixedDamage dmg, int tick_duration) {
this.loc=loc.clone().add(0,l.getEyeHeight(),0);
this.l=l;
this.dmg=dmg;
this.death_time = TwosideKeeper.getServerTickTime()+tick_duration;
this.lasteffect=TwosideKeeper.getServerTickTime();
SoundUtils.playGlobalSound(loc,Sound.BLOCK_PORTAL_TRIGGER, 0.2f, 2.0f);
}
public boolean runTick() {
if (!moveWindSlash()) {
return false;
}
createParticles();
damageNearbyTargets();
if (TwosideKeeper.getServerTickTime()>death_time) {
return false;
}
return true;
}
private void damageNearbyTargets() {
GenericFunctions.DealDamageToNearbyMobs(loc, dmg.getDmgComponent(), SLASH_SIZE, false, 0, sourcep, sourcep.getEquipment().getItemInMainHand(), false, "Wind Slash");
}
protected boolean moveWindSlash() {
Location origloc = loc.clone();
Vector move = origloc.getDirection().setY(origloc.getDirection().getY()/1.4).multiply(SPEED_MULT);
float dist = SPEED_MULT;
loc.add(move);
SoundUtils.playGlobalSound(loc, Sound.ENTITY_PLAYER_ATTACK_NODAMAGE, 0.4f, 1.0f);
while (dist-->0) {
if (!BlockUtils.isPassThrough(origloc.add(origloc.getDirection()))) {
return false;
}
}
return true;
//TwosideKeeper.log("New Location: "+loc, 0);
}
protected void createParticles() {
loc.getWorld().spawnParticle(Particle.SWEEP_ATTACK, loc.clone().add(0,-SLASH_SIZE/2,0), 2);
for (int i=0;i<EFFECT_DENSITY;i++) {
Location randloc = loc.clone();
loc.getWorld().spawnParticle(EFFECT_PARTICLE, randloc.add(randloc.getDirection().setY(randloc.getDirection().getY()/1.4).multiply(Math.random())).clone().add(0,-SLASH_SIZE/2,0), 1);
}
}
}

View File

@ -25,10 +25,10 @@ public class EliteMonsterLocationFinder implements Runnable{
public void run() { public void run() {
TwosideKeeper.ELITE_LOCATION = GenericFunctions.defineNewEliteLocation(); TwosideKeeper.ELITE_LOCATION = GenericFunctions.defineNewEliteLocation();
if (TwosideKeeper.ELITE_LOCATION==null) { if (TwosideKeeper.ELITE_LOCATION==null) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 2l);
if (p!=null) { if (p!=null) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if ((pd.lastcompassnotification+(20*10))<TwosideKeeper.getServerTickTime()) { if ((pd.lastcompassnotification+(20*20))<TwosideKeeper.getServerTickTime()) {
pd.lastcompassnotification=TwosideKeeper.getServerTickTime(); pd.lastcompassnotification=TwosideKeeper.getServerTickTime();
p.sendMessage("The "+name+ChatColor.WHITE+" is still searching..."); p.sendMessage("The "+name+ChatColor.WHITE+" is still searching...");
} else { } else {
@ -42,7 +42,7 @@ public class EliteMonsterLocationFinder implements Runnable{
p.setCompassTarget(TwosideKeeper.ELITE_LOCATION); p.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
} }
Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE); Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE);
MonsterController.convertMonster(m, MonsterDifficulty.ELITE); MonsterController.convertLivingEntity(m, LivingEntityDifficulty.ELITE);
} }
} }

View File

@ -0,0 +1,63 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Hopper;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
public class FilterCubeItem {
public static void populateFilterCubeItemList(Player p) {
HashMap<Material, List<Integer>> structure = GrabFilterCubeStructure(p);
structure.clear();
for (ItemStack item : p.getInventory().getContents()) {
if (item!=null && CustomItem.isFilterCube(item)) {
Hopper h = ItemCubeUtils.getFilterCubeHopper(ItemCubeUtils.getItemCubeID(item));
for (ItemStack it : h.getInventory()) {
if (it!=null) {
int id = ItemCubeUtils.getItemCubeID(item);
if (structure.containsKey(it.getType())) {
List<Integer> filterCubes = structure.get(it.getType());
filterCubes.add(id);
} else {
List<Integer> filterCubeList = new ArrayList<Integer>();
filterCubeList.add(id);
structure.put(it.getType(), filterCubeList);
}
}
}
}
}
//TwosideKeeper.log("New Map: \n"+TextUtils.outputHashmap(structure), 0);
}
public static HashMap<Material, List<Integer>> GrabFilterCubeStructure(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
HashMap<Material,List<Integer>> structure = pd.filtercubestructure;
return structure;
}
public static boolean ItemHasFilterCube(ItemStack item, Player p) {
HashMap<Material, List<Integer>> structure = GrabFilterCubeStructure(p);
return structure.containsKey(item.getType());
}
public static List<Integer> getFilterCubeIDsToInsertItem(ItemStack item, Player p) {
HashMap<Material, List<Integer>> structure = GrabFilterCubeStructure(p);
if (structure.containsKey(item.getType())) {
return structure.get(item.getType());
} else {
return new ArrayList<Integer>();
}
}
}

View File

@ -1,11 +1,19 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.Arrays;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ItemCube { public class ItemCube {
public static boolean isSomeoneViewingItemCube(int id, Player checker) { public static boolean isSomeoneViewingItemCube(int id, Player checker) {
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
@ -23,8 +31,9 @@ public class ItemCube {
} }
public static Inventory getViewingItemCubeInventory(int id, Player checker) { public static Inventory getViewingItemCubeInventory(int id, Player checker) {
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
if (!p.equals(checker)) { if (checker==null || !p.equals(checker)) {
if (p.getOpenInventory()!=null && p.getOpenInventory().getTitle().contains("Item Cube #"+id)) { if (p.getOpenInventory()!=null && p.getOpenInventory().getTitle().contains("Item Cube #"+id)) {
//TwosideKeeper.log("Updating inventory for player "+p.getName()+"; Inventory "+p.getOpenInventory().getTitle(), 0);
//This is an item cube. Check if it's the same number. //This is an item cube. Check if it's the same number.
return p.getOpenInventory().getTopInventory(); return p.getOpenInventory().getTopInventory();
} }
@ -33,14 +42,43 @@ public class ItemCube {
return null; //Didn't find anything. return null; //Didn't find anything.
} }
public static void displayErrorMessage(Player p) { public static void displayErrorMessage(Player p) {
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 0.6f, 4.0f); SoundUtils.playLocalSound(p, Sound.BLOCK_NOTE_PLING, 0.6f, 4.0f);
p.sendMessage("Someone is currently using this Item Cube! Please wait for them to finish."); p.sendMessage("Someone is currently using this Item Cube! Please wait for them to finish.");
} }
public static void addToViewersOfItemCube(int idnumb, ItemStack cursor, Player check) { public static void addToViewersOfItemCube(int idnumb, ItemStack cursor, Player check) {
Inventory inv = getViewingItemCubeInventory(idnumb, check); Inventory inv = getViewingItemCubeInventory(idnumb, check);
if (inv!=null) { if (inv!=null && cursor!=null) {
//TwosideKeeper.log("Adding items "+cursor+" to Inventory "+inv.getTitle(), 0);
inv.addItem(cursor); inv.addItem(cursor);
} }
} }
public static void addToViewersOfItemCube(int idnumb, ItemStack[] cursor, Player check) {
Inventory inv = getViewingItemCubeInventory(idnumb, check);
cursor = InventoryUtils.RemoveAllNullItems(cursor);
if (inv!=null) {
//TwosideKeeper.log("Adding items "+Arrays.toString(cursor)+" to Inventory "+inv.getTitle(), 0);
inv.addItem(cursor);
}
}
public static void removeFromViewersofItemCube(int idnumb, ItemStack cursor, Player check) {
Inventory inv = getViewingItemCubeInventory(idnumb, check);
if (inv!=null && cursor!=null) {
inv.removeItem(cursor);
}
}
public static void removeFromViewersofItemCube(int idnumb, ItemStack[] cursor, Player check) {
Inventory inv = getViewingItemCubeInventory(idnumb, check);
cursor = InventoryUtils.RemoveAllNullItems(cursor);
if (inv!=null) {
inv.removeItem(cursor);
}
}
public static void clearFromViewersofItemCube(int id, Player check) {
Inventory inv = getViewingItemCubeInventory(id, check);
if (inv!=null) {
inv.clear();
}
}
} }

View File

@ -0,0 +1,170 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.PVP;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent;
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent.UpdateReason;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ItemPickupStructure {
PlayerPickupItemEvent ev;
public ItemPickupStructure(PlayerPickupItemEvent itemEvent) {
this.ev=itemEvent;
}
public void run() {
//Arrow quiver code goes here.
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerPickupItemEvent fired w/ "+ev.getItem().getItemStack(), 1);
if (ev.isCancelled()) {
return;
}
Player p = ev.getPlayer();
if (PVP.isPvPing(p)) {
ev.setCancelled(true);
return;
}
//log("Item Right now: "+ev.getItem().getItemStack(),0);
long time = System.nanoTime();
long totaltime = System.nanoTime();
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
InventoryUpdateEvent.TriggerUpdateInventoryEvent(p,ev.getItem().getItemStack(),UpdateReason.PICKEDUPITEM);
}, 1);
ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItem().getItemStack());
TwosideKeeper.PickupLogger.AddEntry("Fill Partial Slots First", (int)(System.nanoTime()-time));time=System.nanoTime();
//TwosideKeeper.log(" New Stack is: "+newstack,0);
if (newstack==null || newstack.getType()==Material.AIR) {
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
if (ev.getRemaining()>0) {
Item it = ev.getItem();
it.getItemStack().setAmount(ev.getRemaining());
//GenericFunctions.giveItem(p, it.getItemStack());
GenericFunctions.dropItem(it.getItemStack(), p.getLocation());
}
ev.getItem().remove();ev.setCancelled(true);return;}
TwosideKeeper.PickupLogger.AddEntry("Pickup Item when it's null", (int)(System.nanoTime()-time));time=System.nanoTime();
ev.getItem().setItemStack(newstack);
//log("Pickup Metadata: "+ev.getItem().getItemStack().getItemMeta().toString(),0);
//GenericFunctions.updateSetItems(p.getInventory());
GenericFunctions.UpdateItemLore(ev.getItem().getItemStack());
TwosideKeeper.PickupLogger.AddEntry("Update Item Lore", (int)(System.nanoTime()-time));time=System.nanoTime();
/*//LEGACY CODE
if (!ev.isCancelled()) {
if (ev.getItem().getItemStack().getType()==Material.ARROW &&
playerHasArrowQuiver(p)) {
int arrowquiver_slot = playerGetArrowQuiver(p);
playerInsertArrowQuiver(p, arrowquiver_slot, ev.getItem().getItemStack().getAmount());
log("Added "+ev.getItem().getItemStack().getAmount()+" arrow"+((ev.getItem().getItemStack().getAmount()==1)?"":"s")+" to quiver in slot "+arrowquiver_slot+". New amount: "+playerGetArrowQuiverAmt(p,arrowquiver_slot),4);
//If we added it here, we destroy the item stack.
p.sendMessage(ChatColor.DARK_GRAY+""+ev.getItem().getItemStack().getAmount()+" arrow"+((ev.getItem().getItemStack().getAmount()==1)?"":"s")+" "+((ev.getItem().getItemStack().getAmount()==1)?"was":"were")+" added to your arrow quiver. Arrow Count: "+ChatColor.GRAY+playerGetArrowQuiverAmt(p,arrowquiver_slot));
ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, 1.0f);
ev.getItem().remove();
ev.setCancelled(true);
}
}*/
TwosideKeeper.HandlePickupAchievements(ev.getPlayer(), ev.getItem().getItemStack());
TwosideKeeper.PickupLogger.AddEntry("Pickup Achievements", (int)(System.nanoTime()-time));time=System.nanoTime();
boolean handled = TwosideKeeper.AutoEquipItem(ev.getItem().getItemStack(), p);
TwosideKeeper.PickupLogger.AddEntry("Auto Equip Item Check", (int)(System.nanoTime()-time));time=System.nanoTime();
if (handled) {
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
ev.setCancelled(handled);
return;
}
/*if (AutoConsumeItem(p,ev.getItem().getItemStack())) {
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
ev.setCancelled(true);
return;
}*/
TwosideKeeper.PickupLogger.AddEntry("Auto Consume Item Check", (int)(System.nanoTime()-time));time=System.nanoTime();
if (ev.getItem().hasMetadata("INFINITEARROW")) { //Not allowed to be picked up, this was an infinite arrow.
TwosideKeeper.log("INFINITE PICKUP", 5);
ev.setCancelled(true);
return;
}
TwosideKeeper.PickupLogger.AddEntry("Infinite Arrow Check", (int)(System.nanoTime()-time));time=System.nanoTime();
if (GenericFunctions.isValidArrow(ev.getItem().getItemStack()) && ArrowQuiver.getArrowQuiverInPlayerInventory(p)!=null) {
ev.setCancelled(true);
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
TwosideKeeper.AddToPlayerInventory(ev.getItem().getItemStack(), p);
return;
}
TwosideKeeper.PickupLogger.AddEntry("Valid Arrow check", (int)(System.nanoTime()-time));time=System.nanoTime();
/**
* MUST BE HANDLED AFTER EVERYTHING ELSE.
*/
//TwosideKeeper.log("(1)Item is "+ev.getItem().getItemStack(), 0);
if (InventoryUtils.isCarryingFilterCube(p)) {
//Try to insert it into the Filter cube.
//TwosideKeeper.log("(2)Item is "+ev.getItem().getItemStack(), 0);
ItemStack[] remaining = InventoryUtils.insertItemsInFilterCube(p, ev.getItem().getItemStack());
//TwosideKeeper.log("(3)Item is "+ev.getItem().getItemStack(), 0);
if (remaining.length==0) {
ev.setCancelled(true);
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
return;
} else {
ev.getItem().setItemStack(remaining[0]);
}
}
TwosideKeeper.PickupLogger.AddEntry("Filter Cube Check", (int)(System.nanoTime()-time));time=System.nanoTime();
//TwosideKeeper.log("(1)Item is "+ev.getItem().getItemStack(), 0);
if (ev.getItem().getItemStack().getType().isBlock() && InventoryUtils.isCarryingVacuumCube(p)) {
//Try to insert it into the Vacuum cube.
ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, ev.getItem().getItemStack());
if (remaining.length==0) {
ev.setCancelled(true);
SoundUtils.playGlobalSound(ev.getPlayer().getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(ev.getItem().getItemStack()));
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
return;
} else {
ev.getItem().setItemStack(remaining[0]);
}
}
TwosideKeeper.PickupLogger.AddEntry("Vacuum Cube Check", (int)(System.nanoTime()-time));time=System.nanoTime();
//ItemCubeUtils.pickupAndAddItemCubeToGraph(ev.getItem().getItemStack(), p);
ev.setCancelled(true);
ItemStack givenitem = ev.getItem().getItemStack().clone();
GenericFunctions.giveItem(p, givenitem);
if (ev.getRemaining()>0) {
givenitem.setAmount(ev.getRemaining());
GenericFunctions.giveItem(p, givenitem);
}
TwosideKeeper.PlayPickupParticle(ev.getPlayer(),ev.getItem());
ev.getItem().remove();
ItemSet.updateItemSets(ev.getPlayer());
TwosideKeeper.PickupLogger.AddEntry("Update Item Sets", (int)(System.nanoTime()-time));time=System.nanoTime();
return;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public enum ItemSlot {
MAINHAND,
OFFHAND;
public ItemStack getItem(Player p) {
switch (this) {
case MAINHAND:
return p.getEquipment().getItemInMainHand();
case OFFHAND:
return p.getEquipment().getItemInOffHand();
default:
TwosideKeeper.log("WARNING! Could not find proper enum for this item slot! Slot: "+this, 0);
return p.getEquipment().getItemInMainHand();
}
}
public void setItem(Player p, ItemStack item) {
switch (this) {
case MAINHAND:
p.getEquipment().setItemInMainHand(item);
break;
case OFFHAND:
p.getEquipment().setItemInOffHand(item);
break;
default:
TwosideKeeper.log("WARNING! Could not find proper enum for this item slot! Slot: "+this, 0);
p.getEquipment().setItemInMainHand(item);
}
}
}

View File

@ -0,0 +1,19 @@
package sig.plugin.TwosideKeeper.HelperStructures.Items;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class Scepter {
ItemStack item;
public Scepter(ItemStack item) {
}
public static boolean isScepter(ItemStack item) {
return item.getType()==Material.BONE && (item.hasItemMeta() &&
item.getItemMeta().hasLore() &&
item.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE+"Summoner Gear"));
}
}

View File

@ -0,0 +1,415 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import aPlugin.API.Chests;
import net.md_5.bungee.api.ChatColor;
import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public enum LivingEntityDifficulty {
NORMAL(0,""),
DANGEROUS(500,ChatColor.DARK_AQUA+"Dangerous"),
DEADLY(1000,ChatColor.GOLD+"Deadly"),
HELLFIRE(5000,ChatColor.DARK_RED+"Hellfire"),
ELITE(10000,ChatColor.DARK_PURPLE+"Elite"),
END(6000,ChatColor.DARK_BLUE+""+ChatColor.MAGIC+"End"),
T1_MINIBOSS(9000,ChatColor.GOLD+""+ChatColor.BOLD+"T1"+ChatColor.RESET),
T2_MINIBOSS(9010,ChatColor.GOLD+""+ChatColor.BOLD+"T2"+ChatColor.RESET),
T3_MINIBOSS(9020,ChatColor.GOLD+""+ChatColor.BOLD+"T3"+ChatColor.RESET);
int rating;
String difficultyString;
LivingEntityDifficulty(int rating,String diffString) {
this.rating=rating;
this.difficultyString=diffString;
}
public String getDifficultyString() {
return difficultyString;
}
/*private ItemStack Artifact() {
sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3);
return null;
}*/
public int getRating() {
return rating;
}
/**
* Returns whether diff is stronger than the current difficulty. This is a numerical comparison,
* and so will always be accurate.
*/
public boolean isStronger(LivingEntityDifficulty diff) {
return (this.getRating()>diff.getRating());
}
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger, Entity damager, LivingEntity m) {
return RandomizeDrops(dropmult,isBoss,false,isRanger,damager,m);
}
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger, Entity damager, LivingEntity m) {
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty(m);
TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5);
List<ItemStack> droplist = new ArrayList<ItemStack>();
dropmult += 1; //Base dropmult is 1.0.
if (Math.random() < dropmult % 1)
{
dropmult++;
}
//Basically for each additional dropmult integer value, the
//amount of rolls increases. (A dropmult of 1.0 is required for
//an additional roll.)
Player p = (Player)CustomDamage.getDamagerEntity(damager);
for (int i=0;i<dropmult;i++) {
TwosideKeeper.Loot_Logger.AddLootRoll();
TwosideKeeper.log("Attempting a roll...", TwosideKeeper.LOOT_DEBUG);
ItemStack goodie = null;
if (Math.random()<=0.1 || isBoss) {
TwosideKeeper.log("Inside!", 5);
switch (diff) {
case DANGEROUS:{
goodie=aPlugin.API.Chests.LOOT_DANGEROUS.getSingleDrop(p);
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DANGEROUS, p);
}break;
case DEADLY:{
goodie=aPlugin.API.Chests.LOOT_DEADLY.getSingleDrop(p);
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DEADLY, p);
}break;
case HELLFIRE:{
goodie=aPlugin.API.Chests.LOOT_HELLFIRE.getSingleDrop(p);
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_HELLFIRE, p);
}break;
case END:{
goodie=aPlugin.API.Chests.LOOT_CUSTOM.getSingleDrop(p);
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_CUSTOM, p);
}break;
case ELITE:{
}break;
default:{
if (Math.random()<=0.4) {
goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop(p);
}
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, p);
}
}
TwosideKeeper.Loot_Logger.AddCommonLoot();
ModifyAndAddDropToList(droplist,goodie,damager);
}
}
TwosideKeeper.log("New Droplist: "+droplist.toString(), 5);
return droplist;
}
public void KeepRollingForBosses(boolean isBoss, List<ItemStack> droplist, ItemStack goodie, Chests chest, Player damager) {
int roll=0;
while (isBoss && !isValidSetItem(goodie) && roll<50) {
goodie=chest.getSingleDrop(damager);
ModifyAndAddDropToList(droplist,goodie,damager);
roll++;
TwosideKeeper.Loot_Logger.AddCommonLoot();
}
}
private void ModifyAndAddDropToList(List<ItemStack> droplist, ItemStack goodie, Entity damager) {
/*LivingEntity shooter = CustomDamage.getDamagerEntity(damager);
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (isValidSetItem(goodie)) {
if (Math.random()<0.8) {
//Convert it to a set piece.
PlayerMode pm = PlayerMode.getPlayerMode(p);
if (AllowedToConvert(pm,goodie)) {
ItemSet set = PickAnItemSet(pm,goodie);
goodie = ConvertSetPieceIfNecessary(goodie, set);
goodie = Loot.GenerateSetPiece(goodie.getType(), set, (Math.random()<0.1)?true:false, 0, false);
}
} else {
//Convert it to a mega piece.
PlayerMode pm = PlayerMode.getPlayerMode(p);
if (AllowedToConvert(pm,goodie)) {
goodie = Loot.GenerateMegaPiece(goodie.getType(), (Math.random()<0.1)?true:false);
}
}
}
}
TwosideKeeper.log("Adding item "+goodie, 2);*/ //LEGACY CODE.
if (damager.getWorld().getName().equalsIgnoreCase("world")) {
if (Artifact.isArtifact(goodie) && goodie.getType()==Material.MAGMA_CREAM) {
//This is a core, convert to essence.
switch (goodie.getEnchantmentLevel(Enchantment.LUCK)) {
case 1:{
goodie = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,goodie.getAmount());
}break;
case 2:{
goodie = Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE,goodie.getAmount());
}break;
case 3:{
goodie = Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE,goodie.getAmount());
}break;
case 4:{
goodie = Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE,goodie.getAmount());
}break;
default:{
goodie = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,goodie.getAmount());
}
}
}
} else {
if (Artifact.isArtifact(goodie) && goodie.getType()==Material.CLAY_BALL) {
//This is a core, convert to essence.
switch (goodie.getEnchantmentLevel(Enchantment.LUCK)) {
case 1:{
goodie = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE,goodie.getAmount());
}break;
case 2:{
goodie = Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE,goodie.getAmount());
}break;
case 3:{
goodie = Artifact.createArtifactItem(ArtifactItem.LOST_CORE,goodie.getAmount());
}break;
case 4:{
goodie = Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE,goodie.getAmount());
}break;
default:{
goodie = Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE,goodie.getAmount());
}
}
}
}
droplist.add(goodie);
}
@SuppressWarnings("unused")
private boolean AllowedToConvert(PlayerMode pm, ItemStack goodie) {
if (goodie.getType()==Material.SKULL_ITEM && pm!=PlayerMode.NORMAL && pm!=PlayerMode.SLAYER) {
goodie.setDurability((short)3);
SkullMeta sm = (SkullMeta)goodie.getItemMeta();
sm.setOwner(Bukkit.getOfflinePlayers()[(int)(Math.random()*Bukkit.getOfflinePlayers().length)].getName());
goodie.setItemMeta(sm);
return false;
}
return true;
}
public static ItemStack ConvertSetPieceIfNecessary(ItemStack goodie, ItemSet set) {
if ((set==ItemSet.JAMDAK ||
set==ItemSet.ALIKAHN ||
set==ItemSet.DARNYS ||
set==ItemSet.LORASAADI) &&
!goodie.getType().name().contains("LEATHER") &&
GenericFunctions.isArmor(goodie)) {
goodie.setType(Material.valueOf("LEATHER_"+goodie.getType().name().split("_")[1]));
} else
if (goodie.getType().name().contains("LEATHER") &&
!(set==ItemSet.JAMDAK ||
set==ItemSet.ALIKAHN ||
set==ItemSet.DARNYS ||
set==ItemSet.LORASAADI) &&
GenericFunctions.isArmor(goodie)) {
goodie.setType(Material.valueOf("IRON_"+goodie.getType().name().split("_")[1]));
} else
if (goodie.getType()!=Material.SKULL_ITEM &&
(set==ItemSet.MOONSHADOW ||
set==ItemSet.GLADOMAIN ||
set==ItemSet.WOLFSBANE ||
set==ItemSet.ALUSTINE)) {
goodie.setType(Material.SKULL_ITEM);
} else
if (!goodie.getType().name().contains("SWORD") &&
(set==ItemSet.LORASYS)) {
goodie.setType(Material.valueOf(goodie.getType().name().split("_")[0]+"_SWORD"));
}
if (!GenericFunctions.isArmor(goodie) && (set==ItemSet.BLITZEN ||
set==ItemSet.COMET ||
set==ItemSet.CUPID ||
set==ItemSet.DANCER ||
set==ItemSet.DASHER ||
set==ItemSet.DONNER ||
set==ItemSet.OLIVE ||
set==ItemSet.PRANCER ||
set==ItemSet.RUDOLPH ||
set==ItemSet.VIXEN)) {
//Convert to a random choice of armor.
ItemStack item = new ItemStack(Christmas.PickRandomArmorMaterial());
goodie.setType(item.getType());
}
return goodie;
}
private boolean isValidSetItem(ItemStack goodie) {
if (goodie!=null) {
return TwosideKeeper.validsetitems.contains(goodie.getType());
} else {
return false;
}
}
public static ItemSet PickAnItemSet(PlayerMode pm, LivingEntityDifficulty md) {
ItemSet set;
switch (pm) {
case STRIKER:{
set = ItemSet.PANROS;
}break;
case DEFENDER:{
set = ItemSet.SONGSTEEL;
}break;
case BARBARIAN:{
set = ItemSet.DAWNTRACKER;
}break;
case RANGER:{
final int NUMBER_OF_MODES=4;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
set = ItemSet.JAMDAK;
} else
if (selectweight<100) {
set = ItemSet.ALIKAHN;
} else
if (selectweight<150) {
set = ItemSet.DARNYS;
} else
{
set = ItemSet.LORASAADI;
}
}break;
case SLAYER:{
final int NUMBER_OF_MODES=3;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<10) {
set = ItemSet.LORASYS;
} else
switch (md) {
case DANGEROUS:{
set = ItemSet.ALUSTINE;
}break;
case DEADLY:{
set = ItemSet.MOONSHADOW;
}break;
case HELLFIRE:
case END:{
set = ItemSet.GLADOMAIN;
}break;
default:{
set = ItemSet.WOLFSBANE;
}
}
}break;
default:{
set = PickRandomSet(md);
}
}
return set;
}
public static ItemSet PickRandomSet(LivingEntityDifficulty md) {
final int NUMBER_OF_MODES=5;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
return ItemSet.PANROS;
} else
if (selectweight<100) {
return ItemSet.SONGSTEEL;
} else
if (selectweight<150) {
return ItemSet.DAWNTRACKER;
} else
if (selectweight<200) {
//12.5 per set type.
if (selectweight<162.5) {
return ItemSet.JAMDAK;
} else
if (selectweight<175) {
return ItemSet.ALIKAHN;
} else
if (selectweight<187.5) {
return ItemSet.DARNYS;
} else
if (selectweight<200) {
return ItemSet.LORASAADI;
}
} else
if (selectweight<250) {
if (selectweight<205) {
return ItemSet.LORASYS;
} else
switch (md) {
case DANGEROUS:{
return ItemSet.ALUSTINE;
}
case DEADLY:{
return ItemSet.MOONSHADOW;
}
case HELLFIRE:
case END:{
return ItemSet.GLADOMAIN;
}
default:{
return ItemSet.WOLFSBANE;
}
}
}
return ItemSet.PANROS;
}
public static ItemSet PickAHolidayItemSet(PlayerMode playerMode, Object object) {
final int NUMBER_OF_MODES=10;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
return ItemSet.BLITZEN;
} else
if (selectweight<100) {
return ItemSet.COMET;
} else
if (selectweight<150) {
return ItemSet.CUPID;
} else
if (selectweight<200) {
return ItemSet.DANCER;
} else
if (selectweight<250) {
return ItemSet.DASHER;
} else
if (selectweight<300) {
return ItemSet.DONNER;
} else
if (selectweight<350) {
return ItemSet.OLIVE;
} else
if (selectweight<400) {
return ItemSet.PRANCER;
} else
if (selectweight<450) {
return ItemSet.RUDOLPH;
} else
{
return ItemSet.VIXEN;
}
}
}

View File

@ -3,6 +3,7 @@ package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Material; import org.bukkit.Material;
@ -16,10 +17,13 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import aPlugin.DropItem; import aPlugin.DropItem;
import aPlugin.DropMaterial; import aPlugin.DropMaterial;
import aPlugin.API.Chests;
import aPlugin.Drop;
import sig.plugin.TwosideKeeper.Artifact; import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Drops.SigDrop; import sig.plugin.TwosideKeeper.Drops.SigDrop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public class Loot { public class Loot {
@ -33,20 +37,30 @@ public class Loot {
public static void DefineLootChests() { public static void DefineLootChests() {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.STONE_SWORD,8)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.STONE_SWORD,8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),11)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),11));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.COAL,101)); //aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.AIR,101));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.COAL,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,1,17)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,1,17));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,1,18)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,1,18));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,1,17)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,1,17));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_PEARL,1,8)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_PEARL,1,8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,19)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE),4)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,18,"[Normal] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,18,"[Normal] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,19,"[Normal] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,19,"[Normal] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
/*aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.NORMAL)); if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getCookieItem(),1,3,10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getLargeCandyItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSourCandyItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasEventToken(),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasBox(),1));
}
/*aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.NORMAL)); aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.NORMAL));*/ aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.NORMAL));*/
@ -75,17 +89,28 @@ public class Loot {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_INGOT,91800)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_INGOT,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BLOCK,7800)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BLOCK,7800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,1800,"[Dangerous] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,1800,"[Dangerous] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,7800,"[Dangerous] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,7800,"[Dangerous] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,200,"[Dangerous] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,200,"[Dangerous] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,200,"[Dangerous] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,200,"[Dangerous] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,600,"[Dangerous] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,600,"[Dangerous] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,180,"[Dangerous] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,180,"[Dangerous] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,780,"[Dangerous] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,780,"[Dangerous] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,60,"[Dangerous] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DANGEROUS)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,60,"[Dangerous] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE),400)); aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getCookieItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getLargeCandyItem(),46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSourCandyItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),4900));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSweetCandyItem(),4900));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_DANGEROUS.printDrops(); aPlugin.API.Chests.LOOT_DANGEROUS.printDrops();
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_INGOT,1,2,59800)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_INGOT,1,2,59800));
@ -95,17 +120,23 @@ public class Loot {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,7800)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_INGOT,7800)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_INGOT,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_SWORD,800)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_SWORD,800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,1800,"[Deadly] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,1800,"[Deadly] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,7800,"[Deadly] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,7800,"[Deadly] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,200,"[Deadly] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,200,"[Deadly] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,200,"[Deadly] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,200,"[Deadly] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,600,"[Deadly] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,600,"[Deadly] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,360,"[Deadly] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,360,"[Deadly] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,1560,"[Deadly] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,1560,"[Deadly] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,120,"[Deadly] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.DEADLY)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,120,"[Deadly] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_CORE),400)); aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),3900));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,3900));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_DEADLY.printDrops(); aPlugin.API.Chests.LOOT_DEADLY.printDrops();
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD,1,3,60200)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD,1,3,60200));
@ -114,33 +145,66 @@ public class Loot {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD_BLOCK,7800)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD_BLOCK,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,1,2,7800)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,1,2,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BLOCK,7800)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BLOCK,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,1800,"[Hellfire] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,1800,"[Hellfire] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,7800,"[Hellfire] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,7800,"[Hellfire] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,200,"[Hellfire] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,200,"[Hellfire] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,200,"[Hellfire] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,200,"[Hellfire] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,600,"[Hellfire] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,600,"[Hellfire] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,540,"[Hellfire] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,540,"[Hellfire] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,2340,"[Hellfire] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,2340,"[Hellfire] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,180,"[Hellfire] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.HELLFIRE)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,180,"[Hellfire] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),400)); aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,3900));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,3900));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_HELLFIRE.printDrops(); aPlugin.API.Chests.LOOT_HELLFIRE.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,1800,"[End] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,1800,"[End] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,7800,"[End] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,7800,"[End] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,200,"[End] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,200,"[End] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,200,"[End] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,200,"[End] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,600,"[End] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,600,"[End] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,540,"[End] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,540,"[End] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,2340,"[End] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,2340,"[End] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,180,"[End] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.END)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,180,"[End] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400)); aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,1400));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,1400));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getChristmasEventToken(),200));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getChristmasBox(),50));
}
aPlugin.API.Chests.LOOT_CUSTOM.printDrops(); aPlugin.API.Chests.LOOT_CUSTOM.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM_5.setName(ChatColor.RED+"Leader Wither Loot Box");
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropMaterial(Material.NETHER_STAR,140));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(CustomItem.DailyToken(),140));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,40,"[Leader Wither] Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,40,"[Leader Wither] Tool",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,5,"[Leader Wither] Hardened Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,5,"[Leader Wither] Hardened Tool",SigDrop.HARDENED,SigDrop.SET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(aPlugin.API.getChestItem(Chests.ELITE),5));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(Christmas.getChristmasBox(),5));
aPlugin.API.Chests.LOOT_CUSTOM_5.setProbability(0.8);
aPlugin.API.Chests.LOOT_CUSTOM_5.printDrops();
/*for (Chests loot : Chests.values()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
loot.printDrops();
}, 90);
}*/
//aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10)); //aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10));
} }
@ -157,7 +221,7 @@ public class Loot {
} }
public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened, boolean setitem, int settier, Entity damager, Monster m) { public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened, boolean setitem, int settier, Entity damager, Monster m) {
TwosideKeeper.log("Calling this with "+mat_type.name()+","+hardened+","+setitem+".", 2); TwosideKeeper.log("Calling this with "+mat_type.name()+","+hardened+","+setitem+".", 5);
ItemStack raresword = new ItemStack(mat_type); ItemStack raresword = new ItemStack(mat_type);
ItemMeta sword_meta = raresword.getItemMeta(); ItemMeta sword_meta = raresword.getItemMeta();
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type)); sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type));
@ -372,9 +436,9 @@ public class Loot {
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases duration of Tumble to 3 seconds."); fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases duration of Tumble to 3 seconds.");
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Damage Reduction by 20%."); fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Damage Reduction by 20%.");
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Maximum Health by 20."); fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Maximum Health by 20.");
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(128, 64, 0));
} }
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(128, 64, 0));
}break; }break;
case 2: { case 2: {
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", "")); sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
@ -499,7 +563,9 @@ public class Loot {
boolean allowed=true; //Setting this to false will not convert it to a set piece. boolean allowed=true; //Setting this to false will not convert it to a set piece.
prefix = (hardened)?(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "):(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "); prefix = (hardened)?(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "):(ChatColor.AQUA+""+ChatColor.BOLD+"Mega ");
switch (set) { switch (set) {
case PANROS:{ case PANROS:
case WINDRY:
case LUCI:{
if (item.getType().toString().contains("SWORD")) { if (item.getType().toString().contains("SWORD")) {
} else } else
@ -508,9 +574,11 @@ public class Loot {
allowed = false; allowed = false;
} }
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus); tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Panros Striker "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Striker set. set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Striker "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Striker set.
}break; }break;
case SONGSTEEL:{ case SONGSTEEL:
case PROTECTOR:
case SUSTENANCE:{
if (item.getType().toString().contains("SWORD")) { if (item.getType().toString().contains("SWORD")) {
item.setType(Material.SHIELD); item.setType(Material.SHIELD);
tierbonus/=(custom)?1:2; tierbonus/=(custom)?1:2;
@ -520,9 +588,11 @@ public class Loot {
allowed = false; allowed = false;
} }
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus); tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Songsteel Defender "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Defender set. set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Defender "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Defender set.
}break; }break;
case DAWNTRACKER:{ case DAWNTRACKER:
case LEGION:
case PRIDE:{
if (item.getType().toString().contains("SWORD")) { if (item.getType().toString().contains("SWORD")) {
item.setType(Material.valueOf(item.getType().toString().replace("SWORD","")+"AXE")); item.setType(Material.valueOf(item.getType().toString().replace("SWORD","")+"AXE"));
} else } else
@ -531,66 +601,39 @@ public class Loot {
allowed = false; allowed = false;
} }
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus); tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Dawntracker Barbarian "+GenericFunctions.UserFriendlyMaterialName(item.getType()); set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Barbarian "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break; }break;
case LORASYS:{ case LORASYS:
case ASSASSIN:
case STEALTH:{
if (!item.getType().toString().contains("SWORD")) { if (!item.getType().toString().contains("SWORD")) {
allowed = false; allowed = false;
} }
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus); tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType()); set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case JAMDAK:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Jamdak Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.5 && tierbonus<2) {
tierbonus+=(custom)?0:2;
}
}break;
case DARNYS:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.5 && tierbonus<1) {
tierbonus+=(custom)?0:1;
}
}break;
case ALIKAHN:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Alikahn Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.1 && tierbonus<1) {
tierbonus+=(custom)?0:1;
}
}break; }break;
case JAMDAK:
case SHARD:
case TOXIN:
case DARNYS:
case ALIKAHN:
case LORASAADI:{ case LORASAADI:{
if (item.getType().toString().contains("SWORD")) { if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW); item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else } else
if (!item.getType().toString().contains("LEATHER")) { if (item.getType().toString().contains("_HELMET") ||
item.getType().toString().contains("_LEGGINGS") ||
item.getType().toString().contains("_CHESTPLATE") ||
item.getType().toString().contains("_BOOTS")) {
String itemstr = item.getType().toString();
String[] split = itemstr.split("_");
String newstr = "LEATHER_"+split[1];
item.setType(Material.valueOf(newstr));
} else
if (!item.getType().name().contains("LEATHER") && !item.getType().name().contains("BOW")) {
allowed = false; allowed = false;
} }
set_name = prefix+"Lorasaadi Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType()); set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (tierbonus>0 && Math.random()<=0.5) {
tierbonus=(custom)?tierbonus:0;
}
}break; }break;
case GLADOMAIN:{ case GLADOMAIN:{
//item.setType(Material.SKULL_ITEM); else //item.setType(Material.SKULL_ITEM); else
@ -602,7 +645,7 @@ public class Loot {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS); m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m); item.setItemMeta(m);
set_name = prefix+"Gladomain Slayer Amulet"; set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Amulet";
}break; }break;
case MOONSHADOW:{ case MOONSHADOW:{
if (!item.getType().toString().contains("SKULL_ITEM")) { if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -614,7 +657,7 @@ public class Loot {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS); m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m); item.setItemMeta(m);
set_name = prefix+"Moonshadow Slayer Trinket"; set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Trinket";
}break; }break;
case WOLFSBANE:{ case WOLFSBANE:{
if (!item.getType().toString().contains("SKULL_ITEM")) { if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -626,7 +669,7 @@ public class Loot {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS); m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m); item.setItemMeta(m);
set_name = prefix+"Wolfsbane Slayer Ornament"; set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Ornament";
}break; }break;
case ALUSTINE:{ case ALUSTINE:{
if (!item.getType().toString().contains("SKULL_ITEM")) { if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -638,7 +681,20 @@ public class Loot {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS); m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m); item.setItemMeta(m);
set_name = prefix+"Alustine Slayer Charm"; set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Charm";
}break;
case BLITZEN:
case COMET:
case CUPID:
case DANCER:
case DASHER:
case DONNER:
case OLIVE:
case PRANCER:
case RUDOLPH:
case VIXEN: {
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Holiday "+GenericFunctions.CapitalizeFirstLetters(set.name())+" "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Striker set.
}break; }break;
} }
if (item.getItemMeta().hasLore()) { if (item.getItemMeta().hasLore()) {
@ -647,12 +703,13 @@ public class Loot {
int tier = tierbonus; int tier = tierbonus;
do {tier++;} while(Math.random()<=0.25); do {tier++;} while(Math.random()<=0.25);
if (allowed) { if (allowed) {
lore.addAll(ItemSet.GenerateLore(set,tier)); lore.addAll(ItemSet.GenerateLore(set,tier,null));
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.setLore(lore); m.setLore(lore);
m.setDisplayName(set_name); m.setDisplayName(set_name);
item.setItemMeta(m); item.setItemMeta(m);
} }
GenericFunctions.ConvertSetColor(item, set);
item = addEnchantments(item,hardened); item = addEnchantments(item,hardened);
return item; return item;
} }

View File

@ -18,20 +18,34 @@ import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
/**
* Use LivingEntityDifficulty instead.
*/
@Deprecated
public enum MonsterDifficulty { public enum MonsterDifficulty {
NORMAL, NORMAL(LivingEntityDifficulty.NORMAL),
DANGEROUS, DANGEROUS(LivingEntityDifficulty.DANGEROUS),
DEADLY, DEADLY(LivingEntityDifficulty.DEADLY),
HELLFIRE, HELLFIRE(LivingEntityDifficulty.HELLFIRE),
ELITE, ELITE(LivingEntityDifficulty.ELITE),
END; END(LivingEntityDifficulty.END);
LivingEntityDifficulty diff;
MonsterDifficulty(LivingEntityDifficulty diff) {
this.diff=diff;
}
/*private ItemStack Artifact() { /*private ItemStack Artifact() {
sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3); sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3);
return null; return null;
}*/ }*/
public LivingEntityDifficulty getLivingEntityDifficultyEquivalent() {
return this.diff;
}
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger, Entity damager, Monster m) { public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger, Entity damager, Monster m) {
return RandomizeDrops(dropmult,isBoss,false,isRanger,damager,m); return RandomizeDrops(dropmult,isBoss,false,isRanger,damager,m);
} }
@ -54,7 +68,7 @@ public enum MonsterDifficulty {
Player p = (Player)CustomDamage.getDamagerEntity(damager); Player p = (Player)CustomDamage.getDamagerEntity(damager);
for (int i=0;i<dropmult;i++) { for (int i=0;i<dropmult;i++) {
TwosideKeeper.Loot_Logger.AddLootRoll(); TwosideKeeper.Loot_Logger.AddLootRoll();
TwosideKeeper.log("Attempting a roll...", 2); TwosideKeeper.log("Attempting a roll...", TwosideKeeper.LOOT_DEBUG);
ItemStack goodie = null; ItemStack goodie = null;
if (Math.random()<=0.1 || isBoss) { if (Math.random()<=0.1 || isBoss) {
TwosideKeeper.log("Inside!", 5); TwosideKeeper.log("Inside!", 5);
@ -79,7 +93,9 @@ public enum MonsterDifficulty {
}break; }break;
default:{ default:{
goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop(p); if (Math.random()<=0.4) {
goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop(p);
}
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, p); KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, p);
} }
} }

View File

@ -0,0 +1,232 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class OptionsMenu {
Player p;
Inventory inv;
List<Option> options;
final int NUMBER_OF_ROWS = (OptionName.values().length/3)+(((OptionName.values().length%3)!=0)?1:0);
public OptionsMenu(Player p) {
this.p=p;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.optionsmenu=this;
inv = Bukkit.createInventory(p, NUMBER_OF_ROWS*9, ChatColor.BLUE+"Options Menu");
this.options = new ArrayList<Option>();
PopulateInterface(p);
//inv.setItem(arg0, arg1);
p.openInventory(inv);
}
private void PopulateInterface(Player p) {
for (int i=0;i<OptionName.values().length;i++) {
Option o = new Option(OptionName.values()[i],i*3,(i*3)+1);
ItemStack it = o.getOption().getMaterialData().toItemStack();
SetupDescriptions(o, it);
ItemStack it2 = new ItemStack(o.getTorchIcon(p));
it2.setAmount(0);
SetupDescriptions(o, it2);
//TwosideKeeper.log(o+";;"+it+";;"+it2, 0);
inv.setItem(o.getPositions()[0], it);
inv.setItem(o.getPositions()[1], it2);
options.add(o);
}
}
private void SetupDescriptions(Option o, ItemStack it) {
ItemUtils.setDisplayName(it, o.getOption().getTitle());
ItemUtils.addLore(it, o.getOption().getDescription());
ItemUtils.addFlag(it, ItemFlag.values());
}
public static boolean runOptionsMenuClick(InventoryClickEvent ev) {
InventoryHolder holder = ev.getInventory().getHolder();
if (holder!=null && holder instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)holder);
if (pd.optionsmenu!=null) {
if (ev.getClickedInventory().equals(pd.optionsmenu.getInventory())) {
pd.optionsmenu.checkForClick(ev.getSlot());
}
return false;
}
}
return true;
}
private void checkForClick(int slot) {
for (Option o : options) {
for (Integer i : o.getPositions()) {
if (i==slot) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (o.getOption().getTitle().equalsIgnoreCase("DPS Tracking") && pd.dpstrackinglocked) {
return;
}
boolean val = o.getOption().isOptionEnabled(p, true);
doExtraThings(o.getOption());
p.sendMessage(o.getOption().getTitle()+" is now turned "+(val?ChatColor.GREEN+"ON":ChatColor.RED+"OFF")+ChatColor.RESET+".");
PopulateInterface(p);
return;
}
}
}
}
private void doExtraThings(OptionName o) {
if (o==OptionName.DPS && !o.isOptionEnabled(p, false)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
p.sendMessage(pd.damagedata.OutputResults());
}
}
private Inventory getInventory() {
return inv;
}
}
class Option{
int iconpos;
int torchpos;
OptionName option;
Option(OptionName option, int iconslot, int torchslot) {
this.option=option;
this.iconpos=iconslot;
this.torchpos=torchslot;
}
OptionName getOption() {
return option;
}
int[] getPositions() {
return new int[]{iconpos,torchpos};
}
Material getTorchIcon(Player p) {
return (getOption().isOptionEnabled(p,false)?Material.SLIME_BALL:Material.FIREBALL);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Option(option=");
sb.append(option);
sb.append(",iconpos=");
sb.append(iconpos);
sb.append(",torchpos=");
sb.append(torchpos);
sb.append(")");
return sb.toString();
}
}
enum OptionName{
DPSDISPLAY("Damage Number Display",ChatColor.GRAY+"Toggles the display of Damage Numbers on/off.",Material.SKULL_ITEM,(byte)0),
DPS("DPS Tracking",ChatColor.GRAY+"Toggles the tracking of damage stats on/off.\nTurning it off reports the last damage session breakdown.",Material.WRITTEN_BOOK,(byte)0),
HEALTHBARDISPLAY("Healthbar Display",ChatColor.GRAY+"Toggles the healthbar near the player's cursor\nwhen attacking or getting hit by mobs.",Material.BED,(byte)0),
AUTOEQUIPARMOR("Auto-Equip Armor",ChatColor.GRAY+"Toggles automatically equipping appropriate armor.",Material.LEATHER_CHESTPLATE,(byte)0),
AUTOEQUIPWEAPON("Auto-Equip Weapon",ChatColor.GRAY+"Toggles automatically equipping appropriate weapons.",Material.IRON_SWORD,(byte)0),
SOUNDS("Login/Logout Sounds",ChatColor.GRAY+"Toggles the playing of login/logout sound\nnotifications as well as message sound notifications.",Material.RECORD_7,(byte)0),
MOUSEOVERHEALTHBAR("Mouseover Healthbar",ChatColor.GRAY+"Toggles the display of a mob's healthbar without having to attack it.",Material.WATCH,(byte)0);
String title;
String description;
MaterialData data;
OptionName(String title, String desc, Material icon, byte data) {
this.data = new MaterialData(icon,data);
this.title=title;
this.description=desc;
}
MaterialData getMaterialData() {
return data;
}
boolean isOptionEnabled(Player p, boolean toggle) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
switch (this) {
case DPSDISPLAY:{
if (toggle) {
pd.damagenumbers=!pd.damagenumbers;
}
return pd.damagenumbers;
}
case DPS:{
if (toggle) {
pd.damagelogging=!pd.damagelogging;
}
return pd.damagelogging;
}
case AUTOEQUIPARMOR:{
if (toggle) {
pd.equiparmor=!pd.equiparmor;
}
return pd.equiparmor;
}
case AUTOEQUIPWEAPON:{
if (toggle) {
pd.equipweapons=!pd.equipweapons;
}
return pd.equipweapons;
}
case SOUNDS:{
if (toggle) {
pd.sounds_enabled=!pd.sounds_enabled;
}
return pd.sounds_enabled;
}
case HEALTHBARDISPLAY:{
if (toggle) {
pd.healthbardisplay=!pd.healthbardisplay;
}
return pd.healthbardisplay;
}
case MOUSEOVERHEALTHBAR:{
if (toggle) {
pd.mouseoverhealthbar=!pd.mouseoverhealthbar;
}
return pd.mouseoverhealthbar;
}
}
TwosideKeeper.log("WARNING! Value for Option "+title+" does not exist!", 1);
return false;
}
String getTitle() {
return title;
}
String getDescription() {
return description;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("OptionName(title=");
sb.append(title);
sb.append(",description=");
sb.append(description);
sb.append(",data=");
sb.append(data);
sb.append(")");
return sb.toString();
}
}

View File

@ -0,0 +1,246 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
public class Pet {
final static public int LEASHRANGE = 16;
final static public int LEASHRANGE_SQUARED = LEASHRANGE*LEASHRANGE;
Player owner;
Location targetLoc;
Location lastPos;
double moveSpd = 1;
double jumpHeight = 3.0;
int attackRate = 10;
long lastAttacked = 0;
LivingEntity ent;
String name="";
int stuckTimer=0;
LivingEntity myTarget=null;
PetState myState = PetState.PASSIVE;
double myDamage = 5;
public Pet(Player owner, EntityType ent, String nickname) {
try {
this.ent = (LivingEntity)owner.getLocation().getWorld().spawnEntity(owner.getLocation(), ent);
this.owner = owner;
this.name = nickname;
this.setNickname(nickname);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(this.ent);
les.isPet=true;
les.petOwner=owner;
} catch (ClassCastException e) {
TwosideKeeper.log("ERROR! Specified invalid Entity Type when creating Pet!", 0);
e.printStackTrace();
}
}
public void run() {
if (owner==null || !owner.isValid() || ent==null || !ent.isValid()) {
cleanup();
return;
}
grabEnemyTarget();
switch (myState) {
case PASSIVE:{
if (myTarget!=null && !myTarget.isValid()) {
myTarget=null;
//TwosideKeeper.log("My Target is now "+GenericFunctions.GetEntityDisplayName(myTarget), 1);
} else
if (myTarget!=null) { //This is a valid target. If we are too far away, move towards it. Perform an attack when close enough if possible.
if (ent.getLocation().distanceSquared(myTarget.getLocation())>4) {
setTargetLocation(myTarget.getLocation());
setState(PetState.MOVING);
} else {
//We are in attack range. Prepare an attack.
if (lastAttacked+attackRate<=TwosideKeeper.getServerTickTime()) {
myState=PetState.ATTACKING;
lastAttacked=TwosideKeeper.getServerTickTime();
}
}
}
if (owner.getLocation().distanceSquared(ent.getLocation())>LEASHRANGE_SQUARED) {
ent.teleport(owner.getLocation());
}
}break;
case MOVING:{
if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)>2) {
Location loc = MoveTowardsPoint(targetLoc);
if (lastPos!=null) {
if (lastPos.distanceSquared(ent.getLocation())<4) {
stuckTimer++;
//TwosideKeeper.log("Stuck Timer: "+stuckTimer, 1);
} else {
stuckTimer=0;
lastPos=null;
//setState(PetState.PASSIVE);
}
} else {
lastPos = loc.clone();
}
}
if (stuckTimer==20) {
//Try jumping.
ent.setVelocity(new Vector(0,jumpHeight,0));
stuckTimer++;
} else
if (stuckTimer==50) {
ent.teleport(owner);
stuckTimer=0;
lastPos=null;
targetLoc=null;
setState(PetState.PASSIVE);
}
if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)<=2) {
targetLoc=null;
stuckTimer=0;
setState(PetState.PASSIVE);
}
if (targetLoc==null) {
stuckTimer=0;
setState(PetState.PASSIVE);
}
}break;
case ATTACKING:{
if (myTarget!=null) {
MoveTowardsPoint(myTarget.getLocation(),0.4);
//Deal damage.
CustomDamage.ApplyDamage(myDamage, ent, myTarget, null, "Pet Attack");
}
setState(PetState.PASSIVE);
}break;
}
//TwosideKeeper.log("Pet State: "+myState, 1);
}
private Location MoveTowardsPoint(Location targetLoc) {
return MoveTowardsPoint(targetLoc,1);
}
private Location MoveTowardsPoint(Location targetLoc, double mult) {
Vector dirToMove = MovementUtils.getVelocityTowardsLocation(ent.getLocation(), targetLoc, moveSpd*mult);
Location loc = ent.getLocation();
loc.setDirection(dirToMove);
ent.setVelocity(dirToMove);
ent.teleport(loc);
return loc;
}
public void setTarget(LivingEntity target) {
setTarget(target,false);
}
public void setTarget(LivingEntity target, boolean force) {
if (myTarget==null || myTarget.getLocation().distanceSquared(ent.getLocation())>64 || force) {
myTarget = target;
}
}
private void grabEnemyTarget() {
if (myTarget!=null){
if (myTarget.isValid()) {
if (!myTarget.getWorld().equals(ent.getWorld())) {
myTarget=null;
return;
}
if (myTarget.getLocation().distanceSquared(ent.getLocation())>64) {
myTarget=null;
return;
}
}
}
if (ent.hasAI() && isFighting()) {
ent.setAI(false);
if (myTarget==null || !myTarget.isValid()) {
//Attempt to find a target. Try the owner's target first.
PlayerStructure pd = PlayerStructure.GetPlayerStructure(owner);
myTarget = pd.target;
if (myTarget==null || !myTarget.isValid()) {
//Try to find a nearby target.
List<LivingEntity> ents = GenericFunctions.getNearbyMonsters(ent.getLocation(), 4);
double closestrange = Integer.MAX_VALUE;
LivingEntity selectedent = null;
for (int i=0;i<ents.size();i++) {
LivingEntity ent = ents.get(i);
if (ent==this.ent || LivingEntityStructure.isFriendly(owner, ent)) {
ents.remove(i--);
} else {
double dist = ent.getLocation().distanceSquared(this.ent.getLocation());
if (closestrange>dist) {
closestrange = dist;
selectedent = ent;
}
}
}
if (selectedent!=null) {
myTarget=selectedent;
}
}
}
} else
if (!ent.hasAI() && !isFighting()) {
ent.setAI(true);
}
}
public PetState getState() {
return myState;
}
public void setTargetLocation(Location loc) {
this.targetLoc=loc;
}
public void setMoveSpeed(double spd) {
this.moveSpd = spd;
}
public void setNickname(String nickname) {
this.name=nickname;
this.ent.setCustomName(nickname);
}
public String getNickname() {
return name;
}
public Location getTargetLocation() {
return targetLoc;
}
public LivingEntity getEntity() {
return ent;
}
public void cleanup() {
ent.remove();
}
public boolean isFighting() {
if (owner!=null && PlayerUtils.PlayerIsInCombat(owner)) {
return true;
} else {
return false;
}
}
public void setState(PetState state) {
myState = state;
}
}

View File

@ -0,0 +1,7 @@
package sig.plugin.TwosideKeeper.HelperStructures;
public enum PetState {
PASSIVE,
MOVING,
ATTACKING;
}

View File

@ -4,109 +4,29 @@ import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PartyManager;
import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum PlayerMode { public enum PlayerMode {
STRIKER(ChatColor.RED,"S","Striker", STRIKER(ChatColor.RED,"S","Striker",Book.STRIKERGUIDE),
ChatColor.RED+""+ChatColor.BOLD+"Striker mode Perks: "+ChatColor.RESET+"\n" RANGER(ChatColor.DARK_GREEN,"R","Ranger",Book.RANGERGUIDE),
+ ChatColor.WHITE+"->Players are identified as 'Strikers' when they only carry a sword in their main hand. No off-hand items.\n" DEFENDER(ChatColor.GRAY,"D","Defender",Book.DEFENDERGUIDE),
+ ChatColor.GRAY+"->10% passive damage increase.\n" BARBARIAN(ChatColor.GOLD,"B","Barbarian",Book.BARBARIANGUIDE
+ ChatColor.WHITE+"->20% chance to critically strike.\n"
+ ChatColor.WHITE+"->Getting hit increases Speed by 1 Level. Stacks up to Speed V (Lasts five seconds.)\n"
+ ChatColor.GRAY+"->Swinging your weapon stops nearby flying arrows. Each arrow deflected will give you a Strength buff. Stacks up to Strength V (Lasts five seconds.)\n"
+ ChatColor.WHITE+"->Dropping your weapon will perform a line drive. Enemies you charge through take x1-x5 damage, based on target's missing health. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
+ ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n"
+ ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n"),
RANGER(ChatColor.DARK_GREEN,"R","Ranger",
ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Rangers' when they carry a bow or a quiver in one of their hands. Off-hand items are permitted, except for a shield. Can only be wearing leather armor, or no armor.\n"
+ ChatColor.GRAY+"->Left-clicking mobs will cause them to be knocked back extremely far, basically in headshot range, when walls permit.\n"
+ ChatColor.WHITE+"->Base Arrow Damage increases from x2->x4.\n"
+ ChatColor.GRAY+"->You can dodge 50% of all incoming attacks from any damage sources.\n"
+ ChatColor.WHITE+"You have immunity to all Thorns damage.\n"
+ ChatColor.GRAY+"Shift-Right Click to change Bow Modes.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Close Range Mode (Default):"+ChatColor.RESET+ChatColor.WHITE+" \n"
+ ChatColor.GRAY+" You gain the ability to deal headshots from any distance, even directly onto an enemy's face. Each kill made in this mode gives you 100% dodge chance for the next hit taken. You can tumble and gain invulnerability for 1 second by dropping your bow. Sneak while dropping it to tumble backwards.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Sniping Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
+ ChatColor.GRAY+" Headshot collision area increases by x3. Headshots will deal an extra x0.25 damage for each headshot landed, up to a cap of 8 stacks. Each stack also increases your Slowness level by 1. You lose 10% dodge chance per Slowness stack, but gain one Resistance level and 10% critical chance per Slowness stack.\n"
+ ChatColor.WHITE+" Arrows are lightning-fast in Sniping Mode.\n"
+ ChatColor.GRAY+" Press the drop key in Sniping Mode to unleash 26 piercing arrows rapidly against your enemies.\n\n"
+ ChatColor.GRAY+"- "+ChatColor.BOLD+"Debilitation Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
+ ChatColor.WHITE+" Adds a stack of Poison when hitting non-poisoned targets (20 second duration). Hitting mobs in this mode refreshes the duration of the poison stacks. Headshots made in this mode will increase the level of Poison on the mob, making the mob more and more vulnerable.\n"
+ ChatColor.GRAY+" Headshots also remove one level of a buff (does not affect debuffs) applied to the mob at random.\n"
+ ChatColor.WHITE+" Press the drop key in Debilitation Mode when at least 1 poisoned target is nearby. Deals (Poison Level x 10) True Damage and Slows all targets the same level as the number of poison stacks applied to nearby targets for 15 seconds, and grants 4 Absorption health (2 hearts) to the Ranger per poison stack. Refreshes Poison duration on all nearby poisoned targets.\n"),
DEFENDER(ChatColor.GRAY,"D","Defender",
ChatColor.GRAY+""+ChatColor.BOLD+"Defender mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Defenders' when they use a shield in their main hand.\n"
+ ChatColor.GRAY+"->Base Damage reduction from shields increases from 5%->10%\n"
+ ChatColor.WHITE+"->Blocking damage reduction increases from 50->70%\n"
+ ChatColor.GRAY+"->When not blocking, you have Regeneration I. Blocking applies Regeneration II.\n"
+ ChatColor.WHITE+"->Blocking gives 8 health (4 hearts) of Absorption damage.\n"
+ ChatColor.GRAY+"->When hit while blocking, you build up Resistance, one level per hit, up to Resistance V (lasts 2 seconds)\n"
+ ChatColor.WHITE+"->While blocking, you absorb 50% of all damage taken by party members.\n"
+ ChatColor.GRAY+"->Blocking will aggro all nearby mobs to the blocking defender. They will glow indicate the aggro shift.\n"
+ ChatColor.WHITE+"->Base Health increased by 10 (5 hearts)\n"
+ ChatColor.GRAY+"->Getting hit as a defender increases saturation.\n"
+ ChatColor.WHITE+"->Hitting mobs as a Defender aggros them to you.\n"
+ ChatColor.GRAY+"->Knockback from attacks reduced by 75% while blocking.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Rejuvenation"+ChatColor.RESET+ChatColor.WHITE+"\n"
+ ChatColor.GRAY+"->Dropping your shield will give you Regeneration X for 10 seconds and 2 seconds of invulnerability. It also costs 400 shield durability!\n"),
BARBARIAN(ChatColor.GOLD,"B","Barbarian",
ChatColor.GOLD+""+ChatColor.BOLD+"Barbarian mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Barbarians' by wielding an axe in both the main hand and the offhand.\n"
+ ChatColor.GRAY+"->Barbarians swing their off-hand by right-clicking.\n"
+ ChatColor.WHITE+"->Barbarians gain 2 HP (1 Heart) per 1% of Damage reduction.\n"
+ ChatColor.GRAY+"->When Barbarians are hit, they take damage as if they had 0% Damage reduction.\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n"
+ ChatColor.GRAY+"->Barbarians deal 20% more damage for every 20% of an enemy's missing health.\n"
+ ChatColor.WHITE+"->Barbarians gain Bonus Lifesteal stacks as they hit enemies. Each stack increases Lifesteal by 1%, up to a cap of 100% extra Lifesteal. The stacks refresh every hit, but wear off after 5 seconds.\n"
+ ChatColor.GRAY+"->Barbarians do not instantly take full damage when hit. Instead, the HP is stored in a 'Damage Pool' and distributed every second.\n"
+ ChatColor.WHITE+"->If Barbarians have points in their 'Damage Pool', they will take up to 15 damage every second. The amount taken goes down by wearing Barbarian gear.\n"
+ ChatColor.GRAY+"->When a monster is killed by a Barbarian, the amount of remaining damage in their Damage Pool is divided by 4.\n"
+ ChatColor.WHITE+"->Barbarians automatically consume Rotten Flesh and Spider Eyes that are picked up. Each one heals for 1% of their health. Rotten Flesh and Spider Eyes in a Barbarian's inventory will automatically be consumed as the Barbarian gets hungry.\n"
+ ChatColor.GRAY+"->Barbarians build up Weapon Charges in two ways: +1 Charge for attacking an enemy with the main hand weapon and +2 Charges for taking damage.\n"
+ ChatColor.WHITE+"->Barbarians have 70% knockback resistance.\n"
+ ChatColor.GRAY+"->Barbarians can release their Weapon Charges by using a variety of commands:\n"
+ ChatColor.WHITE+"->Right-Click (Costs 10 Charges): Power Swing - Swing your off-hand weapon to deal an attack with +100% Lifesteal and +100% Crit Chance bonus. Gives 10 Bonus Lifesteal stacks.\n"
+ ChatColor.GRAY+"->Shift Left-Click (Costs 30 Charges): Forceful Strike - Hit all enemies in a line in front of you, dealing double damage and suppressing them for 3 seconds.\n"
+ ChatColor.WHITE+"->Shift Right-Click (Costs 30 Charges): Sweep Up - Performs a sweeping attack which knocks up and damages all enemies within a 4m radius of you. Doubles your Bonus Lifesteal stacks. Lifesteal effects are doubled during this attack.\n"
+ ChatColor.GRAY+"->Swap Item Key (100 Charges Minimum, Costs ALL Charges): Barbarian's Rage - Converts your missing health into Absorption Hearts and applies powerful buffs. This ability is stronger the more stacks consumed.\n"
+ ChatColor.WHITE+" Barbarian's Rage: \n"
+ ChatColor.GRAY+" -- Strength Level: +1 per 10 charges\n"
+ ChatColor.WHITE+" -- LifeSteal: +1% per 2 charges\n"
+ ChatColor.GRAY+" -- Speed V\n"
+ ChatColor.WHITE+" -- Duration of Rage: +1 second per 10 charges\n"
+ ChatColor.GRAY+" -- +2 seconds of invulnerability per 100 charges\n"
+ ChatColor.WHITE+"During Rage you gain double the number of Bonus Lifesteal stacks. You do not gain Weapon Charges during Barbarian's Rage.\n"
+ ChatColor.GRAY+"->Leaping Strike: Barbarians that take fall damage deal triple the damage taken from the fall as damage to all enemies nearby. The range of this attack increases based on how fast the Barbarian falls.\n"
+ ChatColor.WHITE+"->Mock: Press the drop key to perform a Mock attack to all enemies near you. Affected enemies become aggro'd to the Barbarian for 15 seconds and receive 2 stacks of Weakness that lasts 15 seconds. This can stack up to Weakness VI. 20 second cooldown.\n"
), ),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer", SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",Book.SLAYERGUIDE),
ChatColor.DARK_BLUE+""+ChatColor.BOLD+"Slayer mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n"
+ ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them on their hotbar (Ideally you would want to use one slot for a weapon). Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n"
+ ChatColor.WHITE+"->Slayers take a maximum of 1 Heart (2 HP) in damage from all attacks, making this mode essentially 5 lives.\n"
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills, being out of combat for 1 minute, using the Amulet's set effect, or sleeping. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
+ ChatColor.WHITE+"->Whenever a Slayer kills a target, they recover 1 Heart (2 HP). This can be modified by a special weapon.\n"
+ ChatColor.GRAY+"->Slayers can enter Stealth mode by pressing Sneak. Once in Stealth mode, Slayers will not leave stealth until they take damage or Sneak again. Stealth mode drains 1 Durability every second from tools on your hotbar.\n"
+ ChatColor.WHITE+"->While in Stealth mode, nothing will be able to detect you. Note this does not get rid of aggression from targets that have already aggro'd you.\n"
+ ChatColor.GRAY+"->Slayers can Backstab targets by getting behind them and hitting them. A backstab does triple the normal damage of an attack.\n"
+ ChatColor.WHITE+"->Whenever a Slayer critically strikes, it suppresses a target for 0.75 seconds. Suppression prevents movement, attacking, teleporting, and exploding. Suppressed targets glow Black.\n"
+ ChatColor.GRAY+"->Slayers thrive in 1vs1 situations. If a target is completely alone, they will glow white to the Slayer. Isolated targets take 50% more damage from the Slayer. Slayer's Dodge Chance increases by 40% against isolated targets.\n"
+ ChatColor.WHITE+"->Slayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain a speed and strength buff. These buffs cap at Speed V and Strength X respectively and last 10 seconds. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"),
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner", SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"), Book.SUMMONERGUIDE),
NORMAL(ChatColor.WHITE,"","Normal", NORMAL(ChatColor.WHITE,"A","Adventurer",Book.ADVENTURERGUIDE);
"This mode has no perks!");
; ;
final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player. final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player.
ChatColor col=ChatColor.WHITE; ChatColor col=ChatColor.WHITE;
String symbol=""; String symbol="";
Book storedBook;
public ChatColor getColor() { public ChatColor getColor() {
return col; return col;
@ -121,32 +41,39 @@ public enum PlayerMode {
} }
public static PlayerMode getPlayerMode(Player p) { public static PlayerMode getPlayerMode(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (p!=null && p.isValid() && p.isOnline() && !p.isDead()) {
if (needsUpdating(pd)) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (Check_isSlayer(p)) { if (needsUpdating(pd)) {
if (pd.lastmode!=PlayerMode.SLAYER) {pd.slayermodehp=p.getHealth();} if (Check_isSlayer(p)) {
pd.lastmode=PlayerMode.SLAYER; if (pd.lastmode!=PlayerMode.SLAYER) {pd.slayermodehp=p.getHealth();}
} else { pd.lastmode=PlayerMode.SLAYER;
if (pd.lastmode==PlayerMode.SLAYER) {
GenericFunctions.removeStealth(p);
}
if (Check_isStriker(p)) {
pd.lastmode=PlayerMode.STRIKER;
} else
if (Check_isBarbarian(p)) {
pd.lastmode=PlayerMode.BARBARIAN;
} else
if (Check_isDefender(p)) {
pd.lastmode=PlayerMode.DEFENDER;
} else
if (Check_isRanger(p)) {
pd.lastmode=PlayerMode.RANGER;
} else { } else {
pd.lastmode=PlayerMode.NORMAL; if (pd.lastmode==PlayerMode.SLAYER) {
GenericFunctions.removeStealth(p);
}
if (Check_isStriker(p)) {
pd.lastmode=PlayerMode.STRIKER;
} else
if (Check_isBarbarian(p)) {
pd.lastmode=PlayerMode.BARBARIAN;
} else
if (Check_isDefender(p)) {
pd.lastmode=PlayerMode.DEFENDER;
} else
if (Check_isRanger(p)) {
pd.lastmode=PlayerMode.RANGER;
} else
if (Check_isSummoner(p)) {
pd.lastmode=PlayerMode.SUMMONER;
} else {
pd.lastmode=PlayerMode.NORMAL;
}
} }
} }
return pd.lastmode;
} else {
return PlayerMode.NORMAL;
} }
return pd.lastmode;
} }
public static boolean needsUpdating(PlayerStructure pd) { public static boolean needsUpdating(PlayerStructure pd) {
@ -222,6 +149,19 @@ public enum PlayerMode {
} }
} }
public static boolean isSummoner(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
return getPlayerMode(p)==PlayerMode.SUMMONER;
} else {
return pd.lastmode==PlayerMode.SUMMONER;
}
} else {
return false;
}
}
public static boolean isNormal(Player p) { public static boolean isNormal(Player p) {
if (p!=null && !p.isDead()) { if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -241,8 +181,8 @@ public enum PlayerMode {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) { if (needsUpdating(pd)) {
if ((((p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow/quiver in main hand. if ((((p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow/quiver in main hand.
(p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && p.getInventory().getExtraContents()[0]!=null && !GenericFunctions.isEquip(p.getInventory().getExtraContents()[0])) || /*Satisfy a bow/quiver in main hand and no shield in off-hand.*/ (p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && p.getInventory().getExtraContents()[0]!=null && !(GenericFunctions.isWeapon(p.getInventory().getExtraContents()[0])) && !(GenericFunctions.isArmor(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in main hand and no shield in off-hand.*/
(p.getEquipment().getItemInMainHand()!=null && !GenericFunctions.isEquip(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in off-hand and no shield in main hand.*/ (p.getEquipment().getItemInMainHand()!=null && !GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand()) && !GenericFunctions.isArmor(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in off-hand and no shield in main hand.*/
((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0])))) /*Satisfy just a bow/quiver in off-hand.*/ && ((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0])))) /*Satisfy just a bow/quiver in off-hand.*/ &&
GenericFunctions.AllLeatherArmor(p))) { GenericFunctions.AllLeatherArmor(p))) {
return true; return true;
@ -296,7 +236,7 @@ public enum PlayerMode {
if (p!=null && !p.isDead()) { if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) { if (needsUpdating(pd)) {
if (p.getEquipment().getItemInMainHand()!=null && GenericFunctions.hasSlayerSetItemOnHotbar(p) && if (p.getEquipment().getItemInMainHand()!=null && GenericFunctions.hasBaublePouchInOffHand(p) &&
GenericFunctions.WearingNoArmor(p)) { GenericFunctions.WearingNoArmor(p)) {
return true; return true;
} else { } else {
@ -328,23 +268,43 @@ public enum PlayerMode {
} }
} }
public static boolean Check_isSummoner(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (GenericFunctions.onlyHoldingScepter(p) &&
GenericFunctions.AllLeatherArmor(p)) {
return true;
} else {
return false;
}
} else {
return pd.lastmode==PlayerMode.SUMMONER;
}
} else {
return false;
}
}
String name=""; String name="";
String desription=""; Book helperBook;
public String getDesription() { public Book getBook() {
return desription; return helperBook;
} }
public void setDesription(String desription) { public void setBook(Book book) {
this.desription = desription; this.helperBook = book;
} }
PlayerMode(ChatColor col, String abbreviation, String fullname, String desc) { PlayerMode(ChatColor col, String abbreviation, String fullname, Book descBook) {
this.col=col; this.col=col;
this.symbol=abbreviation; this.symbol=abbreviation;
this.name=fullname; this.name=fullname;
this.desription=desc; this.helperBook=descBook;
} }
public static boolean isLeatherPlayerMode(PlayerMode mode) {
return mode==PlayerMode.RANGER || mode==PlayerMode.SUMMONER;
}
} }

View File

@ -71,7 +71,7 @@ public class Pronouns {
"exploded.", "exploded.",
"decided there was a better life worth living.", "decided there was a better life worth living.",
"exploded by the after shock.", "exploded by the after shock.",
"was shredded by the secondary explsion.", "was shredded by the secondary explosion.",
"exploded into pieces.", "exploded into pieces.",
"could not handle the after shock.", "could not handle the after shock.",
"was feeling a little greedy, blindly walking into the demolition zone.", "was feeling a little greedy, blindly walking into the demolition zone.",
@ -205,7 +205,7 @@ public class Pronouns {
"melon", "melon",
"pie", "pie",
}; };
} }break;
case 16:{ case 16:{
pronouns = new String[]{ pronouns = new String[]{
"thought living inside a block was a good idea.", "thought living inside a block was a good idea.",
@ -216,7 +216,7 @@ public class Pronouns {
"somehow ended up trapped inside a block.", "somehow ended up trapped inside a block.",
"ended up suffocating.", "ended up suffocating.",
}; };
} }break;
case 17:{ case 17:{
pronouns = new String[]{ pronouns = new String[]{
"got murdered by the webs of a "+ChatColor.DARK_RED+"Hellfire Spider.", "got murdered by the webs of a "+ChatColor.DARK_RED+"Hellfire Spider.",
@ -227,7 +227,7 @@ public class Pronouns {
"got lost in the web.", "got lost in the web.",
"got tangled by webs.", "got tangled by webs.",
}; };
} }break;
case 18:{ case 18:{
pronouns = new String[]{ pronouns = new String[]{
"took too much damage, and wilted away...", "took too much damage, and wilted away...",
@ -239,7 +239,30 @@ public class Pronouns {
"braved the terrors of the world, but could not live to see another day.", "braved the terrors of the world, but could not live to see another day.",
"fought until the very end of their life. But it was not enough.", "fought until the very end of their life. But it was not enough.",
}; };
} }break;
case 19:{
pronouns = new String[]{
"pulverized into Darkness...",
"did not time their jump properly, submitting to Darkness.",
"got slammed into the earth by Darkness.",
};
}break;
case 20:{
pronouns = new String[]{
"was pierced to death.",
"took one to the face.",
"took an arrow to the knee.",
"took one too many arrows to the face.",
};
}break;
case 21:{
pronouns = new String[]{
"was barbequed!",
"was turned into fried chicken from a deadly Burning Plume.",
"could not avoid the Burning hell.",
"... wtfbbq",
};
}break;
} }
return pronouns[(int)(Math.random()*pronouns.length)]; return pronouns[(int)(Math.random()*pronouns.length)];
} }

View File

@ -0,0 +1,58 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Location;
public class RecyclingCenterNode {
private Location loc;
private boolean toolsAllowed=true;
private boolean itemsAllowed=true;
private String recyclingCenterName="Recycling Center";
public RecyclingCenterNode(Location loc, String name) {
this(loc,name,true);
}
public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed) {
this(loc,name,toolsAllowed,true);
}
public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed, boolean itemsAllowed) {
this.loc=loc.clone();
this.toolsAllowed=toolsAllowed;
this.itemsAllowed=itemsAllowed;
this.recyclingCenterName=name;
}
public boolean areToolsAllowed() {
return (itemsAllowed && toolsAllowed);
}
public void setToolsAllowed(boolean toolsAllowed) {
this.toolsAllowed = toolsAllowed;
if (!this.itemsAllowed) {this.itemsAllowed = toolsAllowed;}
}
public boolean areItemsAllowed() {
return itemsAllowed;
}
public void setItemsAllowed(boolean itemsAllowed) {
this.itemsAllowed = itemsAllowed;
}
public String getRecyclingCenterName() {
return recyclingCenterName;
}
public void setRecyclingCenterName(String name) {
this.recyclingCenterName = name;
}
public Location getRecyclingCenterLocation() {
return loc;
}
public String toString() {
return "RecyclingCenterNode(Name="+recyclingCenterName+",x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
}
}

View File

@ -1,7 +1,9 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -11,14 +13,14 @@ import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ShopPurchase { public class ShopPurchase {
String player; UUID player;
String customer; UUID customer;
ItemStack item; ItemStack item;
double money; double money;
int amt; int amt;
boolean sell; boolean sell;
public ShopPurchase(String p, String customer, ItemStack item, double money, int amt) { public ShopPurchase(UUID p, UUID customer, ItemStack item, double money, int amt) {
this.player = p; this.player = p;
this.customer=customer; this.customer=customer;
this.item=item; this.item=item;
@ -27,7 +29,7 @@ public class ShopPurchase {
this.sell=true; this.sell=true;
} }
public ShopPurchase(String p, String customer, ItemStack item, double money, int amt, boolean sell) { public ShopPurchase(UUID p, UUID customer, ItemStack item, double money, int amt, boolean sell) {
this.player = p; this.player = p;
this.customer=customer; this.customer=customer;
this.item=item; this.item=item;
@ -36,11 +38,11 @@ public class ShopPurchase {
this.sell=sell; this.sell=sell;
} }
public String getSeller() { public UUID getSeller() {
return player; return Bukkit.getOfflinePlayer(player).getUniqueId();
} }
public String getCustomer() { public UUID getCustomer() {
return customer; return Bukkit.getOfflinePlayer(customer).getUniqueId();
} }
public ItemStack getItem() { public ItemStack getItem() {
return item; return item;
@ -58,7 +60,7 @@ public class ShopPurchase {
public TextComponent announcementString() { public TextComponent announcementString() {
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
if (sell) { if (sell) {
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has purchased "+ChatColor.YELLOW+amt+ChatColor.WHITE+" of your "); TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+WorldShop.getFriendlyOwnerName(customer)+ChatColor.WHITE+" has purchased "+ChatColor.YELLOW+amt+ChatColor.WHITE+" of your ");
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]"); TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]");
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create())); message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create()));
TextComponent message3 = new TextComponent(". You have earned $"+df.format(money)+". "+ChatColor.GRAY+""+ChatColor.ITALIC+"(See /money)"); TextComponent message3 = new TextComponent(". You have earned $"+df.format(money)+". "+ChatColor.GRAY+""+ChatColor.ITALIC+"(See /money)");
@ -67,7 +69,7 @@ public class ShopPurchase {
finalmsg.addExtra(message3); finalmsg.addExtra(message3);
return finalmsg; return finalmsg;
} else { } else {
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has sold "+ChatColor.YELLOW+amt+ChatColor.WHITE+" "); TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+WorldShop.getFriendlyOwnerName(customer)+ChatColor.WHITE+" has sold "+ChatColor.YELLOW+amt+ChatColor.WHITE+" ");
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]"); TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]");
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create())); message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create()));
TextComponent message3 = new TextComponent(" to you. $"+df.format(money)+" has been deducted from your bank account. "+ChatColor.GRAY+""+ChatColor.ITALIC+"(Check your shop to collect your items.)"); TextComponent message3 = new TextComponent(" to you. $"+df.format(money)+" has been deducted from your bank account. "+ChatColor.GRAY+""+ChatColor.ITALIC+"(Check your shop to collect your items.)");

View File

@ -0,0 +1,52 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class Spell {
String name;
int[] cast_time;
int[] cooldown_time;
MixedDamage[] damage;
long last_casted_spell;
public Spell(String name, int[] cast_time, int[] cooldowns) {
this.name=name;
this.cast_time=cast_time;
this.cooldown_time=cooldowns;
this.damage=null;
this.last_casted_spell=TwosideKeeper.getServerTickTime();
}
public Spell(String name, int[] cast_time, int[] cooldowns, MixedDamage[] damage) {
this.name=name;
this.cast_time=cast_time;
this.cooldown_time=cooldowns;
this.damage=damage;
this.last_casted_spell=TwosideKeeper.getServerTickTime();
}
public String getName() {
return name;
}
public int[] getCastTimes() {
return cast_time;
}
public int[] getCooldowns() {
return cooldown_time;
}
public MixedDamage[] getDamageValues() {
return damage;
}
public long getLastCastedTime() {
return last_casted_spell;
}
public void setLastCastedTime(long time) {
last_casted_spell = time;
}
}

View File

@ -0,0 +1,32 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class StringConverter {
public static Object getValue(String val, Class c) {
switch (c.getSimpleName()) {
case "Integer":{
return Integer.parseInt(val);
}
case "Double":{
return Double.parseDouble(val);
}
case "Boolean":{
return Boolean.parseBoolean(val);
}
case "EntityType":{
return EntityType.valueOf(val);
}
case "Color":{
//return Color.(val);
}
default:{
TwosideKeeper.log("WARNING! Could not convert String to Object class type "+c.getSimpleName(), 1);
return val;
}
}
//return Integer.parseInt(val);
}
}

View File

@ -12,5 +12,6 @@ public enum UpgradePath {
SCYTHE, //Falls under the 'Weapon' and 'Tool' category. SCYTHE, //Falls under the 'Weapon' and 'Tool' category.
FISHING_ROD, //Falls under the 'Weapon' category. FISHING_ROD, //Falls under the 'Weapon' category.
BASIC, //Every category that is not 'Armor'. BASIC, //Every category that is not 'Armor'.
ALL //The base category. ALL, //The base category.
PROVOKE
} }

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