Final commit including all changes necessary to make the Holiday Event

completely functional!
testdev
sigonasr2 8 years ago
parent b1adb5eeac
commit 374b045623
  1. BIN
      TwosideKeeper.jar
  2. 5
      src/plugin.yml
  3. 4
      src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java
  4. 2
      src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
  5. 318
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  6. 11
      src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
  7. 1
      src/sig/plugin/TwosideKeeper/Events/EntityDamagedEvent.java
  8. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  9. 63
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  10. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
  11. 86
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryIce.java
  12. 148
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  13. 51
      src/sig/plugin/TwosideKeeper/HelperStructures/LivingEntityDifficulty.java
  14. 46
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  15. 5
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ArrayUtils.java
  16. 21
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/EntityUtils.java
  17. 17
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
  18. 9
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java
  19. 75
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  20. 5
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/TextUtils.java
  21. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  22. 882
      src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
  23. 39
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  24. 543
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  25. 75
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

@ -127,6 +127,11 @@ commands:
usage: /weather <DISCORD NAME>
permission: TwosideKeeper.money
permission-message: No permissions!
red:
description: Ready up for the ice skating race.
usage: /red
permission: TwosideKeeper.money
permission-message: No permissions!
ready:
description: Ready up for the tree climbing race.
usage: /ready

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@ -50,7 +51,8 @@ public class ActionBarBuffUpdater{
effectString.append(AppendAmplifier((int)(pd.damagepool-1)));
effectString.append(" ");
}
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime()) {
if (pd.lastvendettastack+200>TwosideKeeper.getServerTickTime() &&
ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
effectString.append(ChatColor.GRAY+"☉");
effectString.append(AppendAmplifier(((int)((pd.lastvendettastack+200)-TwosideKeeper.getServerTickTime())/20)-1,false));
effectString.append(" ");

@ -153,7 +153,7 @@ public class AwakenedArtifact {
List<String> lore = m.getLore();
DecimalFormat df = new DecimalFormat("000");
lore.set(findLVLine(lore), ChatColor.GRAY+"Level "+df.format(amt));
lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt);
//lore.set(findAPLine(lore), ChatColor.GOLD+"Ability Points: "+getAP(artifact)+"/"+amt);
m.setLore(lore);
artifact.setItemMeta(m);
return artifact;

@ -22,6 +22,7 @@ import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Monster;
@ -37,6 +38,7 @@ import org.bukkit.entity.TippedArrow;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
@ -58,6 +60,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
import sig.plugin.TwosideKeeper.Monster.HellfireGhast;
import sig.plugin.TwosideKeeper.Monster.HellfireSpider;
@ -222,6 +225,7 @@ public class CustomDamage {
if (shooter instanceof Player) {
dmg += addToPlayerLogger(damager,target,"Tactics Bonus Damage",API.getPlayerBonuses((Player)shooter).getBonusDamage());
dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
if (!((Player)shooter).isOnGround()) {dmg += addToPlayerLogger(damager,target,"Prancer Set Bonus",ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.PRANCER));}
if (PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.BARBARIAN) {
dmg += addMultiplierToPlayerLogger(damager,target,"Barbarian Execute Mult",dmg * (1-(target.getHealth()/target.getMaxHealth())));
}
@ -244,8 +248,14 @@ public class CustomDamage {
aPlugin.API.critEntity(target, 15);}
dmg += critdmg;
double armorpendmg = addToPlayerLogger(damager,target,"Armor Pen",calculateArmorPen(damager,dmg,weapon));
if (!isFlagSet(flags, TRUEDMG) && (target instanceof Player && PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN)) {
dmg -= getDamageFromBarbarianSetBonus(target);
dmg -= getDamageReduction(target);
} else
if (isFlagSet(flags, TRUEDMG) && (target instanceof Player && PlayerMode.getPlayerMode((Player)target)==PlayerMode.BARBARIAN)) {
dmg -= getDamageFromBarbarianSetBonus(target);
dmg -= getDamageReduction(target);
}
addToLoggerActual(damager,dmg);
addToPlayerRawDamage(dmg,target);
if (!isFlagSet(flags, TRUEDMG)) {
@ -296,7 +306,7 @@ public class CustomDamage {
private static double getDamageFromBarbarianSetBonus(LivingEntity target) {
if (target instanceof Player) {
Player p = (Player)target;
return ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DAWNTRACKER);
return (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DAWNTRACKER)+1)/3;
}
return 0.0;
}
@ -343,6 +353,7 @@ public class CustomDamage {
dmg += calculateEnchantmentDamageIncrease(weapon,damager,target);
dmg += addToPlayerLogger(damager,target,"Strike",GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE, weapon));
dmg += addToPlayerLogger(damager,target,"Highwinder",calculateHighwinderDamage(weapon,damager));
dmg += addToPlayerLogger(damager,target,"Dancer Speed Bonus",calculateDancerSpeedDamage(weapon,damager));
dmg += addToPlayerLogger(damager,target,"Set Bonus",calculateSetBonusDamage(damager));
dmg += addMultiplierToPlayerLogger(damager,target,"Party Bonus Mult",dmg * calculatePartyBonusMultiplier(damager));
dmg += addMultiplierToPlayerLogger(damager,target,"Set Bonus Mult",dmg * calculateSetBonusMultiplier(weapon,damager));
@ -351,6 +362,20 @@ public class CustomDamage {
return dmg;
}
private static double calculateDancerSpeedDamage(ItemStack weapon, Entity damager) {
double dmg = 0.0;
if (damager instanceof Player) {
Player p = (Player)damager;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER)>0) {
dmg += 93.182445*pd.velocity*ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER);
pd.lasthighwinderhit=TwosideKeeper.getServerTickTime();
GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER)),true);
}
}
return dmg;
}
private static double calculatePartyBonusMultiplier(Entity damager) {
if (getDamagerEntity(damager) instanceof Player) {
Player p = (Player)getDamagerEntity(damager);
@ -455,6 +480,9 @@ public class CustomDamage {
increaseStrikerSpeed(p);
healDefenderSaturation(p);
damage=increaseDamageDealtByFireTicks(p,damage,reason);
dealRetaliationDamage(p,damager);
aggroOntoMyPartyMembersInstead(p,damager);
giveAbsorptionHealth(p);
reduceKnockback(p);
reduceSwiftAegisBuff(p);
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
@ -489,6 +517,8 @@ public class CustomDamage {
damage = sendDamageToDamagePool(p, damage, reason);
damage = modifyFateBasedOnHolidayTreats(p, damage);
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0;
}
@ -586,6 +616,7 @@ public class CustomDamage {
suppressTarget(p,weapon,target);
causeSpetralGlowAndAggro(damager,p,target);
removeExperienceFromAlustineSetBonus(p);
applyLightningStriketoFoe(p,target);
pd.slayermegahit=false;
pd.lastcombat=TwosideKeeper.getServerTickTime();
increaseBarbarianStacks(p,weapon);
@ -657,6 +688,175 @@ public class CustomDamage {
return damage;
}
private static double modifyFateBasedOnHolidayTreats(Player p, double damage) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) {
boolean consumed=false;
if (p.getHealth()-damage<=0) {
for (int i=0;i<9;i++) {
ItemStack item = p.getInventory().getItem(i);
if (item!=null) {
if (Christmas.isHolidayRageCandyBarItem(item)) {
//TwosideKeeper.log(ChatColor.AQUA+"You prepare to eat a "+GenericFunctions.UserFriendlyMaterialName(item), 0);
p.sendMessage(ChatColor.AQUA+"You munch on a "+GenericFunctions.UserFriendlyMaterialName(item));
RemoveOneItem(p.getInventory(),item,i);
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
p.setHealth(p.getMaxHealth());
consumed=true;
return 0;
}
}
}
} else
if (p.getHealth()-damage<p.getMaxHealth()/2) {
//See if we can activate any treats. Check the hotbar.
for (int i=0;i<9;i++) {
ItemStack item = p.getInventory().getItem(i);
if (item!=null) {
if (Christmas.isSmallCandyItem(item)) {
//TwosideKeeper.log(ChatColor.AQUA+"You prepare to eat a "+GenericFunctions.UserFriendlyMaterialName(item), 0);
p.sendMessage(ChatColor.AQUA+"You munch on a "+GenericFunctions.UserFriendlyMaterialName(item));
RemoveOneItem(p.getInventory(),item,i);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (!p.isDead()) {
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
p.setHealth(Math.min(p.getHealth()+(0.1*p.getMaxHealth()), p.getMaxHealth()));
p.sendMessage(ChatColor.GREEN+" "+Math.round(p.getMaxHealth()*0.1)+ChatColor.WHITE+" health has been restored!");
}
},10);
consumed=true;break;
} else
if (Christmas.isLargeCandyItem(item)) {
//TwosideKeeper.log(ChatColor.AQUA+"You prepare to eat a "+GenericFunctions.UserFriendlyMaterialName(item), 0);
p.sendMessage(ChatColor.AQUA+"You munch on a "+GenericFunctions.UserFriendlyMaterialName(item));
RemoveOneItem(p.getInventory(),item,i);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (!p.isDead()) {
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
p.setHealth(Math.min(p.getHealth()+(0.5*p.getMaxHealth()), p.getMaxHealth()));
p.sendMessage(ChatColor.GREEN+" "+Math.round(p.getMaxHealth()*0.5)+ChatColor.WHITE+" health has been restored!");
}
},10);
consumed=true;break;
} else
if (Christmas.isSourCandyItem(item)) {
//TwosideKeeper.log(ChatColor.AQUA+"You prepare to eat a "+GenericFunctions.UserFriendlyMaterialName(item), 0);
p.sendMessage(ChatColor.AQUA+"You munch on a "+GenericFunctions.UserFriendlyMaterialName(item));
RemoveOneItem(p.getInventory(),item,i);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (!p.isDead()) {
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.REGENERATION, 400, 4, p, true);
p.sendMessage(ChatColor.GREEN+" You feel a rejuvenating feeling inside of you.");
}
},10);
consumed=true;break;
} else
if (Christmas.isMysteryFlavorLollipopItem(item)) {
//TwosideKeeper.log(ChatColor.AQUA+"You prepare to eat a "+GenericFunctions.UserFriendlyMaterialName(item), 0);
p.sendMessage(ChatColor.AQUA+"You munch on a "+GenericFunctions.UserFriendlyMaterialName(item));
RemoveOneItem(p.getInventory(),item,i);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (!p.isDead()) {
if (Bukkit.getOnlinePlayers().size()>1) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION, 60, 4, p, true);
TeleportToARandomPlayer(p);
SoundUtils.playLocalSound(p, Sound.BLOCK_PORTAL_TRAVEL, 1.0f, 0.6f);
p.sendMessage(ChatColor.YELLOW+" You suddenly become disoriented.");
} else {
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.6f);
double randompct = Math.random();
p.setHealth(Math.min(p.getHealth()+(randompct*p.getMaxHealth()), p.getMaxHealth()));
p.sendMessage(ChatColor.GREEN+" "+Math.round(p.getMaxHealth()*randompct)+ChatColor.WHITE+" health has been restored!");
}
}
},10);
consumed=true;break;
}
}
}
}
if (consumed) {
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastcandyconsumed=TwosideKeeper.getServerTickTime();
}
}
return damage;
}
private static void TeleportToARandomPlayer(Player p) {
int tries = 0;
while (true && tries<50) {
tries++;
for (Player pl : Bukkit.getOnlinePlayers()) {
if (Math.random()<=1d/(Bukkit.getOnlinePlayers().size())) {
p.teleport(pl);
return;
}
}
}
}
public static void RemoveOneItem(PlayerInventory inventory, ItemStack item, int i) {
if (item.getAmount()>1) {
item.setAmount(item.getAmount()-1);
inventory.setItem(i, item);
} else {
inventory.setItem(i, new ItemStack(Material.AIR));
}
}
private static void giveAbsorptionHealth(Player p) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.OLIVE, 4)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastabsorptionhealthgiven+600<TwosideKeeper.getServerTickTime()) {
pd.lastabsorptionhealthgiven=TwosideKeeper.getServerTickTime();
CustomDamage.setAbsorptionHearts(p, Math.min(CustomDamage.getAbsorptionHearts(p)+20,20));
}
}
}
private static void aggroOntoMyPartyMembersInstead(Player p, Entity damager) {
if (damager instanceof Monster) {
Monster m = (Monster)damager;
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
if (!pl.equals(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(pl), pl, ItemSet.DONNER, 4)) {
//Aggro to them instead.
if (!m.hasPotionEffect(PotionEffectType.GLOWING)) {
setMonsterTarget(m,pl);
setAggroGlowTickTime(m,100);
}
break;
}
}
}
}
private static void applyLightningStriketoFoe(Player p, LivingEntity target) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p),p,ItemSet.BLITZEN,4)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastlightningstrike+100<TwosideKeeper.getServerTickTime()) {
p.getWorld().strikeLightningEffect(target.getLocation());
p.getWorld().strikeLightningEffect(target.getLocation());
pd.lastlightningstrike=TwosideKeeper.getServerTickTime();
GenericFunctions.DealDamageToNearbyMobs(target.getLocation(), 12, 1, p, TRUEDMG|IGNORE_DAMAGE_TICK);
}
}
}
private static void dealRetaliationDamage(Player p, Entity damager) {
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null) {
if (p.isBlocking() &&
ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.OLIVE)>0) {
CustomDamage.ApplyDamage(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.OLIVE), p, shooter, null, "Retaliation", TRUEDMG);
}
}
}
private static void ApplyVendettaStackTimer(PlayerStructure pd) {
if (pd.vendetta_amt<=0) {pd.lastvendettastack=TwosideKeeper.getServerTickTime();}
}
@ -747,7 +947,7 @@ public class CustomDamage {
}
}
if (p.isSneaking() && pd.weaponcharges>=30 && (reason==null || !reason.equalsIgnoreCase("forceful strike")) &&
weapon.equals(p.getEquipment().getItemInMainHand())) {
weapon!=null && weapon.equals(p.getEquipment().getItemInMainHand())) {
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_WOOD_BUTTON_CLICK_ON, 3.0f, 0.6f);
//Apply 10 strikes across the field.
dmg*=2;
@ -1077,9 +1277,15 @@ public class CustomDamage {
applyDefenderAggro((Monster)m,p);
applyProvokeAggro((Monster)m,weapon);
leaderRallyNearbyMonsters((Monster)m,p);
applyDonnerSetAggro((Monster)m,p);
}
}
private static void applyDonnerSetAggro(Monster m, Player p) {
double aggrotime = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DONNER)*20;
setAggroGlowTickTime(m,(int)aggrotime);
}
static void leaderRallyNearbyMonsters(Monster m, Player p) {
if ((MonsterController.isZombieLeader(m) || (
m.getCustomName()!=null && m.getCustomName().contains(ChatColor.MAGIC+"")
@ -1279,7 +1485,7 @@ public class CustomDamage {
if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) {
TwosideKeeper.log("Not in an iframe.", 5);
if (isFlagSet(flags,IGNOREDODGE) || !PassesDodgeCheck(target,damager)) {
GenericFunctions.updateNoDamageTickMap(target, damager);
GenericFunctions.updateNoDamageTickMap(target, damager, (int)-(10-(10/(1.0+GetAttackRate(damager)))));
TwosideKeeper.log("Did not dodge attack.", 5);
return false;
} else {
@ -1309,6 +1515,15 @@ public class CustomDamage {
return true;
}
private static double GetAttackRate(Entity damager) {
double attackrate = 0.0;
if (damager instanceof Player) {
Player p = (Player)damager;
attackrate += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.BLITZEN)/100d;
}
return attackrate;
}
private static boolean LowEnoughToResistPoison(LivingEntity target, String reason) {
TwosideKeeper.log("Target health: "+target.getHealth(), 5);
if (reason!=null && reason.equalsIgnoreCase("POISON") && target.getHealth()<=2) {
@ -1387,6 +1602,9 @@ public class CustomDamage {
DecimalFormat df = new DecimalFormat("0.00");
GenericFunctions.sendActionBarMessage(p, ChatColor.YELLOW+" Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+((pd.thorns_amt>0)?"/"+ChatColor.GOLD+df.format(pd.thorns_amt):"")+ChatColor.GREEN+" dmg stored",true);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.VIXEN, 4)) {
p.setHealth(Math.min(p.getHealth()+(p.getMaxHealth()*0.1), p.getMaxHealth()));
}
return true;
}
return false;
@ -1408,7 +1626,7 @@ public class CustomDamage {
for (ItemStack it : GenericFunctions.getArmor(p)) {
if (it!=null) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, it) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
dodgechance+=0.01*it.getEnchantmentLevel(Enchantment.LUCK);
}
dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, it.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, it))/100d);
@ -1432,6 +1650,8 @@ public class CustomDamage {
}*/
}
}
dodgechance+=API.getPlayerBonuses(p).getBonusDodgeChance();
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.JAMDAK)/100d;
@ -1440,7 +1660,7 @@ public class CustomDamage {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK);
}
@ -1451,6 +1671,10 @@ public class CustomDamage {
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,2,2)/100d;
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,3,3)/100d;
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.VIXEN, 4)) {
dodgechance+=0.2;
}
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null && shooter instanceof LivingEntity) {
LivingEntity m = (LivingEntity)shooter;
@ -1500,20 +1724,26 @@ public class CustomDamage {
double magmacubediv = 0;
double rangerdmgdiv = 0;
double tacticspct = 0;
double darknessdiv = 0;
if (target instanceof LivingEntity) {
ItemStack[] armor = GenericFunctions.getArmor(target);
if (target instanceof Player) {
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target, ItemSet.DARNYS, 3, 3)/100d;
/*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d;*/
rangeraegislevel += GenericFunctions.getSwiftAegisAmt((Player)target);
Player p = (Player)target;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), p, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), p, ItemSet.DARNYS, 3, 3)/100d;
/*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 2, 2)/100d;*/
rangeraegislevel += GenericFunctions.getSwiftAegisAmt(p);
if ((p).getLocation().getY()>=0 && (p).getLocation().getY()<=255 && (p).getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
darknessdiv += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH)/100d;
}
} else {
LivingEntityDifficulty diff = EntityUtils.GetStrongestNearbyEntityDifficulty(EntityType.MAGMA_CUBE, target, 4);
double reduction = 0.0d;
if (diff!=null) {
switch (diff) {
case DANGEROUS:{
reduction=0.4d;
@ -1530,6 +1760,7 @@ public class CustomDamage {
}
magmacubediv+=Math.min(reduction,1);
}
}
for (int i=0;i<armor.length;i++) {
if (armor[i]!=null) {
@ -1634,7 +1865,7 @@ public class CustomDamage {
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i]) &&
p.getLocation().getY()>=0 &&
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
p.isOnGround() && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
double dmgreduce = 1d-(GenericFunctions.getAbilityValue(ArtifactAbility.SHADOWWALKER, p.getEquipment().getArmorContents()[i])/100d);
basedmg *= dmgreduce;
TwosideKeeper.log("Base damage became "+(dmgreduce*100)+"% of original amount.",5);
@ -1656,9 +1887,25 @@ public class CustomDamage {
TwosideKeeper.log("Protection level: "+protectionlevel, 5);
dmgreduction = ShredDamageReduction(dmgreduction, target,damager);
resistlevel=(resistlevel>10)?10:resistlevel;
protectionlevel=(protectionlevel>100)?100:protectionlevel;
partylevel=(partylevel>9)?9:partylevel;
/*if (damager!=null && target!=null) {
TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(damager)+"-> "+GenericFunctions.GetEntityDisplayName(target)+":\n"
+ "Damage Reduction: "+dmgreduction+"\n"
+ "Resist Level: "+(1d-((resistlevel*10d)/100d))+"\n"
+ "Ranger Aegis Level: "+(1d-((rangeraegislevel*10d)/100d))+"\n"
+ "Protection Level: "+(1d-((protectionlevel)/100d))+"\n"
+ "Projective Protection Level: "+(1d-((projectileprotectionlevel)/100d))+"\n"
+ "Explosion Protection Level: "+(1d-((explosionprotectionlevel)/100d))+"\n"
+ "Ranger Damage Divider: "+(1d-rangerdmgdiv)+"\n"
+ "Magma Cube Divider: "+(1d-magmacubediv)+"\n"
+ "Party Level: "+(1d-((partylevel*10d)/100d))+"\n"
+ "Tactics Percent: "+(1d-tacticspct)+"\n"
+ "Set Bonus: "+setbonus, 0);}*/
double finaldmg=(basedmg-(basedmg*(dmgreduction/100.0d)))
*(1d-((resistlevel*10d)/100d))
*(1d-((rangeraegislevel*10d)/100d))
@ -1667,6 +1914,7 @@ public class CustomDamage {
*(1d-((explosionprotectionlevel)/100d))
*(1d-rangerdmgdiv)
*(1d-magmacubediv)
*(1d-darknessdiv)
*(1d-((partylevel*10d)/100d))
*(1d-tacticspct)
*setbonus
@ -1686,6 +1934,19 @@ public class CustomDamage {
return finaldmg;
}
private static double ShredDamageReduction(double dmgreduction, LivingEntity target, Entity damager) {
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null && (shooter instanceof Player) &&
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor((Player)shooter), (Player)shooter, ItemSet.PRANCER, 4)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)shooter);
if (pd.ignoretargetarmor+200<TwosideKeeper.getServerTickTime()) {
pd.ignoretargetarmor=TwosideKeeper.getServerTickTime();
return Math.max(0, dmgreduction-50d);
}
}
return dmgreduction;
}
/**
* Adds a iframe with the specified amount of ticks in duration.
* @param ticks
@ -1958,6 +2219,16 @@ public class CustomDamage {
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 3, 3);*/
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.DASHER, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.DANCER, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.PRANCER, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.VIXEN, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.BLITZEN, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.COMET, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.CUPID, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.DONNER, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.RUDOLPH, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.OLIVE, 3, 3);
}
return dmg;
@ -2097,6 +2368,18 @@ public class CustomDamage {
ApplyDamage(defenderdmg, shooter, check, null, "Defender Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK);
//TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,0);
break;
} else
if (!isCupidTank(p) && isCupidTank(check) &&
!p.equals(check)) {
//This is a defender. Transfer half the damage to them!
double origdmg = dmg;
dmg = origdmg-(origdmg*(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(check), check, ItemSet.CUPID)/100d));
//Send the rest of the damage to the defender.
double defenderdmg = origdmg*(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(check), check, ItemSet.CUPID)/100d);
//defenderdmg=CalculateDamageReduction(dmg, check, entity);
ApplyDamage(defenderdmg, shooter, check, null, "Cupid Set Tank", IGNOREDODGE|IGNORE_DAMAGE_TICK);
//TwosideKeeper.log("Damage was absorbed by "+check.getName()+". Took "+defenderdmg+" reduced damage. Original damage: "+dmg,0);
break;
}
}
}
@ -2105,6 +2388,14 @@ public class CustomDamage {
return dmg;
}
private static boolean isCupidTank(Player p) {
if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.CUPID)>0) {
return true;
} else {
return false;
}
}
private static double calculateCriticalStrikeMultiplier(ItemStack weapon, LivingEntity shooter,
LivingEntity target, String reason, int flags) {
boolean criticalstrike=false;
@ -2629,6 +2920,7 @@ public class CustomDamage {
public static double calculateCooldownReduction(Player p) {
double cooldown = 0.0;
cooldown+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 2, 2)/100d;
cooldown+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN)/100d;
return cooldown;
}

