->Fix Custom Arrow Pickup not properly converting arrows back.

->Fix Line Drive not leveling artifacts properly.
->All Artifact armor tiers have been converted to Leather.
->Hellfire Spiders now trap you in their deadly webs, doing massive
damage, and making it much more difficult to continue to attack them.
->Fixed a bug where fighting Hellfire Zombies kept creating Charge
Zombie structures, running the same AI many times every calculation.
->Hunter's Compass calibration works a little bit differently now. It
may take some time for the compass to calibrate properly, so be prepared
to wait awhile for results.
This commit is contained in:
sigonasr2 2016-09-01 21:32:02 -05:00
parent 4a59c504ba
commit cf47e38849
16 changed files with 467 additions and 274 deletions

Binary file not shown.

View File

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

View File

@ -45,7 +45,7 @@ public class AwakenedArtifact {
int expval = Integer.parseInt(exp); int expval = Integer.parseInt(exp);
return expval; return expval;
} }
TwosideKeeper.log("Could not retrieve EXP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not retrieve EXP value for artifact "+artifact.toString(), 1);
return -1; //If we got here, something bad happened. return -1; //If we got here, something bad happened.
} }
public static ItemStack setEXP(ItemStack artifact, int amt) { public static ItemStack setEXP(ItemStack artifact, int amt) {
@ -63,7 +63,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not set the EXP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not set the EXP value for artifact "+artifact.toString(), 1);
return artifact; return artifact;
} }
public static ItemStack addEXP(ItemStack artifact, int amt, Player p) { public static ItemStack addEXP(ItemStack artifact, int amt, Player p) {
@ -113,7 +113,7 @@ public class AwakenedArtifact {
int LV = Integer.parseInt(lv); int LV = Integer.parseInt(lv);
return LV; return LV;
} }
TwosideKeeper.log("Could not retrieve LV value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not retrieve LV value for artifact "+artifact.toString(), 1);
return -1; //If we got here, something bad happened. return -1; //If we got here, something bad happened.
} }
public static ItemStack setLV(ItemStack artifact, int amt, Player p) { public static ItemStack setLV(ItemStack artifact, int amt, Player p) {
@ -131,7 +131,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not set the LV value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not set the LV value for artifact "+artifact.toString(), 1);
return artifact; return artifact;
} }
public static ItemStack addAP(ItemStack artifact, int amt) { public static ItemStack addAP(ItemStack artifact, int amt) {
@ -148,7 +148,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
return null; return null;
} }
public static ItemStack setAP(ItemStack artifact, int newamt) { public static ItemStack setAP(ItemStack artifact, int newamt) {
@ -164,7 +164,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
return null; return null;
} }
public static int getAP(ItemStack artifact) { public static int getAP(ItemStack artifact) {
@ -185,7 +185,7 @@ public class AwakenedArtifact {
return level-apused;*/ return level-apused;*/
return Integer.parseInt(((apline.split("/")[0]).split(": ")[1])); return Integer.parseInt(((apline.split("/")[0]).split(": ")[1]));
} }
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
return -1; return -1;
} }
public static ItemStack addMaxAP(ItemStack artifact, int amt) { public static ItemStack addMaxAP(ItemStack artifact, int amt) {
@ -202,7 +202,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
return null; return null;
} }
public static ItemStack setMaxAP(ItemStack artifact, int newamt) { public static ItemStack setMaxAP(ItemStack artifact, int newamt) {
@ -218,7 +218,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} }
TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the AP value for artifact "+artifact.toString(), 1);
return null; return null;
} }
public static int getMaxAP(ItemStack artifact) { public static int getMaxAP(ItemStack artifact) {
@ -239,7 +239,7 @@ public class AwakenedArtifact {
return level-apused;*/ return level-apused;*/
return Integer.parseInt(((apline.split("/")[1]))); return Integer.parseInt(((apline.split("/")[1])));
} }
TwosideKeeper.log("Could not get the Max AP value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the Max AP value for artifact "+artifact.toString(), 1);
return -1; return -1;
} }
public static ItemStack addLV(ItemStack artifact, int amt, Player p) { public static ItemStack addLV(ItemStack artifact, int amt, Player p) {
@ -252,7 +252,7 @@ public class AwakenedArtifact {
String potentialline = lore.get(4); String potentialline = lore.get(4);
return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", ""))); return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", "")));
} else { } else {
TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
return -1; return -1;
} }
} }
@ -267,7 +267,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} else { } else {
TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
return artifact; return artifact;
} }
} }
@ -282,7 +282,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m); artifact.setItemMeta(m);
return artifact; return artifact;
} else { } else {
TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1); //TwosideKeeper.log("Could not get the Potential value for artifact "+artifact.toString(), 1);
return artifact; return artifact;
} }
} }

View File

