>Increased Earth Wave artifact ability's level cap from 100 to 10000.

>Fixed a bug causing dodge chance to be incorrectly calculated.
This commit is contained in:
sigonasr2 2017-03-02 18:40:27 -06:00
parent 73e685092f
commit 310f5c687f
17 changed files with 235 additions and 55 deletions

View File

@ -5,6 +5,6 @@
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/> <classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/>
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/GlowAPI_v1.4.4.jar"/> <classpathentry kind="lib" path="D:/Documents/Test Server/plugins/GlowAPI_v1.4.4.jar"/>
<classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/> <classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/aPlugin (97).jar"/> <classpathentry kind="lib" path="D:/Documents/Test Server/plugins/aPlugin (99).jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.10.9b version: 3.10.9c
loadbefore: [aPlugin] loadbefore: [aPlugin]
commands: commands:
money: money:

View File

@ -1582,6 +1582,10 @@ public class CustomDamage {
if (target.isDead()) { if (target.isDead()) {
return true; //Cancel all damage events if they are dead. return true; //Cancel all damage events if they are dead.
} }
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null && shooter.isDead()) {
return true;
}
target.setLastDamage(0); target.setLastDamage(0);
target.setNoDamageTicks(0); target.setNoDamageTicks(0);
target.setMaximumNoDamageTicks(0); target.setMaximumNoDamageTicks(0);
@ -1837,7 +1841,7 @@ public class CustomDamage {
} }
} }
dodgechance=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 3, 3)/100d; dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 3, 3)/100d);
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7)) {
dodgechance=addMultiplicativeValue(dodgechance,(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7, 4)))); //For every 1m, give 5%. dodgechance=addMultiplicativeValue(dodgechance,(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getBaubles(p), p, ItemSet.GLADOMAIN, 7, 4)))); //For every 1m, give 5%.
} }
@ -1861,15 +1865,12 @@ public class CustomDamage {
if (pd.fulldodge || pd.slayermegahit) { if (pd.fulldodge || pd.slayermegahit) {
dodgechance = 1.0; dodgechance = 1.0;
} }
return dodgechance; return dodgechance;
} }
private static double addMultiplicativeValue(double numb, double val) { private static double addMultiplicativeValue(double numb, double val) {
if (numb==0) { numb += (1-numb)*val;
numb += val;
} else {
numb += (1-numb)*val;
}
return numb; return numb;
} }
@ -3149,20 +3150,20 @@ public class CustomDamage {
return cooldown; return cooldown;
} }
//REturns 0-100. //Returns 0-100.
public static double CalculateDebuffResistance(Player p) { public static double CalculateDebuffResistance(Player p) {
TwosideKeeper.log("Debuffcount went up...",5); TwosideKeeper.log("Debuffcount went up...",5);
double removechance = 0.0; double removechance = 0.0;
ItemStack[] equips = p.getEquipment().getArmorContents(); ItemStack[] equips = p.getEquipment().getArmorContents();
for (ItemStack equip : equips) { for (ItemStack equip : equips) {
if (GenericFunctions.isArtifactEquip(equip)) { if (GenericFunctions.isArtifactEquip(equip)) {
double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip); double resistamt = GenericFunctions.getAbilityValue(ArtifactAbility.STATUS_EFFECT_RESISTANCE, equip)/100d;
TwosideKeeper.log("Resist amount is "+resistamt,5); TwosideKeeper.log("Resist amount is "+resistamt,5);
removechance=addMultiplicativeValue(removechance,resistamt); removechance=addMultiplicativeValue(removechance,resistamt);
} }
} }
removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 2, 2)); removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 2, 2)/100d);
return removechance; return removechance*100d;
} }

View File