@ -143,7 +143,16 @@ public class SigDrop extends Drop{
public ItemStack CreateModifiedLootPiece(Player p, ItemStack item, LivingEntityDifficulty diff2) {
if (isSet) {
ItemSet set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
ItemSet set = ItemSet.PANROS;
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (Math.random()<=0.8) {
set = LivingEntityDifficulty.PickAHolidayItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
}
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
}
//Turn it into the appropriate piece if necessary.
item = LivingEntityDifficulty.ConvertSetPieceIfNecessary(item, set);

@ -72,7 +72,6 @@ public class EntityDamagedEvent extends Event implements Cancellable{
@Override
public boolean isCancelled() {
// TODO Auto-generated method stub
return this.cancelled;
}

@ -428,7 +428,7 @@ public enum ArtifactAbility {
if (getEnchantmentLevel(ability,item)>1) { //This is more than 1 level, so we just remove one level from it.
//This is allowed. Proceed.
item = applyEnchantment(ability,getEnchantmentLevel(ability,item)-1,item);
AwakenedArtifact.addAP(item, 1);
//AwakenedArtifact.addAP(item, 1);
} else {
//Just remove it completely.
removeEnchantment(ability,item);

@ -2505,7 +2505,9 @@ public class GenericFunctions {
item.getType()!=Material.AIR) {
int mendinglv = item.getEnchantmentLevel(Enchantment.MENDING);
int infinitylv = item.getEnchantmentLevel(Enchantment.ARROW_INFINITE);
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Testing Mending...", 1);
if (mendinglv>0 && Math.random()<=0.00048828125*(isHarvestingTool(item)?0.75:1d)) {
//TwosideKeeper.log("Knockoff!", 0);
mendinglv--;
if (mendinglv>0) {
item.addUnsafeEnchantment(Enchantment.MENDING, mendinglv);
@ -2712,11 +2714,11 @@ public class GenericFunctions {
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
TwosideKeeper.log("Found one.",5);
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
if (Math.random()<=(100d/tier)/100d) {
if (Math.random()<=(8-(tier/2d))/100d) {
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
//AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1);
//AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1);
brokeone=true;
return;
}
@ -2728,9 +2730,9 @@ public class GenericFunctions {
if (isArtifactEquip(item) &&
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
if (Math.random()<=(100d/tier)/100d) {
if (Math.random()<=(8-(tier/2d))/100d) {
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
//AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
p.sendMessage(ChatColor.DARK_AQUA+"A level of "+ChatColor.YELLOW+"Greed"+ChatColor.DARK_AQUA+" has been knocked off of your "+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():UserFriendlyMaterialName(item)));
brokeone=true;
return;
@ -2999,6 +3001,10 @@ public class GenericFunctions {
}
public static void updateNoDamageTickMap(LivingEntity entity, Entity damager) {
updateNoDamageTickMap(entity,damager,0);
}
public static void updateNoDamageTickMap(LivingEntity entity, Entity damager, int extraticks) {
if (entity instanceof Player) {
Player p = (Player)entity;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -3008,10 +3014,10 @@ public class GenericFunctions {
damager = CustomDamage.getDamagerEntity(damager);
}
}
pd.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime());
pd.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime()+extraticks);
} else {
TwosideKeeper.log("Adding one.", 5);
pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime());
pd.hitlist.put(p.getUniqueId(), TwosideKeeper.getServerTickTime()+extraticks);
}
} else
if (entity instanceof LivingEntity) {
@ -3023,9 +3029,9 @@ public class GenericFunctions {
damager = CustomDamage.getDamagerEntity(damager);
}
}
md.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime());
md.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime()+extraticks);
} else {
md.hitlist.put(m.getUniqueId(), TwosideKeeper.getServerTickTime());
md.hitlist.put(m.getUniqueId(), TwosideKeeper.getServerTickTime()+extraticks);
}
}
}
@ -3405,21 +3411,27 @@ public class GenericFunctions {
}
public static void ConvertSetColor(ItemStack item, ItemSet set) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
if (set==ItemSet.JAMDAK) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0));
item.setItemMeta(lm);
}
if (set==ItemSet.DARNYS) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
lm.setColor(org.bukkit.Color.fromRGB(224, 224, 224));
item.setItemMeta(lm);
}
if (set==ItemSet.ALIKAHN) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
lm.setColor(org.bukkit.Color.fromRGB(64, 0, 64));
item.setItemMeta(lm);
}
if (set==ItemSet.LORASAADI) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0));
}
item.setItemMeta(lm);
}
}
public static ExperienceOrb spawnXP(Location location, int expAmount) {
ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class);
@ -3659,6 +3671,16 @@ public class GenericFunctions {
}
}
}
public static void DealDamageToNearbyMobs(Location l, double basedmg, int range, Entity damager, int flags) {
List<LivingEntity> nearbyentities = getNearbyMobs(l,range);
for (LivingEntity ent : nearbyentities) {
if (!(ent instanceof Player)) {
CustomDamage.ApplyDamage(basedmg, damager, ent, null, "Blitzen Lightning Strike", flags);
}
}
}
public static void DealDamageToNearbyMobs(Location l, double basedmg, int range, boolean knockup, double knockupamt, Entity damager, ItemStack weapon, boolean isLineDrive) {
DealDamageToNearbyMobs(l,basedmg,range,knockup,knockupamt,damager,weapon,isLineDrive,(isLineDrive)?"Line Drive":null);
}
@ -4256,7 +4278,7 @@ public class GenericFunctions {
if (ex_version) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p));;
aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p));
pd.last_strikerspell=TwosideKeeper.getServerTickTime();
}
},17);
@ -4446,28 +4468,35 @@ public class GenericFunctions {
if (pd.rage_time>TwosideKeeper.getServerTickTime()) {
message = ChatColor.RED+" !! RAGE ACTIVE !! "+message;
}
if (important || (pd.lastimportantactionbarmsg+20<TwosideKeeper.getServerTickTime())) {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Preparing Message. Important? "+important+" Message: \""+message+"\"", 1);
String prefix=ActionBarBuffUpdater.getActionBarPrefix(p);
if (prefix.length()>0) {
aPlugin.API.sendActionBarMessage(p, message+" "+prefix);
finalmsg=message+" "+prefix;
if (important || (pd.lastimportantactionbarmsg+20<TwosideKeeper.getServerTickTime())) {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Sent Message", 0);
if (prefix.length()>0) {
aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), finalmsg));
} else {
if (message.length()>0) {
aPlugin.API.sendActionBarMessage(p, message);
aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), message));
finalmsg=message;
}
}
if (important) {
pd.lastimportantactionbarmsg=TwosideKeeper.getServerTickTime();
}
pd.lastActionBarMessage=finalmsg;
}
pd.lastActionBarMessage=finalmsg;
pd.lastActionBarMessageTime=TwosideKeeper.getServerTickTime();
/*if ((finalmsg.length()>0 && pd.lastActionBarMessageTime+100<TwosideKeeper.getServerTickTime()) || pd.lastActionBarMessageTime+100<TwosideKeeper.getServerTickTime()) {
pd.lastActionBarMessageTime=TwosideKeeper.getServerTickTime();
}*/
}
public static void sendLastImportantActionBarMsgTime(Player p, long last_important_msg_time) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastimportantactionbarmsg=last_important_msg_time;
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"]Set time to "+last_important_msg_time, 1);
}
public static String getLastActionBarMessage(Player p) {

@ -134,7 +134,7 @@ public class Habitation {
bw.newLine();
}
if (locationhashes.keySet().toArray().length>0) {
TwosideKeeper.log("[Habitat]Saved "+(locationhashes.keySet().toArray().length)+" habitats successfully.",2);
TwosideKeeper.log("[Habitat]Saved "+(locationhashes.keySet().toArray().length)+" habitat"+((locationhashes.keySet().toArray().length)!=1?"s":"")+" successfully.",2);
}
bw.close();
} catch (IOException e) {

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

@ -25,7 +25,17 @@ public enum ItemSet {
MOONSHADOW(4,2, 1,1, 8,8, 15,7),
GLADOMAIN(1,1, 12,10, 8,8, 1,1),
WOLFSBANE(2,1, 15,10, 10,5, 15,10),
ALUSTINE(3,2, 300,-30, 50,-5, 6,2);
ALUSTINE(3,2, 300,-30, 50,-5, 6,2),
DASHER(5,5, 3,3, 5,5, 0,0),
DANCER(5,1, 3,3, 5,5, 0,0),
PRANCER(5,5, 3,3, 5,5, 0,0),
VIXEN(5,4, 3,3, 5,5, 0,0),
COMET(10,10, 10,10, 2,1, 0,0),
CUPID(10,5, 10,10, 2,1, 0,0),
DONNER(5,5, 10,10, 2,1, 0,0),
BLITZEN(10,10, 3,3, 5,5, 0,0),
RUDOLPH(5,5, 10,10, 2,1, 0,0),
OLIVE(3,2, 10,10, 2,1, 0,0);
int baseval;
int increase_val;
@ -238,7 +248,9 @@ public enum ItemSet {
case DAWNTRACKER:{
lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Dawntracker Set");
lore.add(ChatColor.YELLOW+"-"+(ItemSet.GetBaseAmount(set, tier, 1)/3)+" Damage taken per hit");
if (((ItemSet.GetBaseAmount(set, tier, 1)+1)/3)>0) {
lore.add(ChatColor.YELLOW+"-"+((ItemSet.GetBaseAmount(set, tier, 1)+1)/3)+" Damage taken per hit");
}
}break;
case LORASYS:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Gear");
@ -285,6 +297,56 @@ public enum ItemSet {
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Alustine Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% EXP Gain");
}break;
case BLITZEN:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Attack Rate");
break;
case COMET:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Health Regeneration to Party Members");
break;
case CUPID:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"Absorbs "+ItemSet.GetBaseAmount(set, tier, 1)+"% of Damage Taken from Party Members");
break;
case DANCER:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" Damage per 1m of Movement Speed");
break;
case DASHER:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Movement Speed");
break;
case DONNER:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"Attacking aggros enemies for "+ItemSet.GetBaseAmount(set, tier, 1)+" seconds");
break;
case OLIVE:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"When blocking, attackers take "+ItemSet.GetBaseAmount(set, tier, 1)+" True Damage");
break;
case PRANCER:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"Deals +"+ItemSet.GetBaseAmount(set, tier, 1)+" Additional Damage in Mid-Air");
break;
case RUDOLPH:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"In Dark Areas, gain "+ItemSet.GetBaseAmount(set, tier, 1)+"% Damage Reduction");
break;
case VIXEN:
lore.add(ChatColor.BLUE+"Holiday Gear");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Cooldown Reduction");
break;
}
lore.add("");
@ -451,6 +513,88 @@ public enum ItemSet {
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"number of levels you have. Drains XP equal");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"to the number of levels you have per hit.");
}break;
case BLITZEN:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Storm Onward!");
lore.add(ChatColor.GRAY+" Attacks occasionally send Lightning bolts");
lore.add(ChatColor.GRAY+" down on foes dealing true damage.");
break;
case COMET:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" More Health For You");
lore.add(ChatColor.GRAY+" Right-Clicking players will take away");
lore.add(ChatColor.GRAY+" 10% of your health to heal 20% of");
lore.add(ChatColor.GRAY+" the targeted ally's health.");
break;
case CUPID:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Linked for Life");
lore.add(ChatColor.GRAY+" Right-Clicking players will link yourself");
lore.add(ChatColor.GRAY+" to them. Teleporting via any means sends");
lore.add(ChatColor.GRAY+" you both to the new position.");
break;
case DANCER:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Can't Catch Me!");
lore.add(ChatColor.GRAY+" Changing your movement direction constantly");
lore.add(ChatColor.GRAY+" makes you invulnerable to incoming attacks.");
break;
case DASHER:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Marathon Runner");
lore.add(ChatColor.GRAY+" Sprinting will restore missing hunger.");
break;
case DONNER:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Come At Me");
lore.add(ChatColor.GRAY+" Monsters attacking your party members");
lore.add(ChatColor.GRAY+" will automatically be provoked to you.");
break;
case OLIVE:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Right Back At You");
lore.add(ChatColor.GRAY+" Gain 20 Absorption Health each time");
lore.add(ChatColor.GRAY+" damage is taken. (30 sec cooldown)");
break;
case PRANCER:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Will You Just Sit Down?");
lore.add(ChatColor.GRAY+" Your next strike ignores 50% of the");
lore.add(ChatColor.GRAY+" target's armor. (10 sec cooldown)");
break;
case RUDOLPH:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Light the Way");
lore.add(ChatColor.GRAY+" You and your party gain Permanent");
lore.add(ChatColor.GRAY+" Night Vision.");
break;
case VIXEN:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Untouchable, Unkillable");
lore.add(ChatColor.GRAY+" Increases Dodge Chance by 20%. Dodging");
lore.add(ChatColor.GRAY+" successfully restores 10% of your max");
lore.add(ChatColor.GRAY+" health.");
break;
}
return lore;
}