@ -25,6 +25,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Spider; import org.bukkit.entity.Spider;
import org.bukkit.entity.TippedArrow; import org.bukkit.entity.TippedArrow;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -53,6 +54,7 @@ public class CustomDamage {
public static final int TRUEDMG = 4; public static final int TRUEDMG = 4;
public static final int IGNORE_DAMAGE_TICK = 8; //Ignores damage ticks, which guarantees this attack will land regardless if the player's gotten hit by this before. public static final int IGNORE_DAMAGE_TICK = 8; //Ignores damage ticks, which guarantees this attack will land regardless if the player's gotten hit by this before.
public static final int SPECIALATTACK = 16; //Used internally to specifically define a special attack. public static final int SPECIALATTACK = 16; //Used internally to specifically define a special attack.
public static final int NOAOE = 32; //Prevents AoE from being applied again since this attack will be considered the AoE attack. Prevents recursion with AoE.
//////////////////THE FLAGS BELOW ARE SYSTEM FLAGS!! DO NOT USE THEM! //////////////////THE FLAGS BELOW ARE SYSTEM FLAGS!! DO NOT USE THEM!
public static final int IS_CRIT = 1; //System Flag. Used for telling a player structure their last hit was a crit. public static final int IS_CRIT = 1; //System Flag. Used for telling a player structure their last hit was a crit.
@ -171,6 +173,15 @@ public class CustomDamage {
if (shooter instanceof LivingEntity) { if (shooter instanceof LivingEntity) {
dmg = calculateMobBaseDamage(shooter,target)*calculateMonsterDifficultyMultiplier(shooter); dmg = calculateMobBaseDamage(shooter,target)*calculateMonsterDifficultyMultiplier(shooter);
} }
if (damager instanceof Snowball) {
Snowball sb = (Snowball)damager;
if (sb.hasMetadata("SPIDERBALL")) {
dmg = 10.0*10.0;
reason = "Spider Ball";
TwosideKeeper.log("Got here to damage.", 1);
GenericFunctions.removeNoDamageTick(target, damager);
}
}
} }
dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
if (shooter instanceof Player) { if (shooter instanceof Player) {
@ -386,14 +397,23 @@ public class CustomDamage {
GenericFunctions.isArtifactWeapon(weapon)) { GenericFunctions.isArtifactWeapon(weapon)) {
double ratio = 1.0-CalculateDamageReduction(1,target,p); double ratio = 1.0-CalculateDamageReduction(1,target,p);
if (p.getEquipment().getItemInMainHand().getType()!=Material.BOW) { if (p.getEquipment().getItemInMainHand().getType()!=Material.BOW) {
AwakenedArtifact.addPotentialEXP(weapon, (int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1), p); //Do this with a 1 tick delay, that way it can account for items that are dropped one tick earlier and still work.
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), (int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1), p);
}
},1);
} else { } else {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.storedbowxp+=(int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1); pd.storedbowxp+=(int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1);
pd.lasthittarget=TwosideKeeper.getServerTickTime(); pd.lasthittarget=TwosideKeeper.getServerTickTime();
} }
increaseArtifactArmorXP(p,(int)(ratio*10)+1); increaseArtifactArmorXP(p,(int)(ratio*10)+1);
List<LivingEntity> hitlist = getAOEList(weapon,target); List<LivingEntity> hitlist = new ArrayList<LivingEntity>();
if (!isFlagSet(flags,NOAOE)) {
hitlist = getAOEList(weapon,target);
}
boolean applyDeathMark=false; boolean applyDeathMark=false;
@ -401,22 +421,21 @@ public class CustomDamage {
applyDeathMark=true; applyDeathMark=true;
} }
for (int i=0;i<hitlist.size();i++) { for (LivingEntity ent : hitlist) {
if (!hitlist.get(i).equals(target)) { if (!ent.equals(target)) {
//hitlist.get(i).damage(dmg); //hitlist.get(i).damage(dmg);
//GenericFunctions.DealDamageToMob(CalculateDamageReduction(dmg,target,damager), hitlist.get(i), shooter, weapon, "AoE Damage"); //GenericFunctions.DealDamageToMob(CalculateDamageReduction(dmg,target,damager), hitlist.get(i), shooter, weapon, "AoE Damage");
ApplyDamage(0,damager,hitlist.get(i),weapon,"AoE Damage",flags); ApplyDamage(0,damager,ent,weapon,"AoE Damage",setFlag(flags,NOAOE));
}; };
if (applyDeathMark) { if (applyDeathMark) {
GenericFunctions.ApplyDeathMark(hitlist.get(i)); GenericFunctions.ApplyDeathMark(ent);
} }
} }
final List<LivingEntity> finallist = hitlist; final List<LivingEntity> finallist = hitlist;
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() { public void run() {
for (int i=0;i<finallist.size();i++) { for (LivingEntity le : finallist) {
LivingEntity le = finallist.get(i);
if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) { if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) {
GenericFunctions.ResetMobName(le); GenericFunctions.ResetMobName(le);
//They don't have death marks anymore, so we just remove their name color. //They don't have death marks anymore, so we just remove their name color.
@ -661,12 +680,22 @@ public class CustomDamage {
static void setMonsterTarget(Monster m, Player p) { static void setMonsterTarget(Monster m, Player p) {
addChargeZombieToList(m); addChargeZombieToList(m);
addHellfireSpiderToList(m);
addMonsterToTargetList(m,p); addMonsterToTargetList(m,p);
} }
static void addChargeZombieToList(Monster m) { static void addChargeZombieToList(Monster m) {
if (MonsterController.isChargeZombie(m)) { if (!TwosideKeeper.chargezombies.containsKey(m.getUniqueId()) &&
TwosideKeeper.chargezombies.add(new ChargeZombie((Monster)m)); MonsterController.isChargeZombie(m)) {
TwosideKeeper.chargezombies.put(m.getUniqueId(),new ChargeZombie((Monster)m));
}
}
static void addHellfireSpiderToList(Monster m) {
if (!TwosideKeeper.hellfirespiders.containsKey(m.getUniqueId()) &&
MonsterController.isHellfireSpider(m)) {
TwosideKeeper.hellfirespiders.put(m.getUniqueId(),new HellfireSpider((Monster)m));
TwosideKeeper.log("Added Hellfire Spider.", 2);
} }
} }

View File

@ -0,0 +1,22 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.entity.Monster;
public class HellfireSpider {
Monster m;
public HellfireSpider(Monster m) {
this.m=m;
}
public Monster GetSpider() {
return m;
}
public boolean isAlive() {
return !m.isDead();
}
public boolean hasTarget() {
return (m.getTarget()!=null)?true:false;
}
}

View File

@ -300,7 +300,7 @@ public enum ArtifactAbility {
TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2); TwosideKeeper.log("Checking for enchantment "+ab.GetName(), 2);
item = removeEnchantment(ab,item); item = removeEnchantment(ab,item);
} }
item = AwakenedArtifact.setAP(item, AwakenedArtifact.getLV(item)); item = AwakenedArtifact.setAP(item, AwakenedArtifact.getMaxAP(item));
return item; return item;
} }

View File

@ -158,18 +158,18 @@ public enum ArtifactItemType {
new ItemStack(Material.LEATHER_HELMET), //T1 new ItemStack(Material.LEATHER_HELMET), //T1
new ItemStack(Material.LEATHER_HELMET), //T2 new ItemStack(Material.LEATHER_HELMET), //T2
new ItemStack(Material.LEATHER_HELMET), //T3 new ItemStack(Material.LEATHER_HELMET), //T3
new ItemStack(Material.GOLD_HELMET), //T4 new ItemStack(Material.LEATHER_HELMET), //T4
new ItemStack(Material.IRON_HELMET), //T5 new ItemStack(Material.LEATHER_HELMET), //T5
new ItemStack(Material.IRON_HELMET), //T6 new ItemStack(Material.LEATHER_HELMET), //T6
new ItemStack(Material.IRON_HELMET), //T7 new ItemStack(Material.LEATHER_HELMET), //T7
new ItemStack(Material.DIAMOND_HELMET), //T8 new ItemStack(Material.LEATHER_HELMET), //T8
new ItemStack(Material.DIAMOND_HELMET), //T9 new ItemStack(Material.LEATHER_HELMET), //T9
new ItemStack(Material.DIAMOND_HELMET), //T10 new ItemStack(Material.LEATHER_HELMET), //T10
new ItemStack(Material.DIAMOND_HELMET), //T11 new ItemStack(Material.LEATHER_HELMET), //T11
new ItemStack(Material.DIAMOND_HELMET), //T12 new ItemStack(Material.LEATHER_HELMET), //T12
new ItemStack(Material.DIAMOND_HELMET), //T13 new ItemStack(Material.LEATHER_HELMET), //T13
new ItemStack(Material.DIAMOND_HELMET), //T14 new ItemStack(Material.LEATHER_HELMET), //T14
new ItemStack(Material.DIAMOND_HELMET), //T15 new ItemStack(Material.LEATHER_HELMET), //T15
}, },
new double[]{ new double[]{
3.75d, //T1 3.75d, //T1
@ -200,18 +200,18 @@ public enum ArtifactItemType {
new ItemStack(Material.LEATHER_CHESTPLATE), //T1 new ItemStack(Material.LEATHER_CHESTPLATE), //T1
new ItemStack(Material.LEATHER_CHESTPLATE), //T2 new ItemStack(Material.LEATHER_CHESTPLATE), //T2
new ItemStack(Material.LEATHER_CHESTPLATE), //T3 new ItemStack(Material.LEATHER_CHESTPLATE), //T3
new ItemStack(Material.GOLD_CHESTPLATE), //T4 new ItemStack(Material.LEATHER_CHESTPLATE), //T4
new ItemStack(Material.IRON_CHESTPLATE), //T5 new ItemStack(Material.LEATHER_CHESTPLATE), //T5
new ItemStack(Material.IRON_CHESTPLATE), //T6 new ItemStack(Material.LEATHER_CHESTPLATE), //T6
new ItemStack(Material.IRON_CHESTPLATE), //T7 new ItemStack(Material.LEATHER_CHESTPLATE), //T7
new ItemStack(Material.DIAMOND_CHESTPLATE), //T8 new ItemStack(Material.LEATHER_CHESTPLATE), //T8
new ItemStack(Material.DIAMOND_CHESTPLATE), //T9 new ItemStack(Material.LEATHER_CHESTPLATE), //T9
new ItemStack(Material.DIAMOND_CHESTPLATE), //T10 new ItemStack(Material.LEATHER_CHESTPLATE), //T10
new ItemStack(Material.DIAMOND_CHESTPLATE), //T11 new ItemStack(Material.LEATHER_CHESTPLATE), //T11
new ItemStack(Material.DIAMOND_CHESTPLATE), //T12 new ItemStack(Material.LEATHER_CHESTPLATE), //T12
new ItemStack(Material.DIAMOND_CHESTPLATE), //T13 new ItemStack(Material.LEATHER_CHESTPLATE), //T13
new ItemStack(Material.DIAMOND_CHESTPLATE), //T14 new ItemStack(Material.LEATHER_CHESTPLATE), //T14
new ItemStack(Material.DIAMOND_CHESTPLATE), //T15 new ItemStack(Material.LEATHER_CHESTPLATE), //T15
}, },
new double[]{ new double[]{
3.75d, //T1 3.75d, //T1
@ -242,18 +242,18 @@ public enum ArtifactItemType {
new ItemStack(Material.LEATHER_LEGGINGS), //T1 new ItemStack(Material.LEATHER_LEGGINGS), //T1
new ItemStack(Material.LEATHER_LEGGINGS), //T2 new ItemStack(Material.LEATHER_LEGGINGS), //T2
new ItemStack(Material.LEATHER_LEGGINGS), //T3 new ItemStack(Material.LEATHER_LEGGINGS), //T3
new ItemStack(Material.GOLD_LEGGINGS), //T4 new ItemStack(Material.LEATHER_LEGGINGS), //T4
new ItemStack(Material.IRON_LEGGINGS), //T5 new ItemStack(Material.LEATHER_LEGGINGS), //T5
new ItemStack(Material.IRON_LEGGINGS), //T6 new ItemStack(Material.LEATHER_LEGGINGS), //T6
new ItemStack(Material.IRON_LEGGINGS), //T7 new ItemStack(Material.LEATHER_LEGGINGS), //T7
new ItemStack(Material.DIAMOND_LEGGINGS), //T8 new ItemStack(Material.LEATHER_LEGGINGS), //T8
new ItemStack(Material.DIAMOND_LEGGINGS), //T9 new ItemStack(Material.LEATHER_LEGGINGS), //T9
new ItemStack(Material.DIAMOND_LEGGINGS), //T10 new ItemStack(Material.LEATHER_LEGGINGS), //T10
new ItemStack(Material.DIAMOND_LEGGINGS), //T11 new ItemStack(Material.LEATHER_LEGGINGS), //T11
new ItemStack(Material.DIAMOND_LEGGINGS), //T12 new ItemStack(Material.LEATHER_LEGGINGS), //T12
new ItemStack(Material.DIAMOND_LEGGINGS), //T13 new ItemStack(Material.LEATHER_LEGGINGS), //T13
new ItemStack(Material.DIAMOND_LEGGINGS), //T14 new ItemStack(Material.LEATHER_LEGGINGS), //T14
new ItemStack(Material.DIAMOND_LEGGINGS), //T15 new ItemStack(Material.LEATHER_LEGGINGS), //T15
}, },
new double[]{ new double[]{
3.75d, //T1 3.75d, //T1
@ -284,18 +284,18 @@ public enum ArtifactItemType {
new ItemStack(Material.LEATHER_BOOTS), //T1 new ItemStack(Material.LEATHER_BOOTS), //T1
new ItemStack(Material.LEATHER_BOOTS), //T2 new ItemStack(Material.LEATHER_BOOTS), //T2
new ItemStack(Material.LEATHER_BOOTS), //T3 new ItemStack(Material.LEATHER_BOOTS), //T3
new ItemStack(Material.GOLD_BOOTS), //T4 new ItemStack(Material.LEATHER_BOOTS), //T4
new ItemStack(Material.IRON_BOOTS), //T5 new ItemStack(Material.LEATHER_BOOTS), //T5
new ItemStack(Material.IRON_BOOTS), //T6 new ItemStack(Material.LEATHER_BOOTS), //T6
new ItemStack(Material.IRON_BOOTS), //T7 new ItemStack(Material.LEATHER_BOOTS), //T7
new ItemStack(Material.DIAMOND_BOOTS), //T8 new ItemStack(Material.LEATHER_BOOTS), //T8
new ItemStack(Material.DIAMOND_BOOTS), //T9 new ItemStack(Material.LEATHER_BOOTS), //T9
new ItemStack(Material.DIAMOND_BOOTS), //T10 new ItemStack(Material.LEATHER_BOOTS), //T10
new ItemStack(Material.DIAMOND_BOOTS), //T11 new ItemStack(Material.LEATHER_BOOTS), //T11
new ItemStack(Material.DIAMOND_BOOTS), //T12 new ItemStack(Material.LEATHER_BOOTS), //T12
new ItemStack(Material.DIAMOND_BOOTS), //T13 new ItemStack(Material.LEATHER_BOOTS), //T13
new ItemStack(Material.DIAMOND_BOOTS), //T14 new ItemStack(Material.LEATHER_BOOTS), //T14
new ItemStack(Material.DIAMOND_BOOTS), //T15 new ItemStack(Material.LEATHER_BOOTS), //T15
}, },
new double[]{ new double[]{
3.75d, //T1 3.75d, //T1

View File

@ -1,6 +1,5 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common; package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -38,8 +37,6 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI; import org.inventivetalent.glow.GlowAPI;
import org.inventivetalent.glow.GlowAPI.Color; import org.inventivetalent.glow.GlowAPI.Color;
import aPlugin.DiscordMessageSender;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
@ -55,8 +52,8 @@ import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI; import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode; import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
@ -2059,11 +2056,8 @@ public class GenericFunctions {
public static boolean isArtifactWeapon(ItemStack item) { public static boolean isArtifactWeapon(ItemStack item) {
if (item!=null && if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("BOW") || item.getType()!=Material.AIR && isWeapon(item) &&
(item.getType().toString().contains("AXE") && !item.getType().toString().contains("PICKAXE")) || Artifact.isArtifact(item)) {
item.getType().toString().contains("SWORD") ||
item.getType().toString().contains("FISHING_ROD") ||
item.getType().toString().contains("HOE"))) {
return true; return true;
} else { } else {
return false; return false;
@ -2071,10 +2065,8 @@ public class GenericFunctions {
} }
public static boolean isArtifactArmor(ItemStack item) { public static boolean isArtifactArmor(ItemStack item) {
if (item!=null && if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("BOOTS") || item.getType()!=Material.AIR && isArmor(item) &&
item.getType().toString().contains("CHESTPLATE") || Artifact.isArtifact(item)) {
item.getType().toString().contains("LEGGINGS") ||
item.getType().toString().contains("HELMET"))) {
return true; return true;
} else { } else {
return false; return false;
@ -2083,9 +2075,8 @@ public class GenericFunctions {
public static boolean isArtifactTool(ItemStack item) { public static boolean isArtifactTool(ItemStack item) {
if (item!=null && if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") || item.getType()!=Material.AIR && isHarvestingTool(item) &&
item.getType().toString().contains("AXE")|| Artifact.isArtifact(item)) {
item.getType().toString().contains("HOE"))) {
return true; return true;
} else { } else {
return false; return false;
@ -2769,7 +2760,7 @@ public class GenericFunctions {
public static void logAndRemovePotionEffectFromPlayer(PotionEffectType type, Player p) { public static void logAndRemovePotionEffectFromPlayer(PotionEffectType type, Player p) {
TwosideKeeper.log(ChatColor.WHITE+"Removing Potion Effect "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+") on Player "+p.getName()+" Duration: "+getPotionEffectDuration(type,p)+" ticks by adding a 0 duration version of this effect.", TwosideKeeper.POTION_DEBUG_LEVEL); TwosideKeeper.log(ChatColor.WHITE+"Removing Potion Effect "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+") on Player "+p.getName()+" Duration: "+getPotionEffectDuration(type,p)+" ticks by adding a 0 duration version of this effect.", TwosideKeeper.POTION_DEBUG_LEVEL);
//p.removePotionEffect(type); //p.removePotionEffect(type);
logAndApplyPotionEffectToPlayer(type,0,0,p,true); logAndApplyPotionEffectToPlayer(type,1,0,p,true);
if (p.hasPotionEffect(type)) { if (p.hasPotionEffect(type)) {
TwosideKeeper.log(ChatColor.DARK_RED+" Effect on Player "+p.getName()+" is now "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+"), Duration: "+getPotionEffectDuration(type,p)+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL); TwosideKeeper.log(ChatColor.DARK_RED+" Effect on Player "+p.getName()+" is now "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+"), Duration: "+getPotionEffectDuration(type,p)+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL);
TwosideKeeper.log(ChatColor.RED+"THIS SHOULD NOT BE HAPPENING! Reporting", TwosideKeeper.POTION_DEBUG_LEVEL); TwosideKeeper.log(ChatColor.RED+"THIS SHOULD NOT BE HAPPENING! Reporting", TwosideKeeper.POTION_DEBUG_LEVEL);
@ -3081,12 +3072,21 @@ public class GenericFunctions {
} }
UpdateOldRangerPieces(item); UpdateOldRangerPieces(item);
UpdateArtifactDust(item); UpdateArtifactDust(item);
UpdateArtifactItemType(item);
UpdateVials(item); UpdateVials(item);
UpdateHuntersCompass(item); UpdateHuntersCompass(item);
UpdateUpgradeShard(item); UpdateUpgradeShard(item);
return item; return item;
} }
private static void UpdateArtifactItemType(ItemStack item) {
if (isArtifactArmor(item)) {
double durabilityratio = item.getDurability()/item.getType().getMaxDurability();
item.setType(Material.valueOf("LEATHER_"+item.getType().name().split("_")[1]));
item.setDurability((short)(durabilityratio*item.getType().getMaxDurability()));
}
}
private static void UpdateHuntersCompass(ItemStack item) { private static void UpdateHuntersCompass(ItemStack item) {
if (item.getType()==Material.COMPASS && if (item.getType()==Material.COMPASS &&
item.containsEnchantment(Enchantment.LUCK)) { item.containsEnchantment(Enchantment.LUCK)) {
@ -3187,6 +3187,15 @@ public class GenericFunctions {
if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) { if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) {
TwosideKeeper.log("->In here",5); TwosideKeeper.log("->In here",5);
ItemSet set = TwosideKeeperAPI.getItemSet(item); ItemSet set = TwosideKeeperAPI.getItemSet(item);
ConvertSetColor(item, set);
}
item.setItemMeta(lm);
}
}
}
public static void ConvertSetColor(ItemStack item, ItemSet set) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
if (set==ItemSet.JAMDAK) { if (set==ItemSet.JAMDAK) {
lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0)); lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0));
} }
@ -3199,11 +3208,8 @@ public class GenericFunctions {
if (set==ItemSet.LORASAADI) { if (set==ItemSet.LORASAADI) {
lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0)); lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0));
} }
}
item.setItemMeta(lm); item.setItemMeta(lm);
} }
}
}
public static ExperienceOrb spawnXP(Location location, int expAmount) { public static ExperienceOrb spawnXP(Location location, int expAmount) {
ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class); ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class);
@ -3452,20 +3458,28 @@ public class GenericFunctions {
int randomx = (int)((Math.random()*10000) - 5000); int randomx = (int)((Math.random()*10000) - 5000);
int randomz = (int)((Math.random()*10000) - 5000); int randomz = (int)((Math.random()*10000) - 5000);
Location testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz); Location testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
do { testloc.getChunk().load();
int loopmax=5;
int i = 0;
while (i<loopmax) {
randomx = (int)((Math.random()*10000) - 5000); randomx = (int)((Math.random()*10000) - 5000);
randomz = (int)((Math.random()*10000) - 5000); randomz = (int)((Math.random()*10000) - 5000);
testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz); testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load(); } while testloc.getChunk().load();
((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) && if ((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) &&
AllNaturalBlocks(testloc.getBlock(),16,8,16)); AllNaturalBlocks(testloc.getBlock(),16,8,16)) {
return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz); return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz);
} else {
testloc.getChunk().unload();
TwosideKeeper.log("Failed location "+testloc.toString(), 4);
i++;
}
}
return null;
} }
public static void generateNewElite() { public static void generateNewElite(Player p, String name) {
TwosideKeeper.ELITE_LOCATION = defineNewEliteLocation(); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l);
Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE);
MonsterController.convertMonster(m, MonsterDifficulty.ELITE);
} }
public static boolean isHunterCompass(ItemStack item) { public static boolean isHunterCompass(ItemStack item) {
@ -3771,4 +3785,27 @@ public class GenericFunctions {
pd.lasteffectlist.addAll(p.getActivePotionEffects()); pd.lasteffectlist.addAll(p.getActivePotionEffects());
} }
} }
public static void createRandomWeb(Location l, int loop) {
for (int x=-loop;x<=loop;x++) {
for (int y=-loop;y<=loop;y++) {
for (int z=-loop;z<=loop;z++) {
Block b = l.getBlock().getRelative(x, y, z);
if (b.getType()==Material.AIR ||
b.getType()==Material.WATER ||
b.getType()==Material.LAVA) {
if (Math.random()<=0.45) {
b.setType(Material.WEB);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
b.setType(Material.AIR);
}
}, 20*5);
}
}
}
}
}
}
} }

