Compare commits

...

64 Commits

Author SHA1 Message Date
sigonasr2 c3dff18aef Force version number change. 7 years ago
sigonasr2 862b7399d6 Rename version to 3.X. Remove daily bot message spam. 7 years ago
sigonasr2 fb8d30b9c5 Recycling Center search improved with Recycling Centers getting names. 8 years ago
sigonasr2 1a285cbf7d Add the '!search' bot command fix to master. 8 years ago
sigonasr2 ea59b4890c Implement basic Pet AI behaviors. Add /search command. 8 years ago
sigonasr2 8e9053f308 Baseline commit. 8 years ago
sigonasr2 bca56c165c Implementation of glow control, and targeting via looking at mobs. 8 years ago
sigonasr2 6d82052571 Made Labels smoother and implemented better. Implemented Custom Models 8 years ago
sigonasr2 ae2148bed7 Habitat levels properly work again. 8 years ago
sigonasr2 65f025a640 Emergency Patch. Items disappearing glitch. 8 years ago
sigonasr2 506661479c Update version number. 8 years ago
sigonasr2 ffe7d5adb5 Defender rework complete. 8 years ago
sigonasr2 b0f634c1d8 Merge branch 'daily_nerf' 8 years ago
sigonasr2 20a4a5dd14 Implement Item Queue Max Buffer to Filter Cube Handling. 8 years ago
sigonasr2 bfd185d562 Implement max item queue buffer to Filter Cube handling. 8 years ago
sigonasr2 ffb784dcd2 Merge branch 'daily_nerf' 8 years ago
sigonasr2 85ec1bf6fc Reduce the number of item operations and damage operations allowed in 8 years ago
sigonasr2 b4e8aed1f3 Merge branch 'daily_nerf' 8 years ago
sigonasr2 64901cd703 -Nerf Daily Challenge Loot, making passive daily rewards a lot less 8 years ago
sigonasr2 ba7af310ac Defender Updates included here. More to be announced. 8 years ago
sigonasr2 5bcf1a2dea Merge remote-tracking branch 'origin/vogog' 8 years ago
sigonasr2 aa1b74716a Implement Defender Stances. Begin work on Defender Rework. 8 years ago
Vogog 6b7ca1808f Slayer mode backstabs now deal 4x damage, up from 3x. The Assassin set 8 years ago
Vogog 1c79e6a3a0 Slayer mode backstabs now deal 4x damage, up from 3x. 8 years ago
sigonasr2 9874633e69 Fixed AOE bug and Earth Wave vehicle bug. 8 years ago
sigonasr2 3d9479b9f2 Implement aggro mechanics for monsters. 8 years ago
sigonasr2 7a87c6ce4f Updates to PVP, team PVP clarity, bugfixes, balance changes. 8 years ago
sigonasr2 15e872803f Fixed double death message bug. 8 years ago
sigonasr2 abe745c0ac Added things to make Team PvP more distinguishable. Added custom PVP 8 years ago
sigonasr2 f438d3e16f Implemented custom item displays using server PHP GD system. Modified 8 years ago
sigonasr2 7789fbe900 PvP Implementation completed. Rewards and loot are now taken care of. 8 years ago
sigonasr2 abc03b5dc7 Implemented PVP Arenas, improved on PVP Balancing, fixed PVP bugs. 8 years ago
sigonasr2 8570e2706f Added PVP Scoreboard displays, fleshed out more PVP bugs. Added 8 years ago
sigonasr2 245b3f5e07 Added tank buffs. Minor bugfixes. Improvements. 8 years ago
sigonasr2 28d1bca571 Vacuum Cube optimization. 8 years ago
sigonasr2 d5969900b0 +>Alustine 3 set bonus now resists Infection, Bleeding, Burn, and 8 years ago
sigonasr2 2dbb09c8e0 Basic PvP System incorporated. All attacks are working as intended and 8 years ago
sigonasr2 f5369018aa Bugfixes and Behavior fixes for Minibosses. Modified DPS Room and Tank 8 years ago
sigonasr2 1a3ab570eb Maintenance / Quick Fixes to many bugs. 8 years ago
sigonasr2 0869df5fad Daily Challenge Rooms completed, Rewards distribution system finished. 8 years ago
sigonasr2 51b39cc298 Implemented instanced room system in preparation for Challenge Rooms. 8 years ago
sigonasr2 05582519fc Organized common attributes of Bosses into a GenericBoss class. 8 years ago
sigonasr2 f404d2fd73 Finished implementation of Sniper Skeletons. 8 years ago
sigonasr2 ab164df286 Finished Knight mechanic implementation. 8 years ago
sigonasr2 5b4b52d56d Fixed all bug reports that came in earlier today. Filter Cubes work 8 years ago
sigonasr2 f5641c7e88 Fixed a Glow bug and ConcurrentModification buff removal bug that was 8 years ago
sigonasr2 7bafd04a6e Added Provoke ability to Artifact Axes. Created and began implementation 8 years ago
sigonasr2 80adc60e12 Finished implementation of all new Item Sets. Fixed soup eating bugs. 8 years ago
sigonasr2 ed2f549416 Implemented PRIDE set. Began work on Assassin sword set. Fixed bug with 8 years ago
sigonasr2 91841bba18 Majorly improved overlay system to have multiple sections that are timed 8 years ago
sigonasr2 d83be25465 Fixed Barbarian mode. Implemented Legion Barb Set. Fixed bugs with enemy 8 years ago
sigonasr2 55b6d99e91 Fixed bug involving consuming of soup stacks in off-hand. 8 years ago
sigonasr2 6ba5c21dfd Added Channeling system, fixed Suppression movement stopping for 8 years ago
sigonasr2 b3e44fdcda Updated naming scheme for monsters. Fixed minor bugs with setting 8 years ago
sigonasr2 c75d629eb3 Updates to API, ranger mode is now remembered upon logging back in. 8 years ago
sigonasr2 826467da8e Forgot getBuff() in API. 8 years ago
sigonasr2 5e14364761 Added buff methods to API. Fixed minor issues with buff system. Fixed 8 years ago
sigonasr2 dcf5629e76 Remove certain Item sets from rerollable item set list. 8 years ago
sigonasr2 c86785c16b Fixed a bug causing items to vanish while picking up partial stacks that 8 years ago
sigonasr2 30915bb6b6 Toxin Set Implementation almost completed. Fixed a major bug with item 8 years ago
sigonasr2 f9f4935463 Added functionality for Ranger sets. 8 years ago
sigonasr2 51b6759d7f Test Gitignore 8 years ago
sigonasr2 248bdd16ad Ignore more files. 8 years ago
sigonasr2 ef43bea3a0 Update TwosideKeeper .gitignore to prevent project modifications for 8 years ago
  1. 8
      .classpath
  2. 3
      .gitignore
  3. 7
      .project
  4. BIN
      TwosideKeeper.jar
  5. 2
      projectBuilder.xml
  6. 42
      src/plugin.yml
  7. 44
      src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java
  8. 4
      src/sig/plugin/TwosideKeeper/Artifact.java
  9. 2
      src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
  10. 4
      src/sig/plugin/TwosideKeeper/Boss/Arena.java
  11. 21
      src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
  12. 7
      src/sig/plugin/TwosideKeeper/Boss/MegaWither.java
  13. 1
      src/sig/plugin/TwosideKeeper/BossMonster.java
  14. 201
      src/sig/plugin/TwosideKeeper/Buff.java
  15. 163
      src/sig/plugin/TwosideKeeper/ChallengeReward.java
  16. 34
      src/sig/plugin/TwosideKeeper/ChargeZombie.java
  17. 1588
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  18. 66
      src/sig/plugin/TwosideKeeper/CustomMonster.java
  19. 4
      src/sig/plugin/TwosideKeeper/DeathManager.java
  20. 18
      src/sig/plugin/TwosideKeeper/EliteMonster.java
  21. 34
      src/sig/plugin/TwosideKeeper/Events/EntityChannelCastEvent.java
  22. 6
      src/sig/plugin/TwosideKeeper/Events/InventoryUpdateEvent.java
  23. 61
      src/sig/plugin/TwosideKeeper/Generators/DPSRoom.java
  24. 61
      src/sig/plugin/TwosideKeeper/Generators/ParkourRoom.java
  25. 83
      src/sig/plugin/TwosideKeeper/Generators/Room.java
  26. 132
      src/sig/plugin/TwosideKeeper/GlobalLoot.java
  27. 176
      src/sig/plugin/TwosideKeeper/HelperStructures/AdvancedTitle.java
  28. 10
      src/sig/plugin/TwosideKeeper/HelperStructures/ArrowBarrage.java
  29. 332
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  30. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItem.java
  31. 31
      src/sig/plugin/TwosideKeeper/HelperStructures/Book.java
  32. 81
      src/sig/plugin/TwosideKeeper/HelperStructures/BuffTemplate.java
  33. 28
      src/sig/plugin/TwosideKeeper/HelperStructures/CastBar.java
  34. 166
      src/sig/plugin/TwosideKeeper/HelperStructures/Channel.java
  35. 34
      src/sig/plugin/TwosideKeeper/HelperStructures/CloudRunnableRemoveLabel.java
  36. 207
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/ArmorStandProperties.java
  37. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
  38. 34
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/CastBarItem.java
  39. 1156
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  40. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
  41. 20
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/PVPValue.java
  42. 86
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
  43. 55
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomModel.java
  44. 27
      src/sig/plugin/TwosideKeeper/HelperStructures/DamageLabel.java
  45. 65
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/DarkSlash.java
  46. 9
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EarthWaveTask.java
  47. 35
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/EffectPool.java
  48. 67
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/HighlightCircle.java
  49. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/ReplaceBlockTask.java
  50. 45
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryBlock.java
  51. 141
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryBlockNode.java
  52. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
  53. 20
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/WindSlash.java
  54. 170
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemPickupStructure.java
  55. 579
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  56. 37
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSlot.java
  57. 19
      src/sig/plugin/TwosideKeeper/HelperStructures/Items/Scepter.java
  58. 23
      src/sig/plugin/TwosideKeeper/HelperStructures/LivingEntityDifficulty.java
  59. 89
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  60. 22
      src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java
  61. 232
      src/sig/plugin/TwosideKeeper/HelperStructures/OptionsMenu.java
  62. 246
      src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
  63. 7
      src/sig/plugin/TwosideKeeper/HelperStructures/PetState.java
  64. 204
      src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
  65. 31
      src/sig/plugin/TwosideKeeper/HelperStructures/Pronouns.java
  66. 26
      src/sig/plugin/TwosideKeeper/HelperStructures/RecyclingCenterNode.java
  67. 22
      src/sig/plugin/TwosideKeeper/HelperStructures/ShopPurchase.java
  68. 52
      src/sig/plugin/TwosideKeeper/HelperStructures/Spell.java
  69. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/UpgradePath.java
  70. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ArrayUtils.java
  71. 13
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java
  72. 43
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BookUtils.java
  73. 23
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ColoredParticle.java
  74. 17
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/InstanceFilter.java
  75. 48
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/MixedDamage.java
  76. 1606
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ParticleEffect.java
  77. 605
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ReflectionUtils.java
  78. 59
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java
  79. 15
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
  80. 12
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  81. 9
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/MathUtils.java
  82. 35
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/MovementUtils.java
  83. 10
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/PlayerUtils.java
  84. 15
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java
  85. 70
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java
  86. 31
      src/sig/plugin/TwosideKeeper/HelperStructures/VerifyItemWasMovedTask.java
  87. 34
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  88. 2
      src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
  89. 475
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  90. 4
      src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
  91. 39
      src/sig/plugin/TwosideKeeper/Modes/Summoner.java
  92. 49
      src/sig/plugin/TwosideKeeper/Monster/Bloodmite.java
  93. 28
      src/sig/plugin/TwosideKeeper/Monster/ChallengeBlaze.java
  94. 27
      src/sig/plugin/TwosideKeeper/Monster/ChallengeGhast.java
  95. 27
      src/sig/plugin/TwosideKeeper/Monster/ChallengeSpider.java
  96. 32
      src/sig/plugin/TwosideKeeper/Monster/ChallengeZombie.java
  97. 232
      src/sig/plugin/TwosideKeeper/Monster/DarkSpider.java
  98. 44
      src/sig/plugin/TwosideKeeper/Monster/DarkSpiderMinion.java
  99. 24
      src/sig/plugin/TwosideKeeper/Monster/Dummy.java
  100. 17
      src/sig/plugin/TwosideKeeper/Monster/ExplosiveMite.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -3,10 +3,10 @@
<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="C:/Users/sigon/Downloads/vogog/AutoPluginUpdate.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/vogog/GlowAPI_v1.4.4.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/vogog/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/vogog/aPlugin (99).jar"/>
<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>

3
.gitignore vendored

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

@ -24,11 +24,4 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>jgrapht</name>
<type>2</type>
<location>D:/Data/jgrapht-1.0.1/jgrapht-1.0.1/source/jgrapht-core/src/main/java</location>
</link>
</linkedResources>
</projectDescription>

Binary file not shown.

@ -3,6 +3,6 @@
<project name="TwosideKeeper.makejar" default="makejar" basedir=".">
<target name ="makejar" description="Create a jar for the TwosideKeeper project">
<jar jarfile="TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
<jar jarfile="C:\Users\sigon\Documents\Test Stream Server\plugins\TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
<jar jarfile="D:\Documents\Test Server\plugins\TwosideKeeper.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
</target>
</project>

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.11.0
version: 3.X
loadbefore: [aPlugin]
commands:
money:
@ -148,11 +148,6 @@ commands:
usage: /debugreport
permission: TwosideKeeper.fulldebugreport
permission-message: No permissions!
vac:
description: Toggle Vacuum Cube suction
usage: /vac
permission: TwosideKeeper.money
permission-message: No permissions!
equip_weapon:
description: Toggle Automatic Equipping of Weapons
usage: /equip_weapon
@ -163,3 +158,38 @@ commands:
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!

