r259. Many fixes and changes yet again.
This commit is contained in:
parent
89377ecaf0
commit
303e6d9739
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: BankEconomy
|
name: BankEconomy
|
||||||
main: me.kaZep.Base.Main
|
main: me.kaZep.Base.Main
|
||||||
version: 257
|
version: 259
|
||||||
description: Bank plugin which stores money.
|
description: Bank plugin which stores money.
|
||||||
commands:
|
commands:
|
||||||
bankeconomy:
|
bankeconomy:
|
||||||
|
@ -13,6 +13,7 @@ import java.util.Date;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -23,6 +24,7 @@ import me.kaZep.Commands.commandBankEconomy;
|
|||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -47,6 +49,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.PigZombie;
|
import org.bukkit.entity.PigZombie;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Sheep;
|
import org.bukkit.entity.Sheep;
|
||||||
@ -147,6 +150,7 @@ public class Main extends JavaPlugin
|
|||||||
public List<PlayerData> playerdata_list = null;
|
public List<PlayerData> playerdata_list = null;
|
||||||
public List<InvisibilityData> ninjavisible_list = null;
|
public List<InvisibilityData> ninjavisible_list = null;
|
||||||
public List<ReviveInventory> revive_inventory_list = null;
|
public List<ReviveInventory> revive_inventory_list = null;
|
||||||
|
public List<Chunk> chunk_queue_list = null;
|
||||||
public DamageAPI DMGCALC = null;
|
public DamageAPI DMGCALC = null;
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +238,7 @@ public class Main extends JavaPlugin
|
|||||||
playerdata_list = new ArrayList<PlayerData>();
|
playerdata_list = new ArrayList<PlayerData>();
|
||||||
ninjavisible_list = new ArrayList<InvisibilityData>();
|
ninjavisible_list = new ArrayList<InvisibilityData>();
|
||||||
revive_inventory_list = new ArrayList<ReviveInventory>();
|
revive_inventory_list = new ArrayList<ReviveInventory>();
|
||||||
|
chunk_queue_list = new ArrayList<Chunk>();
|
||||||
|
|
||||||
//Add Recipes for new Block armor crafting.
|
//Add Recipes for new Block armor crafting.
|
||||||
ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET));
|
ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET));
|
||||||
@ -640,6 +645,8 @@ public class Main extends JavaPlugin
|
|||||||
Enchanter_job.setExp(50, 40, 8, 1.08);
|
Enchanter_job.setExp(50, 40, 8, 1.08);
|
||||||
Enchanter_job.addExtraData("Each level of enchantment multiplies your income and exp gain exponentially.");
|
Enchanter_job.addExtraData("Each level of enchantment multiplies your income and exp gain exponentially.");
|
||||||
Enchanter_job.addExtraData("Ex. If PROTECTION gives $0.08 and 4XP, PROTECTION III would give you x9 exp and money: $0.72 and 36XP.");
|
Enchanter_job.addExtraData("Ex. If PROTECTION gives $0.08 and 4XP, PROTECTION III would give you x9 exp and money: $0.72 and 36XP.");
|
||||||
|
Enchanter_job.addExtraData("");
|
||||||
|
Enchanter_job.addExtraData("Enchanters also gain some exp and income if job buffs automatically enchant items, such as the Weaponsmith/Blacksmith job. Note this is a very small amount and does not give as much as enchanting an item of your own.");
|
||||||
Enchanter_job.addData("PROTECTION", 0.08, 4, 0);
|
Enchanter_job.addData("PROTECTION", 0.08, 4, 0);
|
||||||
Enchanter_job.addData("SMITE", 0.10, 8, 0);
|
Enchanter_job.addData("SMITE", 0.10, 8, 0);
|
||||||
Enchanter_job.addData("FIRE PROTECTION", 0.10, 6, 0);
|
Enchanter_job.addData("FIRE PROTECTION", 0.10, 6, 0);
|
||||||
@ -934,6 +941,7 @@ public void runTick() {
|
|||||||
REVIVE_EFFECT--;
|
REVIVE_EFFECT--;
|
||||||
//Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+"");
|
//Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+"");
|
||||||
}
|
}
|
||||||
|
List<UUID> lineofsight_check = new ArrayList<UUID>();
|
||||||
for (int zx=0;zx<Bukkit.getOnlinePlayers().length;zx++) {
|
for (int zx=0;zx<Bukkit.getOnlinePlayers().length;zx++) {
|
||||||
Player p = Bukkit.getOnlinePlayers()[zx];
|
Player p = Bukkit.getOnlinePlayers()[zx];
|
||||||
//p.sendMessage("That's item slot #"+p.getInventory().getHeldItemSlot());
|
//p.sendMessage("That's item slot #"+p.getInventory().getHeldItemSlot());
|
||||||
@ -1122,23 +1130,261 @@ public void runTick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Bukkit.getWorld("world").getFullTime()%20==0) {
|
if (Bukkit.getWorld("world").getFullTime()%20==0) {
|
||||||
|
for (int d=0;d<chunk_queue_list.size();d++) {
|
||||||
|
if (!chunk_queue_list.get(d).isLoaded()) {
|
||||||
|
chunk_queue_list.remove(0);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chunk_queue_list.size()>0 && chunk_queue_list.get(0).isLoaded() && chunk_queue_list.get(0).getWorld().getName().equalsIgnoreCase("world")) {
|
||||||
|
//Load up this chunk if it's loaded and check things.
|
||||||
|
//Attempt to load up the custom chunk.
|
||||||
|
List<String> debugmessages = new ArrayList<String>();
|
||||||
|
FileConfiguration customchunk = reloadChunksConfig(chunk_queue_list.get(0).getX(), chunk_queue_list.get(0).getZ());
|
||||||
|
if (!customchunk.contains("animal-reset2")) {
|
||||||
|
customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000));
|
||||||
|
Chunk c = chunk_queue_list.get(0);
|
||||||
|
Random r = new Random();
|
||||||
|
for (int x=0;x<16;x++) {
|
||||||
|
for (int z=0;z<16;z++) {
|
||||||
|
if (r.nextDouble()<=0.000244140625) {
|
||||||
|
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16);
|
||||||
|
if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) {
|
||||||
|
if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("plains")) {
|
||||||
|
//Best place for things to spawn. Any mob type can spawn here.
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("forest")) {
|
||||||
|
//Wolves can still spawn here. Horses cannot.
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("jungle")) {
|
||||||
|
//Chance to spawn ocelots here.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Bukkit.getLogger().info("Biome here is "+b.getBiome().name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Check the value and regenerate if necessary.
|
||||||
|
if (Bukkit.getWorld("world").getFullTime()>customchunk.getLong("animal-reset2")) {
|
||||||
|
customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000));
|
||||||
|
Chunk c = chunk_queue_list.get(0);
|
||||||
|
Random r = new Random();
|
||||||
|
for (int x=0;x<16;x++) {
|
||||||
|
for (int z=0;z<16;z++) {
|
||||||
|
if (r.nextDouble()<=0.000244140625) {
|
||||||
|
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16);
|
||||||
|
if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) {
|
||||||
|
if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("plains")) {
|
||||||
|
//Best place for things to spawn. Any mob type can spawn here.
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("forest")) {
|
||||||
|
//Wolves can still spawn here. Horses cannot.
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (b.getBiome().name().equalsIgnoreCase("jungle")) {
|
||||||
|
//Chance to spawn ocelots here.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//Choose a mob type randomly.
|
||||||
|
EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN};
|
||||||
|
int i=(int)(Math.random()*4)+2;
|
||||||
|
EntityType selected = mobs[(int)(mobs.length*Math.random())];
|
||||||
|
////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+".");
|
||||||
|
debugmessages.add(" Spawned: "+i+" "+selected.getName());
|
||||||
|
while (i>0) {
|
||||||
|
LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected);
|
||||||
|
f.setRemoveWhenFarAway(false); //This should be a permanent mob.
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Bukkit.getLogger().info("Biome here is "+b.getBiome().name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!customchunk.contains("diamond-generate")) {
|
||||||
|
customchunk.set("diamond-generate", Boolean.valueOf(true));
|
||||||
|
Chunk c = chunk_queue_list.get(0);
|
||||||
|
int adddiamond=0;
|
||||||
|
for (int x=0;x<16;x++) {
|
||||||
|
for (int y=5;y<25;y++) {
|
||||||
|
for (int z=0;z<16;z++) {
|
||||||
|
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16);
|
||||||
|
if (b!=null && b.getType()==Material.STONE) {
|
||||||
|
if (Math.random()<=0.000625) {
|
||||||
|
int i=(int)(Math.random()*8.0d)+1;
|
||||||
|
while (i>0) {
|
||||||
|
Block d = c.getBlock(x+(int)(Math.random()*i)-(int)(Math.random()*i), y+(int)(Math.random()*i)-(int)(Math.random()*i), z+(int)(Math.random()*i)-(int)(Math.random()*i));
|
||||||
|
adddiamond++;
|
||||||
|
b.setType(Material.DIAMOND_ORE);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
//Make a patch between 1 and 8.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Bukkit.getLogger().info("Generated "+adddiamond+" new diamonds for chunk "+e.getChunk().getX()+","+e.getChunk().getZ());
|
||||||
|
if (adddiamond>0) {
|
||||||
|
debugmessages.add(" Added "+adddiamond+" diamond"+((adddiamond!=1)?"s":"")+".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!customchunk.contains("limit-ore-generation")) {
|
||||||
|
customchunk.set("limit-ore-generation", Boolean.valueOf(true));
|
||||||
|
Chunk c = chunk_queue_list.get(0);
|
||||||
|
int removeore=0,totalore=0,newore=0;
|
||||||
|
for (int x=0;x<16;x++) {
|
||||||
|
for (int y=5;y<96;y++) {
|
||||||
|
for (int z=0;z<16;z++) {
|
||||||
|
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16);
|
||||||
|
if (b!=null && (b.getType()==Material.COAL_ORE ||
|
||||||
|
b.getType()==Material.IRON_ORE ||
|
||||||
|
b.getType()==Material.GOLD_ORE ||
|
||||||
|
b.getType()==Material.REDSTONE_ORE ||
|
||||||
|
b.getType()==Material.LAPIS_ORE ||
|
||||||
|
b.getType()==Material.DIAMOND_ORE)) {
|
||||||
|
if (Math.random()<=0.60) {
|
||||||
|
removeore++;
|
||||||
|
b.setType(Material.STONE);
|
||||||
|
//Make a patch between 1 and 8.
|
||||||
|
}
|
||||||
|
totalore++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int x=0;x<16;x++) {
|
||||||
|
for (int y=5;y<96;y++) {
|
||||||
|
for (int z=0;z<16;z++) {
|
||||||
|
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16);
|
||||||
|
if (b!=null && (b.getType()==Material.COAL_ORE ||
|
||||||
|
b.getType()==Material.IRON_ORE ||
|
||||||
|
b.getType()==Material.GOLD_ORE ||
|
||||||
|
b.getType()==Material.REDSTONE_ORE ||
|
||||||
|
b.getType()==Material.LAPIS_ORE ||
|
||||||
|
b.getType()==Material.DIAMOND_ORE)) {
|
||||||
|
newore++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////Bukkit.getLogger().info("Removed "+removeore+"/"+totalore+" ore for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+". There are now "+newore+" ores left.");
|
||||||
|
debugmessages.add(" Removed: "+removeore+"/"+totalore+" ores.");
|
||||||
|
}
|
||||||
|
saveChunksConfig(customchunk, chunk_queue_list.get(0).getX(), chunk_queue_list.get(0).getZ());
|
||||||
|
if (debugmessages.size()>0) {
|
||||||
|
for (int i=0;i<debugmessages.size();i++) {
|
||||||
|
//Bukkit.getLogger().info(debugmessages.get(i));
|
||||||
|
}
|
||||||
|
//Bukkit.getLogger().info(new String(new char[("Chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+" ("+e.getChunk().getX()*16+","+e.getChunk().getZ()*16+")").length()]).replace("\0", "="));
|
||||||
|
//Bukkit.getLogger().info("Chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+" ("+e.getChunk().getX()*16+","+e.getChunk().getZ()*16+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Entity> nearby = p.getNearbyEntities(20, 12, 20);
|
List<Entity> nearby = p.getNearbyEntities(20, 12, 20);
|
||||||
//List<Entity> nearby2 = p.getNearbyEntities(10, 6, 10);
|
//List<Entity> nearby2 = p.getNearbyEntities(10, 6, 10);
|
||||||
for (int i=0;i<nearby.size();i++) {
|
for (int i=0;i<nearby.size();i++) {
|
||||||
EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER};
|
//EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER};
|
||||||
boolean contains=false;
|
boolean contains=nearby.get(i) instanceof Monster;
|
||||||
for (int k=0;k<allowedtypes.length;k++) {
|
|
||||||
if (nearby.get(i).getType()==allowedtypes[k]) {
|
|
||||||
contains=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (contains) {
|
if (contains) {
|
||||||
LivingEntity l = (LivingEntity)nearby.get(i);
|
LivingEntity l = (LivingEntity)nearby.get(i);
|
||||||
if (l.getCustomName()!=null && l.hasLineOfSight(p)) {
|
if (l.getCustomName()!=null && l.hasLineOfSight(p)) {
|
||||||
l.setCustomNameVisible(true);
|
if (!lineofsight_check.contains(l.getUniqueId())) {
|
||||||
|
l.setCustomNameVisible(true);
|
||||||
|
lineofsight_check.add(l.getUniqueId());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
l.setCustomNameVisible(false);
|
if (!lineofsight_check.contains(l.getUniqueId())) {
|
||||||
|
l.setCustomNameVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int heightmodifier=0;
|
int heightmodifier=0;
|
||||||
@ -1975,6 +2221,40 @@ public String healthbar(double curHP,double maxHP) {
|
|||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String healthbar(double curHP,double maxHP,int hunger) {
|
||||||
|
//█ ▌
|
||||||
|
int bits=(int)(Math.ceil(curHP/maxHP*10));
|
||||||
|
String bar=" ";
|
||||||
|
if (hunger==20) {
|
||||||
|
if (bits>6) {
|
||||||
|
bar+=ChatColor.GREEN+"";
|
||||||
|
} else
|
||||||
|
if (bits>3) {
|
||||||
|
bar+=ChatColor.YELLOW+"";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
bar+=ChatColor.RED+"";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bits>6) {
|
||||||
|
bar+=ChatColor.DARK_GREEN+"";
|
||||||
|
} else
|
||||||
|
if (bits>3) {
|
||||||
|
bar+=ChatColor.GOLD+"";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
bar+=ChatColor.DARK_RED+"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<bits/2;i++) {
|
||||||
|
bar+="█";
|
||||||
|
}
|
||||||
|
if (bits%2!=0) {
|
||||||
|
bar+="▌";
|
||||||
|
}
|
||||||
|
return bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void checkJukeboxes() {
|
public void checkJukeboxes() {
|
||||||
@ -2521,7 +2801,7 @@ public void checkJukeboxes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list[i].getScoreboard().getTeam(list[i].getName()).setSuffix(healthbar(list[i].getHealth(),list[i].getMaxHealth()));
|
list[i].getScoreboard().getTeam(list[i].getName()).setSuffix(healthbar(list[i].getHealth(),list[i].getMaxHealth(),list[i].getFoodLevel()));
|
||||||
}
|
}
|
||||||
LOGGING_UPDATE_COUNTS++; //3
|
LOGGING_UPDATE_COUNTS++; //3
|
||||||
for (int i=0;i<supportmoblist.size();i++) {
|
for (int i=0;i<supportmoblist.size();i++) {
|
||||||
@ -3414,8 +3694,11 @@ public void payDay(int time)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack EnchantItem(ItemStack item,int lv,Player p) {
|
public ItemStack EnchantItem(ItemStack item,int lv,Player p) {
|
||||||
|
return EnchantItem(item,lv,p,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack EnchantItem(ItemStack item,int lv,Player p, boolean fromAuto) {
|
||||||
boolean protection=false; //Set to true when a protection enchantment has been given.
|
boolean protection=false; //Set to true when a protection enchantment has been given.
|
||||||
boolean silktouch=false; //Set to true if silk touch OR fortune is set. Only one of these can be there.
|
boolean silktouch=false; //Set to true if silk touch OR fortune is set. Only one of these can be there.
|
||||||
boolean enhanceddmg=false; //Set to true if a damage increasing enchantment has been given.
|
boolean enhanceddmg=false; //Set to true if a damage increasing enchantment has been given.
|
||||||
@ -3521,65 +3804,98 @@ public void payDay(int time)
|
|||||||
entry.setValue(entry.getValue()+1);
|
entry.setValue(entry.getValue()+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
double mult=1.0d;
|
||||||
|
if (fromAuto) {
|
||||||
|
if (!item.getType().toString().toLowerCase().contains("leggings") && !item.getType().toString().toLowerCase().contains("helmet") && !item.getType().toString().toLowerCase().contains("chestplate") && !item.getType().toString().toLowerCase().contains("boots")) {
|
||||||
|
if (item.getType().toString().toLowerCase().contains("spade")) {
|
||||||
|
mult=0.015d;
|
||||||
|
} else
|
||||||
|
if (item.getType().toString().toLowerCase().contains("hoe")) {
|
||||||
|
mult=0.03d;
|
||||||
|
} else
|
||||||
|
if (item.getType().toString().toLowerCase().contains("sword")) {
|
||||||
|
mult=0.03d;
|
||||||
|
} else
|
||||||
|
if (item.getType().toString().toLowerCase().contains("pickaxe")) {
|
||||||
|
mult=0.045d;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (item.hasItemMeta() && item.getItemMeta().getLore()!=null) {
|
||||||
|
List<String> thelore = item.getItemMeta().getLore();
|
||||||
|
for (int i=0;i<thelore.size();i++) {
|
||||||
|
if (thelore.get(i).contains(ChatColor.RED+"-400% Durability")) {
|
||||||
|
//This is a weak piece.
|
||||||
|
mult=0.10d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.getType().toString().toLowerCase().contains("iron")) {
|
||||||
|
mult/=4;
|
||||||
|
} else
|
||||||
|
if (item.getType().toString().toLowerCase().contains("gold")) {
|
||||||
|
mult/=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.PROTECTION_ENVIRONMENTAL.getName()) {
|
if (entry.getKey().getName()==Enchantment.PROTECTION_ENVIRONMENTAL.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.08*entry.getValue(),4*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.08*entry.getValue()*mult,4*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.DAMAGE_UNDEAD.getName()) {
|
if (entry.getKey().getName()==Enchantment.DAMAGE_UNDEAD.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.10*entry.getValue()*mult,8*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.PROTECTION_FIRE.getName()) {
|
if (entry.getKey().getName()==Enchantment.PROTECTION_FIRE.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),6*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.10*entry.getValue()*mult,6*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.DAMAGE_ARTHROPODS.getName()) {
|
if (entry.getKey().getName()==Enchantment.DAMAGE_ARTHROPODS.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.12*entry.getValue(),8*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.12*entry.getValue()*mult,8*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.PROTECTION_FALL.getName()) {
|
if (entry.getKey().getName()==Enchantment.PROTECTION_FALL.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.14*entry.getValue(),10*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.14*entry.getValue()*mult,10*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.DAMAGE_ALL.getName()) {
|
if (entry.getKey().getName()==Enchantment.DAMAGE_ALL.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.15*entry.getValue()*mult,14*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.DIG_SPEED.getName()) {
|
if (entry.getKey().getName()==Enchantment.DIG_SPEED.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.15*entry.getValue()*mult,14*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.PROTECTION_EXPLOSIONS.getName()) {
|
if (entry.getKey().getName()==Enchantment.PROTECTION_EXPLOSIONS.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.20*entry.getValue()*mult,16*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.THORNS.getName()) {
|
if (entry.getKey().getName()==Enchantment.THORNS.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.20*entry.getValue()*mult,16*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.KNOCKBACK.getName()) {
|
if (entry.getKey().getName()==Enchantment.KNOCKBACK.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.20*entry.getValue()*mult,18*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.ARROW_KNOCKBACK.getName()) {
|
if (entry.getKey().getName()==Enchantment.ARROW_KNOCKBACK.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.20*entry.getValue()*mult,18*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.FIRE_ASPECT.getName()) {
|
if (entry.getKey().getName()==Enchantment.FIRE_ASPECT.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.22*entry.getValue()*mult,20*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.ARROW_FIRE.getName()) {
|
if (entry.getKey().getName()==Enchantment.ARROW_FIRE.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.22*entry.getValue()*mult,20*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.WATER_WORKER.getName()) {
|
if (entry.getKey().getName()==Enchantment.WATER_WORKER.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),16*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.25*entry.getValue()*mult,16*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.OXYGEN.getName()) {
|
if (entry.getKey().getName()==Enchantment.OXYGEN.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.30*entry.getValue(),20*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.30*entry.getValue()*mult,20*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.DURABILITY.getName()) {
|
if (entry.getKey().getName()==Enchantment.DURABILITY.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.35*entry.getValue(),24*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.35*entry.getValue()*mult,24*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.ARROW_INFINITE.getName()) {
|
if (entry.getKey().getName()==Enchantment.ARROW_INFINITE.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),40*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.40*entry.getValue()*mult,40*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_MOBS.getName()) {
|
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_MOBS.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),30*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.40*entry.getValue()*mult,30*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_BLOCKS.getName()) {
|
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_BLOCKS.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.50*entry.getValue()*mult,40*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
if (entry.getKey().getName()==Enchantment.SILK_TOUCH.getName()) {
|
if (entry.getKey().getName()==Enchantment.SILK_TOUCH.getName()) {
|
||||||
gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
|
gainMoneyExp(p,"Enchanter",0.50*entry.getValue()*mult,40*entry.getValue()*mult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4069,6 +4385,29 @@ public void payDay(int time)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean inventoryFull(Player p){
|
||||||
|
//Returns if the player's inventory is full(true) or not(false).
|
||||||
|
boolean full=true;
|
||||||
|
for (int i=0;i<p.getInventory().getContents().length;i++) {
|
||||||
|
if (p.getInventory().getContents()[i]==null || p.getInventory().getContents()[i].getType()==Material.AIR) {
|
||||||
|
full=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return full;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBroken(ItemStack i) {
|
||||||
|
if (i!=null && i.hasItemMeta() && i.getItemMeta().getLore()!=null) {
|
||||||
|
for (int j=0;j<i.getItemMeta().getLore().size();j++) {
|
||||||
|
if (i.getItemMeta().getLore().get(j).contains("Will be repaired @ ")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean containsEnchantment(String s, String enchant) {
|
public boolean containsEnchantment(String s, String enchant) {
|
||||||
if (s.contains(enchant)) {
|
if (s.contains(enchant)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -117,7 +117,7 @@ public class PlayerBuffData {
|
|||||||
//Check player equipment to see if an item could possibly have a health buff.
|
//Check player equipment to see if an item could possibly have a health buff.
|
||||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
//Bukkit.getLogger().info("Got to 1.");
|
//Bukkit.getLogger().info("Got to 1.");
|
||||||
if (p.getEquipment().getArmorContents()[i]!=null && p.getEquipment().getArmorContents()[i].getItemMeta()!=null && p.getEquipment().getArmorContents()[i].getItemMeta().getLore()!=null) {
|
if (p.getEquipment().getArmorContents()[i]!=null && !this.plugin.isBroken(p.getEquipment().getArmorContents()[i]) && p.getEquipment().getArmorContents()[i].getItemMeta()!=null && p.getEquipment().getArmorContents()[i].getItemMeta().getLore()!=null) {
|
||||||
//Bukkit.getLogger().info("Got to 2.");
|
//Bukkit.getLogger().info("Got to 2.");
|
||||||
for (int j=0;j<p.getEquipment().getArmorContents()[i].getItemMeta().getLore().size();j++) {
|
for (int j=0;j<p.getEquipment().getArmorContents()[i].getItemMeta().getLore().size();j++) {
|
||||||
//Bukkit.getLogger().info("Got to 3.");
|
//Bukkit.getLogger().info("Got to 3.");
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -85,6 +85,244 @@ public class commandBankEconomy
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String convertToItemName(String val) {
|
||||||
|
val=val.replace('_', ' ');
|
||||||
|
char[] mod = val.toCharArray();
|
||||||
|
boolean first=false;
|
||||||
|
for (int i=0;i<mod.length;i++) {
|
||||||
|
if (!first) {
|
||||||
|
if (mod[i]>='a'&&mod[i]<='z') {
|
||||||
|
mod[i]-=32;
|
||||||
|
first=true;
|
||||||
|
} else
|
||||||
|
if (i==0) {
|
||||||
|
if (mod[i]>='A'&&mod[i]<='Z') {
|
||||||
|
first=true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) {
|
||||||
|
first=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mod[i-1]!=' ') {
|
||||||
|
if (mod[i]>='A'&&mod[i]<='Z') {
|
||||||
|
mod[i]+=32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String.valueOf(mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void giveLegendaryItem(Player p) {
|
||||||
|
String prefix = "";
|
||||||
|
String suffix = "";
|
||||||
|
int type=(int)(Math.random()*6);
|
||||||
|
//int type=5; //TESTING.
|
||||||
|
List<String> enchants1 = new ArrayList<String>();
|
||||||
|
List<String> enchants2 = new ArrayList<String>();
|
||||||
|
ItemStack finalitem = null;
|
||||||
|
if (type==0) {
|
||||||
|
finalitem=new ItemStack(Material.DIAMOND_HELMET);
|
||||||
|
enchants1.add("Protective");
|
||||||
|
enchants1.add("Fire-Proof");
|
||||||
|
enchants1.add("Blast Resistant");
|
||||||
|
enchants1.add("Untouchable");
|
||||||
|
enchants1.add("Breathing");
|
||||||
|
enchants1.add("Working");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants1.add("Thorny");
|
||||||
|
enchants2.add("Life");
|
||||||
|
enchants2.add("Resistance");
|
||||||
|
enchants2.add("Durability");
|
||||||
|
enchants2.add("Protection");
|
||||||
|
}
|
||||||
|
if (type==1) {
|
||||||
|
finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE);
|
||||||
|
enchants1.add("Protective");
|
||||||
|
enchants1.add("Fire-Proof");
|
||||||
|
enchants1.add("Blast Resistant");
|
||||||
|
enchants1.add("Untouchable");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants1.add("Thorny");
|
||||||
|
enchants2.add("Life");
|
||||||
|
enchants2.add("Resistance");
|
||||||
|
enchants2.add("Durability");
|
||||||
|
enchants2.add("Protection");
|
||||||
|
}
|
||||||
|
if (type==2) {
|
||||||
|
finalitem=new ItemStack(Material.DIAMOND_LEGGINGS);
|
||||||
|
enchants1.add("Protective");
|
||||||
|
enchants1.add("Fire-Proof");
|
||||||
|
enchants1.add("Blast Resistant");
|
||||||
|
enchants1.add("Untouchable");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants1.add("Thorny");
|
||||||
|
enchants2.add("Life");
|
||||||
|
enchants2.add("Resistance");
|
||||||
|
enchants2.add("Durability");
|
||||||
|
enchants2.add("Protection");
|
||||||
|
}
|
||||||
|
if (type==3) {
|
||||||
|
finalitem=new ItemStack(Material.DIAMOND_BOOTS);
|
||||||
|
enchants1.add("Protective");
|
||||||
|
enchants1.add("Fire-Proof");
|
||||||
|
enchants1.add("Blast Resistant");
|
||||||
|
enchants1.add("Untouchable");
|
||||||
|
enchants1.add("Lightweight");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants1.add("Thorny");
|
||||||
|
enchants2.add("Life");
|
||||||
|
enchants2.add("Resistance");
|
||||||
|
enchants2.add("Durability");
|
||||||
|
enchants2.add("Protection");
|
||||||
|
}
|
||||||
|
if (type==4) {
|
||||||
|
finalitem=new ItemStack(Material.BOW);
|
||||||
|
enchants1.add("Power");
|
||||||
|
enchants1.add("Punch");
|
||||||
|
enchants1.add("Flaming");
|
||||||
|
enchants1.add("Infinite");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants2.add("Smiting");
|
||||||
|
enchants2.add("Penetration");
|
||||||
|
enchants2.add("Draining");
|
||||||
|
enchants2.add("Fury");
|
||||||
|
enchants2.add("Power");
|
||||||
|
}
|
||||||
|
if (type==5) {
|
||||||
|
finalitem=new ItemStack(Material.DIAMOND_SWORD);
|
||||||
|
enchants1.add("Damaging");
|
||||||
|
enchants1.add("Knockback");
|
||||||
|
enchants1.add("Undead");
|
||||||
|
enchants1.add("Baning");
|
||||||
|
enchants1.add("Fiery");
|
||||||
|
enchants1.add("Greedy");
|
||||||
|
enchants1.add("Unbreaking");
|
||||||
|
enchants2.add("Smiting");
|
||||||
|
enchants2.add("Penetration");
|
||||||
|
enchants2.add("Draining");
|
||||||
|
enchants2.add("Fury");
|
||||||
|
enchants2.add("Power");
|
||||||
|
}
|
||||||
|
prefix = enchants1.get((int)(Math.random()*enchants1.size()));
|
||||||
|
suffix = enchants2.get((int)(Math.random()*enchants2.size()));
|
||||||
|
if (prefix.equalsIgnoreCase("Protective")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Fire-Proof")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Blast Resistant")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Untouchable")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Breathing")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Working")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Unbreaking")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Thorny")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Untouchable")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Lightweight")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Power")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Damaging")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Knockback")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Punch")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Flaming")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Infinite")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Undead")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Baning")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Fiery")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10);
|
||||||
|
}
|
||||||
|
if (prefix.equalsIgnoreCase("Greedy")) {
|
||||||
|
finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||||
|
}
|
||||||
|
ItemMeta meta = finalitem.getItemMeta();
|
||||||
|
meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix);
|
||||||
|
List<String> setLore = new ArrayList<String>();
|
||||||
|
if (suffix.equalsIgnoreCase("Life")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Resistance")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Durability")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Protection")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Smiting")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Penetration")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Draining")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Fury")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed");
|
||||||
|
}
|
||||||
|
if (suffix.equalsIgnoreCase("Power")) {
|
||||||
|
setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage");
|
||||||
|
}
|
||||||
|
setLore.add("");
|
||||||
|
setLore.add(ChatColor.YELLOW+"[Halloween]");
|
||||||
|
setLore.add("This item was created during the Halloween");
|
||||||
|
setLore.add("event. When this item breaks, it simply turns");
|
||||||
|
setLore.add("into a \"broken\" state and has a recharge time");
|
||||||
|
setLore.add("of 1 week. The item will be fully restored after");
|
||||||
|
setLore.add("a week of cooldown.");
|
||||||
|
meta.setLore(setLore);
|
||||||
|
finalitem.setItemMeta(meta);
|
||||||
|
//finalitem.setDurability((short)1560); //TESTING.
|
||||||
|
boolean full=true;
|
||||||
|
for (int i=0;i<p.getInventory().getContents().length;i++) {
|
||||||
|
if (p.getInventory().getContents()[i]==null) {
|
||||||
|
full=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!full) {
|
||||||
|
p.getInventory().addItem(finalitem);
|
||||||
|
} else {
|
||||||
|
p.getWorld().dropItemNaturally(p.getLocation(), finalitem); //Drop item on the ground if our inventory is full. That way we don't lose it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
||||||
{
|
{
|
||||||
if ((sender instanceof Player)) {
|
if ((sender instanceof Player)) {
|
||||||
@ -320,6 +558,20 @@ public class commandBankEconomy
|
|||||||
}
|
}
|
||||||
this.plugin.saveConfig();
|
this.plugin.saveConfig();
|
||||||
}
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("legendary_item")) {
|
||||||
|
if (this.plugin.getConfig().getBoolean("halloween-enabled")) {
|
||||||
|
giveLegendaryItem(p);
|
||||||
|
}
|
||||||
|
this.plugin.saveConfig();
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("break")) {
|
||||||
|
if (this.plugin.getConfig().getBoolean("halloween-enabled")) {
|
||||||
|
if (p.getItemInHand()!=null) {
|
||||||
|
p.getItemInHand().setDurability((short)9000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.plugin.saveConfig();
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) {
|
if (cmd.getName().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) {
|
||||||
Dungeon x = new Dungeon(new Location(Bukkit.getWorld("world"),-8990,0,-4),new Location(Bukkit.getWorld("world"),50,255,50),Integer.valueOf(args[0]));
|
Dungeon x = new Dungeon(new Location(Bukkit.getWorld("world"),-8990,0,-4),new Location(Bukkit.getWorld("world"),50,255,50),Integer.valueOf(args[0]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user