View File

@ -0,0 +1,49 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class EliteMonsterLocationFinder implements Runnable{
Player p = null;
String name = "";
public EliteMonsterLocationFinder(Player p, String name) {
this.p=p;
this.name=name;
}
@Override
public void run() {
TwosideKeeper.ELITE_LOCATION = GenericFunctions.defineNewEliteLocation();
if (TwosideKeeper.ELITE_LOCATION==null) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l);
if (p!=null) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if ((pd.lastcompassnotification+(20*10))<TwosideKeeper.getServerTickTime()) {
pd.lastcompassnotification=TwosideKeeper.getServerTickTime();
p.sendMessage("The "+name+ChatColor.WHITE+" is still searching...");
} else {
pd.lastrightclick=TwosideKeeper.getServerTickTime();
}
}
} else {
if (p!=null) {
p.sendMessage("The "+name+ChatColor.WHITE+" is now properly calibrated!");
p.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
p.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
}
Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE);
MonsterController.convertMonster(m, MonsterDifficulty.ELITE);
}
}
}

View File

@ -100,6 +100,7 @@ public enum ItemSet {
m.setLore(lore); m.setLore(lore);
item.setItemMeta(m); item.setItemMeta(m);
GenericFunctions.UpdateItemLore(item); //Update this item now that we upgraded the tier. GenericFunctions.UpdateItemLore(item); //Update this item now that we upgraded the tier.
GenericFunctions.ConvertSetColor(item, GetSet(item));
if (!found) { if (!found) {
TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1); TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1);
} }