@ -26,9 +26,7 @@ public class ActionBarBuffUpdater{
public static String getActionBarPrefix(LivingEntity p) {
StringBuilder actionbardisplay = new StringBuilder("");
for (PotionEffect pe : p.getActivePotionEffects()) {
if (pe.getAmplifier()>3) {
actionbardisplay.append(ParseEffect(p,pe));
}
actionbardisplay.append(ParseEffect(p,pe));
}
actionbardisplay.append(AddAdditionalEffects(p));
//TwosideKeeper.log(actionbardisplay.toString(), 0);
@ -43,30 +41,30 @@ public class ActionBarBuffUpdater{
StringBuilder effectString=new StringBuilder("");
if (p instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)p);
if (p.getFireTicks()>=20) {
if (p.getFireTicks()>0) {
effectString.append(ChatColor.GOLD);
effectString.append("⚠");
effectString.append(AppendAmplifier((p.getFireTicks()/20)-1,false));
effectString.append(" ");
}
if (pd.lifestealstacks>4) {
/*if (pd.lifestealstacks>0) {
effectString.append(ChatColor.AQUA);
effectString.append("❣");
effectString.append(AppendAmplifier(pd.lifestealstacks-1));
effectString.append(" ");
}
if (pd.weaponcharges>4) {
}*/
/*if (pd.weaponcharges>0) {
effectString.append(ChatColor.DARK_AQUA);
effectString.append("☤");
effectString.append(AppendAmplifier(pd.weaponcharges-1));
effectString.append(" ");
}
if (pd.damagepool>4) {
}*/
/*if (pd.damagepool>0) {
effectString.append(ChatColor.DARK_PURPLE);
effectString.append("♥");
effectString.append(AppendAmplifier((int)(pd.damagepool-1)));
effectString.append(" ");
}
}*/
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() &&
ItemSet.hasFullSet((Player)p, ItemSet.SONGSTEEL)) {
effectString.append(ChatColor.GRAY);
@ -74,7 +72,7 @@ public class ActionBarBuffUpdater{
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("❈");
effectString.append(AppendAmplifier((int)(GenericFunctions.getSwiftAegisAmt((Player)p)-1)));
@ -87,6 +85,19 @@ public class ActionBarBuffUpdater{
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()) {
@ -100,7 +111,7 @@ public class ActionBarBuffUpdater{
}
effectString.append(ConvertBuffAmplifierToIcon(b.getAmplifier()));
effectString.append(" ");
if (b.getRemainingBuffTime()<=200) {
if (b.getRemainingBuffTime()<=200 || b.getDisplayTimerAlways()) {
effectString.append(ConvertBuffTimeToIcon(b.getRemainingBuffTime()));
}
effectString.append(" ");
@ -151,11 +162,18 @@ public class ActionBarBuffUpdater{
if (amplifier==12) {
return "Ⅻ";
} else {
return Integer.toString(amplifier);
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

@ -13,6 +13,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
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 static ItemStack createArtifactItem(ArtifactItem type) {
@ -191,7 +192,7 @@ public class Artifact {
(GenericFunctions.searchfor(item.getItemMeta().getLore(),ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Crafting Item") ||
item.getItemMeta().getLore().contains(ChatColor.GOLD+""+ChatColor.ITALIC+"Artifact Item") ||
(ItemUtils.LoreContainsSubstring(item, ChatColor.GOLD+""+ChatColor.BOLD+"T") &&
ItemUtils.LoreContainsSubstring(item, " Artifact")))) {
ItemUtils.LoreContainsSubstring(item, " Artifact") && TextUtils.hasNoSpaceBeforeAndAfter(ChatColor.GOLD+""+ChatColor.BOLD+"T"," Artifact",item.getItemMeta().getLore())))) {
//This is an artifact.
return true;
} else {
@ -243,6 +244,7 @@ public class Artifact {
m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
newitem.setItemMeta(m);
newitem.addUnsafeEnchantment(Enchantment.LUCK, tier);
return newitem.clone();
}
}

@ -98,7 +98,7 @@ public class AwakenedArtifact {
item = setEXP(item,totalval%1000);
item = addAP(item,totalval/1000);
double potentialred = 0.1d * getPotential(item); //5
potentialred *= 1d - (5d+GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact))/100d;
potentialred *= 1d - (5d+GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact,p))/100d;
TwosideKeeper.log("Potential is reduced by "+(potentialred)+"% from "+getPotential(item), 0);
if (getPotential(item)>potentialred) {
item = setPotential(item,(int)(getPotential(item)-potentialred));

@ -23,8 +23,9 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MaterialData;
/**
* Holds data about an arena.
* @param <E>
*/
public class Arena {
public class Arena<E> {
HashMap<Block,MaterialData> oldblocklist = new HashMap<Block,MaterialData>();
List<Material> wallmats = new ArrayList<Material>();
List<Material> floormats = new ArrayList<Material>();
@ -34,6 +35,7 @@ public class Arena {
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;

@ -32,6 +32,8 @@ import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.MonsterController;
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.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
@ -275,12 +277,12 @@ public class EliteZombie extends EliteMonster{
}
}
if (!storingenergy) {
if (storingenergy_hit>0) {
storingenergy_hit/=1.04f;
/*if (storingenergy_hit>0) {
//storingenergy_hit/=1.04f;
if (storingenergy_hit<10) {
storingenergy_hit=0;
}
}
} */
if (l.getLocation().distanceSquared(m.getLocation())>8192 && !leaping && last_leap_time+20<TwosideKeeper.getServerTickTime()) {
//Lose the target.
targetlist.remove(l);
@ -367,7 +369,7 @@ public class EliteZombie extends EliteMonster{
if (targetlist.size()>4) {
double hpgain = m.getMaxHealth()*(0.25*(targetlist.size()-4));
m.setMaxHealth(baseHP+hpgain);
m.setHealth(m.getHealth()+hpgain);
GenericFunctions.HealEntity(m,hpgain);
}
}
if (!participantlist.contains(damager) && (damager instanceof Player)) {
@ -400,6 +402,7 @@ public class EliteZombie extends EliteMonster{
for (int i=0;i<targetlist.size();i++) {
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);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
@ -410,7 +413,7 @@ public class EliteZombie extends EliteMonster{
Player target = ChooseRandomTarget();
if (target!=null) {
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++) {
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!\"");
@ -482,7 +485,8 @@ public class EliteZombie extends EliteMonster{
Monster nm = (Monster)m.getWorld().spawnEntity(getNearbyFreeLocation(m.getLocation()),choice);
Player target = targetlist.get((int)(Math.random() * targetlist.size()));
nm.setTarget(target);
MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
//MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
MonsterController.convertLivingEntity(nm, LivingEntityDifficulty.HELLFIRE);
}
if (CustomDamage.getPercentHealthRemaining(m)<10) {
Player target = targetlist.get((int)(Math.random() * targetlist.size()));
@ -491,7 +495,8 @@ public class EliteZombie extends EliteMonster{
nm.setPowered(true);
}
nm.setTarget(target);
MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
//MonsterController.convertMonster(nm, MonsterDifficulty.HELLFIRE);
MonsterController.convertLivingEntity(nm, LivingEntityDifficulty.HELLFIRE);
}
}
@ -601,7 +606,7 @@ public class EliteZombie extends EliteMonster{
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,20*4,0,p);
TwosideKeeper.log("Got hit for "+storingenergy_hit+" damage!", 2);
//GenericFunctions.removeNoDamageTick(p, m);
if (CustomDamage.ApplyDamage(storingenergy_hit, m, p, null, "Stored Energy", CustomDamage.IGNOREDODGE|CustomDamage.IGNORE_DAMAGE_TICK)) {
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);
storingenergy_hit=0;
p.setVelocity(m.getLocation().getDirection().multiply(2.0f));

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

@ -18,6 +18,7 @@ import org.bukkit.potion.PotionEffect;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@Deprecated
public class BossMonster {
private String name;
private double maxhp;

@ -8,6 +8,7 @@ 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 {
@ -17,7 +18,18 @@ public class Buff {
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;
@ -25,6 +37,51 @@ public class Buff {
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) {
@ -38,6 +95,10 @@ public class Buff {
}
}
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;
@ -80,6 +141,17 @@ public class Buff {
}
}
/**
* 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.
@ -108,13 +180,54 @@ public class Buff {
}
}
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;
@ -122,6 +235,9 @@ public class Buff {
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;
@ -166,47 +282,85 @@ public class Buff {
}
}
}
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);
pd.buffs.remove(name);
Buff b = pd.buffs.remove(name);
if (b!=null && !b.buffCanBeRemoved()) {
pd.buffs.put(name, b);
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.buffs.remove(name);
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;
}
private static boolean hasBuffExpired(Buff b) {
/**
* Whether or not this buff has ran out of time.
*/
public static boolean hasBuffExpired(Buff b) {
if (b.expireTime<TwosideKeeper.getServerTickTime()) {
return false;
} else {
@ -214,31 +368,66 @@ public class Buff {
}
}
/**
* 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;
}
}

@ -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),
};
}
}
}
}

@ -6,6 +6,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Monster;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlock;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ChargeZombie {
@ -38,8 +39,34 @@ public class ChargeZombie {
Math.abs(z)<outerradius &&
(aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) ||
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 (!(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 (m.getTarget()!=null && m.getTarget().isValid()) {
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;
//Break it.
if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) {
@ -126,6 +153,9 @@ public class ChargeZombie {
public static boolean ChanceToBreak(Block b) {
int blocktoughness = 0;
if (TemporaryBlock.isTemporaryBlock(b) || !aPlugin.API.isDestroyable(b)) {
return false;
}
switch (b.getType()) {
case BEDROCK: {
blocktoughness=999999;

File diff suppressed because it is too large Load Diff

@ -5,6 +5,11 @@ 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;
@ -22,6 +27,10 @@ public class CustomMonster {
return !m.isDead();
}
public MixedDamage getBasicAttackDamage() {
return MixedDamage.v(0,0,0);
}
/*
public boolean hasTarget() {
return (m.getTarget()!=null)?true:false;
@ -35,9 +44,9 @@ public class CustomMonster {
}
}
public static boolean recognizeMonsterConditions(LivingEntity m) {
/*public boolean recognizeMonsterConditions(LivingEntity m) {
return false;
}
}*/
public void runTick() {
@ -46,7 +55,58 @@ public class CustomMonster {
public void customHitHandler() {
}
public void customHitHandler(Player p, double dmg) {
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;
}
}

@ -27,8 +27,8 @@ public class DeathManager {
public static List<DeathStructure> ds = new ArrayList<DeathStructure>();
public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) {
ds.add(new DeathStructure(deathinv,deathloc,p));
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),5);
ds.add(new DeathStructure(deathinv,deathloc.clone(),p));
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),0);
}
public static void removeDeathStructure(Player p) {
ds.remove(getDeathStructure(p));

@ -25,6 +25,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
@ -127,7 +128,7 @@ public class EliteMonster {
}
}
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();
}
@ -139,10 +140,14 @@ public class EliteMonster {
}
protected void displayHealthbarToNearbyPlayers() {
for (Player p : Bukkit.getOnlinePlayers()) {
if (m.getLocation().distanceSquared(p.getLocation())<=2500) {
bar.addPlayer(p);
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();
}
}
@ -196,6 +201,9 @@ public class EliteMonster {
public GlowAPI.Color getGlow() {
GlowAPI.Color col = GlowAPI.Color.DARK_PURPLE;
if (m.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) {
col = GlowAPI.Color.DARK_BLUE;
}
if (Channel.isChanneling(m)) {
col = GlowAPI.Color.YELLOW;
}
if (storingenergy) {
@ -315,6 +323,8 @@ public class EliteMonster {
Player p = targetlist.get((int)(Math.random() * targetlist.size()));
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS,20*1,7,p);
m.setTarget(p);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.increaseAggroWhileMultiplyingAllOthers(p, 0, 0.25);
TwosideKeeper.log("Set new target to "+p.getName(), 2);
return p;
} else {

@ -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;
}
}

@ -42,8 +42,10 @@ public class InventoryUpdateEvent extends Event{
}
public static void TriggerUpdateInventoryEvent(Player p, ItemStack item, UpdateReason reason) {
InventoryUpdateEvent ev = new InventoryUpdateEvent(p, item, reason);
Bukkit.getPluginManager().callEvent(ev);
if (item!=null) {
InventoryUpdateEvent ev = new InventoryUpdateEvent(p, item, reason);
Bukkit.getPluginManager().callEvent(ev);
}
//TwosideKeeper.log("Triggered because of "+reason, 0);
}

@ -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();
}
}
}
}
}
}

@ -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();
}
}
}
}
}
}

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

@ -1,12 +1,16 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ArrowBarrage implements Runnable{
@ -32,7 +36,11 @@ public class ArrowBarrage implements Runnable{
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 4, 9, p, true);
if (shots_left>0) {
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);
}
}
}

@ -17,8 +17,10 @@ import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.AwakenedArtifact;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.PVP;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Common.PVPValue;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
public enum ArtifactAbility {
@ -27,25 +29,25 @@ public enum ArtifactAbility {
//Temporary abilities: Work for 1 level and wear off afterward.
//Weapon Abilities
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,1.0},
new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,1,UpgradePath.BASIC,1),
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,1.0},
new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,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.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[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,1,UpgradePath.BASIC,1),
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},
new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},1000,1,UpgradePath.WEAPON,1),
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},
new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},100,1,UpgradePath.WEAPON,1),
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},
new double[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,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.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[]{0.5,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.83,0.86,0.89,0.92,0.95,1.0},10000,15,UpgradePath.WEAPON,1),
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 PVPValue(15,1.0),10000,1,UpgradePath.BASIC,1),
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 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.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 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.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 PVPValue(15,0.1),1000,1,UpgradePath.WEAPON,1),
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 PVPValue(30,0.5),100,1,UpgradePath.WEAPON,1),
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 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.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 PVPValue(1,0.5),10000,15,UpgradePath.WEAPON,1),
//Bow Abilities
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},
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},10000,15,UpgradePath.BOW,1),
SIEGESTANCE("Siege Stance",ChatColor.GRAY+"[Unimplemented] Activate by Sneaking for three seconds. Sneak again to de-activate.\n\n"
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 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"
+ "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,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},
@ -53,31 +55,31 @@ public enum ArtifactAbility {
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,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},
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),
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
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},
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,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.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},10000,1,UpgradePath.ARMOR,1),
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 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.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 PVPValue(30,0.25),10000,1,UpgradePath.ARMOR,1),
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},10000,1,UpgradePath.ARMOR,1),
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[]{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,1),
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[]{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,100,UpgradePath.ARMOR,1),
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(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,1),
new PVPValue(0,10),10,25,UpgradePath.ARMOR,1),
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,2),
new PVPValue(0,0.2),100,40,UpgradePath.ARMOR,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},100,40,UpgradePath.ARMOR,10),
new PVPValue(0,0.05),100,40,UpgradePath.ARMOR,10),
//Sword abilities
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",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[]{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},10000,10,UpgradePath.SWORD,1),
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 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[]{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},10000,40,UpgradePath.SWORD,1),
new PVPValue(50,0.1),10000,40,UpgradePath.SWORD,1),
//Pickaxe abilities
/*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},
@ -85,22 +87,22 @@ public enum ArtifactAbility {
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,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 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},10000,40,UpgradePath.PICKAXE,1),
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 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},10000,100,UpgradePath.PICKAXE,40),
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 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},250,20,UpgradePath.PICKAXE,5),
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 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},10000,350,UpgradePath.PICKAXE,1),
new PVPValue(100,2.0),10000,350,UpgradePath.PICKAXE,1),
//Shovel abilities
SUPPRESS("Suppression","Suppresses a mob on hit for [VAL] seconds.\n\n"
+ "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},100,10,UpgradePath.SHOVEL,10),
new PVPValue(10,0.02),100,10,UpgradePath.SHOVEL,10),
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},10000,40,UpgradePath.SHOVEL,1),
new PVPValue(15,3.0),10000,40,UpgradePath.SHOVEL,1),
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},10000,100,UpgradePath.SHOVEL,1),
new PVPValue(15,2.0),10000,100,UpgradePath.SHOVEL,1),
//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},
@ -109,63 +111,62 @@ public enum ArtifactAbility {
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 double[]{},10000,1,UpgradePath.AXE,1),
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 double[]{},10000,1,UpgradePath.AXE,1),
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 double[]{},100,40,UpgradePath.AXE,3),
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 double[]{},100,100,UpgradePath.AXE,3),
new PVPValue(30,0.8),100,100,UpgradePath.AXE,3),
//Scythe abilities
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},10000,1,UpgradePath.SCYTHE,1),
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[]{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},10000,10,UpgradePath.SCYTHE,1),
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.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,1),
new PVPValue(1,1.0),100,1000,UpgradePath.SCYTHE,1),
//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[]{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},10000,1,UpgradePath.ALL,1),
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(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,1),
new PVPValue(0,10.0),10,10,UpgradePath.ALL,1),
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,2.0,2.0,2.0,2.0,2.0},1,10,UpgradePath.ALL,1),
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,-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,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),*/
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,0.0,0.0,0.0,0.0,0.0},100,1,UpgradePath.ALL,1),
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,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,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),*/
//Bad stuff
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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},
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,1),
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};
@ -179,18 +180,23 @@ public enum ArtifactAbility {
int requirement;
UpgradePath upgrade;
int apcost;
PVPValue pvpval;
ArtifactAbility(String name, String desc, double[] baseval, double[] decayval, int maxlv, int requirement, UpgradePath upgrade, int apcost) {
ArtifactAbility(String name, String desc, double[] baseval, PVPValue pvpval, int maxlv, int requirement, UpgradePath upgrade, int apcost) {
this.name=name;
this.desc=desc;
this.baseval=baseval;
this.decayval=decayval;
this.maxlv=maxlv;
this.requirement=requirement;
AwakenedArtifact.ability_map.put(this,this.name);
AwakenedArtifact.name_map.put(this.name,this);
this.upgrade=upgrade;
this.apcost=apcost;
this.pvpval=pvpval;
}
public PVPValue getPVPValue() {
return pvpval;
}
private static String LevelCost(int i) {
@ -215,12 +221,22 @@ public enum ArtifactAbility {
public double GetBaseValue(int tier) {
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) {
if (tier<=0) {tier=1;}
return decayvals[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() {
@ -231,23 +247,6 @@ public enum ArtifactAbility {
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);*/
//return Math.pow(ability.GetBaseValue(artifacttier)*abilitylevel, ability.GetDecayValue(artifacttier));
return ability.GetBaseValue(artifacttier) * Math.pow(abilitylevel, ability.GetDecayValue(artifacttier));
}
public static HashMap<ArtifactAbility,Integer> getEnchantments(ItemStack item) {
HashMap<ArtifactAbility,Integer> abilities = new HashMap<ArtifactAbility,Integer>();
if (GenericFunctions.isArtifactEquip(item)) {
@ -265,7 +264,6 @@ public enum ArtifactAbility {
newstring+=" "+splitstring[j];
}
}
TwosideKeeper.log(newstring,5);
//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]));
}
@ -364,6 +362,7 @@ public enum ArtifactAbility {
}
public static boolean containsEnchantment(ArtifactAbility ability, ItemStack item) {
//TwosideKeeper.log("Enchantment list: "+getEnchantments(item), 0);
return getEnchantments(item).containsKey(ability);
}
@ -441,6 +440,13 @@ public enum ArtifactAbility {
return true;
}
}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:{
if (!item.getType().toString().contains("HELMET") &&
!item.getType().toString().contains("CHESTPLATE") &&
@ -489,13 +495,13 @@ public enum ArtifactAbility {
if (ability.GetMaxLevel()>level && ability.GetMinLevel()<=AwakenedArtifact.getLV(item)) {
//This is allowed. Proceed.
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!");
if (ability.equals(ArtifactAbility.GRACEFULDODGE) ||
/*if (ability.equals(ArtifactAbility.GRACEFULDODGE) ||
ability.equals(ArtifactAbility.SUPPRESS)) {
//Remove a level from using a temporary ability.
AwakenedArtifact.addAP(item, -9);
}
}*/
if (ability.equals(ArtifactAbility.GROWTH)) {
removeEnchantment(ArtifactAbility.GROWTH,item);
AwakenedArtifact.setPotential(item, 20);
@ -511,7 +517,7 @@ public enum ArtifactAbility {
tc.addExtra(ac);
tc.addExtra(" to open up the ability upgrade menu.");;*/
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 {
if (ability.GetMaxLevel()<=level) {
@ -529,7 +535,7 @@ public enum ArtifactAbility {
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;
String lockedreason = "";
if (AwakenedArtifact.getLV(targetitem)<ability.GetMinLevel() || getEnchantmentLevel(ability,targetitem)>=ability.GetMaxLevel() || AwakenedArtifact.getAP(targetitem)<ability.getAPCost()) {
@ -548,9 +554,9 @@ public enum ArtifactAbility {
}
String displaystring = "";
if (enchantlevel>0) {
displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval);
displaystring = displayDescriptionUpgrade(ability,ArtifactUtils.getArtifactTier(targetitem),enchantlevel,enchantlevel+1,playerdmgval, PVP.isPvPing(p));
} else {
displaystring = displayDescription(ability,ArtifactUtils.getArtifactTier(targetitem),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)+"] ");
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()));
@ -567,11 +573,11 @@ public enum ArtifactAbility {
}
}
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem) {
return GenerateMenu(path,playerdmgval,targetitem,0);
public static TextComponent GenerateMenu(UpgradePath path, double playerdmgval, ItemStack targetitem, Player p) {
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");
int i=0;
TextComponent text = new TextComponent("");
@ -583,82 +589,83 @@ public enum ArtifactAbility {
path==UpgradePath.FISHING_ROD ||
path==UpgradePath.SCYTHE ||
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(ARMOR_PEN,playerdmgval,targetitem,slot);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(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,p);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) {
text=DisplayAbility(LIFESTEAL,playerdmgval,targetitem,slot);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(CRIT_DMG,playerdmgval,targetitem,slot);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(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,p);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,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
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(COMBO,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,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else
if (path==UpgradePath.AXE) {
text=DisplayAbility(PROVOKE,playerdmgval,targetitem,slot,p);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);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESTACK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESUCK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HIGHDIVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
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
if (path==UpgradePath.FISHING_ROD) {
} else
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(SIEGESTANCE,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(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(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
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(DEATHMARK,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,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
}
}
} else
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(HEALTH,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);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(SHADOWWALKER,playerdmgval,targetitem,slot);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(DODGE,playerdmgval,targetitem,slot);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(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,p);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,p);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,p);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,p);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else
if (path==UpgradePath.TOOL || //Tool category.
path==UpgradePath.SHOVEL ||
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(ARMOR_PEN,playerdmgval,targetitem,slot);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(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,p);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) {
text=DisplayAbility(SUPPRESS,playerdmgval,targetitem,slot);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(EARTHWAVE,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,p);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
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");}
if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) {
text=DisplayAbility(MINES,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(OREHARVESTER,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(IMPACT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(FORCESTRIKE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
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(AUTOREPAIR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(GROWTH,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,p);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(REMOVE_CURSE,playerdmgval,targetitem,slot);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(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;
@ -668,42 +675,42 @@ public enum ArtifactAbility {
return ChatColor.LIGHT_PURPLE+oretype+": "+ChatColor.YELLOW+" "+bonus;
}
public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval) { //Level to display information for.
public static String displayDescription(ArtifactAbility ability, int tier, int abilitylv, double playerdmgval, boolean pvp) { //Level to display information for.
String msg = ability.GetDescription();
DecimalFormat df = new DecimalFormat("0.00");
msg=msg.replace("[VAL]", ChatColor.BLUE+df.format(calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[200VAL]", ChatColor.BLUE+df.format(200+calculateValue(ability,tier,abilitylv))+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("[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,pvp))+ChatColor.RESET);
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("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+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("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET);
msg=msg.replace("[ERUPTIONVAL]", ChatColor.BLUE+df.format(35+calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[EARTHWAVEVAL]", ChatColor.BLUE+df.format(20+calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[AOEVAL]", ChatColor.BLUE+df.format(1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[POTVAL]", ChatColor.BLUE+df.format(5+calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[GRACEFULVAL]", ChatColor.BLUE+df.format(0.1+calculateValue(ability,tier,abilitylv))+ChatColor.RESET);
msg=msg.replace("[FORCESTRIKEVAL]", ChatColor.BLUE+df.format(60+calculateValue(ability,tier,abilitylv))+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;
}
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();
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("[200VAL]", ChatColor.BLUE+DisplayChangedValue(df.format(200+calculateValue(ability,tier,fromlv)),df.format(200+calculateValue(ability,tier,tolv)))+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("[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,pvp)),df.format(200+calculateValue(ability,tier,tolv,pvp)))+ChatColor.RESET);
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("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3));
msg=msg.replace("[DODGEVAL]", df.format(tier));
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))+ChatColor.RESET,df.format(35+calculateValue(ability,tier,tolv))+ChatColor.RESET));
msg=msg.replace("[EARTHWAVEVAL]", DisplayChangedValue(df.format(20+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(20+calculateValue(ability,tier,tolv))+ChatColor.RESET));
msg=msg.replace("[AOEVAL]", DisplayChangedValue(df.format(1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(1+calculateValue(ability,tier,tolv))+ChatColor.RESET));
msg=msg.replace("[POTVAL]", DisplayChangedValue(df.format(5+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(5+calculateValue(ability,tier,tolv))+ChatColor.RESET));
msg=msg.replace("[GRACEFULVAL]", DisplayChangedValue(df.format(0.1+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(0.1+calculateValue(ability,tier,tolv))+ChatColor.RESET));
msg=msg.replace("[FORCESTRIKEVAL]", DisplayChangedValue(df.format(60+calculateValue(ability,tier,fromlv))+ChatColor.RESET,df.format(60+calculateValue(ability,tier,tolv))+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;
}
@ -714,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;
}
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));
}
}
}

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

@ -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;
}
}

@ -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)
}

@ -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());
}
}
}

@ -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;
}
}
}

@ -1,34 +0,0 @@
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.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 CloudRunnableRemoveLabel implements Runnable{
AreaEffectCloud aec;
Location loc;
String str;
double spd;
int duration;
public CloudRunnableRemoveLabel(Location loc,String str,double spd,int duration) {
this.loc=loc;
this.str=str;
this.spd=spd;
this.duration=duration;
}
@Override
public void run() {
aec = EntityUtils.CreateOverlayText(loc, str);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, new CloudRunnable(aec,spd,duration), 1);
}
}

@ -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);
}
}

@ -5,6 +5,8 @@ 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.
@ -34,6 +36,7 @@ public class BlockModifyQueue{
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);}
}
}

@ -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;
}
}

@ -95,6 +95,7 @@ public class Habitation {
public void addKillToLocation(Location location) {
String locationHash = getLocationHash(location);
//TwosideKeeper.log("Location hash is "+locationHash, 0);
locationhashes.put(locationHash, locationhashes.getOrDefault(locationHash, 0) + 1);
}
@ -132,7 +133,7 @@ public class Habitation {
public String getLocationHash(Location location) {
if (location != null) {
return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().toString();
return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().getName();
} else {
TwosideKeeper.log(
"[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!",

@ -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;
}
}

@ -128,6 +128,50 @@ public class CustomItem {
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");
@ -154,6 +198,48 @@ public class CustomItem {
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();

@ -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()));
}
}
}
}

