+>Rangers do not lose any durability when dodging attacks.

+>Extra Recipes from Jobs now show up in the Misc Items Category of the
'/craft' menu.
+>The Bauble Pouch has been added. The Pouch is crafted with 8 leather +
1 Chorus Flower and holds up to 9 items inside. The Bauble Pouch is now
a requirement in the off hand slot for Slayer Mode to activate.
	Bauble Pouches are opened just like Item Cubes, and can be interacted
with in similar ways. You can click items directly into them, or open up
their inventories to insert/remove items.
>Fixed a bug causing money transactions to not work properly.
>Mode Switching for Bows can only be done via left-click now. The order
of the old right-click version is now the left-click version: CLOSE ->
SNIPE -> DEBILITATION -> CLOSE
>Fixed a bug where Slayers would benefit from perks of a Lorasys Sword
even when not currently holding one (Just by letting it sit in the
hotbar).
>Fixed a bug causing the Backstab sound to play when viewing '/stats' as
a Slayer.
>Updated in-game Slayer description: "->Players are identified as
'Slayers' by wearing no armor, and wearing a Bauble Pouch in their off
hand."
>Updated the descriptions of Baubles.
>Improved efficiency of Hellfire leader code and Magma cube checking
code, leading to less overhead and lag with these scenarios.
->Baubles no longer function when in the hotbar of a player's inventory.
->Dodge Chance now reduces durability of all armor by 3+(1% Durability)
per dodge. (This does not apply to block chance.)
->Defenders now lose durability on their shields as they block attacks.
->The Alustine Set no longer increases base damage. It now applies true
damage on each hit instead.
testdev
sigonasr2 8 years ago
parent 22e31e2b8c
commit bcf29de763
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 108
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  4. 82
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/BaublePouch.java
  5. 54
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  6. 13
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/JobRecipe.java
  7. 6
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/RecipeLinker.java
  8. 23
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
  9. 22
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  10. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
  11. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Pronouns.java
  12. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java
  13. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java
  14. 14
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  15. 1
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  16. 3
      src/sig/plugin/TwosideKeeper/Recipes.java
  17. 292
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  18. 5
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.10.7a version: 3.10.8
loadbefore: [aPlugin] loadbefore: [aPlugin]
commands: commands:
money: money:

@ -162,9 +162,11 @@ public class CustomDamage {
private static double CalculateBonusTrueDamage(Entity damager) { private static double CalculateBonusTrueDamage(Entity damager) {
if (getDamagerEntity(damager) instanceof Player) { if (getDamagerEntity(damager) instanceof Player) {
LivingEntity shooter = getDamagerEntity(damager);
double bonus_truedmg = 0; double bonus_truedmg = 0;
Player p = (Player)getDamagerEntity(damager); Player p = (Player)getDamagerEntity(damager);
bonus_truedmg += API.getPlayerBonuses(p).getBonusTrueDamage(); bonus_truedmg += API.getPlayerBonuses(p).getBonusTrueDamage();
bonus_truedmg += ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(shooter), (Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0;
return bonus_truedmg; return bonus_truedmg;
} else { } else {
return 0.0; return 0.0;
@ -237,12 +239,14 @@ public class CustomDamage {
dmg += addMultiplierToPlayerLogger(damager,target,"Tactics Bonus Mult",dmg * API.getPlayerBonuses((Player)shooter).getBonusOverallDamageMultiplier()); dmg += addMultiplierToPlayerLogger(damager,target,"Tactics Bonus Mult",dmg * API.getPlayerBonuses((Player)shooter).getBonusOverallDamageMultiplier());
} }
dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target));
double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter)); if ((reason==null || !reason.equalsIgnoreCase("Test Damage"))) {
if (preemptivedmg!=0.0) {preemptive=true;} double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter));
dmg += preemptivedmg; if (preemptivedmg!=0.0) {preemptive=true;}
double backstabdmg = addMultiplierToPlayerLogger(damager,target,"Backstab Mult",dmg * calculateBackstabMultiplier(target,shooter)); dmg += preemptivedmg;
if (backstabdmg!=0.0) {preemptive=true;} double backstabdmg = addMultiplierToPlayerLogger(damager,target,"Backstab Mult",dmg * calculateBackstabMultiplier(target,shooter));
dmg += backstabdmg; if (backstabdmg!=0.0 && (reason==null || !reason.equalsIgnoreCase("Test Damage"))) {preemptive=true;}
dmg += backstabdmg;
}
dmg += addMultiplierToPlayerLogger(damager,target,"Isolation Damage Mult",dmg * calculateIsolationMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"Isolation Damage Mult",dmg * calculateIsolationMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"STRENGTH Mult",dmg * calculateStrengthEffectMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"STRENGTH Mult",dmg * calculateStrengthEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target));
@ -264,7 +268,9 @@ public class CustomDamage {
dmg -= getDamageReduction(target); dmg -= getDamageReduction(target);
} }
addToLoggerActual(damager,dmg); addToLoggerActual(damager,dmg);
addToPlayerRawDamage(dmg,target); if (reason==null || !reason.equalsIgnoreCase("Test Damage")) {
addToPlayerRawDamage(dmg,target);
}
if (!isFlagSet(flags, TRUEDMG)) { if (!isFlagSet(flags, TRUEDMG)) {
if (target instanceof Player) { if (target instanceof Player) {
if (PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN) { if (PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN) {
@ -648,7 +654,7 @@ public class CustomDamage {
GenericFunctions.addSuppressionTime(target, 15); GenericFunctions.addSuppressionTime(target, 15);
} }
if (isFlagSet(pd.lasthitproperties,IS_PREEMPTIVE)) { if (isFlagSet(pd.lasthitproperties,IS_PREEMPTIVE)) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.WOLFSBANE, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 7)) {
if (pd.slayermodehp+2<p.getMaxHealth()) { if (pd.slayermodehp+2<p.getMaxHealth()) {
pd.slayermodehp+=2; pd.slayermodehp+=2;
p.setHealth(pd.slayermodehp); p.setHealth(pd.slayermodehp);
@ -657,13 +663,13 @@ public class CustomDamage {
p.setHealth(pd.slayermodehp); p.setHealth(pd.slayermodehp);
} }
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.ALUSTINE, 5)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5)) {
GenericFunctions.spawnXP(target.getLocation(), (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.ALUSTINE, 5, 4)); GenericFunctions.spawnXP(target.getLocation(), (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5, 4));
} }
} }
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 2)) {
int poisonlv = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2, 2); int poisonlv = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 2, 2);
if (target.hasPotionEffect(PotionEffectType.BLINDNESS) && GenericFunctions.getPotionEffectLevel(PotionEffectType.BLINDNESS, target)<=poisonlv) { if (target.hasPotionEffect(PotionEffectType.BLINDNESS) && GenericFunctions.getPotionEffectLevel(PotionEffectType.BLINDNESS, target)<=poisonlv) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target);
} else { } else {
@ -752,7 +758,7 @@ public class CustomDamage {
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f); SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
p.setHealth(p.getMaxHealth()); p.setHealth(p.getMaxHealth());
GenericFunctions.RevivePlayer(p,p.getMaxHealth()); GenericFunctions.RevivePlayer(p,p.getMaxHealth());
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p); ItemStack[] hotbar = GenericFunctions.getBaubles(p);
GenericFunctions.RandomlyBreakBaubles(p, hotbar); GenericFunctions.RandomlyBreakBaubles(p, hotbar);
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime(); pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime();
@ -1083,7 +1089,7 @@ public class CustomDamage {
} }
private static void removeExperienceFromAlustineSetBonus(Player p) { private static void removeExperienceFromAlustineSetBonus(Player p) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.ALUSTINE, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 7)) {
aPlugin.API.setTotalExperience(p, aPlugin.API.getTotalExperience(p)-p.getLevel()); aPlugin.API.setTotalExperience(p, aPlugin.API.getTotalExperience(p)-p.getLevel());
} }
} }
@ -1188,7 +1194,7 @@ public class CustomDamage {
} }
private static void subtractWeaponDurability(Player p,ItemStack weapon) { private static void subtractWeaponDurability(Player p,ItemStack weapon) {
aPlugin.API.damageItem(p, weapon, 1); aPlugin.API.damageItem(p.getInventory(), weapon, 1);
} }
static void triggerEliteEvent(Player p, Entity damager) { static void triggerEliteEvent(Player p, Entity damager) {
@ -1415,7 +1421,9 @@ public class CustomDamage {
} }
static void setMonsterTarget(LivingEntity m, Player p) { static void setMonsterTarget(LivingEntity m, Player p) {
addChargeZombieToList(m); if (TwosideKeeper.chargezombies.size()<16) {
addChargeZombieToList(m);
}
addToCustomStructures(m); addToCustomStructures(m);
addMonsterToTargetList(m,p); addMonsterToTargetList(m,p);
} }
@ -1570,14 +1578,14 @@ public class CustomDamage {
TwosideKeeper.log("Enough ticks have passed.", 5); TwosideKeeper.log("Enough ticks have passed.", 5);
if (CanResistExplosionsWithExperienceSet(damager, target, reason)) { if (CanResistExplosionsWithExperienceSet(damager, target, reason)) {
aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2, 2),0)); aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2, 2),0));
SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f); ((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f);
GenericFunctions.updateNoDamageTickMap(target, damager); GenericFunctions.updateNoDamageTickMap(target, damager);
return true; return true;
} }
if (CanResistDotsWithExperienceSet(damager, target, reason)) { if (CanResistDotsWithExperienceSet(damager, target, reason)) {
aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 3, 3),0)); aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3, 3),0));
SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f); ((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f);
GenericFunctions.updateNoDamageTickMap(target, damager); GenericFunctions.updateNoDamageTickMap(target, damager);
@ -1654,16 +1662,16 @@ public class CustomDamage {
} }
public static boolean CanResistExplosionsWithExperienceSet(Entity damager, LivingEntity target, String reason) { public static boolean CanResistExplosionsWithExperienceSet(Entity damager, LivingEntity target, String reason) {
return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2) && return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2) &&
((reason!=null && (reason.equalsIgnoreCase("explosion") || reason.equalsIgnoreCase("entity_explosion"))) ((reason!=null && (reason.equalsIgnoreCase("explosion") || reason.equalsIgnoreCase("entity_explosion")))
|| damager instanceof Creeper) && || damager instanceof Creeper) &&
aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2, 2); aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 2, 2);
} }
public static boolean CanResistDotsWithExperienceSet(Entity damager, LivingEntity target, String reason) { public static boolean CanResistDotsWithExperienceSet(Entity damager, LivingEntity target, String reason) {
return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 3) && return target instanceof Player && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3) &&
((reason!=null && (reason.equalsIgnoreCase("poison") || reason.equalsIgnoreCase("wither") || reason.equalsIgnoreCase("fire_tick") || reason.equalsIgnoreCase("lava") || reason.equalsIgnoreCase("fire")))) && ((reason!=null && (reason.equalsIgnoreCase("poison") || reason.equalsIgnoreCase("wither") || reason.equalsIgnoreCase("fire_tick") || reason.equalsIgnoreCase("lava") || reason.equalsIgnoreCase("fire")))) &&
aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 3, 3); aPlugin.API.getTotalExperience((Player)target)>=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(target), (Player)target, ItemSet.ALUSTINE, 3, 3);
} }
private static boolean canHitMobDueToWeakness(Entity damager) { private static boolean canHitMobDueToWeakness(Entity damager) {
@ -1803,11 +1811,11 @@ public class CustomDamage {
} }
} }
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 3, 3)/100d; dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 3, 3)/100d;
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) {
dodgechance+=(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7, 4))); //For every 1m, give 5%. dodgechance+=(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7, 4))); //For every 1m, give 5%.
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7) && if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 7) &&
GenericFunctions.hasStealth(p)) { GenericFunctions.hasStealth(p)) {
dodgechance+=0.4; dodgechance+=0.4;
} }
@ -1864,24 +1872,28 @@ public class CustomDamage {
darknessdiv += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH)/100d; darknessdiv += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH)/100d;
} }
} else { } else {
LivingEntityDifficulty diff = EntityUtils.GetStrongestNearbyEntityDifficulty(EntityType.MAGMA_CUBE, target, 4); LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(target);
double reduction = 0.0d; if (!les.checkedforcubes) {
if (diff!=null) { LivingEntityDifficulty diff = EntityUtils.GetStrongestNearbyEntityDifficulty(EntityType.MAGMA_CUBE, target, 4);
switch (diff) { double reduction = 0.0d;
case DANGEROUS:{ if (diff!=null) {
reduction=0.4d; switch (diff) {
}break; case DANGEROUS:{
case DEADLY:{ reduction=0.4d;
reduction=0.6d; }break;
}break; case DEADLY:{
case HELLFIRE:{ reduction=0.6d;
reduction=0.8d; }break;
}break; case HELLFIRE:{
default:{ reduction=0.8d;
reduction=0.2d; }break;
default:{
reduction=0.2d;
}
} }
magmacubediv+=Math.min(reduction,1);
} }
magmacubediv+=Math.min(reduction,1); les.checkedforcubes=true;
} }
} }
@ -2346,7 +2358,7 @@ public class CustomDamage {
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 2, 2); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 3, 3);
dmg += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.LORASYS); dmg += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.LORASYS);
dmg += ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(shooter), (Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0; //dmg += ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(shooter), (Player)shooter, ItemSet.ALUSTINE, 7)?((Player)shooter).getLevel():0;
/*dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.JAMDAK, 3, 3); /*dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.JAMDAK, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3);
@ -2572,8 +2584,8 @@ public class CustomDamage {
critchance += (PlayerMode.isStriker(p)?0.2:0.0); critchance += (PlayerMode.isStriker(p)?0.2:0.0);
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,4,4)/100d; critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,4,4)/100d;
critchance += (PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0); critchance += (PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0);
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 5, 4)/100d; critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 5, 4)/100d;
critchance += ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.WOLFSBANE)/100d; critchance += ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE)/100d;
critchance += API.getPlayerBonuses(p).getBonusCriticalChance(); critchance += API.getPlayerBonuses(p).getBonusCriticalChance();
critchance += (pd.slayermegahit)?1.0:0.0; critchance += (pd.slayermegahit)?1.0:0.0;
if (reason!=null && reason.equalsIgnoreCase("power swing")) { if (reason!=null && reason.equalsIgnoreCase("power swing")) {
@ -2606,7 +2618,7 @@ public class CustomDamage {
critdmg+=1.0; critdmg+=1.0;
} }
critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage(); critdmg+=API.getPlayerBonuses(p).getBonusCriticalDamage();
critdmg+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW)/100d; critdmg+=ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW)/100d;
} }
TwosideKeeper.log("Crit Damage is "+critdmg, 5); TwosideKeeper.log("Crit Damage is "+critdmg, 5);
return critdmg; return critdmg;
@ -3073,7 +3085,7 @@ public class CustomDamage {
*/ */
public static double calculateCooldownReduction(Player p) { public static double calculateCooldownReduction(Player p) {
double cooldown = 0.0; double cooldown = 0.0;
cooldown+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 2, 2)/100d; cooldown+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 2, 2)/100d;
cooldown+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN)/100d; cooldown+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN)/100d;
return cooldown; return cooldown;
} }
@ -3155,7 +3167,7 @@ public class CustomDamage {
double mult = 0.0; double mult = 0.0;
LivingEntity shooter = getDamagerEntity(damager); LivingEntity shooter = getDamagerEntity(damager);
if (shooter instanceof Player) { if (shooter instanceof Player) {
mult += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(shooter), (Player)shooter, ItemSet.MOONSHADOW, 3, 3)/100; mult += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(shooter), (Player)shooter, ItemSet.MOONSHADOW, 3, 3)/100;
} }
return mult; return mult;
} }

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

