Mob Heads now bug-free (Crafting + looting + identification all work

perfectly now). Cave filler code added.
dev
sigonasr2 11 years ago
parent 2b40b15d50
commit 3082887b1f
  1. 7
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 236
      BankEconomyMod/src/me/kaZep/Base/MobHead.java
  3. 13
      BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java
  4. 97
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  5. 149
      BankEconomyMod/src/me/kaZep/Base/TerrainManager.java
  6. 185
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -1450,6 +1450,11 @@ public void onDisable()
natural_mats.add(Material.SAND);
natural_mats.add(Material.CLAY);
natural_mats.add(Material.WEB);
natural_mats.add(Material.LAVA);
natural_mats.add(Material.WATER);
natural_mats.add(Material.AIR);
natural_mats.add(Material.MOSSY_COBBLESTONE);
natural_mats.add(Material.COAL_ORE);
natural_mats.add(Material.IRON_ORE);
natural_mats.add(Material.GOLD_ORE);
natural_mats.add(Material.DIAMOND_ORE);
@ -6523,11 +6528,13 @@ public void payDay(int time)
*/
public int getMobHeadAmt(MobHead mobhead, List<MobHead> mobheads) {
int same_amt=0;
if (mobheads!=null) {
for (int i=0;i<mobheads.size();i++) {
if (mobhead.equals(mobheads.get(i))) {
same_amt++;
}
}
}
return same_amt;
}
}

