>Fixed Hellfire Blaze Fireballs not causing Temporary Lava to disappear

properly.
>Fixed Bad Memory leaks that caused eventual server slowdowns.
>Leader Wither loot now appears in a series of chests for collection
rather than being dispersed all over the ground.
>The Elite Zombie no longer completely stops players it is leashing
onto, but instead slowing them down.
>The Elite Zombie's running speed has been decreased by 35%.
>The Elite Zombie's cooldowns and timings on mechanics have been
modified.
>The Elite Zombie's Stored Energy attack now knocks the player hit very
far back.
>The Elite Zombie's health has been increased dramatically. The Elite
Zombie no longer has a Resistance IX buff.
testdev
sigonasr2 8 years ago
parent 341a330d6b
commit d35942b678
  1. 11
      .project
  2. 13
      src/plugin.yml
  3. 1
      src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
  4. 52
      src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
  5. 8
      src/sig/plugin/TwosideKeeper/ChargeZombie.java
  6. 35
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  7. 14
      src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
  8. 38
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  9. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
  10. 63
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  11. 53
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
  12. 1
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
  13. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
  14. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
  15. 6
      src/sig/plugin/TwosideKeeper/HelperStructures/LivingEntityDifficulty.java
  16. 85
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  17. 17
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/BlockUtils.java
  18. 3
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
  19. 77
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  20. 12
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/PlayerUtils.java
  21. 3
      src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
  22. 2
      src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
  23. 31
      src/sig/plugin/TwosideKeeper/Monster/HellfireGhast.java
  24. 106
      src/sig/plugin/TwosideKeeper/Monster/Wither.java
  25. 20
      src/sig/plugin/TwosideKeeper/MonsterController.java
  26. 41
      src/sig/plugin/TwosideKeeper/PartyManager.java
  27. 1
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  28. 8
      src/sig/plugin/TwosideKeeper/Recipes.java
  29. 578
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  30. 10
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

@ -1,6 +1,7 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.10.3
version: 3.10.5
loadbefore: [aPlugin]
commands:
money:
description: Tells the player the amount of money they are holding.
@ -136,4 +137,14 @@ commands:
description: Ready up for the tree climbing race.
usage: /ready
permission: TwosideKeeper.money
permission-message: No permissions!
habitat:
description: View the habitat levels within the area.
usage: /habitat
permission: TwosideKeeper.money
permission-message: No permissions!
debugreport:
description: View a full debug report of the Server.
usage: /debugreport
permission: TwosideKeeper.fulldebugreport
permission-message: No permissions!

