diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index b81a358..61ad5cd 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index e615723..2e91ffb 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -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. diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java index fd7d170..26c11f6 100644 --- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java +++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java @@ -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; } } diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 2d46963..834b1f4 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -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 hitlist = getAOEList(weapon,target); + List hitlist = new ArrayList(); + 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 finallist = hitlist; Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() { public void run() { - for (int i=0;iIn 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 lasteffectlist=null; + public boolean stealthmode=false; + public long lastcompassnotification=0; public long iframetime = 0; diff --git a/src/sig/plugin/TwosideKeeper/Recipes.java b/src/sig/plugin/TwosideKeeper/Recipes.java index 10317a2..4eeb7cb 100644 --- a/src/sig/plugin/TwosideKeeper/Recipes.java +++ b/src/sig/plugin/TwosideKeeper/Recipes.java @@ -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": { diff --git a/src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java b/src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java index d7fb243..43160cb 100644 --- a/src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java +++ b/src/sig/plugin/TwosideKeeper/ThreadSafeCollection.java @@ -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 obj2 = null; List obj3 = null; + HashMap obj4 = null; public ThreadSafeCollection(Collection obj, Object remove) { this.obj=obj; @@ -29,6 +31,11 @@ public class ThreadSafeCollection implements Runnable{ this.obj3=obj; this.removal=remove; } + + public ThreadSafeCollection(HashMap 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); } } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index def2570..330b882 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -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 list, Object remove) { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(list,remove),1); } + public void ScheduleRemoval(HashMap map, Object remove) { + Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new ThreadSafeCollection(map,remove),1); + } public static void ScheduleRemoval(Collection 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 colors_used = new ArrayList(); - public static List chargezombies = new ArrayList(); + public static HashMap chargezombies = new HashMap(); + public static HashMap hellfirespiders = new HashMap(); public static List elitemonsters = new ArrayList(); 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(); 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 eff = ta.getCustomEffects(); + //This is custom! Let's see what it is. + for (int i=0;i eff = ta.getCustomEffects(); - //This is custom! Let's see what it is. - for (int i=0;iBase 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 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 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==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 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 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==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 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 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); }