View File

@ -169,7 +169,7 @@ public class Pronouns {
case 13:{ case 13:{
pronouns = new String[]{ pronouns = new String[]{
"withered away.", "withered away.",
"withered away...Never to be seen again/", "withered away...Never to be seen again.",
"did not respect the Wither effect damage.", "did not respect the Wither effect damage.",
"could not handle the Wither effect.", "could not handle the Wither effect.",
"slowly withered into oblivion.", "slowly withered into oblivion.",
@ -217,6 +217,17 @@ public class Pronouns {
"ended up suffocating.", "ended up suffocating.",
}; };
} }
case 17:{
pronouns = new String[]{
"got murdered by the webs of a "+ChatColor.DARK_RED+"Hellfire Spider.",
"suffocated to webs.",
"got completely trapped by sticky webs.",
"was overwhelmed by sticky webs.",
"was slain by the webs of a "+ChatColor.DARK_RED+"Hellfire Spider.",
"got lost in the web.",
"got tangled by webs.",
};
}
} }
return pronouns[(int)(Math.random()*pronouns.length)]; return pronouns[(int)(Math.random()*pronouns.length)];
} }

View File

@ -909,8 +909,7 @@ public class MonsterController {
public static boolean isChargeZombie(Monster m) { public static boolean isChargeZombie(Monster m) {
if ((m.getType()==EntityType.ZOMBIE || m.getType()==EntityType.PIG_ZOMBIE) && if ((m.getType()==EntityType.ZOMBIE || m.getType()==EntityType.PIG_ZOMBIE) &&
MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE && MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE) {
!TwosideKeeper.chargezombies.contains((Monster)m)) {
return true; return true;
} }
return false; return false;
@ -926,4 +925,12 @@ public class MonsterController {
} }
return false; return false;
} }
public static boolean isHellfireSpider(Monster m) {
if ((m.getType()==EntityType.SPIDER || m.getType()==EntityType.CAVE_SPIDER) &&
MonsterController.getMonsterDifficulty(m)==MonsterDifficulty.HELLFIRE) {
return true;
}
return false;
}
} }

