Improve Performance of Hoppers and checking world shops.
This commit is contained in:
parent
8af5f62601
commit
739f84932b
Binary file not shown.
@ -1936,4 +1936,11 @@ public class CustomDamage {
|
|||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
return pd.lasthitdesc;
|
return pd.lasthitdesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Returns the amount of cooldown reduction the player has.
|
||||||
|
* 0% meaning cooldowns are not reduced at all. 100% meaning cooldowns should be non-existent.
|
||||||
|
*/
|
||||||
|
public static double calculateCooldownReduction(Player p) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3647,4 +3647,34 @@ public class GenericFunctions {
|
|||||||
p.addPotionEffect(neweffect);
|
p.addPotionEffect(neweffect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasSlayerSetItemOnHotbar(Player p) {
|
||||||
|
for (int i=0;i<9;i++) {
|
||||||
|
if (i==9) {
|
||||||
|
i=40;
|
||||||
|
}
|
||||||
|
ItemStack item = p.getInventory().getContents()[i];
|
||||||
|
ItemSet set = TwosideKeeperAPI.getItemSet(item);
|
||||||
|
if (set!=null &&
|
||||||
|
(set==ItemSet.LORASYS ||
|
||||||
|
set==ItemSet.GLADOMAIN ||
|
||||||
|
set==ItemSet.MOONSHADOW)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean WearingNoArmor(Player p) {
|
||||||
|
ItemStack[] armor = p.getEquipment().getArmorContents();
|
||||||
|
boolean hasArmor=false;
|
||||||
|
for (int i=0;i<armor.length;i++) {
|
||||||
|
if (armor[i]!=null &&
|
||||||
|
armor[i].getType()!=Material.AIR) {
|
||||||
|
hasArmor=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasArmor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,7 @@ public class Loot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int modifyTierBonus(ItemStack item, int tierbonus) {
|
private static int modifyTierBonus(ItemStack item, int tierbonus) {
|
||||||
if (item.getType().name().contains("IRON")) {
|
/*if (item.getType().name().contains("IRON")) {
|
||||||
if (Math.random()<=0.5 && tierbonus<2) {
|
if (Math.random()<=0.5 && tierbonus<2) {
|
||||||
tierbonus+=2;
|
tierbonus+=2;
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ public class Loot {
|
|||||||
if (tierbonus>0 && Math.random()<=0.5) {
|
if (tierbonus>0 && Math.random()<=0.5) {
|
||||||
tierbonus=0;
|
tierbonus=0;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return tierbonus;
|
return tierbonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ public enum PlayerMode {
|
|||||||
+ ChatColor.WHITE+"->Dropping your weapon will perform a line drive. Enemies you charge through take x7 your base damage. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
|
+ ChatColor.WHITE+"->Dropping your weapon will perform a line drive. Enemies you charge through take x7 your base damage. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
|
||||||
+ ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n"
|
+ ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n"
|
||||||
+ ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n"),
|
+ ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n"),
|
||||||
RANGER(ChatColor.GREEN,"R","Ranger",
|
RANGER(ChatColor.DARK_GREEN,"R","Ranger",
|
||||||
ChatColor.GREEN+""+ChatColor.BOLD+"Ranger mode Perks: "+ChatColor.RESET+"\n"
|
ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger mode Perks: "+ChatColor.RESET+"\n"
|
||||||
+ ChatColor.WHITE+"->Players are identified as 'Rangers' when they carry a bow in their main hand. Off-hand items are permitted, except for a shield. Can only be wearing leather armor, or no armor.\n"
|
+ ChatColor.WHITE+"->Players are identified as 'Rangers' when they carry a bow in their main hand. Off-hand items are permitted, except for a shield. Can only be wearing leather armor, or no armor.\n"
|
||||||
+ ChatColor.GRAY+"->Left-clicking mobs will cause them to be knocked back extremely far, basically in headshot range, when walls permit.\n"
|
+ ChatColor.GRAY+"->Left-clicking mobs will cause them to be knocked back extremely far, basically in headshot range, when walls permit.\n"
|
||||||
+ ChatColor.WHITE+"->Base Arrow Damage increases from x2->x4.\n"
|
+ ChatColor.WHITE+"->Base Arrow Damage increases from x2->x4.\n"
|
||||||
@ -90,6 +90,9 @@ public enum PlayerMode {
|
|||||||
public static PlayerMode getPlayerMode(Player p) {
|
public static PlayerMode getPlayerMode(Player p) {
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (needsUpdating(pd)) {
|
if (needsUpdating(pd)) {
|
||||||
|
if (isSlayer(p)) {
|
||||||
|
pd.lastmode=PlayerMode.SLAYER;
|
||||||
|
} else
|
||||||
if (isStriker(p)) {
|
if (isStriker(p)) {
|
||||||
pd.lastmode=PlayerMode.STRIKER;
|
pd.lastmode=PlayerMode.STRIKER;
|
||||||
} else
|
} else
|
||||||
@ -167,6 +170,24 @@ public enum PlayerMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSlayer(Player p) {
|
||||||
|
if (p!=null && !p.isDead()) {
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
if (needsUpdating(pd)) {
|
||||||
|
if (p.getEquipment().getItemInMainHand()!=null && GenericFunctions.hasSlayerSetItemOnHotbar(p) &&
|
||||||
|
GenericFunctions.WearingNoArmor(p)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pd.lastmode==PlayerMode.SLAYER;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String name="";
|
String name="";
|
||||||
String desription="";
|
String desription="";
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -356,4 +356,12 @@ public final class TwosideKeeperAPI {
|
|||||||
public static PlayerMode getPlayerMode(Player p) {
|
public static PlayerMode getPlayerMode(Player p) {
|
||||||
return PlayerMode.getPlayerMode(p);
|
return PlayerMode.getPlayerMode(p);
|
||||||
}
|
}
|
||||||
|
/**Returns the amount of cooldown reduction the player has.
|
||||||
|
0% meaning cooldowns are not reduced at all. 100% meaning cooldowns should be non-existent.
|
||||||
|
* @param p
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public double getCooldownReduction(Player p) {
|
||||||
|
return CustomDamage.calculateCooldownReduction(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user