More Digger changes. Add in DiabloDropsHook API first implementation.

dev
sigonasr2 11 years ago
parent 1ac4c6ea1a
commit ee564d496d
  1. 5
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 90
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  3. 5
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java
  4. 35
      BankEconomyMod/src/sig/ItemSets/DiabloDropsHook.java

@ -575,6 +575,11 @@ public class Main extends JavaPlugin
item_cube.setIngredient('c', Material.EMERALD_BLOCK);
Bukkit.addRecipe(item_cube);
ShapelessRecipe artifact_clay = new ShapelessRecipe(new ItemStack(Material.CLAY_BALL));
artifact_clay.addIngredient(Material.CLAY_BALL);
artifact_clay.addIngredient(Material.EYE_OF_ENDER);
Bukkit.addRecipe(artifact_clay);
ItemSetList = new ItemSetList();
ItemSetList.Init();

@ -179,6 +179,7 @@ import org.bukkit.util.Vector;
import org.bukkit.potion.Potion;
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.MaxChangedBlocksException;
@ -1551,12 +1552,15 @@ implements Listener
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefwins", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleeflosses", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1", String.valueOf("None"));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1_30", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1lv", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1exp", Double.valueOf(0.0d));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2", String.valueOf("None"));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2_30", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2lv", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2exp", Double.valueOf(0.0d));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3", String.valueOf("None"));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3_30", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3lv", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3exp", Double.valueOf(0.0d));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.ultimate", String.valueOf("None"));
@ -1609,6 +1613,12 @@ implements Listener
p.sendMessage("----------------------------");
p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName().toLowerCase()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase()+".money")));
//Update account information for the stat point update.
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".jobs.job1_30")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job1_30", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job2_30", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job3_30", Integer.valueOf(0));
//this.plugin.saveAccountsConfig();
}
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".bonus.witherskeleton")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".bonus.witherskeleton", Integer.valueOf(0));
//this.plugin.saveAccountsConfig();
@ -3685,9 +3695,9 @@ implements Listener
}
if (this.plugin.hasJobBuff("Digger", p, Job.JOB5)) {
//Applies to dirt, sand, and gravel blocks. A small chance that a nearby block drops an artifact piece (clay with enchantment to glow)
if (e.getBlock().getType()==Material.DIRT ||
if ((e.getBlock().getType()==Material.DIRT ||
e.getBlock().getType()==Material.SAND ||
e.getBlock().getType()==Material.GRAVEL && Math.random()<=0.0025 /*0.25% chance*/) {
e.getBlock().getType()==Material.GRAVEL) && Math.random()<=0.0025 /*0.25% chance*/) {
ItemStack artifact = new ItemStack(Material.CLAY_BALL);
ItemMeta meta = artifact.getItemMeta();
List<String> lore = new ArrayList<String>();
@ -4448,16 +4458,42 @@ implements Listener
//****************************// Job Boofs poof here.
if (result.getResult().getType()==Material.CLAY_BALL) {
//Check to see if there is an artifact in the crafting grid.
boolean artifact=false;
boolean artifact=false, ender_eye=false;
for (int i=0;i<result.getMatrix().length;i++) {
if (result.getMatrix()[i]!=null) {
if (result.getMatrix()[i].getType()==Material.CLAY_BALL) {
//See if it's an artifact.
if (result.getMatrix()[i].hasItemMeta() && result.getMatrix()[i].getItemMeta().hasLore()) {
if (result.getMatrix()[i].getItemMeta().getLore().contains("This clump of material seems to")) {
for (int j=0;j<result.getMatrix()[i].getItemMeta().getLore().size();j++) {
if (result.getMatrix()[i].getItemMeta().getLore().get(j).contains("This clump of material seems to")) {
Bukkit.getLogger().info("Found the lore line.");
artifact=true;
}
}
}
}
if (result.getMatrix()[i].getType()==Material.EYE_OF_ENDER) {
Bukkit.getLogger().info("Found the eye of ender.");
ender_eye=true;
} //DERP
}
}
if (artifact && ender_eye) {
ItemStack artifact_result = new ItemStack(Material.CLAY_BALL);
ItemMeta meta = artifact_result.getItemMeta();
List<String> lore = new ArrayList<String>();
lore.add("This clump of material seems to");
lore.add("be part of something ancient.");
lore.add("");
lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.ITALIC+"This piece has a chance to be restored");
lore.add(ChatColor.LIGHT_PURPLE+""+ChatColor.ITALIC+"to its true potential.");
meta.setLore(lore);
artifact_result.setItemMeta(meta);
artifact_result.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1);
result.setResult(artifact_result);
} else {
result.setResult(new ItemStack(Material.AIR));
return; //Don't allow it to continue.
}
}
//****************************//Job Non-Boofs go below.
@ -13333,19 +13369,6 @@ implements Listener
//******************************//All Job Buff related items go in here.
if (e.getAction()==Action.LEFT_CLICK_BLOCK || e.getAction()==Action.RIGHT_CLICK_AIR) {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB10)) {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) {
p.setAllowFlight(true);
p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled...");
this.plugin.getPlayerData(p).lastflighttime=Main.SERVER_TICK_TIME;
} else {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40)) {
this.plugin.getPlayerData(p).lastflighttime=Main.SERVER_TICK_TIME;
}
}
//See if they are holding a line tool.
if (p.getItemInHand().getType()==Material.getMaterial(142)) {
//Check to see if this is the first block they clicked.
@ -13362,6 +13385,19 @@ implements Listener
pd.SetClickedBlock(checkblock.getLocation());
} else {
if (pd.GetClickedBlock().distance(checkblock.getLocation())<=500) {//Make sure the range is small enough.
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) {
p.setAllowFlight(true);
p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled...");
this.plugin.getPlayerData(p).lastflighttime=Main.SERVER_TICK_TIME;
} else {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40)) {
this.plugin.getPlayerData(p).lastflighttime=Main.SERVER_TICK_TIME;
}
}
//Compare the blocks and see if they are the same.
boolean successful=true;
int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder");
@ -13494,6 +13530,15 @@ implements Listener
}
}
if (e.getAction()==Action.LEFT_CLICK_BLOCK && this.plugin.hasJobBuff("Builder", p, Job.JOB5)) {
//See if they are holding a line tool.
if (p.getItemInHand().getType()==Material.getMaterial(141)) {
//Check to see if this is the first block they clicked.
PlayerData pd = this.plugin.getPlayerData(p);
if (pd.GetClickedBlock()==null) {
p.sendMessage("Set first block. Left-click another block of the same type to build a line of that block between them. "+ChatColor.GRAY+ChatColor.ITALIC+"If you wish to cancel, right-click or swap items.");
pd.SetClickedBlock(e.getClickedBlock().getLocation());
} else {
if (pd.GetClickedBlock().distance(e.getClickedBlock().getLocation())<=500) {//Make sure the range is small enough.
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
@ -13507,15 +13552,6 @@ implements Listener
this.plugin.getPlayerData(p).lastflighttime=Main.SERVER_TICK_TIME;
}
}
//See if they are holding a line tool.
if (p.getItemInHand().getType()==Material.getMaterial(141)) {
//Check to see if this is the first block they clicked.
PlayerData pd = this.plugin.getPlayerData(p);
if (pd.GetClickedBlock()==null) {
p.sendMessage("Set first block. Left-click another block of the same type to build a line of that block between them. "+ChatColor.GRAY+ChatColor.ITALIC+"If you wish to cancel, right-click or swap items.");
pd.SetClickedBlock(e.getClickedBlock().getLocation());
} else {
if (pd.GetClickedBlock().distance(e.getClickedBlock().getLocation())<=500) {//Make sure the range is small enough.
int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder");
//Compare the blocks and see if they are the same.
boolean successful=true;

@ -45,6 +45,8 @@ import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import sig.ItemSets.DiabloDropsHook;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
@ -570,6 +572,9 @@ public String convertToItemName(String val) {
}
this.plugin.saveConfig();
}
if (args[0].equalsIgnoreCase("diablodrops")) {
p.getWorld().dropItemNaturally(p.getLocation(), DiabloDropsHook.getRandomItem());
}
if (args[0].equalsIgnoreCase("loot")) {
p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); }
if (args[0].equalsIgnoreCase("thanksgiving")) {

@ -0,0 +1,35 @@
package sig.ItemSets;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import com.modcrafting.diablodrops.DiabloDrops;
public class DiabloDropsHook {
enum Tier {Legendary, Lore, Magical, Rare, Set, Unidentified};
public static ItemStack getRandomItem() {
return DiabloDrops.getInstance().getDropAPI().getItem();
}
public static ItemStack getRandomItem(Material mat) {
//Returns a random Diablodrops item that is of a certain material type..
return DiabloDrops.getInstance().getDropAPI().getItem(mat);
}
public static ItemStack getTierItem(Tier tier) {
//Returns a random Diablodrops item that is of a certain tier type.. (Use the Tier enum types)
return DiabloDrops.getInstance().getDropAPI().getItem(DiabloDrops.getInstance().getDropAPI().getTier(tier.name()));
}
public static ItemStack getTierItem(Material mat, Tier tier) {
//Returns a random Diablodrops item that is of a certain material type and tier type.. (Use the Tier enum types)
return DiabloDrops.getInstance().getDropAPI().getItem(mat, DiabloDrops.getInstance().getDropAPI().getTier(tier.name()));
}
public static ItemStack getItem(ItemStack i) {
//Turns an item into a Diablodrops special item.
return DiabloDrops.getInstance().getDropAPI().getItem(i);
}
public void fillChest(Block b, int size) {
//Fills a specified chest in the world with loot.
DiabloDrops.getInstance().getDropAPI().fillChest(b, size);
}
}
Loading…
Cancel
Save