View File

@ -101,6 +101,8 @@ public class PlayerStructure {
public int swiftaegisamt=0; public int swiftaegisamt=0;
public PlayerMode lastmode=PlayerMode.NORMAL; public PlayerMode lastmode=PlayerMode.NORMAL;
public List<PotionEffect> lasteffectlist=null; public List<PotionEffect> lasteffectlist=null;
public boolean stealthmode=false;
public long lastcompassnotification=0;
public long iframetime = 0; public long iframetime = 0;

View File

@ -656,15 +656,13 @@ public class Recipes {
Bukkit.addRecipe(explosionarrow_recipe); Bukkit.addRecipe(explosionarrow_recipe);
} }
@SuppressWarnings("deprecation")
public static void Initialize_NotchApple_Recipe() { public static void Initialize_NotchApple_Recipe() {
ItemStack notchapple = new ItemStack(Material.GOLDEN_APPLE);
ShapelessRecipe notchapple_recipe = new ShapelessRecipe(new ItemStack(Material.GOLDEN_APPLE,1,(short)1)); ShapelessRecipe notchapple_recipe = new ShapelessRecipe(new ItemStack(Material.GOLDEN_APPLE,1,(short)1));
notchapple_recipe.addIngredient(8,Material.GOLD_BLOCK); notchapple_recipe.addIngredient(8,Material.GOLD_BLOCK);
notchapple_recipe.addIngredient(Material.APPLE); notchapple_recipe.addIngredient(Material.APPLE);
Bukkit.addRecipe(notchapple_recipe); Bukkit.addRecipe(notchapple_recipe);
} }
public static ItemStack getArrowFromMeta(String string) { public static ItemStack getArrowFromMeta(String string) {
switch (string) { switch (string) {
case "EXPLODE_ARR": { case "EXPLODE_ARR": {

View File

@ -1,6 +1,7 @@
package sig.plugin.TwosideKeeper; package sig.plugin.TwosideKeeper;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -14,6 +15,7 @@ public class ThreadSafeCollection implements Runnable{
Object removal = null; Object removal = null;
Set<? extends Object> obj2 = null; Set<? extends Object> obj2 = null;
List<? extends Object> obj3 = null; List<? extends Object> obj3 = null;
HashMap<? extends Object,? extends Object> obj4 = null;
public ThreadSafeCollection(Collection<? extends Object> obj, Object remove) { public ThreadSafeCollection(Collection<? extends Object> obj, Object remove) {
this.obj=obj; this.obj=obj;
@ -30,6 +32,11 @@ public class ThreadSafeCollection implements Runnable{
this.removal=remove; this.removal=remove;
} }
public ThreadSafeCollection(HashMap<? extends Object,? extends Object> obj, Object remove) {
this.obj4=obj;
this.removal=remove;
}
@Override @Override
public void run() { public void run() {
if (this.obj!=null) { if (this.obj!=null) {
@ -40,6 +47,9 @@ public class ThreadSafeCollection implements Runnable{
} else } else
if (this.obj3!=null) { if (this.obj3!=null) {
this.obj3.remove(removal); this.obj3.remove(removal);
} else
if (this.obj4!=null) {
this.obj4.remove(removal);
} }
} }

View File

@ -19,7 +19,6 @@ import org.bukkit.Color;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.attribute.Attribute; import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -31,7 +30,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
@ -47,6 +45,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow; import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Witch; import org.bukkit.entity.Witch;
@ -60,7 +59,6 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDispenseEvent; import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.AreaEffectCloudApplyEvent;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
@ -133,10 +131,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI; import org.inventivetalent.glow.GlowAPI;
@ -625,10 +621,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
private final class ControlChargeZombies implements Runnable { private final class ControlChargeZombies implements Runnable {
public void run(){ public void run(){
//Control charge zombies.. //Control charge zombies..
for (ChargeZombie cz : chargezombies) { for (ChargeZombie cz : chargezombies.values()) {
if (cz.m==null || !cz.m.isValid() || !cz.isAlive() || !cz.hasTarget() || cz.GetZombie().getLocation().getY()>32) { if (cz.m==null || !cz.m.isValid() || !cz.isAlive() || !cz.hasTarget() || cz.GetZombie().getLocation().getY()>32) {
//This has to be removed... //This has to be removed...
ScheduleRemoval(chargezombies,cz); ScheduleRemoval(chargezombies,cz.m.getUniqueId());
} else { } else {
//This is fine! Clear away blocks. //This is fine! Clear away blocks.
Monster m = cz.GetZombie(); Monster m = cz.GetZombie();
@ -666,6 +662,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
cz.BreakBlocksAroundArea(1); cz.BreakBlocksAroundArea(1);
} }
} }
for (HellfireSpider hs : hellfirespiders.values()) {
if (hs.m==null || !hs.m.isValid() || !hs.isAlive() || !hs.hasTarget() || hs.m.getLocation().getY()>32) {
//This has to be removed...
ScheduleRemoval(hellfirespiders,hs.m.getUniqueId());
} else {
Monster m = hs.GetSpider();
if (Math.random()<=0.08) {
//Fire a sticky web.
Snowball sb = (Snowball)m.getLocation().getWorld().spawnEntity(m.getLocation().add(0,0.3,0), EntityType.SNOWBALL);
sb.setVelocity(m.getLocation().getDirection().multiply(1.3f));
sb.setMetadata("SPIDERBALL", new FixedMetadataValue(TwosideKeeper.plugin,true));
sb.setShooter(m);
m.getWorld().playSound(sb.getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1.0f, 1.0f);
}
}
}
//Control elite monsters. //Control elite monsters.
for (EliteMonster em : elitemonsters) { for (EliteMonster em : elitemonsters) {
if (!em.m.isValid()) { if (!em.m.isValid()) {
@ -680,6 +692,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static void ScheduleRemoval(Set<? extends Object> list, Object remove) { public static void ScheduleRemoval(Set<? extends Object> list, Object remove) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1);
} }
public void ScheduleRemoval(HashMap<? extends Object,? extends Object> map, Object remove) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(map,remove),1);
}
public static void ScheduleRemoval(Collection<? extends Object> list, Object remove) { public static void ScheduleRemoval(Collection<? extends Object> list, Object remove) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1);
} }
@ -856,7 +871,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public int TeamCounter = 0; public int TeamCounter = 0;
public static int time_passed = 0; //The total amount of time lost due to modifications to FullTime(). public static int time_passed = 0; //The total amount of time lost due to modifications to FullTime().
public List<Integer> colors_used = new ArrayList<Integer>(); public List<Integer> colors_used = new ArrayList<Integer>();
public static List<ChargeZombie> chargezombies = new ArrayList<ChargeZombie>(); public static HashMap<UUID,ChargeZombie> chargezombies = new HashMap<UUID,ChargeZombie>();
public static HashMap<UUID,HellfireSpider> hellfirespiders = new HashMap<UUID,HellfireSpider>();
public static List<EliteMonster> elitemonsters = new ArrayList<EliteMonster>(); public static List<EliteMonster> elitemonsters = new ArrayList<EliteMonster>();
public static RecyclingCenter TwosideRecyclingCenter; public static RecyclingCenter TwosideRecyclingCenter;
@ -925,8 +941,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
EssenceLogger = new MysteriousEssenceLogger(); EssenceLogger = new MysteriousEssenceLogger();
BowLogger = new BowModeLogger(); BowLogger = new BowModeLogger();
Loot_Logger = new LootLogger(); Loot_Logger = new LootLogger();
chargezombies = new ArrayList<ChargeZombie>();
habitat_data = new Habitation(); habitat_data = new Habitation();
habitat_data.loadLocationHashesFromConfig(); habitat_data.loadLocationHashesFromConfig();
@ -1166,6 +1180,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//aPlugin.API.sendActionBarMessage(p, "Testing/nMultiple Lines.\nLolz"); //aPlugin.API.sendActionBarMessage(p, "Testing/nMultiple Lines.\nLolz");
//TwosideKeeperAPI.setItemSet(p.getEquipment().getItemInMainHand(), ItemSet.PANROS); //TwosideKeeperAPI.setItemSet(p.getEquipment().getItemInMainHand(), ItemSet.PANROS);
//p.getWorld().dropItemNaturally(p.getLocation(), TwosideKeeperAPI.generateMegaPiece(Material.LEATHER_CHESTPLATE, true, true, 5)); //p.getWorld().dropItemNaturally(p.getLocation(), TwosideKeeperAPI.generateMegaPiece(Material.LEATHER_CHESTPLATE, true, true, 5));
//p.getWorld().dropItemNaturally(p.getLocation(), HUNTERS_COMPASS.getItemStack());
AwakenedArtifact.setEXP(p.getEquipment().getItemInMainHand(), 999);
/*p.getWorld().dropItemNaturally(p.getLocation(), UPGRADE_SHARD.getItemStack()); /*p.getWorld().dropItemNaturally(p.getLocation(), UPGRADE_SHARD.getItemStack());
ItemStack upgrade = UPGRADE_SHARD.getItemStack(); ItemStack upgrade = UPGRADE_SHARD.getItemStack();
GenericFunctions.setUpgradeShardTier(upgrade,3); GenericFunctions.setUpgradeShardTier(upgrade,3);
@ -2011,6 +2027,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Arrow a = (Arrow)ev.getEntity(); Arrow a = (Arrow)ev.getEntity();
a.setCustomName("HIT"); a.setCustomName("HIT");
} }
if (ev.getEntity() instanceof Snowball) {
Snowball sb = (Snowball)ev.getEntity();
if (sb.hasMetadata("SPIDERBALL")) {
GenericFunctions.createRandomWeb(sb.getLocation(),2);
}
}
} }
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
@ -2054,15 +2076,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void onPlayerSneak(PlayerToggleSneakEvent ev) { public void onPlayerSneak(PlayerToggleSneakEvent ev) {
Player p = ev.getPlayer(); Player p = ev.getPlayer();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ev.isSneaking()) { if (ev.isSneaking()) {
pd.stealthmode=!pd.stealthmode;
if (pd.stealthmode) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true); GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p); GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p);
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.8f); p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
} else { } else {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p); GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
} }
} }
} }
}
@EventHandler(priority=EventPriority.LOW) @EventHandler(priority=EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent ev) { public void onPlayerInteract(PlayerInteractEvent ev) {
@ -2127,30 +2153,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
},45); },45);
} else { } else {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
player.sendMessage("The "+name+ChatColor.WHITE+" is now properly calibrated!");
}
},15);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
}
},45);
boolean pointToExistingElite=false; boolean pointToExistingElite=false;
for (int i=0;i<elitemonsters.size();i++) { for (int i=0;i<elitemonsters.size();i++) {
if (Math.random()<=0.5) { if (Math.random()<=0.5) {
TwosideKeeper.ELITE_LOCATION = elitemonsters.get(i).m.getLocation(); TwosideKeeper.ELITE_LOCATION = elitemonsters.get(i).m.getLocation();
pointToExistingElite=true; pointToExistingElite=true;
player.sendMessage("The "+name+ChatColor.WHITE+" is now properly calibrated!");
player.sendMessage(ChatColor.ITALIC+" Good luck on your adventure!");
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
break; break;
} }
} }
if (!pointToExistingElite) { if (!pointToExistingElite) {
GenericFunctions.generateNewElite(); pd.lastcompassnotification=getServerTickTime();
GenericFunctions.generateNewElite(player,name);
} }
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
} }
ev.setCancelled(true); ev.setCancelled(true);
return; return;
@ -3065,6 +3082,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "DRAGON_BREATH": { case "DRAGON_BREATH": {
return Pronouns.ChoosePronoun(0)+" to the breath of the Ender Dragon."; return Pronouns.ChoosePronoun(0)+" to the breath of the Ender Dragon.";
} }
case "Spider Ball": {
return Pronouns.ChoosePronoun(17);
}
default:{ default:{
return "has died by "+pd.lasthitdesc; return "has died by "+pd.lasthitdesc;
} }
@ -3310,7 +3330,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60); newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
} }
GenericFunctions.DealDamageToNearbyMobs(newpos, dmgdealt, 2, true, 0.8d, ev1.getPlayer(), ev.getItemDrop().getItemStack(), true); GenericFunctions.DealDamageToNearbyMobs(newpos, dmgdealt, 2, true, 0.8d, ev1.getPlayer(), ev.getItemDrop().getItemStack(), true);
DecimalFormat df = new DecimalFormat("0.00"); //DecimalFormat df = new DecimalFormat("0.00");
ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f); ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
int range=8; int range=8;
for (int i=0;i<range;i++) { for (int i=0;i<range;i++) {
@ -4676,7 +4696,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
em.Cleanup(); em.Cleanup();
elitemonsters.remove(em); elitemonsters.remove(em);
}},1); }},1);
GenericFunctions.generateNewElite(); GenericFunctions.generateNewElite(null,"");
} }
dropmult = dropmult + (luckmult * 0.5) - (unluckmult * 0.5); dropmult = dropmult + (luckmult * 0.5) - (unluckmult * 0.5);
@ -4785,15 +4805,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log(" Drops "+"["+(drop.size()+originaldroplist.size())+"]: "+ChatColor.GOLD+ChatColor.stripColor(originaldroplist.toString())+ChatColor.WHITE+","+ChatColor.LIGHT_PURPLE+ChatColor.stripColor(drop.toString()),2); log(" Drops "+"["+(drop.size()+originaldroplist.size())+"]: "+ChatColor.GOLD+ChatColor.stripColor(originaldroplist.toString())+ChatColor.WHITE+","+ChatColor.LIGHT_PURPLE+ChatColor.stripColor(drop.toString()),2);
} }
if (monsterdata.containsKey(m.getUniqueId())) {
monsterdata.remove(m.getUniqueId()); monsterdata.remove(m.getUniqueId());
} chargezombies.remove(m.getUniqueId());
for (int i=0;i<chargezombies.size();i++) { hellfirespiders.remove(m.getUniqueId());
if (chargezombies.get(i).m.equals(ev.getEntity())) {
chargezombies.remove(i);
break;
}
}
} }
} }
@ -5299,6 +5313,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getEntity() instanceof Projectile) { if (ev.getEntity() instanceof Projectile) {
Projectile arr = (Projectile)ev.getEntity(); Projectile arr = (Projectile)ev.getEntity();
//Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12); //Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12);
if (arr.getCustomName()==null && (arr instanceof Arrow)) {
if (arr.getType()==EntityType.TIPPED_ARROW) {
//This might be special. Let's get the potion meta.
TippedArrow ta = (TippedArrow)arr;
List<PotionEffect> eff = ta.getCustomEffects();
//This is custom! Let's see what it is.
for (int i=0;i<eff.size();i++) {
PotionEffect pe = eff.get(i);
if (pe.getDuration()==0) {
log("This is special!",5);
if (pe.getType().equals(PotionEffectType.FIRE_RESISTANCE)) {
arr.setMetadata("DOUBLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.SPEED)) {
arr.setMetadata("QUADRUPLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.POISON)) {
arr.setMetadata("POISON_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.WEAKNESS)) {
arr.setMetadata("TRAP_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.INVISIBILITY)) {
arr.setMetadata("EXPLODE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
}
}
}
}
}
if (arr.getShooter() instanceof Player && if (arr.getShooter() instanceof Player &&
arr.getCustomName()==null && (arr instanceof Arrow)) { arr.getCustomName()==null && (arr instanceof Arrow)) {
Player p = (Player)arr.getShooter(); Player p = (Player)arr.getShooter();
@ -5342,35 +5386,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5); log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5);
arr.setCustomName("HIT"); arr.setCustomName("HIT");
} }
if (arr.getCustomName()==null && (arr instanceof Arrow)) {
if (arr.getType()==EntityType.TIPPED_ARROW) {
//This might be special. Let's get the potion meta.
TippedArrow ta = (TippedArrow)arr;
List<PotionEffect> eff = ta.getCustomEffects();
//This is custom! Let's see what it is.
for (int i=0;i<eff.size();i++) {
PotionEffect pe = eff.get(i);
if (pe.getDuration()==0) {
log("This is special!",5);
if (pe.getType().equals(PotionEffectType.FIRE_RESISTANCE)) {
arr.setMetadata("DOUBLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.SPEED)) {
arr.setMetadata("QUADRUPLE_DAMAGE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.POISON)) {
arr.setMetadata("POISON_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.WEAKNESS)) {
arr.setMetadata("TRAP_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
} else
if (pe.getType().equals(PotionEffectType.INVISIBILITY)) {
arr.setMetadata("EXPLODE_ARR", new FixedMetadataValue(TwosideKeeper.plugin,true));
}
}
}
}
}
} }
} }
@ -5579,9 +5594,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int essence_tier=-1; int essence_tier=-1;
int core_tier=-1; int core_tier=-1;
int base_tier=-1; int base_tier=-1;
boolean hasdye=false;
ItemStack artifact_item=null; ItemStack artifact_item=null;
boolean pumpkin_seeds=false; boolean pumpkin_seeds=false;
for (int i=1;i<ev.getInventory().getSize();i++) { for (int i=1;i<ev.getInventory().getSize();i++) {
if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
ev.getInventory().getItem(i).getType()==Material.INK_SACK) {
//We are not supposed to be in here!
hasdye=true;
}
if (ev.getInventory().getItem(i)!=null && if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR && ev.getInventory().getItem(i).getType()!=Material.AIR &&
Artifact.isArtifact(ev.getInventory().getItem(i))) { Artifact.isArtifact(ev.getInventory().getItem(i))) {
@ -5626,11 +5648,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (ev.getInventory().getItem(i)!=null && if (ev.getInventory().getItem(i)!=null &&
ev.getInventory().getItem(i).getType()!=Material.AIR && ev.getInventory().getItem(i).getType()!=Material.AIR &&
!Artifact.isArtifact(ev.getInventory().getItem(i))) { !Artifact.isArtifact(ev.getInventory().getItem(i)) &&
!hasdye) {
log("One of these is not an artifact",5); log("One of these is not an artifact",5);
ev.getInventory().setResult(new ItemStack(Material.AIR)); //Don't allow it, an item is not an artifact! ev.getInventory().setResult(new ItemStack(Material.AIR)); //Don't allow it, an item is not an artifact!
} }
} }
if (!hasdye) {
if (items_found==1 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) { if (items_found==1 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
//This is a recipe->Base item conversion. //This is a recipe->Base item conversion.
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found); ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found);
@ -5719,6 +5743,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
}
//We are looking for an artifact recipe. //We are looking for an artifact recipe.
@ -5855,8 +5880,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//getConfig().set("ARTIFACT_RARITY", ARTIFACT_RARITY); //getConfig().set("ARTIFACT_RARITY", ARTIFACT_RARITY);
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue()); getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN); getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
if (ELITE_LOCATION!=null) {
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX()); getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ()); getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ());
}
//getConfig().set("MOTD", MOTD); //It makes no sense to save the MOTD as it will never be modified in-game. //getConfig().set("MOTD", MOTD); //It makes no sense to save the MOTD as it will never be modified in-game.
saveConfig(); saveConfig();
@ -5953,7 +5980,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
GenericFunctions.generateNewElite(); GenericFunctions.generateNewElite(null,"");
} }
},20); },20);
} }