Removed support for Custom Items since Custom Items has been discontinued

This commit is contained in:
David Berdik 2017-12-22 23:15:00 -05:00
parent a458cb71b8
commit 296585d547
4 changed files with 34 additions and 123 deletions

View File

@ -156,65 +156,44 @@ public class Temple extends Core {
Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(mobloc, MobType.ARTIFACT_GUARDIAN); Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(mobloc, MobType.ARTIFACT_GUARDIAN);
} }
} }
ItemStack ciItem = null; Random generator = new Random();
if (Herobrine.getPluginCore().getConfigDB().UseCustomItems) int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if ((chance < 4) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow))
{ {
if (Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.size() > 0) item = new ItemStack(Material.BOW);
{ newLore.add("Herobrine's Artifact");
Random generator = new Random(); newLore.add("Bow of Teleporting");
int chance = generator.nextInt(Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.size()); item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
if ((Herobrine.getPluginCore().getSupport().isCustomItems()) && item.addEnchantment(Enchantment.ARROW_FIRE, 1);
(Herobrine.getPluginCore().getSupport().getCustomItems().checkItem((String)Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.get(chance)))) { item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
ciItem = Herobrine.getPluginCore().getSupport().getCustomItems().getItem((String)Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.get(chance));
}
}
if (ciItem != null)
{
Chest chest = (Chest)loc.getWorld().getBlockAt(MainX + 5, MainY - 2, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), ciItem);
}
} }
else else if ((chance < 8) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{ {
Random generator = new Random(); item = new ItemStack(Material.DIAMOND_SWORD);
int chance = generator.nextInt(15); newLore.add("Herobrine's Artifact");
ItemStack item = null; newLore.add("Sword of Lightning");
ArrayList<String> newLore = new ArrayList<String>(); item = ItemName.setNameAndLore(item, "Sword of Lightning", newLore);
if ((chance < 4) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) item.addEnchantment(Enchantment.KNOCKBACK, 2);
{ item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item = new ItemStack(Material.BOW); item.addEnchantment(Enchantment.DURABILITY, 3);
newLore.add("Herobrine's Artifact");
newLore.add("Bow of Teleporting");
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
}
else if ((chance < 8) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
item = new ItemStack(Material.DIAMOND_SWORD);
newLore.add("Herobrine's Artifact");
newLore.add("Sword of Lightning");
item = ItemName.setNameAndLore(item, "Sword of Lightning", newLore);
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item.addEnchantment(Enchantment.DURABILITY, 3);
}
else if ((chance < 12) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine's Artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
}
else if (Herobrine.getPluginCore().getConfigDB().UseAncientSword)
{
item = Herobrine.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
}
Chest chest = (Chest)loc.getWorld().getBlockAt(MainX + 5, MainY - 2, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
} }
else if ((chance < 12) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine's Artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
}
else if (Herobrine.getPluginCore().getConfigDB().UseAncientSword)
{
item = Herobrine.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
}
Chest chest = (Chest)loc.getWorld().getBlockAt(MainX + 5, MainY - 2, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
} }
} }

View File