@ -18,6 +18,7 @@ import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public enum LivingEntityDifficulty {
NORMAL(0),
@ -183,6 +184,20 @@ public enum LivingEntityDifficulty {
set==ItemSet.ALUSTINE)) {
goodie.setType(Material.SKULL_ITEM);
}
if (!GenericFunctions.isArmor(goodie) && (set==ItemSet.BLITZEN ||
set==ItemSet.COMET ||
set==ItemSet.CUPID ||
set==ItemSet.DANCER ||
set==ItemSet.DASHER ||
set==ItemSet.DONNER ||
set==ItemSet.OLIVE ||
set==ItemSet.PRANCER ||
set==ItemSet.RUDOLPH ||
set==ItemSet.VIXEN)) {
//Convert to a random choice of armor.
ItemStack item = new ItemStack(Christmas.PickRandomArmorMaterial());
goodie.setType(item.getType());
}
return goodie;
}
@ -303,4 +318,40 @@ public enum LivingEntityDifficulty {
}
return ItemSet.PANROS;
}
public static ItemSet PickAHolidayItemSet(PlayerMode playerMode, Object object) {
final int NUMBER_OF_MODES=10;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
return ItemSet.BLITZEN;
} else
if (selectweight<100) {
return ItemSet.COMET;
} else
if (selectweight<150) {
return ItemSet.CUPID;
} else
if (selectweight<200) {
return ItemSet.DANCER;
} else
if (selectweight<250) {
return ItemSet.DASHER;
} else
if (selectweight<300) {
return ItemSet.DONNER;
} else
if (selectweight<350) {
return ItemSet.OLIVE;
} else
if (selectweight<400) {
return ItemSet.PRANCER;
} else
if (selectweight<450) {
return ItemSet.RUDOLPH;
} else
{
return ItemSet.VIXEN;
}
}
}