@ -89,6 +89,7 @@ public class AwakenedArtifact {
if (totalval>=1000) {
//LEVEL UP!
ItemStack item = addLV(artifact,totalval/1000, p);
item = addMaxAP(item,totalval/1000);
item = setEXP(item,totalval%1000);
item = addAP(item,totalval/1000);
double potentialred = 10.0d;

@ -40,17 +40,20 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class EliteZombie extends EliteMonster{
static int REFRESH_BUFFS = 20*30;
static float FAST_MOVE_SPD = 0.65f;
static float FAST_MOVE_SPD = 0.575f;
static long BURST_TIME = 20*3;
static float BURST_LIMIT = 10f;
static int WEAKNESS_DURATION = 20*10;
static int POISON_DURATION = 20*10;
static int LEAP_COOLDOWN = 20*40;
static int LEAP_COOLDOWN = 20*20;
static int ENRAGE_COOLDOWN = 20*60;
static int STORINGENERGY_COOLDOWN = 20*50;
static int WILLPOWER_COOLDOWN = 20*50;
static int STORINGENERGY_COOLDOWN = 20*45;
static int WILLPOWER_COOLDOWN = 20*30;
static int GLOW_TIME = 20*1;
private long stuckTimer=0;
private Location lastLoc = null;
long last_rebuff_time=0;
long last_burstcheck_time=0;
long last_applyglow_time=0;
@ -142,7 +145,7 @@ public class EliteZombie extends EliteMonster{
private void adjustWillpower() {
//Check for nearby mobs. Each mob increases willpower by 1.
if (Math.random()<=0.3 && !leaping && !storingenergy) {
if (Math.random()<=0.5 && !leaping && !storingenergy) {
int mobcount=0;
List<Monster> monsterlist = CustomDamage.trimNonMonsterEntities(m.getNearbyEntities(10, 10, 10));
mobcount=monsterlist.size()-1;
@ -274,7 +277,7 @@ public class EliteZombie extends EliteMonster{
storingenergy_hit=0;
}
}
if (l.getLocation().distanceSquared(m.getLocation())>4096 && !leaping) {
if (l.getLocation().distanceSquared(m.getLocation())>8192 && !leaping && last_leap_time+20<TwosideKeeper.getServerTickTime()) {
//Lose the target.
targetlist.remove(l);
if (targetlist.size()>0) {
@ -290,7 +293,7 @@ public class EliteZombie extends EliteMonster{
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
m.teleport(l.getLocation().add(Math.random(),Math.random(),Math.random()));
l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20*5,7));
l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,20*5,4));
l.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,20*1,7));
chasing=false;
}
@ -306,6 +309,18 @@ public class EliteZombie extends EliteMonster{
//Jump up to compensate. Move towards the player too.
m.setVelocity((m.getLocation().getDirection()).add(new Vector(0,0.2*(l.getLocation().getY()-m.getLocation().getY()),0)));
}
if (lastLoc!=null && lastLoc.distance(m.getLocation())<=0.4) {
stuckTimer++;
//TwosideKeeper.log("Stuck. "+stuckTimer, 0);
} else {
stuckTimer=0;
}
lastLoc = m.getLocation().clone();
if (stuckTimer>5) {
//Teleport randomly.
m.teleport(getNearbyFreeLocation(m.getLocation()));
stuckTimer=0;
}
} else {
targetlist.remove(l);
m.setTarget(null);
@ -315,7 +330,7 @@ public class EliteZombie extends EliteMonster{
private void rebuff() {
if (last_rebuff_time+REFRESH_BUFFS<=TwosideKeeper.getServerTickTime()) {
last_rebuff_time=TwosideKeeper.getServerTickTime();
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8),true);
//m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8),true);
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,8),true);
//m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,2),true);
ItemStack helm = new ItemStack(Material.GOLD_AXE);
@ -364,12 +379,12 @@ public class EliteZombie extends EliteMonster{
}
last_regen_time=TwosideKeeper.getServerTickTime();
double randomrate = 0d;
if (!chasing && CustomDamage.getPercentHealthRemaining(m)<=50) {
if (!chasing && CustomDamage.getPercentHealthRemaining(m)<=90) {
if (last_leap_time+LEAP_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
performLeap();
}
}
if (CustomDamage.getPercentHealthRemaining(m)<=25) {
if (CustomDamage.getPercentHealthRemaining(m)<=65) {
if (!leaping && !chasing &&
last_storingenergy_time+STORINGENERGY_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
last_storingenergy_time=TwosideKeeper.getServerTickTime();
@ -404,7 +419,7 @@ public class EliteZombie extends EliteMonster{
},6*20);
}
}
if (CustomDamage.getPercentHealthRemaining(m)<=10) {
if (CustomDamage.getPercentHealthRemaining(m)<=20) {
if (last_enrage_time+ENRAGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
last_enrage_time=TwosideKeeper.getServerTickTime();
for (int i=0;i<targetlist.size();i++) {
@ -426,12 +441,12 @@ public class EliteZombie extends EliteMonster{
}},20*20);
}
}
if (CustomDamage.getPercentHealthRemaining(m)<=75 &&
CustomDamage.getPercentHealthRemaining(m)>50) {
if (CustomDamage.getPercentHealthRemaining(m)<=90 &&
CustomDamage.getPercentHealthRemaining(m)>75) {
randomrate = 1/16d;
} else
if (CustomDamage.getPercentHealthRemaining(m)<=50 &&
CustomDamage.getPercentHealthRemaining(m)>25) {
if (CustomDamage.getPercentHealthRemaining(m)<=75 &&
CustomDamage.getPercentHealthRemaining(m)>50) {
randomrate = 1/8d;
} else
{
@ -475,7 +490,7 @@ public class EliteZombie extends EliteMonster{
@SuppressWarnings("deprecation")
private void performLeap() {
last_leap_time = TwosideKeeper.getServerTickTime();
int radius = (int)(6*(CustomDamage.getPercentHealthMissing(m)/100d))+1;
int radius = (int)(5*(CustomDamage.getPercentHealthMissing(m)/100d))+4;
//Choose a target randomly.
Player target = ChooseRandomTarget();
m.setTarget(target);
@ -547,7 +562,7 @@ public class EliteZombie extends EliteMonster{
//GenericFunctions.DealDamageToNearbyPlayers(target_leap_loc, 5*200, radius, true, 2, m, "Leap",false);
//GenericFunctions.getNear
}
},(int)(((20*3)*(CustomDamage.getPercentHealthRemaining(m)/100d))+30));
},(int)(((20*1.5)*(CustomDamage.getPercentHealthRemaining(m)/100d))+30));
}
//Triggers when this mob hits something.
@ -577,9 +592,10 @@ public class EliteZombie extends EliteMonster{
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.CONFUSION,20*4,0,p);
TwosideKeeper.log("Got hit for "+storingenergy_hit+" damage!", 2);
GenericFunctions.removeNoDamageTick(p, m);
if (CustomDamage.ApplyDamage(storingenergy_hit, m, p, null, "Stored Energy", CustomDamage.IGNOREDODGE)) {
if (CustomDamage.ApplyDamage(storingenergy_hit, m, p, null, "Stored Energy", CustomDamage.IGNOREDODGE|CustomDamage.IGNORE_DAMAGE_TICK)) {
//TwosideKeeperAPI.DealDamageToEntity(.CalculateDamageReduction(storingenergy_hit,p,m),p,m);
storingenergy_hit=0;
p.setVelocity(m.getLocation().getDirection().multiply(2.0f));
}
}
}

@ -33,8 +33,8 @@ public class ChargeZombie {
if (Math.abs(x)<outerradius &&
Math.abs(y)<outerradius+1 &&
Math.abs(z)<outerradius &&
aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) {
(aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) ||
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN)) {
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
boolean brokeliquid = false;
@ -128,7 +128,7 @@ public class ChargeZombie {
blocktoughness=100;
}break;
case ENDER_CHEST:{
blocktoughness=44;
blocktoughness=999999;
}break;
case ANVIL:{
blocktoughness=10;
@ -226,7 +226,7 @@ public class ChargeZombie {
case CHEST:
case TRAPPED_CHEST:
case WORKBENCH:{
blocktoughness=5;
blocktoughness=999999;
}break;
case BRICK_STAIRS:
case BRICK:

@ -35,6 +35,7 @@ import org.bukkit.entity.Snowball;
import org.bukkit.entity.SpectralArrow;
import org.bukkit.entity.Spider;
import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Wither;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.inventory.ItemStack;
@ -559,8 +560,7 @@ public class CustomDamage {
}
}
provokeMonster(target,p,weapon);
if (GenericFunctions.isArtifactEquip(weapon) &&
GenericFunctions.isArtifactWeapon(weapon)) {
if (GenericFunctions.isArtifactEquip(weapon)) {
double ratio = 1.0-CalculateDamageReduction(1,target,p);
if (p.getEquipment().getItemInMainHand().getType()!=Material.BOW) {
//Do this with a 1 tick delay, that way it can account for items that are dropped one tick earlier and still work.
@ -726,7 +726,7 @@ public class CustomDamage {
private static double modifyFateBasedOnHolidayTreats(Player p, double damage) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
boolean consumed=false,consumed2=false;
boolean consumed=false;
if (p.getHealth()-damage<=0 && pd.lastrevivecandyconsumed+200<TwosideKeeper.getServerTickTime()) {
for (int i=0;i<9;i++) {
ItemStack item = p.getInventory().getItem(i);
@ -742,7 +742,9 @@ public class CustomDamage {
GenericFunctions.RevivePlayer(p,p.getMaxHealth());
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
GenericFunctions.RandomlyBreakBaubles(p, hotbar);
consumed2=true;
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, 200);
return 0;
}
}
@ -822,11 +824,6 @@ public class CustomDamage {
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_CARROT, 40);
aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, 40);
}
if (consumed2) {
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f);
pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, 200);
}
return damage;
}
@ -1384,8 +1381,16 @@ public class CustomDamage {
addHellfireSpiderToList(m);
addHellfireGhastToList(m);
addBlazeToList(m);
addWitherToList(m);
}
private static void addWitherToList(LivingEntity m) {
if (!TwosideKeeper.custommonsters.containsKey(m.getUniqueId()) &&
m instanceof Wither) {
TwosideKeeper.custommonsters.put(m.getUniqueId(),new sig.plugin.TwosideKeeper.Monster.Wither((Monster)m));
}
}
static void addChargeZombieToList(LivingEntity m) {
if (!TwosideKeeper.chargezombies.containsKey(m.getUniqueId()) &&
MonsterController.isChargeZombie(m)) {
@ -1778,6 +1783,7 @@ public class CustomDamage {
double tacticspct = 0;
double darknessdiv = 0;
double playermodediv = 0;
double witherdiv = 0;
if (target instanceof LivingEntity) {
ItemStack[] armor = GenericFunctions.getArmor(target);
@ -1816,7 +1822,7 @@ public class CustomDamage {
}
for (int i=0;i<armor.length;i++) {
if (armor[i]!=null) {
if (armor[i]!=null && GenericFunctions.isArmor(armor[i])) {
//Check for Protection enchantment.
//Each Protection level gives 1% extra damage reduction.
if (armor[i].getEnchantmentLevel(Enchantment.PROTECTION_ENVIRONMENTAL)>0) {
@ -1896,6 +1902,10 @@ public class CustomDamage {
}
}
if (target instanceof Wither) {
witherdiv += 0.2;
}
//Check for resistance effect.
Collection<PotionEffect> target_effects = target.getActivePotionEffects();
@ -1972,6 +1982,7 @@ public class CustomDamage {
*(1d-((partylevel*10d)/100d))
*(1d-tacticspct)
*(1d-playermodediv)
*(1d-witherdiv)
*setbonus
*((target instanceof Player && ((Player)target).isBlocking())?(PlayerMode.isDefender((Player)target))?0.30:0.50:1)
*((target instanceof Player)?((PlayerMode.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1);
@ -2755,10 +2766,10 @@ public class CustomDamage {
difficulty_damage=new double[]{3.0,5.0,7.0};
break;
case WITHER:
difficulty_damage=new double[]{10.0,16.0,36.0};
difficulty_damage=new double[]{10.0,16.0,650.0};
break;
case WITHER_SKULL:
difficulty_damage=new double[]{10.0,16.0,36.0};
difficulty_damage=new double[]{10.0,16.0,650.0};
break;
case GIANT:
case ZOMBIE:

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.Drops;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -145,7 +146,7 @@ public class SigDrop extends Drop{
if (isSet) {
ItemSet set = ItemSet.PANROS;
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
if (Math.random()<=0.8) {
if (Math.random()<=0.01) {
set = LivingEntityDifficulty.PickAHolidayItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
@ -153,6 +154,7 @@ public class SigDrop extends Drop{
} else {
set = LivingEntityDifficulty.PickAnItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
}
TwosideKeeper.log("Set Chosen: "+set, 0);
//Turn it into the appropriate piece if necessary.
item = LivingEntityDifficulty.ConvertSetPieceIfNecessary(item, set);
@ -162,6 +164,7 @@ public class SigDrop extends Drop{
}
item = Loot.GenerateSetPiece(item, set, isHardened, tierbonus);
TwosideKeeper.log("Final Item: "+item, 0);
} else {
item = Loot.GenerateMegaPiece(item.getType(), isHardened);
}
@ -202,7 +205,12 @@ public class SigDrop extends Drop{
@Override
public ItemStack getItemStack() {
TwosideKeeper.log("Something went terribly wrong with getItemStack() call. Check to make sure you are using getSingleDrop(Player) and not getSingleDrop()!!!", 0);
return null;
if (Bukkit.getOnlinePlayers().size()>0) {
int random = (int)(Math.random()*(Bukkit.getOnlinePlayers().size()));
Player picked = (Player)(Bukkit.getOnlinePlayers().toArray()[random]);
return getItemStack(picked);
} else {
return null;
}
}
}

@ -65,7 +65,7 @@ public enum ArtifactAbility {
new double[]{4.0,3.85,3.70,3.55,3.40,3.25,3.10,2.95,2.80,2.775,2.75,2.725,2.7,2.675,2.65},100,1,UpgradePath.ARMOR),
SHADOWWALKER("Shadow Walker","Increases your speed in dark areas. Damage Reduction increases by [VAL]% in dark areas. Dodge chance increases by [DODGEVAL]% in dark areas.",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5},
new double[]{1.5,1.4,1.3,1.2,1.1,1.0,0.9,0.8,0.7,0.65,0.625,0.6,0.585,0.565,0.55},100,10,UpgradePath.ARMOR),
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consumes this ability, removes all debuffs, and restores your health by [VAL]%"+TemporarySkill(),new double[]{4,4.25,4.5,4.75,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10},
SURVIVOR("Survivor","Taking fatal damage will not kill you and instead consumes this ability, removes all debuffs, and restores your health by [VAL]%"+TemporarySkill(true),new double[]{4,4.25,4.5,4.75,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10},
new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,25,UpgradePath.ARMOR),
DODGE("Dodge","You have a [VAL]% chance to dodge incoming damage from any damage source.",new double[]{0.1,0.125,0.15,0.175,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.45,0.5,0.55},
new double[]{1.0,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.45,0.35,0.25,0.2},100,40,UpgradePath.ARMOR),
@ -110,16 +110,16 @@ public enum ArtifactAbility {
//General abilities
AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,10,15},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL),
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each kill has a [GREEDCHANCE]% chance to consume the Greed buff."+TemporarySkill(),new double[]{1,2,3,4,5,7,9,11,13,15,17,19,25,35,50},
GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each kill has a [GREEDCHANCE]% chance to consume the Greed buff."+TemporarySkill(true),new double[]{1,2,3,4,5,7,9,11,13,15,17,19,25,35,50},
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,-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),
GROWTH("Growth","Recovers 20% Potential to your Artifact."+TemporarySkill(false),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},1,10,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,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),
/*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},
@ -172,8 +172,8 @@ public enum ArtifactAbility {
return "\n\n"+ChatColor.RED+"Costs "+i+" AP";
}
private static String TemporarySkill() {
return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point when knocked off.";
private static String TemporarySkill(boolean knockoff) {
return "\n\n"+ChatColor.RED+"Consumes 1 Max AP Point"+((knockoff)?" when knocked off.":"");
}
public String GetName() {
@ -282,7 +282,7 @@ public enum ArtifactAbility {
if (containsEnchantment(ability,item)) {
for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(ability.GetName())) {
TwosideKeeper.log("Removed "+ability.GetName(), 2);
//TwosideKeeper.log("Removed "+ability.GetName(), 2);
//This is the line! Remove it.
lore.remove(i);
i--;
@ -297,7 +297,7 @@ public enum ArtifactAbility {
public static ItemStack removeAllEnchantments(ItemStack item) {
HashMap<ArtifactAbility,Integer> enchants = getEnchantments(item);
for (ArtifactAbility ab : enchants.keySet()) {
TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2);
//TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2);
item = removeEnchantment(ab,item);
}
item = AwakenedArtifact.setAP(item, AwakenedArtifact.getMaxAP(item));
@ -456,6 +456,11 @@ public enum ArtifactAbility {
//Remove a level from using a temporary ability.
AwakenedArtifact.addAP(item, -9);
}
if (ability.equals(ArtifactAbility.GROWTH)) {
removeEnchantment(ArtifactAbility.GROWTH,item);
AwakenedArtifact.setPotential(item, AwakenedArtifact.getPotential(item)+20);
AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1);
}
int apamt = AwakenedArtifact.getAP(item);
if (apamt>0) {
TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining!");
@ -597,9 +602,10 @@ public enum ArtifactAbility {
text=DisplayAbility(GREED,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(AUTOREPAIR,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(GROWTH,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
//text=DisplayAbility(REMOVE_CURSE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(PRESERVATION,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
//text=DisplayAbility(EXP_MULT,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
return msg1;
}
@ -614,7 +620,7 @@ public enum ArtifactAbility {
msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET);
msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET);
msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET);
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((16-tier)*0.1d)+ChatColor.RESET);
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET);
return msg;
}
public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for.
@ -627,7 +633,7 @@ public enum ArtifactAbility {
msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv)));
msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3));
msg=msg.replace("[DODGEVAL]", df.format(tier));
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((100d/tier))+ChatColor.RESET);
msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format(8-(tier/2d))+ChatColor.RESET);
return msg;
}

@ -38,6 +38,10 @@ public class BlockModifyQueue{
}
}
public Block getBlock() {
return b;
}
private boolean TypeException(Block b) {
if (b.getType()==Material.STATIONARY_LAVA || b.getType()==Material.LAVA ||
b.getType()==Material.STATIONARY_WATER || b.getType()==Material.WATER) {

@ -132,6 +132,7 @@ public class GenericFunctions {
break_count=0;
}
TwosideKeeper.log("Setting breaks remaining to "+(break_count-1),3);
break;
}
}
}
@ -157,7 +158,8 @@ public class GenericFunctions {
if (p!=null) {
p.sendMessage(ChatColor.LIGHT_PURPLE+"You still feel the artifact's presence inside of you...");
}
return convertArtifactToDust(item.clone());
convertArtifactToDust(item);
return null;
}
return null;
}
@ -411,6 +413,7 @@ public class GenericFunctions {
break_count+=charges_stored;
lore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
TwosideKeeper.log("Setting time to "+TwosideKeeper.getServerTickTime(),3);
break;
}
}
}
@ -2240,7 +2243,7 @@ public class GenericFunctions {
}
}
public static boolean isBossMonster(Monster m) {
public static boolean isBossMonster(LivingEntity m) {
if (MonsterController.isZombieLeader(m) ||
(m.getType()==EntityType.GUARDIAN &&
((Guardian)m).isElder()) ||
@ -2253,7 +2256,7 @@ public class GenericFunctions {
}
}
public static boolean isCoreMonster(Monster m) {
public static boolean isCoreMonster(LivingEntity m) {
if (m.getType()==EntityType.GUARDIAN ||
m.getType()==EntityType.SKELETON) {
if (m.getType()==EntityType.SKELETON) {
@ -2751,7 +2754,7 @@ public class GenericFunctions {
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); //We knock off one Max AP because it's a temporary ability!!
brokeone=true;
return;
}
@ -2759,13 +2762,16 @@ public class GenericFunctions {
}
if (!brokeone) {
//Try the main hand.
//TwosideKeeper.log("Trying to break in here.", 0);
ItemStack item = p.getEquipment().getItemInMainHand();
if (isArtifactEquip(item) &&
ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) {
int tier = item.getEnchantmentLevel(Enchantment.LUCK);
//TwosideKeeper.log("Chance is "+((8-(tier/2d))/100d), 0);
if (Math.random()<=(8-(tier/2d))/100d) {
item = ArtifactAbility.downgradeEnchantment(p, item, ArtifactAbility.GREED);
//AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p);
AwakenedArtifact.setMaxAP(item, AwakenedArtifact.getMaxAP(item)-1); //We knock off one Max AP because it's a temporary ability!!
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;
@ -3430,15 +3436,14 @@ public class GenericFunctions {
int tier = 1;
UpdateSetLore(set,tier,item);
}
if (TwosideKeeperAPI.getItemSet(item)!=null && item.getType().name().contains("LEATHER")) {
if (TwosideKeeperAPI.getItemSet(item)!=null && item.getType()!=Material.LEATHER && item.getType().name().contains("LEATHER")) {
TwosideKeeper.log("In here",5);
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) {
if (lm.getColor().equals(Bukkit.getServer().getItemFactory().getDefaultLeatherColor())) {
TwosideKeeper.log("->In here",5);
ItemSet set = TwosideKeeperAPI.getItemSet(item);
ConvertSetColor(item, set);
}
item.setItemMeta(lm);
}
}
}
@ -3493,8 +3498,8 @@ public class GenericFunctions {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 20*10, 3, p, true);
deAggroNearbyTargets(p);
revived=true;
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!");
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" should've died but managed to live!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" should've died but managed to live!");
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p));
return true;
}
@ -3510,10 +3515,11 @@ public class GenericFunctions {
//We can revive!
RevivePlayer(p, Math.min(p.getMaxHealth()*(getAbilityValue(ArtifactAbility.SURVIVOR,equip)/100d),p.getMaxHealth()));
ArtifactAbility.removeEnchantment(ArtifactAbility.SURVIVOR, equip);
AwakenedArtifact.setLV(equip, AwakenedArtifact.getLV(equip)-1, p);
//AwakenedArtifact.setLV(equip, AwakenedArtifact.getLV(equip)-1, p);
AwakenedArtifact.setMaxAP(equip, AwakenedArtifact.getMaxAP(equip)-1);
revived=true;
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!");
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" survived a brutal attack and managed to come back to life!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" survived a brutal attack and managed to come back to life!");
return true;
}
@ -3796,12 +3802,12 @@ public class GenericFunctions {
return players;
}
public static boolean isEliteMonster(Monster m) {
public static boolean isEliteMonster(LivingEntity m) {
LivingEntityStructure md = LivingEntityStructure.getLivingEntityStructure(m);
return md.getElite();
}
public static EliteMonster getEliteMonster(Monster m) {
public static EliteMonster getEliteMonster(LivingEntity m) {
for (EliteMonster em : TwosideKeeper.elitemonsters) {
if (em.getMonster().equals(m)) {
return em;
@ -3815,21 +3821,16 @@ public class GenericFunctions {
int randomz = (int)((Math.random()*10000) - 5000);
Location testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load();
int loopmax=5;
int i = 0;
while (i<loopmax) {
randomx = (int)((Math.random()*10000) - 5000);
randomz = (int)((Math.random()*10000) - 5000);
testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load();
if ((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) &&
AllNaturalBlocks(testloc.getBlock(),16,8,16)) {
return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz);
} else {
testloc.getChunk().unload();
TwosideKeeper.log("Failed location "+testloc.toString(), 4);
i++;
}
randomx = (int)((Math.random()*10000) - 5000);
randomz = (int)((Math.random()*10000) - 5000);
testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load();
if ((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) &&
AllNaturalBlocks(testloc.getBlock(),16,8,16)) {
return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz);
} else {
testloc.getChunk().unload(false);
TwosideKeeper.log("Failed location "+testloc.toString(), 4);
}
return null;
}
@ -4338,7 +4339,7 @@ public class GenericFunctions {
Location originalloc = player.getLocation().clone();
Location teleloc = target.getLocation().add(target.getLocation().getDirection().multiply(-1.0-mult));
int i=0;
while (teleloc.getBlock().getType().isSolid() || teleloc.getBlock().getType()==Material.BEDROCK) {
while (!(teleloc.getBlock().getRelative(0, -1, 0).getType().isSolid() && teleloc.getBlock().getType()==Material.AIR && teleloc.getBlock().getRelative(0, 1, 0).getType()==Material.AIR)) {
if (i==0) {
teleloc=target.getLocation();
} else
@ -4508,7 +4509,7 @@ public class GenericFunctions {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Preparing Message. Important? "+important+" Message: \""+message+"\"", 1);
String prefix=ActionBarBuffUpdater.getActionBarPrefix(p);
finalmsg=message+" "+prefix;
if (important || (pd.lastimportantactionbarmsg+20<TwosideKeeper.getServerTickTime())) {
if (important || (pd.lastimportantactionbarmsg+20<=TwosideKeeper.getServerTickTime())) {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] Sent Message", 0);
if (prefix.length()>0 || aPlugin.API.getLastXPBar(p).length() > 2) {
aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), finalmsg));

@ -8,6 +8,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -33,7 +34,7 @@ public class Habitation {
if (locationhashes.containsKey(hash)) {
int spawnamt = locationhashes.get(hash);
TwosideKeeper.log("[Habitat]Spawn Amount was "+spawnamt+". "+((0.5/(spawnamt+1))*100)+"% chance to fail.",4);
if (Math.random()>(20/(spawnamt+1))) {
if (Math.random()>(20/((spawnamt*2)+1))) {
TwosideKeeper.log("[Habitat]It failed.",4);
return false;
}
@ -45,7 +46,7 @@ public class Habitation {
return true;
}
public void addKillToLocation(LivingEntity l) {
/*public void addKillToLocation(LivingEntity l) {
String hash = getLocationHash(l.getLocation());
if (startinglocs.containsKey(l.getUniqueId())) {
hash = getLocationHash(startinglocs.get(l.getUniqueId()));
@ -65,7 +66,8 @@ public class Habitation {
else {
locationhashes.put(hash,1);
}
}
}
public void addKillToLocation(Location l) {
String hash = getLocationHash(l);
if (locationhashes.containsKey(hash)) {
@ -78,7 +80,30 @@ public class Habitation {
else {
locationhashes.put(hash,1);
}
}
}*/
public void addKillToLocation(LivingEntity entityKilled) {
for (int offsetMeters = 0; offsetMeters < 64; offsetMeters += 4) {
// Attempt to add 1 habitat to a random chunk within offsetMeters of the death location
// Guaranteed to add at least 1 kill to the chunk that the killed entity was in.
addKillToLocation(getRandomLocationWithinCircle(
// Use entity source location, or death location if not available
startinglocs.getOrDefault(entityKilled.getUniqueId(), entityKilled.getLocation()),
offsetMeters));
}
}
public void addKillToLocation(Location location) {
String locationHash = getLocationHash(location);
locationhashes.put(locationHash, locationhashes.getOrDefault(locationHash, 0) + 1);
}
private Location getRandomLocationWithinCircle(Location sourceLocation, double radiusMultiplier) {
final double angle = 2 * Math.PI * ThreadLocalRandom.current().nextDouble();
final double temp = ThreadLocalRandom.current().nextDouble() + ThreadLocalRandom.current().nextDouble();
final double radius = temp > 1 ? radiusMultiplier * (2 - temp) : radiusMultiplier * temp;
return sourceLocation.clone().add(radius * Math.cos(angle), 0, radius * Math.sin(angle));
}
public void increaseHabitationLevels() {
for(String hash : locationhashes.keySet()) {
@ -105,14 +130,16 @@ public class Habitation {
}
}
public String getLocationHash(Location l) {
if (l!=null) {
return (int)(l.getX()/16)+" "+(int)(l.getZ()/16);
} else {
TwosideKeeper.log("[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!", 1);
return "";
}
}
public String getLocationHash(Location location) {
if (location != null) {
return location.getChunk().getX() + ' ' + String.valueOf((int)location.getY() / 16) + ' ' + location.getChunk().getZ() + ' ' + location.getWorld().toString();
} else {
TwosideKeeper.log(
"[ERROR][Habitat]Could not get Location Hash!!! Probably undefined Player->Enemy hit interaction!",
1);
return "";
}
}
public void saveLocationHashesToConfig() {
File file = new File(TwosideKeeper.plugin.getDataFolder()+"/locationhashes.data");
@ -205,4 +232,4 @@ public class Habitation {
return getHabitationStatus(0)+((TwosideKeeper.SERVER_TYPE!=ServerType.MAIN)?locationhashes.get(hash):"");
}
}
}
}

@ -54,6 +54,7 @@ public class LavaPlume {
FallingBlock fallblock = this.lavaplumeloc.clone().getWorld().spawnFallingBlock(this.lavaplumeloc.clone().add(0,1,0), Material.REDSTONE_BLOCK, (byte)0);
fallblock.setMetadata("DESTROY", new FixedMetadataValue(TwosideKeeper.plugin,true));
fallblock.setVelocity(new Vector(0,(float)((Math.random()*2)+1),0));
fallblock.setDropItem(false);
for (Player pl : Bukkit.getOnlinePlayers()) {
GlowAPI.setGlowing(fallblock, GlowAPI.Color.YELLOW, pl);
}

@ -19,9 +19,9 @@ public class TemporaryLava {
public TemporaryLava(Block b, int timer, boolean convert) {
if (convert) {
if (b.getType()==Material.AIR) {
//b.setType(Material.LAVA);
b.setType(Material.LAVA);
b.setData((byte)8);
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,Material.LAVA));
//b.setData((byte)8);
}
}
this.b=b;

@ -25,7 +25,7 @@ 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), 10l);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 2l);
if (p!=null) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if ((pd.lastcompassnotification+(20*20))<TwosideKeeper.getServerTickTime()) {
@ -42,7 +42,7 @@ public class EliteMonsterLocationFinder implements Runnable{
p.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
}
Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE);
MonsterController.convertMonster(m, MonsterDifficulty.ELITE);
MonsterController.convertLivingEntity(m, LivingEntityDifficulty.ELITE);
}
}

@ -248,14 +248,14 @@ public enum LivingEntityDifficulty {
switch (md) {
case DANGEROUS:{
set = ItemSet.ALUSTINE;
}
}break;
case DEADLY:{
set = ItemSet.MOONSHADOW;
}
}break;
case HELLFIRE:
case END:{
set = ItemSet.GLADOMAIN;
}
}break;
default:{
set = ItemSet.WOLFSBANE;
}

@ -16,6 +16,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import aPlugin.DropItem;
import aPlugin.DropMaterial;
import aPlugin.API.Chests;
import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.Drops.SigDrop;
@ -41,19 +42,19 @@ public class Loot {
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,4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,18,"[Normal] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,19,"[Normal] Mega Set Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,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 || TwosideKeeper.CHRISTMASLINGERINGEVENT_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.getCookieItem(),1,3,10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getLargeCandyItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSourCandyItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),10));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasEventToken(),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getChristmasBox(),1));
}
/*aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Hardened Mega Armor",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.NORMAL));
@ -96,17 +97,17 @@ public class Loot {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,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));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getCookieItem(),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.addDrop(new DropItem(Christmas.getCookieItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getLargeCandyItem(),46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSourCandyItem(),1,3,46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getMysteryFlavorLollipopItem(),46600));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),4900));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSweetCandyItem(),4900));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_DANGEROUS.printDrops();
@ -127,12 +128,12 @@ public class Loot {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,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));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),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.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),3900));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,3900));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_DEADLY.printDrops();
@ -152,14 +153,14 @@ public class Loot {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,60,"[Hellfire] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,180,"[Hellfire] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_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.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,3900));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,3900));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasEventToken(),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasBox(),100));
}
aPlugin.API.Chests.LOOT_HELLFIRE.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,1800,"[End] Mega Armor",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.ARMOR,LivingEntityDifficulty.END));
@ -172,9 +173,30 @@ public class Loot {
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Tool",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,60,"[End] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new SigDrop(1,180,"[End] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.END));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,1400));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,1400));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getChristmasEventToken(),200));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Christmas.getChristmasBox(),50));
}
aPlugin.API.Chests.LOOT_CUSTOM.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM_5.setName(ChatColor.RED+"Leader Wither Loot Box");
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,1000,"[Leader Wither] Armor",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropMaterial(Material.NETHER_STAR,70));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,70,"[Leader Wither] Hardened Armor",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,40,"[Leader Wither] Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,40,"[Leader Wither] Tool",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,5,"[Leader Wither] Hardened Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new SigDrop(1,5,"[Leader Wither] Hardened Tool",SigDrop.HARDENED,SigDrop.SET,SigDrop.TOOL,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(aPlugin.API.getChestItem(Chests.ELITE),5));
aPlugin.API.Chests.LOOT_CUSTOM_5.addDrop(new DropItem(Christmas.getChristmasBox(),5));
aPlugin.API.Chests.LOOT_CUSTOM_5.setProbability(0.2);
aPlugin.API.Chests.LOOT_CUSTOM_5.printDrops();
//aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10));
}
@ -406,9 +428,9 @@ public class Loot {
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases duration of Tumble to 3 seconds.");
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Damage Reduction by 20%.");
fakelore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Increases Maximum Health by 20.");
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(128, 64, 0));
}
LeatherArmorMeta lm = (LeatherArmorMeta)sword_meta;
lm.setColor(Color.fromRGB(128, 64, 0));
}break;
case 2: {
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega Darnys Ranger "+GenericFunctions.UserFriendlyMaterialName(mat_type).replace("Leather ", ""));
@ -684,6 +706,7 @@ public class Loot {
m.setDisplayName(set_name);
item.setItemMeta(m);
}
GenericFunctions.ConvertSetColor(item, set);
item = addEnchantments(item,hardened);
return item;
}

@ -1,10 +1,14 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.material.Chest;
import aPlugin.API.Chests;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class BlockUtils {
@SuppressWarnings("deprecation")
public static boolean LocationInFrontOfBlockIsFree(Block b) {
@ -47,4 +51,17 @@ public class BlockUtils {
return null;
}
}
public static void AttemptToPlaceLootChest(Location refloc, int i, int j, int k, Chests chest) {
int tries=0;
while (tries<50) {
Block rand = refloc.getBlock().getRelative((int)(i*((Math.random()*5)+1)), (int)(j*((Math.random()*5)+1)), (int)(k*((Math.random()*5)+1)));
if (GenericFunctions.isNaturalBlock(rand)) {
chest.placeChestAt(rand);
return;
} else {
tries++;
}
}
}
}

@ -204,4 +204,7 @@ public class InventoryUtils {
}
return newlist;
}
public static String getInventoryHash(Inventory destination) {
return destination.getLocation().getX()+destination.getLocation().getY()+destination.getLocation().getZ()+destination.getLocation().getWorld().getName();
}
}

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@ -9,11 +10,15 @@ import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
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;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class ItemUtils {
public static void addLore(ItemStack item, String string) {
@ -133,6 +138,78 @@ public class ItemUtils {
return false;
}
}
/**
* Returns time remaining for the Artifact Dust until auto-rebuild in ticks.
*/
public static long getArtifactDustTimeRemaining(ItemStack item) {
if (isArtifactDust(item)) {
long time = TwosideKeeper.getServerTickTime();
List<String> oldlore = item.getItemMeta().getLore();
for (int i=0;i<oldlore.size();i++) {
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
//See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
return (time+12096000 - TwosideKeeper.getServerTickTime());
}
}
}
return 0;
}
/**
* Set a new amount of time in ticks required before the item will turn from dust back into an artifact.
* Returns a new modified version of the item.
*/
public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) {
if (isArtifactDust(item)) {
long time = TwosideKeeper.getServerTickTime();
List<String> oldlore = item.getItemMeta().getLore();
for (int i=0;i<oldlore.size();i++) {
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
//See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+(TwosideKeeper.getServerTickTime()-newtime+12096000));
}
}
ItemMeta m = item.getItemMeta();
m.setLore(oldlore);
item.setItemMeta(m);
}
return item;
}
/**
* This method will increase/decrease the amount of Artifact Dust Time remaining on the item.
* By providing a negative value for amt, you can make the artifact dust revive sooner, while a positive amount would extend the time required to repair the Artifact Dust.
* <br><br>
* If the negative value provided sets the time remaining of the Artifact Dust to 0 or lower, it will automatically turn into a regular item again!
* <br><br>
* Returns a modified version of the item.
*/
public static void addArtifactDustTime(ItemStack item, long amt) {
if (isArtifactDust(item)) {
long time = TwosideKeeper.getServerTickTime();
List<String> oldlore = item.getItemMeta().getLore();
for (int i=0;i<oldlore.size();i++) {
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
//See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
time += amt;
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
TwosideKeeper.log("Time is "+time, 5);
break;
}
}
ItemMeta meta = item.getItemMeta();
meta.setLore(oldlore);
item.setItemMeta(meta);
if (time+12096000<=TwosideKeeper.getServerTickTime()) {
item = GenericFunctions.convertArtifactDustToItem(item);
}
}
}
public static ItemStack createRandomFirework() {
ItemStack firework = new ItemStack(Material.FIREWORK);

@ -0,0 +1,12 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PlayerStructure;
public class PlayerUtils {
public static boolean PlayerIsInCombat(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
return (pd.target!=null && pd.target.isValid() && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<256);
}
}

@ -50,6 +50,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BiomeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
@ -721,7 +722,7 @@ public class Christmas {
pd.falldamageimmunity=true;
pd.lastusedrocketbooster=TwosideKeeper.getServerTickTime();
removeRocketBoosterCharges(ev.getItem(),1);
p.setVelocity(p.getLocation().getDirection().multiply(6.0f));
if (PlayerUtils.PlayerIsInCombat(p)) {p.setVelocity(p.getLocation().getDirection().multiply(1.25f));} else {p.setVelocity(p.getLocation().getDirection().multiply(6.0f));}
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_FIREWORK_SHOOT, 1.0f, 1.5f);
SoundUtils.playGlobalSound(p.getLocation(), Sound.ENTITY_FIREWORK_LAUNCH, 1.0f, 1.5f);
GenericFunctions.sendActionBarMessage(p, ChatColor.WHITE+"Charges Remaining: "+ChatColor.YELLOW+getRocketBoosterCharges(ev.getItem()), true);

@ -11,7 +11,7 @@ import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class DamageLogger {
HashMap<String,Double> breakdownlist;
public HashMap<String,Double> breakdownlist;
double totaldmg;
double actualtotaldmg=0.0;
double calculatedtotaldmg=0.0;

@ -1,5 +1,6 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -46,16 +47,42 @@ public class HellfireGhast extends CustomMonster{
public void runTick() {
double pcthealth = m.getHealth()/m.getMaxHealth();
if (pcthealth<=0.2 && target!=null) {
if (pcthealth<=0.2) {
//Begin charging towards player.
m.setAI(false);
m.setVelocity(MovementUtils.moveTowardsLocation(m.getLocation(), target.getLocation(), 2));
if (target!=null && target.isValid() && !target.isDead() && target.getWorld().equals(m.getWorld())) {
m.setVelocity(MovementUtils.moveTowardsLocation(m.getLocation(), target.getLocation(), 2));
} else {
target = FindClosestNearbyTarget();
if (target!=null) {
m.setVelocity(MovementUtils.moveTowardsLocation(m.getLocation(), target.getLocation(), 2));
}
}
if (m.getLocation().distanceSquared(target.getLocation())<49) {
explode();
}
} else {
m.setAI(true);
if (getTarget()==null) {
if (m.getKiller()!=null) {
setTarget(m.getKiller());
} else {
Player p = FindClosestNearbyTarget();
}
}
}
}
private Player FindClosestNearbyTarget() {
Player closestplayer=null;
double dist=999999;
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getWorld().equals(m.getWorld()) && p.getLocation().distance(m.getLocation())<dist) {
dist=p.getLocation().distance(m.getLocation());
closestplayer=p;
}
}
return closestplayer;
}
private void explode() {

@ -0,0 +1,106 @@
package sig.plugin.TwosideKeeper.Monster;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import sig.plugin.TwosideKeeper.ChargeZombie;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class Wither extends CustomMonster{
private long lastSkullShot = 0;
private long lastWitherSkeletonSpawned=0;
private long stuckTimer=0;
private Location lastLoc = null;
public Wither(LivingEntity m) {
super(m);
this.lastSkullShot=TwosideKeeper.getServerTickTime();
}
public long getLastSkullShot() {
return lastSkullShot;
}
public void resetLastSkullShot() {
this.lastSkullShot = TwosideKeeper.getServerTickTime();
}
public void runTick() {
if (m instanceof Monster) {
if (((Monster) m).getTarget()!=null) {
ChargeZombie.BreakBlocksAroundArea((Monster)m, 2);
}
if (lastLoc!=null && lastLoc.distance(m.getLocation())<=0.4) {
stuckTimer++;
//TwosideKeeper.log("Stuck. "+stuckTimer, 0);
} else {
stuckTimer=0;
}
lastLoc = m.getLocation().clone();
if (stuckTimer>5) {
//Teleport randomly.
double numb = Math.random();
if (numb<=0.33) {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(Math.random()*10-5,0,0));
} else
if (numb<=0.33) {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(0,0,Math.random()*10-5));
} else
{
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(0,Math.random()*10-5,0));
}
stuckTimer=0;
}
if (m.getHealth()<m.getMaxHealth()) {
m.setHealth(Math.min(m.getMaxHealth(), m.getHealth()+5));
}
if (m.getLocation().getY()>=128) {
m.teleport(m.getLocation().add(0,-32,0));
}
if (m.getHealth()<86000 && lastWitherSkeletonSpawned+40<TwosideKeeper.getServerTickTime() &&
GenericFunctions.GetNearbyMonsterCount(m, 32)<50) {
lastWitherSkeletonSpawned = TwosideKeeper.getServerTickTime();
Skeleton ws = (Skeleton)m.getWorld().spawnEntity(m.getLocation(), EntityType.SKELETON);
ws.setSkeletonType(SkeletonType.WITHER);
MonsterController.convertLivingEntity(ws, LivingEntityDifficulty.HELLFIRE);
ws.setMaxHealth(ws.getMaxHealth()*6);
ws.setHealth(ws.getMaxHealth());
ws.setCustomName(ChatColor.RED+"Hellfire Wither Skeleton Minion");
if (((Monster) m).getTarget()!=null && ((Monster) m).getTarget().isValid() &&
!((Monster) m).getTarget().isDead()) {
ws.setTarget(((Monster) m).getTarget());
} else {
ws.setTarget(FindClosestNearbyTarget());
}
}
}
}
private Player FindClosestNearbyTarget() {
Player closestplayer=null;
double dist=999999;
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getWorld().equals(m.getWorld()) && p.getLocation().distance(m.getLocation())<dist) {
dist=p.getLocation().distance(m.getLocation());
closestplayer=p;
}
}
return closestplayer;
}
}