@ -4,6 +4,7 @@ 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;
@ -11,27 +12,35 @@ import org.bukkit.entity.FallingBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
public class CloudRunnable implements Runnable{
AreaEffectCloud aec;
public class DamageLabel{
ArmorStand aec;
double spd;
int duration;
public CloudRunnable(AreaEffectCloud aec, double spd, int duration) {
public DamageLabel(ArmorStand aec, double spd, int duration) {
this.aec=aec;
this.spd=spd;
this.duration=duration;
}
@Override
public void run() {
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), 2);
}
/*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));
aec.remove();
if (duration<0) {
aec.remove();
return false;
}
return true;
} else {
return false;
}
}
public void cleanup() {
aec.remove();
}
}

@ -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);}
}
}

@ -7,6 +7,7 @@ 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{
@ -29,7 +30,7 @@ public class EarthWaveTask implements Runnable{
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) {
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);
@ -42,7 +43,7 @@ public class EarthWaveTask implements Runnable{
}
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) {
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);
@ -55,7 +56,7 @@ public class EarthWaveTask implements Runnable{
}
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) {
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);
@ -68,7 +69,7 @@ public class EarthWaveTask implements Runnable{
}
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) {
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);

@ -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());
}
}

@ -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();
}
}

@ -23,9 +23,9 @@ public class ReplaceBlockTask implements Runnable{
}
public static void CleanupTemporaryBlock(TemporaryBlock tb) {
if (tb.getBlock()!=null &&
if (tb.getBlock()!=null /*&&
tb.getBlock().getType()==tb.getConvertedMaterial() &&
tb.getBlock().getData()==tb.getConvertedData()) {
tb.getBlock().getData()==tb.getConvertedData()*/) {
tb.getBlock().setType(tb.getOriginalMaterial());
tb.getBlock().setData(tb.getOriginalData());
}

@ -1,6 +1,7 @@
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;
@ -138,6 +139,7 @@ public class TemporaryBlock {
sb.append(bl.getLocation().getWorld().getName());
sb.append("_");
sb.append(specialKey);
//TwosideKeeper.log("Checking key: "+sb.toString(), 0);
return sb.toString();
} else {
return "";
@ -193,22 +195,25 @@ public class TemporaryBlock {
public static boolean isTemporaryBlock(Block b) {
return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
}
public static boolean isStandingOnSpecialBlock(Player p, String specialKey) {
public static boolean isStandingOnSpecialBlock(Location l, String specialKey) {
//return TwosideKeeper.temporaryblocks.containsKey(TemporaryBlock.getLocationKey(b));
Block b = p.getLocation().getBlock();
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(Player p, double range, String specialKey) {
Block b = p.getLocation().getBlock();
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;
@ -220,4 +225,36 @@ public class TemporaryBlock {
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--;
}
}
}
}

@ -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;
}
}

@ -21,7 +21,7 @@ public class TemporaryLava {
if (b.getType()==Material.AIR) {
b.setType(Material.LAVA);
b.setData((byte)8);
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,Material.LAVA));
//TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,Material.LAVA));
}
}
this.b=b;

@ -3,6 +3,7 @@ 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;
@ -11,11 +12,13 @@ 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;
double dmg;
LivingEntity l;
MixedDamage dmg;
long lasteffect;
long death_time;
final static int EFFECT_DENSITY = 20;
@ -27,6 +30,15 @@ public class WindSlash {
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();
@ -46,10 +58,10 @@ public class WindSlash {
}
private void damageNearbyTargets() {
GenericFunctions.DealDamageToNearbyMobs(loc, dmg, SLASH_SIZE, false, 0, sourcep, sourcep.getEquipment().getItemInMainHand(), false, "Wind Slash");
GenericFunctions.DealDamageToNearbyMobs(loc, dmg.getDmgComponent(), SLASH_SIZE, false, 0, sourcep, sourcep.getEquipment().getItemInMainHand(), false, "Wind Slash");
}
private boolean moveWindSlash() {
protected boolean moveWindSlash() {
Location origloc = loc.clone();
Vector move = origloc.getDirection().setY(origloc.getDirection().getY()/1.4).multiply(SPEED_MULT);
float dist = SPEED_MULT;
@ -64,7 +76,7 @@ public class WindSlash {
//TwosideKeeper.log("New Location: "+loc, 0);
}
private void createParticles() {
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();

@ -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

@ -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);
}
}
}

@ -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"));
}
}

@ -23,17 +23,26 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public enum LivingEntityDifficulty {
NORMAL(0),
DANGEROUS(500),
DEADLY(1000),
HELLFIRE(5000),
ELITE(10000),
END(6000);
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) {
LivingEntityDifficulty(int rating,String diffString) {
this.rating=rating;
this.difficultyString=diffString;
}
public String getDifficultyString() {
return difficultyString;
}
/*private ItemStack Artifact() {

@ -3,6 +3,7 @@ package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
@ -17,6 +18,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import aPlugin.DropItem;
import aPlugin.DropMaterial;
import aPlugin.API.Chests;
import aPlugin.Drop;
import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Drops.SigDrop;
@ -185,7 +187,8 @@ public class Loot {
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,70));
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));
@ -197,6 +200,11 @@ public class Loot {
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));
}
@ -555,7 +563,9 @@ public class Loot {
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 ");
switch (set) {
case PANROS:{
case PANROS:
case WINDRY:
case LUCI:{
if (item.getType().toString().contains("SWORD")) {
} else
@ -564,9 +574,11 @@ public class Loot {
allowed = false;
}
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;
case SONGSTEEL:{
case SONGSTEEL:
case PROTECTOR:
case SUSTENANCE:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.SHIELD);
tierbonus/=(custom)?1:2;
@ -576,9 +588,11 @@ public class Loot {
allowed = false;
}
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;
case DAWNTRACKER:{
case DAWNTRACKER:
case LEGION:
case PRIDE:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.valueOf(item.getType().toString().replace("SWORD","")+"AXE"));
} else
@ -587,50 +601,39 @@ public class Loot {
allowed = false;
}
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;
case LORASYS:{
case LORASYS:
case ASSASSIN:
case STEALTH:{
if (!item.getType().toString().contains("SWORD")) {
allowed = false;
}
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case JAMDAK:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
} else
if (!item.getType().name().contains("LEATHER") && !item.getType().name().contains("BOW")) {
allowed = false;
}
set_name = prefix+"Jamdak Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case DARNYS:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
} else
if (!item.getType().toString().contains("LEATHER") && !item.getType().name().contains("BOW")) {
allowed = false;
}
set_name = prefix+"Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case ALIKAHN:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
} else
if (!item.getType().toString().contains("LEATHER") && !item.getType().name().contains("BOW")) {
allowed = false;
}
set_name = prefix+"Alikahn Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case JAMDAK:
case SHARD:
case TOXIN:
case DARNYS:
case ALIKAHN:
case LORASAADI:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
} else
if (!item.getType().toString().contains("LEATHER") && !item.getType().name().contains("BOW")) {
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;
}
set_name = prefix+"Lorasaadi Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case GLADOMAIN:{
//item.setType(Material.SKULL_ITEM); else
@ -642,7 +645,7 @@ public class Loot {
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Gladomain Slayer Amulet";
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Amulet";
}break;
case MOONSHADOW:{
if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -654,7 +657,7 @@ public class Loot {
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Moonshadow Slayer Trinket";
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Trinket";
}break;
case WOLFSBANE:{
if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -666,7 +669,7 @@ public class Loot {
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Wolfsbane Slayer Ornament";
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Ornament";
}break;
case ALUSTINE:{
if (!item.getType().toString().contains("SKULL_ITEM")) {
@ -678,7 +681,7 @@ public class Loot {
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Alustine Slayer Charm";
set_name = prefix+GenericFunctions.CapitalizeFirstLetters(set.name())+" Slayer Charm";
}break;
case BLITZEN:
case COMET:
@ -700,7 +703,7 @@ public class Loot {
int tier = tierbonus;
do {tier++;} while(Math.random()<=0.25);
if (allowed) {
lore.addAll(ItemSet.GenerateLore(set,tier));
lore.addAll(ItemSet.GenerateLore(set,tier,null));
ItemMeta m = item.getItemMeta();
m.setLore(lore);
m.setDisplayName(set_name);

@ -24,18 +24,28 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@Deprecated
public enum MonsterDifficulty {
NORMAL,
DANGEROUS,
DEADLY,
HELLFIRE,
ELITE,
END;
NORMAL(LivingEntityDifficulty.NORMAL),
DANGEROUS(LivingEntityDifficulty.DANGEROUS),
DEADLY(LivingEntityDifficulty.DEADLY),
HELLFIRE(LivingEntityDifficulty.HELLFIRE),
ELITE(LivingEntityDifficulty.ELITE),
END(LivingEntityDifficulty.END);
LivingEntityDifficulty diff;
MonsterDifficulty(LivingEntityDifficulty diff) {
this.diff=diff;
}
/*private ItemStack Artifact() {
sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3);
return null;
}*/
public LivingEntityDifficulty getLivingEntityDifficultyEquivalent() {
return this.diff;
}
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger, Entity damager, Monster m) {
return RandomizeDrops(dropmult,isBoss,false,isRanger,damager,m);
}

