diff --git a/.project b/.project
new file mode 100644
index 0000000..45b9206
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ Project
+
+
+
+
+
+
+
+
diff --git a/src/plugin.yml b/src/plugin.yml
index a3ffbee..0091e9f 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -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!
\ No newline at end of file
diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
index 3f8afdd..13f2e81 100644
--- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
+++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
@@ -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;
diff --git a/src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java b/src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
index 25e9b83..caef687 100644
--- a/src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
+++ b/src/sig/plugin/TwosideKeeper/Boss/EliteZombie.java
@@ -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 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+200) {
@@ -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;i50) {
+ 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));
}
}
}
diff --git a/src/sig/plugin/TwosideKeeper/ChargeZombie.java b/src/sig/plugin/TwosideKeeper/ChargeZombie.java
index 5fba29f..2b22667 100644
--- a/src/sig/plugin/TwosideKeeper/ChargeZombie.java
+++ b/src/sig/plugin/TwosideKeeper/ChargeZombie.java
@@ -33,8 +33,8 @@ public class ChargeZombie {
if (Math.abs(x)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:
diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java
index 8bc7ae0..c61c6b4 100644
--- a/src/sig/plugin/TwosideKeeper/CustomDamage.java
+++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java
@@ -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+2000) {
@@ -1896,6 +1902,10 @@ public class CustomDamage {
}
}
+ if (target instanceof Wither) {
+ witherdiv += 0.2;
+ }
+
//Check for resistance effect.
Collection 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:
diff --git a/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java b/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
index f2be322..bdd9960 100644
--- a/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
+++ b/src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
@@ -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;
+ }
}
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
index 27310ae..67bd7c1 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
@@ -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 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;
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
index 8096729..7a363bc 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
@@ -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) {
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
index 7d756e9..3d8fa0e 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
@@ -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 (i0 || aPlugin.API.getLastXPBar(p).length() > 2) {
aPlugin.API.sendActionBarMessage(p, String.format(aPlugin.API.getLastXPBar(p), finalmsg));
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
index 87c19ba..59bf7ca 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/Habitation.java
@@ -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):"");
}
}
-}
+}
\ No newline at end of file
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
index ced56d4..2e2a1d4 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
@@ -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);
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
index 771556b..93a2ddc 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryLava.java
@@ -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;
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java b/src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
index 25be0d9..3741d62 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
@@ -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)) oldlore = item.getItemMeta().getLore();
+ for (int i=0;i oldlore = item.getItemMeta().getLore();
+ for (int i=0;i
+ * 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!
+ *
+ * Returns a modified version of the item.
+ */
+ public static void addArtifactDustTime(ItemStack item, long amt) {
+ if (isArtifactDust(item)) {
+ long time = TwosideKeeper.getServerTickTime();
+ List oldlore = item.getItemMeta().getLore();
+ for (int i=0;i breakdownlist;
+ public HashMap breakdownlist;
double totaldmg;
double actualtotaldmg=0.0;
double calculatedtotaldmg=0.0;
diff --git a/src/sig/plugin/TwosideKeeper/Monster/HellfireGhast.java b/src/sig/plugin/TwosideKeeper/Monster/HellfireGhast.java
index 5168cc0..3d0cd72 100644
--- a/src/sig/plugin/TwosideKeeper/Monster/HellfireGhast.java
+++ b/src/sig/plugin/TwosideKeeper/Monster/HellfireGhast.java
@@ -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())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()=128) {
+ m.teleport(m.getLocation().add(0,-32,0));
+ }
+ if (m.getHealth()<86000 && lastWitherSkeletonSpawned+40=128) {
+ les.m.teleport(les.m.getLocation().add(0,-32,0));
+ }
+ }
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/PartyManager.java b/src/sig/plugin/TwosideKeeper/PartyManager.java
index c5d784e..d208436 100644
--- a/src/sig/plugin/TwosideKeeper/PartyManager.java
+++ b/src/sig/plugin/TwosideKeeper/PartyManager.java
@@ -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 getPartyMembers(Player p) {
int partynumb = GetCurrentParty(p);
- if (partynumb>=0) {
- return parties.get(partynumb);
- } else {
- List partylist = new ArrayList();
- return partylist;
- }
- }
-}
+ return parties.get(partynumb);
+ }
+}
\ No newline at end of file
diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java
index c5357f7..80d055f 100644
--- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java
+++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java
@@ -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;
diff --git a/src/sig/plugin/TwosideKeeper/Recipes.java b/src/sig/plugin/TwosideKeeper/Recipes.java
index 8b1881f..dc80cfe 100644
--- a/src/sig/plugin/TwosideKeeper/Recipes.java
+++ b/src/sig/plugin/TwosideKeeper/Recipes.java
@@ -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);
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
index fc79184..a86e211 100644
--- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
+++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
@@ -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 TEMPORARYABILITIES = new ArrayList();
- public static Set notWorldShop = new HashSet();
+ public static Set notWorldShop = new HashSet();
public static List suppressed_entities = new ArrayList();
public static List lavaplume_list = new ArrayList();
@@ -462,7 +470,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static List validsetitems = new ArrayList();
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 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 ope = GetFullStructureMap("ope");
+ HashMap dam = GetFullStructureMap("dam");
+ HashMap dea = GetFullStructureMap("dea");
+ HashMap hit = GetFullStructureMap("hit");
+ HashMap ite2 = GetFullStructureMap("ite");
+ HashMap las = GetFullStructureMap("las");
+ HashMap 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 \"");
+ 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 GetFullStructureMap(String string) {
+ HashMap newmap = new HashMap();
+ 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_shovelspell1) {
//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(){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) {
diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
index e5675ee..001aef0 100644
--- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
+++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
@@ -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)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);