First merge with basic master branch.

testdev
sigonasr2 9 years ago
parent 5fced804b5
commit 6b50cdd748
  1. 2
      src/plugin.yml
  2. 11
      src/sig/plugin/TwosideKeeper/ActionBarBuffUpdater.java
  3. 15
      src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
  4. 10
      src/sig/plugin/TwosideKeeper/ChargeZombie.java
  5. 116
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  6. 5
      src/sig/plugin/TwosideKeeper/EliteMonster.java
  7. 93
      src/sig/plugin/TwosideKeeper/Events/EntityDamagedEvent.java
  8. 2
      src/sig/plugin/TwosideKeeper/Events/PlayerDodgeEvent.java
  9. 2
      src/sig/plugin/TwosideKeeper/Events/PlayerLineDriveEvent.java
  10. 2
      src/sig/plugin/TwosideKeeper/Events/PlayerTumbleEvent.java
  11. 10
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  12. 82
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  13. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/RecipeLinker.java
  14. 1
      src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
  15. 129
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
  16. 40
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
  17. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
  18. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemCube.java
  19. 8
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  20. 21
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  21. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java
  22. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
  23. 36
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  24. 45
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java
  25. 32
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  26. 44
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShopItem.java
  27. 9
      src/sig/plugin/TwosideKeeper/ItemCubeWindow.java
  28. 4
      src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
  29. 21
      src/sig/plugin/TwosideKeeper/PartyManager.java
  30. 9
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  31. 738
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  32. 3
      src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
  33. 14
      src/sig/plugin/TwosideKeeper/WorldShopManager.java
  34. 11
      src/sig/plugin/TwosideKeeper/aPluginAPIWrapper.java
  35. 176
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.9.0a
version: 3.9.1
commands:
money:
description: Tells the player the amount of money they are holding.