@ -92,13 +92,25 @@ public enum ArtifactAbility {
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [ERUPTIONVAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0}, ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [ERUPTIONVAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0},
new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3},10000,40,UpgradePath.SHOVEL,1), new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3},10000,40,UpgradePath.SHOVEL,1),
EARTHWAVE("Earth Wave","While in mid-air, right-click to instantly slam into the ground and launch soft blocks. This attack ignores fall damage. The larger the fall, the larger the wave.\n\nDeals [EARTHWAVEVAL] damage to every enemy hit by the wave. Deals double damage and knocks up on soft blocks.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0}, EARTHWAVE("Earth Wave","While in mid-air, right-click to instantly slam into the ground and launch soft blocks. This attack ignores fall damage. The larger the fall, the larger the wave.\n\nDeals [EARTHWAVEVAL] damage to every enemy hit by the wave. Deals double damage and knocks up on soft blocks.",new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},
new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2,1.1,1.0,0.9,0.8,0.7},100,100,UpgradePath.SHOVEL,1), new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2,1.1,1.0,0.9,0.8,0.7},10000,100,UpgradePath.SHOVEL,1),
//Axe abilities //Axe abilities
BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3}, /*BREAKDOWN("Break Down",ChatColor.GRAY+"[Unimplemented] Breaks down armor on mobs. Each hit has a [VAL]% chance to remove a piece of armor from a mob.",new double[]{3,3,3,3,3,3,3,3,3,3},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.AXE,1), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.AXE,1),
BUTCHERY("Butchery",ChatColor.GRAY+"[Unimplemented] Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10}, BUTCHERY("Butchery",ChatColor.GRAY+"[Unimplemented] Broken down armor have a [VAL]% chance to drop onto the ground.",new double[]{10,10,10,10,10,10,10,10,10,10},
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE,1), new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},100,1000,UpgradePath.AXE,1),*/
DAMAGEPOOL("Damage Pool Recovery","Removes [VAL] points from Barbarian's Damage Pool with each attack.",
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new double[]{},10000,1,UpgradePath.AXE,1),
LIFESTACK("Life Stack","Increases Barbarian's lifesteal stacks by [VAL] per hit.",
new double[]{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
new double[]{},10000,1,UpgradePath.AXE,1),
LIFESUCK("Life Sucker","Directly heals [VAL]% of damage dealt as health, with a maximum of [LIFESUCKVAL] health healed per hit."+LevelCost(3),
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},
new double[]{},100,40,UpgradePath.AXE,3),
HIGHDIVE("High Dive","Sneak while pressing the drop key to become rooted for 3 seconds, storing [VAL]% damage taken and gaining 100% knockback resistance. Then leap up high into the air and slam the ground. High Dive increases the base damage of Barbarian's Leaping Strike by the amount of damage stored."+LevelCost(3),
new double[]{0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8},
new double[]{},100,100,UpgradePath.AXE,3),
//Scythe abilities //Scythe abilities
AOE("Area of Effect","Deals damage to targets up to [AOEVAL]m from the main target hit.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1}, AOE("Area of Effect","Deals damage to targets up to [AOEVAL]m from the main target hit.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
@ -576,8 +588,14 @@ public enum ArtifactAbility {
text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} text=DisplayAbility(COMBO,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
} else } else
if (path==UpgradePath.AXE) { if (path==UpgradePath.AXE) {
text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(BREAKDOWN,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");} //text=DisplayAbility(BUTCHERY,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
if (TwosideKeeper.NEWARTIFACTABILITIES_ACTIVATED) {
text=DisplayAbility(DAMAGEPOOL,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESTACK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(LIFESUCK,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
text=DisplayAbility(HIGHDIVE,playerdmgval,targetitem,slot);msg1.addExtra(text);if(!text.getText().equalsIgnoreCase("")){++i;}if(i%4==0){msg1.addExtra("\n");}
}
} else } else
if (path==UpgradePath.FISHING_ROD) { if (path==UpgradePath.FISHING_ROD) {
} else } else

View File

@ -0,0 +1,21 @@
/*package sig.plugin.TwosideKeeper.HelperStructures.BotCommands;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class stats implements aPlugin.API.DiscordCommandExecutor{
@Override
public void run(String[] args) {
//args[0] is the command!
//TwosideKeeper.log("Length is "+args.length, 0);
if (args.length==2) {
Player p = Bukkit.getPlayer(args[1]);
if (p!=null && p.isOnline()) {
//TwosideKeeper.showP
}
}
}
}
*/

View File

@ -83,6 +83,7 @@ import sig.plugin.TwosideKeeper.Events.PlayerTumbleEvent;
import sig.plugin.TwosideKeeper.HelperStructures.ArrowBarrage; import sig.plugin.TwosideKeeper.HelperStructures.ArrowBarrage;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility; import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode; import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem; import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder; import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
@ -509,11 +510,15 @@ public class GenericFunctions {
} }
public static String UserFriendlyMaterialName(ItemStack type) { public static String UserFriendlyMaterialName(ItemStack type) {
return UserFriendlyMaterialName(type,false);
}
public static String UserFriendlyMaterialName(ItemStack type, boolean displayTier) {
if (type!=null && if (type!=null &&
type.getType()!=Material.AIR) { type.getType()!=Material.AIR) {
if (type.hasItemMeta() && if (type.hasItemMeta() &&
type.getItemMeta().hasDisplayName()) { type.getItemMeta().hasDisplayName()) {
return type.getItemMeta().getDisplayName(); return type.getItemMeta().getDisplayName()+((ItemSet.isSetItem(type) && displayTier)?" (T"+ItemSet.GetTier(type)+")":"");
} }
switch (type.getType()) { switch (type.getType()) {
case ACACIA_DOOR_ITEM:{ case ACACIA_DOOR_ITEM:{
@ -2132,7 +2137,9 @@ public class GenericFunctions {
item.getType().toString().contains("FISHING_ROD") || item.getType().toString().contains("FISHING_ROD") ||
item.getType().toString().contains("SHIELD") || item.getType().toString().contains("SHIELD") ||
item.getType().toString().contains("CARROT_STICK") || item.getType().toString().contains("CARROT_STICK") ||
item.getType().toString().contains("ELYTRA"))) { item.getType().toString().contains("ELYTRA") ||
BaublePouch.isBaublePouch(item) ||
ArrowQuiver.isValidQuiver(item))) {
return true; return true;
} else { } else {
return false; return false;
@ -3353,13 +3360,13 @@ public class GenericFunctions {
} }
} }
//TODO Item Cube Contents list. public static void UpdateItemCubeContentsList(ItemStack item) {
private static void UpdateItemCubeContentsList(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) && if (ItemUtils.isValidLoreItem(item) &&
item.getItemMeta().getLore().size()>=4 && item.getItemMeta().getLore().size()>=4 &&
ItemUtils.LoreContainsSubstring(item, ChatColor.DARK_PURPLE+"ID#")) { ItemUtils.LoreContainsSubstring(item, ChatColor.DARK_PURPLE+"ID#")) {
//This is an item cube. Update its lore. //This is an item cube. Update its lore.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]); int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
ItemCubeUtils.updateVacuumCubeSuctionLoreLine(item);
if (TwosideKeeper.itemcube_updates.containsKey(id)) { if (TwosideKeeper.itemcube_updates.containsKey(id)) {
ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.WHITE+"Contents ("); ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.WHITE+"Contents (");
ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.AQUA+" "); ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.AQUA+" ");
@ -3725,6 +3732,7 @@ public class GenericFunctions {
int breaks = GenericFunctions.getHardenedItemBreaks(bauble); int breaks = GenericFunctions.getHardenedItemBreaks(bauble);
if (breaks>0) { if (breaks>0) {
inv.setItem(i, GenericFunctions.addHardenedItemBreaks(bauble, -1)); inv.setItem(i, GenericFunctions.addHardenedItemBreaks(bauble, -1));
p.sendMessage(ChatColor.YELLOW+"Your "+ChatColor.YELLOW+((bauble.hasItemMeta() && bauble.getItemMeta().hasDisplayName())?bauble.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(bauble))+ChatColor.YELLOW+" reduced to "+ChatColor.GREEN+(breaks-1)+" "+ChatColor.YELLOW+" breaks remaining.");
} else { } else {
p.sendMessage(ChatColor.GOLD+""+ChatColor.BOLD+"Unlucky! "+ChatColor.RESET+ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+((bauble.hasItemMeta() && bauble.getItemMeta().hasDisplayName())?bauble.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(bauble))+ChatColor.DARK_RED+" has broken!"); p.sendMessage(ChatColor.GOLD+""+ChatColor.BOLD+"Unlucky! "+ChatColor.RESET+ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+((bauble.hasItemMeta() && bauble.getItemMeta().hasDisplayName())?bauble.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(bauble))+ChatColor.DARK_RED+" has broken!");
inv.setItem(i, new ItemStack(Material.AIR)); inv.setItem(i, new ItemStack(Material.AIR));
@ -4486,7 +4494,7 @@ public class GenericFunctions {
pd.last_strikerspell=TwosideKeeper.getServerTickTime(); pd.last_strikerspell=TwosideKeeper.getServerTickTime();
} }
SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f); SoundUtils.playLocalSound(p, Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(p.getInventory(), weaponused, (weaponused.getType().getMaxDurability()/10)+7); aPlugin.API.damageItem(p, weaponused, (weaponused.getType().getMaxDurability()/10)+7);
final Player p1 = p; final Player p1 = p;
int mult=2; int mult=2;
@ -4674,7 +4682,7 @@ public class GenericFunctions {
for (int i=0;i<9;i++) { for (int i=0;i<9;i++) {
if (inv[i]!=null && if (inv[i]!=null &&
isTool(inv[i]) && inv[i].getType()!=Material.BOW) { isTool(inv[i]) && inv[i].getType()!=Material.BOW) {
aPlugin.API.damageItem(p.getInventory(), inv[i], 1); aPlugin.API.damageItem(p, inv[i], 1);
} }
} }
} }

View File

@ -146,7 +146,7 @@ public class CustomItem {
List<String> item_VacuumCube_lore = new ArrayList<String>(); List<String> item_VacuumCube_lore = new ArrayList<String>();
item_VacuumCube_lore.add("A storage container that sucks"); item_VacuumCube_lore.add("A storage container that sucks");
item_VacuumCube_lore.add("up blocks. Holds 54 block stacks."); item_VacuumCube_lore.add("up blocks. Holds 54 block stacks.");
item_VacuumCube_lore.add(" "); item_VacuumCube_lore.add(ChatColor.GRAY+"Block Collection: "+ChatColor.GREEN+"ON");
ItemMeta item_ItemCube_meta=item_VacuumCube.getItemMeta(); ItemMeta item_ItemCube_meta=item_VacuumCube.getItemMeta();
item_ItemCube_meta.setLore(item_VacuumCube_lore); item_ItemCube_meta.setLore(item_VacuumCube_lore);
item_ItemCube_meta.setDisplayName(ChatColor.BLUE+""+ChatColor.BOLD+"Vacuum Cube"); item_ItemCube_meta.setDisplayName(ChatColor.BLUE+""+ChatColor.BOLD+"Vacuum Cube");

View File

@ -247,8 +247,8 @@ public enum PlayerMode {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) { if (needsUpdating(pd)) {
if ((((p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow/quiver in main hand. if ((((p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow/quiver in main hand.
(p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && p.getInventory().getExtraContents()[0]!=null && !GenericFunctions.isEquip(p.getInventory().getExtraContents()[0])) || /*Satisfy a bow/quiver in main hand and no shield in off-hand.*/ (p.getEquipment().getItemInMainHand()!=null && (p.getEquipment().getItemInMainHand().getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getEquipment().getItemInMainHand())) && p.getInventory().getExtraContents()[0]!=null && !(GenericFunctions.isWeapon(p.getInventory().getExtraContents()[0])) && !(GenericFunctions.isArmor(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in main hand and no shield in off-hand.*/
(p.getEquipment().getItemInMainHand()!=null && !GenericFunctions.isEquip(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in off-hand and no shield in main hand.*/ (p.getEquipment().getItemInMainHand()!=null && !GenericFunctions.isWeapon(p.getEquipment().getItemInMainHand()) && !GenericFunctions.isArmor(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0]))) || /*Satisfy a bow/quiver in off-hand and no shield in main hand.*/
((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0])))) /*Satisfy just a bow/quiver in off-hand.*/ && ((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && (p.getInventory().getExtraContents()[0].getType()==Material.BOW || ArrowQuiver.isValidQuiver(p.getInventory().getExtraContents()[0])))) /*Satisfy just a bow/quiver in off-hand.*/ &&
GenericFunctions.AllLeatherArmor(p))) { GenericFunctions.AllLeatherArmor(p))) {
return true; return true;

View File

@ -0,0 +1,28 @@
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
import org.bukkit.Sound;
public class SoundData {
Sound sound;
float pitch;
float vol;
public SoundData(Sound sound) {
this.sound=sound;
this.pitch=1.0f;
this.vol=1.0f;
}
public SoundData(Sound sound, float pitch, float vol) {
this.sound=sound;
this.pitch=pitch;
this.vol=vol;
}
public Sound getSound() {
return sound;
}
public float getPitch() {
return pitch;
}
public float getVolume() {
return vol;
}
}

View File

@ -22,7 +22,7 @@ import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public class InventoryUtils { public class InventoryUtils {
public static boolean isCarryingVacuumCube(Player p) { public static boolean isCarryingVacuumCube(Player p) {
for (ItemStack items : p.getInventory().getContents()) { for (ItemStack items : p.getInventory().getContents()) {
if (items!=null && CustomItem.isVacuumCube(items)) { if (items!=null && CustomItem.isVacuumCube(items) && ItemCubeUtils.isSuctionOn(ItemCubeUtils.getItemCubeID(items))) {
return true; return true;
} }
} }
@ -31,7 +31,7 @@ public class InventoryUtils {
public static ItemStack[] insertItemsInVacuumCube(Player p,ItemStack...items) { public static ItemStack[] insertItemsInVacuumCube(Player p,ItemStack...items) {
ItemStack[] remaining = items; ItemStack[] remaining = items;
for (ItemStack itemStacks : p.getInventory().getContents()) { for (ItemStack itemStacks : p.getInventory().getContents()) {
if (itemStacks!=null && CustomItem.isVacuumCube(itemStacks)) { if (itemStacks!=null && CustomItem.isVacuumCube(itemStacks) && ItemCubeUtils.isSuctionOn(ItemCubeUtils.getItemCubeID(itemStacks))) {
//Insert as many items as possible in here. //Insert as many items as possible in here.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]); int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
List<ItemStack> itemCubeContents = TwosideKeeper.itemCube_loadConfig(id); List<ItemStack> itemCubeContents = TwosideKeeper.itemCube_loadConfig(id);

View File

@ -26,6 +26,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ItemContainer; import sig.plugin.TwosideKeeper.HelperStructures.Common.ItemContainer;
public class ItemCubeUtils { public class ItemCubeUtils {
public final static String SUCTION_STRING = ChatColor.GRAY+"Block Collection: ";
public static int getItemCubeID(ItemStack item) { public static int getItemCubeID(ItemStack item) {
return Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]); return Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
} }
@ -168,6 +169,7 @@ public class ItemCubeUtils {
return ItemCube_items; return ItemCube_items;
} }
@Deprecated
public static List<ItemStack> loadFilterConfig(int id){ public static List<ItemStack> loadFilterConfig(int id){
List<ItemStack> ItemCube_items = new ArrayList<ItemStack>(); List<ItemStack> ItemCube_items = new ArrayList<ItemStack>();
File config; File config;
@ -285,4 +287,55 @@ public class ItemCubeUtils {
ItemCube.clearFromViewersofItemCube(id,null); ItemCube.clearFromViewersofItemCube(id,null);
saveConfig(id,InventoryUtils.ConvertInventoryToList(inv,slots),size); saveConfig(id,InventoryUtils.ConvertInventoryToList(inv,slots),size);
} }
public static boolean isSuctionOn(int id) {
File config;
config = new File(TwosideKeeper.filesave,"itemcubes/ItemCube"+id+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
CubeType type = CubeType.getCubeTypeFromID(workable.getInt("cubetype"));
if (type==CubeType.VACUUM) {
if (workable.contains("suction")) {
return workable.getBoolean("suction");
} else {
workable.set("suction", true);
try {
workable.save(config);
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
} else {
return false;
}
}
public static void toggleSuction(int id) {
File config;
config = new File(TwosideKeeper.filesave,"itemcubes/ItemCube"+id+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
CubeType type = CubeType.getCubeTypeFromID(workable.getInt("cubetype"));
if (type==CubeType.VACUUM) {
if (isSuctionOn(id)) {
workable.set("suction",false);
} else {
workable.set("suction",true);
}
try {
workable.save(config);
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void updateVacuumCubeSuctionLoreLine(ItemStack item) {
if (getCubeType(ItemCubeUtils.getItemCubeID(item))==CubeType.VACUUM) {
ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.WHITE+"Contents (");
if (ItemUtils.LoreContainsSubstring(item, SUCTION_STRING)) {
ItemUtils.ModifyLoreLineContainingSubstring(item, SUCTION_STRING, SUCTION_STRING+(ItemCubeUtils.isSuctionOn(ItemCubeUtils.getItemCubeID(item))?ChatColor.GREEN+"ON":ChatColor.RED+"OFF"));
} else {
ItemUtils.addLore(item, SUCTION_STRING+(ItemCubeUtils.isSuctionOn(ItemCubeUtils.getItemCubeID(item))?ChatColor.GREEN+"ON":ChatColor.RED+"OFF"));
}
}
}
} }

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.SoundData;
public class SoundUtils { public class SoundUtils {
@ -57,4 +58,16 @@ public class SoundUtils {
TwosideKeeper.log("Next float:"+newnumb+" | Pitch: "+newpitch, 5); TwosideKeeper.log("Next float:"+newnumb+" | Pitch: "+newpitch, 5);
return (float)newpitch; return (float)newpitch;
} }
/**
* Plays sounds back to back with the tickdelay specified between each sound until all sounds have been played.
*/
public static void playLocalSoundsWithDelay(int tickdelay,Player p,SoundData...sounds) {
for (int i=0;i<sounds.length;i++) {
final int val = i;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
SoundUtils.playLocalSound(p, sounds[val].getSound(), sounds[val].getVolume(), sounds[val].getPitch());
}, i*tickdelay);
}
}
} }

View File

@ -49,6 +49,7 @@ public class PlayerStructure {
public boolean opened_inventory; public boolean opened_inventory;
public boolean isViewingItemCube=false; public boolean isViewingItemCube=false;
public boolean shootingArrowBarrage=false;
public int saturation; //We will now track saturation manually to remove health healing from saturation. public int saturation; //We will now track saturation manually to remove health healing from saturation.
public long last_regen_time; //Last time a health regen took place. public long last_regen_time; //Last time a health regen took place.

View File

@ -174,6 +174,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionEffectTypeWrapper;
import org.bukkit.potion.PotionType; import org.bukkit.potion.PotionType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI; import org.inventivetalent.glow.GlowAPI;
@ -246,6 +247,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.SoundData;
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas; import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
import sig.plugin.TwosideKeeper.HolidayEvents.TreeBuilder; import sig.plugin.TwosideKeeper.HolidayEvents.TreeBuilder;
import sig.plugin.TwosideKeeper.Logging.BowModeLogger; import sig.plugin.TwosideKeeper.Logging.BowModeLogger;
@ -473,6 +475,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static List<JobRecipe> jobrecipes = new ArrayList<JobRecipe>(); public static List<JobRecipe> jobrecipes = new ArrayList<JobRecipe>();
public static List<Camera> cameras = new ArrayList<Camera>(); public static List<Camera> cameras = new ArrayList<Camera>();
public static List<Arena> arenas = new ArrayList<Arena>(); public static List<Arena> arenas = new ArrayList<Arena>();
//public static stats StatCommand = new stats();
public static PotionEffectType TESTEFFECT;
long LastClearStructureTime = 0; long LastClearStructureTime = 0;
public static final Set<Material> isNatural = ImmutableSet.of(Material.CLAY, Material.DIRT, Material.GRASS, public static final Set<Material> isNatural = ImmutableSet.of(Material.CLAY, Material.DIRT, Material.GRASS,
@ -517,6 +523,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false; public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false;
public final static boolean ELITEGUARDIANS_ACTIVATED=false; public final static boolean ELITEGUARDIANS_ACTIVATED=false;
public final static boolean NEWARTIFACTABILITIES_ACTIVATED=false;
public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of( public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of(
EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN, EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN,
@ -919,7 +926,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Recipes.Initialize_NewRedstoneLamp_Recipe(); Recipes.Initialize_NewRedstoneLamp_Recipe();
Recipes.Initialize_BaublePouch_Recipe(); Recipes.Initialize_BaublePouch_Recipe();
Bukkit.getScheduler().runTaskLater(this,()->{JobRecipe.InitializeJobRecipes();},1); Bukkit.getScheduler().runTaskLater(this,()->{
JobRecipe.InitializeJobRecipes();
//TwosideKeeper.InitializeBotCommands();
},1);
Bukkit.createWorld(new WorldCreator("FilterCube")); Bukkit.createWorld(new WorldCreator("FilterCube"));
@ -1057,8 +1067,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerTick(), 1l, 1l); getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerTick(), 1l, 1l);
//log(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)+"",0); //log(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)+"",0);
log("This is here to change the file size if necessary Kappa",5);
} }
private static void InitializeBotCommands() {
//aPlugin.API.addCommand(StatCommand, "stats");
}
@Override @Override
public void onDisable() { public void onDisable() {
//Clear out remaining parties. //Clear out remaining parties.
@ -1821,7 +1836,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideKeeper.log("Suppression Time: "+GenericFunctions.getSuppressionTime(p), 1); TwosideKeeper.log("Suppression Time: "+GenericFunctions.getSuppressionTime(p), 1);
TwosideKeeper.log("Suppressed: "+GenericFunctions.isSuppressed(p),1);*/ TwosideKeeper.log("Suppressed: "+GenericFunctions.isSuppressed(p),1);*/
//ItemStack item = p.getEquipment().getItemInMainHand(); //ItemStack item = p.getEquipment().getItemInMainHand();
//AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), 999999, p); AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), 999999, p);
/*FallingBlock fb = p.getWorld().spawnFallingBlock(p.getLocation(), Material.REDSTONE_BLOCK, (byte)0); /*FallingBlock fb = p.getWorld().spawnFallingBlock(p.getLocation(), Material.REDSTONE_BLOCK, (byte)0);
fb.setMetadata("DESTROY", new FixedMetadataValue(this,true)); fb.setMetadata("DESTROY", new FixedMetadataValue(this,true));
GlowAPI.setGlowing(fb, GlowAPI.Color.YELLOW, Bukkit.getOnlinePlayers());*/ GlowAPI.setGlowing(fb, GlowAPI.Color.YELLOW, Bukkit.getOnlinePlayers());*/
@ -3301,24 +3316,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
switch (mode) { switch (mode) {
case CLOSE:{ case CLOSE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f); SoundUtils.playLocalSound(p, Sound.BLOCK_BREWING_STAND_BREW, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, SIPHON_COOLDOWN));
}break;
case SNIPE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p,BowMode.CLOSE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, DODGE_COOLDOWN));
}break;
case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.SNIPE); GenericFunctions.setBowMode(p,BowMode.SNIPE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand()); //GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory(); p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, ARROWBARRAGE_COOLDOWN)); aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_siphon, ARROWBARRAGE_COOLDOWN));
}break;
case SNIPE:{
SoundUtils.playLocalSound(p, Sound.BLOCK_CHEST_LOCKED, 0.5f, 3.5f);
GenericFunctions.setBowMode(p,BowMode.DEBILITATION);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_dodge, SIPHON_COOLDOWN));
}break;
case DEBILITATION:{
SoundUtils.playLocalSound(p, Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 0.1f);
GenericFunctions.setBowMode(p,BowMode.CLOSE);
//GenericFunctions.applyModeName(p.getEquipment().getItemInMainHand());
p.updateInventory();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetRemainingCooldownTime(p, pd.last_arrowbarrage, DODGE_COOLDOWN));
}break; }break;
} }
pd.lastbowmodeswitch=getServerTickTime(); pd.lastbowmodeswitch=getServerTickTime();
@ -3366,14 +3381,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
/*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p)); /*aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p));
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/ pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/
pd.lastusedearthwave=TwosideKeeper.getServerTickTime(); pd.lastusedearthwave=TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(p.getInventory(), weapon, (int) (weapon.getType().getMaxDurability()*0.05+5)); aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.05+5));
for (int x=-1;x<2;x++) { for (int x=-1;x<2;x++) {
for (int z=-1;z<2;z++) { for (int z=-1;z<2;z++) {
if (x!=0 && z!=0) { if (x!=0 && z!=0) {
Location newblock = checkloc.clone(); Location newblock = checkloc.clone();
if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) { if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) {
TwosideKeeper.log("NOT SOFT!", 5); TwosideKeeper.log("NOT SOFT!", 5);
aPlugin.API.damageItem(p.getInventory(), weapon, (int) (weapon.getType().getMaxDurability()*0.01+1)); aPlugin.API.damageItem(p, weapon, (int) (weapon.getType().getMaxDurability()*0.01+1));
} }
} }
} }
@ -4733,7 +4748,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (pd.last_rejuvenate+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime() && PlayerMode.isDefender(ev.getPlayer())) { if (pd.last_rejuvenate+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime() && PlayerMode.isDefender(ev.getPlayer())) {
GenericFunctions.PerformRejuvenate(ev.getPlayer()); GenericFunctions.PerformRejuvenate(ev.getPlayer());
pd.last_rejuvenate = TwosideKeeper.getServerTickTime(); pd.last_rejuvenate = TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(ev.getPlayer().getInventory(), ev.getItemDrop().getItemStack(), 400); aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), 400);
} }
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR)); ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
} }
@ -5122,7 +5137,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
//Check for a shift-right click for Filter Cubes. //Check for a shift-right click for Filter Cubes.
if (ev.getClick()==ClickType.SHIFT_RIGHT) { if (ev.getClick()==ClickType.SHIFT_RIGHT && ((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9))) {
ItemStack item = ev.getCurrentItem(); ItemStack item = ev.getCurrentItem();
if (CustomItem.isFilterCube(item)) { if (CustomItem.isFilterCube(item)) {
int cubeid = ItemCubeUtils.getItemCubeID(item); int cubeid = ItemCubeUtils.getItemCubeID(item);
@ -5132,8 +5148,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getWhoClicked().openInventory(targethopper.getInventory()); ev.getWhoClicked().openInventory(targethopper.getInventory());
SoundUtils.playLocalSound((Player)ev.getWhoClicked(), Sound.BLOCK_CHEST_LOCKED, 1.0f, 1.0f); SoundUtils.playLocalSound((Player)ev.getWhoClicked(), Sound.BLOCK_CHEST_LOCKED, 1.0f, 1.0f);
ev.setCancelled(true); ev.setCancelled(true);
return;
}
if (CustomItem.isVacuumCube(item)) {
ItemCubeUtils.toggleSuction(ItemCubeUtils.getItemCubeID(item));
GenericFunctions.UpdateItemCubeContentsList(item);
if (ItemCubeUtils.isSuctionOn(ItemCubeUtils.getItemCubeID(item))) {
SoundUtils.playLocalSoundsWithDelay(4, player, new SoundData[]{new SoundData(Sound.BLOCK_NOTE_HARP,0.7f,1.0f),new SoundData(Sound.BLOCK_NOTE_HARP,1.0f,1.0f)});
} else {
SoundUtils.playLocalSoundsWithDelay(4, player, new SoundData[]{new SoundData(Sound.BLOCK_NOTE_HARP,1.0f,1.0f),new SoundData(Sound.BLOCK_NOTE_HARP,0.7f,1.0f)});
}
ev.setCancelled(true);
return;
} }
return;
} }
//Check for a right-click for a Bauble Pouch. //Check for a right-click for a Bauble Pouch.
@ -5337,13 +5364,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//WARNING! This only happens for ITEM CUBES! Do not add other items in here! //WARNING! This only happens for ITEM CUBES! Do not add other items in here!
pd = (PlayerStructure) playerdata.get(ev.getWhoClicked().getUniqueId()); pd = (PlayerStructure) playerdata.get(ev.getWhoClicked().getUniqueId());
if (ev.getClick()==ClickType.RIGHT || ev.getClick()==ClickType.SHIFT_RIGHT || (ev.getCursor()==null || ev.getCursor().getType()==Material.AIR)) { if (ev.getClick()==ClickType.RIGHT || ev.getClick()==ClickType.SHIFT_RIGHT || (ev.getCursor()==null || ev.getCursor().getType()==Material.AIR)) {
//TwosideKeeper.log("In here Item Cubes 1.. Current item: "+ev.getCurrentItem()+" Cursor: "+ev.getCursor(), 0);
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) || if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.getCurrentItem()!=null) { (ev.getInventory().getType()==InventoryType.WORKBENCH && ev.getRawSlot()>9)) && ev.getCurrentItem()!=null) {
//TwosideKeeper.log("In here Item Cubes 2..", 0);
if (ev.getCurrentItem().hasItemMeta() && (ev.getCurrentItem().getType()!=Material.AIR)) { if (ev.getCurrentItem().hasItemMeta() && (ev.getCurrentItem().getType()!=Material.AIR)) {
//TwosideKeeper.log("In here Item Cubes 3..", 0);
ItemMeta item_meta = ev.getCurrentItem().getItemMeta(); ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
if (item_meta.hasLore()) { if (item_meta.hasLore()) {
List<String> item_meta_lore = item_meta.getLore(); List<String> item_meta_lore = item_meta.getLore();
if (item_meta_lore.size()>=4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) { if (item_meta_lore.size()>=4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
//TwosideKeeper.log("In here Item Cubes 4..", 0);
int itemcubeid = -1; int itemcubeid = -1;
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube && if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
ev.getWhoClicked().getOpenInventory().getTitle().contains("Item Cube #")) { ev.getWhoClicked().getOpenInventory().getTitle().contains("Item Cube #")) {
@ -5355,6 +5386,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Check to see if the cursor item is an item cube. //Check to see if the cursor item is an item cube.
if ((ItemCubeUtils.isItemCubeMaterial(ev.getCurrentItem().getType()) && if ((ItemCubeUtils.isItemCubeMaterial(ev.getCurrentItem().getType()) &&
ItemCubeUtils.isItemCube(ev.getCurrentItem()))) { ItemCubeUtils.isItemCube(ev.getCurrentItem()))) {
//TwosideKeeper.log("In here Item Cubes 5..", 0);
log("The clicked item has lore...",5); log("The clicked item has lore...",5);
for (int i=0;i<ev.getCurrentItem().getItemMeta().getLore().size();i++) { for (int i=0;i<ev.getCurrentItem().getItemMeta().getLore().size();i++) {
if (ev.getCurrentItem().getItemMeta().getLore().get(i).contains(ChatColor.DARK_PURPLE+"ID#")) { if (ev.getCurrentItem().getItemMeta().getLore().get(i).contains(ChatColor.DARK_PURPLE+"ID#")) {
@ -5367,6 +5399,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Stop this before the player does something dumb! //Stop this before the player does something dumb!
//Player p = ((Player)ev.getWhoClicked()); //Player p = ((Player)ev.getWhoClicked());
//SoundUtils.playLocalSound(p, Sound.BLOCK_NOTE_HARP, 0.4f, 0.2f); //SoundUtils.playLocalSound(p, Sound.BLOCK_NOTE_HARP, 0.4f, 0.2f);
//TwosideKeeper.log("In here Item Cubes..", 0);
ev.setCancelled(true); ev.setCancelled(true);
return; return;
} }
@ -6001,16 +6034,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Only reduce durability of the shield. //Only reduce durability of the shield.
ItemStack[] equips = GenericFunctions.getEquipment(p, true); ItemStack[] equips = GenericFunctions.getEquipment(p, true);
if (GenericFunctions.isEquip(equips[0])) { if (GenericFunctions.isEquip(equips[0])) {
aPlugin.API.damageItem(p.getInventory(), equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1))); aPlugin.API.damageItem(p, equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1)));
} }
if (GenericFunctions.isEquip(equips[1])) { if (GenericFunctions.isEquip(equips[1])) {
aPlugin.API.damageItem(p.getInventory(), equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1))); aPlugin.API.damageItem(p, equips[0], 3+((int)((equips[0].getType().getMaxDurability()*0.01)+1)));
} }
} else { } else {
ItemStack[] equips = GenericFunctions.getArmor(p, false); ItemStack[] equips = GenericFunctions.getArmor(p, false);
for (ItemStack equip : equips) { for (ItemStack equip : equips) {
if (GenericFunctions.isEquip(equip)) { if (GenericFunctions.isEquip(equip)) {
aPlugin.API.damageItem(p.getInventory(), equip, 3+((int)((equip.getType().getMaxDurability()*0.01)+1))); aPlugin.API.damageItem(p, equip, 3+((int)((equip.getType().getMaxDurability()*0.01)+1)));
} }
} }
} }
@ -8316,7 +8349,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
CustomDamage.ApplyDamage(0, arr, findtarget, p.getEquipment().getItemInMainHand(), "Arrow"); CustomDamage.ApplyDamage(0, arr, findtarget, p.getEquipment().getItemInMainHand(), "Arrow");
arr.remove(); //Remove the arrow as we are damaging the entity directly. arr.remove(); //Remove the arrow as we are damaging the entity directly.
} }
aPlugin.API.damageItem(p.getInventory(), p.getEquipment().getItemInMainHand(), 3); aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 3);
} }
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
@ -9870,6 +9903,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2)); receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2));
Chicken temporarychicken = (Chicken)p.getWorld().spawnEntity(p.getLocation().add(0,1000000,0), EntityType.CHICKEN); //Why are you so cruel to the chicken sig. Chicken temporarychicken = (Chicken)p.getWorld().spawnEntity(p.getLocation().add(0,1000000,0), EntityType.CHICKEN); //Why are you so cruel to the chicken sig.
@SuppressWarnings("unchecked")
HashMap<String,Double> origmap = (HashMap<String, Double>) pd.damagedata.breakdownlist.clone(); HashMap<String,Double> origmap = (HashMap<String, Double>) pd.damagedata.breakdownlist.clone();
double origdmg = pd.damagedata.actualtotaldmg; double origdmg = pd.damagedata.actualtotaldmg;
if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) {

View File

@ -542,6 +542,9 @@ public final class TwosideKeeperAPI {
} }
//Localization COMMANDS. //Localization COMMANDS.
public static String getLocalizedItemName(ItemStack i, boolean displayTier) {
return GenericFunctions.UserFriendlyMaterialName(i,displayTier);
}
public static String getLocalizedItemName(ItemStack i) { public static String getLocalizedItemName(ItemStack i) {
return GenericFunctions.UserFriendlyMaterialName(i); return GenericFunctions.UserFriendlyMaterialName(i);
} }

View File

@ -612,7 +612,7 @@ final class runServerHeartbeat implements Runnable {
config = new File(TwosideKeeper.filesave,"users/"+user+".data"); config = new File(TwosideKeeper.filesave,"users/"+user+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config); FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
//aPlugin.DiscordMessageSender.sendPM("A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")", workable.getString("weatherwatch_user")); //aPlugin.DiscordMessageSender.sendPM("A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")", workable.getString("weatherwatch_user"));
aPlugin.API.discordSendDM(workable.getString("weatherwatch_user"), "A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")"); aPlugin.API.discordSendOnlineDM(workable.getString("weatherwatch_user"), "A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")");
} }
} }
} }