@ -70,13 +70,11 @@ public class ConfigDB
public int HerobrineHP = 150; public int HerobrineHP = 150;
public int BuildInterval = 72000; public int BuildInterval = 72000;
public boolean UseHeads = true; public boolean UseHeads = true;
public boolean UseCustomItems = false;
public boolean UseAncientSword = true; public boolean UseAncientSword = true;
public boolean UseNPC_Guardian = true; public boolean UseNPC_Guardian = true;
public boolean UseNPC_Warrior = true; public boolean UseNPC_Warrior = true;
public boolean UseNPC_Demon = true; public boolean UseNPC_Demon = true;
public CustomID ItemInHand = null; public CustomID ItemInHand = null;
public List<String> UseCustomItemsList = new ArrayList<String>();
public boolean Explosions = true; public boolean Explosions = true;
public boolean Burn = true; public boolean Burn = true;
public boolean Curse = true; public boolean Curse = true;
@ -199,7 +197,6 @@ public class ConfigDB
this.useBookMessages.add("White eyes in dark..."); this.useBookMessages.add("White eyes in dark...");
this.useBookMessages.add("... was last what I saw ..."); this.useBookMessages.add("... was last what I saw ...");
this.useBookMessages.add("... before i was dead."); this.useBookMessages.add("... before i was dead.");
this.UseCustomItemsList.add("ItemExample");
this.log.info("[Herobrine] Creating new Config ..."); this.log.info("[Herobrine] Creating new Config ...");
this.config.set("config.ShowInterval", Integer.valueOf(144000)); this.config.set("config.ShowInterval", Integer.valueOf(144000));
@ -251,8 +248,6 @@ public class ConfigDB
this.config.set("config.SecuredArea.Signs", Boolean.valueOf(true)); this.config.set("config.SecuredArea.Signs", Boolean.valueOf(true));
this.config.set("config.SecuredArea.Books", Boolean.valueOf(true)); this.config.set("config.SecuredArea.Books", Boolean.valueOf(true));
this.config.set("config.UseHeads", Boolean.valueOf(true)); this.config.set("config.UseHeads", Boolean.valueOf(true));
this.config.set("config.UseCustomItems", Boolean.valueOf(false));
this.config.set("config.CustomItemsList", this.UseCustomItemsList);
this.config.set("config.UseAncientSword", Boolean.valueOf(true)); this.config.set("config.UseAncientSword", Boolean.valueOf(true));
this.config.set("config.UseNPC.Guardian", Boolean.valueOf(true)); this.config.set("config.UseNPC.Guardian", Boolean.valueOf(true));
this.config.set("config.UseNPC.Warrior", Boolean.valueOf(true)); this.config.set("config.UseNPC.Warrior", Boolean.valueOf(true));
@ -428,16 +423,6 @@ public class ConfigDB
hasUpdated = true; hasUpdated = true;
this.config.set("config.UseHeads", Boolean.valueOf(true)); this.config.set("config.UseHeads", Boolean.valueOf(true));
} }
if (!this.config.contains("config.UseCustomItems"))
{
if (!hasUpdated) {
this.log.info("[Herobrine] Configuration file updating to Herobrine v" + pluginVersionNumber);
}
hasUpdated = true;
this.UseCustomItemsList.add("ItemExample");
this.config.set("config.UseCustomItems", Boolean.valueOf(false));
this.config.set("config.CustomItemsList", this.UseCustomItemsList);
}
if (!this.config.contains("config.UseAncientSword")) if (!this.config.contains("config.UseAncientSword"))
{ {
if (!hasUpdated) { if (!hasUpdated) {
@ -664,8 +649,6 @@ public class ConfigDB
this.SecuredArea_Signs = this.config.getBoolean("config.SecuredArea.Signs"); this.SecuredArea_Signs = this.config.getBoolean("config.SecuredArea.Signs");
this.SecuredArea_Books = this.config.getBoolean("config.SecuredArea.Books"); this.SecuredArea_Books = this.config.getBoolean("config.SecuredArea.Books");
this.UseHeads = this.config.getBoolean("config.UseHeads"); this.UseHeads = this.config.getBoolean("config.UseHeads");
this.UseCustomItems = this.config.getBoolean("config.UseCustomItems");
this.UseCustomItemsList = this.config.getStringList("config.CustomItemsList");
this.UseAncientSword = this.config.getBoolean("config.UseAncientSword"); this.UseAncientSword = this.config.getBoolean("config.UseAncientSword");
this.UseNPC_Guardian = this.config.getBoolean("config.UseNPC.Guardian"); this.UseNPC_Guardian = this.config.getBoolean("config.UseNPC.Guardian");
this.UseNPC_Warrior = this.config.getBoolean("config.UseNPC.Warrior"); this.UseNPC_Warrior = this.config.getBoolean("config.UseNPC.Warrior");

View File

@ -1,6 +1,5 @@
package net.theprogrammersworld.herobrine; package net.theprogrammersworld.herobrine;
import net.theprogrammersworld.herobrine.hooks.CustomItemsHook;
import net.theprogrammersworld.herobrine.hooks.FactionsHook; import net.theprogrammersworld.herobrine.hooks.FactionsHook;
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook; import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook; import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
@ -25,7 +24,6 @@ public class Support {
private GriefPreventionHook GriefPreventionCore; private GriefPreventionHook GriefPreventionCore;
private TownyHook TownyCore; private TownyHook TownyCore;
private WorldGuardHook WorldGuard; private WorldGuardHook WorldGuard;
private CustomItemsHook CustomItems = null;
private PreciousStonesHook PreciousStones; private PreciousStonesHook PreciousStones;
private FactionsHook Factions; private FactionsHook Factions;
private RedProtectHook RedProtect; private RedProtectHook RedProtect;
@ -34,7 +32,6 @@ public class Support {
ResidenceCore = new ResidenceHook(); ResidenceCore = new ResidenceHook();
GriefPreventionCore = new GriefPreventionHook(); GriefPreventionCore = new GriefPreventionHook();
TownyCore = new TownyHook(); TownyCore = new TownyHook();
CustomItems = new CustomItemsHook();
WorldGuard = new WorldGuardHook(); WorldGuard = new WorldGuardHook();
PreciousStones = new PreciousStonesHook(); PreciousStones = new PreciousStonesHook();
Factions = new FactionsHook(); Factions = new FactionsHook();
@ -104,11 +101,6 @@ public class Support {
B_RedProtect = true; B_RedProtect = true;
Herobrine.log.info("[Herobrine] RedProtect plugin detected on server"); Herobrine.log.info("[Herobrine] RedProtect plugin detected on server");
} }
if (this.CustomItems.Check()) {
this.B_CustomItems = true;
Herobrine.log.info("[Herobrine] Custom Items plugin detected on server");
this.CustomItems.init();
}
} }
public boolean isSecuredArea(final Location loc) { public boolean isSecuredArea(final Location loc) {
@ -159,11 +151,4 @@ public class Support {
public boolean isCustomItems() { public boolean isCustomItems() {
return this.B_CustomItems; return this.B_CustomItems;
} }
public CustomItemsHook getCustomItems() {
if (this.B_CustomItems) {
return this.CustomItems;
}
return null;
}
} }

View File

@ -1,36 +0,0 @@
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack;
import net.theprogrammersworld.customitems.API;
import net.theprogrammersworld.customitems.CustomItems;
public class CustomItemsHook
{
private CustomItems ci = null;
private API api = null;
public void init()
{
this.ci = ((CustomItems)Bukkit.getServer().getPluginManager().getPlugin("Custom_Items"));
this.api = CustomItems.getAPI();
}
public boolean Check()
{
return Bukkit.getServer().getPluginManager().getPlugin("Custom_Items") != null;
}
public boolean checkItem(String name)
{
if (this.ci != null) {
return this.api.itemExist(name);
}
return false;
}
public ItemStack getItem(String name)
{
return this.api.createItem(name);
}
}