@ -27,7 +27,7 @@ public class MobHead {
}
MobHeadType head_type = null;
MobHeadRareType rare_head_type =null;
boolean rare_head;
boolean rare_head=false;
boolean is_powered=false;
/**
* Compares if two MobHeads are equal to each other
@ -291,7 +291,7 @@ public class MobHead {
Main.plugin.getConfig().set(key, Main.plugin.getConfig().getInt(key)+1);
newhead.setItemMeta(skullMeta);
ItemMeta meta = newhead.getItemMeta();
meta.setDisplayName(ChatColor.BLUE+"Rare Spider Head");
//meta.setDisplayName(ChatColor.BLUE+"Rare Spider Head");
List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration");
@ -452,101 +452,239 @@ public class MobHead {
static public MobHead getMobHead(ItemStack item) {
if (item!=null && item.getType()==Material.SKULL_ITEM && item.hasItemMeta() && item.getItemMeta().hasLore()) {
List<String> getLore = item.getItemMeta().getLore();
MobHeadType headtype = null;
MobHeadRareType raretype = null;
boolean powered = false;
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither I"+ChatColor.GOLD+" duration")) {
return new MobHead(MobHeadType.WITHER_SKELETON);
//return new MobHead(MobHeadType.WITHER_SKELETON);
headtype=MobHeadType.WITHER_SKELETON;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Ranged Damage")) {
return new MobHead(MobHeadType.SKELETON);
//return new MobHead(MobHeadType.SKELETON);
headtype=MobHeadType.SKELETON;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Lifesteal")) {
return new MobHead(MobHeadType.ZOMBIE);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage")) {
return new MobHead(MobHeadType.CREEPER);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit")) {
return new MobHead(MobHeadType.SPIDER);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance")) {
return new MobHead(MobHeadType.ENDERMAN);
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration")) {
return new MobHead(MobHeadType.CAVE_SPIDER);
//return new MobHead(MobHeadType.ZOMBIE);
headtype=MobHeadType.ZOMBIE;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"AoE Damage"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.CREEPER);
headtype=MobHeadType.CREEPER;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.SPIDER);
headtype=MobHeadType.SPIDER;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Critical Chance"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.ENDERMAN);
headtype=MobHeadType.ENDERMAN;
}
if ((getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration")) &&
!getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Slow on hit"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.CAVE_SPIDER);
headtype=MobHeadType.CAVE_SPIDER;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second ignite duration")) {
return new MobHead(MobHeadType.BLAZE);
//return new MobHead(MobHeadType.BLAZE);
headtype=MobHeadType.BLAZE;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit")) {
return new MobHead(MobHeadType.GHAST);
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit") ||
getLore.contains(ChatColor.LIGHT_PURPLE+"-1% "+ChatColor.GOLD+"damage taken on hit"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.GHAST);
headtype=MobHeadType.GHAST;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of being fully")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN);
//return new MobHead(MobHeadType.ZOMBIE_PIGMAN);
headtype=MobHeadType.ZOMBIE_PIGMAN;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of setting the")) {
return new MobHead(MobHeadType.MAGMA_CUBE);
//return new MobHead(MobHeadType.MAGMA_CUBE);
headtype=MobHeadType.MAGMA_CUBE;
}
boolean ampersand=false;
for (int i=0;i<getLore.size();i++) {
if (getLore.get(i).contains(ChatColor.BLUE+" &")) {
powered=true;
ampersand=true;
}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+15 "+ChatColor.GOLD+"second "+ChatColor.GRAY+"Wither III"+ChatColor.GOLD+" duration")) {
return new MobHead(MobHeadType.WITHER_SKELETON, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.WITHER_SKELETON, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.WITHER_SKELETON;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.GOLD+"Stacks Wither effect by 1")) {
headtype=MobHeadType.WITHER_SKELETON;
powered=true;
}
if (getLore.contains(ChatColor.GOLD+"Stacks Wither effect by 2")) {
headtype=MobHeadType.WITHER_SKELETON;
raretype=MobHeadRareType.RARE_TYPE_A;
powered=true;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Ranged Damage")) {
return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.SKELETON;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed")) {
return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.SKELETON, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.SKELETON;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"Lifesteal")) {
return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.ZOMBIE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Max Health")) {
return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.ZOMBIE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ZOMBIE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"Damage to all nearby enemies.")) {
return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.ZOMBIE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+20% "+ChatColor.GOLD+"AoE Damage")) {
return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.CREEPER, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.CREEPER;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration on hit")) {
return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_A);
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration") &&
!getLore.contains(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.SPIDER;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+15% "+ChatColor.GOLD+"Slow on hit")) {
return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.SPIDER, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.SPIDER;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"Item Drop Amount Increase")) {
return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.ENDERMAN;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Critical Chance")) {
return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.ENDERMAN, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ENDERMAN;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"of snaring a target")) {
return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.CAVE_SPIDER;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second Poison duration")) {
return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.CAVE_SPIDER, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.CAVE_SPIDER;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down")) {
return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.GHAST;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-5% "+ChatColor.GOLD+"damage taken on hit")) {
return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.GHAST;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of dropping a")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.ZOMBIE_PIGMAN;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of being fully")) {
return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.ZOMBIE_PIGMAN, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ZOMBIE_PIGMAN;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of burning an")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of setting the")) {
return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
}
////////////////////////////////////////////
if (getLore.contains(ChatColor.LIGHT_PURPLE+"-10% "+ChatColor.GOLD+"damage taken on hit"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.GHAST;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second ignite duration")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.BLAZE;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5 "+ChatColor.GOLD+"second Poison duration")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.CAVE_SPIDER;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"Critical Chance"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ENDERMAN;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+30% "+ChatColor.GOLD+"Slow on hit"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.SPIDER;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+30% "+ChatColor.GOLD+"AoE Damage"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.CREEPER;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Lifesteal"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ZOMBIE;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Ranged Damage"+ChatColor.BLUE+" &")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.SKELETON;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+10% "+ChatColor.GOLD+"chance of setting the")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.MAGMA_CUBE;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"chance of being fully")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.ZOMBIE_PIGMAN;
raretype=MobHeadRareType.RARE_TYPE_A;
}
if (getLore.contains(ChatColor.GOLD+"Stacks Wither effect by 2") || getLore.contains(ChatColor.GOLD+"Stacks Wither effect by 1")) {
powered=true;
}
if (raretype!=null) {
return new MobHead(headtype,true,raretype,powered);
} else {
return new MobHead(headtype,false,powered);
}
}
return null;
@ -556,7 +694,7 @@ public class MobHead {
* Checks if the given head is powered or
* unpowered.
* @param head The mob head to check for.
* @return Returns true if the head is powered
* @return Returns true if the head is unpowered
* or false otherwise.
*/
static public boolean isUnpoweredHead(MobHead head) {
@ -645,9 +783,9 @@ public class MobHead {
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.LIGHT_PURPLE+"+2 "+ChatColor.GOLD+"second Poison duration");
newLore.add(ChatColor.GOLD+" on hit."+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+1% "+ChatColor.GOLD+"chance of snaring the");
newLore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance of snaring the");
newLore.add(ChatColor.GOLD+" target for 5 seconds.");
meta.setLore(newLore);
newitem.setItemMeta(meta);
@ -710,7 +848,7 @@ public class MobHead {
getLore.contains(ChatColor.LIGHT_PURPLE+"+1 "+ChatColor.GOLD+"m/s Projectile Speed")) {
ItemMeta meta = newitem.getItemMeta();
List<String> newLore = new ArrayList<String>();
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Ranged Damage "+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+5% "+ChatColor.GOLD+"Ranged Damage"+ChatColor.BLUE+" &");
newLore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"m/s Projectile Speed");
meta.setLore(newLore);
newitem.setItemMeta(meta);
@ -823,7 +961,7 @@ public class MobHead {
}
@Override
public String toString() {
return "MobHead(Type: "+head_type.name()+", Rare Type: "+rare_head_type.name()+", is_rare:"+rare_head+", is_powered:"+is_powered+")";
return "MobHead(Type: "+(head_type!=null?head_type.name():"null")+", Rare Type: "+(rare_head_type!=null?rare_head_type.name():"null")+", is_rare:"+rare_head+", is_powered:"+is_powered+")";
}
public MobHead(MobHeadType head_type) {
MobHead(head_type, false, MobHeadRareType.RARE_TYPE_A, false);

@ -8,6 +8,8 @@ import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import me.kaZep.Base.MobHead.MobHeadRareType;
import me.kaZep.Base.MobHead.MobHeadType;
import me.kaZep.Commands.JobsDataInfo.Job;
import org.bukkit.Bukkit;
@ -157,6 +159,17 @@ public class PlayerBuffData {
}
}
}
if (p.getInventory()!=null) {
List<MobHead> playerheads = this.plugin.getMobHeads(p);
int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads);
int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads);
Bukkit.getLogger().info("Base Health is "+base_hplv+".");
base_hplv+=zombierarebheads;
base_hplv+=zombiepoweredheads;
base_hplv+=zombiepoweredrareheads*4;
Bukkit.getLogger().info("Base Health is "+base_hplv+".");
}
extra_hp=0;
//p.setMaxHealth(base_hplv);
boolean hasabsorption=false;

