->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.
dev
sigonasr2 9 years ago
parent 4a59c504ba
commit cf47e38849
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 26
      src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
  4. 49
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  5. 22
      src/sig/plugin/TwosideKeeper/HellfireSpider.java
  6. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  7. 96
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactItemType.java
  8. 119
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  9. 49
      src/sig/plugin/TwosideKeeper/HelperStructures/EliteMonsterLocationFinder.java
  10. 1
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  11. 13
      src/sig/plugin/TwosideKeeper/HelperStructures/Pronouns.java
  12. 11
      src/sig/plugin/TwosideKeeper/MonsterController.java
  13. 2
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  14. 4
      src/sig/plugin/TwosideKeeper/Recipes.java
  15. 10
      src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java
  16. 329
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

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

@ -45,7 +45,7 @@ public class AwakenedArtifact {
int expval = Integer.parseInt(exp);
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.
}
public static ItemStack setEXP(ItemStack artifact, int amt) {
@ -63,7 +63,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static ItemStack addEXP(ItemStack artifact, int amt, Player p) {
@ -113,7 +113,7 @@ public class AwakenedArtifact {
int LV = Integer.parseInt(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.
}
public static ItemStack setLV(ItemStack artifact, int amt, Player p) {
@ -131,7 +131,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static ItemStack addAP(ItemStack artifact, int amt) {
@ -148,7 +148,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static ItemStack setAP(ItemStack artifact, int newamt) {
@ -164,7 +164,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static int getAP(ItemStack artifact) {
@ -185,7 +185,7 @@ public class AwakenedArtifact {
return level-apused;*/
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;
}
public static ItemStack addMaxAP(ItemStack artifact, int amt) {
@ -202,7 +202,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static ItemStack setMaxAP(ItemStack artifact, int newamt) {
@ -218,7 +218,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
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;
}
public static int getMaxAP(ItemStack artifact) {
@ -239,7 +239,7 @@ public class AwakenedArtifact {
return level-apused;*/
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;
}
public static ItemStack addLV(ItemStack artifact, int amt, Player p) {
@ -252,7 +252,7 @@ public class AwakenedArtifact {
String potentialline = lore.get(4);
return Integer.parseInt(ChatColor.stripColor(potentialline.split("Potential: ")[1].replace("%", "")));
} 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;
}
}
@ -267,7 +267,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
return artifact;
} 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;
}
}
@ -282,7 +282,7 @@ public class AwakenedArtifact {
artifact.setItemMeta(m);
return artifact;
} 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;
}
}

@ -25,6 +25,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Spider;
import org.bukkit.entity.TippedArrow;
import org.bukkit.event.entity.EntityDamageEvent;
@ -53,6 +54,7 @@ public class CustomDamage {
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 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!
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) {
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())))));
if (shooter instanceof Player) {
@ -386,14 +397,23 @@ public class CustomDamage {
GenericFunctions.isArtifactWeapon(weapon)) {
double ratio = 1.0-CalculateDamageReduction(1,target,p);
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 {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.storedbowxp+=(int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1);
pd.lasthittarget=TwosideKeeper.getServerTickTime();
}
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;
@ -401,22 +421,21 @@ public class CustomDamage {
applyDeathMark=true;
}
for (int i=0;i<hitlist.size();i++) {
if (!hitlist.get(i).equals(target)) {
for (LivingEntity ent : hitlist) {
if (!ent.equals(target)) {
//hitlist.get(i).damage(dmg);
//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) {
GenericFunctions.ApplyDeathMark(hitlist.get(i));
GenericFunctions.ApplyDeathMark(ent);
}
}
final List<LivingEntity> finallist = hitlist;
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() {
for (int i=0;i<finallist.size();i++) {
LivingEntity le = finallist.get(i);
for (LivingEntity le : finallist) {
if (le!=null && !le.isDead() && !le.hasPotionEffect(PotionEffectType.UNLUCK)) {
GenericFunctions.ResetMobName(le);
//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) {
addChargeZombieToList(m);
addHellfireSpiderToList(m);
addMonsterToTargetList(m,p);
}
static void addChargeZombieToList(Monster m) {
if (MonsterController.isChargeZombie(m)) {
TwosideKeeper.chargezombies.add(new ChargeZombie((Monster)m));
if (!TwosideKeeper.chargezombies.containsKey(m.getUniqueId()) &&
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);
}
}

@ -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;
}
}

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

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

@ -1,6 +1,5 @@
package sig.plugin.TwosideKeeper.HelperStructures.Common;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@ -38,8 +37,6 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import org.inventivetalent.glow.GlowAPI.Color;
import aPlugin.DiscordMessageSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
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.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
@ -2059,11 +2056,8 @@ public class GenericFunctions {
public static boolean isArtifactWeapon(ItemStack item) {
if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("BOW") ||
(item.getType().toString().contains("AXE") && !item.getType().toString().contains("PICKAXE")) ||
item.getType().toString().contains("SWORD") ||
item.getType().toString().contains("FISHING_ROD") ||
item.getType().toString().contains("HOE"))) {
item.getType()!=Material.AIR && isWeapon(item) &&
Artifact.isArtifact(item)) {
return true;
} else {
return false;
@ -2071,10 +2065,8 @@ public class GenericFunctions {
}
public static boolean isArtifactArmor(ItemStack item) {
if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("BOOTS") ||
item.getType().toString().contains("CHESTPLATE") ||
item.getType().toString().contains("LEGGINGS") ||
item.getType().toString().contains("HELMET"))) {
item.getType()!=Material.AIR && isArmor(item) &&
Artifact.isArtifact(item)) {
return true;
} else {
return false;
@ -2083,9 +2075,8 @@ public class GenericFunctions {
public static boolean isArtifactTool(ItemStack item) {
if (item!=null &&
item.getType()!=Material.AIR && (item.getType().toString().contains("SPADE") ||
item.getType().toString().contains("AXE")||
item.getType().toString().contains("HOE"))) {
item.getType()!=Material.AIR && isHarvestingTool(item) &&
Artifact.isArtifact(item)) {
return true;
} else {
return false;
@ -2769,7 +2760,7 @@ public class GenericFunctions {
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);
//p.removePotionEffect(type);
logAndApplyPotionEffectToPlayer(type,0,0,p,true);
logAndApplyPotionEffectToPlayer(type,1,0,p,true);
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.RED+"THIS SHOULD NOT BE HAPPENING! Reporting", TwosideKeeper.POTION_DEBUG_LEVEL);
@ -3081,12 +3072,21 @@ public class GenericFunctions {
}
UpdateOldRangerPieces(item);
UpdateArtifactDust(item);
UpdateArtifactItemType(item);
UpdateVials(item);
UpdateHuntersCompass(item);
UpdateUpgradeShard(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) {
if (item.getType()==Material.COMPASS &&
item.containsEnchantment(Enchantment.LUCK)) {
@ -3187,24 +3187,30 @@ public class GenericFunctions {
if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) {
TwosideKeeper.log("->In here",5);
ItemSet set = TwosideKeeperAPI.getItemSet(item);
if (set==ItemSet.JAMDAK) {
lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0));
}
if (set==ItemSet.DARNYS) {
lm.setColor(org.bukkit.Color.fromRGB(224, 224, 224));
}
if (set==ItemSet.ALIKAHN) {
lm.setColor(org.bukkit.Color.fromRGB(64, 0, 64));
}
if (set==ItemSet.LORASAADI) {
lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0));
}
ConvertSetColor(item, set);
}
item.setItemMeta(lm);
}
}
}
public static void ConvertSetColor(ItemStack item, ItemSet set) {
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
if (set==ItemSet.JAMDAK) {
lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0));
}
if (set==ItemSet.DARNYS) {
lm.setColor(org.bukkit.Color.fromRGB(224, 224, 224));
}
if (set==ItemSet.ALIKAHN) {
lm.setColor(org.bukkit.Color.fromRGB(64, 0, 64));
}
if (set==ItemSet.LORASAADI) {
lm.setColor(org.bukkit.Color.fromRGB(0, 64, 0));
}
item.setItemMeta(lm);
}
public static ExperienceOrb spawnXP(Location location, int expAmount) {
ExperienceOrb orb = location.getWorld().spawn(location, ExperienceOrb.class);
orb.setExperience(orb.getExperience() + expAmount);
@ -3452,20 +3458,28 @@ public class GenericFunctions {
int randomx = (int)((Math.random()*10000) - 5000);
int randomz = (int)((Math.random()*10000) - 5000);
Location testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
do {
randomx = (int)((Math.random()*10000) - 5000);
randomz = (int)((Math.random()*10000) - 5000);
testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load(); } while
((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) &&
AllNaturalBlocks(testloc.getBlock(),16,8,16));
return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz);
testloc.getChunk().load();
int loopmax=5;
int i = 0;
while (i<loopmax) {
randomx = (int)((Math.random()*10000) - 5000);
randomz = (int)((Math.random()*10000) - 5000);
testloc = new Location(Bukkit.getWorld("world"),randomx,96,randomz);
testloc.getChunk().load();
if ((testloc.getBlock().getType()!=Material.AIR || testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) &&
AllNaturalBlocks(testloc.getBlock(),16,8,16)) {
return new Location(Bukkit.getWorld("world"),randomx,testloc.getBlockY(),randomz);
} else {
testloc.getChunk().unload();
TwosideKeeper.log("Failed location "+testloc.toString(), 4);
i++;
}
}
return null;
}
public static void generateNewElite() {
TwosideKeeper.ELITE_LOCATION = defineNewEliteLocation();
Monster m = (Monster)TwosideKeeper.ELITE_LOCATION.getWorld().spawnEntity(TwosideKeeper.ELITE_LOCATION, EntityType.ZOMBIE);
MonsterController.convertMonster(m, MonsterDifficulty.ELITE);
public static void generateNewElite(Player p, String name) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l);
}
public static boolean isHunterCompass(ItemStack item) {
@ -3771,4 +3785,27 @@ public class GenericFunctions {
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);
}
}
}
}
}
}
}