@ -3499,7 +3499,7 @@ public class GenericFunctions {
pd.slayermodehp = p.getMaxHealth(); pd.slayermodehp = p.getMaxHealth();
ItemStack[] equips = p.getEquipment().getArmorContents(); ItemStack[] equips = p.getEquipment().getArmorContents();
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p); ItemStack[] hotbar = GenericFunctions.getBaubles(p);
if (ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) && if (ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) &&
pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) { pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) {
@ -4139,23 +4139,8 @@ public class GenericFunctions {
} }
} }
public static boolean hasSlayerSetItemOnHotbar(Player p) { public static boolean hasBaublePouchInOffHand(Player p) {
for (int i=0;i<9;i++) { return BaublePouch.isBaublePouch(p.getEquipment().getItemInOffHand());
if (i==9) {
i=40;
}
ItemStack item = p.getInventory().getContents()[i];
ItemSet set = TwosideKeeperAPI.getItemSet(item);
if (set!=null &&
(set==ItemSet.LORASYS ||
set==ItemSet.GLADOMAIN ||
set==ItemSet.MOONSHADOW ||
set==ItemSet.WOLFSBANE ||
set==ItemSet.ALUSTINE)) {
return true;
}
}
return false;
} }
public static boolean WearingNoArmor(Player p) { public static boolean WearingNoArmor(Player p) {
@ -4289,7 +4274,7 @@ public class GenericFunctions {
pd.last_strikerspell=TwosideKeeper.getServerTickTime(); pd.last_strikerspell=TwosideKeeper.getServerTickTime();
} }
SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f); SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(p, weaponused, (weaponused.getType().getMaxDurability()/10)+7); aPlugin.API.damageItem(p.getInventory(), weaponused, (weaponused.getType().getMaxDurability()/10)+7);
final Player p1 = p; final Player p1 = p;
int mult=2; int mult=2;
@ -4362,16 +4347,16 @@ public class GenericFunctions {
aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player)); aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player));
} }
pd.lastassassinatetime=TwosideKeeper.getServerTickTime(); pd.lastassassinatetime=TwosideKeeper.getServerTickTime();
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 5)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 5)) {
GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 5, 4)); GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 5, 4));
} else { } else {
GenericFunctions.addIFrame(player, 10); GenericFunctions.addIFrame(player, 10);
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 3)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 3)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 100, 4, player); GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 100, 4, player);
GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 3, 3)); GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 3, 3));
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 7) && if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(player), player, ItemSet.WOLFSBANE, 7) &&
target.getLocation().distanceSquared(originalloc)<=25) { target.getLocation().distanceSquared(originalloc)<=25) {
pd.lastassassinatetime = TwosideKeeper.getServerTickTime()-TwosideKeeper.ASSASSINATE_COOLDOWN+40; pd.lastassassinatetime = TwosideKeeper.getServerTickTime()-TwosideKeeper.ASSASSINATE_COOLDOWN+40;
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns. if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
@ -4460,12 +4445,12 @@ public class GenericFunctions {
} }
public static void DamageRandomTool(Player p) { public static void DamageRandomTool(Player p) {
if (!aPlugin.API.isAFK(p) && ItemSet.GetSetCount(GenericFunctions.getHotbarItems(p), ItemSet.LORASYS, p)==0) { if (!aPlugin.API.isAFK(p) && ItemSet.GetSetCount(GenericFunctions.getEquipment(p), ItemSet.LORASYS, p)==0) {
ItemStack[] inv = p.getInventory().getContents(); ItemStack[] inv = p.getInventory().getContents();
for (int i=0;i<9;i++) { for (int i=0;i<9;i++) {
if (inv[i]!=null && if (inv[i]!=null &&
isTool(inv[i]) && inv[i].getType()!=Material.BOW) { isTool(inv[i]) && inv[i].getType()!=Material.BOW) {
aPlugin.API.damageItem(p, inv[i], 1); aPlugin.API.damageItem(p.getInventory(), inv[i], 1);
} }
} }
} }
@ -4549,6 +4534,21 @@ public class GenericFunctions {
} }
} }
public static ItemStack[] getBaubles(LivingEntity p) {
Player pl = (Player)p;
ItemStack baublepouch = pl.getEquipment().getItemInOffHand();
if (BaublePouch.isBaublePouch(baublepouch)) {
List<ItemStack> baubles = BaublePouch.getBaublePouchContents(BaublePouch.getBaublePouchID(baublepouch));
ItemStack[] array = new ItemStack[baubles.size()];
array = baubles.toArray(array);
TwosideKeeper.log("Baubles: "+ArrayUtils.toString(array), 5);
return array;
} else {
return new ItemStack[]{
};
}
}
public static ItemStack[] getHotbarItems(LivingEntity p) { public static ItemStack[] getHotbarItems(LivingEntity p) {
Player pl = (Player)p; Player pl = (Player)p;
return new ItemStack[]{ return new ItemStack[]{
@ -4659,7 +4659,7 @@ public class GenericFunctions {
public static boolean AllowedToBeEquippedToOffHand(Player p, ItemStack item, int clickedslot) { public static boolean AllowedToBeEquippedToOffHand(Player p, ItemStack item, int clickedslot) {
//TwosideKeeper.log("Slot:"+clickedslot, 0); 36-44 is hotbar. //TwosideKeeper.log("Slot:"+clickedslot, 0); 36-44 is hotbar.
return (ArrowQuiver.isValidQuiver(item)); /*|| return (ArrowQuiver.isValidQuiver(item) || BaublePouch.isBaublePouch(item)); /*||
(item.getType()==Material.SHIELD && (clickedslot<36 || !p.getEquipment().getItemInMainHand().equals(p.getInventory().getContents()[clickedslot-36])) && (PlayerMode.isDefender(p) || PlayerMode.isNormal(p))));*/ (item.getType()==Material.SHIELD && (clickedslot<36 || !p.getEquipment().getItemInMainHand().equals(p.getInventory().getContents()[clickedslot-36])) && (PlayerMode.isDefender(p) || PlayerMode.isNormal(p))));*/
} }

@ -16,9 +16,22 @@ public class JobRecipe {
this.rec=rec; this.rec=rec;
} }
public String getName() {
return name;
}
public String getCommandName() {
return name.replaceAll(" ", "_");
}
public Recipe getRecipe() {
return rec;
}
public static void InitializeJobRecipes() { public static void InitializeJobRecipes() {
Map<String,Recipe> newrecipes = aPlugin.API.getAddedRecipes(); Map<String,Recipe> newrecipes = aPlugin.API.getAddedRecipes();
for (String namer : newrecipes.keySet()) { for (String namer : newrecipes.keySet()) {
TwosideKeeper.log("Added recipe: "+namer, 4);
Recipe r = newrecipes.get(namer); Recipe r = newrecipes.get(namer);
TwosideKeeper.jobrecipes.add(new JobRecipe(namer,r)); TwosideKeeper.jobrecipes.add(new JobRecipe(namer,r));
} }

@ -383,6 +383,12 @@ public enum RecipeLinker {
CustomItem.WorldShop2(), CustomItem.WorldShop2(),
new ItemStack(Material.TRAPPED_CHEST,1),new ItemStack(Material.SIGN,1),null, new ItemStack(Material.TRAPPED_CHEST,1),new ItemStack(Material.SIGN,1),null,
CustomItem.DirtSubstitute(), CustomItem.DirtSubstitute(),
}),
baublepouch(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Bauble Pouch",new ItemStack[]{
CustomItem.BaublePouch(),
new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),
new ItemStack(Material.LEATHER),new ItemStack(Material.CHORUS_FLOWER),new ItemStack(Material.LEATHER),
new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),new ItemStack(Material.LEATHER),
}); });
String name = ""; String name = "";