@ -978,16 +978,16 @@ public class MonsterController {
SetupCustomName(ChatColor.DARK_PURPLE+"Elite",m);
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
//m.setCustomNameVisible(true);
m.setMaxHealth(4800);
m.setMaxHealth(48000);
m.setHealth(m.getMaxHealth());
if (isAllowedToEquipItems(m)) {
m.getEquipment().clear();
RandomizeEquipment(m,4);
}
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
//m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,8));
if (!GenericFunctions.isArmoredMob(m)) {
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
//m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
m.setMaxHealth(m.getMaxHealth()*2.0);
}
m.setCustomNameVisible(true);
@ -1305,4 +1305,18 @@ public class MonsterController {
}
return false;
}
public static void HandleWitherSpawn(LivingEntity ent) {
//TODO Make Elites spawn at this Y level later.
/*if (ent.getLocation().getY()<54) {
} else */ {
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(ent);
les.SetLeader(true);
les.m.setMaxHealth(480000);
les.m.setHealth(les.m.getMaxHealth());
if (les.m.getLocation().getY()>=128) {
les.m.teleport(les.m.getLocation().add(0,-32,0));
}
}
}
}

@ -20,33 +20,17 @@ 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.
AddPlayerToParty(p,totalparties++);
//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());
}
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.
AddPlayerToParty(p,totalparties++);
//Now find nearby players and add them to this party.
AddNearbyPlayersToSameParty(p);
}
}
UpdatePartyScoreboards();
}
private static boolean PlayersAreNearby(Player sourcep) {
for (Player checkp : Bukkit.getOnlinePlayers()) {
if (!sourcep.equals(checkp) && sourcep.getWorld().equals(checkp.getWorld()) && 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)) {
@ -90,7 +74,7 @@ public class PartyManager {
int membercount = partymembers.size();
StringBuilder partydisplay = new StringBuilder("");
if (membercount>=2) {
int dmgbonus=((membercount-1)<6)?(membercount-1)*10:60;
int dmgbonus=((membercount-1)<=6)?(membercount-1)*10:60;
partydisplay.append(" +"+dmgbonus+"%DMG/DEF");
}
return partydisplay.toString();
@ -241,11 +225,6 @@ 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;
}
}
}
return parties.get(partynumb);
}
}