@ -3,6 +3,7 @@ package me.kaZep.Base;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
@ -16,6 +17,7 @@ import java.util.UUID;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
//import net.minecraft.server.v1_7_R1.WorldData;
//import net.minecraft.server.v1_4_R1.EntityWolf;
@ -207,8 +209,11 @@ import com.google.common.base.Objects;
import com.modcrafting.diablodrops.DiabloDrops;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.FilenameException;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.data.DataException;
import com.sk89q.worldedit.schematic.SchematicFormat;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
@ -255,6 +260,11 @@ implements Listener
natural_mats.add(Material.SAND);
natural_mats.add(Material.CLAY);
natural_mats.add(Material.WEB);
natural_mats.add(Material.LAVA);
natural_mats.add(Material.WATER);
natural_mats.add(Material.AIR);
natural_mats.add(Material.MOSSY_COBBLESTONE);
natural_mats.add(Material.COAL_ORE);
natural_mats.add(Material.IRON_ORE);
natural_mats.add(Material.GOLD_ORE);
natural_mats.add(Material.DIAMOND_ORE);
@ -339,9 +349,9 @@ implements Listener
public void onServerListPing(ServerListPingEvent e) {
e.setMaxPlayers(16);
if (this.plugin.getConfig().getBoolean("maintenance-mode")) {
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.RED+"Currently in Maintenance Mode.");
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.RED+" Currently in Maintenance Mode.");
} else {
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.BLUE+"Currently Online.");
e.setMotd(ChatColor.AQUA+"Sig's Minecraft!\n"+ChatColor.BLUE+" Currently Online.");
}
return;
}
@ -10948,12 +10958,22 @@ implements Listener
/*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) {
m.removePotionEffect(PotionEffectType.SLOW);
}*/
List<MobHead> playerheads = this.plugin.getMobHeads(p);
int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads);
int witherskeletonrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true), playerheads);
int witherskeletonpoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,false,true), playerheads);
int witherskeletonpoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON,true,true), playerheads);
int witherduration = 0, witheramplifier = 0;
try {
Iterator<PotionEffect> effects = m.getActivePotionEffects().iterator();
//Figure out potion effects when player joins.
while (effects.hasNext()) {
PotionEffect nexteffect = effects.next();
//Bukkit.getLogger().info("Effect Type is "+nexteffect.getType().getName()+", amplifier is "+nexteffect.getAmplifier()+", duration is "+nexteffect.getDuration());
if (witherskeletonheads+witherskeletonrareheads+witherskeletonpoweredheads+witherskeletonpoweredrareheads>0 && nexteffect.getType().getName().compareTo(PotionEffectType.WITHER.getName())==0) {
witherduration=nexteffect.getDuration();
witheramplifier=nexteffect.getAmplifier();
}
if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0 && nexteffect.getAmplifier()==6 && nexteffect.getDuration()<=60) {
m.removePotionEffect(PotionEffectType.SLOW);
//Bukkit.getLogger().info("Removed slow.");
@ -10969,6 +10989,21 @@ implements Listener
} catch (ConcurrentModificationException ex_e) {
Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to remove slow debuff.");
}
if (witherskeletonpoweredrareheads>0) {
if (witherduration==0) {witherduration=400;}
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier "+(witheramplifier+2*witherskeletonpoweredrareheads)+" + duration "+witherduration);
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration,witheramplifier+2*witherskeletonpoweredrareheads),true);
} else if (witherskeletonpoweredheads>0) {
if (witherduration==0) {witherduration=100;}
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier "+(witheramplifier+1*witherskeletonpoweredrareheads)+" + duration "+witherduration);
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration,witheramplifier+1*witherskeletonpoweredrareheads),true);
} else if (witherskeletonrareheads>0) {
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier 2 + duration "+(witherduration+300*witherskeletonrareheads));
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration+300*witherskeletonrareheads,2),true);
} else if (witherskeletonheads>0) {
Bukkit.getLogger().info("Adding potion effect WITHER with amplifier 0 + duration "+(witherduration+100*witherskeletonrareheads));
m.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,witherduration+100*witherskeletonrareheads,0),true);
}
}
if (this.plugin.hasJobBuff("Hunter", p, Job.JOB20) && p.getItemInHand().getType().name().toLowerCase().contains("sword")) {
if (e.getEntity() instanceof Monster) {
@ -11020,6 +11055,19 @@ implements Listener
}
}
}
List<MobHead> playerheads = this.plugin.getMobHeads(p);
int zombieheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE), playerheads);
int zombierareaheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_A), playerheads);
//int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads);
int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads);
Bukkit.getLogger().info("Head counts are "+zombieheads+", "+zombierareaheads+", "+zombiepoweredheads+", "+zombiepoweredrareheads);
Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
life_steal+=zombieheads;
life_steal+=zombiepoweredheads;
life_steal+=zombierareaheads*3;
life_steal+=zombiepoweredrareheads*5;
Bukkit.getLogger().info("Life Steal is "+life_steal+"%");
if (this.plugin.getPlayerData(p).furytime!=0) {
attack_speed+=this.plugin.getPlayerData(p).furyamt;
}
@ -15143,7 +15191,7 @@ implements Listener
}
}
@EventHandler
public void onProjectilLaunch(ProjectileLaunchEvent e) {
public void onProjectileLaunch(ProjectileLaunchEvent e) {
Projectile thrown_obj = e.getEntity();
if (thrown_obj instanceof Arrow) {
if (thrown_obj.getShooter()!=null && (thrown_obj.getShooter() instanceof Player)) {
@ -17459,6 +17507,49 @@ implements Listener
double actMon = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money");
int actHand = (int)Main.economy.getBalance(p.getName());
/* WORKS!!! Now INTEGRATE! */
/*if (e.getAction()==Action.LEFT_CLICK_AIR) {
//Save the region around ourself.
WorldEditPlugin wep = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit");
final TerrainManager tm = new TerrainManager(wep, p);
final Location loc1 = new Location(p.getWorld(),p.getLocation().getBlockX()-32,0,p.getLocation().getBlockZ()-32);
final Location loc2 = new Location(p.getWorld(),p.getLocation().getBlockX()+32,128,p.getLocation().getBlockZ()+32);
final File saveFile = new File("plugins/WorldEdit/schematics/world_save");
try {
tm.saveTerrain(saveFile, loc1, loc2);
} catch (FilenameException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
} catch (DataException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
} catch (IOException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
}
}
if (e.getAction()==Action.RIGHT_CLICK_AIR) {
File file = new File("plugins/WorldEdit/schematics/world_save.schematic");
if (file.exists()) {
try {
com.sk89q.worldedit.Vector v = new com.sk89q.worldedit.Vector(p.getLocation().getX()+8, p.getLocation().getY(), p.getLocation().getZ()+8);
World worldf = Bukkit.getWorld("world");
BukkitWorld BWf = new BukkitWorld(worldf);
EditSession es = new EditSession(BWf, 2000000);
CuboidClipboard c1 = SchematicFormat.MCEDIT.load(file);
c1.place(es, v, true);
} catch (DataException ex) {
Bukkit.getLogger().warning("DataException while trying to create structure.");
} catch (IOException ex) {
Bukkit.getLogger().warning("IOException while trying to create structure.");
} catch (MaxChangedBlocksException ex) {
Bukkit.getLogger().warning("MaxChangedBlocksException while trying to create structure.");
}
} else {
Bukkit.getLogger().warning(("File does not exist."));
}
}*/
if (p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
e.setCancelled(true);
return;

@ -0,0 +1,149 @@
package me.kaZep.Base;
import java.io.File;
import java.io.IOException;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.FilenameException;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.data.DataException;
import com.sk89q.worldedit.schematic.SchematicFormat;
/**
* @author desht
*
* A wrapper class for the WorldEdit terrain loading & saving API to make things a little
* simple for other plugins to use.
*/
public class TerrainManager {
private static final String EXTENSION = "schematic";
private final WorldEdit we;
private final LocalSession localSession;
private final EditSession editSession;
private final LocalPlayer localPlayer;
/**
* Constructor
*
* @param wep the WorldEdit plugin instance
* @param player the player to work with
*/
public TerrainManager(WorldEditPlugin wep, Player player) {
we = wep.getWorldEdit();
localPlayer = wep.wrapPlayer(player);
localSession = we.getSession(localPlayer);
editSession = localSession.createEditSession(localPlayer);
}
/**
* Constructor
*
* @param wep the WorldEdit plugin instance
* @param world the world to work in
*/
public TerrainManager(WorldEditPlugin wep, World world) {
we = wep.getWorldEdit();
localPlayer = null;
localSession = new LocalSession(we.getConfiguration());
editSession = new EditSession(new BukkitWorld(world), we.getConfiguration().maxChangeLimit);
}
/**
* Write the terrain bounded by the given locations to the given file as a MCedit format
* schematic.
*
* @param saveFile a File representing the schematic file to create
* @param l1 one corner of the region to save
* @param l2 the corner of the region to save, opposite to l1
* @throws DataException
* @throws IOException
*/
public void saveTerrain(File saveFile, Location l1, Location l2) throws FilenameException, DataException, IOException {
Vector min = getMin(l1, l2);
Vector max = getMax(l1, l2);
saveFile = we.getSafeSaveFile(localPlayer,
saveFile.getParentFile(), saveFile.getName(),
EXTENSION, new String[] { EXTENSION });
editSession.enableQueue();
CuboidClipboard clipboard = new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min);
clipboard.copy(editSession);
SchematicFormat.MCEDIT.save(clipboard, saveFile);
editSession.flushQueue();
}
/**
* Load the data from the given schematic file and paste it at the given location. If the location is null, then
* paste it at the saved data's origin.
*
* @param saveFile a File representing the schematic file to load
* @param loc the location to paste the clipboard at (may be null)
* @throws FilenameException
* @throws DataException
* @throws IOException
* @throws MaxChangedBlocksException
* @throws EmptyClipboardException
*/
public void loadSchematic(File saveFile, Location loc) throws FilenameException, DataException, IOException, MaxChangedBlocksException, EmptyClipboardException {
saveFile = we.getSafeSaveFile(localPlayer,
saveFile.getParentFile(), saveFile.getName(),
EXTENSION, new String[] { EXTENSION });
editSession.enableQueue();
localSession.setClipboard(SchematicFormat.MCEDIT.load(saveFile));
localSession.getClipboard().place(editSession, getPastePosition(loc), false);
editSession.flushQueue();
we.flushBlockBag(localPlayer, editSession);
}
/**
* Load the data from the given schematic file and paste it at the saved clipboard's origin.
*
* @param saveFile
* @throws FilenameException
* @throws DataException
* @throws IOException
* @throws MaxChangedBlocksException
* @throws EmptyClipboardException
*/
public void loadSchematic(File saveFile) throws FilenameException, DataException, IOException, MaxChangedBlocksException, EmptyClipboardException {
loadSchematic(saveFile, null);
}
private Vector getPastePosition(Location loc) throws EmptyClipboardException {
if (loc == null)
return localSession.getClipboard().getOrigin();
else
return new Vector(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}
private Vector getMin(Location l1, Location l2) {
return new Vector(
Math.min(l1.getBlockX(), l2.getBlockX()),
Math.min(l1.getBlockY(), l2.getBlockY()),
Math.min(l1.getBlockZ(), l2.getBlockZ())
);
}
private Vector getMax(Location l1, Location l2) {
return new Vector(
Math.max(l1.getBlockX(), l2.getBlockX()),
Math.max(l1.getBlockY(), l2.getBlockY()),
Math.max(l1.getBlockZ(), l2.getBlockZ())
);
}
}

@ -8,11 +8,13 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import me.kaZep.Base.Main;
import me.kaZep.Base.MobHead;
import me.kaZep.Base.MobHead.MobHeadRareType;
import me.kaZep.Base.MobHead.MobHeadType;
import me.kaZep.Base.TerrainManager;
import me.kaZep.Commands.JobsDataInfo.Job;
import net.jmhertlein.mctowns.MCTowns;
import net.jmhertlein.mctowns.MCTownsPlugin;
@ -22,6 +24,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Difficulty;
import org.bukkit.Location;
import org.bukkit.Material;
@ -30,6 +33,9 @@ import org.bukkit.Server;
import org.bukkit.SkullType;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Skull;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -46,6 +52,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Wolf;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantInventory;
@ -61,9 +68,14 @@ import sig.ItemSets.DiabloDropsHook.Tier;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.FilenameException;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.data.DataException;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.schematic.MCEditSchematicFormat;
import com.sk89q.worldedit.schematic.SchematicFormat;
@ -114,6 +126,40 @@ public class commandBankEconomy
this.plugin = plugin;
}
short getBlock(short[][] result, int x, int y, int z) {
if (result[y >> 4] == null) {
return (short)0;
}
return result[y >> 4][((y & 0xF) << 8) | (z << 4) | x];
}
public boolean naturalBlock(Material mat) {
List<Material> natural_mats = new ArrayList<Material>();
natural_mats.add(Material.DIRT);
natural_mats.add(Material.STONE);
natural_mats.add(Material.WOOD);
natural_mats.add(Material.FENCE);
natural_mats.add(Material.GRAVEL);
natural_mats.add(Material.SAND);
natural_mats.add(Material.CLAY);
natural_mats.add(Material.WEB);
natural_mats.add(Material.LAVA);
natural_mats.add(Material.WATER);
natural_mats.add(Material.AIR);
natural_mats.add(Material.MOSSY_COBBLESTONE);
natural_mats.add(Material.COAL_ORE);
natural_mats.add(Material.IRON_ORE);
natural_mats.add(Material.GOLD_ORE);
natural_mats.add(Material.DIAMOND_ORE);
natural_mats.add(Material.EMERALD_ORE);
natural_mats.add(Material.LAPIS_ORE);
natural_mats.add(Material.REDSTONE_ORE);
if (natural_mats.contains(mat)) {
return true;
} else {
return false;
}
}
public String convertToItemName(String val) {
val=val.replace('_', ' ');
@ -978,6 +1024,129 @@ public String convertToItemName(String val) {
i.setItemMeta(meta);
f.getInventory().addItem(i);
}
if (args[0].equalsIgnoreCase("regen_chunk")) {
if (p.hasPermission("maintenance-mode-admin")) {
//boolean result=p.getWorld().regenerateChunk(p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16);
//Bukkit.getLogger().info("Chunk regenerated: "+result+" ("+p.getLocation().getBlockX()/16+","+p.getLocation().getBlockZ()/16+")");
/*byte[] worldarray = p.getWorld().getGenerator().generate(p.getWorld(), new Random(), p.getLocation().getBlockX()/16, p.getLocation().getBlockZ()/16);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < 128; y++) {
Bukkit.getLogger().info("Block @ ("+x+","+y+","+z+") is "+worldarray[(x * 16 + z) * 128 + y]);
}
}
}*/
/*
//Create a new tempworld that mimics the real world, generator-wise.
World newworld = Bukkit.createWorld(new WorldCreator("newworld").copy(p.getWorld()));
p.teleport(new Location(newworld,0,0,0));
for (int x=-720;x<721;x++) {
for (int z=-720;z<721;z++) {
Bukkit.getLogger().info("Creating new chunk at ("+x+","+z+") for world newworld.");
newworld.loadChunk(x,z,true);
}
}*/
Location CenterPoint = new Location(p.getWorld(),1627,67,-268); //Center of Twoside.
int iterations=100*(Integer.valueOf(args[1])+50);
for (int MASTER_i=Integer.valueOf(args[1]);MASTER_i<51;MASTER_i++) {
p.getWorld().save();
for (int MASTER_j=-50;MASTER_j<51;MASTER_j++) {
iterations++;
Bukkit.getLogger().info("");
Bukkit.getLogger().info("BEGINNING Chunk ("+MASTER_i+","+MASTER_j+") correction...");
int rand_factor = (int)(Math.random()*200d);
int chunkx=(MASTER_i*16+CenterPoint.getBlockX()+8)/16, chunkz=(MASTER_j*16+CenterPoint.getBlockZ()+8)/16;
WorldEditPlugin wep = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit");
final TerrainManager tm = new TerrainManager(wep, p.getWorld());
final Location loc1 = new Location(p.getWorld(),chunkx*16-16,60,chunkz*16-16);
final Location loc2 = new Location(p.getWorld(),chunkx*16+32,128,chunkz*16+32);
final File saveFile = new File("plugins/WorldEdit/schematics/world_save"+rand_factor);
try {
tm.saveTerrain(saveFile, loc1, loc2);
} catch (FilenameException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
} catch (DataException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
} catch (IOException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
}
final ChunkSnapshot savedChunk = p.getWorld().getChunkAt(chunkx, chunkz).getChunkSnapshot();
final Player p2 = p;
final int chunkx2=chunkx,chunkz2=chunkz;
p.getWorld().regenerateChunk(chunkx2, chunkz2);/*
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {*/
int replaced_layers=0;
//Bukkit.getLogger().info("-Checking old world bounds...");
for (int y=0;y<56;y+=8) {
boolean all_natural=true;
//Bukkit.getLogger().info("--All Natural set.");
for (int x=0;x<16;x++) {
for (int yy=0;yy<8;yy++) {
for (int z=0;z<16;z++) {
if (!naturalBlock(Material.getMaterial((savedChunk.getBlockTypeId(x, y+yy, z))))) {
//Bukkit.getLogger().info("--Block of type "+Material.getMaterial((savedChunk.getBlockTypeId(x, y+yy, z))).toString()+" is not natural.");
all_natural=false;
break;
}
}
if (!all_natural) {break;}
}
if (!all_natural) {break;}
}
if (!all_natural) {
Bukkit.getLogger().info("--Replacing blocks at positions ("+y+" to "+(y+4)+")");
for (int x=0;x<16;x++) {
for (int yy=0;yy<8;yy++) {
for (int z=0;z<16;z++) {
p2.getWorld().getBlockAt(chunkx2*16+x, y+yy, chunkz2*16+z).setTypeIdAndData(savedChunk.getBlockTypeId(x, y+yy, z),(byte)savedChunk.getBlockData(x, y+yy, z),false);
}
}
}
} else {
replaced_layers++;
}
}
Bukkit.getLogger().info("->REPLACED "+replaced_layers+" layers. ("+(int)(iterations/10000d*100)+"%)");
for (int y=63;y<256;y++) {
for (int x=0;x<16;x++) {
for (int z=0;z<16;z++) {
p2.getWorld().getBlockAt(chunkx2*16+x, y, chunkz2*16+z).setType(Material.AIR);
}
}
}
//p2.getWorld().refreshChunk(chunkx2, chunkz2);
try {
tm.loadSchematic(saveFile);
} catch (FilenameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MaxChangedBlocksException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (EmptyClipboardException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DataException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*}},20);*/
p.getWorld().unloadChunkRequest(chunkx2, chunkz2);
}
}
}
}
if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("end")) {
p.sendMessage(ChatColor.GRAY+"Ending Harrowing night... Did you make sure it was night time? If not, type this command again after /time night instead.");
this.plugin.harrowing_night=true;
@ -1649,6 +1818,22 @@ public String convertToItemName(String val) {
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
}
}
if (args[0].equalsIgnoreCase("save_topworld") && args[1].equalsIgnoreCase("5000")) {
com.sk89q.worldedit.Vector v1 = new com.sk89q.worldedit.Vector(2500,77,2500);
com.sk89q.worldedit.Vector v2 = new com.sk89q.worldedit.Vector(p.getLocation().getX(), 63, p.getLocation().getZ());
World worldf = Bukkit.getWorld("world");
//BukkitWorld BWf = new BukkitWorld(worldf);
//EditSession es = new EditSession(BWf, 2100000000);
try {
SchematicFormat.MCEDIT.save(new CuboidClipboard(v2,v1),new File("plugins/WorldEdit/schematics/world_save.schematic"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DataException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (args[0].equalsIgnoreCase("spawn_dungeon") && args[1].equalsIgnoreCase("boss")) {
//Empty the whole area.
double xoffset = Math.random()*10+15;

Loading…
Cancel
Save