@ -24,6 +24,7 @@ import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.Recipes; import sig.plugin.TwosideKeeper.Recipes;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
@ -116,6 +117,28 @@ public class CustomItem {
TwosideKeeper.PIERCING_ARROW_RECIPE = PiercingArrowRecipe(); TwosideKeeper.PIERCING_ARROW_RECIPE = PiercingArrowRecipe();
TwosideKeeper.WORLD_SHOP_RECIPE = WorldShopRecipe(); TwosideKeeper.WORLD_SHOP_RECIPE = WorldShopRecipe();
TwosideKeeper.WORLD_SHOP2_RECIPE = WorldShop2Recipe(); TwosideKeeper.WORLD_SHOP2_RECIPE = WorldShop2Recipe();
TwosideKeeper.BAUBLE_POUCH_RECIPE = BaublePouchRecipe();
}
private static ShapelessRecipe BaublePouchRecipe() {
ShapelessRecipe rec = new ShapelessRecipe(BaublePouch());
rec.addIngredient(4, Material.LEATHER);
rec.addIngredient(1, Material.CHORUS_FLOWER);
rec.addIngredient(4, Material.LEATHER);
return rec;
}
public static ItemStack BaublePouch() {
ItemStack baublePouch = new ItemStack(Material.CHORUS_FLOWER);
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"A handy 9-slot pouch that");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"can hold Baubles of any");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"sort.");
ItemUtils.addLore(baublePouch, ChatColor.AQUA+"");
ItemUtils.addLore(baublePouch, BaublePouch.POUCHID_LINE+"0");
ItemUtils.setDisplayName(baublePouch, ChatColor.GREEN+"Bauble Pouch");
baublePouch.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemUtils.hideEnchantments(baublePouch);
return baublePouch.clone();
} }
public static ItemStack VacuumCube() { public static ItemStack VacuumCube() {

@ -319,21 +319,37 @@ public enum ItemSet {
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Amulet"); lore.add(ChatColor.LIGHT_PURPLE+"Slayer Amulet");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Gladomain Set"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Gladomain Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" HP"); lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" HP");
lore.add("");
lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch");
lore.add(ChatColor.GRAY+" to benefit from the effects.");
lore.add("");
}break; }break;
case MOONSHADOW:{ case MOONSHADOW:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Trinket"); lore.add(ChatColor.LIGHT_PURPLE+"Slayer Trinket");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Moonshadow Set"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Moonshadow Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Crit Damage"); lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Crit Damage");
lore.add("");
lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch");
lore.add(ChatColor.GRAY+" to benefit from the effects.");
lore.add("");
}break; }break;
case WOLFSBANE:{ case WOLFSBANE:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Ornament"); lore.add(ChatColor.LIGHT_PURPLE+"Slayer Ornament");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Wolfsbane Set"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Wolfsbane Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Critical Chance"); lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Critical Chance");
lore.add("");
lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch");
lore.add(ChatColor.GRAY+" to benefit from the effects.");
lore.add("");
}break; }break;
case ALUSTINE:{ case ALUSTINE:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Charm"); lore.add(ChatColor.LIGHT_PURPLE+"Slayer Charm");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Alustine Set"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Alustine Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% EXP Gain"); lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% EXP Gain");
lore.add("");
lore.add(ChatColor.GRAY+" Must be inserted into a "+ChatColor.BLUE+"Bauble Pouch");
lore.add(ChatColor.GRAY+" to benefit from the effects.");
lore.add("");
}break; }break;
case BLITZEN: case BLITZEN:
lore.add(ChatColor.BLUE+"Holiday Gear"); lore.add(ChatColor.BLUE+"Holiday Gear");
@ -568,9 +584,9 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Collecting experience has a "+Math.min((ItemSet.GetBaseAmount(set, tier, 4)/20d)*100d,100)+"% chance"); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" Collecting experience has a "+Math.min((ItemSet.GetBaseAmount(set, tier, 4)/20d)*100d,100)+"% chance");
lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" to restore 2 HP (1 Heart)."); lore.add(ChatColor.DARK_AQUA+" "+ChatColor.WHITE+" to restore 2 HP (1 Heart).");
lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:"); lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Deal additional base damage equal to the"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Deals true damage equal to the number");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"number of levels you have. Drains XP equal"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"of levels you have. Drains XP equal to");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"to the number of levels you have per hit."); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"the number of levels you have per hit.");
}break; }break;
case BLITZEN: case BLITZEN:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");

