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);
}
}
ItemStack ciItem = null;
if (Herobrine.getPluginCore().getConfigDB().UseCustomItems)
Random generator = new Random();
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)
{
Random generator = new Random();
int chance = generator.nextInt(Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.size());
if ((Herobrine.getPluginCore().getSupport().isCustomItems()) &&
(Herobrine.getPluginCore().getSupport().getCustomItems().checkItem((String)Herobrine.getPluginCore().getConfigDB().UseCustomItemsList.get(chance)))) {
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);
}
item = new ItemStack(Material.BOW);
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
else if ((chance < 8) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
Random generator = new Random();
int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if ((chance < 4) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow))
{
item = new ItemStack(Material.BOW);
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);
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);
}
}

View File

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

View File

@ -1,6 +1,5 @@
package net.theprogrammersworld.herobrine;
import net.theprogrammersworld.herobrine.hooks.CustomItemsHook;
import net.theprogrammersworld.herobrine.hooks.FactionsHook;
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
@ -25,7 +24,6 @@ public class Support {
private GriefPreventionHook GriefPreventionCore;
private TownyHook TownyCore;
private WorldGuardHook WorldGuard;
private CustomItemsHook CustomItems = null;
private PreciousStonesHook PreciousStones;
private FactionsHook Factions;
private RedProtectHook RedProtect;
@ -34,7 +32,6 @@ public class Support {
ResidenceCore = new ResidenceHook();
GriefPreventionCore = new GriefPreventionHook();
TownyCore = new TownyHook();
CustomItems = new CustomItemsHook();
WorldGuard = new WorldGuardHook();
PreciousStones = new PreciousStonesHook();
Factions = new FactionsHook();
@ -104,11 +101,6 @@ public class Support {
B_RedProtect = true;
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) {
@ -159,11 +151,4 @@ public class Support {
public boolean isCustomItems() {
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);
}
}