@ -141,6 +141,7 @@ public class PlayerStructure {
public long lastrevivecandyconsumed = TwosideKeeper.getServerTickTime();
public long icewandused = TwosideKeeper.getServerTickTime();
public PlayerMode playermode_on_death=PlayerMode.NORMAL;
public long lastusedearthwave = TwosideKeeper.getServerTickTime();
public long iframetime = 0;

@ -358,4 +358,12 @@ public class Recipes {
}
return new ItemStack(Material.TIPPED_ARROW);
}
public static void Initialize_NewRedstoneLamp_Recipe() {
ItemStack newredstonelamp = new ItemStack(Material.REDSTONE_LAMP_ON);
ShapelessRecipe recipe = new ShapelessRecipe(newredstonelamp);
recipe.addIngredient(4,Material.REDSTONE);
recipe.addIngredient(4,Material.GLOWSTONE_DUST);
recipe.addIngredient(Material.OBSIDIAN);
Bukkit.addRecipe(recipe);
}
}

@ -26,6 +26,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.WorldCreator;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
@ -56,10 +57,12 @@ 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.Slime;
import org.bukkit.entity.SmallFireball;
import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -70,6 +73,9 @@ import org.bukkit.entity.Snowman;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Witch;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkull;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
@ -78,6 +84,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
@ -177,6 +184,7 @@ 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 net.minecraft.server.v1_9_R1.MinecraftServer;
import sig.plugin.AutoPluginUpdate.AnnounceUpdateEvent;
import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem;
@ -275,7 +283,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static Location ELITE_LOCATION = null;
public static boolean LOOT_TABLE_NEEDS_POPULATING=true;
public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
public static Set<Inventory> notWorldShop = new HashSet<Inventory>();
public static Set<String> notWorldShop = new HashSet<String>();
public static List<Entity> suppressed_entities = new ArrayList<Entity>();
public static List<LavaPlume> lavaplume_list = new ArrayList<LavaPlume>();
@ -462,7 +470,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static List<Material> validsetitems = new ArrayList<Material>();
public final static boolean CHRISTMASEVENT_ACTIVATED=false;
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=true; //Limited Christmas drops/functionality remain while the majority of it is turned off.
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false; //Limited Christmas drops/functionality remain while the majority of it is turned off.
public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of(
EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN,
@ -537,7 +545,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideShops.SaveWorldShopData(newshop);
WorldShop.spawnShopItem(current_session.GetSign().getLocation(), newshop);
Chest c = (Chest)WorldShop.getBlockShopSignAttachedTo(current_session.GetSign()).getState();
notWorldShop.remove(c.getInventory());
notWorldShop.remove(InventoryUtils.getInventoryHash(c.getInventory()));
TwosideShops.RemoveSession(ev.getPlayer());
}
}
@ -561,7 +569,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
WorldShop newshop = TwosideShops.CreateWorldShop(current_session.GetSign(), current_session.getItem(), current_session.getAmt(), Double.parseDouble(df.format(amt)), ev.getPlayer().getName());
WorldShop.spawnShopItem(current_session.GetSign().getLocation(), newshop);
Chest c = (Chest)WorldShop.getBlockShopSignAttachedTo(current_session.GetSign()).getState();
notWorldShop.remove(c.getInventory());
notWorldShop.remove(InventoryUtils.getInventoryHash(c.getInventory()));
TwosideShops.SaveWorldShopData(newshop);
//RemoveItemAmount(ev.getPlayer(), current_session.getItem(), current_session.getAmt()); //We now handle items via chest.
TwosideShops.RemoveSession(ev.getPlayer());
@ -768,6 +776,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Recipes.Initialize_HunterCompass_Recipe();
Recipes.Initialize_CustomArrow_Recipes();
Recipes.Initialize_NotchApple_Recipe();
Recipes.Initialize_NewRedstoneLamp_Recipe();
Bukkit.createWorld(new WorldCreator("FilterCube"));
@ -985,6 +994,87 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
sender.sendMessage(Loot_Logger.GenerateReport());
return true;
} else
if (cmd.getName().equalsIgnoreCase("debugreport")) {
sender.sendMessage(ChatColor.YELLOW+"Server Structure Statistics");
if (args.length==0) {
double tps = MinecraftServer.getServer().recentTps[0];
int sno = SnowmanHuntList.size();
int pla = playerdata.size();
int liv = livingentitydata.size();
int log = log_messages.size();
int tem = temporary_lava_list.size();
int tem2 = temporary_ice_list.size();
int tem3 = temporary_chunks.size();
int blo = blockqueue.size();
int job = jobrecipes.size();
int col = colors_used.size();
int cha = chargezombies.size();
int cus = custommonsters.size();
int eli = elitemonsters.size();
int ban = banksessions.size();
int wea = weather_watch_users.size();
int val = validsetitems.size();
int tem4 = TEMPORARYABILITIES.size();
int not = notWorldShop.size();
int sup = suppressed_entities.size();
int lav = lavaplume_list.size();
int loc = habitat_data.locationhashes.size();
int sta = habitat_data.startinglocs.size();
int spl = TwosideSpleefGames.spleef_game_list.size();
int nod = TwosideRecyclingCenter.nodes.size();
int ite = TwosideRecyclingCenter.itemmap.size();
HashMap<Player,Integer> ope = GetFullStructureMap("ope");
HashMap<Player,Integer> dam = GetFullStructureMap("dam");
HashMap<Player,Integer> dea = GetFullStructureMap("dea");
HashMap<Player,Integer> hit = GetFullStructureMap("hit");
HashMap<Player,Integer> ite2 = GetFullStructureMap("ite");
HashMap<Player,Integer> las = GetFullStructureMap("las");
HashMap<Player,Integer> blo2 = GetFullStructureMap("blo2");
DecimalFormat df = new DecimalFormat("0.00");
sender.sendMessage(ChatColor.WHITE+"TPS: "+GetTPSColor(tps)+df.format(tps));
sender.sendMessage(ChatColor.WHITE+Display("SNO",sno)+Display("PLA",pla)+Display("LIV",liv));
sender.sendMessage(ChatColor.WHITE+Display("LOG",log)+Display("TEM",tem)+Display("TEM2",tem2));
sender.sendMessage(ChatColor.WHITE+Display("TEM3",tem3)+Display("BLO",blo)+Display("JOB",job));
sender.sendMessage(ChatColor.WHITE+Display("COL",col)+Display("CHA",cha)+Display("CUS",cus));
sender.sendMessage(ChatColor.WHITE+Display("ELI",eli)+Display("BAN",ban)+Display("WEA",wea));
sender.sendMessage(ChatColor.WHITE+Display("VAL",val)+Display("TEM4",tem4)+Display("NOT",not));
sender.sendMessage(ChatColor.WHITE+Display("SUP",sup)+Display("LAV",lav)+Display("LOC",loc));
sender.sendMessage(ChatColor.WHITE+Display("STA",sta)+Display("SPL",spl)+Display("NOD",nod));
sender.sendMessage(ChatColor.WHITE+Display("ITE",ite)+Display("P-OPE",ope.size())+Display("P-DAM",dam.size()));
sender.sendMessage(ChatColor.WHITE+Display("P-DEA",dea.size())+Display("P-HIT",hit.size())+Display("P-ITE2",ite2.size()));
sender.sendMessage(ChatColor.WHITE+Display("P-LAS",las.size())+Display("P-BLO2",blo2.size()));
sender.sendMessage(ChatColor.WHITE+DisplayPlayerBar());
sender.sendMessage(ChatColor.WHITE+"To view a specific player's usage, use "+ChatColor.GREEN+"\"/debugreport <name>\"");
sender.sendMessage(ChatColor.WHITE+"To view specific entities' usage, use "+ChatColor.GREEN+"\"/debugreport ALLENTS\"");
} else {
if (args[0].equalsIgnoreCase("ALLENTS")) {
sender.sendMessage("Individual Structures for all Living Entities:");
int count=0;
StringBuilder line = new StringBuilder("");
for (LivingEntityStructure ent : TwosideKeeper.livingentitydata.values()) {
line.append("["+count+"]"+GenericFunctions.GetEntityDisplayName(ent.m)+":"+Display("H",ent.hitlist.size())+Display("G",ent.glowcolorlist.size())+" ");
count++;
if (count % 3 == 0) {
sender.sendMessage(line.toString());
line = new StringBuilder("");
}
}
} else {
if (Bukkit.getPlayer(args[0])!=null) {
Player pl = Bukkit.getPlayer(args[0]);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(pl);
sender.sendMessage("Individual Structures for player "+ChatColor.YELLOW+pl.getName()+ChatColor.RESET+":");
sender.sendMessage(ChatColor.WHITE+Display("OPE",pd.openeditemcube.size())+Display("DAM",pd.damagedata.breakdownlist.size())+Display("DEA",pd.deathloot.size()));
sender.sendMessage(ChatColor.WHITE+Display("HIT",pd.hitlist.size())+Display("ITE",pd.itemcubelist.size())+Display("LAS",pd.lasteffectlist.size()));
sender.sendMessage(ChatColor.WHITE+Display("BLO",pd.blockscanlist.size()));
} else {
sender.sendMessage("Could not find player "+ChatColor.YELLOW+args[0]+ChatColor.RESET+"!");
}
}
}
return true;
}
else
if (cmd.getName().equalsIgnoreCase("stats")) {
if (args.length>=1) {
if (args[0].equalsIgnoreCase("equip")) {
@ -1086,10 +1176,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ArrowQuiver.updateQuiverLore(quiver);
}break;
case "WITHER":{
LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.WITHER), MonsterDifficulty.ELITE);
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.WITHER), MonsterDifficulty.ELITE);
Wither w = (Wither)p.getWorld().spawnEntity(p.getLocation(), EntityType.WITHER);
w.setHealth(10);
}break;
case "ELITE":{
LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
LivingEntity m = MonsterController.convertLivingEntity((LivingEntity)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), LivingEntityDifficulty.ELITE);
}break;
case "VACUUM":{
ItemStack[] remaining = InventoryUtils.insertItemsInVacuumCube(p, new ItemStack(Material.ENDER_PEARL,16), new ItemStack(Material.IRON_PICKAXE,1), new ItemStack(Material.GOLDEN_APPLE,64));
@ -1364,6 +1456,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ItemStack remaining = ItemCubeUtils.removeItemFromSlot(Integer.parseInt(args[1]), Integer.parseInt(args[2]));
p.sendMessage("Removed "+GenericFunctions.UserFriendlyMaterialName(remaining));
}break;
case "ADDDUSTTIME":{
ItemUtils.addArtifactDustTime(p.getEquipment().getItemInMainHand(), Integer.parseInt(args[1]));
}break;
case "SETDUSTTIME":{
ItemUtils.setArtifactDustTimeRemaining(p.getEquipment().getItemInMainHand(), Integer.parseInt(args[1]));
}break;
case "GETDUSTTIME":{
p.sendMessage(""+ItemUtils.getArtifactDustTimeRemaining(p.getEquipment().getItemInMainHand()));
}break;
case "GLOWINGBLOCK":{
FallingBlock fb = p.getWorld().spawnFallingBlock(p.getLocation(), p.getLocation().getBlock().getRelative(0, -1, 0).getType(), p.getLocation().getBlock().getRelative(0, -1, 0).getData());
GlowAPI.setGlowing(fb, GlowAPI.Color.BLUE, Bukkit.getOnlinePlayers());
fb.setMetadata("BREAKDOWN", new FixedMetadataValue(TwosideKeeper.plugin,true));
fb.setDropItem(false);
}break;
}
}
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
@ -1750,33 +1857,48 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else
if (cmd.getName().equalsIgnoreCase("ready")) {
Player p = (Player)sender;
switch (InventoryUtils.onlyHoldingFiveDirtBlocks(p)) {
case HOLDING5DIRT:{
if (CHRISTMASEVENT_ACTIVATED) {
switch (InventoryUtils.onlyHoldingFiveDirtBlocks(p)) {
case HOLDING5DIRT:{
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.GREEN+"READY"+".");
}break;
case NOTEMPTYINVENTORY:
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.");
break;
case NOTENOUGHDIRT:
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
break;
case TOOMUCHDIRT:
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
break;
}
} else {
if (args.length>0) {
Bukkit.broadcastMessage(p.getName()+" has issued a ready check. Type "+ChatColor.YELLOW+"/ready"+ChatColor.RESET+" to announce when you are ready.");
} else {
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.GREEN+"READY"+".");
}
}
return true;
} else
if (cmd.getName().equalsIgnoreCase("red")) {
Player p = (Player)sender;
if (CHRISTMASEVENT_ACTIVATED) {
if (InventoryUtils.onlyHoldingRacingItems(p)) {
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.GREEN+"READY"+".");
}break;
case NOTEMPTYINVENTORY:
} 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.");
break;
case NOTENOUGHDIRT:
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
break;
case TOOMUCHDIRT:
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
break;
}
}
}
return true;
} else
if (cmd.getName().equalsIgnoreCase("red")) {
if (cmd.getName().equalsIgnoreCase("habitat")) {
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.");
}
p.sendMessage(aPlugin.API.getHabitatMap(p, 7));
return true;
}
} else {
@ -1784,8 +1906,103 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
return false;
}
private String DisplayPlayerBar() {
StringBuilder str = new StringBuilder();
for (Player p : Bukkit.getOnlinePlayers()) {
str.append(GDC(GetTotalStructureSize(p))+p.getName().substring(0, 1).toUpperCase());
}
return str.toString();
}
private int GetTotalStructureSize(Player p) {
int totalsize = 0;
totalsize+=PlayerStructure.GetPlayerStructure(p).openeditemcube.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).deathloot.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).hitlist.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).itemcubelist.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).lasteffectlist.size();
totalsize+=PlayerStructure.GetPlayerStructure(p).blockscanlist.size();
return totalsize;
}
private HashMap<Player, Integer> GetFullStructureMap(String string) {
HashMap<Player,Integer> newmap = new HashMap<Player,Integer>();
for (Player p : Bukkit.getOnlinePlayers()) {
switch (string) {
case "ope":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).openeditemcube.size());
}break;
case "dam":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size());
}break;
case "dea":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).deathloot.size());
}break;
case "hit":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).hitlist.size());
}break;
case "ite":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).itemcubelist.size());
}break;
case "las":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).lasteffectlist.size());
}break;
case "blo":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).blockscanlist.size());
}break;
}
}
return newmap;
}
private String Display(String symbol,int val) {
return symbol+":"+GDC(val)+val+ChatColor.RESET+" ";
}
private void RemoveUserFromWeatherWatch(Player p) {
//Stands for "Get Display Color"
private ChatColor GDC(int val) {
if (val>=10000) {
return ChatColor.DARK_RED;
} else
if (val>=2500) {
return ChatColor.RED;
} else
if (val>=1000) {
return ChatColor.GOLD;
} else
if (val>=250) {
return ChatColor.YELLOW;
} else
if (val>=100) {
return ChatColor.GREEN;
} else
{
return ChatColor.AQUA;
}
}
private ChatColor GetTPSColor(double tps) {
if (tps>=19) {
return ChatColor.DARK_GREEN;
} else
if (tps>=17) {
return ChatColor.GREEN;
} else
if (tps>=14) {
return ChatColor.YELLOW;
} else
if (tps>=11) {
return ChatColor.GOLD;
} else
if (tps>=8) {
return ChatColor.RED;
} else
{
return ChatColor.DARK_RED;
}
}
private void RemoveUserFromWeatherWatch(Player p) {
weather_watch_users.remove(p.getName());
}
private void AddUserToWeatherWatch(Player p) {
@ -1954,6 +2171,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Update player max health. Check equipment too.
setPlayerMaxHealth(ev.getPlayer());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard players set "+ev.getPlayer().getName()+" Deaths "+ev.getPlayer().getStatistic(Statistic.DEATHS));
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.GLOWING,ev.getPlayer());
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.NIGHT_VISION,ev.getPlayer());
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix(createHealthbar(((ev.getPlayer().getHealth())/ev.getPlayer().getMaxHealth())*100,ev.getPlayer()));
@ -1996,7 +2214,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Make sure to save the config for this player.
pd.saveConfig();
playerdata.remove(ev.getPlayer().getUniqueId());
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players reset "+ev.getPlayer().getName().toLowerCase());
//Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players reset "+ev.getPlayer().getName().toLowerCase());
log("[TASK] Player Data for "+ev.getPlayer().getName()+" has been removed. Size of array: "+playerdata.size(),4);
}
@ -2839,7 +3057,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (GenericFunctions.isArtifactEquip(weapon) &&
weapon.toString().contains("SPADE")) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, weapon) &&
pd.last_shovelspell<TwosideKeeper.getServerTickTime()) {
pd.lastusedearthwave+10<TwosideKeeper.getServerTickTime()) {
dmg = GenericFunctions.getAbilityValue(ArtifactAbility.EARTHWAVE, weapon);
int falldist = 0;
Location checkloc = p.getLocation().clone();
@ -2848,6 +3066,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
if (falldist>1) {
//Now that we have the fall distance, create an Earth Wave around us the size of falldist/2.
//Teleport the player to the location we'd fall from.
Location snaploc = p.getLocation().getBlock().getLocation().clone();
snaploc.setPitch(p.getLocation().getPitch());
snaploc.setYaw(p.getLocation().getYaw());
p.teleport(snaploc.add(0.5,0,0.5));
p.setFlying(false);
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, falldist, -124, p, true);
p.setVelocity(new Vector(0,-50,0));
double vel = Math.pow(falldist, 0.2);
@ -2863,6 +3087,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
/*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p));
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/
pd.lastusedearthwave=TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.05+5));
for (int x=-1;x<2;x++) {
for (int z=-1;z<2;z++) {
if (x!=0 && z!=0) {
Location newblock = checkloc.clone();
if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) {
TwosideKeeper.log("NOT SOFT!", 0);
aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.01+1));
}
}
}
}
}
}
}
@ -3829,6 +4066,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "Damage Pool": {
return Pronouns.ChoosePronoun(18);
}
case "Orni": {
return "was killed by merely existing.";
}
default:{
return "has died by "+pd.lasthitdesc;
}
@ -3965,6 +4205,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void onFallingBlock(EntityChangeBlockEvent ev) {
if (ev.getEntity() instanceof FallingBlock) {
FallingBlock fb = (FallingBlock)ev.getEntity();
//TwosideKeeper.log("In here.", 0);
if (fb.hasMetadata("BREAKDOWN")) {
ev.setCancelled(true);
FallingBlock fb2 = fb.getWorld().spawnFallingBlock(fb.getLocation().getBlock().getLocation(), fb.getBlockId(), fb.getBlockData());
GlowAPI.setGlowing(fb2, GlowAPI.Color.BLUE, Bukkit.getOnlinePlayers());
fb2.setMetadata("BREAKDOWN", new FixedMetadataValue(TwosideKeeper.plugin,true));
fb2.setDropItem(false);
//TwosideKeeper.log("Spawn new block", 0);
}
if (fb.hasMetadata("FAKE")) {
final Block b = ev.getBlock();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@ -5073,6 +5322,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Setting a monster with Difficulty "+MonsterController.getMonsterDifficulty((Monster)m).name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
ms.SetLeader(true);
}
if (m instanceof Wither) {
ms.SetLeader(true);
}
}
}
@ -5094,6 +5346,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
convertToStrongerShulker(ev.getEntity());
}
if (ev.getEntity() instanceof Wither) {
MonsterController.HandleWitherSpawn(ev.getEntity());
return;
}
if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) ||
ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) ||
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) ||
@ -5183,6 +5440,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void playerGetAchievementEvent(PlayerAchievementAwardedEvent ev) {
final Player p = ev.getPlayer();
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setSuffix("");
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setPrefix("");
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (p!=null) {
@ -5714,6 +5972,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if ((ev.getEntity() instanceof Monster)) {
log("In here 1",5);
Monster m = (Monster)ev.getEntity();
if (ev.getTarget() instanceof Wither) {
ev.setCancelled(true);
return; //Monsters will not target the Wither, even with friendly fire.
}
if (m.hasPotionEffect(PotionEffectType.GLOWING)) {
ev.setCancelled(true);
return;
@ -5808,6 +6072,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Make them move in a direction violently and spontaneously.
}
}
@EventHandler
public void witherBlockEatingCanceller(EntityChangeBlockEvent event)
{
EntityType entityType = event.getEntity().getType();
if (entityType == EntityType.WITHER) {
event.setCancelled(true);
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void monsterDeathEvent(final EntityDeathEvent ev) {
@ -5860,7 +6133,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
if (ms!=null && (ms.GetTarget() instanceof Player)) {
habitat_data.addKillToLocation(m);
if ((m instanceof Slime) ||
(m instanceof MagmaCube)) {
if (m instanceof Slime) {
Slime ss = (Slime)m;
if (ss.getSize()>=4) {
habitat_data.addKillToLocation(m);
}
} else {
MagmaCube mm = (MagmaCube)m;
if (mm.getSize()>=4) {
habitat_data.addKillToLocation(m);
}
}
} else {
habitat_data.addKillToLocation(m);
}
habitat_data.startinglocs.remove(m.getUniqueId());
log("Killed by a player.",5);
killedByPlayer = true;
@ -5906,11 +6194,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (m instanceof Monster) {
isBoss=GenericFunctions.isBossMonster((Monster)m);
isElite=GenericFunctions.isEliteMonster((Monster)m);
if (m instanceof LivingEntity) {
isBoss=GenericFunctions.isBossMonster(m);
isElite=GenericFunctions.isEliteMonster(m);
if (killedByPlayer && GenericFunctions.isCoreMonster((Monster)m) && Math.random()<RARE_DROP_RATE*dropmult*ARTIFACT_RARITY) {
if (killedByPlayer && GenericFunctions.isCoreMonster(m) && Math.random()<RARE_DROP_RATE*dropmult*ARTIFACT_RARITY) {
switch ((int)(Math.random()*4)) {
case 0:{
droplist.add(Artifact.createArtifactItem(ArtifactItem.LOST_CORE));
@ -5926,6 +6214,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}break;
}
}
if (isBoss && Math.random()<=0.5) {
LivingEntityDifficulty diff = MonsterController.getLivingEntityDifficulty(m);
switch (diff) {
case DANGEROUS:
droplist.add(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE));
break;
case DEADLY:
droplist.add(Artifact.createArtifactItem(ArtifactItem.LOST_CORE));
break;
case ELITE:
droplist.add(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
break;
case END:
droplist.add(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
break;
case HELLFIRE:
droplist.add(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
break;
default:
droplist.add(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE));
}
}
}
if (killedByPlayer) {
@ -6029,7 +6340,26 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (isElite) {
if (m instanceof Wither) {
GenericFunctions.spawnXP(m.getLocation().add(5,0,5), 25000);
GenericFunctions.spawnXP(m.getLocation().add(-5,0,-5), 25000);
GenericFunctions.spawnXP(m.getLocation().add(-5,0,5), 25000);
GenericFunctions.spawnXP(m.getLocation().add(5,0,-5), 25000);
//Spawn 8 chests at different quadrants.
AttemptToPlaceChest(m.getLocation(),-1,-1,-1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),1,-1,-1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),1,-1,1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),-1,-1,1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),-1,1,-1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),-1,1,1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),1,1,-1,aPlugin.API.Chests.LOOT_CUSTOM_5);
AttemptToPlaceChest(m.getLocation(),1,1,1,aPlugin.API.Chests.LOOT_CUSTOM_5);
}
if (isElite && m instanceof Monster) {
dropmult+=50;
EliteMonster em = GenericFunctions.getEliteMonster((Monster)m);
//For each target, drop additional loot and exp.
@ -6040,6 +6370,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (pl!=null && pl.isOnline()) {
ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300);
exp.setInvulnerable(true);
if (m instanceof Zombie) {
Zombie z = (Zombie)m;
if (z.isBaby()) {
GenericFunctions.giveItem(pl,aPlugin.API.getChestItem(Chests.ELITE));
}
}
GenericFunctions.giveItem(pl,aPlugin.API.getChestItem(Chests.ELITE));
log("Dropping "+aPlugin.API.getChestItem(Chests.ELITE).toString(),2);
if (participants_list.length()<1) {
@ -6125,7 +6461,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer.getLocation().getBlockY()<48) {
if (!mer.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer.getLocation().getBlockY()<48) {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 3.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 3);
} else {
@ -6156,7 +6492,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer1.getLocation().getBlockY()<48) {
if (!mer1.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer1.getLocation().getBlockY()<48) {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 5);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),2);
@ -6189,7 +6525,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer4.getLocation().getBlockY()<48) {
if (!mer4.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer4.getLocation().getBlockY()<48) {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 150, 5);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2);
@ -6236,7 +6572,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
private void AwardDeathAchievements(Player p, LivingEntity entity) {
private void AttemptToPlaceChest(Location refloc, int i, int j, int k, Chests chest) {
int tries=0;
while (tries<50) {
Block rand = refloc.getBlock().getRelative((int)(i*((Math.random()*4)+1)), (int)(j*((Math.random()*4)+1)), (int)(k*((Math.random()*4)+1)));
if (GenericFunctions.isNaturalBlock(rand)) {
chest.placeChestAt(rand);
for (int x=-1;x<2;x++) {
for (int y=-1;y<2;y++) {
for (int z=-1;z<2;z++) {
if (x!=0 || y!=0 || z!=0) {
if (GenericFunctions.isNaturalBlock(rand.getRelative(x, y, z))) {
rand.getRelative(x, y, z).setType(Material.AIR);
}
}
}
}
}
return;
} else {
tries++;
}
}
}
private Chest SpawnALootChest(int i, int j, int k) {
// TODO Auto-generated method stub
return null;
}
private void AwardDeathAchievements(Player p, LivingEntity entity) {
if (p.hasAchievement(Achievement.BUILD_SWORD) && (entity instanceof Monster) && !p.hasAchievement(Achievement.KILL_ENEMY)) {
p.awardAchievement(Achievement.KILL_ENEMY);
}
@ -6248,6 +6611,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void updateHealthbarRespawnEvent(PlayerRespawnEvent ev) {
final Player p = ev.getPlayer();
//ev.setRespawnLocation(new Location(Bukkit.getWorld("world"),Math.random()*2000-1000,72,Math.random()*2000-1000));
//TwosideKeeper.log("Player Location: "+p.getLocation(), 0);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.deathloc_world=p.getWorld().getName();
pd.deathloc_x=p.getLocation().getX();
pd.deathloc_y=p.getLocation().getY();
pd.deathloc_z=p.getLocation().getZ();
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (p!=null) {
@ -6279,7 +6648,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
newloc.setY(newloc.getWorld().getHighestBlockYAt(ev.getRespawnLocation()));
ev.setRespawnLocation(newloc.add(0,10,0));
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastdeath=getServerTickTime();
pd.hasDied=false;
pd.slayermodehp=10;
@ -6287,9 +6656,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
pd.weaponcharges=0;
//log("Block started on is "+ev.getRespawnLocation().getBlock(),2);
//p.teleport(GenericFunctions.FindRandomFreeLocation(p.getLocation().add(0,1,0)));
Location newloc = ev.getRespawnLocation();
/*Location newloc = ev.getRespawnLocation();
newloc.setY(newloc.getWorld().getHighestBlockYAt(ev.getRespawnLocation()));
ev.setRespawnLocation(newloc.add(0,10,0));
ev.setRespawnLocation(newloc.add(0,10,0));*/
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -6332,6 +6701,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ItemStack test = GenericFunctions.breakHardenedItem(item,p);
if (test!=null) {
//We have to give this player the item!
TwosideKeeper.log("We have to give this player the item", 0);
GenericFunctions.giveItem(p, test);
}
breakdownItem(item,p);
@ -6392,62 +6762,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log(p.getName()+" has broken block "+GenericFunctions.UserFriendlyMaterialName(new ItemStack(ev.getBlock().getType())),3);
if (GenericFunctions.isTool(p.getEquipment().getItemInMainHand())) {
GenericFunctions.RemovePermEnchantmentChance(p.getEquipment().getItemInMainHand(), p);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()) &&
pd.target!=null && !pd.target.isDead() && pd.last_shovelspell<getServerTickTime()) {
/*if (pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())<=256) {
final Player p1 = p;
AreaEffectCloud lp = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD);
lp.setColor(Color.OLIVE);
DecimalFormat df = new DecimalFormat("0.00");
lp.setCustomName("EW "+df.format(GenericFunctions.getAbilityValue(ArtifactAbility.EARTHWAVE, p.getEquipment().getItemInMainHand()))+" "+p.getName());
lp.setRadius(3f);
lp.setDuration(80);
lp.setReapplicationDelay(20);
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
lp.setParticle(Particle.SMOKE_NORMAL);
SoundUtils.playLocalSound(p, Sound.ENTITY_SHULKER_SHOOT, 1.0f, 0.5f);
pd.last_shovelspell=getServerTickTime()+EARTHWAVE_COOLDOWN;
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 300);
int mult=2;
double xspd=p.getLocation().getDirection().getX()*mult;
double yspd=p.getLocation().getDirection().getY()/2;
double zspd=p.getLocation().getDirection().getZ()*mult;
double xpos=p.getLocation().getX();
double ypos=p.getLocation().getY();
double zpos=p.getLocation().getZ();
int range=8;
final String customname = lp.getCustomName();
for (int i=0;i<range;i++) {
final int tempi=i;
final Location newpos=new Location(p.getWorld(),xpos,ypos,zpos).add(i*xspd,i*yspd,i*zspd);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
AreaEffectCloud lp = (AreaEffectCloud)newpos.getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD);
lp.setColor(Color.OLIVE);
lp.setCustomName(customname);
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
lp.setRadius(3f);
lp.setDuration(80);
lp.setReapplicationDelay(20);
lp.setBasePotionData(new PotionData(PotionType.INSTANT_DAMAGE));
if (tempi%2==0) {
lp.setParticle(Particle.SMOKE_LARGE);} else {
lp.setParticle(Particle.SMOKE_NORMAL);
}
p1.playSound(lp.getLocation(), Sound.ENTITY_CAT_HISS, 1.0f, 0.3f);
}
},i*16);
}
} else {
pd.target=null;
}*/
}
}
}
if (ev.getBlock().getType()==Material.CHEST ||
ev.getBlock().getType()==Material.TRAPPED_CHEST) {
Chest cc = (Chest)ev.getBlock().getState();
TwosideKeeper.notWorldShop.remove(InventoryUtils.getInventoryHash(cc.getInventory()));
}
if (ev.getBlock().getType()==Material.WALL_SIGN ||
ev.getBlock().getType()==Material.CHEST ||
ev.getBlock().getType()==Material.TRAPPED_CHEST) {
@ -6911,14 +7234,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onHopperSuction(InventoryMoveItemEvent ev) {
if (notWorldShop.contains(ev.getDestination()) || notWorldShop.contains(ev.getSource())) {
if (notWorldShop.contains(InventoryUtils.getInventoryHash(ev.getDestination())) || notWorldShop.contains(InventoryUtils.getInventoryHash(ev.getSource()))) {
return;
}
Inventory source = ev.getSource();
Inventory destination = ev.getDestination();
if ((source.getHolder() instanceof HopperMinecart) || source.getLocation().getBlock().getType()==Material.HOPPER) {
//log("In here 1",2);
if (notWorldShop.contains(destination)) {
if (notWorldShop.contains(InventoryUtils.getInventoryHash(destination))) {
return;
} else {
Location l = destination.getLocation();
@ -6941,14 +7264,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
,1);
}
} else {
notWorldShop.add(ev.getDestination());
notWorldShop.add(InventoryUtils.getInventoryHash(ev.getDestination()));
log("Added not world shop "+ev.getDestination().getLocation(),4);
}
}
}
if ((destination.getHolder() instanceof HopperMinecart) || destination.getLocation().getBlock().getType()==Material.HOPPER) {
//log("In here 2",2);
if (notWorldShop.contains(source)) {
if (notWorldShop.contains(InventoryUtils.getInventoryHash(source))) {
return;
} else {
Location l = source.getLocation();
@ -6974,7 +7297,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
,1);
}
} else {
notWorldShop.add(ev.getSource());
notWorldShop.add(InventoryUtils.getInventoryHash(ev.getSource()));
log("Added not world shop "+ev.getSource().getLocation(),4);
}
}
@ -7162,6 +7485,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getEntity() instanceof Projectile) {
Projectile arr = (Projectile)ev.getEntity();
//Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12);
//TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(arr)+" being shot.", 0);
if (arr instanceof Fireball && (arr.getShooter() instanceof Ghast)) {
Ghast g = (Ghast)arr.getShooter();
Fireball fb = (Fireball)arr;
@ -7183,6 +7507,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
return;
}
if (arr instanceof WitherSkull && (arr.getShooter() instanceof Wither)) {
Wither w = (Wither)arr.getShooter();
WitherSkull ws = (WitherSkull)arr;
LivingEntity le = w.getTarget();
if (le!=null) {
CustomMonster mon = CustomMonster.getCustomMonster(w);
if (mon!=null && ((sig.plugin.TwosideKeeper.Monster.Wither)mon).getLastSkullShot()+20<TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, ()->{FireExtraWitherSkull(w,le,ws);},5);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, ()->{FireExtraWitherSkull(w,le,ws);},10);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, ()->{FireExtraWitherSkull(w,le,ws);},15);
((sig.plugin.TwosideKeeper.Monster.Wither)mon).resetLastSkullShot();
}
}
}
if (arr instanceof SmallFireball && (arr.getShooter() instanceof Blaze)) {
Blaze b = (Blaze)arr.getShooter();
@ -7309,6 +7648,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
private void FireExtraWitherSkull(Wither w, LivingEntity le, WitherSkull ws) {
WitherSkull skull = w.launchProjectile(WitherSkull.class);
skull.setShooter(w);
skull.setDirection(ws.getDirection().add(new Vector(Math.random()*0.2-0.1,Math.random()*0.2-0.1,Math.random()*0.2-0.1)));
SoundUtils.playGlobalSound(skull.getLocation(), Sound.ENTITY_WITHER_SHOOT, 1.0f, 1.0f);
}
private void FireExtraBlazeFireball(Blaze b, LivingEntity le, SmallFireball ref) {
SmallFireball sf = b.launchProjectile(SmallFireball.class);
sf.setShooter(b);
@ -8485,10 +8831,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ChatColor finalcolor = GetHeartColor(color1);
ChatColor finalcolor2 = GetHeartColor(color2);
final String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
TwosideKeeper.log("Message 1 is "+message1, 5);
p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(pd2.target.getHealth()/20+1));
}}}
if (pd2.target.getHealth()>2000) {
finalheartdisplay=GetHeartColor(GetFactorialAmt(pd2.target.getHealth()))+FinalHealthDisplay(pd2.target.getHealth())+" / "+FinalHealthDisplay(pd2.target.getMaxHealth());
p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET);
} else {
p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(pd2.target.getHealth()/20+1));
}
}}
private String FinalHealthDisplay(double maxHealth) {
DecimalFormat df = new DecimalFormat("0");
if (maxHealth>=1000000) {
return df.format(maxHealth/1000000)+"M";
} else {
return df.format(maxHealth/1000)+"k";
}
}
private int GetFactorialAmt(double health) {
double startingamt = health;
int numb = 0;
while (startingamt>1000) {
startingamt/=1000;
numb++;
}
return numb;
}}
,1);
if (Bukkit.getPlayer(pd2.name)!=null) {
if (pd.title_task!=-1) {

@ -48,6 +48,7 @@ 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.PlayerUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
@ -162,6 +163,10 @@ final class runServerHeartbeat implements Runnable {
if (!p.isDead()) {
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
if (p.getName().equalsIgnoreCase("Orni")) {
CustomDamage.ApplyDamage(10, null, p, null, "Orni",CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK|CustomDamage.IGNOREDODGE);
}
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<serverTickTime) {
pd.lastsprintcheck=serverTickTime;
GenericFunctions.ApplySwiftAegis(p);
@ -504,12 +509,12 @@ final class runServerHeartbeat implements Runnable {
if (deltax<-0.25) {
xvel=SPD*(Math.min(10, Math.abs(deltax)));
}
if (deltay>0.01) {
/*if (deltay>0.01) {
yvel=-SPD*deltay*4;
} else
if (deltay<-0.01) {
yvel=SPD*deltay*4;
}
}*/
if (deltaz>0.25) {
zvel=-SPD*(Math.min(10, Math.abs(deltaz)));
} else
@ -636,6 +641,7 @@ final class runServerHeartbeat implements Runnable {
//TwosideKeeper.monsterdata.remove(data);
TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms);
TwosideKeeper.ScheduleRemoval(data, id);
TwosideKeeper.ScheduleRemoval(TwosideKeeper.habitat_data.startinglocs, id);
TwosideKeeper.log("Removed Monster Structure for "+id+".", 5);
} else {
AddEliteStructureIfOneDoesNotExist(ms);

Loading…
Cancel
Save