@ -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();
}
}

@ -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;
}
}

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

@ -4,115 +4,29 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PartyManager;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum PlayerMode {
STRIKER(ChatColor.RED,"S","Striker",
ChatColor.RED+""+ChatColor.BOLD+"Striker mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Strikers' when they only carry a sword in their main hand. No off-hand items.\n"
+ ChatColor.GRAY+"->10% passive damage increase.\n"
+ 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 40% 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+"->Barbarians deal 20% more damage for every 20% of an enemy's missing health.\n"
+ ChatColor.GRAY+"->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.WHITE+"->Barbarians do not instantly take full damage when hit. Instead, the HP is stored in a 'Damage Pool' and distributed every second.\n"
+ ChatColor.GRAY+"->If Barbarians have points in their 'Damage Pool', they will take up to 15 damage (+1% of their damage pool) every second. The amount taken goes down by wearing Barbarian gear.\n"
+ ChatColor.WHITE+"->When a monster is killed by a Barbarian, the amount of remaining damage in their Damage Pool is divided by 4.\n"
+ ChatColor.GRAY+"->Extra health from Lifestealing that is not used for healing your health will heal up your Damage Pool instead."
+ 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"
STRIKER(ChatColor.RED,"S","Striker",Book.STRIKERGUIDE),
RANGER(ChatColor.DARK_GREEN,"R","Ranger",Book.RANGERGUIDE),
DEFENDER(ChatColor.GRAY,"D","Defender",Book.DEFENDERGUIDE),
BARBARIAN(ChatColor.GOLD,"B","Barbarian",Book.BARBARIANGUIDE
),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",
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 Pouch in their off hand.\n"
+ ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them in their Bauble Pouch. 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"),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",Book.SLAYERGUIDE),
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"),
NORMAL(ChatColor.WHITE,"A","Adventurer",
ChatColor.WHITE+""+ChatColor.BOLD+"Adventurer mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Adventurers' by default.\n"
+ ChatColor.GRAY+"->Adventurers gain +10 Health.\n"
+ ChatColor.WHITE+"->Adventurers gain +20% Damage Reduction.\n"
+ ChatColor.GRAY+"->Adventurers gain +50% Health Regeneration.\n"
+ ChatColor.WHITE+"->If Adventurers are killed, their Buy-Backs are 50% cheaper.\n"
+ ChatColor.GRAY+"->Adventurers do not get exhausted when performing light activities.\n");
Book.SUMMONERGUIDE),
NORMAL(ChatColor.WHITE,"A","Adventurer",Book.ADVENTURERGUIDE);
;
final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player.
ChatColor col=ChatColor.WHITE;
String symbol="";
Book storedBook;
public ChatColor getColor() {
return col;
@ -127,32 +41,39 @@ public enum PlayerMode {
}
public static PlayerMode getPlayerMode(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (Check_isSlayer(p)) {
if (pd.lastmode!=PlayerMode.SLAYER) {pd.slayermodehp=p.getHealth();}
pd.lastmode=PlayerMode.SLAYER;
} else {
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;
if (p!=null && p.isValid() && p.isOnline() && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (Check_isSlayer(p)) {
if (pd.lastmode!=PlayerMode.SLAYER) {pd.slayermodehp=p.getHealth();}
pd.lastmode=PlayerMode.SLAYER;
} 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) {
@ -228,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) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -334,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 desription="";
Book helperBook;
public String getDesription() {
return desription;
public Book getBook() {
return helperBook;
}
public void setDesription(String desription) {
this.desription = desription;
public void setBook(Book book) {
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.symbol=abbreviation;
this.name=fullname;
this.desription=desc;
this.helperBook=descBook;
}
public static boolean isLeatherPlayerMode(PlayerMode mode) {
return mode==PlayerMode.RANGER || mode==PlayerMode.SUMMONER;
}
}

@ -205,7 +205,7 @@ public class Pronouns {
"melon",
"pie",
};
}
}break;
case 16:{
pronouns = new String[]{
"thought living inside a block was a good idea.",
@ -216,7 +216,7 @@ public class Pronouns {
"somehow ended up trapped inside a block.",
"ended up suffocating.",
};
}
}break;
case 17:{
pronouns = new String[]{
"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 tangled by webs.",
};
}
}break;
case 18:{
pronouns = new String[]{
"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.",
"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)];
}

@ -6,23 +6,21 @@ public class RecyclingCenterNode {
private Location loc;
private boolean toolsAllowed=true;
private boolean itemsAllowed=true;
private String recyclingCenterName="Recycling Center";
public RecyclingCenterNode(Location loc) {
this.loc=loc.clone();
this.toolsAllowed=true;
this.itemsAllowed=true;
public RecyclingCenterNode(Location loc, String name) {
this(loc,name,true);
}
public RecyclingCenterNode(Location loc, boolean toolsAllowed) {
this.loc=loc.clone();
this.toolsAllowed=toolsAllowed;
this.itemsAllowed=true;
public RecyclingCenterNode(Location loc, String name, boolean toolsAllowed) {
this(loc,name,toolsAllowed,true);
}
public RecyclingCenterNode(Location loc, boolean toolsAllowed, boolean itemsAllowed) {
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() {
@ -42,11 +40,19 @@ public class RecyclingCenterNode {
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(x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
return "RecyclingCenterNode(Name="+recyclingCenterName+",x="+loc.getBlockX()+",y="+loc.getBlockY()+",z="+loc.getBlockZ()+",tools="+toolsAllowed+",itemsAllowed="+itemsAllowed+")";
}
}

@ -1,7 +1,9 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.text.DecimalFormat;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack;
@ -11,14 +13,14 @@ import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ShopPurchase {
String player;
String customer;
UUID player;
UUID customer;
ItemStack item;
double money;
int amt;
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.customer=customer;
this.item=item;
@ -27,7 +29,7 @@ public class ShopPurchase {
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.customer=customer;
this.item=item;
@ -36,11 +38,11 @@ public class ShopPurchase {
this.sell=sell;
}
public String getSeller() {
return player;
public UUID getSeller() {
return Bukkit.getOfflinePlayer(player).getUniqueId();
}
public String getCustomer() {
return customer;
public UUID getCustomer() {
return Bukkit.getOfflinePlayer(customer).getUniqueId();
}
public ItemStack getItem() {
return item;
@ -58,7 +60,7 @@ public class ShopPurchase {
public TextComponent announcementString() {
DecimalFormat df = new DecimalFormat("0.00");
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+"]");
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)");
@ -67,7 +69,7 @@ public class ShopPurchase {
finalmsg.addExtra(message3);
return finalmsg;
} 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+"]");
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.)");

@ -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;
}
}

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

@ -44,7 +44,7 @@ public class ArrayUtils {
lookingfor = ' ';
} else {
collective = collective + " " + args[i];
TwosideKeeper.log(collective, 0);
//TwosideKeeper.log(collective, 0);
}
} else {
newargs.add(args[i]);

@ -84,4 +84,17 @@ public class BlockUtils {
b.getType()==Material.WALL_SIGN ||
b.getType()==Material.SIGN_POST;
}
public static boolean isInteractable(Block b) {
return b.getType().name().contains("DOOR") ||
b.getType().name().contains("CHEST") ||
b.getType().name().contains("FURNACE") ||
b.getType().name().contains("MINECART") ||
b.getType()==Material.BREWING_STAND ||
b.getType()==Material.WORKBENCH ||
b.getType()==Material.ENCHANTMENT_TABLE ||
b.getType()==Material.LEVER ||
b.getType().name().contains("BUTTON") ||
b.getType().name().contains("BOAT");
}
}

@ -0,0 +1,43 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Book;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class BookUtils {
public static void GiveBookToPlayer(Player p,Book book) {
File file = book.getBookFile();
if (file.exists()) {
ItemStack bookItem = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta)bookItem.getItemMeta();
String[] contents = FileUtils.readFromFile(book.getBookFilepath());
List<String> bookContents = new ArrayList<String>();
for (int i=0;i<contents.length;i++) {
bookContents.add(ChatColor.translateAlternateColorCodes('&', contents[i]).replace("\\n", "\n"));
}
//meta.setTitle(bookContents.remove(0));
meta.setDisplayName(bookContents.remove(0));
meta.setAuthor(bookContents.remove(0));
meta.setPages(bookContents);
bookItem.setItemMeta(meta);
GenericFunctions.giveItem(p, bookItem);
} else {
try {
TwosideKeeper.log("WARNING! Book "+book.name()+" does not exist! Create a file in "+file.getCanonicalPath(), 1);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

@ -0,0 +1,23 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public enum ColoredParticle {
MOB_SPELL("SPELL_MOB"), MOB_SPELL_AMBIENT("SPELL_MOB_AMBIENT"), RED_DUST("REDSTONE");
private ColoredParticle(String name) {
this.name = name;
}
String name;
public void send(Location location, List<Player> players, int r, int g, int b) {
ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, players);
}
public void send(Location location, int Distance, int r, int g, int b) {
ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, Distance);
}
}

@ -0,0 +1,17 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
import java.io.File;
import java.io.FileFilter;
public class InstanceFilter implements FileFilter{
@Override
public boolean accept(File arg0) {
if (arg0.getName().contains("Instance")) {
return true;
} else {
return false;
}
}
}

@ -0,0 +1,48 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
public class MixedDamage {
double dmgcomponent;
double truepctdmgcomponent;
double truedmgcomponent;
public MixedDamage(double dmg) {
this.dmgcomponent=dmg;
this.truepctdmgcomponent=0;
this.truedmgcomponent=0;
}
public MixedDamage(double dmg,double truepctdmg) {
this.dmgcomponent=dmg;
this.truepctdmgcomponent=truepctdmg;
this.truedmgcomponent=0;
}
public MixedDamage(double dmg,double truepctdmg,double truedmg) {
this.dmgcomponent=dmg;
this.truepctdmgcomponent=truepctdmg;
this.truedmgcomponent=truedmg;
}
public static MixedDamage v(double dmg) {
return new MixedDamage(dmg);
}
public static MixedDamage v(double dmg,double truepctdmg) {
return new MixedDamage(dmg,truepctdmg);
}
public static MixedDamage v(double dmg,double truepctdmg,double truedmg) {
return new MixedDamage(dmg,truepctdmg,truedmg);
}
public double getDmgComponent() {
return dmgcomponent;
}
public double getTruePctDmgComponent() {
return truepctdmgcomponent;
}
public double getTrueDmgComponent() {
return truedmgcomponent;
}
public boolean hasTruePctDmgComponent() {
return truepctdmgcomponent>0;
}
public boolean hasTrueDmgComponent() {
return truedmgcomponent>0;
}
}

@ -0,0 +1,605 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
/**
* <b>ReflectionUtils</b>
* <p>
* This class provides useful methods which makes dealing with reflection much easier, especially when working with Bukkit
* <p>
* You are welcome to use it, modify it and redistribute it under the following conditions:
* <ul>
* <li>Don't claim this class as your own
* <li>Don't remove this disclaimer
* </ul>
* <p>
* <i>It would be nice if you provide credit to me if you use this class in a published project</i>
*
* @author DarkBlade12
* @version 1.1
*/
public final class ReflectionUtils {
// Prevent accidental construction
private ReflectionUtils() {}
/**
* Returns the constructor of a given class with the given parameter types
*
* @param clazz Target class
* @param parameterTypes Parameter types of the desired constructor
* @return The constructor of the target class with the specified parameter types
* @throws NoSuchMethodException If the desired constructor with the specified parameter types cannot be found
* @see DataType
* @see DataType#getPrimitive(Class[])
* @see DataType#compare(Class[], Class[])
*/
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) throws NoSuchMethodException {
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
for (Constructor<?> constructor : clazz.getConstructors()) {
if (!DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
continue;
}
return constructor;
}
throw new NoSuchMethodException("There is no such constructor in this class with the specified parameter types");
}
/**
* Returns the constructor of a desired class with the given parameter types
*
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param parameterTypes Parameter types of the desired constructor
* @return The constructor of the desired target class with the specified parameter types
* @throws NoSuchMethodException If the desired constructor with the specified parameter types cannot be found
* @throws ClassNotFoundException ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getClass(String, PackageType)
* @see #getConstructor(Class, Class...)
*/
public static Constructor<?> getConstructor(String className, PackageType packageType, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
return getConstructor(packageType.getClass(className), parameterTypes);
}
/**
* Returns an instance of a class with the given arguments
*
* @param clazz Target class
* @param arguments Arguments which are used to construct an object of the target class
* @return The instance of the target class with the specified arguments
* @throws InstantiationException If you cannot create an instance of the target class due to certain circumstances
* @throws IllegalAccessException If the desired constructor cannot be accessed due to certain circumstances
* @throws IllegalArgumentException If the types of the arguments do not match the parameter types of the constructor (this should not occur since it searches for a constructor with the types of the arguments)
* @throws InvocationTargetException If the desired constructor cannot be invoked
* @throws NoSuchMethodException If the desired constructor with the specified arguments cannot be found
*/
public static Object instantiateObject(Class<?> clazz, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getConstructor(clazz, DataType.getPrimitive(arguments)).newInstance(arguments);
}
/**
* Returns an instance of a desired class with the given arguments
*
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param arguments Arguments which are used to construct an object of the desired target class
* @return The instance of the desired target class with the specified arguments
* @throws InstantiationException If you cannot create an instance of the desired target class due to certain circumstances
* @throws IllegalAccessException If the desired constructor cannot be accessed due to certain circumstances
* @throws IllegalArgumentException If the types of the arguments do not match the parameter types of the constructor (this should not occur since it searches for a constructor with the types of the arguments)
* @throws InvocationTargetException If the desired constructor cannot be invoked
* @throws NoSuchMethodException If the desired constructor with the specified arguments cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getClass(String, PackageType)
* @see #instantiateObject(Class, Object...)
*/
public static Object instantiateObject(String className, PackageType packageType, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
return instantiateObject(packageType.getClass(className), arguments);
}
/**
* Returns a method of a class with the given parameter types
*
* @param clazz Target class
* @param methodName Name of the desired method
* @param parameterTypes Parameter types of the desired method
* @return The method of the target class with the specified name and parameter types
* @throws NoSuchMethodException If the desired method of the target class with the specified name and parameter types cannot be found
* @see DataType#getPrimitive(Class[])
* @see DataType#compare(Class[], Class[])
*/
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
for (Method method : clazz.getMethods()) {
if (!method.getName().equals(methodName) || !DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
continue;
}
return method;
}
throw new NoSuchMethodException("There is no such method in this class with the specified name and parameter types");
}
/**
* Returns a method of a desired class with the given parameter types
*
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param methodName Name of the desired method
* @param parameterTypes Parameter types of the desired method
* @return The method of the desired target class with the specified name and parameter types
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and parameter types cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getClass(String, PackageType)
* @see #getMethod(Class, String, Class...)
*/
public static Method getMethod(String className, PackageType packageType, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException {
return getMethod(packageType.getClass(className), methodName, parameterTypes);
}
/**
* Invokes a method on an object with the given arguments
*
* @param instance Target object
* @param methodName Name of the desired method
* @param arguments Arguments which are used to invoke the desired method
* @return The result of invoking the desired method on the target object
* @throws IllegalAccessException If the desired method cannot be accessed due to certain circumstances
* @throws IllegalArgumentException If the types of the arguments do not match the parameter types of the method (this should not occur since it searches for a method with the types of the arguments)
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
* @throws NoSuchMethodException If the desired method of the class of the target object with the specified name and arguments cannot be found
* @see #getMethod(Class, String, Class...)
* @see DataType#getPrimitive(Object[])
*/
public static Object invokeMethod(Object instance, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getMethod(instance.getClass(), methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments);
}
/**
* Invokes a method of the target class on an object with the given arguments
*
* @param instance Target object
* @param clazz Target class
* @param methodName Name of the desired method
* @param arguments Arguments which are used to invoke the desired method
* @return The result of invoking the desired method on the target object
* @throws IllegalAccessException If the desired method cannot be accessed due to certain circumstances
* @throws IllegalArgumentException If the types of the arguments do not match the parameter types of the method (this should not occur since it searches for a method with the types of the arguments)
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
* @throws NoSuchMethodException If the desired method of the target class with the specified name and arguments cannot be found
* @see #getMethod(Class, String, Class...)
* @see DataType#getPrimitive(Object[])
*/
public static Object invokeMethod(Object instance, Class<?> clazz, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException {
return getMethod(clazz, methodName, DataType.getPrimitive(arguments)).invoke(instance, arguments);
}
/**
* Invokes a method of a desired class on an object with the given arguments
*
* @param instance Target object
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param methodName Name of the desired method
* @param arguments Arguments which are used to invoke the desired method
* @return The result of invoking the desired method on the target object
* @throws IllegalAccessException If the desired method cannot be accessed due to certain circumstances
* @throws IllegalArgumentException If the types of the arguments do not match the parameter types of the method (this should not occur since it searches for a method with the types of the arguments)
* @throws InvocationTargetException If the desired method cannot be invoked on the target object
* @throws NoSuchMethodException If the desired method of the desired target class with the specified name and arguments cannot be found
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getClass(String, PackageType)
* @see #invokeMethod(Object, Class, String, Object...)
*/
public static Object invokeMethod(Object instance, String className, PackageType packageType, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
return invokeMethod(instance, packageType.getClass(className), methodName, arguments);
}
/**
* Returns a field of the target class with the given name
*
* @param clazz Target class
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @return The field of the target class with the specified name
* @throws NoSuchFieldException If the desired field of the given class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
*/
public static Field getField(Class<?> clazz, boolean declared, String fieldName) throws NoSuchFieldException, SecurityException {
Field field = declared ? clazz.getDeclaredField(fieldName) : clazz.getField(fieldName);
field.setAccessible(true);
return field;
}
/**
* Returns a field of a desired class with the given name
*
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @return The field of the desired target class with the specified name
* @throws NoSuchFieldException If the desired field of the desired class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getField(Class, boolean, String)
*/
public static Field getField(String className, PackageType packageType, boolean declared, String fieldName) throws NoSuchFieldException, SecurityException, ClassNotFoundException {
return getField(packageType.getClass(className), declared, fieldName);
}
/**
* Returns the value of a field of the given class of an object
*
* @param instance Target object
* @param clazz Target class
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @return The value of field of the target object
* @throws IllegalArgumentException If the target object does not feature the desired field
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the target class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @see #getField(Class, boolean, String)
*/
public static Object getValue(Object instance, Class<?> clazz, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
return getField(clazz, declared, fieldName).get(instance);
}
/**
* Returns the value of a field of a desired class of an object
*
* @param instance Target object
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @return The value of field of the target object
* @throws IllegalArgumentException If the target object does not feature the desired field
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the desired class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #getValue(Object, Class, boolean, String)
*/
public static Object getValue(Object instance, String className, PackageType packageType, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException {
return getValue(instance, packageType.getClass(className), declared, fieldName);
}
/**
* Returns the value of a field with the given name of an object
*
* @param instance Target object
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @return The value of field of the target object
* @throws IllegalArgumentException If the target object does not feature the desired field (should not occur since it searches for a field with the given name in the class of the object)
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the target object cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @see #getValue(Object, Class, boolean, String)
*/
public static Object getValue(Object instance, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
return getValue(instance, instance.getClass(), declared, fieldName);
}
/**
* Sets the value of a field of the given class of an object
*
* @param instance Target object
* @param clazz Target class
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @param value New value
* @throws IllegalArgumentException If the type of the value does not match the type of the desired field
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the target class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @see #getField(Class, boolean, String)
*/
public static void setValue(Object instance, Class<?> clazz, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
getField(clazz, declared, fieldName).set(instance, value);
}
/**
* Sets the value of a field of a desired class of an object
*
* @param instance Target object
* @param className Name of the desired target class
* @param packageType Package where the desired target class is located
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @param value New value
* @throws IllegalArgumentException If the type of the value does not match the type of the desired field
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the desired class cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @throws ClassNotFoundException If the desired target class with the specified name and package cannot be found
* @see #setValue(Object, Class, boolean, String, Object)
*/
public static void setValue(Object instance, String className, PackageType packageType, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException {
setValue(instance, packageType.getClass(className), declared, fieldName, value);
}
/**
* Sets the value of a field with the given name of an object
*
* @param instance Target object
* @param declared Whether the desired field is declared or not
* @param fieldName Name of the desired field
* @param value New value
* @throws IllegalArgumentException If the type of the value does not match the type of the desired field
* @throws IllegalAccessException If the desired field cannot be accessed
* @throws NoSuchFieldException If the desired field of the target object cannot be found
* @throws SecurityException If the desired field cannot be made accessible
* @see #setValue(Object, Class, boolean, String, Object)
*/
public static void setValue(Object instance, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
setValue(instance, instance.getClass(), declared, fieldName, value);
}
/**
* Represents an enumeration of dynamic packages of NMS and CraftBukkit
* <p>
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
*
* @author DarkBlade12
* @since 1.0
*/
public enum PackageType {
MINECRAFT_SERVER("net.minecraft.server." + getServerVersion()),
CRAFTBUKKIT("org.bukkit.craftbukkit." + getServerVersion()),
CRAFTBUKKIT_BLOCK(CRAFTBUKKIT, "block"),
CRAFTBUKKIT_CHUNKIO(CRAFTBUKKIT, "chunkio"),
CRAFTBUKKIT_COMMAND(CRAFTBUKKIT, "command"),
CRAFTBUKKIT_CONVERSATIONS(CRAFTBUKKIT, "conversations"),
CRAFTBUKKIT_ENCHANTMENS(CRAFTBUKKIT, "enchantments"),
CRAFTBUKKIT_ENTITY(CRAFTBUKKIT, "entity"),
CRAFTBUKKIT_EVENT(CRAFTBUKKIT, "event"),
CRAFTBUKKIT_GENERATOR(CRAFTBUKKIT, "generator"),
CRAFTBUKKIT_HELP(CRAFTBUKKIT, "help"),
CRAFTBUKKIT_INVENTORY(CRAFTBUKKIT, "inventory"),
CRAFTBUKKIT_MAP(CRAFTBUKKIT, "map"),
CRAFTBUKKIT_METADATA(CRAFTBUKKIT, "metadata"),
CRAFTBUKKIT_POTION(CRAFTBUKKIT, "potion"),
CRAFTBUKKIT_PROJECTILES(CRAFTBUKKIT, "projectiles"),
CRAFTBUKKIT_SCHEDULER(CRAFTBUKKIT, "scheduler"),
CRAFTBUKKIT_SCOREBOARD(CRAFTBUKKIT, "scoreboard"),
CRAFTBUKKIT_UPDATER(CRAFTBUKKIT, "updater"),
CRAFTBUKKIT_UTIL(CRAFTBUKKIT, "util");
private final String path;
/**
* Construct a new package type
*
* @param path Path of the package
*/
private PackageType(String path) {
this.path = path;
}
/**
* Construct a new package type
*
* @param parent Parent package of the package
* @param path Path of the package
*/
private PackageType(PackageType parent, String path) {
this(parent + "." + path);
}
/**
* Returns the path of this package type
*
* @return The path
*/
public String getPath() {
return path;
}
/**
* Returns the class with the given name
*
* @param className Name of the desired class
* @return The class with the specified name
* @throws ClassNotFoundException If the desired class with the specified name and package cannot be found
*/
public Class<?> getClass(String className) throws ClassNotFoundException {
return Class.forName(this + "." + className);
}
// Override for convenience
@Override
public String toString() {
return path;
}
/**
* Returns the version of your server
*
* @return The server version
*/
public static String getServerVersion() {
return Bukkit.getServer().getClass().getPackage().getName().substring(23);
}
}
/**
* Represents an enumeration of Java data types with corresponding classes
* <p>
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
*
* @author DarkBlade12
* @since 1.0
*/
public enum DataType {
BYTE(byte.class, Byte.class),
SHORT(short.class, Short.class),
INTEGER(int.class, Integer.class),
LONG(long.class, Long.class),
CHARACTER(char.class, Character.class),
FLOAT(float.class, Float.class),
DOUBLE(double.class, Double.class),
BOOLEAN(boolean.class, Boolean.class);
private static final Map<Class<?>, DataType> CLASS_MAP = new HashMap<Class<?>, DataType>();
private final Class<?> primitive;
private final Class<?> reference;
// Initialize map for quick class lookup
static {
for (DataType type : values()) {
CLASS_MAP.put(type.primitive, type);
CLASS_MAP.put(type.reference, type);
}
}
/**
* Construct a new data type
*
* @param primitive Primitive class of this data type
* @param reference Reference class of this data type
*/
private DataType(Class<?> primitive, Class<?> reference) {
this.primitive = primitive;
this.reference = reference;
}
/**
* Returns the primitive class of this data type
*
* @return The primitive class
*/
public Class<?> getPrimitive() {
return primitive;
}
/**
* Returns the reference class of this data type
*
* @return The reference class
*/
public Class<?> getReference() {
return reference;
}
/**
* Returns the data type with the given primitive/reference class
*
* @param clazz Primitive/Reference class of the data type
* @return The data type
*/
public static DataType fromClass(Class<?> clazz) {
return CLASS_MAP.get(clazz);
}
/**
* Returns the primitive class of the data type with the given reference class
*
* @param clazz Reference class of the data type
* @return The primitive class
*/
public static Class<?> getPrimitive(Class<?> clazz) {
DataType type = fromClass(clazz);
return type == null ? clazz : type.getPrimitive();
}
/**
* Returns the reference class of the data type with the given primitive class
*
* @param clazz Primitive class of the data type
* @return The reference class
*/
public static Class<?> getReference(Class<?> clazz) {
DataType type = fromClass(clazz);
return type == null ? clazz : type.getReference();
}
/**
* Returns the primitive class array of the given class array
*
* @param classes Given class array
* @return The primitive class array
*/
public static Class<?>[] getPrimitive(Class<?>[] classes) {
int length = classes == null ? 0 : classes.length;
Class<?>[] types = new Class<?>[length];
for (int index = 0; index < length; index++) {
types[index] = getPrimitive(classes[index]);
}
return types;
}
/**
* Returns the reference class array of the given class array
*
* @param classes Given class array
* @return The reference class array
*/
public static Class<?>[] getReference(Class<?>[] classes) {
int length = classes == null ? 0 : classes.length;
Class<?>[] types = new Class<?>[length];
for (int index = 0; index < length; index++) {
types[index] = getReference(classes[index]);
}
return types;
}
/**
* Returns the primitive class array of the given object array
*
* @param object Given object array
* @return The primitive class array
*/
public static Class<?>[] getPrimitive(Object[] objects) {
int length = objects == null ? 0 : objects.length;
Class<?>[] types = new Class<?>[length];
for (int index = 0; index < length; index++) {
types[index] = getPrimitive(objects[index].getClass());
}
return types;
}
/**
* Returns the reference class array of the given object array
*
* @param object Given object array
* @return The reference class array
*/
public static Class<?>[] getReference(Object[] objects) {
int length = objects == null ? 0 : objects.length;
Class<?>[] types = new Class<?>[length];
for (int index = 0; index < length; index++) {
types[index] = getReference(objects[index].getClass());
}
return types;
}
/**
* Compares two class arrays on equivalence
*
* @param primary Primary class array
* @param secondary Class array which is compared to the primary array
* @return Whether these arrays are equal or not
*/
public static boolean compare(Class<?>[] primary, Class<?>[] secondary) {
if (primary == null || secondary == null || primary.length != secondary.length) {
return false;
}
for (int index = 0; index < primary.length; index++) {
Class<?> primaryClass = primary[index];
Class<?> secondaryClass = secondary[index];
if (primaryClass.equals(secondaryClass) || primaryClass.isAssignableFrom(secondaryClass)) {
continue;
}
return false;
}
return true;
}
}
}

@ -10,23 +10,30 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import org.bukkit.block.BlockFace;
import sig.plugin.TwosideKeeper.Buff;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.CloudRunnable;
import sig.plugin.TwosideKeeper.HelperStructures.DamageLabel;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
public class EntityUtils {
final public static BlockFace[] faces = new BlockFace[]{BlockFace.EAST,BlockFace.SOUTH_EAST,BlockFace.SOUTH,
BlockFace.SOUTH_WEST,BlockFace.WEST,BlockFace.NORTH_WEST,BlockFace.NORTH,BlockFace.NORTH_EAST};
public static int CountNearbyEntityType(EntityType type, Entity ent, double range) {
List<Entity> ents = ent.getNearbyEntities(range, range, range);
int count=0;
@ -72,27 +79,39 @@ public class EntityUtils {
public static void applyDamageIndicator(Entity e, double damage, IndicatorType type) {
Location offsetloc = e.getLocation().add(Math.random()/2-0.25,0.5,Math.random()/2-0.25);
if (damage>=1) {
AreaEffectCloud aec = CreateOverlayText(offsetloc,((damage>=100)?ChatColor.BOLD+" ":"")+type.getColor()+Integer.toString((int)damage)+((damage>=100)?" ":""));
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,new CloudRunnable(aec,0.15*Math.min(Math.max(1,(double)damage/50),2),(int)(10*Math.min(Math.max(1,(double)damage/50),2))),1);
ArmorStand aec = CreateOverlayText(offsetloc,((damage>=100)?ChatColor.BOLD+" ":"")+type.getColor()+Integer.toString((int)damage)+((damage>=100)?" ":""));
TwosideKeeper.labelqueue.add(new DamageLabel(aec,0.1,(int)(10*Math.min(Math.max(1,(double)damage/50),2))));
}
}
public static AreaEffectCloud CreateOverlayText(Location loc, String overlay) {
AreaEffectCloud aec = (AreaEffectCloud)loc.getWorld().spawnEntity(loc, EntityType.AREA_EFFECT_CLOUD);
public static ArmorStand CreateOverlayText(Location loc, String overlay) {
ArmorStand aec = (ArmorStand)loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
aec.setCustomName(overlay);
aec.setGravity(false);
aec.setRemoveWhenFarAway(true);
aec.setCustomNameVisible(true);
aec.setRadius(0);
aec.setParticle(Particle.ITEM_TAKE);
aec.setVisible(false);
aec.setMarker(true);
//aec.setRadius(0);
//aec.setParticle(Particle.ITEM_TAKE);
//Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin,new CloudRunnable(aec,0.15,10),1);
return aec;
}
public static void createPotionEffectSwirls(LivingEntity l, Color col, int delay) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
AreaEffectCloud aec = (AreaEffectCloud)l.getWorld().spawnEntity(l.getLocation(), EntityType.AREA_EFFECT_CLOUD);
/*AreaEffectCloud aec = (AreaEffectCloud)l.getWorld().spawnEntity(l.getLocation(), EntityType.AREA_EFFECT_CLOUD);
aec.setColor(col);
aec.setDuration(5);
aec.setRadius(0.1f);
aec.setRadiusOnUse(0.1f);
aec.setRadiusPerTick(0f);
aec.setRadius(0.1f);*/
Location origloc = l.getLocation();
for (int i=0;i<5;i++) {
ColoredParticle.MOB_SPELL.send(origloc.clone().add(Math.random()*2-1,
Math.random()*2-1,
Math.random()*2-1), 10, col.getRed(), col.getGreen(), col.getBlue());
}
},delay);
}
@ -178,4 +197,26 @@ public class EntityUtils {
GenericFunctions.sendActionBarMessage((Player)l, "");
}
}
public static BlockFace getFacingDirection(LivingEntity l) {
Vector direction = l.getLocation().getDirection();
double rad = Math.atan2(direction.getZ(), direction.getX());
double dir = Math.toDegrees(rad);
if (dir<0) {
dir=360-Math.abs(dir);
//-90 180 + 90 = 270
// -0 180
//-180 360
}
//TwosideKeeper.log(Double.toString(dir), 0);
//+Z: 90 degrees (South)
//+X: 0 degrees (East)
//-Z: -90 degrees (North)
//-X: -180/180 degrees (West)
return faces[(int)((dir+22.5)/45)%faces.length];
}
public static boolean isValidEntity(Entity e) {
return e!=null && e.isValid() && !e.isDead();
}
}

@ -87,6 +87,7 @@ public class InventoryUtils {
remaining = remainingitems.values().toArray(new ItemStack[0]);
//TwosideKeeper.log("Remaining items: "+ArrayUtils.toString(remaining), 0);
GenericFunctions.UpdateItemLore(itemStacks);
//GenericFunctions.UpdateItemCubeContentsList(item);
}
}
return remaining;
@ -149,6 +150,12 @@ public class InventoryUtils {
HashMap<Integer,ItemStack> remainingitems = ItemCubeUtils.AttemptingToAddItemToFilterCube(id,virtualinventory,remaining);
//TwosideKeeper.log("Cube Inventory "+ChatColor.DARK_RED+"AFTER"+ChatColor.RESET+" for cube #"+id+": "+Arrays.toString(virtualinventory.getContents()), 0);
GenericFunctions.UpdateItemLore(remaining[j]);
for (ItemStack item:p.getInventory()) {
if (ItemCubeUtils.isItemCube(item) &&
ItemCubeUtils.getItemCubeID(item)==id) {
GenericFunctions.UpdateItemCubeContentsList(item);
}
}
if (remainingitems.size()>0) {
//TwosideKeeper.log("Remaining items size > 0. Adding "+remainingitems.values().iterator().next(), 0);
remaining = remainingitems.values().toArray(new ItemStack[]{remainingitems.values().iterator().next()});
@ -195,7 +202,7 @@ public class InventoryUtils {
ItemStack[] inventory = inv.getContents();
for (ItemStack i : inventory) {
if (i!=null && i.getType()!=Material.AIR) {
TwosideKeeper.log("Item is "+i, 0);
TwosideKeeper.log("Item is "+i, 5);
return false;
}
}
@ -264,11 +271,17 @@ public class InventoryUtils {
if (itemStackInventory.isSimilar(itemStackAdded) && itemStackInventory.getAmount()<itemStackInventory.getMaxStackSize()) {
int amt = itemStackInventory.getMaxStackSize()-itemStackInventory.getAmount();
if (itemStackAdded.getAmount()>=amt) {
//TwosideKeeper.log(" itemStackAdded amt: "+itemStackAdded.getAmount()+", amt:"+amt,0);
int remaining = itemStackAdded.getAmount()-amt;
itemStackInventory.setAmount(itemStackInventory.getMaxStackSize());
itemStackAdded.setAmount(remaining);
//TwosideKeeper.log(" ItemStack in inventory: "+itemStackInventory,0);
//TwosideKeeper.log(" Remaining amount: "+itemStackAdded,0);
//TwosideKeeper.log(" Remaining was: "+remaining,0);
} else {
itemStackInventory.setAmount(itemStackInventory.getAmount()+itemStackAdded.getAmount());
//TwosideKeeper.log(" End. We're done. Added "+itemStackAdded,0);
itemStackAdded=null;
break; //Ran out, we're done here.
}

@ -44,6 +44,18 @@ public class ItemUtils {
item.setItemMeta(m);
}
public static void addFlag(ItemStack item, ItemFlag...flags) {
ItemMeta m = item.getItemMeta();
m.addItemFlags(flags);
item.setItemMeta(m);
}
public static void removeFlag(ItemStack item, ItemFlag...flags) {
ItemMeta m = item.getItemMeta();
m.removeItemFlags(flags);
item.setItemMeta(m);
}
public static void setDisplayName(ItemStack item, String name) {
ItemMeta m = item.getItemMeta();
m.setDisplayName(name);

@ -0,0 +1,9 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.util.EulerAngle;
public class MathUtils {
public static EulerAngle getEulerAngleDegrees(double degX,double degY,double degZ) {
return new EulerAngle(Math.toRadians(degX),Math.toRadians(degY),Math.toRadians(degZ));
}
}

@ -1,10 +1,11 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.util.Vector;
public class MovementUtils {
public static Vector moveTowardsLocation(Location currloc, Location targetloc, double spd) {
public static Vector getVelocityTowardsLocation(Location currloc, Location targetloc, double spd) {
/*double deltax = currloc.getX()-targetloc.getX();
double deltay = currloc.getY()-targetloc.getY();
double deltaz = currloc.getZ()-targetloc.getZ();
@ -47,4 +48,36 @@ public class MovementUtils {
//TwosideKeeper.log("New angle is "+angle, 0);
return new Vector(-velx,-vely,-velz);
}
/**
* Returns an array with a size of two elements:
* One pointing 45 degrees to the right of the specified direction.
* One pointing 45 degrees to the left of the specified direction.
*/
public static BlockFace[] get45DegreeDirections(BlockFace dir) {
int slotfound = 0;
for (int i=0;i<EntityUtils.faces.length;i++) {
if (EntityUtils.faces[i].equals(dir)) {
slotfound=i;
break;
}
}
return new BlockFace[]{EntityUtils.faces[(slotfound+1)%EntityUtils.faces.length],EntityUtils.faces[Math.floorMod((slotfound-1),EntityUtils.faces.length)]};
}
/**
* Returns an array with a size of two elements:
* One pointing 90 degrees to the right of the specified direction.
* One pointing 90 degrees to the left of the specified direction.
*/
public static BlockFace[] get90DegreeDirections(BlockFace dir) {
int slotfound = 0;
for (int i=0;i<EntityUtils.faces.length;i++) {
if (EntityUtils.faces[i].equals(dir)) {
slotfound=i;
break;
}
}
return new BlockFace[]{EntityUtils.faces[(slotfound+2)%EntityUtils.faces.length],EntityUtils.faces[Math.floorMod((slotfound-2),EntityUtils.faces.length)]};
}
}

@ -3,10 +3,18 @@ package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class PlayerUtils {
public static boolean PlayerIsInCombat(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return (pd.target!=null && pd.target.isValid() && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<256);
return (pd.lastattack+100>TwosideKeeper.getServerTickTime() || (pd.target!=null && pd.target.isValid() && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<256));
}
public static boolean cooldownAvailable(long basetimer, int cooldown, Player p) {
return (basetimer+GenericFunctions.GetModifiedCooldown(cooldown, p)<=TwosideKeeper.getServerTickTime());
}
public static long cooldownTimeRemaining(long basetimer, int cooldown, Player p) {
return (basetimer+GenericFunctions.GetModifiedCooldown(cooldown, p))-TwosideKeeper.getServerTickTime();
}
}

@ -18,13 +18,14 @@ public class SoundUtils {
*/
public static void playGlobalSound(Location loc, Sound sound, float vol, float pitch) {
loc.getWorld().playSound(loc, sound, vol, pitch);
//playIndividualGlobalSound(loc,sound,vol,pitch);
}
/**
* Same as playGlobalSound. Just done for every single player locally.
*/
public static void playIndividualGlobalSound(Location loc, Sound sound, float vol, float pitch) {
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getLocation().distanceSquared(loc)<=2500) {
if (!p.isDead()) {
p.playSound(loc, sound, vol, pitch);
}
}
@ -33,20 +34,26 @@ public class SoundUtils {
* Plays a sound at the player's location, as if they were hearing a regular sound in the client.
*/
public static void playLocalSound(Player p, Sound sound, float vol, float pitch) {
SoundUtils.playLocalSound(p,p.getLocation(), sound, vol, pitch);
if (!p.isDead()) {
SoundUtils.playLocalSound(p,p.getLocation(), sound, vol, pitch);
}
}
/**
* Plays a sound at the specified location for a single player, as if they were hearing a regular sound in the client.
*/
public static void playLocalSound(Player p, Location loc, Sound sound, float vol, float pitch) {
p.playSound(loc, sound, vol, pitch);
if (!p.isDead()) {
p.playSound(loc, sound, vol, pitch);
}
}
/**
* Plays a sound at the player's location for every player, as if they were hearing a regular sound in the client. Useful for notifications/pings.
*/
public static void playLocalGlobalSound(Sound sound, float vol, float pitch) {
for (Player p : Bukkit.getOnlinePlayers()) {
SoundUtils.playLocalSound(p, sound, vol, pitch);
if (!p.isDead()) {
SoundUtils.playLocalSound(p, sound, vol, pitch);
}
}
}

@ -6,6 +6,8 @@ import java.util.Map;
import org.bukkit.ChatColor;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class TextUtils {
public static ChatColor RandomColor() {
@ -28,6 +30,24 @@ public class TextUtils {
return choices[(int)(Math.random()*choices.length)];
}
public static void GenerateListOfItems(List<? extends Object> items, StringBuilder str) {
for (int i=0;i<items.size();i++) {
if (i==0) {
str.append(items.get(i));
} else {
if (items.size()==2) {
str.append(" and "+items.get(i));
} else {
if (i==items.size()-1) {
str.append(", and "+items.get(i));
} else {
str.append(", "+items.get(i));
}
}
}
}
}
public static ChatColor GetColorBasedOnPercent(double pct) {
if (pct>0.75) {
return ChatColor.DARK_GREEN;
@ -82,4 +102,54 @@ public class TextUtils {
}
return builder.toString();
}
public static boolean hasNoSpaceBeforeAndAfter(String str1, String str2, List<String> baselist) {
//int pos = str
for (int i=0;i<baselist.size();i++) {
String s = baselist.get(i);
if (s.contains(str1) && s.contains(str2)) {
int pos1 = s.indexOf(str1);
int pos2 = s.indexOf(str2);
if (pos1>0 || pos2+str2.length()<s.length()) {
return false;
}
}
}
return true;
}
/**
* Uses Underline formatting to create a bar beneath a given set of text with X% of the width filled.
*/
@Deprecated
public static String createUnderlineBar(String finaltext, double pct) {
//TODO Does not work.
int barlength = finaltext.length();
int filledbar = (int)(pct * barlength);
finaltext = ChatColor.UNDERLINE+finaltext;
TwosideKeeper.log("Text: "+finaltext, 0);
finaltext = finaltext.substring(0, filledbar-1) + ChatColor.RESET + finaltext.substring(filledbar-1, finaltext.length()-1);
return finaltext;
}
/**
* Use boxes to create an aggro bar.
*/
public static String createAggroBar(double pct) {
StringBuilder sb = new StringBuilder(ChatColor.DARK_RED+""+ChatColor.ITALIC+""+ChatColor.UNDERLINE+"");
for (int i=0;i<5;i++) {
if (pct>=(0.1*(i+1))+0.5) {
sb.append("█");
} else
if(pct>=0.1*(i+1)) {
sb.append("▄");
} else
{
sb.append(" ");
}
}
return sb.toString()+ChatColor.RESET;
}
}

@ -0,0 +1,31 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class VerifyItemWasMovedTask implements Runnable{
ItemStack checkitem;
ItemSlot slot;
Player p;
public VerifyItemWasMovedTask(ItemStack checkitem, Player p, ItemSlot slot) {
this.checkitem=checkitem.clone();
this.p=p;
this.slot=slot;
}
@Override
public void run() {
if (!slot.getItem(p).isSimilar(checkitem)) {
TwosideKeeper.log("WARNING! Item "+checkitem+" was not inserted in slot "+slot.name()+" properly! Item in slot atm: "+slot.getItem(p)+". Trying again in 1 tick!", 1);
//This is bad. Try again on the next tick. Set the item.
slot.setItem(p, checkitem);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, this, 1);
}
}
}

@ -16,6 +16,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -24,6 +25,7 @@ import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Banner;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -63,7 +65,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class WorldShop {
ItemStack item;
String owner;
UUID owner;
double price;
int amt;
int storedamt = 0;
@ -72,8 +74,9 @@ public class WorldShop {
public static final double DEFAULTPRICE = 99.99;
public static HashMap<String,Double> pricelist = new HashMap<String,Double>();
public static String price_file = TwosideKeeper.plugin.getDataFolder()+"/ShopPrices.data";
public static final UUID ADMIN_UUID = UUID.nameUUIDFromBytes(new byte[]{(byte)0});
public WorldShop (ItemStack i, int amt, int storedamt, double p, String player, int shopID, Location shopLoc) {
public WorldShop (ItemStack i, int amt, int storedamt, double p, UUID player, int shopID, Location shopLoc) {
this.item=i;
this.price=p;
this.owner=player;
@ -110,6 +113,15 @@ public class WorldShop {
this.loc=loc;
}
public static String getFriendlyOwnerName(UUID id) {
OfflinePlayer op = Bukkit.getOfflinePlayer(id);
if (op!=null) {
return op.getName();
} else {
return "admin";
}
}
public Location getLoc() {
return loc;
}
@ -121,7 +133,7 @@ public class WorldShop {
return item;
}
public double GetUnitPrice() {
if (owner.equalsIgnoreCase("admin")) {
if (owner.equals(ADMIN_UUID)) {
return GetWorldShopPrice(item);
} else {
return price;
@ -169,7 +181,8 @@ public class WorldShop {
}
private double ModifyPriceBasedOnLocation(double price) {
if (!loc.getWorld().equals(TwosideKeeper.TWOSIDE_LOCATION.getWorld())) {
////NO LONGER INCREASES BASED ON DISTANCE OR WORLD!!
/*if (!loc.getWorld().equals(TwosideKeeper.TWOSIDE_LOCATION.getWorld())) {
//This is in another world. Automatically increase price by x4.
price *= 4;
} else {
@ -190,7 +203,7 @@ public class WorldShop {
if (loc.getBlockY()<=16) {
price *= 1.5;
}
}
}*/
return Math.round(price*100)/100d;
}
@ -241,13 +254,13 @@ public class WorldShop {
return id;
}
public int GetAmount() {
if (owner.equalsIgnoreCase("admin")) {
if (owner.equals(ADMIN_UUID)) {
return 10000;
} else {
return amt;
}
}
public String GetOwner() {
public UUID GetOwner() {
return owner;
}
@ -258,6 +271,7 @@ public class WorldShop {
public static String GetItemInfo(ItemStack item) {
//Gets all the info about this item in one gigantic string. (Separated by new lines. Useful for tellraw()).
String message = "";
if (item==null) {return message;}
if (GenericFunctions.isArtifactEquip(item) && !GenericFunctions.isArtifactArmor(item) /*Artifact armor already has this info displayed.*/) {
if (item.hasItemMeta() &&
item.getItemMeta().hasDisplayName()) {
@ -688,7 +702,7 @@ public class WorldShop {
return duration/1200+":"+df.format((duration/20)%60);
}
private static String obfuscateAllMagicCodes(String message) {
public static String obfuscateAllMagicCodes(String message) {
StringBuilder newstring = new StringBuilder("");
boolean isMagic=false;
boolean WillBeMagic=false;
@ -1101,7 +1115,7 @@ public class WorldShop {
public static boolean hasPermissionToBreakWorldShopSign(Sign s, Player p) {
if (WorldShop.isWorldShopSign(s)) {
WorldShop shop = TwosideKeeper.TwosideShops.LoadWorldShopData(s);
if (shop.GetOwner().equalsIgnoreCase(p.getName()) || p.isOp()) {
if (shop.GetOwner().equals(p.getUniqueId()) || p.isOp()) {
return true;
} else {
return false;
@ -1240,7 +1254,7 @@ public class WorldShop {
wallsign.setData(sign.getData());
Sign s = (Sign)wallsign.getState();
s.setLine(0,"shop");
WorldShop shop = TwosideKeeper.TwosideShops.CreateWorldShop(s, item, 10000, DEFAULTPRICE, "admin");
WorldShop shop = TwosideKeeper.TwosideShops.CreateWorldShop(s, item, 10000, DEFAULTPRICE, ADMIN_UUID);
/*s.setLine(0, ChatColor.BLUE+"-- SHOP --");
s.setLine(1, GenericFunctions.UserFriendlyMaterialName(item));
s.setLine(2, "$"+df.format(GetWorldShopPrice(item))+ChatColor.DARK_BLUE+" [x10000]");

@ -762,7 +762,7 @@ public class Christmas {
Block b = p.getWorld().getHighestBlockAt(p.getLocation().getBlockX()+blockx, p.getLocation().getBlockZ()+blockz);
Block bbelow = b.getRelative(0, -1, 0);
if (p.isOnGround()) {
if (!aPlugin.API.isAFK(p)) {
if (!aPluginAPIWrapper.isAFK(p)) {
AddRocketBoosterCharges(p);
}
if (pd.falldamageimmunity && pd.lastusedrocketbooster+20<TwosideKeeper.getServerTickTime()) {

@ -1,22 +1,37 @@
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.attribute.Attribute;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
import sig.plugin.TwosideKeeper.Monster.Knight;
public class LivingEntityStructure {
public LivingEntity target;
public String original_name="";
public String base_name="";
public String difficulty_modifier="";
public String prefix="";
public String suffix="";
public String suffix_bar="";
public LivingEntity m;
public boolean isLeader=false;
public boolean isElite=false;
@ -30,23 +45,41 @@ public class LivingEntityStructure {
public HashMap<String,Buff> buffs = new HashMap<String,Buff>();
public long lastpotionparticles=0;
public long lastPoisonTick=0;
public long lastShrapnelTick=0;
public long lastBleedingTick=0;
public long lastInfectionTick=0;
public long lastCrippleTick=0;
public long lastBurnTick=0;
public long lastHit=0;
public long lastHitbyPlayer=0;
public Player lastPlayerThatHit=null;
public float MoveSpeedMultBeforeCripple=1f;
public Channel currentChannel=null;
public boolean isImportantGlowEnemy=true;
public boolean isPet=false;
public Player petOwner=null;
public HashMap<UUID,Integer> aggro_table = new HashMap<UUID,Integer>();
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
final static String MODIFIED_NAME_DELIMITER = ChatColor.RESET+";"+ChatColor.RESET;
public LivingEntityStructure(LivingEntity m) {
target=null;
original_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+original_name, 0);
base_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+base_name, 0);
this.m=m;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
}
public LivingEntityStructure(LivingEntity m, LivingEntity target) {
this.target=target;
original_name=GetOriginalName(m);
base_name=GetOriginalName(m);
//TwosideKeeper.log("Original name is "+base_name, 0);
this.m=m;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
}
public LivingEntityStructure(LivingEntity m, LivingEntity target, BossMonster bm) {
this.target=target;
original_name=bm.getName();
base_name=bm.getName();
this.m=m;
this.bm=bm;
this.original_movespd = m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue();
@ -54,12 +87,75 @@ public class LivingEntityStructure {
private String GetOriginalName(LivingEntity m) {
if (m.getCustomName()!=null) {
return m.getCustomName();
//TwosideKeeper.log("Custom Name is "+m.getCustomName(), 0);
if (!isModifiedName(m.getCustomName())) {
//TwosideKeeper.log(" NOT A MODIFIED NAME! "+m.getCustomName(), 0);
//See if it's an old version of the difficulty naming system.
LivingEntityDifficulty diff = MonsterController.getOldLivingEntityDifficulty(m);
if (diff!=null) {
String diffname = diff.getDifficultyString();
String basename = m.getCustomName().replace(diffname+" ", "");
difficulty_modifier = diffname;
//TwosideKeeper.log(" Set Difficulty to "+difficulty_modifier, 0);
//TwosideKeeper.log(" Set Base Name to "+basename, 0);
return basename;
} else {
return m.getCustomName();
}
} else {
String[] splitter = m.getCustomName().split(MODIFIED_NAME_DELIMITER);
difficulty_modifier = splitter[0];
//TwosideKeeper.log(" Set Difficulty to "+splitter[0], 0);
//TwosideKeeper.log(" Set Base Name to "+splitter[1], 0);
return splitter[1];
}
} else {
return GenericFunctions.CapitalizeFirstLetters(m.getType().name().replace("_", " "));
}
}
private boolean isModifiedName(String customName) {
return customName.contains(MODIFIED_NAME_DELIMITER);
}
public String getDifficultyAndMonsterName() {
StringBuilder sb = new StringBuilder(difficulty_modifier);
if (difficulty_modifier.length()>0) {
sb.append(" ");
}
sb.append(base_name);
if (suffix.length()>0) {
sb.append(" ");
sb.append(suffix);
}
return sb.toString();
}
public String getActualName() {
StringBuilder sb = new StringBuilder(prefix);
if (prefix.length()==0) {
if (sb.length()>0 && difficulty_modifier.length()>0) {
sb.append(" ");
}
sb.append(difficulty_modifier);
if (sb.length()>0 && base_name.length()>0) {
sb.append(" ");
}
sb.append(base_name);
if (sb.length()>0 && suffix.length()>0) {
sb.append(" ");
}
} else {
sb.append(" ");
}
sb.append(suffix);
if (sb.length()>0 && suffix_bar.length()>0) {
sb.append(" ");
}
sb.append(suffix_bar);
sb.append(MODIFIED_NAME_CODE);
//TwosideKeeper.log(prefix+","+difficulty_modifier+","+base_name+","+suffix+","+suffix_bar, 0);
return sb.toString();
}
public LivingEntity GetTarget() {
if (this.target!=null &&
!this.target.isDead()) {
@ -73,18 +169,19 @@ public class LivingEntityStructure {
}
public void SetLeader(boolean leader) {
this.isLeader=leader;
//suffix=(suffix.length()>0)?suffix+" Leader":"Leader";
}
public void SetElite(boolean elite) {
this.isElite=elite;
}
public boolean hasOriginalName() {
return !this.original_name.equalsIgnoreCase("");
return !this.base_name.equalsIgnoreCase("");
}
public String getOriginalName() {
if (hasOriginalName()) {
return this.original_name;
return this.base_name;
} else {
return "";
}
@ -98,11 +195,13 @@ public class LivingEntityStructure {
}
public void setGlow(Player p, GlowAPI.Color col) {
GlowAPI.setGlowing(m, col, p);
glowcolorlist.put(p.getUniqueId(), col);
}
public void setGlobalGlow(GlowAPI.Color col) {
for (Player p : Bukkit.getOnlinePlayers()) {
GlowAPI.setGlowing(m, col, p);
glowcolorlist.put(p.getUniqueId(), col);
}
}
@ -111,69 +210,115 @@ public class LivingEntityStructure {
//Updates the glow color for all players. We base it on default statuses here. CALL THIS INSTEAD OF
// SETTING THE GLOW DIRECTLY ANYMORE!
for (Player p : Bukkit.getOnlinePlayers()) {
if (GenericFunctions.isSuppressed(m)) {
setGlow(p,GlowAPI.Color.BLACK);
} else
if (getElite()) {
boolean handled=false;
for (EliteMonster em : TwosideKeeper.elitemonsters) {
if (em.getMonster().equals(m)) {
setGlow(p,em.getGlow());
handled=true;
//if (p!=null && p.isValid() && !p.isDead()) {
if (p!=null && p.isOnline()) {
if (isImportantGlowEnemy) {
if (TwosideKeeper.custommonsters.containsKey(m.getUniqueId()) &&
TwosideKeeper.custommonsters.get(m.getUniqueId()).getGlowColor()!=null) {
CustomMonster cm = TwosideKeeper.custommonsters.get(m.getUniqueId());
if (cm.getGlowColor()!=null) {
setGlow(p,cm.getGlowColor());
}
}
else
if (GenericFunctions.isSuppressed(m)) {
setGlow(p,GlowAPI.Color.BLACK);
} else
if (Channel.isChanneling(m)) {
setGlow(p,GlowAPI.Color.YELLOW);
} else
if (getElite()) {
boolean handled=false;
for (EliteMonster em : TwosideKeeper.elitemonsters) {
if (em.getMonster().equals(m)) {
setGlow(p,em.getGlow());
handled=true;
}
}
if (!handled) {
setGlow(p,GlowAPI.Color.DARK_PURPLE);
}
} else
if (getLeader() || (m instanceof Monster && GenericFunctions.isBossMonster((Monster)m))) {
//TwosideKeeper.log("Monster "+GenericFunctions.getDisplayName(m)+" is a Leader. Set the Glow.", 0);
setGlow(p,GlowAPI.Color.DARK_RED);
//TwosideKeeper.log("Is glowing? "+GlowAPI.isGlowing(m, p)+", Glow color list contains key? "+glowcolorlist.containsKey(p.getUniqueId()), 0);
} else
if (GenericFunctions.isIsolatedTarget(m, p)) {
setGlow(p,GlowAPI.Color.WHITE);
} else
{
//No glow.
//setGlow(p,null);
if (glowcolorlist.containsKey(p.getUniqueId())) {
GlowAPI.setGlowing(m, null, p);
glowcolorlist.remove(p.getUniqueId());
}
isImportantGlowEnemy=false;
}
//}
}
if (!handled) {
setGlow(p,GlowAPI.Color.DARK_PURPLE);
}
} else
if (getLeader() || (m instanceof Monster && GenericFunctions.isBossMonster((Monster)m))) {
setGlow(p,GlowAPI.Color.DARK_RED);
} else
if (GenericFunctions.isIsolatedTarget(m, p)) {
setGlow(p,GlowAPI.Color.WHITE);
} else {
//No glow.
//setGlow(p,null);
if (glowcolorlist.containsKey(p.getUniqueId())) {
GlowAPI.setGlowing(m, null, p);
glowcolorlist.remove(p.getUniqueId());
if (!GlowAPI.isGlowing(m, p) && glowcolorlist.containsKey(p.getUniqueId())) {
//TwosideKeeper.log("Set glow of "+GenericFunctions.getDisplayName(m)+" to "+glowcolorlist.get(p.getUniqueId()), 0);
GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p);
} else
try {
if (m!=null && p!=null && GlowAPI.isGlowing(m, p) && (GlowAPI.getGlowColor(m, p)==null || !glowcolorlist.get(p.getUniqueId()).equals(GlowAPI.getGlowColor(m, p)))) {
if (GlowAPI.getGlowColor(m, p)==null) {
GlowAPI.setGlowing(m, null, p);
} else {
GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p);
}
}
}catch (NullPointerException npe) {
GlowAPI.setGlowing(m, false, p);
}
}
if (!GlowAPI.isGlowing(m, p) && glowcolorlist.containsKey(p.getUniqueId())) {
GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p);
} else
if (GlowAPI.isGlowing(m, p) && !glowcolorlist.get(p.getUniqueId()).equals(GlowAPI.getGlowColor(m, p))) {
GlowAPI.setGlowing(m, glowcolorlist.get(p.getUniqueId()), p);
}
}
}
public static void UpdateMobName(LivingEntity ent) {
if (ent instanceof LivingEntity) {
if (ent instanceof LivingEntity && !(ent instanceof Player)) {
LivingEntity m = (LivingEntity)ent;
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
m.setCustomNameVisible(false);
if (m.getCustomName()!=null) {
m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
if (m.getCustomName().contains("Dangerous")) {
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
}
if (m.getCustomName().contains("Deadly")) {
m.setCustomName(ChatColor.GOLD+m.getCustomName());
}
if (m.getCustomName().contains("Hellfire")) {
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
}
m.setCustomName(ChatColor.DARK_RED+m.getCustomName()+ChatColor.RESET+" ");
if (Buff.hasBuff(m, "DeathMark")) {
GenericFunctions.RefreshBuffColor(m, Buff.getBuff(m, "DeathMark").getAmplifier());
}
CustomDamage.appendDebuffsToName(m);
if (m.getCustomName().contains(" ")) {
m.setCustomNameVisible(true);
if (les.GetTarget()!=null && m.hasLineOfSight(les.GetTarget()) ||
hasLineOfSightWithAPlayer(m)) {
String actualName = les.getActualName();
if (actualName.length()>0) {
//m.setCustomName(ChatColor.stripColor(GenericFunctions.getDisplayName(m)));
/*if (m.getCustomName().contains("Dangerous")) {
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
} else
if (m.getCustomName().contains("Deadly")) {
m.setCustomName(ChatColor.GOLD+m.getCustomName());
} else
if (m.getCustomName().contains("Hellfire")) {
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
} else {
m.setCustomName(ChatColor.WHITE+m.getCustomName()+ChatColor.RESET+" ");
}*/
if (Buff.hasBuff(m, "DeathMark")) {
GenericFunctions.RefreshBuffColor(m, Buff.getBuff(m, "DeathMark").getAmplifier());
}
CustomDamage.appendDebuffsToName(m);
if (les.suffix_bar.length()>0 || les.prefix.length()>0) {
m.setCustomNameVisible(true);
}
m.setCustomName(actualName);
}
}
}
}
private static boolean hasLineOfSightWithAPlayer(LivingEntity ent) {
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getWorld().equals(ent.getWorld()) && p.getLocation().distanceSquared(ent.getLocation())<=625 &&
p.hasLineOfSight(ent)) {
return true;
}
}
return false;
}
//Either gets a monster structure that exists or creates a new one.
public static LivingEntityStructure GetLivingEntityStructure(LivingEntity m) {
if (m instanceof Player) {
@ -191,4 +336,220 @@ public class LivingEntityStructure {
}
}
}
public String getUnloadedName() {
StringBuilder sb = new StringBuilder(difficulty_modifier);
sb.append(ChatColor.RESET);
sb.append(";");
sb.append(ChatColor.RESET);
sb.append(base_name);
return sb.toString();
}
public static void setCustomLivingEntityName(LivingEntity l, String name) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.base_name = name;
}
public static String getCustomLivingEntityName(LivingEntity l) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.base_name;
}
public static void setChannelingBar(LivingEntity l, String barString) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
les.prefix = barString;
}
public static String getChannelingBar(LivingEntity l) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
return les.prefix;
}
public static int getAggroRating(LivingEntity l, Entity targetEntity) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
if (les.aggro_table.containsKey(targetEntity.getUniqueId())) {
return les.aggro_table.get(targetEntity.getUniqueId());
} else {
return 0;
}
}
public int getAggroRating(Entity targetEntity) {
return getAggroRating(m, targetEntity);
}
/**
* May return null if there is no currently aggro'd target.
*/
public static LivingEntity getAggroTarget(LivingEntity l) {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
int highest_aggroRating = 0;
UUID bestAggroTarget = null;
for (UUID ent : les.aggro_table.keySet()) {
if (les.aggro_table.get(ent)>highest_aggroRating) {
highest_aggroRating = les.aggro_table.get(ent);
bestAggroTarget = ent;
}
}
for (Entity e : l.getWorld().getEntities()) {
if (e instanceof LivingEntity) {
if (e.getUniqueId().equals(bestAggroTarget) && EntityUtils.isValidEntity(e)) {
return (LivingEntity)e;
}
}
}
les.aggro_table.remove(bestAggroTarget);
return null;
}
/**
* May return null if there is no currently aggro'd target.
*/
public LivingEntity getAggroTarget() {
return getAggroTarget(m);
}
public void setAggro(LivingEntity target, int aggroValue) {
if (isValidTarget(target)) {
UUID key = target.getUniqueId();
aggro_table.put(key, Math.max(aggroValue, 0));
}
}
public void increaseAggro(LivingEntity target, int amt) {
amt = getNewAggroBasedOnAggroMultipliers(target,amt);
setAggro(target,getAggroRating(target)+amt);
}
private int getNewAggroBasedOnAggroMultipliers(LivingEntity target, int amt) {
if (target instanceof Player) {
Player p = (Player)target;
amt += amt * ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL);
if (ItemSet.hasFullSet(p, ItemSet.PRIDE)) {
return amt * ItemSet.getHighestTierInSet(p, ItemSet.PRIDE);
}
}
return amt;
}
public void decreaseAggro(LivingEntity target, int amt) {
increaseAggro(target,-amt);
}
/**
* Increases aggro of selected Target, multiplies all other aggro by multiplier.
*/
public void increaseAggroWhileMultiplyingAllOthers(LivingEntity target, int amt, double multiplier) {
if (isValidTarget(target)) {
for (UUID id : aggro_table.keySet()) {
if (id!=target.getUniqueId()) {
//setAggro(target,-(int)(getAggroRating(target)*multiplier));
if (aggro_table.containsKey(id)) {
aggro_table.put(id, (int)(aggro_table.get(id)*multiplier));
}
} else {
increaseAggro(target,amt);
}
}
}
}
public void increaseAggroWhileMultiplyingAllOthers(List<LivingEntity> targets, int amt, double multiplier) {
List<UUID> uuid_list = new ArrayList<UUID>();
for (LivingEntity ent : targets) {
uuid_list.add(ent.getUniqueId());
}
if (isValidTarget(target)) {
for (UUID id : aggro_table.keySet()) {
if (!uuid_list.contains(id)) {
//setAggro(target,-(int)(getAggroRating(target)*multiplier));
if (aggro_table.containsKey(id)) {
aggro_table.put(id, (int)(aggro_table.get(id)*multiplier));
}
} else {
increaseAggro(target,amt);
}
}
}
}
private boolean isValidTarget(LivingEntity target) {
return target!=null && EntityUtils.isValidEntity(target) && target!=m;
}
public double getAggroPercentage(LivingEntity target) {
int highestAggro = 0;
if (!aggro_table.containsKey(target.getUniqueId())) {
return 0.0;
} else {
for (UUID id : aggro_table.keySet()) {
if (aggro_table.get(id)>highestAggro) {
highestAggro = aggro_table.get(id);
}
}
//TwosideKeeper.log("Aggro is "+aggro_table.get(target.getUniqueId())+" / "+highestAggro, 0);
return ((double)aggro_table.get(target.getUniqueId()))/highestAggro;
}
}
public String displayAggroTable() {
StringBuilder sb = new StringBuilder("Aggro Table for Entity "+GenericFunctions.GetEntityDisplayName(m)+": \n");
for (UUID id : aggro_table.keySet()) {
int aggroRating = aggro_table.get(id);
sb.append(" "+id+" : "+aggroRating+"\n");
}
return sb.toString();
}
public void UpdateAggroTarget() {
LivingEntity target = getAggroTarget();
if (target!=null) {
if (m instanceof Monster) {
Monster mm = (Monster)m;
mm.setTarget(target);
EntityTargetEvent ev = new EntityTargetEvent(m,target,TargetReason.CUSTOM);
Bukkit.getPluginManager().callEvent(ev);
}
SetTarget(target);
if (lastHit+40<=TwosideKeeper.getServerTickTime()) {
decreaseAggro(target,getAggroRating(target)/2);
//TwosideKeeper.log("Decreased aggro due to no attacking to "+getAggroRating(target), 0);
}
}
if (target!=null && !EntityUtils.isValidEntity(target)) {
aggro_table.remove(target.getUniqueId());
}
}
public static boolean isFriendly(LivingEntity ent1, LivingEntity ent2) {
if (!(ent1 instanceof Player) &&
!(ent2 instanceof Player)) {
LivingEntityStructure les1 = LivingEntityStructure.GetLivingEntityStructure(ent1);
LivingEntityStructure les2 = LivingEntityStructure.GetLivingEntityStructure(ent2);
if (les1.isPet && les2.isPet) {
if (les1.petOwner!=null && les2.petOwner!=null) {
return PVP.isFriendly(les1.petOwner, les2.petOwner);
} else {
return true;
}
} else {
return false;
}
} else
if (!(ent1 instanceof Player) ^
!(ent2 instanceof Player)) {
if (ent1 instanceof Player) { //ent2 is the pet.
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent2);
if (les.isPet && les.petOwner!=null) {
return PVP.isFriendly(les.petOwner,(Player)ent1);
} else {
return false;
}
} else { //ent1 is the pet.
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent1);
if (les.isPet && les.petOwner!=null) {
return PVP.isFriendly(les.petOwner,(Player)ent2);
} else {
return false;
}
}
} else
{
return PVP.isFriendly((Player)ent1,(Player)ent2);
}
}
}

@ -112,6 +112,10 @@ public class DamageLogger {
return finalstring.toString();
}
public double getRawDamage() {
return actualtotaldmg;
}
private ChatColor getPercentColor(Double val, Double total) {
if (val/total>=0.9) {
return ChatColor.DARK_RED;

@ -0,0 +1,39 @@
package sig.plugin.TwosideKeeper.Modes;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.HelperStructures.PetState;
public class Summoner {
/**
*
* @return False means stop the action from passing onto other sections of code.
*/
public static boolean HandleSummonerInteraction(Event e) {
if (e instanceof PlayerInteractEvent) {
PlayerInteractEvent ev = (PlayerInteractEvent)e;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
if (ev.getAction()==Action.RIGHT_CLICK_BLOCK && pd.myPet!=null && pd.myPet.getState()==PetState.PASSIVE) {
PetMoveCommand(ev.getClickedBlock().getLocation(),ev.getPlayer());
}
} else
if (e instanceof PlayerInteractEntityEvent) {
PlayerInteractEntityEvent ev = (PlayerInteractEntityEvent)e;
}
return false;
}
private static void PetMoveCommand(Location targetLoc, Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.myPet!=null) {
pd.myPet.setTargetLocation(targetLoc);
pd.myPet.setState(PetState.MOVING);
}
}
}

@ -0,0 +1,49 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.EffectPool;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlock;
public class Bloodmite extends CustomMonster{
long lastBloodPool=TwosideKeeper.getServerTickTime();
SniperSkeleton main;
public Bloodmite(LivingEntity m) {
super(m);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.setCustomLivingEntityName(m, ChatColor.RED+"Bloodmite");
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.12f);
}
public void setMainEntity(SniperSkeleton ss) {
main = ss;
}
public GlowAPI.Color getGlowColor() {
return GlowAPI.Color.WHITE;
}
public void runTick() {
if (lastBloodPool+90<=TwosideKeeper.getServerTickTime()) {
TemporaryBlock.createTemporaryBlockCircle(m.getLocation(), 1, Material.WOOL, (byte)14, 20*30, "BLOODPOOL");
new EffectPool(m.getLocation(),1,20*30,Color.fromRGB(255, 0, 0));
lastBloodPool=TwosideKeeper.getServerTickTime();
}
}
public void cleanup() {
if (main!=null) {
main.bloodmites.remove(m);
}
}
}

@ -0,0 +1,28 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Zombie;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
public class ChallengeBlaze extends Blaze{
public ChallengeBlaze(LivingEntity m) {
super(m);
}
public static boolean isChallengeBlaze(LivingEntity m) {
if (m instanceof org.bukkit.entity.Blaze &&
LivingEntityStructure.getCustomLivingEntityName(m).equalsIgnoreCase(ChatColor.RED+"Challenge Blaze") &&
m.getMaxHealth()==25000000 &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL) {
return true;
}
return false;
}
}

@ -0,0 +1,27 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.LivingEntity;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
public class ChallengeGhast extends HellfireGhast{
public ChallengeGhast(LivingEntity m) {
super(m);
}
public static boolean isChallengeGhast(LivingEntity m) {
if (m instanceof org.bukkit.entity.Ghast &&
LivingEntityStructure.getCustomLivingEntityName(m).equalsIgnoreCase(ChatColor.RED+"Challenge Ghast") &&
m.getMaxHealth()==25000000 &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL) {
return true;
}
return false;
}
}

@ -0,0 +1,27 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
public class ChallengeSpider extends HellfireSpider{
public ChallengeSpider(LivingEntity m) {
super(m);
}
public static boolean isChallengeSpider(LivingEntity m) {
if (m instanceof org.bukkit.entity.Spider &&
LivingEntityStructure.getCustomLivingEntityName(m).equalsIgnoreCase(ChatColor.RED+"Challenge Spider") &&
m.getMaxHealth()==25000000 &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL) {
return true;
}
return false;
}
}

@ -0,0 +1,32 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Zombie;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class ChallengeZombie extends CustomMonster{
public ChallengeZombie(LivingEntity m) {
super(m);
}
public MixedDamage getBasicAttackDamage() {
return MixedDamage.v(50,0.01,1);
}
public static boolean isChallengeZombie(LivingEntity m) {
if (m instanceof Zombie &&
LivingEntityStructure.getCustomLivingEntityName(m).equalsIgnoreCase(ChatColor.RED+"Challenge Zombie") &&
m.getMaxHealth()==25000000 &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL) {
return true;
}
return false;
}
}

@ -0,0 +1,232 @@
package sig.plugin.TwosideKeeper.Monster;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Spider;
import org.bukkit.potion.PotionEffectType;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.Buff;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Events.EntityChannelCastEvent;
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Spell;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class DarkSpider extends CustomMonster{
Knight linked_knight;
final static int[] SILENCE_DURATIONS = new int[]{200,100,60};
final static int[] MINION_HEALTH = new int[]{900,3000,18000};
List<LivingEntity> temp_spiders = new ArrayList<LivingEntity>();
final Spell SPIDERSUMMON = new Spell("Summon Spider",new int[]{100,60,40},new int[]{600,500,400});
final Spell ULTRABURST = new Spell("UltraBurst",new int[]{80,80,80},new int[]{1200,900,800}, new MixedDamage[]{MixedDamage.v(200),MixedDamage.v(1000),MixedDamage.v(50,0.95)});
MixedDamage[] BASIC_ATTACK_DAMAGE = new MixedDamage[]{MixedDamage.v(20),MixedDamage.v(40),MixedDamage.v(40, 0.01)};
int randomness = 16;
public DarkSpider(LivingEntity m) {
super(m);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
MonsterController.convertLivingEntity(m, LivingEntityDifficulty.NORMAL);
les.setCustomLivingEntityName(m, ChatColor.DARK_RED+"Dark Spider");
m.setMaxHealth(100000);
m.setHealth(m.getMaxHealth());
m.setAI(true);
}
public void runTick() {
if (canCastSpells()) { //SPELL CASTS HERE.
castSpiderSummon();
}
removeIfCannotFindMaster();
}
private void removeIfCannotFindMaster() {
if (linked_knight==null) {
for (LivingEntity l : temp_spiders) {
l.remove();
}
m.remove();
}
}
private void castSpiderSummon() {
CastSpell(SPIDERSUMMON);
}
public void runChannelCastEvent(EntityChannelCastEvent ev) {
switch (ev.getAbilityName()) {
case "Summon Spider":{
//Create another Spider.
DarkSpiderMinion dsm = InitializeDarkSpiderMinion(linked_knight);
dsm.linked_knight = linked_knight;
SPIDERSUMMON.setLastCastedTime(TwosideKeeper.getServerTickTime());
}break;
case "UltraBurst":{
playUltraBurst();
ULTRABURST.setLastCastedTime(TwosideKeeper.getServerTickTime());
}break;
}
}
private void playUltraBurst() {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_TNT_PRIMED, 1.0f, 1.0f);
for (int i=0;i<3;i++) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_TNT_PRIMED, 1.0f, 1.2f);}, (i+1)*10);
}
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
aPlugin.API.sendSoundlessExplosion(m.getLocation(), 6);
m.getWorld().spawnParticle(Particle.LAVA, m.getLocation(), 30);
m.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, m.getLocation(), 2);
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 0.7f);
DealSpellDamageToNearbyPlayers(ULTRABURST,50,true,false,3);
m.remove();
}, 40);
}
private void DealSpellDamageToNearbyPlayers(Spell spell, int range, boolean knockup, boolean dodgeable, double knockupamt) {
List<Player> players = GenericFunctions.DealDamageToNearbyPlayers(m.getLocation(), spell.getDamageValues()[getDifficultySlot()].getDmgComponent(), range, knockup, dodgeable, knockupamt, m, spell.getName(), false);
if (spell.getDamageValues()[getDifficultySlot()].hasTruePctDmgComponent()) {GenericFunctions.DealDamageToNearbyPlayers(m.getLocation(), spell.getDamageValues()[getDifficultySlot()].getTruePctDmgComponent(), range, knockup, dodgeable, knockupamt, m, spell.getName(), false,true);}
if (spell.getDamageValues()[getDifficultySlot()].hasTrueDmgComponent()) {GenericFunctions.DealDamageToNearbyPlayers(m.getLocation(), spell.getDamageValues()[getDifficultySlot()].getTrueDmgComponent(), range, knockup, dodgeable, knockupamt, m, spell.getName(), true);}
for (Player p : players) {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.CONFUSION, 20*6, 1);
}
}
private DarkSpiderMinion InitializeDarkSpiderMinion(Knight knight) {
LivingEntity knight_ent = knight.GetMonster();
CaveSpider s = (CaveSpider)knight_ent.getWorld().spawnEntity(m.getLocation(), EntityType.CAVE_SPIDER);
DarkSpiderMinion dsm = new DarkSpiderMinion(s);
TwosideKeeper.custommonsters.put(s.getUniqueId(), dsm);
s.setMaxHealth(MINION_HEALTH[getDifficultySlot()]);
s.setHealth(s.getMaxHealth());
temp_spiders.add(s);
return dsm;
}
public MixedDamage getBasicAttackDamage() {
return BASIC_ATTACK_DAMAGE[getDifficultySlot()];
}
protected void CastSpell(Spell spell) {
if (hasValidKnight() &&
cooldownIsAvailable(spell.getLastCastedTime(),spell)) {
Channel.createNewChannel(m, spell.getName(), spell.getCastTimes()[getDifficultySlot()]);
}
}
private boolean cooldownIsAvailable(long spell_timer, Spell spell) {
return spell_timer+spell.getCooldowns()[getDifficultySlot()]<=TwosideKeeper.getServerTickTime();
}
public static double getDamageReduction() {
return 1.0;
}
public static Spider InitializeDarkSpider(LivingEntity sourceKnight) {
Spider s = (Spider)sourceKnight.getWorld().spawnEntity(sourceKnight.getLocation(), EntityType.SPIDER);
DarkSpider ds = new DarkSpider(s);
TwosideKeeper.custommonsters.put(s.getUniqueId(), ds);
return s;
}
public static boolean isDarkSpider(LivingEntity m) {
return (m instanceof Spider && !(m instanceof CaveSpider)) &&
m.getMaxHealth()==100000 &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL;
}
public LivingEntityDifficulty getDifficulty() {
if (hasValidKnight()) {
return MonsterController.getLivingEntityDifficulty(linked_knight.GetMonster());
} else {
return LivingEntityDifficulty.T1_MINIBOSS;
}
}
private boolean hasValidKnight() {
return linked_knight!=null && linked_knight.GetMonster()!=null && linked_knight.GetMonster().isValid();
}
public int getDifficultySlot() {
switch (getDifficulty()) {
case T1_MINIBOSS:{
return 0;
}
case T2_MINIBOSS:{
return 1;
}
case T3_MINIBOSS:{
return 2;
}
default:{
TwosideKeeper.log("WARNING! Could not get proper difficulty slot for Difficulty "+getDifficulty()+". Defaulting to slot 0.", 1);
return 0;
}
}
}
public boolean canCastSpells() {
return Math.random()<=1/16d && !Buff.hasBuff(m, "SILENCE") && hasValidKnight() && linked_knight.startedfight && !Channel.isChanneling(m);
}
public void onHitEvent(LivingEntity damager, double damage) {
Buff.addBuff(
m, "SILENCE", new Buff(
"Silence",SILENCE_DURATIONS[getDifficultySlot()],
0,Color.BLUE,ChatColor.WHITE+"…",false));
if (Channel.isChanneling(m)) {
Channel.stopChanneling(m);
}
if (hasValidKnight() &&
(damager instanceof Player)) {
linked_knight.addParticipant((Player)damager);
}
}
public void cleanup() {
for (LivingEntity l : temp_spiders) {
if (l!=null && l.isValid()) {
if (TwosideKeeper.custommonsters.containsKey(l.getUniqueId())) {
CustomMonster cm = TwosideKeeper.custommonsters.get(l.getUniqueId());
cm.cleanup();
}
l.remove();
}
}
m.remove();
}
public GlowAPI.Color getGlowColor() {
if (Channel.isChanneling(m)) {
return GlowAPI.Color.YELLOW;
} else {
if (GenericFunctions.isSuppressed(m)) {
return GlowAPI.Color.BLACK;
} else {
return GlowAPI.Color.NONE;
}
}
}
}

@ -0,0 +1,44 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.ChatColor;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Spider;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Spell;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
public class DarkSpiderMinion extends DarkSpider{
MixedDamage[] BASIC_ATTACK_DAMAGE = new MixedDamage[]{MixedDamage.v(40),MixedDamage.v(80),MixedDamage.v(80, 0.02)};
public DarkSpiderMinion(LivingEntity m) {
super(m);
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
les.setCustomLivingEntityName(m, ChatColor.DARK_PURPLE+"Dark Spider Minion");
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.5f);
}
public void runTick() {
super.runTick();
if (canCastSpells()) {
CastSpell(ULTRABURST);
}
}
public MixedDamage getBasicAttackDamage() {
return BASIC_ATTACK_DAMAGE[getDifficultySlot()];
}
public static boolean isDarkSpiderMinion(LivingEntity m) {
return (m instanceof CaveSpider) &&
(m.getMaxHealth()==MINION_HEALTH[0] ||
m.getMaxHealth()==MINION_HEALTH[1] ||
m.getMaxHealth()==MINION_HEALTH[2]) &&
MonsterController.getLivingEntityDifficulty(m)==LivingEntityDifficulty.NORMAL;
}
}

@ -15,7 +15,9 @@ import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MovementModifier;
public class Dummy extends CustomMonster{
@ -29,7 +31,9 @@ public class Dummy extends CustomMonster{
public Dummy(LivingEntity m) {
super(m);
m.setCustomName(ChatColor.MAGIC+" "+ChatColor.RESET+"Test Dummy"+ChatColor.MAGIC+" ");
//m.setCustomName(ChatColor.MAGIC+" "+ChatColor.RESET+"Test Dummy"+ChatColor.MAGIC+" ");
ChatColor randcolor = TextUtils.RandomColor();
TwosideKeeperAPI.setCustomLivingEntityName(m, randcolor+""+ChatColor.MAGIC+" "+ChatColor.RESET+randcolor+"Test Dummy"+ChatColor.MAGIC+" ");
m.setCustomNameVisible(true);
this.spawnLoc = m.getLocation();
//m.setCollidable(false);
@ -85,20 +89,26 @@ public class Dummy extends CustomMonster{
return sb.toString();
}
public void customHitHandler(Player p, double dmg) {
super.customHitHandler(p,dmg);
public void addPlayerToHitList(Player p) {
if (!playerHitList.contains(p)) {
playerHitList.add(p);
}
}
public void customHitHandler(double dmg) {
super.customHitHandler(dmg);
if (numbOfHits==0) {
timeStartedHitting=TwosideKeeper.getServerTickTime();
dmgdealt=0;
}
if (!playerHitList.contains(p)) {
playerHitList.add(p);
}
lastHitTime=TwosideKeeper.getServerTickTime();
numbOfHits++;
dmgdealt+=dmg;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
m.setVelocity(new Vector(0,0,0));
}, 1);
}
}

@ -0,0 +1,17 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.entity.LivingEntity;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.CustomMonster;
public class ExplosiveMite extends CustomMonster{
public ExplosiveMite(LivingEntity m) {
super(m);
}
public GlowAPI.Color getGlowColor() {
return GlowAPI.Color.RED;
}
}

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

Loading…
Cancel
Save