@ -30,6 +30,11 @@ public class ActionBarBuffUpdater{
StringBuilder effectString=new StringBuilder("");
if (p instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)p);
if (p.getFireTicks()>=20) {
effectString.append(ChatColor.GOLD+"⚠");
effectString.append(AppendAmplifier((p.getFireTicks()/20)-1,false));
effectString.append(" ");
}
if (pd.lifestealstacks>4) {
effectString.append(ChatColor.AQUA+"❣");
effectString.append(AppendAmplifier(pd.lifestealstacks-1));
@ -98,8 +103,12 @@ public class ActionBarBuffUpdater{
}
private static String AppendAmplifier(int amplifier) {
return AppendAmplifier(amplifier,true);
}
private static String AppendAmplifier(int amplifier, boolean romanNumerals) {
StringBuilder amp = new StringBuilder(" ");
if (amplifier+1<=10) {
if (amplifier+1<=10 && romanNumerals) {
amp.append(ChatColor.GRAY+""+WorldShop.toRomanNumeral(amplifier+1));
} else {
amp.append(ChatColor.GRAY+""+(amplifier+1));

@ -36,6 +36,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class EliteZombie extends EliteMonster{
static int REFRESH_BUFFS = 20*30;
@ -136,7 +137,7 @@ public class EliteZombie extends EliteMonster{
lp.setReapplicationDelay(20);
lp.setBasePotionData(new PotionData(PotionType.POISON));
lp.setParticle(Particle.SPELL);
loc.getWorld().playSound(loc, Sound.ENTITY_HOSTILE_SPLASH, 1.0f, 1.0f);
SoundUtils.playGlobalSound(loc, Sound.ENTITY_HOSTILE_SPLASH, 1.0f, 1.0f);
}
private void adjustWillpower() {
@ -246,8 +247,8 @@ public class EliteZombie extends EliteMonster{
p.setVelocity(new Vector(0,-1,0));
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p);
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
p.playSound(p.getLocation(), Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
SoundUtils.playLocalSound(p, Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
}
}
@ -284,7 +285,7 @@ public class EliteZombie extends EliteMonster{
}
} else
if (l.getLocation().distanceSquared(m.getLocation())>100 && !leaping) {
l.getWorld().playSound(l.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 1.0f);
SoundUtils.playGlobalSound(l.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 1.0f);
chasing=true;
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
@ -526,10 +527,10 @@ public class EliteZombie extends EliteMonster{
b.setType(storedblocks.get(b));
}
aPlugin.API.sendSoundlessExplosion(target_leap_loc, 4);
b.getLocation().getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
SoundUtils.playGlobalSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
}
storedblocks.clear();
m.getLocation().getWorld().playSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.7f, 1.2f);
List<Player> nearbyplayers = GenericFunctions.getNearbyPlayers(target_leap_loc, radius);
for (int i=0;i<nearbyplayers.size();i++) {
GenericFunctions.removeNoDamageTick(nearbyplayers.get(i), m);
@ -562,7 +563,7 @@ public class EliteZombie extends EliteMonster{
if (ent instanceof Player) {
Player p = (Player)ent;
if (storingenergy_hit>0) {
p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,20*4,0,p);
TwosideKeeper.log("Got hit for "+storingenergy_hit+" damage!", 2);
GenericFunctions.removeNoDamageTick(p, m);

@ -6,6 +6,8 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Monster;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ChargeZombie {
Monster m;
@ -45,11 +47,11 @@ public class ChargeZombie {
brokeliquid=true;
if (m.getLocation().add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
m.getLocation().add(x,y,z).getBlock().setType(Material.OBSIDIAN);
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
}
}
if (!brokeliquid) {
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
SoundUtils.playGlobalSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
}
m.getLocation().add(x,y,z).getBlock().breakNaturally();
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1);
@ -93,11 +95,11 @@ public class ChargeZombie {
brokeliquid=true;
if (l.add(x,y,z).getBlock().getType()==Material.STATIONARY_LAVA) {
l.add(x,y,z).getBlock().setType(Material.OBSIDIAN);
l.getWorld().playSound(l.add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
SoundUtils.playGlobalSound(l.add(x,y,z),Sound.BLOCK_FIRE_EXTINGUISH, 1f, 1f);
}
}
if (!brokeliquid) {
l.getWorld().playSound(l.add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
SoundUtils.playGlobalSound(l.add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
}
l.add(x,y,z).getBlock().breakNaturally();
aPlugin.API.sendBlockBreakPacket(l.add(x,y,z).getBlock(), -1);

@ -42,6 +42,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
import sig.plugin.TwosideKeeper.Events.PlayerDodgeEvent;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
@ -51,6 +52,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class CustomDamage {
@ -99,7 +101,7 @@ public class CustomDamage {
* &nbsp;&nbsp;&nbsp;&nbsp;IGNOREDODGE - Ignores all Dodge and invulnerability checks.<br>
* &nbsp;&nbsp;&nbsp;&nbsp;TRUEDMG - Ignores all additional calculations/reductions, applying the damage directly.<br>
* <br><b>Combining flags example:</b> CRITICALSTRIKE|IGNOREDODGE (Force a critical strike AND ignore invulnerability check)
* @return Whether or not this attack actually was applied. Returns false if it was dodged, nodamageticks, etc.
* @return Whether or not this attack actually was applied. Returns false if it was dodged, nodamageticks, cancelled, etc.
*/
static public boolean ApplyDamage(double damage, Entity damager, LivingEntity target, ItemStack weapon, String reason, int flags) {
if (damage!=0.0 && weapon==null) {
@ -127,8 +129,15 @@ public class CustomDamage {
if (damager!=null) {
TwosideKeeper.logHealth(target,target.getHealth(),dmg,damager);
}
EntityDamagedEvent ev = new EntityDamagedEvent(target,damager,dmg,reason,flags);
Bukkit.getPluginManager().callEvent(ev);
if (!ev.isCancelled()) {
//TwosideKeeper.log("Inside of here.", 0);
DealDamageToEntity(dmg, damager, target, weapon, reason, flags);
addToLoggerTotal(damager,dmg);
} else {
return false;
}
return true;
} else {
return false;
@ -208,6 +217,7 @@ public class CustomDamage {
dmg += addMultiplierToPlayerLogger(damager,target,"STRENGTH Mult",dmg * calculateStrengthEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target));
dmg += addMultiplierToPlayerLogger(damager,target,"Airborne Mult",dmg * calculateAirborneAttackMultiplier(shooter));
double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags));
if (critdmg!=0.0) {crit=true;
aPlugin.API.critEntity(target, 15);}
@ -231,6 +241,25 @@ public class CustomDamage {
return dmg;
}
private static double calculateAirborneAttackMultiplier(LivingEntity shooter) {
if (shooter==null) {return 0.0;}
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (!p.isOnGround()) {
if (p.isSprinting()) {
return 0.2;
} else {
return -0.2;
}
}
} else {
if (!shooter.isOnGround()) {
return -0.2;
}
}
return 0.0;
}
private static double getDamageFromBarbarianSetBonus(LivingEntity target) {
if (target instanceof Player) {
Player p = (Player)target;
@ -282,12 +311,22 @@ public class CustomDamage {
dmg += addToPlayerLogger(damager,target,"Strike",GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE, weapon));
dmg += addToPlayerLogger(damager,target,"Highwinder",calculateHighwinderDamage(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));
dmg += addMultiplierToPlayerLogger(damager,target,"Belligerent Mult",dmg * calculateBeliggerentMultiplier(weapon,damager));
}
return dmg;
}
private static double calculatePartyBonusMultiplier(Entity damager) {
if (getDamagerEntity(damager) instanceof Player) {
Player p = (Player)getDamagerEntity(damager);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return pd.partybonus*0.1;
}
return 0.0;
}
public static void DealDamageToEntity(double damage, Entity damager, LivingEntity target, ItemStack weapon,
String reason) {
DealDamageToEntity(damage,damager,target,weapon,reason,0);
@ -381,6 +420,7 @@ public class CustomDamage {
}
increaseStrikerSpeed(p);
healDefenderSaturation(p);
damage=increaseDamageDealtByFireTicks(p,damage,reason);
reduceKnockback(p);
reduceSwiftAegisBuff(p);
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
@ -430,7 +470,7 @@ public class CustomDamage {
TwosideKeeper.log("In here", 5);
Location hitloc = aPlugin.API.getArrowHitLocation(target, a);
GenericFunctions.DealExplosionDamageToEntities(hitloc, getBaseWeaponDamage(weapon,damager,target)+60, 6);
p.playSound(hitloc, Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.5f, 1.0f);
SoundUtils.playGlobalSound(hitloc, Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.5f, 1.0f);
aPlugin.API.sendSoundlessExplosion(hitloc, 2);
}
if (a.hasMetadata("TRAP_ARR")) {
@ -662,7 +702,7 @@ public class CustomDamage {
}
if (p.isSneaking() && pd.weaponcharges>=30 && (reason==null || !reason.equalsIgnoreCase("forceful strike")) &&
weapon.equals(p.getEquipment().getItemInMainHand())) {
p.playSound(p.getLocation(), Sound.BLOCK_WOOD_BUTTON_CLICK_ON, 3.0f, 0.6f);
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_WOOD_BUTTON_CLICK_ON, 3.0f, 0.6f);
//Apply 10 strikes across the field.
dmg*=2;
GenericFunctions.addSuppressionTime(target, 20*3);
@ -671,7 +711,7 @@ public class CustomDamage {
Location attackloc = p.getLocation().clone();
for (int i=0;i<10;i++) {
attackloc = attackloc.add(xspd,0,zspd);
p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.1f, 1.4f);
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.1f, 1.4f);
aPlugin.API.sendSoundlessExplosion(attackloc, 0.6f);
GenericFunctions.DealDamageToNearbyMobs(attackloc, dmg, 1, true, 0.6, p, weapon, false, "Forceful Strike");
}
@ -906,7 +946,7 @@ public class CustomDamage {
LivingEntity mon = (LivingEntity)finallist.get(i);
//double finaldmg = CalculateDamageReduction(GenericFunctions.getAbilityValue(ArtifactAbility.ERUPTION, p.getEquipment().getItemInMainHand()),mon,null);
//GenericFunctions.DealDamageToMob(finaldmg, mon, p, p.getEquipment().getItemInMainHand());
TwosideKeeperAPI.removeNoDamageTick(p, (Monster)target);
TwosideKeeperAPI.removeNoDamageTick(p, (LivingEntity)mon);
CustomDamage.ApplyDamage(GenericFunctions.getAbilityValue(ArtifactAbility.ERUPTION, weapon),
p,mon,null,"Eruption",CustomDamage.NONE);
mon.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION,20,15));
@ -923,12 +963,12 @@ public class CustomDamage {
//b.breakNaturally();
b.setType(Material.AIR);
aPlugin.API.sendSoundlessExplosion(b.getLocation(), 1);
p.playSound(mon.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 1.0f);
SoundUtils.playGlobalSound(mon.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 1.0f);
}
}
}
}
p.playSound(p.getLocation(), Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);
@ -1074,10 +1114,10 @@ public class CustomDamage {
public static void increaseArtifactArmorXP(Player p, int exp) {
if (p.getHealth()>0) {
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getArmorContents()[i]) &&
GenericFunctions.isArtifactArmor(p.getEquipment().getArmorContents()[i])) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getArmorContents()[i], exp, p);
for (ItemStack armor : GenericFunctions.getArmor(p)) {
if (GenericFunctions.isArtifactEquip(armor) &&
GenericFunctions.isArtifactArmor(armor)) {
AwakenedArtifact.addPotentialEXP(armor, exp, p);
}
}
}
@ -1139,14 +1179,14 @@ public class CustomDamage {
if (CanResistExplosionsWithExperienceSet(damager, target, reason)) {
aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 2, 2),0));
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f);
GenericFunctions.updateNoDamageTickMap(target, damager);
return true;
}
if (CanResistDotsWithExperienceSet(damager, target, reason)) {
aPlugin.API.setTotalExperience((Player)target, (int)Math.max(aPlugin.API.getTotalExperience((Player)target)-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(target), (Player)target, ItemSet.ALUSTINE, 3, 3),0));
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
SoundUtils.playGlobalSound(((Player)target).getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
((Player)target).playSound(((Player)target).getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 0.5f);
GenericFunctions.updateNoDamageTickMap(target, damager);
return true;
@ -1167,7 +1207,11 @@ public class CustomDamage {
if (ev.isCancelled()) {
return false;
}
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
if (!p.isBlocking()) {
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
} else {
SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.2f, 3.0f);
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.fulldodge=false;
calculateGracefulDodgeTicks(target);
@ -1203,7 +1247,7 @@ public class CustomDamage {
if (p.hasPotionEffect(PotionEffectType.WEAKNESS)) {
int weaknesslv = GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p);
if (weaknesslv>=9) {
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.3f, 3.6f);
SoundUtils.playLocalSound(p, Sound.BLOCK_ANVIL_LAND, 0.3f, 3.6f);
return false;
}
}
@ -1334,7 +1378,7 @@ public class CustomDamage {
dodgechance+=0.2;
}
if (PlayerMode.isRanger(p)) {
dodgechance+=0.5;
dodgechance+=0.4;
}
if (dodgechance>0.95) {
@ -1410,13 +1454,13 @@ public class CustomDamage {
case CHAINMAIL_LEGGINGS:
case CHAINMAIL_CHESTPLATE:
case CHAINMAIL_HELMET: {
dmgreduction+=3*((isBlockArmor)?2:1);
dmgreduction+=6*((isBlockArmor)?2:1);
}break;
case IRON_BOOTS:
case IRON_LEGGINGS:
case IRON_CHESTPLATE:
case IRON_HELMET: {
dmgreduction+=5*((isBlockArmor)?2:1);
dmgreduction+=7*((isBlockArmor)?2:1);
}break;
case GOLD_BOOTS:
case GOLD_LEGGINGS:
@ -1827,9 +1871,9 @@ public class CustomDamage {
TwosideKeeper.log("Distance: "+(arrowLoc.distanceSquared(monsterHead)), 5);
boolean isheadshot=false;
double headshotvaly=0.22/TwosideKeeper.HEADSHOT_ACC;
TwosideKeeper.log("In here.", 2);
TwosideKeeper.log("In here.", 5);
if (proj.getShooter() instanceof Player) {
TwosideKeeper.log("We somehow made it to here???", 2);
TwosideKeeper.log("We somehow made it to here???", 5);
Player p = (Player)proj.getShooter();
if (PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) {
@ -1880,7 +1924,7 @@ public class CustomDamage {
}
}}
,100);
p.playSound(p.getLocation(), Sound.ENTITY_LIGHTNING_IMPACT, 0.1f, 0.24f);
SoundUtils.playLocalSound(p, Sound.ENTITY_LIGHTNING_IMPACT, 0.1f, 0.24f);
} else {
mult+=2.0;
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
@ -1895,7 +1939,7 @@ public class CustomDamage {
if (pe.getType().equals(PotionEffectType.BLINDNESS)) {
int lv = pe.getAmplifier();
TwosideKeeper.log("New BLINDNESS level: "+lv,5);
p.playSound(p.getLocation(), Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f+((lv+1)*0.5f));
SoundUtils.playLocalSound(p, Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f+((lv+1)*0.5f));
m.removePotionEffect(PotionEffectType.BLINDNESS);
m.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,400,lv+1),true);
break;
@ -1904,7 +1948,7 @@ public class CustomDamage {
} else {
m.removePotionEffect(PotionEffectType.BLINDNESS);
m.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,400,0));
p.playSound(p.getLocation(), Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f);
SoundUtils.playLocalSound(p, Sound.ENTITY_RABBIT_ATTACK, 0.1f, 0.1f);
}
}
}
@ -1955,7 +1999,7 @@ public class CustomDamage {
}
if (shooter instanceof Player && criticalstrike) {
Player p = (Player)shooter;
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_PLAYER_ATTACK_CRIT, 1.0f, 1.0f);
}
return criticalstrike?(calculateCriticalStrikeMultiplier(shooter,weapon)):0.0;
}
@ -2503,7 +2547,7 @@ public class CustomDamage {
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_TELEPORT, 1f, 3.65f);
SoundUtils.playLocalSound(p, Sound.ENTITY_SHULKER_TELEPORT, 1f, 3.65f);
}
}
return true;
@ -2564,4 +2608,26 @@ public class CustomDamage {
public static int GetDamageReductionFromDawntrackerPieces(Player p) {
return ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DAWNTRACKER)/3;
}
private static double increaseDamageDealtByFireTicks(Player p, double damage, String reason) {
if (reason!=null && (reason.equalsIgnoreCase("LAVA") || reason.equalsIgnoreCase("FIRE"))) {
p.setFireTicks(p.getFireTicks()+80);
TwosideKeeper.log("Increasing Fire Ticks to "+p.getFireTicks(), 4);
}
if (reason!=null && reason.equalsIgnoreCase("FIRE_TICK")) {
TwosideKeeper.log("Burning by fire. Fire Ticks remaining: "+p.getFireTicks(), 4);
}
return damage+(Math.max(p.getFireTicks()/(80*(((TotalFireProtectionLevel(p))/10)+1)),0));
}
private static int TotalFireProtectionLevel(Player p) {
ItemStack[] items = GenericFunctions.getArmor(p);
int fireprot_lv = 0;
for (ItemStack item : items) {
if (item!=null && item.containsEnchantment(Enchantment.PROTECTION_FIRE)) {
fireprot_lv += item.getEnchantmentLevel(Enchantment.PROTECTION_FIRE);
}
}
return fireprot_lv;
}
}

