Fixed the Item Info display for durability. Added the ability to write
checks. Hellfire zombies behave a little smarter in water/lava. Hellfire zombies rally all other nearby mobs.
This commit is contained in:
parent
f2e426f69b
commit
101084e875
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.4.7
|
version: 3.4.7a
|
||||||
commands:
|
commands:
|
||||||
money:
|
money:
|
||||||
description: Tells the player the amount of money they are holding.
|
description: Tells the player the amount of money they are holding.
|
||||||
|
12
src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
Normal file
12
src/sig/plugin/TwosideKeeper/AwakenedArtifact.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class AwakenedArtifact {
|
||||||
|
public static ItemStack convertToAwakenedArtifact(ItemStack artifact) {
|
||||||
|
ItemStack item = artifact.clone();
|
||||||
|
item = Artifact.convert(item,false);
|
||||||
|
GenericFunctions.
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
@ -28,10 +28,14 @@ public class ChargeZombie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void BreakBlocksAroundArea(int radius) {
|
public void BreakBlocksAroundArea(int radius) {
|
||||||
for (int x=-radius;x<radius+1;x++) {
|
int outerradius = radius+1;
|
||||||
for (int y=-radius;y<radius+2;y++) {
|
for (int x=-radius-1;x<radius+2;x++) {
|
||||||
for (int z=-radius;z<radius+1;z++) {
|
for (int y=-radius;y<radius+3;y++) {
|
||||||
if (!BlockUtils.isExplosionProof(m.getLocation().add(x,y,z).getBlock().getType()) ||
|
for (int z=-radius-1;z<radius+2;z++) {
|
||||||
|
if (Math.abs(x)<outerradius &&
|
||||||
|
Math.abs(y)<outerradius+1 &&
|
||||||
|
Math.abs(z)<outerradius &&
|
||||||
|
!BlockUtils.isExplosionProof(m.getLocation().add(x,y,z).getBlock().getType()) ||
|
||||||
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) {
|
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) {
|
||||||
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
|
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
|
||||||
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
|
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
|
||||||
@ -58,6 +62,15 @@ public class ChargeZombie {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
if (Math.abs(x)>=outerradius ||
|
||||||
|
Math.abs(y)>=outerradius+1 ||
|
||||||
|
Math.abs(z)>=outerradius) {
|
||||||
|
//This block can be destroyed if it is a liquid.
|
||||||
|
if (m.getLocation().add(x,y,z).getBlock().isLiquid()) {
|
||||||
|
m.getLocation().add(x,y,z).getBlock().breakNaturally();
|
||||||
|
Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), -1, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
66
src/sig/plugin/TwosideKeeper/Check.java
Normal file
66
src/sig/plugin/TwosideKeeper/Check.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
public class Check {
|
||||||
|
double amt;
|
||||||
|
String player;
|
||||||
|
public Check(ItemStack item) {
|
||||||
|
//Parse the check.
|
||||||
|
if (Check.isSignedBankCheck(item)) {
|
||||||
|
amt = Double.parseDouble(item.getItemMeta().getLore().get(0).split("\\$")[1]);
|
||||||
|
player = item.getItemMeta().getLore().get(1).split(" "+ChatColor.LIGHT_PURPLE)[1];
|
||||||
|
} else {
|
||||||
|
this.amt=0;
|
||||||
|
this.player=null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean isUnsignedBankCheck(ItemStack item) {
|
||||||
|
if (item!=null &&
|
||||||
|
item.getType()==Material.PAPER &&
|
||||||
|
item.getEnchantmentLevel(Enchantment.LUCK)==1 &&
|
||||||
|
item.getItemMeta().hasLore() &&
|
||||||
|
item.getItemMeta().getLore().size()==3) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean isSignedBankCheck(ItemStack item) {
|
||||||
|
if (item!=null &&
|
||||||
|
item.getType()==Material.PAPER &&
|
||||||
|
item.getEnchantmentLevel(Enchantment.LUCK)==1 &&
|
||||||
|
item.getItemMeta().hasLore() &&
|
||||||
|
item.getItemMeta().getLore().size()==5 &&
|
||||||
|
item.getItemMeta().getLore().get(3).equalsIgnoreCase(ChatColor.ITALIC+"Cash into any local bank") &&
|
||||||
|
item.getItemMeta().getLore().get(4).equalsIgnoreCase(ChatColor.ITALIC+"for money!")) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static ItemStack createSignedBankCheckItem(double amt, String signedby) {
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
ItemStack check = new ItemStack(Material.PAPER);
|
||||||
|
check.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||||
|
ItemMeta m = check.getItemMeta();
|
||||||
|
m.setDisplayName("Signed Money Cheque");
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
lore.add(ChatColor.ITALIC+""+ChatColor.WHITE+"Check for "+ChatColor.YELLOW+"$"+df.format(amt));
|
||||||
|
lore.add(ChatColor.BLUE+"Signed by "+ChatColor.LIGHT_PURPLE+signedby);
|
||||||
|
lore.add("");
|
||||||
|
lore.add(ChatColor.ITALIC+"Cash into any local bank");
|
||||||
|
lore.add(ChatColor.ITALIC+"for money!");
|
||||||
|
m.setLore(lore);
|
||||||
|
check.setItemMeta(m);
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
}
|
@ -294,6 +294,15 @@ public enum ArtifactItemType {
|
|||||||
this.healthamt = healthamt;
|
this.healthamt = healthamt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static ArtifactItemType getTypeFromData(int dataval) {
|
||||||
|
for (int i=0;i<ArtifactItemType.values().length;i++) {
|
||||||
|
if (ArtifactItemType.values()[i].getDataValue()==dataval) {
|
||||||
|
return ArtifactItemType.values()[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public int getDataValue() {
|
public int getDataValue() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
|
||||||
|
public class BankSession {
|
||||||
|
Player p;
|
||||||
|
long time;
|
||||||
|
SessionState state;
|
||||||
|
public BankSession(Player p, SessionState type) {
|
||||||
|
this.p=p;
|
||||||
|
this.time=TwosideKeeper.getServerTickTime();
|
||||||
|
this.state=type;
|
||||||
|
}
|
||||||
|
public Player GetPlayer() {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
public SessionState GetState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
public boolean isSessionExpired() {
|
||||||
|
if (time+TwosideKeeper.TERMINALTIME<TwosideKeeper.getServerTickTime()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetState(SessionState newstate) {
|
||||||
|
this.state=newstate;
|
||||||
|
}
|
||||||
|
public void refreshSession() {
|
||||||
|
this.time=TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
public String GetExpirationMessage() {
|
||||||
|
return ChatColor.RED+"Bank session closed. "+ChatColor.WHITE+"Ran out of time!";
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import org.bukkit.DyeColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Guardian;
|
import org.bukkit.entity.Guardian;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -98,6 +99,96 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack addHardenedItemBreaks(ItemStack item, int breaks) {
|
||||||
|
if (isHardenedItem(item)) {
|
||||||
|
//We can just modify the amount of breaks.
|
||||||
|
return modifyBreaks(item, getHardenedItemBreaks(item)+breaks,false);
|
||||||
|
} else {
|
||||||
|
//We need to add a new line in regards to making this item hardened. Two lines if it's armor.
|
||||||
|
ItemMeta m =item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
if (item.hasItemMeta() &&
|
||||||
|
item.getItemMeta().hasLore()) {
|
||||||
|
lore = m.getLore();
|
||||||
|
}
|
||||||
|
if (isArmor(item)) {
|
||||||
|
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
|
||||||
|
lore.add(ChatColor.GRAY+"Twice as strong");
|
||||||
|
} else
|
||||||
|
if (isWeapon(item)) {
|
||||||
|
lore.add(ChatColor.GRAY+"Twice as strong");
|
||||||
|
}
|
||||||
|
lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+breaks);
|
||||||
|
m.setLore(lore);
|
||||||
|
if (m.hasDisplayName()) {
|
||||||
|
m.setDisplayName(ChatColor.BLUE+"Hardened "+m.getDisplayName());
|
||||||
|
} else {
|
||||||
|
m.setDisplayName(ChatColor.BLUE+"Hardened "+UserFriendlyMaterialName(item));
|
||||||
|
}
|
||||||
|
item.setItemMeta(m);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack addObscureHardenedItemBreaks(ItemStack item, int breaks) {
|
||||||
|
if (isObscureHardenedItem(item)) {
|
||||||
|
//We can just modify the amount of breaks.
|
||||||
|
return modifyBreaks(item, getHardenedItemBreaks(item)+breaks,true);
|
||||||
|
} else {
|
||||||
|
//We need to add a new line in regards to making this item hardened. Two lines if it's armor.
|
||||||
|
ItemMeta m =item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
if (item.hasItemMeta() &&
|
||||||
|
item.getItemMeta().hasLore()) {
|
||||||
|
lore = m.getLore();
|
||||||
|
}
|
||||||
|
if (isArmor(item)) {
|
||||||
|
lore.add(ChatColor.BLUE+""+ChatColor.ITALIC+"Hardened Armor");
|
||||||
|
lore.add(ChatColor.GRAY+"Twice as strong");
|
||||||
|
} else
|
||||||
|
if (isWeapon(item)) {
|
||||||
|
lore.add(ChatColor.GRAY+"Twice as strong");
|
||||||
|
}
|
||||||
|
lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC+breaks);
|
||||||
|
lore.add(ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime());
|
||||||
|
m.setLore(lore);
|
||||||
|
if (m.hasDisplayName()) {
|
||||||
|
m.setDisplayName(ChatColor.BLUE+"Hardened "+m.getDisplayName());
|
||||||
|
} else {
|
||||||
|
m.setDisplayName(ChatColor.BLUE+"Hardened "+UserFriendlyMaterialName(item));
|
||||||
|
}
|
||||||
|
item.setItemMeta(m);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack modifyBreaks(ItemStack item, int newbreaks, boolean isObscure) {
|
||||||
|
//Find the line with Breaks Remaining.
|
||||||
|
if (item.hasItemMeta() &&
|
||||||
|
item.getItemMeta().hasLore()) {
|
||||||
|
ItemMeta item_meta = item.getItemMeta();
|
||||||
|
int breaks_remaining=-1;
|
||||||
|
int loreline=-1;
|
||||||
|
for (int i=0;i<item_meta.getLore().size();i++) {
|
||||||
|
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),2);
|
||||||
|
TwosideKeeper.log("Checking for "+ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC),2);
|
||||||
|
if (item_meta.getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC))) {
|
||||||
|
TwosideKeeper.log("Line is "+item_meta.getLore().get(i),2);
|
||||||
|
loreline = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Found it. Now we will modify it and return the new item.
|
||||||
|
List<String> newlore = item_meta.getLore();
|
||||||
|
newlore.set(loreline, ChatColor.GRAY+"Breaks Remaining: "+((!isObscure)?ChatColor.YELLOW:ChatColor.MAGIC)+newbreaks);
|
||||||
|
item_meta.setLore(newlore);
|
||||||
|
item.setItemMeta(item_meta);
|
||||||
|
return item;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int getObscureHardenedItemBreaks(ItemStack item) {
|
public static int getObscureHardenedItemBreaks(ItemStack item) {
|
||||||
if (item.hasItemMeta() &&
|
if (item.hasItemMeta() &&
|
||||||
@ -115,6 +206,7 @@ public class GenericFunctions {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ItemStack breakObscureHardenedItem(ItemStack item) {
|
public static ItemStack breakObscureHardenedItem(ItemStack item) {
|
||||||
int break_count = getObscureHardenedItemBreaks(item)-1;
|
int break_count = getObscureHardenedItemBreaks(item)-1;
|
||||||
int break_line = -1;
|
int break_line = -1;
|
||||||
@ -1309,6 +1401,23 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isObscureHardenedItem(ItemStack item) {
|
||||||
|
if (item.hasItemMeta() &&
|
||||||
|
item.getItemMeta().hasLore()) {
|
||||||
|
//TwosideKeeper.log("This item has lore...", 2);
|
||||||
|
for (int i=0;i<item.getItemMeta().getLore().size();i++) {
|
||||||
|
TwosideKeeper.log("Lore line is: "+item.getItemMeta().getLore().get(i), 5);
|
||||||
|
if (item.getItemMeta().getLore().get(i).contains(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.MAGIC)) {
|
||||||
|
TwosideKeeper.log("Item "+item.toString()+" is obscured and hardened. Return it!", 5);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; //Nothing found. Return false.
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isEquip(ItemStack item) {
|
public static boolean isEquip(ItemStack item) {
|
||||||
if (item.getType().toString().contains("SPADE") ||
|
if (item.getType().toString().contains("SPADE") ||
|
||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
@ -1535,4 +1644,10 @@ public class GenericFunctions {
|
|||||||
return new ItemStack(Material.AIR);
|
return new ItemStack(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void produceError(int errorCode, CommandSender sender) {
|
||||||
|
String ErrorMessage = ChatColor.RED+"(ERRCODE "+errorCode+") A Fatal Error has occured! "+ChatColor.WHITE+"Please let the server administrator know about this.";
|
||||||
|
sender.sendMessage(ErrorMessage);
|
||||||
|
TwosideKeeper.log(ErrorMessage, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,10 @@ public enum SessionState {
|
|||||||
BUY_PRICE, //Creating a buy shop. Asks for buy price of each unit.
|
BUY_PRICE, //Creating a buy shop. Asks for buy price of each unit.
|
||||||
BUY_EDIT, //Editing a shop. Asks for amount to withdraw.
|
BUY_EDIT, //Editing a shop. Asks for amount to withdraw.
|
||||||
BUY_UPDATE, //Editing a shop. Asks for new price of each unit.
|
BUY_UPDATE, //Editing a shop. Asks for new price of each unit.
|
||||||
SELL
|
SELL,
|
||||||
|
SIGN_CHECK,
|
||||||
|
CASH_CHECK,
|
||||||
|
WITHDRAW,
|
||||||
|
DEPOSIT,
|
||||||
|
CONVERT
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ public class WorldShop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.getType().getMaxDurability()>0) {
|
if (item.getType().getMaxDurability()>0) {
|
||||||
message+="\n\n"+ChatColor.GRAY+"Durability: "+(item.getType().getMaxDurability()-item.getDurability()-1)+"/"+(item.getType().getMaxDurability()-1);
|
message+="\n\n"+ChatColor.GRAY+"Durability: "+(item.getType().getMaxDurability()-item.getDurability()+1)+"/"+(item.getType().getMaxDurability()+1);
|
||||||
}
|
}
|
||||||
if (item.getItemMeta() instanceof Repairable &&
|
if (item.getItemMeta() instanceof Repairable &&
|
||||||
GenericFunctions.isEquip(item)) {
|
GenericFunctions.isEquip(item)) {
|
||||||
|
@ -490,24 +490,29 @@ public class Recipes {
|
|||||||
Bukkit.addRecipe(ArtifactItemType.values()[i].defineBaseRecipe());
|
Bukkit.addRecipe(ArtifactItemType.values()[i].defineBaseRecipe());
|
||||||
ArtifactItemType.values()[i].defineAllDecompRecipes();
|
ArtifactItemType.values()[i].defineAllDecompRecipes();
|
||||||
//T1,T4,T7 Recipes
|
//T1,T4,T7 Recipes
|
||||||
ShapelessRecipe newrecipe = new ShapelessRecipe(Artifact.convert_equip(ArtifactItemType.values()[i].getTieredItem(1),1,ArtifactItemType.values()[i]));
|
ShapelessRecipe newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
|
||||||
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
||||||
newrecipe.addIngredient(Material.SUGAR);
|
newrecipe.addIngredient(Material.SUGAR);
|
||||||
Bukkit.addRecipe(newrecipe);
|
Bukkit.addRecipe(newrecipe);
|
||||||
newrecipe = new ShapelessRecipe(Artifact.convert_equip(ArtifactItemType.values()[i].getTieredItem(2),2,ArtifactItemType.values()[i]));
|
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
|
||||||
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
||||||
newrecipe.addIngredient(Material.MAGMA_CREAM);
|
newrecipe.addIngredient(Material.MAGMA_CREAM);
|
||||||
Bukkit.addRecipe(newrecipe);
|
Bukkit.addRecipe(newrecipe);
|
||||||
newrecipe = new ShapelessRecipe(Artifact.convert_equip(ArtifactItemType.values()[i].getTieredItem(3),3,ArtifactItemType.values()[i]));
|
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
|
||||||
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
||||||
newrecipe.addIngredient(Material.CLAY_BALL);
|
newrecipe.addIngredient(Material.CLAY_BALL);
|
||||||
Bukkit.addRecipe(newrecipe);
|
Bukkit.addRecipe(newrecipe);
|
||||||
newrecipe = new ShapelessRecipe(Artifact.convert_equip(ArtifactItemType.values()[i].getTieredItem(10),10,ArtifactItemType.values()[i]));
|
newrecipe = new ShapelessRecipe(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)ArtifactItemType.values()[i].getDataValue()));
|
||||||
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
newrecipe.addIngredient(2, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
||||||
newrecipe.addIngredient(Material.SUGAR);
|
newrecipe.addIngredient(Material.SUGAR);
|
||||||
newrecipe.addIngredient(Material.MAGMA_CREAM);
|
newrecipe.addIngredient(Material.MAGMA_CREAM);
|
||||||
newrecipe.addIngredient(Material.CLAY_BALL);
|
newrecipe.addIngredient(Material.CLAY_BALL);
|
||||||
Bukkit.addRecipe(newrecipe);
|
Bukkit.addRecipe(newrecipe);
|
||||||
|
|
||||||
|
//Recipe -> Base Item Recipe.
|
||||||
|
newrecipe = new ShapelessRecipe(ArtifactItemType.values()[i].getTieredItem(1));
|
||||||
|
newrecipe.addIngredient(1, Material.STAINED_GLASS_PANE, ArtifactItemType.values()[i].getDataValue());
|
||||||
|
Bukkit.addRecipe(newrecipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Initialize_ArtifactHelper_Recipes() {
|
public static void Initialize_ArtifactHelper_Recipes() {
|
||||||
@ -551,4 +556,21 @@ public class Recipes {
|
|||||||
upgraderecipe.addIngredient(2,Material.CLAY_BALL);
|
upgraderecipe.addIngredient(2,Material.CLAY_BALL);
|
||||||
Bukkit.addRecipe(upgraderecipe);
|
Bukkit.addRecipe(upgraderecipe);
|
||||||
}
|
}
|
||||||
|
public static void Initialize_Check_Recipe() {
|
||||||
|
ItemStack check = new ItemStack(Material.PAPER);
|
||||||
|
check.addUnsafeEnchantment(Enchantment.LUCK, 1);
|
||||||
|
ItemMeta m = check.getItemMeta();
|
||||||
|
m.setDisplayName("Money Cheque");
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
lore.add("An unsigned check. "+ChatColor.YELLOW+"Right-click");
|
||||||
|
lore.add("the check while holding it to");
|
||||||
|
lore.add("write a value and sign the check.");
|
||||||
|
m.setLore(lore);
|
||||||
|
check.setItemMeta(m);
|
||||||
|
ShapelessRecipe checkrecipe = new ShapelessRecipe(check);
|
||||||
|
checkrecipe.addIngredient(Material.INK_SACK);
|
||||||
|
checkrecipe.addIngredient(Material.PAPER);
|
||||||
|
checkrecipe.addIngredient(Material.FEATHER);
|
||||||
|
Bukkit.addRecipe(checkrecipe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ import aPlugin.DiscordMessageSender;
|
|||||||
import net.minecraft.server.v1_9_R1.Vector3f;
|
import net.minecraft.server.v1_9_R1.Vector3f;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.BankSession;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe;
|
import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
||||||
@ -204,12 +205,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public RecyclingCenter TwosideRecyclingCenter;
|
public RecyclingCenter TwosideRecyclingCenter;
|
||||||
|
|
||||||
//Bank timers and users.
|
//Bank timers and users.
|
||||||
public String withdrawUser="";
|
public static HashMap banksessions;
|
||||||
public long withdrawTime=0;
|
|
||||||
public String depositUser="";
|
|
||||||
public long depositTime=0;
|
|
||||||
public String conversionUser="";
|
|
||||||
public long conversionTime=0;
|
|
||||||
public int sleepingPlayers=0;
|
public int sleepingPlayers=0;
|
||||||
|
|
||||||
int[] lampblocks = {1626,71,-255, //List of all lamp blocks in the city to be lit.
|
int[] lampblocks = {1626,71,-255, //List of all lamp blocks in the city to be lit.
|
||||||
@ -248,6 +244,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes();
|
sig.plugin.TwosideKeeper.Recipes.Initialize_SlabReconstruction_Recipes();
|
||||||
//sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes();
|
//sig.plugin.TwosideKeeper.Recipes.Initialize_Artifact_Recipes();
|
||||||
sig.plugin.TwosideKeeper.Recipes.Initialize_ArtifactHelper_Recipes();
|
sig.plugin.TwosideKeeper.Recipes.Initialize_ArtifactHelper_Recipes();
|
||||||
|
sig.plugin.TwosideKeeper.Recipes.Initialize_Check_Recipe();
|
||||||
|
|
||||||
Bukkit.createWorld(new WorldCreator("ItemCube"));
|
Bukkit.createWorld(new WorldCreator("ItemCube"));
|
||||||
|
|
||||||
@ -295,6 +292,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
//Initialize Player Data structure.
|
//Initialize Player Data structure.
|
||||||
playerdata = new HashMap();
|
playerdata = new HashMap();
|
||||||
|
banksessions = new HashMap();
|
||||||
|
|
||||||
//Let's not assume there are no players online. Load their data.
|
//Let's not assume there are no players online. Load their data.
|
||||||
for (int i=0;i<Bukkit.getOnlinePlayers().toArray().length;i++) {
|
for (int i=0;i<Bukkit.getOnlinePlayers().toArray().length;i++) {
|
||||||
@ -382,32 +380,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
LASTSERVERCHECK=getServerTickTime();
|
LASTSERVERCHECK=getServerTickTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check our deposit and withdraw terminals for lingering timers.
|
|
||||||
if (!withdrawUser.equalsIgnoreCase("") && getServerTickTime()-withdrawTime>TERMINALTIME) {
|
|
||||||
//This is occupied still when it's supposed to time out.
|
|
||||||
Player p = Bukkit.getPlayer(withdrawUser);
|
|
||||||
if (p!=null) {
|
|
||||||
p.sendMessage(ChatColor.RED+"RAN OUT OF TIME! "+ChatColor.WHITE+"Cancelled out of Withdraw terminal.");
|
|
||||||
}
|
|
||||||
withdrawUser="";
|
|
||||||
}
|
|
||||||
if (!depositUser.equalsIgnoreCase("") && getServerTickTime()-depositTime>TERMINALTIME) {
|
|
||||||
//This is occupied still when it's supposed to time out.
|
|
||||||
Player p = Bukkit.getPlayer(depositUser);
|
|
||||||
if (p!=null) {
|
|
||||||
p.sendMessage(ChatColor.RED+"RAN OUT OF TIME! "+ChatColor.WHITE+"Cancelled out of Deposit terminal.");
|
|
||||||
}
|
|
||||||
depositUser="";
|
|
||||||
}
|
|
||||||
if (!conversionUser.equalsIgnoreCase("") && getServerTickTime()-conversionTime>TERMINALTIME) {
|
|
||||||
//This is occupied still when it's supposed to time out.
|
|
||||||
Player p = Bukkit.getPlayer(conversionUser);
|
|
||||||
if (p!=null) {
|
|
||||||
p.sendMessage(ChatColor.RED+"RAN OUT OF TIME! "+ChatColor.WHITE+"Cancelled out of Conversion terminal.");
|
|
||||||
}
|
|
||||||
conversionUser="";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bukkit.getWorld("world").getTime()>=12000) {
|
if (Bukkit.getWorld("world").getTime()>=12000) {
|
||||||
Collection<Player> players = (Collection<Player>) getServer().getOnlinePlayers();
|
Collection<Player> players = (Collection<Player>) getServer().getOnlinePlayers();
|
||||||
//Count the number of players sleeping. Compare to "sleepingplayers" count.
|
//Count the number of players sleeping. Compare to "sleepingplayers" count.
|
||||||
@ -444,6 +416,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]);
|
Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]);
|
||||||
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
|
||||||
|
|
||||||
|
if (banksessions.containsKey(p.getUniqueId())) {
|
||||||
|
//See if it expired.
|
||||||
|
BankSession bs = (BankSession)banksessions.get(p.getUniqueId());
|
||||||
|
if (bs.isSessionExpired()) {
|
||||||
|
banksessions.remove(p.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (TwosideShops.PlayerHasPurchases(p)) {
|
if (TwosideShops.PlayerHasPurchases(p)) {
|
||||||
TwosideShops.PlayerSendPurchases(p);
|
TwosideShops.PlayerSendPurchases(p);
|
||||||
}
|
}
|
||||||
@ -601,12 +581,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
if (cmd.getName().equalsIgnoreCase("fix")) {
|
if (cmd.getName().equalsIgnoreCase("fix")) {
|
||||||
Player p = (Player)sender;
|
Player p = (Player)sender;
|
||||||
p.sendMessage(p.getEquipment().getItemInMainHand().toString());
|
//p.sendMessage(p.getEquipment().getItemInMainHand().toString());
|
||||||
//sender.sendMessage("Localized Name is "+GenericFunctions.UserFriendlyMaterialName(p.getEquipment().getItemInMainHand().getType(),p.getEquipment().getItemInMainHand().getData().getData()));
|
//sender.sendMessage("Localized Name is "+GenericFunctions.UserFriendlyMaterialName(p.getEquipment().getItemInMainHand().getType(),p.getEquipment().getItemInMainHand().getData().getData()));
|
||||||
if (Artifact.isMalleableBase(p.getEquipment().getItemInMainHand()) &&
|
if (Artifact.isMalleableBase(p.getEquipment().getItemInMainHand()) &&
|
||||||
MalleableBaseQuest.getTimeStarted(p.getEquipment().getItemInMainHand())<=147337849) {
|
MalleableBaseQuest.getTimeStarted(p.getEquipment().getItemInMainHand())<=147337849) {
|
||||||
p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime()));
|
p.getEquipment().setItemInMainHand(MalleableBaseQuest.setTimeStarted(p.getEquipment().getItemInMainHand(), getServerTickTime()));
|
||||||
}
|
}
|
||||||
|
GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("money")) {
|
if (cmd.getName().equalsIgnoreCase("money")) {
|
||||||
@ -821,7 +802,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (ev.getMessage().length()>=1) {
|
if (ev.getMessage().length()>=1) {
|
||||||
//See if we're using a bank terminal.
|
//See if we're using a bank terminal.
|
||||||
Player thisp = ev.getPlayer();
|
Player thisp = ev.getPlayer();
|
||||||
if (withdrawUser.equalsIgnoreCase(thisp.getName())) {
|
if (banksessions.containsKey(thisp.getUniqueId())) {
|
||||||
|
switch (((BankSession)banksessions.get(ev.getPlayer().getUniqueId())).GetState()) {
|
||||||
|
case WITHDRAW:{
|
||||||
//See if this message is a number.
|
//See if this message is a number.
|
||||||
if (isNumeric(ev.getMessage())) {
|
if (isNumeric(ev.getMessage())) {
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
@ -846,12 +829,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
||||||
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Withdraw terminal.");
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Withdraw terminal.");
|
||||||
}
|
}
|
||||||
withdrawUser="";
|
|
||||||
ev.setMessage("");
|
ev.setMessage("");
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
} else
|
}break;
|
||||||
if (depositUser.equalsIgnoreCase(thisp.getName())) {
|
case DEPOSIT:{
|
||||||
//See if this message is a number.
|
|
||||||
if (isNumeric(ev.getMessage())) {
|
if (isNumeric(ev.getMessage())) {
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
Double value=Double.parseDouble(ev.getMessage());
|
Double value=Double.parseDouble(ev.getMessage());
|
||||||
@ -875,13 +856,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
||||||
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Deposit terminal.");
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Deposit terminal.");
|
||||||
}
|
}
|
||||||
depositUser="";
|
|
||||||
ev.setMessage("");
|
ev.setMessage("");
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
} else
|
}break;
|
||||||
if (conversionUser.equalsIgnoreCase(thisp.getName())) {
|
case CONVERT:{if (isNumeric(ev.getMessage()) && isInteger(ev.getMessage())) {
|
||||||
//See if this message is a number.
|
|
||||||
if (isNumeric(ev.getMessage()) && isInteger(ev.getMessage())) {
|
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
Integer value=Integer.parseInt(ev.getMessage());
|
Integer value=Integer.parseInt(ev.getMessage());
|
||||||
if (value>=1) {
|
if (value>=1) {
|
||||||
@ -948,9 +926,50 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
||||||
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Conversion terminal.");
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Conversion terminal.");
|
||||||
}
|
}
|
||||||
conversionUser="";
|
|
||||||
ev.setMessage("");
|
ev.setMessage("");
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
|
}break;
|
||||||
|
case SIGN_CHECK:{
|
||||||
|
//See if this message is a number.
|
||||||
|
if (isNumeric(ev.getMessage())) {
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
Double value=Double.parseDouble(ev.getMessage());
|
||||||
|
value=Double.parseDouble(df.format(Double.valueOf(value)));
|
||||||
|
if (value>=0.01) {
|
||||||
|
//Write the check.
|
||||||
|
final ItemStack check = ev.getPlayer().getEquipment().getItemInMainHand();
|
||||||
|
if (Check.isUnsignedBankCheck(check)) {
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.GOLD+"SIGNING COMPLETE!");
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.AQUA+" You have successfully written a check for "+ChatColor.YELLOW+"$"+df.format(value)+ChatColor.WHITE+".");
|
||||||
|
final ItemStack finalcheck = Check.createSignedBankCheckItem(value, ev.getPlayer().getName());
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (check.getAmount()>1) {
|
||||||
|
check.setAmount(check.getAmount()-1);
|
||||||
|
ev.getPlayer().getLocation().getWorld().dropItem(ev.getPlayer().getLocation(), finalcheck);
|
||||||
|
} else {
|
||||||
|
ev.getPlayer().getEquipment().setItemInMainHand(finalcheck);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},1);
|
||||||
|
} else {
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.YELLOW+"You are not holding a properly signed check!");
|
||||||
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Check signing.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
thisp.sendMessage(ChatColor.RED+"You must sign a check with at least "+ChatColor.WHITE+"$0.01 or more.");
|
||||||
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Check signing.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
thisp.sendMessage(ChatColor.RED+"Invalid Number!");
|
||||||
|
thisp.sendMessage(ChatColor.WHITE+" Cancelled out of Check signing.");
|
||||||
|
}
|
||||||
|
ev.setMessage("");
|
||||||
|
ev.setCancelled(true);
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
banksessions.remove(ev.getPlayer().getUniqueId());
|
||||||
} else
|
} else
|
||||||
if (TwosideShops.IsPlayerUsingTerminal(ev.getPlayer())) {
|
if (TwosideShops.IsPlayerUsingTerminal(ev.getPlayer())) {
|
||||||
final WorldShopSession current_session = TwosideShops.GetSession(ev.getPlayer());
|
final WorldShopSession current_session = TwosideShops.GetSession(ev.getPlayer());
|
||||||
@ -1089,7 +1108,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
p.getWorld().dropItemNaturally(p.getLocation(), dropitem).setPickupDelay(0);
|
p.getWorld().dropItem(p.getLocation(), dropitem).setPickupDelay(0);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
dropAmt-=shop.GetItem().getMaxStackSize();
|
dropAmt-=shop.GetItem().getMaxStackSize();
|
||||||
@ -1099,7 +1118,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
p.getWorld().dropItemNaturally(p.getLocation(), dropitem).setPickupDelay(0);
|
p.getWorld().dropItem(p.getLocation(), dropitem).setPickupDelay(0);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
dropAmt=0;
|
dropAmt=0;
|
||||||
@ -1254,7 +1273,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ev.getPlayer().getWorld().dropItemNaturally(ev.getPlayer().getLocation(), dropitem).setPickupDelay(0);
|
ev.getPlayer().getWorld().dropItem(ev.getPlayer().getLocation(), dropitem).setPickupDelay(0);
|
||||||
c.getInventory().removeItem(dropitem);
|
c.getInventory().removeItem(dropitem);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
@ -1265,7 +1284,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ev.getPlayer().getWorld().dropItemNaturally(ev.getPlayer().getLocation(), dropitem).setPickupDelay(0);
|
ev.getPlayer().getWorld().dropItem(ev.getPlayer().getLocation(), dropitem).setPickupDelay(0);
|
||||||
c.getInventory().removeItem(dropitem);
|
c.getInventory().removeItem(dropitem);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
@ -1414,6 +1433,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString());
|
ev.getPlayer().sendMessage(ChatColor.DARK_BLUE+"New Recycling Center successfully created at "+ev.getClickedBlock().getLocation().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check stuff here.
|
||||||
|
if (ev.getAction()==Action.RIGHT_CLICK_AIR ||
|
||||||
|
ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
//See if the player is holding a valid bank check. Unsigned.
|
||||||
|
ItemStack check = ev.getPlayer().getEquipment().getItemInMainHand();
|
||||||
|
if (Check.isUnsignedBankCheck(check)) {
|
||||||
|
//This is an unwritten check.
|
||||||
|
BankSession bs = null;
|
||||||
|
if (banksessions.containsKey(ev.getPlayer().getUniqueId())) {
|
||||||
|
bs = (BankSession)banksessions.get(ev.getPlayer().getUniqueId());
|
||||||
|
bs.refreshSession();
|
||||||
|
if (bs.GetState()!=SessionState.SIGN_CHECK) { //Don't keep announcing the message if we are already in the state.
|
||||||
|
ev.getPlayer().sendMessage("Input how much you want to sign this "+ChatColor.YELLOW+"check"+ChatColor.WHITE+" for:");
|
||||||
|
}
|
||||||
|
bs.SetState(SessionState.SIGN_CHECK);
|
||||||
|
} else {
|
||||||
|
bs = new BankSession(ev.getPlayer(),SessionState.SIGN_CHECK);
|
||||||
|
banksessions.put(ev.getPlayer().getUniqueId(), bs);
|
||||||
|
ev.getPlayer().sendMessage("Input how much you want to sign this "+ChatColor.YELLOW+"check"+ChatColor.WHITE+" for:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Shield related stuff in here.
|
//Shield related stuff in here.
|
||||||
if (ev.getAction()==Action.RIGHT_CLICK_AIR ||
|
if (ev.getAction()==Action.RIGHT_CLICK_AIR ||
|
||||||
ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
||||||
@ -1762,62 +1804,77 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getPlayer().sendMessage("Your Bank Account currently has: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer())));
|
ev.getPlayer().sendMessage("Your Bank Account currently has: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer())));
|
||||||
} else
|
} else
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED+"WITHDRAW")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED+"WITHDRAW")) {
|
||||||
if (withdrawUser.equalsIgnoreCase("")) {
|
BankSession bs = null;
|
||||||
if (!depositUser.equalsIgnoreCase(ev.getPlayer().getName()) &&
|
SessionState thissession = SessionState.WITHDRAW;
|
||||||
!conversionUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
if (banksessions.containsKey(ev.getPlayer().getUniqueId())) {
|
||||||
|
bs = (BankSession)banksessions.get(ev.getPlayer().getUniqueId());
|
||||||
|
bs.refreshSession();
|
||||||
|
bs.SetState(thissession);
|
||||||
|
} else {
|
||||||
|
bs = new BankSession(ev.getPlayer(),thissession);
|
||||||
|
banksessions.put(ev.getPlayer().getUniqueId(), bs);
|
||||||
|
}
|
||||||
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to WITHDRAW today.");
|
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to WITHDRAW today.");
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
ev.getPlayer().sendMessage(" In Bank: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer())));
|
ev.getPlayer().sendMessage(" In Bank: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer())));
|
||||||
//Activate the terminal.
|
|
||||||
withdrawUser=ev.getPlayer().getName();
|
|
||||||
withdrawTime=getServerTickTime();
|
|
||||||
} else {
|
|
||||||
//Can't use if we're already using another terminal.
|
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"You're already using another terminal. "+ChatColor.WHITE+"Please finish that operation first.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!withdrawUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"TERMINAL IS BEING USED. "+ChatColor.WHITE+"Please try again later.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"DEPOSIT")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"DEPOSIT")) {
|
||||||
if (depositUser.equalsIgnoreCase("")) {
|
BankSession bs = null;
|
||||||
if (!withdrawUser.equalsIgnoreCase(ev.getPlayer().getName()) &&
|
SessionState thissession = SessionState.DEPOSIT;
|
||||||
!conversionUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
if (banksessions.containsKey(ev.getPlayer().getUniqueId())) {
|
||||||
|
bs = (BankSession)banksessions.get(ev.getPlayer().getUniqueId());
|
||||||
|
bs.refreshSession();
|
||||||
|
bs.SetState(thissession);
|
||||||
|
} else {
|
||||||
|
bs = new BankSession(ev.getPlayer(),thissession);
|
||||||
|
banksessions.put(ev.getPlayer().getUniqueId(), bs);
|
||||||
|
}
|
||||||
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to DEPOSIT today.");
|
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount you want to DEPOSIT today.");
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
ev.getPlayer().sendMessage(" Currently Holding: "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(ev.getPlayer())));
|
ev.getPlayer().sendMessage(" Currently Holding: "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(ev.getPlayer())));
|
||||||
//Activate the terminal.
|
|
||||||
depositUser=ev.getPlayer().getName();
|
|
||||||
depositTime=getServerTickTime();
|
|
||||||
} else {
|
|
||||||
//Can't use if we're already using another terminal.
|
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"You're already using another terminal. "+ChatColor.WHITE+"Please finish that operation first.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!depositUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"TERMINAL IS BEING USED. "+ChatColor.WHITE+"Please try again later.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"EXP CONVERSION")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_BLUE+"EXP CONVERSION")) {
|
||||||
if (conversionUser.equalsIgnoreCase("")) {
|
BankSession bs = null;
|
||||||
if (!withdrawUser.equalsIgnoreCase(ev.getPlayer().getName()) &&
|
SessionState thissession = SessionState.CONVERT;
|
||||||
!depositUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
if (banksessions.containsKey(ev.getPlayer().getUniqueId())) {
|
||||||
|
bs = (BankSession)banksessions.get(ev.getPlayer().getUniqueId());
|
||||||
|
bs.refreshSession();
|
||||||
|
bs.SetState(thissession);
|
||||||
|
} else {
|
||||||
|
bs = new BankSession(ev.getPlayer(),thissession);
|
||||||
|
banksessions.put(ev.getPlayer().getUniqueId(), bs);
|
||||||
|
}
|
||||||
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount of experience you want to convert today.");
|
ev.getPlayer().sendMessage(ChatColor.GOLD+"Say/Type the amount of experience you want to convert today.");
|
||||||
ev.getPlayer().sendMessage(" Currently Have: "+ChatColor.GREEN+ev.getPlayer().getLevel()+" levels");
|
ev.getPlayer().sendMessage(" Currently Have: "+ChatColor.GREEN+ev.getPlayer().getLevel()+" levels");
|
||||||
//Activate the terminal.
|
} else
|
||||||
conversionUser=ev.getPlayer().getName();
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_GREEN+"CASH CHECK")) {
|
||||||
conversionTime=getServerTickTime();
|
if (Check.isSignedBankCheck(ev.getPlayer().getEquipment().getItemInMainHand())) {
|
||||||
|
//Make sure the player that signed has enough money for this check. Otherwise don't allow it!
|
||||||
|
Check c = new Check(ev.getPlayer().getEquipment().getItemInMainHand());
|
||||||
|
if (c.player!=null) {
|
||||||
|
//We found a player for this check. See if they have enough money.
|
||||||
|
if (c.amt<=getPlayerBankMoney(c.player)) {
|
||||||
|
//We're good. Subtract money from that player's bank account. And Add money to the player with the check. Destroy the check.
|
||||||
|
givePlayerBankMoney(c.player,-c.amt);
|
||||||
|
givePlayerBankMoney(ev.getPlayer(),c.amt);
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.AQUA+"Cashed in the check for "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+".");
|
||||||
|
ev.getPlayer().sendMessage(" Now In Bank: "+ChatColor.BLUE+"$"+df.format(getPlayerBankMoney(ev.getPlayer())));
|
||||||
|
if (ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1) {
|
||||||
|
ev.getPlayer().getEquipment().getItemInMainHand().setAmount(ev.getPlayer().getEquipment().getItemInMainHand().getAmount()-1);
|
||||||
} else {
|
} else {
|
||||||
//Can't use if we're already using another terminal.
|
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"You're already using another terminal. "+ChatColor.WHITE+"Please finish that operation first.");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!conversionUser.equalsIgnoreCase(ev.getPlayer().getName())) {
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
ev.getPlayer().sendMessage(ChatColor.RED+"TERMINAL IS BEING USED. "+ChatColor.WHITE+"Please try again later.");
|
ev.getPlayer().sendMessage(ChatColor.RED+"We're sorry! "+ChatColor.WHITE+"But the check cannot be processed since the check signer, "+ChatColor.LIGHT_PURPLE+c.player+ChatColor.WHITE+" has poor money management skills and does not have "+ChatColor.YELLOW+"$"+df.format(c.amt)+ChatColor.WHITE+" available in their account!");
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.AQUA+"We are sorry about this inconvenience. "+ChatColor.WHITE+"Have a nice day!");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
GenericFunctions.produceError(1,ev.getPlayer());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ev.getPlayer().sendMessage(ChatColor.YELLOW+"You are not holding a properly signed check!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1883,7 +1940,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
String line1 = ev.getLine(0);
|
String line1 = ev.getLine(0);
|
||||||
String line2 = ev.getLine(2);
|
String line2 = ev.getLine(2);
|
||||||
//-- BANK --
|
//-- BANK --
|
||||||
if (p.isOp()) {
|
if (p.isOp() || p.hasPermission("TwosideKeeper.bank")) {
|
||||||
//Make sure we're Op, otherwise we're not allowed to do this.
|
//Make sure we're Op, otherwise we're not allowed to do this.
|
||||||
if (line1.equalsIgnoreCase("-- bank --") &&
|
if (line1.equalsIgnoreCase("-- bank --") &&
|
||||||
line2.equalsIgnoreCase("Check Balance")) {
|
line2.equalsIgnoreCase("Check Balance")) {
|
||||||
@ -1920,6 +1977,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.setLine(2, "Right-Click");
|
ev.setLine(2, "Right-Click");
|
||||||
ev.setLine(3, "to use");
|
ev.setLine(3, "to use");
|
||||||
p.sendMessage("Successfully created an EXP Conversion Bank Sign.");
|
p.sendMessage("Successfully created an EXP Conversion Bank Sign.");
|
||||||
|
} else
|
||||||
|
if (line1.equalsIgnoreCase("-- bank --") &&
|
||||||
|
line2.equalsIgnoreCase("Cash Check")) {
|
||||||
|
//Turn it into a bank sign.
|
||||||
|
ev.setLine(0, ChatColor.AQUA+"-- BANK --");
|
||||||
|
ev.setLine(1, ChatColor.DARK_GREEN+"CASH CHECK");
|
||||||
|
ev.setLine(2, "Right-Click");
|
||||||
|
ev.setLine(3, "to use");
|
||||||
|
p.sendMessage("Successfully created a Cash Check Bank Sign.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2580,7 +2646,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
i.getItemStack().getItemMeta().hasLore() &&
|
i.getItemStack().getItemMeta().hasLore() &&
|
||||||
i.getItemStack().getItemMeta().getLore().contains("WorldShop Display Item")) {
|
i.getItemStack().getItemMeta().getLore().contains("WorldShop Display Item")) {
|
||||||
if (WorldShop.hasShopSignAttached(i.getLocation().add(0,-0.5,-0.5).getBlock())) {
|
if (WorldShop.hasShopSignAttached(i.getLocation().add(0,-0.5,-0.5).getBlock())) {
|
||||||
Item e = (Item)(i.getWorld().dropItemNaturally(i.getLocation(), i.getItemStack()));
|
Item e = (Item)(i.getWorld().dropItem(i.getLocation(), i.getItemStack()));
|
||||||
e.setCustomName(i.getCustomName());
|
e.setCustomName(i.getCustomName());
|
||||||
e.setGlowing(i.isGlowing());
|
e.setGlowing(i.isGlowing());
|
||||||
e.setItemStack(i.getItemStack());
|
e.setItemStack(i.getItemStack());
|
||||||
@ -2980,6 +3046,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (mm.getCustomName().contains("Hellfire")) {
|
if (mm.getCustomName().contains("Hellfire")) {
|
||||||
dmgmult=4;
|
dmgmult=4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm.setTarget(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
ev.setDamage(CalculateDamageReduction(ev.getDamage()*dmgmult*ENEMY_DMG_MULT,p,m));
|
ev.setDamage(CalculateDamageReduction(ev.getDamage()*dmgmult*ENEMY_DMG_MULT,p,m));
|
||||||
@ -3023,6 +3091,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//of a new custom damage calculation.
|
//of a new custom damage calculation.
|
||||||
DealDamageToMob(p.getInventory().getItemInMainHand(),p,m);
|
DealDamageToMob(p.getInventory().getItemInMainHand(),p,m);
|
||||||
if (m instanceof Monster) {
|
if (m instanceof Monster) {
|
||||||
|
if (m.getType()==EntityType.ZOMBIE &&
|
||||||
|
MonsterController.isZombieLeader(m) &&
|
||||||
|
!m.hasPotionEffect(PotionEffectType.GLOWING) /*Make sure it's not being aggro'd already.*/) {
|
||||||
|
//Zombie leaders will make everything nearby aggro the same player. So it is really important to keep the zombie leader aggro'd.
|
||||||
|
Collection<Entity> nearby = m.getLocation().getWorld().getNearbyEntities(m.getLocation(), 10, 10, 10);
|
||||||
|
for (int i=0;i<nearby.size();i++) {
|
||||||
|
if (Iterables.get(nearby, i) instanceof Monster) {
|
||||||
|
Monster mm = (Monster)(Iterables.get(nearby, i));
|
||||||
|
mm.setTarget(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!m.hasPotionEffect(PotionEffectType.GLOWING) || GenericFunctions.isDefender(p)) {
|
if (!m.hasPotionEffect(PotionEffectType.GLOWING) || GenericFunctions.isDefender(p)) {
|
||||||
if (GenericFunctions.isDefender(p)) {
|
if (GenericFunctions.isDefender(p)) {
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,0));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,0));
|
||||||
@ -3068,6 +3148,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (mm.getCustomName().contains("Hellfire")) {
|
if (mm.getCustomName().contains("Hellfire")) {
|
||||||
dmgmult=4;
|
dmgmult=4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm.setTarget(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Original damage: "+ev.getDamage(),5);
|
log("Original damage: "+ev.getDamage(),5);
|
||||||
@ -3891,30 +3973,65 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//We are looking for an artifact piece.
|
//We are looking for an artifact piece.
|
||||||
int items_found=0;
|
int items_found=0;
|
||||||
int slot_found=0;
|
int slot_found=0;
|
||||||
|
int tier_found=0;
|
||||||
|
int tier_recipe=0;
|
||||||
|
boolean pumpkin_seeds=false;
|
||||||
for (int i=1;i<ev.getInventory().getSize();i++) {
|
for (int i=1;i<ev.getInventory().getSize();i++) {
|
||||||
if (ev.getInventory().getItem(i)!=null &&
|
if (ev.getInventory().getItem(i)!=null &&
|
||||||
ev.getInventory().getItem(i).getType()!=Material.AIR &&
|
ev.getInventory().getItem(i).getType()!=Material.AIR &&
|
||||||
Artifact.isArtifact(ev.getInventory().getItem(i))) {
|
Artifact.isArtifact(ev.getInventory().getItem(i))) {
|
||||||
items_found++;
|
items_found++;
|
||||||
|
if (ev.getInventory().getItem(i).getType()==Material.PUMPKIN_SEEDS) {
|
||||||
|
//We are not supposed to be in here!
|
||||||
|
pumpkin_seeds=true;
|
||||||
|
}
|
||||||
|
if (ev.getInventory().getItem(i).getType()!=Material.STAINED_GLASS_PANE) {
|
||||||
|
switch (ev.getInventory().getItem(i).getType()) {
|
||||||
|
case SUGAR:{
|
||||||
|
tier_recipe+=1+(ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK)-1)*3;
|
||||||
|
}break;
|
||||||
|
case MAGMA_CREAM:{
|
||||||
|
tier_recipe+=2+(ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK)-1)*3;
|
||||||
|
}break;
|
||||||
|
case CLAY_BALL:{
|
||||||
|
tier_recipe+=3+(ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK)-1)*3;
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (tier_found==0 && ev.getInventory().getItem(i).getType()==Material.STAINED_GLASS_PANE) {
|
||||||
|
tier_found=ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK);
|
||||||
slot_found=i;
|
slot_found=i;
|
||||||
|
} else
|
||||||
|
if (ev.getInventory().getItem(i).getEnchantmentLevel(Enchantment.LUCK)!=tier_found && ev.getInventory().getItem(i).getType()==Material.STAINED_GLASS_PANE) {
|
||||||
|
//Cancel this recipe, no good.
|
||||||
|
ev.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (items_found==1) {
|
}
|
||||||
|
if (items_found==1 && slot_found!=0) {
|
||||||
|
//This is a recipe->Base item conversion.
|
||||||
|
ev.getInventory().setResult(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getTieredItem(tier_found));
|
||||||
|
|
||||||
|
//Add more information for this.
|
||||||
|
}
|
||||||
|
if (items_found==3 && !pumpkin_seeds) {
|
||||||
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
|
int tier = ev.getInventory().getItem(slot_found).getEnchantmentLevel(Enchantment.LUCK);
|
||||||
//log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),2);
|
//log("This is tier "+tier+". Enchantment level of "+ev.getInventory().getItem(slot_found).toString(),2);
|
||||||
//Decompose this into a higher tier of the next item.
|
//Decompose this into a higher tier of the next item.
|
||||||
if (tier<10) {
|
if (tier==tier_recipe && tier<10) {
|
||||||
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,(short)ArtifactItemType.valueOf(Artifact.returnRawTool(ev.getInventory().getItem(slot_found).getType())).getDataValue()));
|
ItemStack newitem1 = Artifact.convert(new ItemStack(Material.STAINED_GLASS_PANE,1,ev.getInventory().getItem(slot_found).getDurability()));
|
||||||
ItemMeta m = newitem1.getItemMeta();
|
ItemMeta m = newitem1.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Crafting Recipe");
|
lore.add(0,ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Crafting Recipe");
|
||||||
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
|
//lore.add(1,ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
|
||||||
|
|
||||||
m.setLore(lore);
|
m.setLore(lore);
|
||||||
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(Artifact.returnRawTool(ev.getInventory().getItem(slot_found).getType()))+" Recipe");
|
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+(tier+1)+" Artifact "+GenericFunctions.CapitalizeFirstLetters(ArtifactItemType.getTypeFromData(ev.getInventory().getItem(slot_found).getDurability()).getItemName())+" Recipe");
|
||||||
newitem1.setItemMeta(m);
|
newitem1.setItemMeta(m);
|
||||||
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier+1);
|
newitem1.addUnsafeEnchantment(Enchantment.LUCK, tier+1);
|
||||||
ev.getInventory().setResult(newitem1);
|
ev.getInventory().setResult(newitem1);
|
||||||
|
} else {
|
||||||
|
ev.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||||
@ -80,9 +81,18 @@ public final class TwosideKeeperAPI {
|
|||||||
public static boolean isHardenedItem(ItemStack i) {
|
public static boolean isHardenedItem(ItemStack i) {
|
||||||
return GenericFunctions.isHardenedItem(i);
|
return GenericFunctions.isHardenedItem(i);
|
||||||
}
|
}
|
||||||
|
public static boolean isObscureHardenedItem(ItemStack i) {
|
||||||
|
return GenericFunctions.isObscureHardenedItem(i);
|
||||||
|
}
|
||||||
public static int getHardenedItemBreaks(ItemStack i) {
|
public static int getHardenedItemBreaks(ItemStack i) {
|
||||||
return GenericFunctions.getHardenedItemBreaks(i);
|
return GenericFunctions.getHardenedItemBreaks(i);
|
||||||
}
|
}
|
||||||
|
public static ItemStack addHardenedItemBreaks(ItemStack i, int breaks) {
|
||||||
|
return GenericFunctions.addHardenedItemBreaks(i, breaks);
|
||||||
|
}
|
||||||
|
public static ItemStack addObscureHardenedItemBreaks(ItemStack i, int breaks) {
|
||||||
|
return GenericFunctions.addObscureHardenedItemBreaks(i, breaks);
|
||||||
|
}
|
||||||
public static ItemStack breakHardenedItem(ItemStack i) {
|
public static ItemStack breakHardenedItem(ItemStack i) {
|
||||||
return GenericFunctions.breakHardenedItem(i,null);
|
return GenericFunctions.breakHardenedItem(i,null);
|
||||||
}
|
}
|
||||||
@ -90,6 +100,11 @@ public final class TwosideKeeperAPI {
|
|||||||
return GenericFunctions.breakHardenedItem(i,p);
|
return GenericFunctions.breakHardenedItem(i,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Loot Commands.
|
||||||
|
public static ItemStack generateMegaPiece(Material item, boolean hardened) {
|
||||||
|
return Loot.GenerateMegaPiece(item, hardened);
|
||||||
|
}
|
||||||
|
|
||||||
//Server COMMANDS.
|
//Server COMMANDS.
|
||||||
public static ServerType getServerType() {
|
public static ServerType getServerType() {
|
||||||
return TwosideKeeper.getServerType();
|
return TwosideKeeper.getServerType();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user