@ -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);
}
}
}

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

@ -169,7 +169,7 @@ public class Pronouns {
case 13:{
pronouns = new String[]{
"withered away.",
"withered away...Never to be seen again/",
"withered away...Never to be seen again.",
"did not respect the Wither effect damage.",
"could not handle the Wither effect.",
"slowly withered into oblivion.",
@ -217,6 +217,17 @@ public class Pronouns {
"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)];
}

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

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

@ -656,15 +656,13 @@ public class Recipes {
Bukkit.addRecipe(explosionarrow_recipe);
}
@SuppressWarnings("deprecation")
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));
notchapple_recipe.addIngredient(8,Material.GOLD_BLOCK);
notchapple_recipe.addIngredient(Material.APPLE);
Bukkit.addRecipe(notchapple_recipe);
}
public static ItemStack getArrowFromMeta(String string) {
switch (string) {
case "EXPLODE_ARR": {

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

@ -19,7 +19,6 @@ import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
@ -31,7 +30,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Creeper;
@ -47,6 +45,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
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.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.AreaEffectCloudApplyEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityChangeBlockEvent;
@ -133,10 +131,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
@ -625,10 +621,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
private final class ControlChargeZombies implements Runnable {
public void run(){
//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) {
//This has to be removed...
ScheduleRemoval(chargezombies,cz);
ScheduleRemoval(chargezombies,cz.m.getUniqueId());
} else {
//This is fine! Clear away blocks.
Monster m = cz.GetZombie();
@ -666,6 +662,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
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.
for (EliteMonster em : elitemonsters) {
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) {
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) {
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 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 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 RecyclingCenter TwosideRecyclingCenter;
@ -925,8 +941,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
EssenceLogger = new MysteriousEssenceLogger();
BowLogger = new BowModeLogger();
Loot_Logger = new LootLogger();
chargezombies = new ArrayList<ChargeZombie>();
habitat_data = new Habitation();
habitat_data.loadLocationHashesFromConfig();
@ -1166,6 +1180,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//aPlugin.API.sendActionBarMessage(p, "Testing/nMultiple Lines.\nLolz");
//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(), HUNTERS_COMPASS.getItemStack());
AwakenedArtifact.setEXP(p.getEquipment().getItemInMainHand(), 999);
/*p.getWorld().dropItemNaturally(p.getLocation(), UPGRADE_SHARD.getItemStack());
ItemStack upgrade = UPGRADE_SHARD.getItemStack();
GenericFunctions.setUpgradeShardTier(upgrade,3);
@ -2011,6 +2027,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Arrow a = (Arrow)ev.getEntity();
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)
@ -2054,12 +2076,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void onPlayerSneak(PlayerToggleSneakEvent ev) {
Player p = ev.getPlayer();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ev.isSneaking()) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p);
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.8f);
} else {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
pd.stealthmode=!pd.stealthmode;
if (pd.stealthmode) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p);
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
} else {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
}
}
}
}
@ -2127,30 +2153,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
},45);
} 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;
for (int i=0;i<elitemonsters.size();i++) {
if (Math.random()<=0.5) {
TwosideKeeper.ELITE_LOCATION = elitemonsters.get(i).m.getLocation();
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;
}
}
if (!pointToExistingElite) {
GenericFunctions.generateNewElite();
pd.lastcompassnotification=getServerTickTime();
GenericFunctions.generateNewElite(player,name);
}
player.setCompassTarget(TwosideKeeper.ELITE_LOCATION);
}
ev.setCancelled(true);
return;
@ -3065,6 +3082,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
case "DRAGON_BREATH": {
return Pronouns.ChoosePronoun(0)+" to the breath of the Ender Dragon.";
}
case "Spider Ball": {
return Pronouns.ChoosePronoun(17);
}
default:{
return "has died by "+pd.lasthitdesc;
}
@ -3310,7 +3330,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
}
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);
int range=8;
for (int i=0;i<range;i++) {
@ -4676,7 +4696,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
em.Cleanup();
elitemonsters.remove(em);
}},1);
GenericFunctions.generateNewElite();
GenericFunctions.generateNewElite(null,"");
}
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);
}
if (monsterdata.containsKey(m.getUniqueId())) {
monsterdata.remove(m.getUniqueId());
}
for (int i=0;i<chargezombies.size();i++) {
if (chargezombies.get(i).m.equals(ev.getEntity())) {
chargezombies.remove(i);
break;
}
}
monsterdata.remove(m.getUniqueId());
chargezombies.remove(m.getUniqueId());
hellfirespiders.remove(m.getUniqueId());
}
}
@ -5299,6 +5313,36 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ev.getEntity() instanceof Projectile) {
Projectile arr = (Projectile)ev.getEntity();
//Arrow newarrow = arr.getLocation().getWorld().spawnArrow(arr.getLocation(), arr.getVelocity(), 1, 12);
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 &&
arr.getCustomName()==null && (arr instanceof Arrow)) {
Player p = (Player)arr.getShooter();
@ -5342,35 +5386,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5);
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 core_tier=-1;
int base_tier=-1;
boolean hasdye=false;
ItemStack artifact_item=null;
boolean pumpkin_seeds=false;
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 &&
ev.getInventory().getItem(i).getType()!=Material.AIR &&
Artifact.isArtifact(ev.getInventory().getItem(i))) {
@ -5626,96 +5648,99 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else
if (ev.getInventory().getItem(i)!=null &&
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);
ev.getInventory().setResult(new ItemStack(Material.AIR)); //Don't allow it, an item is not an artifact!
}
}
if (items_found==1 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
//This is a recipe->Base item conversion.
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found);
//Add more information for this.
ev.getInventory().setResult(AwakenedArtifact.convertToAwakenedArtifact(newitem, tier_found, ev.getInventory().getItem(slot_found).getDurability()));
}
if (items_found==2 && slot_found!=0 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
log("Artifact tier: "+artifact_tier+", Tier Found: "+tier_found,2);
if (artifact_tier!=tier_found || tier_found==15) {
ev.getInventory().setResult(new ItemStack(Material.AIR));
} else {
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found+1);
if (!hasdye) {
if (items_found==1 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
//This is a recipe->Base item conversion.
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found);
//Add more information for this.
ItemStack newartifact = AwakenedArtifact.convertToAwakenedArtifact(newitem, tier_found+1, ev.getInventory().getItem(slot_found).getDurability()).clone();
List<String> transferlore = artifact_item.getItemMeta().getLore();
ItemMeta m = newartifact.getItemMeta();
m.setLore(transferlore);
newartifact.setItemMeta(m);
GenericFunctions.addObscureHardenedItemBreaks(newartifact, 5-GenericFunctions.getObscureHardenedItemBreaks(newartifact));
//Lines can all be transferred over. No lines need to be preserved.
for (Enchantment e : newartifact.getEnchantments().keySet()) {
if (newartifact.containsEnchantment(e) && artifact_item.getEnchantmentLevel(e)>newartifact.getEnchantmentLevel(e)) {
log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
ev.getInventory().setResult(AwakenedArtifact.convertToAwakenedArtifact(newitem, tier_found, ev.getInventory().getItem(slot_found).getDurability()));
}
if (items_found==2 && slot_found!=0 && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
log("Artifact tier: "+artifact_tier+", Tier Found: "+tier_found,2);
if (artifact_tier!=tier_found || tier_found==15) {
ev.getInventory().setResult(new ItemStack(Material.AIR));
} else {
ItemStack newitem = ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found+1);
//Add more information for this.
ItemStack newartifact = AwakenedArtifact.convertToAwakenedArtifact(newitem, tier_found+1, ev.getInventory().getItem(slot_found).getDurability()).clone();
List<String> transferlore = artifact_item.getItemMeta().getLore();
ItemMeta m = newartifact.getItemMeta();
m.setLore(transferlore);
newartifact.setItemMeta(m);
GenericFunctions.addObscureHardenedItemBreaks(newartifact, 5-GenericFunctions.getObscureHardenedItemBreaks(newartifact));
//Lines can all be transferred over. No lines need to be preserved.
for (Enchantment e : newartifact.getEnchantments().keySet()) {
if (newartifact.containsEnchantment(e) && artifact_item.getEnchantmentLevel(e)>newartifact.getEnchantmentLevel(e)) {
log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
}
}
}
for (int i=0;i<artifact_item.getEnchantments().size();i++) {
Enchantment e = (Enchantment)artifact_item.getEnchantments().keySet().toArray()[i];
if (!newartifact.containsEnchantment(e)) {
//log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
for (int i=0;i<artifact_item.getEnchantments().size();i++) {
Enchantment e = (Enchantment)artifact_item.getEnchantments().keySet().toArray()[i];
if (!newartifact.containsEnchantment(e)) {
//log("Contains "+e.toString()+" "+newartifact.getEnchantmentLevel(e), 2);
//These are the enchantments that clash. If the resultitem ones are greater, apply them to the new item.
newartifact.addUnsafeEnchantment(e, artifact_item.getEnchantmentLevel(e));
log("Applied "+e.getName()+" "+artifact_item.getEnchantmentLevel(e)+" to the artifact",2);
}
}
newartifact.setDurability((short)(newartifact.getType().getMaxDurability()*(artifact_item.getDurability()/artifact_item.getType().getMaxDurability())));
ev.getInventory().setResult(newartifact);
}
newartifact.setDurability((short)(newartifact.getType().getMaxDurability()*(artifact_item.getDurability()/artifact_item.getType().getMaxDurability())));
ev.getInventory().setResult(newartifact);
}
}
if (items_found==3 && !pumpkin_seeds && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),5);
//Decompose this into a higher tier of the next item.
if (tier==tier_recipe && tier<14) {
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
ItemMeta m = newitem1.getItemMeta();
List<String> lore = m.getLore();
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Crafting Recipe");
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getItemName())+" Recipe");
newitem1.setItemMeta(m);
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier+1);
ev.getInventory().setResult(newitem1);
} else {
ev.getInventory().setResult(new ItemStack(Material.AIR));
if (items_found==3 && !pumpkin_seeds && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR) {
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),5);
//Decompose this into a higher tier of the next item.
if (tier==tier_recipe && tier<14) {
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
ItemMeta m = newitem1.getItemMeta();
List<String> lore = m.getLore();
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Crafting Recipe");
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getItemName())+" Recipe");
newitem1.setItemMeta(m);
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier+1);
ev.getInventory().setResult(newitem1);
} else {
ev.getInventory().setResult(new ItemStack(Material.AIR));
}
}
}
if (items_found==5 && !pumpkin_seeds && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR
) {
if (essence_tier==4 && core_tier==4 && base_tier==4) {
//It's allowed! Set the result to T10 recipe.
TwosideKeeper.log("It is found.", 2);
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
ItemMeta m = newitem1.getItemMeta();
List<String> lore = m.getLore();
int tier=14;
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier)+" Crafting Recipe");
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getItemName())+" Recipe");
newitem1.setItemMeta(m);
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier);
ev.getInventory().setResult(newitem1);
} else {
ev.getInventory().setResult(new ItemStack(Material.AIR));
if (items_found==5 && !pumpkin_seeds && ev.getInventory().getResult().getType()!=null && ev.getInventory().getResult().getType()!=Material.AIR
) {
if (essence_tier==4 && core_tier==4 && base_tier==4) {
//It's allowed! Set the result to T10 recipe.
TwosideKeeper.log("It is found.", 2);
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
ItemMeta m = newitem1.getItemMeta();
List<String> lore = m.getLore();
int tier=14;
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier)+" Crafting Recipe");
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
m.setLore(lore);
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getItemName())+" Recipe");
newitem1.setItemMeta(m);
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier);
ev.getInventory().setResult(newitem1);
} else {
ev.getInventory().setResult(new ItemStack(Material.AIR));
}
}
}
}
@ -5855,8 +5880,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//getConfig().set("ARTIFACT_RARITY", ARTIFACT_RARITY);
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ());
if (ELITE_LOCATION!=null) {
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
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.
saveConfig();
@ -5953,7 +5980,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
GenericFunctions.generateNewElite();
GenericFunctions.generateNewElite(null,"");
}
},20);
}

Loading…
Cancel
Save