@ -20,6 +20,7 @@ import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Drops.SigDrop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public class Loot {
@ -46,6 +47,15 @@ public class Loot {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getCookieItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getLargeCandyItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSourCandyItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasEventToken(),8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasBox(),1));
}
/*aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Hardened Mega Set Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,MonsterDifficulty.NORMAL));
@ -87,6 +97,17 @@ public class Loot {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,60,"[Dangerous] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getCookieItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSmallCandyItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getLargeCandyItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSourCandyItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasEventToken(),800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasBox(),200));
}
aPlugin.API.Chests.LOOT_DANGEROUS.printDrops();
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_INGOT,1,2,59800));
@ -107,6 +128,12 @@ public class Loot {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,120,"[Deadly] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_CORE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasEventToken(),800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasBox(),200));
}
aPlugin.API.Chests.LOOT_DEADLY.printDrops();
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD,1,3,60200));
@ -127,6 +154,12 @@ public class Loot {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,180,"[Hellfire] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasEventToken(),800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasBox(),200));
}
aPlugin.API.Chests.LOOT_HELLFIRE.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,1800,"[End] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.END));
@ -625,6 +658,19 @@ public class Loot {
item.setItemMeta(m);
set_name = prefix+"Alustine Slayer Charm";
}break;
case BLITZEN:
case COMET:
case CUPID:
case DANCER:
case DASHER:
case DONNER:
case OLIVE:
case PRANCER:
case RUDOLPH:
case VIXEN: {
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Holiday "+GenericFunctions.CapitalizeFirstLetters(set.name())+" "+GenericFunctions.UserFriendlyMaterialName(item.getType()); //Striker set.
}break;
}
if (item.getItemMeta().hasLore()) {
lore = item.getItemMeta().getLore();

@ -1,14 +1,15 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.util.HashMap;
import java.util.List;
import org.bukkit.inventory.ItemStack;
public class ArrayUtils {
public static String toString(ItemStack[] items) {
public static String toString(Object[] items) {
StringBuilder string = new StringBuilder();
boolean first=false;
for (ItemStack i : items) {
for (Object i : items) {
if (i!=null) {
if (!first) {
string.append(i.toString());

@ -2,9 +2,12 @@ package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
@ -22,7 +25,7 @@ public class EntityUtils {
}
public static LivingEntityDifficulty GetStrongestNearbyEntityDifficulty(EntityType type, Entity ent, double range) {
List<Entity> ents = ent.getNearbyEntities(range, range, range);
LivingEntityDifficulty strongest = LivingEntityDifficulty.NORMAL;
LivingEntityDifficulty strongest = null;
for (Entity e : ents) {
if (e instanceof LivingEntity) {
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty((LivingEntity)e);
@ -33,4 +36,20 @@ public class EntityUtils {
}
return strongest;
}
public static boolean PreventEnderCrystalDestruction(Entity ent) {
if (ent instanceof EnderCrystal && ent.getWorld().getName().equalsIgnoreCase("world")) {
return true;
} else {
return false;
}
}
public static boolean ProperlyStoreEnderCrystal(Entity ent) {
if (ent instanceof EnderCrystal && ent.getWorld().getName().equalsIgnoreCase("world")) {
ent.getWorld().dropItemNaturally(ent.getLocation(), new ItemStack(Material.END_CRYSTAL));
ent.remove();
return true;
} else {
return false;
}
}
}

@ -31,7 +31,7 @@ public class InventoryUtils {
for (ItemStack itemStacks : p.getInventory().getContents()) {
if (itemStacks!=null && CustomItem.isVacuumCube(itemStacks)) {
//Insert as many items as possible in here.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingString(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
List<ItemStack> itemCubeContents = TwosideKeeper.itemCube_loadConfig(id);
Inventory virtualinventory = Bukkit.createInventory(p, itemCubeContents.size());
for (int i=0;i<virtualinventory.getSize();i++) {
@ -70,7 +70,7 @@ public class InventoryUtils {
for (ItemStack itemStacks : p.getInventory().getContents()) {
if (itemStacks!=null && CustomItem.isFilterCube(itemStacks)) {
//Insert as many items as possible in here.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingString(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
List<ItemStack> itemCubeContents = TwosideKeeper.itemCube_loadConfig(id);
Inventory virtualinventory = Bukkit.createInventory(p, 27);
for (int i=0;i<virtualinventory.getSize();i++) {
@ -155,4 +155,17 @@ public class InventoryUtils {
return DirtBlockReply.TOOMUCHDIRT;
}
}
public static boolean onlyHoldingRacingItems(Player p) {
Inventory inv = p.getInventory();
for (ItemStack i : inv.getContents()) {
if (i!=null && i.getType()!=Material.AIR) {
if (!(i.getType()==Material.BOW ||
i.getType().name().contains("SWORD") ||
Christmas.isCookieItem(i))) {
return false;
}
}
}
return true;
}
}

@ -20,7 +20,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
public class ItemCubeUtils {
public static int getItemCubeID(ItemStack item) {
return Integer.parseInt(ItemUtils.GetLoreLineContainingString(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
return Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
}
public static Location getFilterCubeLoc(int id) {
int posx = id % 960;
@ -41,6 +41,9 @@ public class ItemCubeUtils {
b.getWorld().getBlockAt(getFilterCubeLoc(id)).setType(Material.HOPPER);
}
public static HashMap<Integer, ItemStack> AttemptingToAddItemToFilterCube(int id, Inventory cube_inv, ItemStack[] remaining) {
return AttemptingToAddItemToFilterCube(id,cube_inv,remaining,false);
}
public static HashMap<Integer, ItemStack> AttemptingToAddItemToFilterCube(int id, Inventory cube_inv, ItemStack[] remaining, boolean testing) {
Hopper h = getFilterCubeHopper(id);
Inventory inv = h.getInventory();
HashMap<Integer,ItemStack> reject_items = new HashMap<Integer,ItemStack>();
@ -54,7 +57,9 @@ public class ItemCubeUtils {
itemslist.add(cube_inv.getItem(i));
}
ItemCube.addToViewersOfItemCube(id,remaining,null);
if (!testing) {
TwosideKeeper.itemCube_saveConfig(id, itemslist);
}
} else {
for (ItemStack i : extras.values()) {
reject_items.put(reject_items.size(), i);
@ -62,9 +67,11 @@ public class ItemCubeUtils {
for (int j=0;j<cube_inv.getSize();j++) {
itemslist.add(cube_inv.getItem(j));
}
if (!testing) {
TwosideKeeper.itemCube_saveConfig(id, itemslist);
}
}
}
} else {
reject_items.put(reject_items.size(), it);
}

@ -4,9 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.ItemMeta;
import sig.plugin.TwosideKeeper.TwosideKeeper;
@ -68,7 +73,7 @@ public class ItemUtils {
return false;
}
public static String GetLoreLineContainingString(ItemStack item, String string) {
public static String GetLoreLineContainingSubstring(ItemStack item, String string) {
if (isValidLoreItem(item)) {
List<String> lore = item.getItemMeta().getLore();
for (String l : lore) {
@ -80,6 +85,22 @@ public class ItemUtils {
return "";
}
public static ItemStack ModifyLoreLineContainingSubstring(ItemStack item, String string, String newstring) {
if (isValidLoreItem(item)) {
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.getLore();
for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(string)) {
lore.set(i, newstring);
break;
}
}
meta.setLore(lore);
item.setItemMeta(meta);
}
return item;
}
public static String GetLoreLine(ItemStack item, int line_numb) {
if (isValidLoreItem(item)) {
List<String> lore = item.getItemMeta().getLore();
@ -113,4 +134,56 @@ public class ItemUtils {
return false;
}
}
public static ItemStack createRandomFirework() {
ItemStack firework = new ItemStack(Material.FIREWORK);
FireworkMeta fm = (FireworkMeta)firework.getItemMeta();
fm.setPower((int)(Math.random()*2+1));
for (int i=0;i<((int)(Math.random()*6))+1;i++) {
fm.addEffect(generateRandomFireworkEffect());
}
//fm.addEffect(generateRandomFireworkEffect());
firework.setItemMeta(fm);
return firework;
}
private static FireworkEffect generateRandomFireworkEffect() {
FireworkEffect.Builder builder = FireworkEffect.builder();
if (Math.random()<=0.33) {
builder.flicker(true);
}
if (Math.random()<=0.33) {
builder.trail(true);
}
builder.with(Type.values()[((int)(Math.random()*Type.values().length))]);
Color newcol = RandomizeBrightColor();
builder.withColor(newcol);
if (Math.random()<=0.33) {
builder.withFade(Color.fromRGB((int)(Math.random()*192+64), (int)(Math.random()*192+64), (int)(Math.random()*192+64)));
}
return builder.build();
}
public static Color RandomizeBrightColor() {
double numb = Math.random();
int r = 0;
int g = 0;
int b = 0;
if (numb<=0.33) {
r = (int)(Math.random()*64+192);
g = (int)(Math.random()*256);
b = (int)(Math.random()*256);
} else
if (numb<=0.66) {
g = (int)(Math.random()*64+192);
r = (int)(Math.random()*256);
b = (int)(Math.random()*256);
} else {
b = (int)(Math.random()*64+192);
r = (int)(Math.random()*256);
g = (int)(Math.random()*256);
}
Color newcol = Color.fromRGB(r, g, b);
return newcol;
}
}

@ -18,4 +18,9 @@ public class TextUtils {
return colors[((int)(Math.random()*colors.length))];
}
public static ChatColor RandomDarkColor() {
ChatColor[] choices = new ChatColor[]{ChatColor.DARK_AQUA,ChatColor.DARK_BLUE,ChatColor.DARK_GRAY,ChatColor.DARK_GREEN,ChatColor.DARK_PURPLE,ChatColor.DARK_RED,ChatColor.GOLD};
return choices[(int)(Math.random()*choices.length)];
}
}

@ -245,7 +245,7 @@ public class WorldShop {
} else
if (!GenericFunctions.isArtifactArmor(item) && item.hasItemMeta() &&
item.getItemMeta().hasDisplayName()) {
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType())+"\n";
message+="\n"+ChatColor.DARK_GRAY+"Item Type: "+ChatColor.ITALIC+ChatColor.GRAY+GenericFunctions.UserFriendlyMaterialName(item.getType(),item.getDurability())+"\n";
}
if (item.hasItemMeta() && !item.getItemMeta().getItemFlags().contains(ItemFlag.HIDE_ENCHANTS)) {
for (int i=0;i<Enchantment.values().length;i++) {

File diff suppressed because it is too large Load Diff

@ -124,6 +124,18 @@ public class PlayerStructure {
public long usetimer=0;
public boolean weatherwatch=false;
public String weatherwatch_user="";
public boolean falldamageimmunity=false;
public double pctbonusregen = 0.0;
public long pctbonusregentime = 0;
public long lastlightningstrike = 0;
public Player linkplayer = null;
public long lastlinkteleport = 0;
public int lastxsign = 0;
public int lastzsign = 0;
public long lastabsorptionhealthgiven = TwosideKeeper.getServerTickTime();
public long ignoretargetarmor = TwosideKeeper.getServerTickTime();
public long lastcandyconsumed = TwosideKeeper.getServerTickTime();
public long icewandused = TwosideKeeper.getServerTickTime();
public long iframetime = 0;
@ -143,6 +155,7 @@ public class PlayerStructure {
public long lastbowmodeswitch=0;
public long lastsneak=0;
public long lastcombat=0;
public long lastsantabox=0;
public boolean isPlayingSpleef=false;
@ -158,12 +171,19 @@ public class PlayerStructure {
public String lastActionBarMessage="";
public Location lastStandingLoc = null;
public boolean holidaychest1=false;
public boolean holidaychest2=false;
public boolean holidaychest3=false;
public boolean holidaychest4=false;
public HashMap<Material,Block> blockscanlist=new HashMap<Material,Block>();
public long lastusedrocketbooster=0;
public long lastActionBarMessageTime=0;
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
@SuppressWarnings("deprecation")
public PlayerStructure(Player p, long serverTickTime) {
if (p!=null) {
if (p!=null && p.isOnline()) {
this.velocity = 0d;
this.name = p.getName();
this.joined = serverTickTime;
@ -208,6 +228,7 @@ public class PlayerStructure {
this.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.lastassassinatetime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.lastlifesavertime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.icewandused=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.damagedata = new DamageLogger(p);
this.damagelogging=false;
this.isPlayingSpleef=false;
@ -263,6 +284,7 @@ public class PlayerStructure {
applyCooldownToAllTypes(p,"SWORD",TwosideKeeper.LINEDRIVE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, TwosideKeeper.REJUVENATE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, TwosideKeeper.LIFESAVER_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.WATCH, TwosideKeeper.ICEWAND_COOLDOWN);
}
private void applyCooldownToAllTypes(Player p, String item, int cooldown) {
@ -298,6 +320,11 @@ public class PlayerStructure {
workable.set("vendetta_amt", vendetta_amt);
workable.set("weatherwatch", weatherwatch);
workable.set("weatherwatch_user", weatherwatch_user);
workable.set("holidaychest1", holidaychest1);
workable.set("holidaychest2", holidaychest2);
workable.set("holidaychest3", holidaychest3);
workable.set("holidaychest4", holidaychest4);
workable.set("lastsantabox", lastsantabox);
//ConfigurationSection deathlootlist = workable.createSection("deathloot");
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
@ -348,6 +375,11 @@ public class PlayerStructure {
workable.addDefault("vendetta_amt", vendetta_amt);
workable.addDefault("weatherwatch", weatherwatch);
workable.addDefault("weatherwatch_user", weatherwatch_user);
workable.addDefault("holidaychest1", holidaychest1);
workable.addDefault("holidaychest2", holidaychest2);
workable.addDefault("holidaychest3", holidaychest3);
workable.addDefault("holidaychest4", holidaychest4);
workable.addDefault("lastsantabox", lastsantabox);
workable.options().copyDefaults();
@ -377,6 +409,11 @@ public class PlayerStructure {
this.lastcombat = TwosideKeeper.getServerTickTime();
this.weatherwatch = workable.getBoolean("weatherwatch");
this.weatherwatch_user = workable.getString("weatherwatch_user");
this.holidaychest1 = workable.getBoolean("holidaychest1");
this.holidaychest2 = workable.getBoolean("holidaychest2");
this.holidaychest3 = workable.getBoolean("holidaychest3");
this.holidaychest4 = workable.getBoolean("holidaychest4");
this.lastsantabox = workable.getLong("lastsantabox");
if (this.hasDied) {
List<ItemStack> deathlootlist = new ArrayList<ItemStack>();

@ -43,6 +43,8 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.EnderDragon.Phase;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
@ -50,6 +52,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.entity.SmallFireball;
@ -62,6 +65,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Witch;
@ -160,11 +164,13 @@ import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import aPlugin.API.Chests;
import events.PlayerGainItemEvent;
import events.PluginLoadEvent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_9_R1.EnumParticle;
import sig.plugin.AutoPluginUpdate.AnnounceUpdateEvent;
import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem;
@ -199,10 +205,12 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.RecipeCategory;
import sig.plugin.TwosideKeeper.HelperStructures.Common.RecipeLinker;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.EarthWaveTask;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryIce;
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.DirtBlockReply;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
@ -379,7 +387,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int SPAWN_DEBUG_LEVEL=5;
public static final int LAVA_PLUME_COOLDOWN=60;
public static final int SNOW_GOLEM_COOLDOWN=60;
public static final int SNOW_GOLEM_COOLDOWN=20*60;
public static final int DODGE_COOLDOWN=100;
public static final int DEATHMARK_COOLDOWN=240;
@ -392,9 +400,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int ARROWBARRAGE_COOLDOWN=2400;
public static final int SIPHON_COOLDOWN = 700;
public static final int MOCK_COOLDOWN = 400;
public static final int ICEWAND_COOLDOWN = 1200;
public static final Material[] ClearFallingBlockList = {Material.REDSTONE_BLOCK};
public static List<String> SnowmanHuntList = new ArrayList<String>();
public static long LastSnowmanHunt = 0;
public static String HuntingForSnowman = "";
public static Location TWOSIDE_LOCATION;
public static final int CLEANUP_DEBUG = 2;
@ -418,6 +431,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static boolean restarting_server=false;
public static List<String> log_messages=new ArrayList<String>();
public static List<TemporaryLava> temporary_lava_list = new ArrayList<TemporaryLava>();
public static List<TemporaryIce> temporary_ice_list = new ArrayList<TemporaryIce>();
public static List<Chunk> temporary_chunks = new ArrayList<Chunk>();
public static List<BlockModifyQueue> blockqueue = new ArrayList<BlockModifyQueue>();
long LastClearStructureTime = 0;
@ -673,12 +687,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
for (Player p : Bukkit.getOnlinePlayers()) {
runServerHeartbeat.runVacuumCubeSuckup(p);
runServerHeartbeat.runFilterCubeCollection(p);
/*if (p.getVehicle() instanceof EnderDragon) {
EnderDragon ed = (EnderDragon)p.getVehicle();
ed.setVelocity(p.getLocation().getDirection().multiply(2.0f));
ed.teleport(ed.getLocation().setDirection(p.getLocation().getDirection()));
}*/
}
for (TemporaryLava tl : temporary_lava_list) {
if (!tl.runTick()) {
ScheduleRemoval(temporary_lava_list,tl);
}
}
for (TemporaryIce tl : temporary_ice_list) {
if (!tl.run()) {
ScheduleRemoval(temporary_ice_list,tl);
}
}
}
private void UpdateLavaBlock(Block lavamod) {
@ -837,6 +861,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!LOOT_TABLE_NEEDS_POPULATING) {
Loot.DefineLootChests();
Christmas.SetupChristmas();
}
getServer().getScheduler().scheduleSyncRepeatingTask(this, new SetupPlayerMode(),0l,10l);
@ -886,6 +911,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
betweentime = System.currentTimeMillis();
log("Cleaning up Temporary Ice ["+temporary_ice_list.size()+"]",CLEANUP_DEBUG);
for (TemporaryIce tl : temporary_ice_list) {
tl.Cleanup();
}
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
betweentime = System.currentTimeMillis();
log("Cleaning up Open Player Death Inventories ["+Bukkit.getOnlinePlayers().size()+"]",CLEANUP_DEBUG);
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getOpenInventory()!=null && p.getOpenInventory().getTopInventory()!=null &&
@ -1121,6 +1152,151 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.sendMessage("/fix COOKIE [amount]");
}
}break;
case "CHRISTMASBOX":{
if (args.length==1) {
GenericFunctions.giveItem(p, Christmas.getChristmasBox());
} else
if (args.length==2) {
ItemStack schematic = Christmas.getChristmasBox();
schematic.setAmount(Integer.parseInt(args[1]));
GenericFunctions.giveItem(p, schematic);
} else {
p.sendMessage("/fix "+args[0]+" [amount]");
}
}break;
case "CHRISTMASDECORATIONBOX":{
if (args.length==1) {
GenericFunctions.giveItem(p, Christmas.getChristmasDecorationBox());
} else
if (args.length==2) {
ItemStack schematic = Christmas.getChristmasDecorationBox();
schematic.setAmount(Integer.parseInt(args[1]));
GenericFunctions.giveItem(p, schematic);
} else {
p.sendMessage("/fix "+args[0]+" [amount]");
}
}break;
case "FIREWORKSHOOTER":{
if (args.length==1) {
GenericFunctions.giveItem(p, Christmas.getFireworkShooterBox());
} else
if (args.length==2) {
ItemStack schematic = Christmas.getFireworkShooterBox();
schematic.setAmount(Integer.parseInt(args[1]));
GenericFunctions.giveItem(p, schematic);
} else {
p.sendMessage("/fix "+args[0]+" [amount]");
}
}break;
case "ROCKETBOOSTER":{
if (args.length==1) {
GenericFunctions.giveItem(p, Christmas.getRocketBoosterItem());
} else
if (args.length==2) {
ItemStack schematic = Christmas.getRocketBoosterItem();
schematic.setAmount(Integer.parseInt(args[1]));
GenericFunctions.giveItem(p, schematic);
} else {
p.sendMessage("/fix "+args[0]+" [amount]");
}
}break;
case "CHRISTMASTOKEN":{
if (args.length==1) {
GenericFunctions.giveItem(p, Christmas.getChristmasEventToken());
} else
if (args.length==2) {
ItemStack schematic = Christmas.getChristmasEventToken();
schematic.setAmount(Integer.parseInt(args[1]));
GenericFunctions.giveItem(p, schematic);
} else {
p.sendMessage("/fix "+args[0]+" [amount]");
}
}break;
case "PARTICLE":{
aPluginAPIWrapper.sendParticle(p.getLocation(), EnumParticle.valueOf(args[1]), 0, 1, 0, 1, 50);
}break;
case "SPECIALHORSE":{
Horse h = (Horse)p.getWorld().spawnEntity(p.getLocation(), EntityType.HORSE);
h.setVariant(Variant.HORSE);
h.setColor(Horse.Color.WHITE);
h.setStyle(Style.values()[(int)(Math.random()*Style.values().length)]);
h.setTamed(true);
h.setAdult();
h.setJumpStrength(0.43+(0.13*8));
h.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.395f);
h.setInvulnerable(true);
}break;
case "GIVEFULLSET":{
for (ItemStack item : new ItemStack[]{
new ItemStack(Material.GOLD_HELMET),
new ItemStack(Material.GOLD_CHESTPLATE),
new ItemStack(Material.GOLD_LEGGINGS),
new ItemStack(Material.GOLD_BOOTS),
}) {
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+Integer.parseInt(args[2])+" "+ItemSet.valueOf(args[1])+" Set");
ItemMeta m = item.getItemMeta();
m.setLore(lore);
item.setItemMeta(m);
p.getWorld().dropItemNaturally(p.getLocation(), item);
}
}break;
case "ICEWAND":{
GenericFunctions.giveItem(p, Christmas.getWinterSolsticeAugury());
}break;
case "SENDTREERULES":{
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.sendMessage(ChatColor.GREEN+"Tree Climb Event - ");
pl.sendMessage(ChatColor.AQUA+"GOAL: "+ChatColor.RESET+"Get to the top Log of the Tree.");
pl.sendMessage(ChatColor.YELLOW+"RULES: ");
pl.sendMessage(ChatColor.WHITE+" - Only Holiday Cookies are allowed. All other items must be stored away!");
pl.sendMessage(ChatColor.WHITE+" - Leaves and Snow blocks may be broken. Logs CANNOT be broken.");
pl.sendMessage(ChatColor.WHITE+" - You can bring 5 Dirt Blocks with you to place during any portion of the Tree Climb. You may not recollect the dirt after placing it.");
pl.sendMessage(ChatColor.YELLOW+"PRIZES: ");
pl.sendMessage(ChatColor.WHITE+" - 1st Place: 3 Christmas Tokens");
pl.sendMessage(ChatColor.WHITE+" - 2nd/3rd Place: 2 Christmas Tokens");
pl.sendMessage(ChatColor.WHITE+" - Others: 1 Christmas Token");
pl.sendMessage("");
pl.sendMessage(ChatColor.WHITE+"Please proceed with emptying your inventories now and type\n"+ChatColor.GREEN+"/ready "+ChatColor.WHITE+"when you are ready!");
}
}break;
case "SENDRACERULES":{
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.sendMessage(ChatColor.GREEN+"Tree Climb Event - ");
pl.sendMessage(ChatColor.AQUA+"GOAL: "+ChatColor.RESET+"Finish one lap around the icy plains of New World 2.");
pl.sendMessage(ChatColor.YELLOW+"RULES: ");
pl.sendMessage(ChatColor.WHITE+" - Only Holiday Cookies are allowed. All other items must be stored away!");
pl.sendMessage(ChatColor.WHITE+" - Only Swords/Bows may be kept on you for mobility. All other items are not permitted.");
pl.sendMessage(ChatColor.WHITE+" - You may not cut through the track or leave the track at any point in time.");
pl.sendMessage(ChatColor.YELLOW+"PRIZES: ");
pl.sendMessage(ChatColor.WHITE+" - 1st Place: 3 Christmas Tokens");
pl.sendMessage(ChatColor.WHITE+" - 2nd/3rd Place: 2 Christmas Tokens");
pl.sendMessage(ChatColor.WHITE+" - Others: 1 Christmas Token");
pl.sendMessage("");
pl.sendMessage(ChatColor.WHITE+"Please proceed with emptying your inventories now and type\n"+ChatColor.GREEN+"/red "+ChatColor.WHITE+"when you are ready!");
}
}break;
case "FINALGIFTS":{
for (Player pl : Bukkit.getOnlinePlayers()) {
GenericFunctions.giveItem(pl, Christmas.getSantaDimensionalBox());
GenericFunctions.giveItem(pl, Christmas.getWinterSolsticeAugury());
}
}break;
case "AWARDTOKEN":{
if (args.length==1) {
for (Player pl : Bukkit.getOnlinePlayers()) {
GenericFunctions.giveItem(pl, Christmas.getChristmasEventToken());
pl.sendMessage("You've been awarded with "+ChatColor.LIGHT_PURPLE+"1"+ChatColor.RESET+" token!");
}
} else {
ItemStack item = Christmas.getChristmasEventToken();
if (args.length==3) {
item.setAmount(Integer.parseInt(args[2]));
}
Bukkit.getPlayer(args[1]).sendMessage("You've been awarded with "+ChatColor.LIGHT_PURPLE+item.getAmount()+ChatColor.RESET+" token"+((item.getAmount()==1)?"":"s")+"!");
GenericFunctions.giveItem(Bukkit.getPlayer(args[1]), item);
}
}break;
}
}
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
@ -1245,6 +1421,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (cmd.getName().equalsIgnoreCase("money")) {
Player p = (Player)sender;
sender.sendMessage("You are currently holding "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(p)));
sender.sendMessage(ChatColor.DARK_AQUA+" Your bank balance is "+ChatColor.GREEN+"$"+df.format(getPlayerBankMoney(p)));
return true;
} else
if (cmd.getName().equalsIgnoreCase("enchant_advanced")) {
@ -1524,6 +1701,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
break;
}
return true;
} else
if (cmd.getName().equalsIgnoreCase("red")) {
Player p = (Player)sender;
if (InventoryUtils.onlyHoldingRacingItems(p)) {
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.GREEN+"READY"+".");
} else {
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
p.sendMessage(" You need to get rid of "+ChatColor.RED+"ALL ITEMS"+ChatColor.RESET+" to play.");
}
return true;
}
} else {
//Implement console/admin version later (Let's you check any name's money.)
@ -1643,6 +1830,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//log("Called",2);
LOOT_TABLE_NEEDS_POPULATING=false;
Loot.DefineLootChests();
Christmas.SetupChristmas();
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -1717,7 +1905,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new ShutdownServerForUpdate(),5);
//Bukkit.getScheduler().scheduleSyncDelayedTask(this, new ShutdownServerForUpdate(),5);
//Find the player that is getting removed.
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
@ -2195,6 +2383,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Clicked with "+ ev.getHand().name(),5);
log("Clicked on: "+ev.getRightClicked().getName(),5);
Player p = ev.getPlayer();
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
if (ev.getRightClicked() instanceof LivingEntity &&
!(ev.getRightClicked() instanceof Player)) {
LivingEntity ent = (LivingEntity)ev.getRightClicked();
if (Christmas.isWinterSolsticeAugury(p.getEquipment().getItemInMainHand()) &&
pd.icewandused+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ICEWAND_COOLDOWN,ev.getPlayer())<getServerTickTime()) {
//Freeze the entity in the nearest grid-locked square and set the AI to false.
ent.setAI(false);
ent.teleport(ent.getLocation().getBlock().getLocation().add(0.5,0,0.5));
ent.setVelocity(new Vector(0,0,0));
for (int y=0;y<3;y++) {
temporary_ice_list.add(new TemporaryIce(20,ent.getLocation().getBlock().getRelative(0, y, 0),ent));
}
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_PORTAL_TRIGGER, 0.7f, 1.6f);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ICEWAND_COOLDOWN,p));
pd.icewandused=TwosideKeeper.getServerTickTime();
return;
}
}
if (ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.NAME_TAG && (ev.getRightClicked() instanceof LivingEntity)) {
//TwosideKeeper.log("Check this out.", 2);
LivingEntity m = (LivingEntity)ev.getRightClicked();
@ -2212,6 +2419,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
},1);
}
if (pd.lastrightclick+20<=getServerTickTime() && EntityUtils.ProperlyStoreEnderCrystal(ev.getRightClicked())) {
pd.lastrightclick=getServerTickTime();
ev.setCancelled(true);
return;
}
if ((ev.getRightClicked() instanceof LivingEntity) && (ev.getHand()==EquipmentSlot.OFF_HAND) &&
GenericFunctions.isArtifactEquip(ev.getPlayer().getEquipment().getItemInMainHand())) {
boolean bursted=false;
@ -2223,7 +2436,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN && ev.getRightClicked() instanceof LivingEntity) {
aPlugin.API.swingOffHand(p);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.weaponcharges>=10 && (pd.weaponcharges<30 || !p.isSneaking())) {
//Apply a stronger attack.
CustomDamage.ApplyDamage(0, p, (LivingEntity)ev.getRightClicked(), p.getInventory().getExtraContents()[0], "Power Swing");
@ -2244,12 +2456,47 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
if (p.getHealth()>p.getMaxHealth()*0.1 && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.COMET, 4)) {
if (ev.getRightClicked() instanceof Player) {
Player pl = (Player)ev.getRightClicked();
if (pl.getHealth()<pl.getMaxHealth()) {
p.setHealth(p.getHealth()-(p.getMaxHealth()*0.1));
aPlugin.API.sendEntityHurtAnimation(p);
pl.setHealth(Math.min(pl.getMaxHealth(), pl.getHealth()+(pl.getMaxHealth()*0.2)));
GenericFunctions.addIFrame(pl, 5);
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.0f);
SoundUtils.playGlobalSound(pl.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 1.0f, 1.6f);
return;
}
}
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.CUPID, 4)) {
if (ev.getRightClicked() instanceof Player) {
Player pl = (Player)ev.getRightClicked();
LinkPlayerToOtherPlayer(p,pl);
}
}
/*if (ev.getRightClicked() instanceof Monster) {
TwosideKeeperAPI.DealDamageToEntity(TwosideKeeperAPI.getFinalDamage(500.0, ev.getPlayer(), (Monster)ev.getRightClicked(), true, "ROFL"), (Monster)ev.getRightClicked(), ev.getPlayer());
}*/
///if (ev.getHand()==EquipmentSlot.OFF_HAND) {aPlugin.API.swingOffHand(ev.getPlayer());};
}
private void LinkPlayerToOtherPlayer(Player p, Player pl) {
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1.0f, 1.3f);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, ()->{SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 1.0f, 1.8f);},5);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
PlayerStructure pld = PlayerStructure.GetPlayerStructure(pl);
if (pd.linkplayer!=null) {
GlowAPI.setGlowing(pd.linkplayer, false, p);
}
if (pld.linkplayer!=null) {
GlowAPI.setGlowing(pld.linkplayer, false, pl);
}
pd.linkplayer=pl;
pld.linkplayer=p;
}
@SuppressWarnings("deprecation")
@EventHandler(priority=EventPriority.LOW,ignoreCancelled=true)
public void onPlayerSneak(PlayerToggleSneakEvent ev) {
@ -2273,6 +2520,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent ev) {
if (ev.getHand()==EquipmentSlot.OFF_HAND) {return;}
if (ev.isCancelled() && ev.getAction() == Action.RIGHT_CLICK_BLOCK) {
return;
} else {
@ -2585,41 +2833,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Artifact.isMalleableBase(ev.getPlayer().getEquipment().getItemInMainHand())) {
//Start a Malleable Base quest.
if (MalleableBaseQuest.getStatus(ev.getPlayer().getEquipment().getItemInMainHand())==QuestStatus.UNFORMED) {
ItemStack MalleableBase = ev.getPlayer().getEquipment().getItemInMainHand();
ev.getPlayer().getEquipment().setItemInMainHand(MalleableBaseQuest.startQuest(MalleableBase));
//Start the quest.
ev.getPlayer().sendMessage(ChatColor.YELLOW+"Malleable Base Forming Quest has begun!");
MalleableBaseQuest.announceQuestItem(this,ev.getPlayer(),MalleableBase);
if (ev.getAction()==Action.RIGHT_CLICK_AIR) {
StartMalleableBaseQuest(p);
}
} else {
//If quest is in progress, we will check if the item we need is in our inventory.
//0-8 are the hotbar slots.
for (int i=0;i<=8;i++) {
if (ev.getPlayer().getInventory().getItem(i)!=null) {
log("Malleable Base Quest: Comparing "+GenericFunctions.UserFriendlyMaterialName(ev.getPlayer().getInventory().getItem(i).getType())+" to "+MalleableBaseQuest.getItem(ev.getPlayer().getEquipment().getItemInMainHand()),2);
}
if (ev.getPlayer().getInventory().getItem(i)!=null && GenericFunctions.hasNoLore(ev.getPlayer().getInventory().getItem(i)) && !Artifact.isArtifact(ev.getPlayer().getInventory().getItem(i)) && GenericFunctions.UserFriendlyMaterialName(ev.getPlayer().getInventory().getItem(i).getType()).equalsIgnoreCase(MalleableBaseQuest.getItem(ev.getPlayer().getEquipment().getItemInMainHand()))) {
//This is good. Take one away from the player to continue the quest.
log(ChatColor.YELLOW+"Success! Next Item...",5);
ItemStack newitem = ev.getPlayer().getInventory().getItem(i);
newitem.setAmount(ev.getPlayer().getInventory().getItem(i).getAmount()-1);
ev.getPlayer().getInventory().setItem(i, newitem);
//Check if we have completed all the quests. Otherwise, generate the next quest.
ev.getPlayer().getEquipment().setItemInMainHand(MalleableBaseQuest.advanceQuestProgress(ev.getPlayer().getEquipment().getItemInMainHand()));
if (MalleableBaseQuest.getCurrentProgress(ev.getPlayer().getEquipment().getItemInMainHand())==30) {
//The quest is completed. Proceed to turn it into a Base.
ev.getPlayer().getEquipment().setItemInMainHand(MalleableBaseQuest.completeQuest(ev.getPlayer().getEquipment().getItemInMainHand()));
if (!Artifact.isMalleableBase(ev.getPlayer().getEquipment().getItemInMainHand())) {
ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"Quest Complete! "+ChatColor.GREEN+"You obtained "+ev.getPlayer().getEquipment().getItemInMainHand().getItemMeta().getDisplayName()+ChatColor.GREEN+"!");
} else {
ev.getPlayer().sendMessage(ChatColor.DARK_RED+"Quest Failed! "+ChatColor.RED+"You did not successfully mold the Malleable Base. You will have to re-activate it by right-clicking it again.");
}
} else {
//The quest is in progress. Announce the next item to the player.
MalleableBaseQuest.announceQuestItem(this,ev.getPlayer(),ev.getPlayer().getEquipment().getItemInMainHand());
}
break;
}
}
p.getInventory().setItemInMainHand(ProceedWithMalleableBaseQuest(p,p.getEquipment().getItemInMainHand()));
}
ev.setCancelled(true);
return;
@ -3122,11 +3342,72 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true);
return;
}
} else
if (s.getLine(1).equalsIgnoreCase(ChatColor.YELLOW+"TOKEN EXCHANGE")) {
if (Christmas.isChristmasEventToken(ev.getItem())) {
ItemStack item = ev.getItem();
item.setAmount(item.getAmount()-1);
if (item.getAmount()>0) {
p.getEquipment().setItemInMainHand(item);
} else {
p.getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
}
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 0.7f);
ItemStack prize = Christmas.GeneratePrize();
if (prize.getType()==Material.PAPER) {
int moneyamt = ((int)(Math.random()*10)*50)+50;
TwosideKeeperAPI.givePlayerMoney(p, moneyamt);
p.sendMessage("You exchange a Christmas Token for "+ChatColor.GREEN+"$"+moneyamt+ChatColor.RESET+"!");
} else {
GenericFunctions.giveItem(p, prize);
p.sendMessage("You exchange a Christmas Token for "+ChatColor.GREEN+GenericFunctions.UserFriendlyMaterialName(prize)+((prize.getAmount()>1)?" x"+prize.getAmount():"")+ChatColor.RESET+"!");
}
} else {
p.sendMessage("You must collect Christmas Tokens. Then return here to exchange them!");
}
}
}
}
}
}
public ItemStack ProceedWithMalleableBaseQuest(final Player p, ItemStack base) {
for (int i=0;i<=8;i++) {
if (p.getInventory().getItem(i)!=null) {
log("Malleable Base Quest: Comparing "+GenericFunctions.UserFriendlyMaterialName(p.getInventory().getItem(i).getType())+" to "+MalleableBaseQuest.getItem(base),2);
}
if (p.getInventory().getItem(i)!=null && GenericFunctions.hasNoLore(p.getInventory().getItem(i)) && !Artifact.isArtifact(p.getInventory().getItem(i)) && GenericFunctions.UserFriendlyMaterialName(p.getInventory().getItem(i).getType()).equalsIgnoreCase(MalleableBaseQuest.getItem(base))) {
//This is good. Take one away from the player to continue the quest.
log(ChatColor.YELLOW+"Success! Next Item...",5);
ItemStack newitem = p.getInventory().getItem(i);
newitem.setAmount(p.getInventory().getItem(i).getAmount()-1);
p.getInventory().setItem(i, newitem);
//Check if we have completed all the quests. Otherwise, generate the next quest.
ItemStack newbase = MalleableBaseQuest.advanceQuestProgress(base);
if (MalleableBaseQuest.getCurrentProgress(newbase)==30) {
//The quest is completed. Proceed to turn it into a Base.
newbase = MalleableBaseQuest.completeQuest(newbase);
if (!Artifact.isMalleableBase(newbase)) {
p.sendMessage(ChatColor.DARK_BLUE+"Quest Complete! "+ChatColor.GREEN+"You obtained "+newbase.getItemMeta().getDisplayName()+ChatColor.GREEN+"!");
} else {
p.sendMessage(ChatColor.DARK_RED+"Quest Failed! "+ChatColor.RED+"You did not successfully mold the Malleable Base. You will have to re-activate it by right-clicking it again.");
}
return newbase;
} else {
//The quest is in progress. Announce the next item to the player.
MalleableBaseQuest.announceQuestItem(this,p,newbase);
}
return newbase;
}
}
return base;
}
public void StartMalleableBaseQuest(final Player p) {
ItemStack MalleableBase = p.getEquipment().getItemInMainHand();
p.getEquipment().setItemInMainHand(MalleableBaseQuest.startQuest(MalleableBase));
//Start the quest.
p.sendMessage(ChatColor.YELLOW+"Malleable Base Forming Quest has begun!");
MalleableBaseQuest.announceQuestItem(this,p,MalleableBase);
}
public boolean performDeathMark(final Player player, boolean bursted) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); //Make sure it's off cooldown.
@ -3176,6 +3457,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideSpleefGames.PassEvent(ev);
Christmas.FillChristmasBox(ev.getPlayer(), ev.getItemInHand(), ev.getBlockPlaced());
if (!Christmas.ChristmasPlaceEvent(ev)) {
return;
}
if (ev.getBlockPlaced().getType()==Material.CHEST ||
ev.getBlockPlaced().getType()==Material.TRAPPED_CHEST) {
//Check for a chest or trapped chest around each side of the block.
@ -3355,7 +3641,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "Spider Ball": {
return Pronouns.ChoosePronoun(17);
}
case "Defender Tank": {
case "Defender Tank":
case "Cupid Set Tank": {
return "died trying to save teammates from imminent death...";
}
case "Damage Pool": {
@ -3419,6 +3706,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setLine(2, "Right-Click");
ev.setLine(3, "to use");
p.sendMessage("Successfully created a Cash Check Bank Sign.");
} else
if (line1.equalsIgnoreCase("-- bank --") &&
line2.equalsIgnoreCase("exchange")) {
//Turn it into a bank sign.
ev.setLine(0, ChatColor.AQUA+"-- BANK --");
ev.setLine(1, ChatColor.YELLOW+"TOKEN EXCHANGE");
ev.setLine(2, "Right-Click");
ev.setLine(3, "to use");
p.sendMessage("Successfully created a Christmas Token Exchange Sign.");
}
}
}
@ -3483,6 +3779,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onFallingBlock(EntityChangeBlockEvent ev) {
if (ev.getEntity() instanceof FallingBlock) {
@ -3861,6 +4158,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
setPlayerMaxHealth(player,player.getHealth()/player.getMaxHealth());
}
},1);
Christmas.RunPlayerItemHeldEvent(ev);
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -3941,6 +4239,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
pd.isViewingInventory=true;
log("Raw Slot Clicked: "+ev.getRawSlot(),5); //5,6,7,8 for gear slots.
log("Slot Type: "+ev.getSlotType().name(),5); //5,6,7,8 for gear slots.
if (!Christmas.runInventoryClickEvent(ev)) {
return;
}
if (ev.getSlotType()==SlotType.ARMOR || ev.getSlotType()==SlotType.QUICKBAR) {
log("Triggered.",5); //5,6,7,8 for gear slots.
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@ -4008,6 +4311,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
if (ev.getClick()==ClickType.RIGHT && Artifact.isMalleableBase(ev.getCurrentItem())) {
if (MalleableBaseQuest.getStatus(ev.getCurrentItem())==QuestStatus.UNFORMED) {
StartMalleableBaseQuest((Player)ev.getWhoClicked());
ev.setCancelled(true);
return;
} else {
ev.setCurrentItem(ProceedWithMalleableBaseQuest((Player)ev.getWhoClicked(),ev.getCurrentItem()));
ev.setCancelled(true);
return;
}
}
//Left-Click for an Arrow Quiver.
if (ev.getClick()==ClickType.LEFT && ev.getCursor()!=null && ev.getCursor().getAmount()>0 &&
GenericFunctions.isValidArrow(ev.getCursor()) &&
@ -4129,7 +4444,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
//Check for a Vacuum Cube. If this is a Vacuum Cube and we're trying to do something with the item, then don't allow it.
PerformVacuumCubeChecks(ev);
//PerformVacuumCubeChecks(ev);
//LEFT CLICK STUFF.
//WARNING! This only happens for ITEM CUBES! Do not add other items in here!
@ -4476,8 +4791,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onItemDespawn(BlockDispenseEvent ev) {
ev.setItem(ev.getItem());
public void onBlockDispense(BlockDispenseEvent ev) {
if (!Christmas.HandleDispenseEvent(ev)) {return;}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -4489,6 +4804,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (e!=null && e.isValid() && (e instanceof LivingEntity)) {
LivingEntity m = (LivingEntity)e;
updateMonsterFlags(m);
if (e instanceof Snowman) {
Snowman snowy = (Snowman)e;
if (e.getCustomName()!=null) {
if (!SnowmanHuntList.contains(ChatColor.stripColor(e.getCustomName()))) {
SnowmanHuntList.add(ChatColor.stripColor(e.getCustomName()));
}
}
}
}
}
}
@ -4692,7 +5015,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void updateHealthbarDamageEvent(EntityDamageEvent ev) {
if (ev.getEntity().isDead()) {ev.setCancelled(true); return;}
if (ev.getEntity() instanceof Player) {
Player p = (Player)ev.getEntity();
if (!p.isOnline()) {
ev.setCancelled(true);
return;
}
}
if (!Christmas.ChristmasDamageEvent(ev)) {return;}
if (EntityUtils.PreventEnderCrystalDestruction(ev.getEntity())) {
ev.setCancelled(true);
return;
}
if (ev.getCause()!=DamageCause.ENTITY_ATTACK &&
ev.getCause()!=DamageCause.PROJECTILE &&
ev.getCause()!=DamageCause.ENTITY_EXPLOSION &&
@ -4825,6 +5159,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void entityHitEvent(EntityDamageByEntityEvent ev) {
//DisplayPlayerDurability(ev.getEntity());
if (ev.getEntity() instanceof Player) {
Player p = (Player)ev.getEntity();
if (!p.isOnline()) {
ev.setCancelled(true);
return;
}
}
if (ev.getEntity().isDead()) {ev.setCancelled(true); return;}
if (ev.getEntity() instanceof LivingEntity) {
if (ev.getCause()==DamageCause.THORNS) { //Custom thorns damage formula.
@ -4844,6 +5186,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getDamager() instanceof Player) {
Player p = (Player)ev.getDamager();
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (Math.random()<=0.1) {
GenericFunctions.spawnXP(ev.getEntity().getLocation(), (int)(dmgdealt));
}
//Spill some XP out of the damaged target.
dmgdealt += pd.thorns_amt;
pd.thorns_amt=0;
}
@ -4921,6 +5267,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
((LivingEntity)ev.getEntity()).setHealth(Math.max(((LivingEntity)ev.getEntity()).getHealth() - (dmgdealt - 1d), 0.5));
}
}
//DisplayPlayerDurability(ev.getEntity());
} else {
ev.setCancelled(true);
}
@ -4930,6 +5277,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
private void DisplayPlayerDurability(Entity ent) {
if (ent instanceof Player) {
StringBuilder armorstring = new StringBuilder("Armor Durability: {");
Player p = (Player)ent;
boolean first=false;
for (ItemStack armor : GenericFunctions.getArmor(p)) {
if (armor!=null) {
armorstring.append((first)?"":","+armor.getDurability());
} else {
armorstring.append((first)?"":","+"X");
}
}
armorstring.append("}");
TwosideKeeper.log(armorstring.toString(), 1);
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onEliteTeleport(EntityPortalEvent ev) {
if (ev.getEntity() instanceof Monster && MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).equals(MonsterDifficulty.ELITE)) {
@ -5003,11 +5368,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void creeperExplodeEvent(ExplosionPrimeEvent ev) {
log("Explosion Entity Type: "+ev.getEntityType().toString(),5);
if (ev.getEntity() instanceof LivingEntity) {
LivingEntity le = (LivingEntity)ev.getEntity();
if (!le.hasAI()) {
ev.setCancelled(true);
return;
}
}
if (GenericFunctions.isSuppressed(ev.getEntity())) {
ev.setCancelled(true);
return;
}
if (EntityUtils.PreventEnderCrystalDestruction(ev.getEntity())) {
ev.setCancelled(true);
return;
}
if (ev.getEntity() instanceof Creeper) {
log("This is a creeper.",5);
final Creeper c = (Creeper)ev.getEntity();
@ -5195,6 +5573,27 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void monsterDeathEvent(final EntityDeathEvent ev) {
log("Has died.",5);
if (livingentitydata.containsKey(ev.getEntity().getUniqueId())){ev.setDroppedExp(ev.getDroppedExp()+5);}
if (ev.getEntity() instanceof Snowman) {
Snowman snowy = (Snowman)ev.getEntity();
if (snowy.getCustomName()!=null && ChatColor.stripColor(snowy.getCustomName()).equalsIgnoreCase(HuntingForSnowman)) {
if (livingentitydata.containsKey(snowy.getUniqueId())) {
LivingEntityStructure led = livingentitydata.get(snowy.getUniqueId());
if (led.GetTarget() instanceof Player) {
Player p = (Player)led.GetTarget();
aPlugin.API.discordSendRaw(p.getName()+" has claimed the bounty of **"+TwosideKeeper.HuntingForSnowman+"** earning 2 Tokens!");
Bukkit.broadcastMessage(ChatColor.YELLOW+p.getName()+ChatColor.RESET+" has claimed the bounty of "+ChatColor.BOLD+TwosideKeeper.HuntingForSnowman+ChatColor.RESET+" earning 2 Tokens!");
Bukkit.broadcastMessage(ChatColor.AQUA+" All other players have earned 1 Token!");
GenericFunctions.giveItem(p, Christmas.getChristmasEventToken());
for (Player pl : Bukkit.getOnlinePlayers()) {
GenericFunctions.giveItem(pl, Christmas.getChristmasEventToken());
}
}
}
}
if (snowy.getCustomName()!=null && SnowmanHuntList.contains(ChatColor.stripColor(snowy.getCustomName()))) {
SnowmanHuntList.remove(ChatColor.stripColor(snowy.getCustomName()));
}
}
if (ev.getEntity() instanceof Bat) {
//Drop an essence.
if (Math.random()<=0.3) {
@ -5442,6 +5841,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
dropmult = dropmult + (luckmult * 0.5) - (unluckmult * 0.5);
if (CHRISTMASEVENT_ACTIVATED) {dropmult += dropmult * 0.5;}
if (luckmult>0 || unluckmult>0) {
log("Modified luck rate is now "+dropmult,3);
}
@ -5613,6 +6014,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}}
,5);
if (Christmas.NoSweetCandyInInventory(p)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
@ -5629,6 +6031,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Last death: "+pd.lastdeath, 2);
}
},1);
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastdeath=getServerTickTime();
pd.hasDied=false;
@ -5694,13 +6097,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player p = ev.getPlayer();
TwosideKeeperAPI.addArtifactEXP(p.getEquipment().getItemInMainHand(), 100, p);
}*/
if (((Entity)ev.getPlayer()).isOnGround()) {
if (ev.getPlayer().isOnGround()) {
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
pd.velocity = new Vector(ev.getFrom().getX(),0,ev.getFrom().getZ()).distanceSquared(new Vector(ev.getTo().getX(),0,ev.getTo().getZ()));
if (pd.highwinder && pd.target!=null && !pd.target.isDead() && pd.lasthighwinderhit+15<getServerTickTime()) {
GenericFunctions.sendActionBarMessage(ev.getPlayer(), drawVelocityBar(pd.velocity,pd.highwinderdmg),true);
}
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(ev.getPlayer()), ev.getPlayer(), ItemSet.DANCER, 4)) {
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
int sign1 = (int) Math.signum(ev.getFrom().getX()-ev.getTo().getX());
int sign2 = (int) Math.signum(ev.getFrom().getZ()-ev.getTo().getZ());
if (sign1!=pd.lastxsign &&
sign2!=pd.lastzsign && !CustomDamage.isInIframe(ev.getPlayer())) {
SoundUtils.playLocalSound(ev.getPlayer(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 1.0f, 1.0f);
GenericFunctions.addIFrame(ev.getPlayer(), 20);
}
pd.lastxsign=sign1;
pd.lastzsign=sign2;
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -5728,10 +6143,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (p!=null) {
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactTool(p.getEquipment().getItemInMainHand())) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), 4, p);
}
if (GenericFunctions.isTool(p.getEquipment().getItemInMainHand())) {
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()) &&
@ -5908,6 +6319,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
}
if (ev.getBlock().getType()==Material.PACKED_ICE) {
for (TemporaryIce ti : temporary_ice_list) {
if (ev.getBlock().equals(ti.getBlock())) {
//Deal 200 Raw Damage.
if (ti.getTrappedEntity()!=null && (ti.getTrappedEntity() instanceof LivingEntity)) {
LivingEntity le = (LivingEntity)ti.getTrappedEntity();
CustomDamage.ApplyDamage(200, p, le, null, "Ice Shatter", CustomDamage.IGNORE_DAMAGE_TICK);
break;
}
}
}
}
}
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled = true)
@ -5962,6 +6387,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.giveItem(p, collect);
}
//TODO Add PlayerGainItemEvent.
/*@EventHandler(priority=EventPriority.HIGH,ignoreCancelled = true)
public void onItemGiven(PlayerGainItemEvent ev) {
//Try to put this item into any of our Filter/Vacuum Cubes.
ItemStack item = ev.getItem();
Player p = ev.get
if (item.getType().isBlock() && InventoryUtils.isCarryingVacuumCube(p)) {
}
}*/
@EventHandler(priority=EventPriority.HIGH,ignoreCancelled = true)
public void onItemPickup(PlayerPickupItemEvent ev) {
//Arrow quiver code goes here.
@ -6009,7 +6445,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
if (GenericFunctions.isValidArrow(ev.getItem().getItemStack())) {
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()));
ev.getItem().remove();
@ -7003,6 +7439,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
},20);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.linkplayer!=null && pd.linkplayer.isValid() && pd.lastlinkteleport+20<TwosideKeeper.getServerTickTime()) {
PlayerStructure pdl = PlayerStructure.GetPlayerStructure(pd.linkplayer);
pdl.lastlinkteleport=TwosideKeeper.getServerTickTime();
pd.lastlinkteleport=TwosideKeeper.getServerTickTime();
pd.linkplayer.teleport(ev.getTo());
}
}
public static String getWeatherIcon() {
@ -7626,6 +8069,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}*/
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.COMET, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.CUPID, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DONNER, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.RUDOLPH, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.OLIVE, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DANCER, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.PRANCER, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.VIXEN, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.BLITZEN, 3, 3);
/*hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+

@ -4,6 +4,7 @@ import java.io.File;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.Set;
@ -19,16 +20,19 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import org.inventivetalent.glow.GlowAPI.Color;
import aPlugin.DiscordMessageSender;
import net.minecraft.server.v1_9_R1.EnumParticle;
@ -42,6 +46,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
@ -190,6 +195,11 @@ final class runServerHeartbeat implements Runnable {
GenericFunctions.RemoveNewDebuffs(p);
if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)>0) {
double spdmult = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)/100d;
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
}
pd.highwinder=ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
if (pd.highwinder) {
pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
@ -236,13 +246,14 @@ final class runServerHeartbeat implements Runnable {
for (ItemStack equip : equips) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, equip) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
}
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
if (p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand())) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
}
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
}
@ -286,6 +297,28 @@ final class runServerHeartbeat implements Runnable {
pd.lifestealstacks=0;
}
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.LastSnowmanHunt+36000<TwosideKeeper.getServerTickTime() && TwosideKeeper.SnowmanHuntList.size()>7) {
TwosideKeeper.HuntingForSnowman = TwosideKeeper.SnowmanHuntList.get((int)(Math.random()*TwosideKeeper.SnowmanHuntList.size()));
aPlugin.API.discordSendRaw("The Hunt is on to kill the Snowman named **"+TwosideKeeper.HuntingForSnowman+"**!");
Bukkit.broadcastMessage("The Hunt is on to kill the Snowman named "+ChatColor.BOLD+TwosideKeeper.HuntingForSnowman+ChatColor.RESET+"!");
Bukkit.broadcastMessage(ChatColor.AQUA+" You will earn Holiday Tokens for successfully completing this mission!");
TwosideKeeper.LastSnowmanHunt=TwosideKeeper.getServerTickTime();
}
}
if (pd.linkplayer!=null && pd.linkplayer.isValid()) {
GlowAPI.setGlowing(pd.linkplayer, true, p);
if (pd.lastlinkteleport!=0 && pd.lastlinkteleport+12000<TwosideKeeper.getServerTickTime()) {
GlowAPI.setGlowing(pd.linkplayer, false, p);
pd.linkplayer=null;
}
} else
if (pd.linkplayer!=null && !pd.linkplayer.isValid()) {
GlowAPI.setGlowing(pd.linkplayer, false, p);
pd.linkplayer=null;
}
if (pd.damagepool>0 && pd.damagepooltime+20<=serverTickTime) {
double transferdmg = CustomDamage.getTransferDamage(p);
TwosideKeeper.log("Transfer Dmg is "+transferdmg+". Damage Pool: "+pd.damagepool, 5);
@ -324,6 +357,10 @@ final class runServerHeartbeat implements Runnable {
totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
}
if (pd.pctbonusregentime+100>TwosideKeeper.getServerTickTime()) {
totalregen += totalregen*pd.pctbonusregen;
}
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
@ -347,6 +384,32 @@ final class runServerHeartbeat implements Runnable {
}
}
double regenbuff = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.COMET);
if (regenbuff>0) {
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
PlayerStructure pld = PlayerStructure.GetPlayerStructure(pl);
pld.pctbonusregen=regenbuff/100d;
pld.pctbonusregentime=TwosideKeeper.getServerTickTime();
}
}
if (p.isSprinting() && p.getFoodLevel()<20
&& ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.DASHER, 4)) {
p.setFoodLevel(p.getFoodLevel()+1);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.RUDOLPH, 4)) {
if (!p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, p, true);
}
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
if (!pl.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, pl, true);
}
}
}
}
//TwosideKeeper.outputArmorDurability(p,">");
}
@ -390,7 +453,7 @@ final class runServerHeartbeat implements Runnable {
for (Entity ent : ents) {
if (ent instanceof Item && GenericFunctions.itemCanBeSuckedUp((Item)ent)) {
Item it = (Item)ent;
if (it.getPickupDelay()<it.getTicksLived()) {
if (it.getPickupDelay()==0) {
ItemStack[] remaining = InventoryUtils.insertItemsInFilterCube(p, it.getItemStack());
if (remaining.length==0) {
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 0.6f, SoundUtils.DetermineItemPitch(it.getItemStack()));
@ -439,7 +502,7 @@ final class runServerHeartbeat implements Runnable {
Math.abs(deltay)<0.25 &&
Math.abs(deltaz)<0.25 &&
InventoryUtils.hasFullInventory(p) &&
((Item)ent).getPickupDelay()<((Item)ent).getTicksLived()) {
((Item)ent).getPickupDelay()==0) {
//Collect this item.
if (((Item)ent).getItemStack().getType().isBlock()) {
ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, ((Item) ent).getItemStack());
@ -548,7 +611,7 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.log("Removed Monster Structure for "+id+".", 5);
} else {
AddEliteStructureIfOneDoesNotExist(ms);
if (ms.GetTarget()!=null && ms.GetTarget().isValid() && !ms.GetTarget().isDead()) {
if (ms.GetTarget()!=null && ms.GetTarget().isValid() && !ms.GetTarget().isDead() && ms.m.hasAI()) {
//Randomly move this monster a tiny bit in case they are stuck.
double xdir=((ms.m.getLocation().getX()>ms.GetTarget().getLocation().getX())?-0.25:0.25)+(Math.random()/8)-(Math.random()/8);
double zdir=((ms.m.getLocation().getZ()>ms.GetTarget().getLocation().getZ())?-0.25:0.25)+(Math.random()/8)-(Math.random()/8);

Loading…
Cancel
Save