@ -86,7 +86,7 @@ public enum PlayerMode {
), ),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer", SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",
ChatColor.DARK_BLUE+""+ChatColor.BOLD+"Slayer mode Perks: "+ChatColor.RESET+"\n" ChatColor.DARK_BLUE+""+ChatColor.BOLD+"Slayer mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n" + ChatColor.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 on their hotbar (Ideally you would want to use one slot for a weapon). Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n" + ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them on their hotbar (Ideally you would want to use one slot for a weapon). Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n"
+ ChatColor.WHITE+"->Slayers take a maximum of 1 Heart (2 HP) in damage from all attacks, making this mode essentially 5 lives.\n" + ChatColor.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.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"
@ -302,7 +302,7 @@ public enum PlayerMode {
if (p!=null && !p.isDead()) { if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) { if (needsUpdating(pd)) {
if (p.getEquipment().getItemInMainHand()!=null && GenericFunctions.hasSlayerSetItemOnHotbar(p) && if (p.getEquipment().getItemInMainHand()!=null && GenericFunctions.hasBaublePouchInOffHand(p) &&
GenericFunctions.WearingNoArmor(p)) { GenericFunctions.WearingNoArmor(p)) {
return true; return true;
} else { } else {

@ -71,7 +71,7 @@ public class Pronouns {
"exploded.", "exploded.",
"decided there was a better life worth living.", "decided there was a better life worth living.",
"exploded by the after shock.", "exploded by the after shock.",
"was shredded by the secondary explsion.", "was shredded by the secondary explosion.",
"exploded into pieces.", "exploded into pieces.",
"could not handle the after shock.", "could not handle the after shock.",
"was feeling a little greedy, blindly walking into the demolition zone.", "was feeling a little greedy, blindly walking into the demolition zone.",

@ -9,6 +9,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.LivingEntityStructure;
import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
@ -28,6 +29,8 @@ public class EntityUtils {
LivingEntityDifficulty strongest = null; LivingEntityDifficulty strongest = null;
for (Entity e : ents) { for (Entity e : ents) {
if (e instanceof LivingEntity) { if (e instanceof LivingEntity) {
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure((LivingEntity)e);
les.checkedforcubes=true;
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e); LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e);
if (e!=null && e.getType()==type && (strongest==null || !strongest.isStronger(diff))) { if (e!=null && e.getType()==type && (strongest==null || !strongest.isStronger(diff))) {
strongest = diff; strongest = diff;

@ -87,7 +87,8 @@ public class ItemCubeUtils {
} }
public static boolean SomeoneHasAFilterCubeOpen() { public static boolean SomeoneHasAFilterCubeOpen() {
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getOpenInventory()!=null && p.getOpenInventory().getTopInventory()!=null && p.getOpenInventory().getTopInventory().getType()==InventoryType.HOPPER) { if (p.getOpenInventory()!=null && p.getOpenInventory().getTopInventory()!=null && (p.getOpenInventory().getTopInventory().getType()==InventoryType.HOPPER ||
p.getOpenInventory().getTopInventory().getType()==InventoryType.DROPPER /*Keep open for Bauble Pouches*/)) {
TwosideKeeper.log("Keep this open! "+p.getName()+" is using it!", 5); TwosideKeeper.log("Keep this open! "+p.getName()+" is using it!", 5);
return true; return true;
} }

@ -50,6 +50,11 @@ public class ItemUtils {
item.setItemMeta(m); item.setItemMeta(m);
} }
public static String getDisplayName(ItemStack item) {
ItemMeta m = item.getItemMeta();
return m.getDisplayName();
}
public static boolean isValidLoreItem(ItemStack item) { public static boolean isValidLoreItem(ItemStack item) {
return (item!=null && item.hasItemMeta() && item.getItemMeta().hasLore()); return (item!=null && item.hasItemMeta() && item.getItemMeta().hasLore());
} }
@ -124,8 +129,8 @@ public class ItemUtils {
} }
} }
private static boolean isValidItem(ItemStack item) { public static boolean isValidItem(ItemStack item) {
return (item!=null && item.hasItemMeta()); return (item!=null && item.getType()!=Material.AIR);
} }
public static boolean isArtifactDust(ItemStack item) { public static boolean isArtifactDust(ItemStack item) {
@ -266,4 +271,9 @@ public class ItemUtils {
Color newcol = Color.fromRGB(r, g, b); Color newcol = Color.fromRGB(r, g, b);
return newcol; return newcol;
} }
public static boolean isValidItem(ItemStack[] equips) {
// TODO Auto-generated method stub
return false;
}
} }

@ -23,6 +23,7 @@ public class LivingEntityStructure {
public HashMap<Player,GlowAPI.Color> glowcolorlist = new HashMap<Player,GlowAPI.Color>(); public HashMap<Player,GlowAPI.Color> glowcolorlist = new HashMap<Player,GlowAPI.Color>();
//public long lastSpiderBallThrow = 0; //public long lastSpiderBallThrow = 0;
public BossMonster bm = null; public BossMonster bm = null;
public boolean checkedforcubes=false;
public LivingEntityStructure(LivingEntity m) { public LivingEntityStructure(LivingEntity m) {
target=null; target=null;

@ -366,4 +366,7 @@ public class Recipes {
recipe.addIngredient(Material.OBSIDIAN); recipe.addIngredient(Material.OBSIDIAN);
Bukkit.addRecipe(recipe); Bukkit.addRecipe(recipe);
} }
public static void Initialize_BaublePouch_Recipe() {
Bukkit.addRecipe(TwosideKeeper.BAUBLE_POUCH_RECIPE);
}
} }

@ -161,6 +161,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -191,6 +192,7 @@ import net.minecraft.server.v1_9_R1.EnumParticle;
import net.minecraft.server.v1_9_R1.MinecraftServer; import net.minecraft.server.v1_9_R1.MinecraftServer;
import sig.plugin.AutoPluginUpdate.AnnounceUpdateEvent; import sig.plugin.AutoPluginUpdate.AnnounceUpdateEvent;
import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent; import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
import sig.plugin.TwosideKeeper.Events.PlayerDodgeEvent;
import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem; import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
@ -216,6 +218,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession; import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue; import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Common.Habitation; import sig.plugin.TwosideKeeper.HelperStructures.Common.Habitation;
@ -226,6 +229,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Effects.EarthWaveTask;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume; import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
@ -257,6 +261,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static double RECYCLEDECAYAMT=20.0; //% chance lost when there's another item of the same type already in there. public static double RECYCLEDECAYAMT=20.0; //% chance lost when there's another item of the same type already in there.
public static double DAYMULT=2.0; //How much the day and night length will be multiplied by. public static double DAYMULT=2.0; //How much the day and night length will be multiplied by.
public static int ITEMCUBEID=0; //The current number of Item Cubes in existence. public static int ITEMCUBEID=0; //The current number of Item Cubes in existence.
public static int BAUBLEPOUCHID=0; //The current number of Bauble Pouches in existence.
public static int ARROWQUIVERID=0; //The current number of Arrow Quivers in existence. public static int ARROWQUIVERID=0; //The current number of Arrow Quivers in existence.
public static String MOTD=""; //The MOTD announcement to be announced every hour. public static String MOTD=""; //The MOTD announcement to be announced every hour.
public static double ARMOR_LEATHER_HP=0.5f; public static double ARMOR_LEATHER_HP=0.5f;
@ -400,6 +405,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static CustomPotion LIFE_VIAL; public static CustomPotion LIFE_VIAL;
public static CustomPotion HARDENING_VIAL; public static CustomPotion HARDENING_VIAL;
public static ItemStack DEAL_OF_THE_DAY_ITEM; public static ItemStack DEAL_OF_THE_DAY_ITEM;
public static ShapelessRecipe BAUBLE_POUCH_RECIPE;
public static final int POTION_DEBUG_LEVEL=5; public static final int POTION_DEBUG_LEVEL=5;
public static final int SPAWN_DEBUG_LEVEL=5; public static final int SPAWN_DEBUG_LEVEL=5;
@ -731,7 +737,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
ChargeZombie.BreakBlocksAroundArea(cz.m,1); ChargeZombie.BreakBlocksAroundArea(cz.m,1);
} }
} }
for (CustomMonster cs : custommonsters.values()) { for (CustomMonster cs : custommonsters.values()) {
if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) { if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) {
//This has to be removed... //This has to be removed...
@ -890,6 +896,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Recipes.Initialize_CustomArrow_Recipes(); Recipes.Initialize_CustomArrow_Recipes();
Recipes.Initialize_NotchApple_Recipe(); Recipes.Initialize_NotchApple_Recipe();
Recipes.Initialize_NewRedstoneLamp_Recipe(); Recipes.Initialize_NewRedstoneLamp_Recipe();
Recipes.Initialize_BaublePouch_Recipe();
Bukkit.getScheduler().runTaskLater(this,()->{JobRecipe.InitializeJobRecipes();},1);
Bukkit.createWorld(new WorldCreator("FilterCube")); Bukkit.createWorld(new WorldCreator("FilterCube"));
@ -1593,7 +1602,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
}break; }break;
case "ADDHOTBARCUBE":{ case "ADDHOTBARCUBE":{
Collection<ItemStack> remaining = ItemCubeUtils.addItems(Integer.parseInt(args[1]), GenericFunctions.getHotbarItems(p)); Collection<ItemStack> remaining = ItemCubeUtils.addItems(Integer.parseInt(args[1]), GenericFunctions.getBaubles(p));
if (remaining.size()>0) { if (remaining.size()>0) {
for (ItemStack item : remaining) { for (ItemStack item : remaining) {
p.sendMessage("Could not fit "+GenericFunctions.UserFriendlyMaterialName(item)+" "+((item.getAmount()>1)?"x"+item.getAmount():"")); p.sendMessage("Could not fit "+GenericFunctions.UserFriendlyMaterialName(item)+" "+((item.getAmount()>1)?"x"+item.getAmount():""));
@ -1637,6 +1646,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.regenpool += Integer.parseInt(args[1]); pd.regenpool += Integer.parseInt(args[1]);
}break; }break;
case "BAUBLEPOUCH":{
BaublePouch.getBaublePouchContents(BaublePouch.getBaublePouchID(p.getEquipment().getItemInOffHand()));
}break;
} }
} }
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE); //LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
@ -2199,12 +2211,37 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
private void DisplayCraftingRecipe(Player p, String string) { private void DisplayCraftingRecipe(Player p, String string) {
RecipeLinker l = RecipeLinker.valueOf(string); try {
ItemStack[] newarray = Arrays.copyOfRange(l.getRec(), 1, l.getRec().length); RecipeLinker l = RecipeLinker.valueOf(string);
if (p.hasPermission("createViaCraftMenu") && (getServerType()==ServerType.TEST || getServerType()==ServerType.QUIET)) { ItemStack[] newarray = Arrays.copyOfRange(l.getRec(), 1, l.getRec().length);
GenericFunctions.giveItem(p, l.getRec()[0]); if (p.hasPermission("createViaCraftMenu") && (getServerType()==ServerType.TEST || getServerType()==ServerType.QUIET)) {
} else { GenericFunctions.giveItem(p, l.getRec()[0]);
aPlugin.API.viewRecipe(p, l.getRec()[0], newarray); } else {
aPlugin.API.viewRecipe(p, l.getRec()[0], newarray);
}
}
catch (IllegalArgumentException ec) {
//Try a Job Recipe.
for (JobRecipe jr : jobrecipes) {
TwosideKeeper.log("Comparing _"+jr.getName()+"_ to _"+string+"_", 5);
if (jr.getCommandName().equalsIgnoreCase(string)) {
//Display that recipe, it matches!
TwosideKeeper.log("Found "+jr.getName(), 5);
Recipe rec = jr.getRecipe();
if (p.hasPermission("createViaCraftMenu") && (getServerType()==ServerType.TEST || getServerType()==ServerType.QUIET)) {
GenericFunctions.giveItem(p,jr.getRecipe().getResult());
} else {
if (rec instanceof ShapedRecipe) {
aPlugin.API.viewRecipe(p, (ShapedRecipe)jr.getRecipe());
} else {
aPlugin.API.viewRecipe(p, (ShapelessRecipe)jr.getRecipe());
}
}
return;
}
}
TwosideKeeper.log(ArrayUtils.toString(ec.getStackTrace()),0);
p.sendMessage(ChatColor.RED+"Something terrible has happened! Please inform the admin of this issue!");
} }
} }
private void DisplayArguments(Player p) { private void DisplayArguments(Player p) {
@ -2259,23 +2296,26 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
fin.addExtra(tc); fin.addExtra(tc);
} }
} }
/*if (RecipeCategory.valueOf(arg)==RecipeCategory.MISC_ITEMS) { if (RecipeCategory.valueOf(arg)==RecipeCategory.MISC_ITEMS) {
//Display the Custom Recipes. //Display the Custom Recipes.
j++; TwosideKeeper.log("In miscellaneous.", 5);
JobRecipe jr = for (JobRecipe jr : TwosideKeeper.jobrecipes) {
TextComponent tc = new TextComponent(ChatColor.values()[j+2]+"["+val.getColor()+val.getName()+ChatColor.values()[j+2]+"] "); TwosideKeeper.log("JobRecipe: "+jr.getName(), 5);
if (p.hasPermission("createViaCraftMenu") && (getServerType()==ServerType.TEST || getServerType()==ServerType.QUIET)) { TextComponent tc = new TextComponent("["+ChatColor.YELLOW+jr.getName()+"] ");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to be given a "+val.getColor()+val.getName()).create())); j++;
} else { if (p.hasPermission("createViaCraftMenu") && (getServerType()==ServerType.TEST || getServerType()==ServerType.QUIET)) {
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view the recipe for "+val.getColor()+val.getName()).create())); tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to be given a "+ChatColor.YELLOW+jr.getName()).create()));
} } else {
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/craft "+val.name()+" view")); tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view the recipe for "+ChatColor.YELLOW+jr.getName()).create()));
if (j>2) { }
tc.addExtra("\n"); tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/craft "+jr.getCommandName()+" view"));
j=0; if (j>2) {
tc.addExtra("\n");
j=0;
}
fin.addExtra(tc);
} }
fin.addExtra(tc); }
}*/
p.spigot().sendMessage(fin); p.spigot().sendMessage(fin);
} }
@ -3172,66 +3212,38 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//Check for a bow shift-right click. //Check for a bow shift+left click.
if (ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK if (ev.getAction()==Action.LEFT_CLICK_BLOCK
|| ev.getAction()==Action.LEFT_CLICK_BLOCK
|| ev.getAction()==Action.LEFT_CLICK_AIR) { || ev.getAction()==Action.LEFT_CLICK_AIR) {
if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
//Rotate Bow Modes. //Rotate Bow Modes.
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.SLOW,p); GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.SLOW,p);
BowMode mode = GenericFunctions.getBowMode(p); BowMode mode = GenericFunctions.getBowMode(p);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ev.getAction().name().contains("RIGHT")) { switch (mode) {
if (pd.lastbowmodeswitch+6>=getServerTickTime()) { case CLOSE:{
return; SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
} GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
switch (mode) { //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
case CLOSE:{ p.updateInventory();
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN));
GenericFunctions.setBowMode(p,BowMode.SNIPE); }break;
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); case SNIPE:{
}break; SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
case SNIPE:{ GenericFunctions.setBowMode(p,BowMode.CLOSE);
SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
GenericFunctions.setBowMode(p,BowMode.DEBILITATION); p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN));
}break; }break;
case DEBILITATION:{ case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f); SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.CLOSE); GenericFunctions.setBowMode(p,BowMode.SNIPE);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN)); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
}break; p.updateInventory();
} aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN));
pd.lastbowmodeswitch=getServerTickTime(); }break;
} else {
if (pd.lastbowmodeswitch+6>=getServerTickTime()) {
return;
}
switch (mode) {
case CLOSE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN));
}break;
case SNIPE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p,BowMode.CLOSE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN));
}break;
case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.SNIPE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN));
}break;
}
pd.lastbowmodeswitch=getServerTickTime();
} }
pd.lastbowmodeswitch=getServerTickTime();
ev.setCancelled(true); ev.setCancelled(true);
return; return;
} }
@ -3276,14 +3288,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
/*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); /*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p));
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/ pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/
pd.lastusedearthwave=TwosideKeeper.getServerTickTime(); pd.lastusedearthwave=TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.05+5)); aPlugin.API.damageItem(p.getInventory(), weapon, (int) (weapon.getType().getMaxDurability()*0.05+5));
for (int x=-1;x<2;x++) { for (int x=-1;x<2;x++) {
for (int z=-1;z<2;z++) { for (int z=-1;z<2;z++) {
if (x!=0 && z!=0) { if (x!=0 && z!=0) {
Location newblock = checkloc.clone(); Location newblock = checkloc.clone();
if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) { if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) {
TwosideKeeper.log("NOT SOFT!", 0); TwosideKeeper.log("NOT SOFT!", 0);
aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.01+1)); aPlugin.API.damageItem(p.getInventory(), weapon, (int) (weapon.getType().getMaxDurability()*0.01+1));
} }
} }
} }
@ -3456,6 +3468,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getPlayer().updateInventory(); ev.getPlayer().updateInventory();
return; return;
} }
if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK)) {
if (BaublePouch.isBaublePouch(ev.getPlayer().getInventory().getItemInMainHand())) {
BaublePouch.openBaublePouch(ev.getPlayer(), ev.getPlayer().getInventory().getItemInMainHand());
ev.setCancelled(true);
return;
}
}
if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) { if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) {
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() && if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() && ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
@ -4118,6 +4137,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true); ev.setCancelled(true);
return; return;
} }
if (BaublePouch.isBaublePouch(ev.getItemInHand())) { //Do not allow bauble pouches to be built.
ev.setCancelled(true);
return;
}
} }
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOWEST,ignoreCancelled = true)
@ -4384,6 +4408,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
if (BaublePouch.isBaublePouch(ev.getCurrentItem())) {
//Modify the Bauble Pouch # line to the next bauble pouch ID.
if (ev.isShiftClick()) {
ev.setCancelled(true);
} else {
ItemUtils.ModifyLoreLineContainingSubstring(ev.getCurrentItem(), BaublePouch.POUCHID_LINE, BaublePouch.POUCHID_LINE+BAUBLEPOUCHID);
BaublePouch.createNewBaublePouch(BAUBLEPOUCHID);
BAUBLEPOUCHID++;
}
}
} }
@ -4547,7 +4581,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (pd.last_rejuvenate+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime() && PlayerMode.isDefender(ev.getPlayer())) { if (pd.last_rejuvenate+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime() && PlayerMode.isDefender(ev.getPlayer())) {
GenericFunctions.PerformRejuvenate(ev.getPlayer()); GenericFunctions.PerformRejuvenate(ev.getPlayer());
pd.last_rejuvenate = TwosideKeeper.getServerTickTime(); pd.last_rejuvenate = TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), 400); aPlugin.API.damageItem(ev.getPlayer().getInventory(), ev.getItemDrop().getItemStack(), 400);
} }
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
} }
@ -4888,6 +4922,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
//Check for a right-click for a Bauble Pouch.
if (ev.getClick()==ClickType.RIGHT && ((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9))) {
ItemStack item = ev.getCurrentItem();
if (BaublePouch.isBaublePouch(item)) {
BaublePouch.openBaublePouch((Player)ev.getWhoClicked(), item);
ev.setCancelled(true);
return;
}
}
//Check for a left-click for a Bauble Pouch.
if (ev.getClick()==ClickType.LEFT && ItemUtils.isValidItem(ev.getCursor())) {
//Attempt to insert the items into the Bauble Pouch.
ItemStack item = ev.getCurrentItem();
if (BaublePouch.isBaublePouch(item)) {
HashMap<Integer,ItemStack> remaining = BaublePouch.insertItemsIntoBaublePouch(BaublePouch.getBaublePouchID(item), ev.getCursor());
if (remaining.size()>0) {
for (Integer numb : remaining.keySet()) {
ItemStack extra = remaining.get(numb);
ev.setCursor(extra);
}
} else {
ev.setCursor(new ItemStack(Material.AIR));
}
((Player)ev.getWhoClicked()).updateInventory();
ev.setCancelled(true);
return;
}
}
if ((ev.getClick()==ClickType.SHIFT_LEFT || ev.getClick()==ClickType.SHIFT_RIGHT) && if ((ev.getClick()==ClickType.SHIFT_LEFT || ev.getClick()==ClickType.SHIFT_RIGHT) &&
ev.getInventory().getType()==InventoryType.CRAFTING && ev.getInventory().getType()==InventoryType.CRAFTING &&
ev.getWhoClicked().getInventory().getExtraContents()[0]==null && GenericFunctions.AllowedToBeEquippedToOffHand((Player)ev.getWhoClicked(),ev.getCurrentItem(),ev.getRawSlot()) && ev.getWhoClicked().getInventory().getExtraContents()[0]==null && GenericFunctions.AllowedToBeEquippedToOffHand((Player)ev.getWhoClicked(),ev.getCurrentItem(),ev.getRawSlot()) &&
@ -5692,6 +5756,32 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
//TODO Nerf Durability
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void dodgeEvent(PlayerDodgeEvent ev) {
Player p = ev.getPlayer();
PlayerMode pm = PlayerMode.getPlayerMode(p);
if (!pm.isRanger(p)) {
if (p.isBlocking() || pm.isDefender(p)) {
//Only reduce durability of the shield.
ItemStack[] equips = GenericFunctions.getEquipment(p, true);
if (GenericFunctions.isEquip(equips[0])) {
aPlugin.API.damageItem(p.getInventory(), equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1)));
}
if (GenericFunctions.isEquip(equips[1])) {
aPlugin.API.damageItem(p.getInventory(), equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1)));
}
} else {
ItemStack[] equips = GenericFunctions.getArmor(p, false);
for (ItemStack equip : equips) {
if (GenericFunctions.isEquip(equip)) {
aPlugin.API.damageItem(p.getInventory(), equip, 3+((int)((equip.getType().getMaxDurability()*0.01)+1)));
}
}
}
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void updateHealthbarDamageEvent(EntityDamageEvent ev) { public void updateHealthbarDamageEvent(EntityDamageEvent ev) {
@ -5861,7 +5951,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
dmgdealt=0.25; dmgdealt=0.25;
} else } else
if (PlayerMode.isSlayer((Player)ev.getEntity()) && if (PlayerMode.isSlayer((Player)ev.getEntity()) &&
ItemSet.GetSetCount(GenericFunctions.getHotbarItems((Player)ev.getEntity()), ItemSet.LORASYS, (Player)ev.getEntity())>0) { ItemSet.GetSetCount(GenericFunctions.getEquipment((Player)ev.getEntity()), ItemSet.LORASYS, (Player)ev.getEntity())>0) {
dmgdealt=0.0; dmgdealt=0.0;
} }
} }
@ -6146,10 +6236,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (amt>500) { if (amt>500) {
testamt=500; testamt=500;
} }
ev.setAmount((int)(ev.getAmount()+(ev.getAmount()*(ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(ev.getPlayer()), ev.getPlayer(), ItemSet.ALUSTINE)/100d)))); ev.setAmount((int)(ev.getAmount()+(ev.getAmount()*(ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(ev.getPlayer()), ev.getPlayer(), ItemSet.ALUSTINE)/100d))));
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.ALUSTINE, 5)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5)) {
if (Math.random()<=Math.min((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.ALUSTINE, 5, 4)/20d),1)) { if (Math.random()<=Math.min((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.ALUSTINE, 5, 4)/20d),1)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (pd.slayermodehp+2<p.getMaxHealth()) { if (pd.slayermodehp+2<p.getMaxHealth()) {
@ -6483,7 +6573,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.SPEED, 10*20, 4); GenericFunctions.addStackingPotionEffect(p, PotionEffectType.SPEED, 10*20, 4);
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 7)) {
//Apply damage to everything around the player. //Apply damage to everything around the player.
//List<Monster> mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8); //List<Monster> mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8);
List<Monster> mobs = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(8, 8, 8)); List<Monster> mobs = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(8, 8, 8));
@ -6501,13 +6591,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9); GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9);
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) {
pd.slayermegahit=true; pd.slayermegahit=true;
} }
GenericFunctions.applyStealth(p, false); GenericFunctions.applyStealth(p, false);
} else { //Failed Assassination. } else { //Failed Assassination.
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.WOLFSBANE, 2)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 2)) {
pd.lastassassinatetime-=GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,p)*(ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.WOLFSBANE, 2, 2)/100d); pd.lastassassinatetime-=GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,p)*(ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.WOLFSBANE, 2, 2)/100d);
ItemStack[] inv = p.getInventory().getContents(); ItemStack[] inv = p.getInventory().getContents();
for (int i=0;i<9;i++) { for (int i=0;i<9;i++) {
if (inv[i]!=null && (inv[i].getType()!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,p)<TwosideKeeper.getServerTickTime())) { if (inv[i]!=null && (inv[i].getType()!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,p)<TwosideKeeper.getServerTickTime())) {
@ -6519,7 +6609,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (isSlayer) { if (isSlayer) {
int restore_amt = (ItemSet.GetSetCount(GenericFunctions.getHotbarItems(p), ItemSet.LORASYS, p)>0)?4:2; int restore_amt = (ItemSet.GetSetCount(GenericFunctions.getEquipment(p), ItemSet.LORASYS, p)>0)?4:2;
if (pd.slayermodehp+restore_amt<p.getMaxHealth()) { if (pd.slayermodehp+restore_amt<p.getMaxHealth()) {
pd.slayermodehp+=restore_amt; pd.slayermodehp+=restore_amt;
} else { } else {
@ -7407,6 +7497,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
item.getType().toString().contains("HELMET") || item.getType().toString().contains("HELMET") ||
item.getType().toString().contains("SHIELD") || item.getType().toString().contains("SHIELD") ||
item.getType().toString().contains("TIPPED_ARROW") || item.getType().toString().contains("TIPPED_ARROW") ||
item.getType().toString().contains("CHORUS_FLOWER") ||
item.getType().toString().contains("_AXE")) { item.getType().toString().contains("_AXE")) {
ItemStack armor = item; ItemStack armor = item;
//See if this armor type is not being worn by the player. //See if this armor type is not being worn by the player.
@ -7496,6 +7587,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.playProperEquipSound(p,armor.getType()); GenericFunctions.playProperEquipSound(p,armor.getType());
p.updateInventory(); p.updateInventory();
return true; return true;
} else
if (BaublePouch.isBaublePouch(armor) && p.getInventory().getExtraContents()[0]==null &&
!PlayerMode.isStriker(p) &&
pd.equipweapons) {
p.getInventory().setExtraContents(new ItemStack[]{armor});
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(armor));
GenericFunctions.playProperEquipSound(p,armor.getType());
p.updateInventory();
return true;
} }
} }
return false; return false;
@ -7902,7 +8003,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Teleported to calculated hit location: "+arr.getLocation(),5); log("Teleported to calculated hit location: "+arr.getLocation(),5);
}},1); }},1);
} }
aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3); aPlugin.API.damageItem(p.getInventory(), p.getEquipment().getItemInMainHand(), 3);
} }
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
@ -8407,6 +8508,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//getConfig().set("RECYCLEDECAYAMT", RECYCLEDECAYAMT); //getConfig().set("RECYCLEDECAYAMT", RECYCLEDECAYAMT);
getConfig().set("ITEMCUBEID", ITEMCUBEID); getConfig().set("ITEMCUBEID", ITEMCUBEID);
getConfig().set("ARROWQUIVERID", ARROWQUIVERID); getConfig().set("ARROWQUIVERID", ARROWQUIVERID);
getConfig().set("BAUBLEPOUCHID", BAUBLEPOUCHID);
//getConfig().set("ARMOR/ARMOR_LEATHER_HP", ARMOR_LEATHER_HP); //getConfig().set("ARMOR/ARMOR_LEATHER_HP", ARMOR_LEATHER_HP);
//getConfig().set("ARMOR/ARMOR_IRON_HP", ARMOR_IRON_HP); //getConfig().set("ARMOR/ARMOR_IRON_HP", ARMOR_IRON_HP);
//getConfig().set("ARMOR/ARMOR_GOLD_HP", ARMOR_GOLD_HP); //getConfig().set("ARMOR/ARMOR_GOLD_HP", ARMOR_GOLD_HP);
@ -8468,6 +8570,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
getConfig().addDefault("RECYCLEDECAYAMT", RECYCLEDECAYAMT); getConfig().addDefault("RECYCLEDECAYAMT", RECYCLEDECAYAMT);
getConfig().addDefault("ITEMCUBEID", ITEMCUBEID); getConfig().addDefault("ITEMCUBEID", ITEMCUBEID);
getConfig().addDefault("ARROWQUIVERID", ARROWQUIVERID); getConfig().addDefault("ARROWQUIVERID", ARROWQUIVERID);
getConfig().addDefault("BAUBLEPOUCHID", BAUBLEPOUCHID);
getConfig().addDefault("MOTD", MOTD); getConfig().addDefault("MOTD", MOTD);
getConfig().addDefault("ARMOR/ARMOR_LEATHER_HP", ARMOR_LEATHER_HP); getConfig().addDefault("ARMOR/ARMOR_LEATHER_HP", ARMOR_LEATHER_HP);
getConfig().addDefault("ARMOR/ARMOR_IRON_HP", ARMOR_IRON_HP); getConfig().addDefault("ARMOR/ARMOR_IRON_HP", ARMOR_IRON_HP);
@ -8506,6 +8609,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
RECYCLEDECAYAMT = getConfig().getDouble("RECYCLEDECAYAMT"); RECYCLEDECAYAMT = getConfig().getDouble("RECYCLEDECAYAMT");
ITEMCUBEID = getConfig().getInt("ITEMCUBEID"); ITEMCUBEID = getConfig().getInt("ITEMCUBEID");
ARROWQUIVERID = getConfig().getInt("ARROWQUIVERID"); ARROWQUIVERID = getConfig().getInt("ARROWQUIVERID");
BAUBLEPOUCHID = getConfig().getInt("BAUBLEPOUCHID");
ARMOR_LEATHER_HP = getConfig().getDouble("ARMOR/ARMOR_LEATHER_HP"); ARMOR_LEATHER_HP = getConfig().getDouble("ARMOR/ARMOR_LEATHER_HP");
ARMOR_IRON_HP = getConfig().getDouble("ARMOR/ARMOR_IRON_HP"); ARMOR_IRON_HP = getConfig().getDouble("ARMOR/ARMOR_IRON_HP");
ARMOR_GOLD_HP = getConfig().getDouble("ARMOR/ARMOR_GOLD_HP"); ARMOR_GOLD_HP = getConfig().getDouble("ARMOR/ARMOR_GOLD_HP");
@ -8754,7 +8858,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return Double.parseDouble(df.format(getPlayerMoney(Bukkit.getPlayer(p)))); return Double.parseDouble(df.format(getPlayerMoney(Bukkit.getPlayer(p))));
} else { } else {
File config; File config;
config = new File(TwosideKeeper.filesave,"users/"+p+".data"); config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getPlayer(p).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config); FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) { if (!config.exists()) {
//Something bad happened if we got here. //Something bad happened if we got here.
@ -8781,7 +8885,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
//See if the data file exists, open it. //See if the data file exists, open it.
File config; File config;
config = new File(TwosideKeeper.filesave,"users/"+p+".data"); config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getPlayer(p).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config); FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) { if (!config.exists()) {
@ -8805,7 +8909,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
//See if the data file exists, open it. //See if the data file exists, open it.
File config; File config;
config = new File(TwosideKeeper.filesave,"users/"+p+".data"); config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getPlayer(p).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config); FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) { if (!config.exists()) {
@ -8838,7 +8942,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else { } else {
//See if the data file exists, open it. //See if the data file exists, open it.
File config; File config;
config = new File(TwosideKeeper.filesave,"users/"+p+".data"); config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getPlayer(p).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config); FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
double money = workable.getDouble("bank_money"); double money = workable.getDouble("bank_money");
@ -8919,7 +9023,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
//Check the hotbar for set equips. //Check the hotbar for set equips.
hp+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN); hp+=ItemSet.GetTotalBaseAmount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN);
log("Health is now "+hp,5); log("Health is now "+hp,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1; maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;

@ -478,7 +478,7 @@ final class runServerHeartbeat implements Runnable {
if (PlayerMode.isSlayer(p)) { if (PlayerMode.isSlayer(p)) {
if (pd.lastsneak+50<=serverTickTime && if (pd.lastsneak+50<=serverTickTime &&
p.isSneaking() && p.isSneaking() &&
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) { ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.MOONSHADOW, 7)) {
GenericFunctions.deAggroNearbyTargets(p); GenericFunctions.deAggroNearbyTargets(p);
GenericFunctions.applyStealth(p, true); GenericFunctions.applyStealth(p, true);
} }
@ -755,6 +755,9 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 5); TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 5);
for (UUID id : data) { for (UUID id : data) {
LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id); LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id);
if (ms.checkedforcubes) {
ms.checkedforcubes=false;
}
if (!ms.m.isValid() || ms.m instanceof Player) { if (!ms.m.isValid() || ms.m instanceof Player) {
//TwosideKeeper.monsterdata.remove(data); //TwosideKeeper.monsterdata.remove(data);
TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms); TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms);

Loading…
Cancel
Save