@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class EliteMonster {
protected static float DEFAULT_MOVE_SPD = 0.3f;
@ -203,8 +204,8 @@ public class EliteMonster {
p.setVelocity(new Vector(0,-1,0));
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION,p);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,(int)(20*2.25),0,p);
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
p.playSound(p.getLocation(), Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_ANVIL_FALL, 0.4f, 0.8f);
SoundUtils.playLocalSound(p, Sound.ENTITY_MAGMACUBE_SQUISH, 1.0f, 1.0f);
}
}

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

@ -12,7 +12,7 @@ public class PlayerDodgeEvent extends Event implements Cancellable{
private Entity damager;
private String reason;
private int flags;
private boolean cancelled;
private boolean cancelled=false;
private static final HandlerList handlers = new HandlerList();
public PlayerDodgeEvent(Player p, Entity damager, String reason, int flags) {

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

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

@ -114,12 +114,12 @@ public enum ArtifactAbility {
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,10,UpgradePath.ALL),
/*GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100},
new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),*/
REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),
REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL),
PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.25,1.5,1.75,2.0,2.25,2.5,2.75,3.0,3.25,3.50,3.75,4.0,4.25,4.5},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1,UpgradePath.ALL),
EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1,UpgradePath.ALL),
EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL),
//Bad stuff
REDUCEDMG("Weakness","[VAL]% Decrease in Base Damage.",new double[]{8,8,8,8,8,8,8,8,8,8},

@ -80,6 +80,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class GenericFunctions {
@ -120,7 +121,7 @@ public class GenericFunctions {
p.sendMessage(ChatColor.GOLD+"WARNING!"+ChatColor.GREEN+ " Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.WHITE+" is going to break soon! You should let it recharge by waiting 24 hours!");
}
if (p!=null) {
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
}
return breakObscureHardenedItem(item);
} else {
@ -140,14 +141,14 @@ public class GenericFunctions {
break_count--;
if (p!=null && break_count==0) {
p.sendMessage(ChatColor.GOLD+"WARNING!"+ChatColor.GREEN+ " Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.WHITE+" is going to break soon!");
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
}
return item;
//By setting the amount to 1, you refresh the item in the player's inventory.
} else {
//This item is technically destroyed.
if (p!=null) {
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
}
if (isArtifactEquip(item)) {
//We can turn it into dust!
@ -2757,12 +2758,12 @@ public class GenericFunctions {
if (!ev.isCancelled()) {
pd.last_dodge=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
p.playSound(p.getLocation(), Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f);
int dodgeduration = 20;
if (GenericFunctions.HasFullRangerSet(p)) {
dodgeduration=60;
dodgeduration = 30;
}
if (p.isSneaking()) { //Do a backwards dodge + jump.
@ -3010,7 +3011,7 @@ public class GenericFunctions {
public static void PerformRejuvenate(Player player) {
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(player.getUniqueId());
if (pd.last_rejuvenate+GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player)<=TwosideKeeper.getServerTickTime()) {
player.playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
SoundUtils.playGlobalSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
addIFrame(player,40);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.REGENERATION,200,9,player,true);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player));
@ -3149,6 +3150,10 @@ public class GenericFunctions {
public static void updateSetItemsInInventory(Inventory inv) {
TwosideKeeper.log("Inventory is size "+inv.getSize(),5);
if (inv.getHolder() instanceof Player) {
Player p = (Player)inv.getHolder();
for (ItemStack armor : GenericFunctions.getEquipment(p)) {GenericFunctions.UpdateArtifactItemType(armor);}
}
for (ItemStack it : inv.getContents()) {
if (it!=null) {
TwosideKeeper.log("Checking "+it.toString(), 5);
@ -3204,7 +3209,7 @@ public class GenericFunctions {
public static void UpdateArtifactItemType(ItemStack item) {
if (isArtifactArmor(item) &&
item.getType()!=Material.SULPHUR) {
double durabilityratio = item.getDurability()/item.getType().getMaxDurability();
double durabilityratio = (double)item.getDurability()/item.getType().getMaxDurability();
item.setType(Material.valueOf("LEATHER_"+item.getType().name().split("_")[1]));
item.setDurability((short)(durabilityratio*item.getType().getMaxDurability()));
UpdateDisplayedEnchantments(item);
@ -3454,7 +3459,7 @@ public class GenericFunctions {
}
}
p.getInventory().setItem(i, new ItemStack(Material.AIR));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
p.sendMessage(ChatColor.GOLD+""+ChatColor.BOLD+"Unlucky! "+ChatColor.RESET+ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+((item.hasItemMeta() && item.getItemMeta().hasDisplayName())?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))+ChatColor.DARK_RED+" has broken!");
}
@ -3472,7 +3477,7 @@ public class GenericFunctions {
private static void RevivePlayer(Player p, double healdmg) {
p.setHealth(healdmg);
p.playSound(p.getLocation(), Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f);
SoundUtils.playLocalSound(p, Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f);
for (PotionEffect eff : p.getActivePotionEffects()) {
if (isBadEffect(eff.getType())) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,
@ -3541,28 +3546,28 @@ public class GenericFunctions {
case LEATHER_CHESTPLATE:
case LEATHER_LEGGINGS:
case LEATHER_BOOTS:{
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_LEATHER, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_LEATHER, 1.0f, 1.0f);
}break;
case IRON_HELMET:
case IRON_CHESTPLATE:
case IRON_LEGGINGS:
case IRON_BOOTS:{
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_IRON, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_IRON, 1.0f, 1.0f);
}break;
case GOLD_HELMET:
case GOLD_CHESTPLATE:
case GOLD_LEGGINGS:
case GOLD_BOOTS:{
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_GOLD, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_GOLD, 1.0f, 1.0f);
}break;
case DIAMOND_HELMET:
case DIAMOND_CHESTPLATE:
case DIAMOND_LEGGINGS:
case DIAMOND_BOOTS:{
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_DIAMOND, 1.0f, 1.0f);
}break;
default:{
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_GENERIC, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_ARMOR_EQUIP_GENERIC, 1.0f, 1.0f);
}
}
}
@ -3772,7 +3777,10 @@ public class GenericFunctions {
private static boolean isNaturalBlock(Block b) {
if (b.getType()==Material.DIRT ||
b.getType()==Material.SOIL ||
b.getType()==Material.MYCEL ||
b.getType()==Material.SAND ||
b.getType()==Material.SANDSTONE ||
b.getType()==Material.AIR ||
b.getType()==Material.CLAY ||
b.getType()==Material.GRASS ||
@ -3791,6 +3799,8 @@ public class GenericFunctions {
b.getType()==Material.STATIONARY_WATER ||*/
b.getType()==Material.SNOW ||
b.getType()==Material.ICE ||
b.getType()==Material.LONG_GRASS ||
b.getType()==Material.YELLOW_FLOWER ||
b.getType()==Material.PACKED_ICE) {
return true;
}
@ -4111,13 +4121,13 @@ public class GenericFunctions {
public static void applyStealth(Player p, boolean blindness_effect) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
if (blindness_effect) {GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 20*2, 111, p);}
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
}
public static void removeStealth(Player p) {
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.INVISIBILITY, p);
GenericFunctions.addIFrame(p, 10);
p.playSound(p.getLocation(), Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.0f);
}
public static boolean hasStealth(Player p) {
@ -4147,7 +4157,7 @@ public class GenericFunctions {
aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p));
pd.last_strikerspell=TwosideKeeper.getServerTickTime();
}
p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(p, weaponused, (weaponused.getType().getMaxDurability()/10)+7);
final Player p1 = p;
@ -4165,7 +4175,7 @@ public class GenericFunctions {
public void run() {
p.setVelocity(facing1.multiply(8));
addIFrame(p, 10);
p.playSound(p.getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f);
final Location newpos=new Location(p.getWorld(),xpos,ypos,zpos);
double dmgdealt=CustomDamage.getBaseWeaponDamage(weaponused, p, null);
//List<Monster> monsters = getNearbyMobs(newpos, 2);
@ -4179,7 +4189,7 @@ public class GenericFunctions {
}
DealDamageToNearbyMobs(newpos, dmgdealt, 2, true, 0.8d, p, weaponused, true);
//DecimalFormat df = new DecimalFormat("0.00");
p.playSound(p.getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
int range=8;
for (int i=0;i<range;i++) {
final double xpos2=p.getLocation().getX();
@ -4192,7 +4202,7 @@ public class GenericFunctions {
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() {
DealDamageToNearbyMobs(newpos2, dmgdealt, 2, true, 0.4d, p, weaponused, true);
p1.playSound(newpos2, Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f);
SoundUtils.playGlobalSound(newpos2, Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f);
}
},1);
}
@ -4243,7 +4253,7 @@ public class GenericFunctions {
}
i++;
}
player.playSound(teleloc, Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f);
SoundUtils.playGlobalSound(teleloc, Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f);
teleloc.setPitch((float)pitch);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
@ -4619,7 +4629,7 @@ public class GenericFunctions {
}
if (totalpoisonstacks>0) {
pd.last_siphon=TwosideKeeper.getServerTickTime();
p.playSound(p.getLocation(), Sound.BLOCK_FENCE_GATE_OPEN, 1.0f, 0.4f);
SoundUtils.playLocalSound(p, Sound.BLOCK_FENCE_GATE_OPEN, 1.0f, 0.4f);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.SIPHON_COOLDOWN,p));
for (LivingEntity ent : poisonlist) {
//Refresh poison stacks if necessary.
@ -4650,5 +4660,33 @@ public class GenericFunctions {
}
}
public static void PopulatePlayerBlockList(Player p, int width, int length, int up, int down, boolean includeCurrentYLayer) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastStandingLoc==null ||
(
!p.getLocation().getWorld().equals(pd.lastStandingLoc.getWorld()) ||
p.getLocation().getX()!=pd.lastStandingLoc.getX() ||
p.getLocation().getZ()!=pd.lastStandingLoc.getZ()
)
) {
pd.lastStandingLoc=new Location(p.getLocation().getWorld(),p.getLocation().getX(),p.getLocation().getY(),p.getLocation().getZ());
pd.blockscanlist.clear();
for (int x=-width;x<=width;x++) {
for (int z=-length;z<=length;z++) {
for (int y=-down;y<=up;y++) {
//pd.blockscanlist.add(pd.lastStandingLoc.add(x,y,z).getBlock());
Block b = pd.lastStandingLoc.add(x,y,z).getBlock();
pd.blockscanlist.put(b.getType(), b);
TwosideKeeper.log("("+x+","+y+","+z+")"+"Added "+b.getType()+" to block list for player "+p.getName(), 0);
}
}
}
}
}
public static HashMap<Material,Block> GetPlayerBlockList(Player p) {
PopulatePlayerBlockList(p,15,15,2,5,false);
return PlayerStructure.GetPlayerStructure(p).blockscanlist;
}
}

@ -35,7 +35,7 @@ public enum RecipeLinker {
CustomItem.EnderItemCube(2),
CustomItem.EnderItemCube(),new ItemStack(Material.NETHER_STAR)
}),
aq(RecipeCategory.MISC_ITEMS,ChatColor.RED,"Arrow Quiver",new ItemStack[]{
aq(RecipeCategory.CONTAINERS,ChatColor.RED,"Arrow Quiver",new ItemStack[]{
CustomItem.ArrowQuiver(),
null,new ItemStack(Material.LEATHER),new ItemStack(Material.EMERALD_BLOCK),
new ItemStack(Material.LEATHER),new ItemStack(Material.SPECTRAL_ARROW),new ItemStack(Material.LEATHER),

@ -368,7 +368,6 @@ public class CustomItem {
ArrowQuiver.setIngredient('l', Material.LEATHER);
ArrowQuiver.setIngredient('e', Material.EMERALD_BLOCK);
return ArrowQuiver;
}

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

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

@ -25,10 +25,10 @@ public class EliteMonsterLocationFinder implements Runnable{
public void run() {
TwosideKeeper.ELITE_LOCATION = GenericFunctions.defineNewEliteLocation();
if (TwosideKeeper.ELITE_LOCATION==null) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 10l);
if (p!=null) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if ((pd.lastcompassnotification+(20*10))<TwosideKeeper.getServerTickTime()) {
if ((pd.lastcompassnotification+(20*20))<TwosideKeeper.getServerTickTime()) {
pd.lastcompassnotification=TwosideKeeper.getServerTickTime();
p.sendMessage("The "+name+ChatColor.WHITE+" is still searching...");
} else {

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ItemCube {
public static boolean isSomeoneViewingItemCube(int id, Player checker) {
for (Player p : Bukkit.getOnlinePlayers()) {
@ -33,7 +35,7 @@ public class ItemCube {
return null; //Didn't find anything.
}
public static void displayErrorMessage(Player p) {
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 0.6f, 4.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_NOTE_PLING, 0.6f, 4.0f);
p.sendMessage("Someone is currently using this Item Cube! Please wait for them to finish.");
}

@ -338,7 +338,7 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" 1 -> 1.5 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
@ -356,7 +356,7 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" 1 -> 1.5 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
@ -370,7 +370,7 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" 1 -> 1.5 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
@ -385,7 +385,7 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" 1 -> 1.5 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");

@ -33,12 +33,13 @@ public class Loot {
public static void DefineLootChests() {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.STONE_SWORD,8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),11));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.COAL,101));
//aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.AIR,101));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.COAL,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,1,17));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,1,18));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,1,17));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_PEARL,1,8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,19));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,18,"[Normal] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,MonsterDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,19,"[Normal] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,MonsterDifficulty.NORMAL));
@ -543,54 +544,38 @@ public class Loot {
case JAMDAK:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Jamdak Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.5 && tierbonus<2) {
tierbonus+=(custom)?0:2;
}
}break;
case DARNYS:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.5 && tierbonus<1) {
tierbonus+=(custom)?0:1;
}
}break;
case ALIKAHN:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Alikahn Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (Math.random()<=0.1 && tierbonus<1) {
tierbonus+=(custom)?0:1;
}
}break;
case LORASAADI:{
if (item.getType().toString().contains("SWORD")) {
item.setType(Material.BOW);
tierbonus/=(custom)?1:2;
} else
if (!item.getType().toString().contains("LEATHER")) {
allowed = false;
}
set_name = prefix+"Lorasaadi Ranger "+GenericFunctions.UserFriendlyMaterialName(item.getType());
if (tierbonus>0 && Math.random()<=0.5) {
tierbonus=(custom)?tierbonus:0;
}
}break;
case GLADOMAIN:{
//item.setType(Material.SKULL_ITEM); else

@ -54,7 +54,7 @@ public enum MonsterDifficulty {
Player p = (Player)CustomDamage.getDamagerEntity(damager);
for (int i=0;i<dropmult;i++) {
TwosideKeeper.Loot_Logger.AddLootRoll();
TwosideKeeper.log("Attempting a roll...", 2);
TwosideKeeper.log("Attempting a roll...", TwosideKeeper.LOOT_DEBUG);
ItemStack goodie = null;
if (Math.random()<=0.1 || isBoss) {
TwosideKeeper.log("Inside!", 5);
@ -79,7 +79,9 @@ public enum MonsterDifficulty {
}break;
default:{
if (Math.random()<=0.4) {
goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop(p);
}
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, p);
}
}

@ -25,7 +25,7 @@ public enum PlayerMode {
+ ChatColor.WHITE+"->Players are identified as 'Rangers' when they carry a bow or a quiver in one of their hands. Off-hand items are permitted, except for a shield. Can only be wearing leather armor, or no armor.\n"
+ ChatColor.GRAY+"->Left-clicking mobs will cause them to be knocked back extremely far, basically in headshot range, when walls permit.\n"
+ ChatColor.WHITE+"->Base Arrow Damage increases from x2->x4.\n"
+ ChatColor.GRAY+"->You can dodge 50% of all incoming attacks from any damage sources.\n"
+ ChatColor.GRAY+"->You can dodge 40% of all incoming attacks from any damage sources.\n"
+ ChatColor.WHITE+"You have immunity to all Thorns damage.\n"
+ ChatColor.GRAY+"Shift-Right Click to change Bow Modes.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Close Range Mode (Default):"+ChatColor.RESET+ChatColor.WHITE+" \n"
@ -60,7 +60,6 @@ public enum PlayerMode {
+ ChatColor.GRAY+"->Barbarians swing their off-hand by right-clicking.\n"
+ ChatColor.WHITE+"->Barbarians gain 2 HP (1 Heart) per 1% of Damage reduction.\n"
+ ChatColor.GRAY+"->When Barbarians are hit, they take damage as if they had 0% Damage reduction.\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n"
+ ChatColor.GRAY+"->Barbarians deal 20% more damage for every 20% of an enemy's missing health.\n"
+ ChatColor.WHITE+"->Barbarians gain Bonus Lifesteal stacks as they hit enemies. Each stack increases Lifesteal by 1%, up to a cap of 100% extra Lifesteal. The stacks refresh every hit, but wear off after 5 seconds.\n"
+ ChatColor.GRAY+"->Barbarians do not instantly take full damage when hit. Instead, the HP is stored in a 'Damage Pool' and distributed every second.\n"

@ -0,0 +1,36 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class ItemUtils {
public static void addLore(ItemStack item, String string) {
ItemMeta m = item.getItemMeta();
List<String> lore = new ArrayList<String>();
if (m.hasLore()) {
lore.addAll(m.getLore());
}
lore.add(string);
m.setLore(lore);
item.setItemMeta(m);
}
public static void hideEnchantments(ItemStack item) {
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
}
public static void showEnchantments(ItemStack item) {
ItemMeta m = item.getItemMeta();
m.removeItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
}
}

@ -0,0 +1,45 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class SoundUtils {
/**
* Plays a sound to everyone in the world. Nearby players should be able to hear it.
*/
public static void playGlobalSound(Location loc, Sound sound, float vol, float pitch) {
loc.getWorld().playSound(loc, sound, vol, pitch);
}
/**
* Same as playGlobalSound. Just done for every single player locally.
*/
public static void playIndividualGlobalSound(Location loc, Sound sound, float vol, float pitch) {
for (Player p : Bukkit.getOnlinePlayers()) {
p.playSound(loc, sound, vol, pitch);
}
}
/**
* Plays a sound at the player's location, as if they were hearing a regular sound in the client.
*/
public static void playLocalSound(Player p, Sound sound, float vol, float pitch) {
SoundUtils.playLocalSound(p,p.getLocation(), sound, vol, pitch);
}
/**
* Plays a sound at the specified location for a single player, as if they were hearing a regular sound in the client.
*/
public static void playLocalSound(Player p, Location loc, Sound sound, float vol, float pitch) {
p.playSound(loc, sound, vol, pitch);
}
/**
* Plays a sound at the player's location for every player, as if they were hearing a regular sound in the client. Useful for notifications/pings.
*/
public static void playLocalGlobalSound(Sound sound, float vol, float pitch) {
for (Player p : Bukkit.getOnlinePlayers()) {
SoundUtils.playLocalSound(p, sound, vol, pitch);
}
}
}

@ -7,6 +7,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -25,6 +26,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.BookMeta;
@ -41,6 +43,7 @@ import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.WorldShopManager;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class WorldShop {
ItemStack item;
@ -649,6 +652,15 @@ public class WorldShop {
}
}
public static boolean isWorldShopSign(Block b) {
if (b!=null && (b.getType()==Material.SIGN || b.getType()==Material.WALL_SIGN || b.getType()==Material.SIGN_POST) && b.getState() instanceof Sign) {
Sign s = (Sign)b.getState();
return isWorldShopSign(s);
} else {
return false;
}
}
public static boolean hasShopSignAttached(Block b) {
//Returns true if there is a shop sign attached to this block.
//Look on all four sides relative to this block.
@ -677,12 +689,13 @@ public class WorldShop {
}
public static boolean shopSignExists(Block block) {
return !(grabShopSign(block)==null);
return isWorldShopSign(block) || grabShopSign(block)!=null;
}
public static Sign grabShopSign(Block block) {
Block signblock = null;
Block signblock2 = null;
if (block==null) {return null;}
for (int i=-1;i<2;i++) {
for (int j=-1;j<2;j++) {
if (i!=0^j!=0) {
@ -916,4 +929,21 @@ public class WorldShop {
public static boolean canPlaceShopSignOnBlock(Block block) {
return (!shopSignExists(block) && GenericFunctions.isDumpableContainer(block.getType()));
}
public static void createWorldShopRecipes() {
for (Material mat : Material.values()) {
ItemStack result = new ItemStack(Material.TRAPPED_CHEST);
ItemUtils.addLore(result,ChatColor.DARK_PURPLE+"World Shop Chest");
ItemUtils.addLore(result,ChatColor.MAGIC+""+ChatColor.BLACK+mat.name());
ItemUtils.addLore(result,ChatColor.LIGHT_PURPLE+"Place in the world to setup a");
ItemUtils.addLore(result,ChatColor.LIGHT_PURPLE+"world shop that sells "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(mat));
ItemUtils.hideEnchantments(result);
result.addUnsafeEnchantment(Enchantment.LUCK, 4);
ShapelessRecipe rec = new ShapelessRecipe(result);
rec.addIngredient(mat, -1);
rec.addIngredient(Material.CHEST);
rec.addIngredient(Material.SIGN);
Bukkit.addRecipe(rec);
}
}
}

@ -0,0 +1,44 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Material;
/**
* Structure contains the following:
* The Material of the item,
* The Item's Default Base Price
*/
public enum WorldShopItem {
APPLE(Material.APPLE,1.00),
BEETROOT(Material.BEETROOT,4.00),
BEETROOT_SEEDS(Material.BEETROOT_SEEDS,3.25),
BLAZE_ROD(Material.BLAZE_POWDER,23.00),
BONE(Material.BONE,1.00),
BROWN_MUSHROOM(Material.BROWN_MUSHROOM,12.00),
CACTUS(Material.CACTUS,4.00),
CARROT_ITEM(Material.CARROT_ITEM,4.00),
CHORUS_FlOWER(Material.CHORUS_FLOWER,20.00),
CHORUS_FRUIT(Material.CHORUS_FRUIT,14.00),
CHORUS_FRUIT_POPPED(Material.CHORUS_FRUIT_POPPED,16.00),
CLAY_BALL(Material.CLAY_BALL,6.00),
CLAY_BRICK(Material.CLAY_BRICK,8.00),
COAL(Material.COAL,16.00),
COAL_ORE(Material.COAL_ORE,48.00),
COBBLESTONE(Material.COBBLESTONE,1.00),
;
Material mat;
double price;
short data;
WorldShopItem(Material mat, double price) {
this.mat=mat;
this.price=price;
this.data=0;
}
WorldShopItem(Material mat, short data, double price) {
this.mat=mat;
this.price=price;
this.data=data;
}
}

@ -8,6 +8,7 @@ import org.bukkit.inventory.InventoryView;
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ItemCubeWindow {
public static void addItemCubeWindow(Player p, int id) {
@ -40,13 +41,13 @@ public class ItemCubeWindow {
InventoryView newinv = p.openInventory(temp);
pd.opened_another_cube=false;
pd.isViewingItemCube=true;}},1);
p.playSound(p.getLocation(),Sound.BLOCK_CHEST_OPEN,1.0f,1.0f);
SoundUtils.playLocalSound(p,Sound.BLOCK_CHEST_OPEN,1.0f,1.0f);
} else {
pd.opened_another_cube=true;
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {@Override public void run() {p.openInventory(ItemCube.getViewingItemCubeInventory(itemcubeid, p));
pd.opened_another_cube=false;
pd.isViewingItemCube=true;}},1);
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
}
}},1);
}
@ -98,12 +99,12 @@ public class ItemCubeWindow {
InventoryView newinv = p.openInventory(inv);
TwosideKeeper.loadItemCubeInventory(inv,newinv);
pd.isViewingItemCube=true;
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
} else {
//ItemCube.displayErrorMessage(p);
p.openInventory(ItemCube.getViewingItemCubeInventory(id, p));
pd.isViewingItemCube=true;
p.playSound(p.getLocation(), Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_OPEN, 1.0f, 1.0f);
}
pd.opened_inventory=false;
}

@ -43,7 +43,7 @@ public class DamageLogger {
public void addMultiplierToLogger(String name, double val) {
if (val!=0.0) {
TwosideKeeper.log("Add "+name+" w/value "+val, 2);
TwosideKeeper.log("Add "+name+" w/value "+val, 3);
if (breakdownlist.containsKey(name)) {
//Add to the already existing value.
double dmg = breakdownlist.get(name);
@ -58,7 +58,7 @@ public class DamageLogger {
public void addEventToLogger(String name, double val) {
if (val!=0.0) {
TwosideKeeper.log("Add "+name+" w/value "+val, 2);
TwosideKeeper.log("Add "+name+" w/value "+val, 3);
if (breakdownlist.containsKey(name)) {
//Add to the already existing value.
double dmg = breakdownlist.get(name);

@ -20,6 +20,7 @@ public class PartyManager {
totalparties=0;
ClearAllParties();
for (Player p : Bukkit.getOnlinePlayers()) {
if (PlayersAreNearby(p)) {
if (!IsInParty(p)) {
//We only care about adding a player that's not in a party already.
//We have to make a new party for this player.
@ -27,10 +28,25 @@ public class PartyManager {
//Now find nearby players and add them to this party.
AddNearbyPlayersToSameParty(p);
}
} else {
if (PlayerStructure.GetPlayerStructure(p).partybonus!=0) {
PlayerStructure.GetPlayerStructure(p).partybonus=0;
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players reset "+p.getName().toLowerCase());
}
}
}
UpdatePartyScoreboards();
}
private static boolean PlayersAreNearby(Player sourcep) {
for (Player checkp : Bukkit.getOnlinePlayers()) {
if (!sourcep.equals(checkp) && sourcep.getLocation().distanceSquared(checkp.getLocation())<=Math.pow(TwosideKeeper.PARTY_CHUNK_SIZE,2)) {
return true;
}
}
return false;
}
private static void UpdatePartyScoreboards() {
for (int i : parties.keySet()) {
if (oldparties.containsKey(i)) {
@ -225,6 +241,11 @@ public class PartyManager {
public static List<Player> getPartyMembers(Player p) {
int partynumb = GetCurrentParty(p);
if (partynumb>=0) {
return parties.get(partynumb);
} else {
List<Player> partylist = new ArrayList<Player>();
return partylist;
}
}
}

@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -104,7 +105,7 @@ public class PlayerStructure {
public List<PotionEffect> lasteffectlist=null;
public boolean stealthmode=false;
public long lastcompassnotification=0;
public long endnotification=0;
public boolean endnotification=false;
public long turnedonsneak=0;
public double slayermodehp=0;
public long lastassassinatetime=0;
@ -150,6 +151,9 @@ public class PlayerStructure {
public int rage_amt=0;
public long swiftaegistime=0;
public String lastActionBarMessage="";
public Location lastStandingLoc = null;
public HashMap<Material,Block> blockscanlist=new HashMap<Material,Block>();
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
@SuppressWarnings("deprecation")
@ -213,6 +217,7 @@ public class PlayerStructure {
//This is a new player! Let the whole world know!
//Give the player free tools and items.
Bukkit.getServer().broadcastMessage(ChatColor.GOLD+"Welcome to new player "+ChatColor.WHITE+""+this.name+"!");
aPlugin.API.discordSendRaw("Welcome to new player **"+this.name+"**!");
p.sendMessage(ChatColor.GREEN+"Welcome to the server! Thanks for joining us.");
p.sendMessage(ChatColor.GOLD+" Here's a manual to get you started!");
@ -228,6 +233,8 @@ public class PlayerStructure {
p.getInventory().addItem(new ItemStack(Material.BREAD,16));*/
ItemStack manual = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bm = (BookMeta)manual.getItemMeta();
bm.setAuthor("Sig's Minecraft");
//bm.setPage(arg0, arg1);
p.getInventory().addItem(manual);

File diff suppressed because it is too large Load Diff

@ -335,6 +335,9 @@ public final class TwosideKeeperAPI {
public static boolean isWorldShop(Block b) {
return WorldShop.shopSignExists(b);
}
public static boolean isWorldShopSign(Block b) {
return WorldShop.isWorldShopSign(b);
}
public static boolean hasPermissionToBreakWorldShopSign(Sign s, Player p) {
return WorldShop.hasPermissionToBreakWorldShopSign(s,p);
}

@ -273,14 +273,16 @@ public class WorldShopManager {
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
//workable.set("recycling_center.count", nodes.size());
int counter=0;
for (int i=0;i<purchases.size();i++) {
if (!purchases.get(i).getSeller().equalsIgnoreCase("admin")) {
workable.set("player"+i, purchases.get(i).getSeller());
workable.set("customer"+i, purchases.get(i).getCustomer());
workable.set("item"+i, purchases.get(i).getItem());
workable.set("money"+i, purchases.get(i).getMoney());
workable.set("amt"+i, purchases.get(i).getAmt());
workable.set("sell"+i, purchases.get(i).getSell());
workable.set("player"+counter, purchases.get(i).getSeller());
workable.set("customer"+counter, purchases.get(i).getCustomer());
workable.set("item"+counter, purchases.get(i).getItem());
workable.set("money"+counter, purchases.get(i).getMoney());
workable.set("amt"+counter, purchases.get(i).getAmt());
workable.set("sell"+counter, purchases.get(i).getSell());
counter++;
}
}

@ -0,0 +1,11 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.Location;
import net.minecraft.server.v1_9_R1.EnumParticle;
public class aPluginAPIWrapper {
public static void sendParticle(Location loc, EnumParticle particle, float dx, float dy, float dz, float v, int particleCount) {
utils.NMSUtils.sendParticle(loc,particle,dx,dy,dz,v,particleCount);
}
}

@ -7,22 +7,31 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
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 aPlugin.DiscordMessageSender;
import net.minecraft.server.v1_9_R1.EnumParticle;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
final class runServerHeartbeat implements Runnable {
/**
@ -115,12 +124,9 @@ final class runServerHeartbeat implements Runnable {
//See if each player needs to regenerate their health.
for (Player p : Bukkit.getOnlinePlayers()) {
//TwosideKeeper.outputArmorDurability(p);
if (!p.isDead()) {
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
GenericFunctions.RemoveNewDebuffs(p);
ItemStack[] equips2 = GenericFunctions.getEquipment(p);
for (int i=0;i<equips2.length;i++) {GenericFunctions.UpdateArtifactItemType(equips2[i]);}
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<serverTickTime) {
pd.lastsprintcheck=serverTickTime;
@ -146,12 +152,15 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.TwosideShops.PlayerSendPurchases(p);
}
if (!aPlugin.API.isAFK(p)) {
if (TwosideKeeper.TwosideShops.IsPlayerUsingTerminal(p) &&
(TwosideKeeper.TwosideShops.GetSession(p).GetSign().getBlock()==null || TwosideKeeper.TwosideShops.GetSession(p).IsTimeExpired())) {
p.sendMessage(ChatColor.RED+"Ran out of time! "+ChatColor.WHITE+"Shop session closed.");
TwosideKeeper.TwosideShops.RemoveSession(p);
}
GenericFunctions.RemoveNewDebuffs(p);
pd.highwinder=ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
if (pd.highwinder) {
pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
@ -182,8 +191,55 @@ final class runServerHeartbeat implements Runnable {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.FIRE_RESISTANCE, duration-(20*(10-lv)), lv, p, true);
}
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
if (!pd.endnotification) {
pd.endnotification=true;
playEndWarningNotification(p);
}
randomlyAggroNearbyEndermen(p);
} else {
if (pd.endnotification) {
pd.endnotification=false;
}
}
ItemStack[] equips = p.getEquipment().getArmorContents();
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) {
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) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
}
//PopulatePlayerBlockList(p,15,15,2,5,false);
PopRandomLavaBlock(p);
GenericFunctions.sendActionBarMessage(p, "");
GenericFunctions.AutoRepairItems(p);
if (GenericFunctions.hasStealth(p)) {GenericFunctions.DamageRandomTool(p);}
//See if this player is sleeping.
if (p.isSleeping()) {
p.setHealth(Bukkit.getPlayer(pd.name).getMaxHealth()); //Heals the player fully when sleeping.
}
//We need to see if this player's damage reduction has changed recently. If so, notify them.
//Check damage reduction by sending an artifical "1" damage to the player.
if (!p.isDead()) {TwosideKeeper.log("Player is not dead.",5); TwosideKeeper.setPlayerMaxHealth(p);}
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
if (PlayerMode.isBarbarian(p)) {
AutoConsumeFoods(p);
}
}
p.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(20*(1.0d-CustomDamage.CalculateDamageReduction(1,p,null))+subtractVanillaArmorBar(p.getEquipment().getArmorContents()));
ItemStack[] equips = p.getEquipment().getArmorContents();
@ -245,36 +301,6 @@ final class runServerHeartbeat implements Runnable {
}
}
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
if (pd.endnotification+72000<serverTickTime) {
pd.endnotification=serverTickTime;
playEndWarningNotification(p);
}
randomlyAggroNearbyEndermen(p);
}
//See if this player is sleeping.
if (p.isSleeping()) {
p.setHealth(Bukkit.getPlayer(pd.name).getMaxHealth()); //Heals the player fully when sleeping.
}
//We need to see if this player's damage reduction has changed recently. If so, notify them.
//Check damage reduction by sending an artifical "1" damage to the player.
if (!p.isDead()) {TwosideKeeper.log("Player is not dead.",5); TwosideKeeper.setPlayerMaxHealth(p);}
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
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) {
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) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
pd.last_swordhit+40<serverTickTime) {
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
@ -288,14 +314,8 @@ final class runServerHeartbeat implements Runnable {
GenericFunctions.applyStealth(p, true);
}
}
if (PlayerMode.isBarbarian(p)) {
AutoConsumeFoods(p);
}
GenericFunctions.sendActionBarMessage(p, "");
GenericFunctions.AutoRepairItems(p);
}
//TwosideKeeper.outputArmorDurability(p,">");
}
MaintainMonsterData();
@ -305,13 +325,59 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.TwosideSpleefGames.TickEvent();
}
private void PopRandomLavaBlock(Player p) {
if (p.getWorld().getName().equalsIgnoreCase("world_nether") &&
TwosideKeeper.last_lava_plume_time+(TwosideKeeper.LAVA_PLUME_COOLDOWN/(Math.max(Bukkit.getOnlinePlayers().size(),1)))<TwosideKeeper.getServerTickTime()) {
//Choose a random location near the player.
int randomx=(int)(Math.random()*32)-16;
int randomz=(int)(Math.random()*32)-16;
TwosideKeeper.last_lava_plume_time=TwosideKeeper.getServerTickTime();
//Start a couple blocks above the player. Work our way down until we can't find AIR or we go farther than 5 iterations.
int yrel=5;
while (p.getLocation().getBlockY()+yrel>=0) {
final Block b = p.getLocation().add(randomx,yrel,randomz).getBlock();
//Schedule this 3 seconds later.
if (b.getType()==Material.STATIONARY_LAVA) {
//TwosideKeeper.log("Block ("+b.getLocation()+") is type "+b.getType(), 0);
//CreateLavaPlumeParticles(b);
//Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{}, 20*3);
CreateLavaPlume(b);
break;
} else {
if (b.getType()==Material.AIR) {
yrel--;
} else {
break;
}
}
}
}
}
private void CreateLavaPlumeParticles(Block b) {
//aPluginAPIWrapper.sendParticle(b.getLocation().add(0,5,0), EnumParticle.DRIP_LAVA, 0, 0, 0, 0.4f, 100);
/*for (int i=0;i<100;i++) {
aPluginAPIWrapper.sendParticle(b.getLocation().add(0,Math.random()*5,0), EnumParticle.DRIP_LAVA, (float)Math.random(),(float)Math.random(),(float)Math.random(), (float)Math.random(), 5);
}*/
}
private void CreateLavaPlume(final Block b) {
//FallingBlock fb = b.getWorld().spawnFallingBlock(b.getLocation().add(0,1,0), Material.REDSTONE_BLOCK, (byte)0);
TwosideKeeper.lavaplume_list.add(new LavaPlume(90,b.getLocation()));
/*fb.setMetadata("DESTROY", new FixedMetadataValue(TwosideKeeper.plugin,true));
fb.setVelocity(new Vector(0,(float)((Math.random()*8)+2),0));
for (Player pl : Bukkit.getOnlinePlayers()) {
GlowAPI.setGlowing(fb, GlowAPI.Color.YELLOW, pl);
}*/
}
private void AutoConsumeFoods(Player p) {
if (p.getFoodLevel()<20 && PlayerMode.getPlayerMode(p)==PlayerMode.BARBARIAN) {
ItemStack[] contents = p.getInventory().getStorageContents();
for (int i=0;i<contents.length;i++) {
if (contents[i]!=null &&
GenericFunctions.isAutoConsumeFood(contents[i])) {
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
p.setFoodLevel(Math.min(20, p.getFoodLevel()+1));
double basepercent = p.getMaxHealth()*0.01;
GenericFunctions.HealEntity(p,basepercent);
@ -325,7 +391,7 @@ final class runServerHeartbeat implements Runnable {
private void MaintainMonsterData() {
Set<UUID> data= TwosideKeeper.livingentitydata.keySet();
TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 2);
TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 5);
for (UUID id : data) {
LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id);
if (!ms.m.isValid()) {
@ -383,33 +449,33 @@ final class runServerHeartbeat implements Runnable {
@Override
public void run() {
p.sendMessage(ChatColor.BLUE+" \"You DO NOT BELONG HERE.\"");
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},20);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(0,20,0), Sound.ENTITY_GHAST_WARN, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p,p.getLocation().add(0,20,0), Sound.ENTITY_GHAST_WARN, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},23);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p,p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},27);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p,p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
SoundUtils.playLocalSound(p, Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},30);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {

Loading…
Cancel
Save