diff --git a/.classpath b/.classpath
index 999fe5e..043ba81 100644
--- a/.classpath
+++ b/.classpath
@@ -5,6 +5,6 @@
-
+
diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar
index adda82a..b6ebd10 100644
Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ
diff --git a/src/plugin.yml b/src/plugin.yml
index c033880..508ce71 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
-version: 3.10.9b
+version: 3.10.9c
loadbefore: [aPlugin]
commands:
money:
diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java
index f1dfddb..5a6634c 100644
--- a/src/sig/plugin/TwosideKeeper/CustomDamage.java
+++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java
@@ -1582,6 +1582,10 @@ public class CustomDamage {
if (target.isDead()) {
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.setNoDamageTicks(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)) {
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) {
dodgechance = 1.0;
}
+
return dodgechance;
}
private static double addMultiplicativeValue(double numb, double val) {
- if (numb==0) {
- numb += val;
- } else {
- numb += (1-numb)*val;
- }
+ numb += (1-numb)*val;
return numb;
}
@@ -3149,20 +3150,20 @@ public class CustomDamage {
return cooldown;
}
- //REturns 0-100.
+ //Returns 0-100.
public static double CalculateDebuffResistance(Player p) {
TwosideKeeper.log("Debuffcount went up...",5);
double removechance = 0.0;
ItemStack[] equips = p.getEquipment().getArmorContents();
for (ItemStack equip : equips) {
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);
removechance=addMultiplicativeValue(removechance,resistamt);
}
}
- removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 2, 2));
- return removechance;
+ removechance=addMultiplicativeValue(removechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p,true), p, ItemSet.DAWNTRACKER, 2, 2)/100d);
+ return removechance*100d;
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
index b69b829..3f004b0 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
@@ -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},
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},
- 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
- 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),
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
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");}
} else
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(BUTCHERY,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");}
+ 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
if (path==UpgradePath.FISHING_ROD) {
} else
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/BotCommands/stats.java b/src/sig/plugin/TwosideKeeper/HelperStructures/BotCommands/stats.java
new file mode 100644
index 0000000..435aa6e
--- /dev/null
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/BotCommands/stats.java
@@ -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
+ }
+ }
+ }
+}
+*/
\ No newline at end of file
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
index 46659e9..66c6726 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
@@ -83,6 +83,7 @@ import sig.plugin.TwosideKeeper.Events.PlayerTumbleEvent;
import sig.plugin.TwosideKeeper.HelperStructures.ArrowBarrage;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
+import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
import sig.plugin.TwosideKeeper.HelperStructures.EliteMonsterLocationFinder;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
@@ -509,11 +510,15 @@ public class GenericFunctions {
}
public static String UserFriendlyMaterialName(ItemStack type) {
+ return UserFriendlyMaterialName(type,false);
+ }
+
+ public static String UserFriendlyMaterialName(ItemStack type, boolean displayTier) {
if (type!=null &&
type.getType()!=Material.AIR) {
if (type.hasItemMeta() &&
type.getItemMeta().hasDisplayName()) {
- return type.getItemMeta().getDisplayName();
+ return type.getItemMeta().getDisplayName()+((ItemSet.isSetItem(type) && displayTier)?" (T"+ItemSet.GetTier(type)+")":"");
}
switch (type.getType()) {
case ACACIA_DOOR_ITEM:{
@@ -2132,7 +2137,9 @@ public class GenericFunctions {
item.getType().toString().contains("FISHING_ROD") ||
item.getType().toString().contains("SHIELD") ||
item.getType().toString().contains("CARROT_STICK") ||
- item.getType().toString().contains("ELYTRA"))) {
+ item.getType().toString().contains("ELYTRA") ||
+ BaublePouch.isBaublePouch(item) ||
+ ArrowQuiver.isValidQuiver(item))) {
return true;
} else {
return false;
@@ -3353,13 +3360,13 @@ public class GenericFunctions {
}
}
- //TODO Item Cube Contents list.
- private static void UpdateItemCubeContentsList(ItemStack item) {
+ public static void UpdateItemCubeContentsList(ItemStack item) {
if (ItemUtils.isValidLoreItem(item) &&
item.getItemMeta().getLore().size()>=4 &&
ItemUtils.LoreContainsSubstring(item, ChatColor.DARK_PURPLE+"ID#")) {
//This is an item cube. Update its lore.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
+ ItemCubeUtils.updateVacuumCubeSuctionLoreLine(item);
if (TwosideKeeper.itemcube_updates.containsKey(id)) {
ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.WHITE+"Contents (");
ItemUtils.DeleteAllLoreLinesAtAndAfterLineContainingSubstring(item, ChatColor.AQUA+" ");
@@ -3725,6 +3732,7 @@ public class GenericFunctions {
int breaks = GenericFunctions.getHardenedItemBreaks(bauble);
if (breaks>0) {
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 {
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));
@@ -4486,7 +4494,7 @@ public class GenericFunctions {
pd.last_strikerspell=TwosideKeeper.getServerTickTime();
}
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;
int mult=2;
@@ -4674,7 +4682,7 @@ public class GenericFunctions {
for (int i=0;i<9;i++) {
if (inv[i]!=null &&
isTool(inv[i]) && inv[i].getType()!=Material.BOW) {
- aPlugin.API.damageItem(p.getInventory(), inv[i], 1);
+ aPlugin.API.damageItem(p, inv[i], 1);
}
}
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java b/src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
index 540034c..bf55ca1 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/CustomItem.java
@@ -146,7 +146,7 @@ public class CustomItem {
List item_VacuumCube_lore = new ArrayList();
item_VacuumCube_lore.add("A storage container that sucks");
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();
item_ItemCube_meta.setLore(item_VacuumCube_lore);
item_ItemCube_meta.setDisplayName(ChatColor.BLUE+""+ChatColor.BOLD+"Vacuum Cube");
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java b/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
index 59b8165..90318ef 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
@@ -247,8 +247,8 @@ public enum PlayerMode {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
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.
- (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 && !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 && (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.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.*/ &&
GenericFunctions.AllLeatherArmor(p))) {
return true;
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/SoundData.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/SoundData.java
new file mode 100644
index 0000000..99810f9
--- /dev/null
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/SoundData.java
@@ -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;
+ }
+}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
index ba7428f..dcdcc55 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/InventoryUtils.java
@@ -22,7 +22,7 @@ import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
public class InventoryUtils {
public static boolean isCarryingVacuumCube(Player p) {
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;
}
}
@@ -31,7 +31,7 @@ public class InventoryUtils {
public static ItemStack[] insertItemsInVacuumCube(Player p,ItemStack...items) {
ItemStack[] remaining = items;
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.
int id = Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(itemStacks, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
List itemCubeContents = TwosideKeeper.itemCube_loadConfig(id);
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java
index 59b328d..2b91a7c 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemCubeUtils.java
@@ -26,6 +26,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ItemContainer;
public class ItemCubeUtils {
+ public final static String SUCTION_STRING = ChatColor.GRAY+"Block Collection: ";
public static int getItemCubeID(ItemStack item) {
return Integer.parseInt(ItemUtils.GetLoreLineContainingSubstring(item, ChatColor.DARK_PURPLE+"ID#").split("#")[1]);
}
@@ -168,6 +169,7 @@ public class ItemCubeUtils {
return ItemCube_items;
}
+ @Deprecated
public static List loadFilterConfig(int id){
List ItemCube_items = new ArrayList();
File config;
@@ -285,4 +287,55 @@ public class ItemCubeUtils {
ItemCube.clearFromViewersofItemCube(id,null);
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"));
+ }
+ }
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java
index 2e65d49..7ca499d 100644
--- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java
+++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/SoundUtils.java
@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
+import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.SoundData;
public class SoundUtils {
@@ -57,4 +58,16 @@ public class SoundUtils {
TwosideKeeper.log("Next float:"+newnumb+" | Pitch: "+newpitch, 5);
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{
+ SoundUtils.playLocalSound(p, sounds[val].getSound(), sounds[val].getVolume(), sounds[val].getPitch());
+ }, i*tickdelay);
+ }
+ }
}
diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java
index f39a240..4b82d12 100644
--- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java
+++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java
@@ -49,6 +49,7 @@ public class PlayerStructure {
public boolean opened_inventory;
public boolean isViewingItemCube=false;
+ public boolean shootingArrowBarrage=false;
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.
diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
index 16acbe9..e8c24be 100644
--- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
+++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java
@@ -174,6 +174,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionEffectTypeWrapper;
import org.bukkit.potion.PotionType;
import org.bukkit.util.Vector;
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.SoundUtils;
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.TreeBuilder;
import sig.plugin.TwosideKeeper.Logging.BowModeLogger;
@@ -473,6 +475,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static List jobrecipes = new ArrayList();
public static List cameras = new ArrayList();
public static List arenas = new ArrayList();
+
+ //public static stats StatCommand = new stats();
+
+ public static PotionEffectType TESTEFFECT;
long LastClearStructureTime = 0;
public static final Set 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 ELITEGUARDIANS_ACTIVATED=false;
+ public final static boolean NEWARTIFACTABILITIES_ACTIVATED=false;
public static final Set LIVING_ENTITY_TYPES = ImmutableSet.of(
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_BaublePouch_Recipe();
- Bukkit.getScheduler().runTaskLater(this,()->{JobRecipe.InitializeJobRecipes();},1);
+ Bukkit.getScheduler().runTaskLater(this,()->{
+ JobRecipe.InitializeJobRecipes();
+ //TwosideKeeper.InitializeBotCommands();
+ },1);
Bukkit.createWorld(new WorldCreator("FilterCube"));
@@ -1057,8 +1067,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
getServer().getScheduler().scheduleSyncRepeatingTask(this, new runServerTick(), 1l, 1l);
//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
public void onDisable() {
//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("Suppressed: "+GenericFunctions.isSuppressed(p),1);*/
//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);
fb.setMetadata("DESTROY", new FixedMetadataValue(this,true));
GlowAPI.setGlowing(fb, GlowAPI.Color.YELLOW, Bukkit.getOnlinePlayers());*/
@@ -3301,24 +3316,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
switch (mode) {
case CLOSE:{
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.applyModeName(p.getEquipment().getItemInMainHand());
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;
}
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));
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);*/
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 z=-1;z<2;z++) {
if (x!=0 && z!=0) {
Location newblock = checkloc.clone();
if (!GenericFunctions.isSoftBlock(newblock.getBlock().getRelative(x, 0, z).getType())) {
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())) {
GenericFunctions.PerformRejuvenate(ev.getPlayer());
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));
}
@@ -5122,7 +5137,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
//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();
if (CustomItem.isFilterCube(item)) {
int cubeid = ItemCubeUtils.getItemCubeID(item);
@@ -5132,8 +5148,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getWhoClicked().openInventory(targethopper.getInventory());
SoundUtils.playLocalSound((Player)ev.getWhoClicked(), Sound.BLOCK_CHEST_LOCKED, 1.0f, 1.0f);
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.
@@ -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!
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)) {
+ //TwosideKeeper.log("In here Item Cubes 1.. Current item: "+ev.getCurrentItem()+" Cursor: "+ev.getCursor(), 0);
if (((ev.getInventory().getType()!=InventoryType.WORKBENCH && ev.getRawSlot()>=0) ||
(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)) {
+ //TwosideKeeper.log("In here Item Cubes 3..", 0);
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
if (item_meta.hasLore()) {
List item_meta_lore = item_meta.getLore();
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;
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
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.
if ((ItemCubeUtils.isItemCubeMaterial(ev.getCurrentItem().getType()) &&
ItemCubeUtils.isItemCube(ev.getCurrentItem()))) {
+ //TwosideKeeper.log("In here Item Cubes 5..", 0);
log("The clicked item has lore...",5);
for (int i=0;i origmap = (HashMap) pd.damagedata.breakdownlist.clone();
double origdmg = pd.damagedata.actualtotaldmg;
if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) {
diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
index 1923bd2..86d4204 100644
--- a/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
+++ b/src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
@@ -542,6 +542,9 @@ public final class TwosideKeeperAPI {
}
//Localization COMMANDS.
+ public static String getLocalizedItemName(ItemStack i, boolean displayTier) {
+ return GenericFunctions.UserFriendlyMaterialName(i,displayTier);
+ }
public static String getLocalizedItemName(ItemStack i) {
return GenericFunctions.UserFriendlyMaterialName(i);
}
diff --git a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
index 4f04091..07da81d 100644
--- a/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
+++ b/src/sig/plugin/TwosideKeeper/runServerHeartbeat.java
@@ -612,7 +612,7 @@ final class runServerHeartbeat implements Runnable {
config = new File(TwosideKeeper.filesave,"users/"+user+".data");
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.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)+")");
}
}
}