->All loot bugs and drop rates have been completely corrected (including

item sets without breaks remaining/enchantments) and now rely on a
proper weighting system to hand out drops. As a reminder, the base
chance for a special item roll to occur is 10%. (And this is affected by
Looting, Luck buffs, Party member buffs, etc)
->Loot from Zombie Leaders are a lot better now.
->Added more safe checks to make sure drops were dropping in the world
by the game.
->Block and Dodge Chance is now hard capped at 95%. Only the Ranger
Close Mode "Perfect Dodge" will allow you to dodge 100% of the time.
->Fixed a bug where no damage ticks were not being reset for applying
Death Mark on monsters.
->Fixed a bug with resetting no damage ticks not properly working.
->Death Mark behavior has been modified. Targets killed when ignited
with Death Mark resets the cooldown on Death Mark, allowing you to cast
it again in 1 second. Targets not killed by Death Mark only consumes
half the stacks now.
->Death Mark tooltip has been updated.
->Fixed a bug with Death Loot that prevented items from being respawned
on very rare occasions. Extensive logging is now done during death
sessions to ensure we have physical proof of respawning.
->Fixed a bug with hardened bows not breaking.
->Chainmail armor now has damage reduction equivalent to Leather armor
instead of none at all.
->Added getPlayerMode() to API.
This commit is contained in:
sigonasr2 2016-08-27 14:33:41 -05:00
parent 9271f57c6f
commit 2c5b2ac15a
20 changed files with 1086 additions and 456 deletions

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.8.5b version: 3.8.5c
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -75,10 +75,10 @@ public class AutoUpdatePlugin implements Runnable {
public void run() { public void run() {
if (!TwosideKeeper.restarting_server) { if (!TwosideKeeper.restarting_server) {
if (Bukkit.getOnlinePlayers().size()!=0) { if (Bukkit.getOnlinePlayers().size()!=0) {
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!"); aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!");
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately.");
} else { } else {
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+".");
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately.");
} }
restarting=true; restarting=true;
@ -86,7 +86,7 @@ public class AutoUpdatePlugin implements Runnable {
//Save the new plugin hash. //Save the new plugin hash.
} else { } else {
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."); aPlugin.API.discordSendRawItalicized("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+".");
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately."); Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(ii).name+"."+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately.");
} }
if (restarting) { if (restarting) {

View File

@ -45,6 +45,8 @@ import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class CustomDamage { public class CustomDamage {
@ -169,6 +171,9 @@ public class CustomDamage {
} }
} }
dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth()))))); dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
if (shooter instanceof Player) {
dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
}
dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target));
double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter)); double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter));
if (preemptivedmg!=0.0) {preemptive=true;} if (preemptivedmg!=0.0) {preemptive=true;}
@ -297,7 +302,7 @@ public class CustomDamage {
String reason, int flags) { String reason, int flags) {
if (target instanceof Player) { if (target instanceof Player) {
Player p = (Player)target; Player p = (Player)target;
if (GenericFunctions.isDefender(p)) { if (PlayerMode.isDefender(p)) {
int resistlevel = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p); int resistlevel = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p);
if (resistlevel<4) { if (resistlevel<4) {
p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
@ -333,6 +338,7 @@ public class CustomDamage {
if (GenericFunctions.AttemptRevive(p, damage, reason)) { if (GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0; damage=0;
} }
reduceSwiftAegisBuff(p);
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);} if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
aPlugin.API.showDamage(target, GetHeartAmount(damage)); aPlugin.API.showDamage(target, GetHeartAmount(damage));
} }
@ -426,6 +432,31 @@ public class CustomDamage {
return damage; return damage;
} }
private static void reduceSwiftAegisBuff(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.swiftaegisamt>0) {
if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
int resistancelv = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p);
int resistance_duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.DAMAGE_RESISTANCE, p);
if (resistancelv>0) {
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Math.max(resistance_duration,20*20),resistancelv-1),true);
} else {
p.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
}
pd.swiftaegisamt--;
TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5);
} else {
pd.swiftaegisamt=0;
TwosideKeeper.log(pd.swiftaegisamt+" stacks of Aegis remaining.", 5);
}
if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
} else {
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Swift Aegis Resistance Removed.");
}
}
}
private static void triggerEliteBreakEvent(LivingEntity target) { private static void triggerEliteBreakEvent(LivingEntity target) {
if (target instanceof Monster && if (target instanceof Monster &&
TwosideKeeper.monsterdata.containsKey(target.getUniqueId())) { TwosideKeeper.monsterdata.containsKey(target.getUniqueId())) {
@ -553,7 +584,7 @@ public class CustomDamage {
} }
private static void reduceDefenderKnockback(Player p) { private static void reduceDefenderKnockback(Player p) {
if (GenericFunctions.isDefender(p) && p.isBlocking()) { if (PlayerMode.isDefender(p) && p.isBlocking()) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
@ -604,7 +635,7 @@ public class CustomDamage {
} }
static void applyDefenderAggro(Monster m, Player p) { static void applyDefenderAggro(Monster m, Player p) {
if (GenericFunctions.isDefender(p)) { if (PlayerMode.isDefender(p)) {
setMonsterTarget(m,p); setMonsterTarget(m,p);
setAggroGlowTickTime(m,100); setAggroGlowTickTime(m,100);
} }
@ -627,12 +658,14 @@ public class CustomDamage {
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId());
ms.SetTarget(p); ms.SetTarget(p);
} else { } else {
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,p)); MonsterStructure ms = new MonsterStructure(m,p);
TwosideKeeper.monsterdata.put(m.getUniqueId(),ms);
ms.SetTarget(p);
} }
} }
private static void healDefenderSaturation(Player p) { private static void healDefenderSaturation(Player p) {
if (GenericFunctions.isDefender(p) && p.getSaturation()<20) { if (PlayerMode.isDefender(p) && p.getSaturation()<20) {
p.setSaturation(p.getSaturation()+1); p.setSaturation(p.getSaturation()+1);
} }
} }
@ -738,6 +771,7 @@ public class CustomDamage {
duration += GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip[i]); duration += GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip[i]);
} }
} }
duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target,ItemSet.JAMDAK,4,4)/20d;
//Convert from seconds to ticks. //Convert from seconds to ticks.
int tick_duration = (int)(duration*20); int tick_duration = (int)(duration*20);
//Apply iframes. //Apply iframes.
@ -817,14 +851,21 @@ public class CustomDamage {
if (p.isBlocking()) { if (p.isBlocking()) {
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d; dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d;
} }
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d;
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d;
if (GenericFunctions.isStriker(p) && if (PlayerMode.isStriker(p) &&
93.182445*pd.velocity>4.317) { 93.182445*pd.velocity>4.317) {
dodgechance+=0.2; dodgechance+=0.2;
} }
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
dodgechance+=0.5; dodgechance+=0.5;
} }
if (dodgechance>0.95) {
dodgechance=0.95;
}
if (pd.fulldodge) { if (pd.fulldodge) {
dodgechance = 1.0; dodgechance = 1.0;
} }
@ -845,10 +886,12 @@ public class CustomDamage {
if (target instanceof LivingEntity) { if (target instanceof LivingEntity) {
ItemStack[] armor = GenericFunctions.getEquipment(target); ItemStack[] armor = GenericFunctions.getEquipment(target);
if (target instanceof Player) { if (target instanceof Player) {
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 3, 3)/100d;
/*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d; rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.LORASAADI, 2, 2)/100d;*/
} }
for (int i=0;i<armor.length;i++) { for (int i=0;i<armor.length;i++) {
@ -977,8 +1020,8 @@ public class CustomDamage {
*(1d-rangerdmgdiv) *(1d-rangerdmgdiv)
*(1d-((partylevel*10d)/100d)) *(1d-((partylevel*10d)/100d))
*setbonus *setbonus
*((target instanceof Player && ((Player)target).isBlocking())?(GenericFunctions.isDefender((Player)target))?0.30:0.50:1) *((target instanceof Player && ((Player)target).isBlocking())?(PlayerMode.isDefender((Player)target))?0.30:0.50:1)
*((target instanceof Player)?((GenericFunctions.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1); *((target instanceof Player)?((PlayerMode.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1);
if (basedmg!=finaldmg) { if (basedmg!=finaldmg) {
TwosideKeeper.log("Original damage was: "+basedmg,5); TwosideKeeper.log("Original damage was: "+basedmg,5);
@ -1260,10 +1303,12 @@ public class CustomDamage {
dmg += ItemSet.GetTotalBaseAmount(shooter,ItemSet.PANROS); dmg += ItemSet.GetTotalBaseAmount(shooter,ItemSet.PANROS);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.PANROS, 2, 2); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.PANROS, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DAWNTRACKER, 4, 4); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DAWNTRACKER, 4, 4);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.JAMDAK, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 3, 3);
/*dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.JAMDAK, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 3, 3); dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 3, 3);*/
} }
return dmg; return dmg;
@ -1272,7 +1317,7 @@ public class CustomDamage {
private static double calculateRangerMultiplier(ItemStack weapon, Entity damager) { private static double calculateRangerMultiplier(ItemStack weapon, Entity damager) {
LivingEntity shooter = getDamagerEntity(damager); LivingEntity shooter = getDamagerEntity(damager);
if (shooter instanceof Player) { if (shooter instanceof Player) {
if (GenericFunctions.isRanger((Player)shooter)) { if (PlayerMode.isRanger((Player)shooter)) {
return 4.0; return 4.0;
} }
} }
@ -1299,7 +1344,7 @@ public class CustomDamage {
if (proj.getShooter() instanceof Player) { if (proj.getShooter() instanceof Player) {
Player p = (Player)proj.getShooter(); Player p = (Player)proj.getShooter();
if (GenericFunctions.isRanger(p) && if (PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) { GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) {
aPlugin.API.sendSoundlessExplosion(arrowLoc, 1); aPlugin.API.sendSoundlessExplosion(arrowLoc, 1);
headshotvaly *= 4; headshotvaly *= 4;
@ -1310,12 +1355,12 @@ public class CustomDamage {
headshotvaly *= 1+(GenericFunctions.getAbilityValue(ArtifactAbility.MARKSMAN, weapon)/100d); headshotvaly *= 1+(GenericFunctions.getAbilityValue(ArtifactAbility.MARKSMAN, weapon)/100d);
} }
if (proj.getTicksLived()>=4 || GenericFunctions.isRanger(p)) { if (proj.getTicksLived()>=4 || PlayerMode.isRanger(p)) {
if (arrowLoc.distanceSquared(monsterHead)<=0.3*headshotvaly) { if (arrowLoc.distanceSquared(monsterHead)<=0.3*headshotvaly) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) { if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {
if (pd.headshotcombo<8) {pd.headshotcombo++;} if (pd.headshotcombo<8) {pd.headshotcombo++;}
double headshotincrease = (2+(pd.headshotcombo*0.25)); double headshotincrease = (2+(pd.headshotcombo*0.25));
mult+=headshotincrease; mult+=headshotincrease;
@ -1353,7 +1398,7 @@ public class CustomDamage {
mult+=2.0; mult+=2.0;
p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage"); p.sendMessage(ChatColor.DARK_RED+"Headshot! x2 Damage");
if (GenericFunctions.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) { if (PlayerMode.isRanger(p) && GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.DEBILITATION) {
if (m.hasPotionEffect(PotionEffectType.BLINDNESS)) { if (m.hasPotionEffect(PotionEffectType.BLINDNESS)) {
//Add to the current stack of BLINDNESS. //Add to the current stack of BLINDNESS.
for (int i1=0;i1<m.getActivePotionEffects().size();i1++) { for (int i1=0;i1<m.getActivePotionEffects().size();i1++) {
@ -1391,7 +1436,7 @@ public class CustomDamage {
Player check = partymembers.get(i); Player check = partymembers.get(i);
if (PartyManager.IsInSameParty(p, check)) { if (PartyManager.IsInSameParty(p, check)) {
TwosideKeeper.log("In here",5); TwosideKeeper.log("In here",5);
if (!GenericFunctions.isDefender(p) && GenericFunctions.isDefender(check) && if (!PlayerMode.isDefender(p) && PlayerMode.isDefender(check) &&
check.isBlocking() && check.isBlocking() &&
!p.equals(check)) { !p.equals(check)) {
//This is a defender. Transfer half the damage to them! //This is a defender. Transfer half the damage to them!
@ -1434,9 +1479,9 @@ public class CustomDamage {
if (shooter!=null) { if (shooter!=null) {
if (shooter instanceof Player) { if (shooter instanceof Player) {
Player p = (Player)shooter; Player p = (Player)shooter;
critchance += (GenericFunctions.isStriker(p)?0.2:0.0); critchance += (PlayerMode.isStriker(p)?0.2:0.0);
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d; critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d;
critchance += (GenericFunctions.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0); critchance += (PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0);
} }
} }
return critchance; return critchance;
@ -1459,7 +1504,7 @@ public class CustomDamage {
if (getDamagerEntity(damager) instanceof Player) { if (getDamagerEntity(damager) instanceof Player) {
Player p = (Player)getDamagerEntity(damager); Player p = (Player)getDamagerEntity(damager);
if (GenericFunctions.HasFullRangerSet(p) && if (GenericFunctions.HasFullRangerSet(p) &&
GenericFunctions.isRanger(p) && PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) { GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) {
critdmg+=1.0; critdmg+=1.0;
} }
@ -1486,7 +1531,7 @@ public class CustomDamage {
double mult=0.0; double mult=0.0;
if (damager instanceof Player) { if (damager instanceof Player) {
Player p = (Player)damager; Player p = (Player)damager;
if (GenericFunctions.isStriker(p)) { if (PlayerMode.isStriker(p)) {
mult+=0.1; mult+=0.1;
} }
} }
@ -1494,7 +1539,7 @@ public class CustomDamage {
} }
static boolean isPreemptiveStrike(LivingEntity m,Player p) { static boolean isPreemptiveStrike(LivingEntity m,Player p) {
if (GenericFunctions.isStriker(p) && if (PlayerMode.isStriker(p) &&
m!=null && m!=null &&
(m instanceof Monster) && (m instanceof Monster) &&
((Monster)m).getTarget()==null) { ((Monster)m).getTarget()==null) {
@ -1570,7 +1615,7 @@ public class CustomDamage {
finaldmg += dmg*(GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, weapon)/100d); finaldmg += dmg*(GenericFunctions.getAbilityValue(ArtifactAbility.ARMOR_PEN, weapon)/100d);
} }
if (GenericFunctions.HasFullRangerSet(p) && if (GenericFunctions.HasFullRangerSet(p) &&
GenericFunctions.isRanger(p) && PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(weapon)==BowMode.DEBILITATION) { GenericFunctions.getBowMode(weapon)==BowMode.DEBILITATION) {
finaldmg += dmg*0.5; finaldmg += dmg*0.5;
} }
@ -1737,7 +1782,7 @@ public class CustomDamage {
private static void performMegaKnockback(Entity damager,final LivingEntity target) { private static void performMegaKnockback(Entity damager,final LivingEntity target) {
if (damager instanceof Player) { if (damager instanceof Player) {
Player p = (Player)damager; Player p = (Player)damager;
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() { public void run() {
if (target!=null) { if (target!=null) {

View File

@ -0,0 +1,47 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
public class DropDeathItems implements Runnable{
Player p = null;
Location deathloc = null;
Inventory contents;
DropDeathItems(Player p, Inventory contents, Location deathloc) {
this.p=p;
this.deathloc=deathloc;
this.contents=contents;
}
@Override
public void run() {
if (!AttemptToDropItems(p,deathloc)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,contents,deathloc),1); //Keep trying until the chunk is loaded!!!
}
}
public boolean AttemptToDropItems(Player p, Location deathloc) {
deathloc.getWorld().loadChunk(deathloc.getChunk());
if (deathloc.getChunk().isLoaded()) {
TwosideKeeper.log("Respawn and Dropping...", 2);
for (int i=0;i<contents.getSize();i++) {
if (contents.getItem(i)!=null &&
contents.getItem(i).getType()!=Material.AIR) {
Item it = deathloc.getWorld().dropItemNaturally(deathloc, contents.getItem(i));
it.setInvulnerable(true);
TwosideKeeper.log("Dropping "+contents.getItem(i).toString()+" at Death location "+deathloc,2);
}
}
DeathManager.removeDeathStructure(p);
return true;
}
TwosideKeeper.log("CHUNK DID NOT LOAD! TRYING AGAIN SOON...", 0);
return false;
}
}

View File

@ -0,0 +1,24 @@
package sig.plugin.TwosideKeeper.Drops;
import org.bukkit.inventory.ItemStack;
import aPlugin.Drop;
public class GenericDrop extends Drop{
ItemStack item;
short data;
public GenericDrop(int amount, int weight, String description, ItemStack item, short data) {
super(amount, weight, description);
this.item=item;
this.data=data;
}
@Override
public ItemStack getItemStack() {
this.item.setDurability(data);
return this.item;
}
}

View File

@ -37,6 +37,7 @@ import org.inventivetalent.glow.GlowAPI;
import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class EliteMonster { public class EliteMonster {
@ -467,7 +468,7 @@ public class EliteMonster {
} }
dpslist.put(p.getName(), currentdps+dmg); dpslist.put(p.getName(), currentdps+dmg);
if ((!p.hasPotionEffect(PotionEffectType.WEAKNESS) || GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p)<9) && if ((!p.hasPotionEffect(PotionEffectType.WEAKNESS) || GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p)<9) &&
!GenericFunctions.isRanger(p)) { !PlayerMode.isRanger(p)) {
p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS,35,9),true); p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS,35,9),true);
} }
} }

View File

@ -105,7 +105,7 @@ public enum ArtifactAbility {
//Scythe abilities //Scythe abilities
AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.4,0.45,0.5,0.55,0.6,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10}, AOE("Area of Effect","Deals damage to targets up to [VAL]m from the main target hit.",new double[]{0.4,0.45,0.5,0.55,0.6,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10},
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.9,0.7,0.5},100,1,UpgradePath.SCYTHE), new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,0.9,0.7,0.5},100,1,UpgradePath.SCYTHE),
DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Each death mark stack applied deals [VAL] true damage.",new double[]{0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.5,3.0,3.5,4.0,5.0}, DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Targets killed with Death Mark resets the cooldown. Targets not killed lose half their Death Mark stacks.\n\n Each death mark stack applied deals [VAL] true damage.",new double[]{0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.5,3.0,3.5,4.0,5.0},
new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3,0.275,0.25},100,10,UpgradePath.SCYTHE), new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375,0.35,0.325,0.3,0.275,0.25},100,10,UpgradePath.SCYTHE),
CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1,2,3,4,5,6,7,8,10,12}, CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1,2,3,4,5,6,7,8,10,12},
new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,1000,UpgradePath.SCYTHE), new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,1000,UpgradePath.SCYTHE),

View File

@ -74,6 +74,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
import sig.plugin.TwosideKeeper.HelperStructures.BowMode; import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
public class GenericFunctions { public class GenericFunctions {
@ -90,7 +91,7 @@ public class GenericFunctions {
TwosideKeeper.log("This is obscure. Breaks is "+(Integer.parseInt(item.getItemMeta().getLore().get(i).split(": "+ChatColor.MAGIC)[1])), 2); TwosideKeeper.log("This is obscure. Breaks is "+(Integer.parseInt(item.getItemMeta().getLore().get(i).split(": "+ChatColor.MAGIC)[1])), 2);
return getObscureHardenedItemBreaks(item); return getObscureHardenedItemBreaks(item);
} else { } else {
return Integer.parseInt(item.getItemMeta().getLore().get(i).split(": "+ChatColor.YELLOW)[1]); return Integer.parseInt(item.getItemMeta().getLore().get(i).split(": "+ChatColor.YELLOW)[1].split(ChatColor.MAGIC+"")[0]);
} }
} }
} }
@ -438,15 +439,18 @@ public class GenericFunctions {
public static String UserFriendlyMaterialName(Material type) { public static String UserFriendlyMaterialName(Material type) {
return UserFriendlyMaterialName(new ItemStack(type,1,(byte)0)); return UserFriendlyMaterialName(new ItemStack(type,1,(short)0));
} }
@Deprecated
public static String UserFriendlyMaterialName(Material type, byte b) { public static String UserFriendlyMaterialName(Material type, byte b) {
return UserFriendlyMaterialName(new ItemStack(type,1,(short)b));
}
public static String UserFriendlyMaterialName(Material type,short b) {
return UserFriendlyMaterialName(new ItemStack(type,1,b)); return UserFriendlyMaterialName(new ItemStack(type,1,b));
} }
public static String UserFriendlyPotionEffectTypeName(PotionEffectType type) { public static String UserFriendlyPotionEffectTypeName(PotionEffectType type) {
switch (type.getName()) { switch (type.getName()) {
case "UNLUCK":{ case "UNLUCK":{
return "Bad Luck"; return "Bad Luck";
} }
@ -618,6 +622,9 @@ public class GenericFunctions {
case EXPLOSIVE_MINECART:{ case EXPLOSIVE_MINECART:{
return "TNT Minecart"; return "TNT Minecart";
} }
case FIREBALL:{
return "Fire Charge";
}
case FLOWER_POT_ITEM:{ case FLOWER_POT_ITEM:{
return "Flower Pot"; return "Flower Pot";
} }
@ -2100,33 +2107,6 @@ public class GenericFunctions {
} }
} }
public static boolean isDefender(Player p) {
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.SHIELD) {
return true;
} else {
return false;
}
}
public static boolean isStriker(Player p) {
if (p!=null && p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType().toString().contains("SWORD") &&
p.getInventory().getExtraContents()[0]==null) {
return true;
} else {
return false;
}
}
public static boolean isRanger(Player p) {
if (p!=null && !p.isDead() && (((p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow in main hand.
(p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && p.getInventory().getExtraContents()[0]!=null && !isEquip(p.getInventory().getExtraContents()[0])) || /*Satisfy a bow in main hand and no shield in off-hand.*/
(p.getEquipment().getItemInMainHand()!=null && !isEquip(p.getEquipment().getItemInMainHand()) && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()==Material.BOW) || /*Satisfy a bow 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)) /*Satisfy just a bow in off-hand.*/ &&
AllLeatherArmor(p))) {
return true;
} else {
return false;
}
}
public static boolean AllLeatherArmor(Player p) { public static boolean AllLeatherArmor(Player p) {
ItemStack[] equipment = p.getEquipment().getArmorContents(); ItemStack[] equipment = p.getEquipment().getArmorContents();
boolean leather=true; boolean leather=true;
@ -2141,11 +2121,11 @@ public class GenericFunctions {
} }
public static String PlayerModePrefix(Player p) { public static String PlayerModePrefix(Player p) {
if (isDefender(p)) { if (PlayerMode.isDefender(p)) {
return ChatColor.GRAY+""+ChatColor.ITALIC+"(D) "+ChatColor.RESET+ChatColor.GRAY; return ChatColor.GRAY+""+ChatColor.ITALIC+"(D) "+ChatColor.RESET+ChatColor.GRAY;
} else if (isStriker(p)) { } else if (PlayerMode.isStriker(p)) {
return ChatColor.RED+""+ChatColor.ITALIC+"(S) "+ChatColor.RESET+ChatColor.RED; return ChatColor.RED+""+ChatColor.ITALIC+"(S) "+ChatColor.RESET+ChatColor.RED;
} else if (isRanger(p)) { } else if (PlayerMode.isRanger(p)) {
return ChatColor.DARK_GREEN+""+ChatColor.ITALIC+"(R) "+ChatColor.RESET+ChatColor.DARK_GREEN; return ChatColor.DARK_GREEN+""+ChatColor.ITALIC+"(R) "+ChatColor.RESET+ChatColor.DARK_GREEN;
} else { } else {
return ""; return "";
@ -2154,17 +2134,17 @@ public class GenericFunctions {
public static TextComponent PlayerModeName(Player p) { public static TextComponent PlayerModeName(Player p) {
TextComponent tc = new TextComponent(""); TextComponent tc = new TextComponent("");
if (isDefender(p)) { if (PlayerMode.isDefender(p)) {
TextComponent tc1 = new TextComponent(ChatColor.GRAY+""+ChatColor.BOLD+"Defender"+ChatColor.RESET); TextComponent tc1 = new TextComponent(ChatColor.GRAY+""+ChatColor.BOLD+"Defender"+ChatColor.RESET);
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.GRAY+""+ChatColor.BOLD+"Defender"+ChatColor.RESET+".").create())); tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.GRAY+""+ChatColor.BOLD+"Defender"+ChatColor.RESET+".").create()));
tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Defender")); tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Defender"));
tc.addExtra(tc1); tc.addExtra(tc1);
} else if (isStriker(p)) { } else if (PlayerMode.isStriker(p)) {
TextComponent tc1 = new TextComponent(ChatColor.RED+""+ChatColor.BOLD+"Striker"+ChatColor.RESET); TextComponent tc1 = new TextComponent(ChatColor.RED+""+ChatColor.BOLD+"Striker"+ChatColor.RESET);
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.RED+""+ChatColor.BOLD+"Strikers"+ChatColor.RESET+".").create())); tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.RED+""+ChatColor.BOLD+"Strikers"+ChatColor.RESET+".").create()));
tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Striker")); tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Striker"));
tc.addExtra(tc1); tc.addExtra(tc1);
} else if (isRanger(p)) { } else if (PlayerMode.isRanger(p)) {
TextComponent tc1 = new TextComponent(ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger"+ChatColor.RESET); TextComponent tc1 = new TextComponent(ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger"+ChatColor.RESET);
tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger"+ChatColor.RESET+".").create())); tc1.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder("Click to view details about "+ChatColor.DARK_GREEN+""+ChatColor.BOLD+"Ranger"+ChatColor.RESET+".").create()));
tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Ranger")); tc1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/mode Ranger"));
@ -2811,7 +2791,7 @@ public class GenericFunctions {
} }
public static void PerformDodge(Player p) { public static void PerformDodge(Player p) {
if (p.isOnGround() && GenericFunctions.isRanger(p) && if (p.isOnGround() && PlayerMode.isRanger(p) &&
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE)) { (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.last_dodge+TwosideKeeper.DODGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) { if (pd.last_dodge+TwosideKeeper.DODGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
@ -2830,7 +2810,7 @@ public class GenericFunctions {
} else { } else {
p.setVelocity(p.getLocation().getDirection().multiply(1.4f)); p.setVelocity(p.getLocation().getDirection().multiply(1.4f));
} }
ApplySwiftAegis(p);
CustomDamage.addIframe(dodgeduration, p); CustomDamage.addIframe(dodgeduration, p);
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,dodgeduration,2)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,dodgeduration,2));
//TwosideKeeper.log("Added "+dodgeduration+" glowing ticks to "+p.getName()+" for dodging.",3); //TwosideKeeper.log("Added "+dodgeduration+" glowing ticks to "+p.getName()+" for dodging.",3);
@ -2948,20 +2928,20 @@ public class GenericFunctions {
public static void removeNoDamageTick(LivingEntity entity, Entity damager) { public static void removeNoDamageTick(LivingEntity entity, Entity damager) {
damager = CustomDamage.getDamagerEntity(damager); damager = CustomDamage.getDamagerEntity(damager);
if (damager instanceof Player) { if (entity instanceof Player) {
Player p = (Player)damager; Player p = (Player)entity;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (entity!=null) { if (damager!=null) {
pd.hitlist.remove(entity.getUniqueId()); pd.hitlist.remove(damager.getUniqueId());
} else { } else {
pd.hitlist.remove(p.getUniqueId()); pd.hitlist.remove(p.getUniqueId());
} }
} }
if (damager instanceof Monster) { if (entity instanceof Monster) {
Monster m = (Monster)damager; Monster m = (Monster)entity;
MonsterStructure md = MonsterStructure.getMonsterStructure(m); MonsterStructure md = MonsterStructure.getMonsterStructure(m);
if (entity!=null) { if (damager!=null) {
md.hitlist.remove(entity.getUniqueId()); md.hitlist.remove(damager.getUniqueId());
} else { } else {
md.hitlist.remove(m.getUniqueId()); md.hitlist.remove(m.getUniqueId());
} }
@ -3100,13 +3080,17 @@ public class GenericFunctions {
} }
public static ItemStack[] getEquipment(LivingEntity ent) { public static ItemStack[] getEquipment(LivingEntity ent) {
return new ItemStack[]{ if (ent!=null) {
ent.getEquipment().getItemInMainHand(), return new ItemStack[]{
ent.getEquipment().getHelmet(), ent.getEquipment().getItemInMainHand(),
ent.getEquipment().getChestplate(), ent.getEquipment().getHelmet(),
ent.getEquipment().getLeggings(), ent.getEquipment().getChestplate(),
ent.getEquipment().getBoots() ent.getEquipment().getLeggings(),
}; ent.getEquipment().getBoots()
};
} else {
return new ItemStack[]{};
}
} }
public static void updateSetItemsInInventory(Inventory inv) { public static void updateSetItemsInInventory(Inventory inv) {
@ -3243,10 +3227,10 @@ public class GenericFunctions {
lore.add();*/ lore.add();*/
} }
if (TwosideKeeperAPI.getItemSet(item)!=null && item.getType().name().contains("LEATHER")) { if (TwosideKeeperAPI.getItemSet(item)!=null && item.getType().name().contains("LEATHER")) {
TwosideKeeper.log("In here",2); TwosideKeeper.log("In here",5);
LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta(); LeatherArmorMeta lm = (LeatherArmorMeta)item.getItemMeta();
if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) { if (lm.getColor()==Bukkit.getServer().getItemFactory().getDefaultLeatherColor()) {
TwosideKeeper.log("->In here",2); TwosideKeeper.log("->In here",5);
ItemSet set = TwosideKeeperAPI.getItemSet(item); ItemSet set = TwosideKeeperAPI.getItemSet(item);
if (set==ItemSet.JAMDAK) { if (set==ItemSet.JAMDAK) {
lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0)); lm.setColor(org.bukkit.Color.fromRGB(128, 64, 0));
@ -3717,4 +3701,31 @@ public class GenericFunctions {
item.setItemMeta(meta); item.setItemMeta(meta);
} }
} }
public static void ApplySwiftAegis(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
int swiftaegislv=(int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4);
if (swiftaegislv>0) {
TwosideKeeper.log("Applying "+swiftaegislv+" levels of Swift Aegis.",5);
int resistancelv = 0;
int resistance_duration = 0;
if (p.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
resistancelv = GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p);
resistance_duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.DAMAGE_RESISTANCE, p);
}
if (resistancelv<9) {
//Try to apply as many levels as we can onto it.
if (resistancelv+swiftaegislv<9) {
//Apply it directly.
pd.swiftaegisamt+=swiftaegislv;
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Math.max(20*20, resistance_duration), (resistancelv+swiftaegislv)),true);
} else {
pd.swiftaegisamt+=Math.max(9-resistancelv,0);
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Math.max(20*20, resistance_duration), 9),true);
}
}
TwosideKeeper.log("New Aegis level: "+pd.swiftaegisamt,5);
aPlugin.API.sendActionBarMessage(p, ChatColor.GRAY+"Resistance "+WorldShop.toRomanNumeral(GenericFunctions.getPotionEffectLevel(PotionEffectType.DAMAGE_RESISTANCE, p)+1));
}
}
} }

View File

@ -1,16 +1,59 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
public enum CustomRecipe { public enum CustomRecipe {
ENDER_ITEM_CUBE_DUPLICATE; ENDER_ITEM_CUBE_DUPLICATE();
Recipe rec;
ItemStack result;
String listname;
CustomRecipe() {
rec=null;
result=null;
listname=null;
}
CustomRecipe(Recipe recipe, ItemStack result, String listname) {
this.rec=recipe;
this.result=result;
this.listname=listname;
}
public static void DisplayRecipe(Player p, CustomRecipe recipe) {
if (isNotGoingToMakeAMillionErrors(recipe)) {
if (recipe.rec instanceof ShapedRecipe) {
aPlugin.API.viewRecipe(p, (ShapedRecipe)recipe.rec);
} else {
aPlugin.API.viewRecipe(p, (ShapelessRecipe)recipe.rec);
}
}
}
private static boolean isNotGoingToMakeAMillionErrors(CustomRecipe recipe) {
return (recipe.rec!=null && recipe.result!=null && recipe.listname!=null);
}
public boolean isSameRecipe(ItemStack item) { public boolean isSameRecipe(ItemStack item) {
if (item!=null && if (item!=null &&
@ -83,4 +126,103 @@ public enum CustomRecipe {
} }
} }
} }
public static CustomPotion DefineHardeningVial() {
ItemStack HARDENING_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)HARDENING_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Hardening Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
HARDENING_VIAL.setItemMeta(pm);
return new CustomPotion(HARDENING_VIAL,effects,6,9);
}
public static CustomPotion DefineLifeVial() {
ItemStack LIFE_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Life Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
LIFE_VIAL.setItemMeta(pm);
return new CustomPotion(LIFE_VIAL,effects,50,100);
}
public static CustomPotion DefineStrengtheningVial() {
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Strengthing Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
STRENGTHENING_VIAL.setItemMeta(pm);
return new CustomPotion(STRENGTHENING_VIAL,effects,20,40);
/*//LEGACY CODE
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
int val=(int)(Math.random()*20+20);
pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,val+1), true);
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY+"Strength "+WorldShop.toRomanNumeral(val)+" ("+WorldShop.toReadableDuration(20*60*15)+")");
lore.add("");
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
pm.setLore(lore);
pm.setDisplayName("Strengthing Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
STRENGTHENING_VIAL.setItemMeta(pm);
return new CustomItem(STRENGTHENING_VIAL);*/
}
public static CustomItem DefineUpgradeShard() {
ItemStack UPGRADE_SHARD = new ItemStack(Material.PRISMARINE_SHARD);
ItemMeta meta = UPGRADE_SHARD.getItemMeta();
meta.setDisplayName(ChatColor.GREEN+"Upgrade Shard");
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
List<String> UPGRADE_SHARD_lore = new ArrayList<String>();
UPGRADE_SHARD_lore.add("An eerie glow radiates from");
UPGRADE_SHARD_lore.add("this item. It seems to possess");
UPGRADE_SHARD_lore.add("some other-worldly powers.");
meta.setLore(UPGRADE_SHARD_lore);
UPGRADE_SHARD.setItemMeta(meta);
UPGRADE_SHARD.addUnsafeEnchantment(Enchantment.LUCK, 1);
return new CustomItem(UPGRADE_SHARD);
}
public static CustomItem DefineHuntersCompass() {
ItemStack temp = new ItemStack(Material.COMPASS);
temp.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemMeta m = temp.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
m.setDisplayName(ChatColor.RED+"Hunter's Compass");
List<String> lore = new ArrayList<String>();
lore.add("A compass for the true hunter.");
lore.add("Legends tell of hunters that have");
lore.add("come back with great treasures and");
lore.add("much wealth from following the.");
lore.add("directions of the guided arrow.");
lore.add("");
lore.add("You may need to calibrate it by");
lore.add("right-clicking with it first.");
lore.add("");
lore.add("The compass appears to be slightly");
lore.add("unstable...");
m.setLore(lore);
temp.setItemMeta(m);
temp.addUnsafeEnchantment(Enchantment.LUCK, 1);
return new CustomItem(temp);
}
} }

View File

@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.WorldShopManager;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum ItemSet { public enum ItemSet {
@ -19,10 +20,12 @@ public enum ItemSet {
SONGSTEEL(4,2, 6,2, 8,4, 20,10), SONGSTEEL(4,2, 6,2, 8,4, 20,10),
DAWNTRACKER(4,4, 20,10, 20,10, 6,4), DAWNTRACKER(4,4, 20,10, 20,10, 6,4),
LORASYS(0,0, 0,0, 0,0, 0,0), LORASYS(0,0, 0,0, 0,0, 0,0),
JAMDAK(1,1, 3,9, 4,4, 10,5), JAMDAK(1,1, 5,1, 10,1, 10,2), //Graceful Dodge is in ticks.
DARNYS(2,1, 6,13, 5,5, 10,8), DARNYS(1,1, 10,5, 20,5, 1,1),
ALIKAHN(3,1, 9,15, 6,6, 10,10), ALIKAHN(1,1, 15,6, 30,10, 12,6),
LORASAADI(4,1, 12,17, 8,8, 10,15); LORASAADI(1,1, 1,1, 3,2, 2,1),
MOONSHADOW(4,1, 12,17, 8,8, 10,15),
GLADOMAIN(4,1, 12,17, 8,8, 10,15);
int baseval; int baseval;
int increase_val; int increase_val;
@ -75,8 +78,8 @@ public enum ItemSet {
return Integer.parseInt(lore.get(i).replace(ChatColor.GOLD+""+ChatColor.BOLD+"T", "").split(" ")[0]); return Integer.parseInt(lore.get(i).replace(ChatColor.GOLD+""+ChatColor.BOLD+"T", "").split(" ")[0]);
} }
} }
TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1);
} }
TwosideKeeper.log(ChatColor.RED+"[ERROR] Could not detect proper tier of "+item.toString()+"!", 1);
return 0; return 0;
} }
@ -304,14 +307,60 @@ public enum ItemSet {
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%."); lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%.");
}break; }break;
case JAMDAK: case JAMDAK: {
case DARNYS: lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
case ALIKAHN: lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Dodge Chance");
case LORASAADI:{ lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+(ItemSet.GetBaseAmount(set, tier, 4)/20d)+"s Graceful Dodge");
lore.add(ChatColor.GRAY+" Gives you invulnerability after a");
lore.add(ChatColor.GRAY+" successful dodge.");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%.");
}break;
case DARNYS: {
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:"); lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Damage Reduction"); lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Damage Reduction");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage Reduction");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" Swift Aegis "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 4)));
lore.add(ChatColor.GRAY+" Builds "+ItemSet.GetBaseAmount(set, tier, 4)+" stack"+((ItemSet.GetBaseAmount(set, tier, 4))!=1?"s":"")+" of Resistance every");
lore.add(ChatColor.GRAY+" 5 seconds of sprinting, and for every");
lore.add(ChatColor.GRAY+" Tumble. Each hit removes one stack of");
lore.add(ChatColor.GRAY+" Resistance. Caps at Resistance 10.");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%.");
}break;
case ALIKAHN: {
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Max Health");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Max Health");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+"+"+ItemSet.GetBaseAmount(set, tier, 4)+" Health Regen / 5 seconds");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");
lore.add(ChatColor.GRAY+" 1 -> 3 seconds");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Sniper Mode:");
lore.add(ChatColor.GRAY+" Increases Critical Damage by +100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Debilitation Mode:");
lore.add(ChatColor.GRAY+" Increases Armor Penetration by +50%.");
}break;
case LORASAADI:{
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage"); lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+" Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Max Health"); lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+" Execution Damage");
lore.add(ChatColor.DARK_AQUA+" per 20% Missing Health");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger"); lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Boosts All Modes of Ranger");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:"); lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Close Range Mode:");
lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from"); lore.add(ChatColor.GRAY+" Increases Tumble Invincibility from");

View File

@ -15,6 +15,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
import aPlugin.Drop;
import aPlugin.DropItem;
import aPlugin.DropMaterial;
import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.CustomDamage; import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.MonsterController; import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
@ -25,6 +29,91 @@ public class Loot {
static double HARDENED_ENCHANT_MULT = 1.4; static double HARDENED_ENCHANT_MULT = 1.4;
static int MAX_ENCHANT_LEVEL = 10; static int MAX_ENCHANT_LEVEL = 10;
//NORMAL: 100% Rate. (<=1000)
//RARE: 7.8% Rate. (<=78)
//LEGENDARY: 1.9% Rate. (<=19)
public static void DefineLootChests() {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.STONE_SWORD,8));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE),11));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,3,19));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,3,18));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,3,17));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_PEARL,3,19));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.ENDER_CHEST,19));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE),4));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.IRON_INGOT,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.DIAMOND,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.GOLD_NUGGET,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_HELMET,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_LEGGINGS,78));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropMaterial(Material.LEATHER_BOOTS,78));
aPlugin.API.Chests.LOOT_NORMAL.printDrops();
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_INGOT,1000));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BLOCK,78));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_LEGGINGS,78));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_BOOTS,78));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.IRON_HELMET,78));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_AXE,8));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_PICKAXE,8));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_HOE,8));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.STONE_SPADE,8));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropMaterial(Material.FISHING_ROD,8));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE),4));
aPlugin.API.Chests.LOOT_DANGEROUS.printDrops();
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_INGOT,2,1000));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND,1000));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_NUGGET,3,1000));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_BLOCK,2,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.GOLD_INGOT,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_AXE,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_PICKAXE,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_HOE,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.IRON_SPADE,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.FISHING_ROD,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropMaterial(Material.BOW,8));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_CORE),4));
aPlugin.API.Chests.LOOT_DEADLY.printDrops();
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD,3,1000));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND,3,1000));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_INGOT,3,1000));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.EMERALD_BLOCK,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,2,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BLOCK,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_SWORD,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_AXE,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_PICKAXE,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_HOE,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_SPADE,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.BOW,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.FISHING_ROD,8));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_LEGGINGS,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_BOOTS,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropMaterial(Material.GOLD_HELMET,78));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10));
aPlugin.API.Chests.LOOT_HELLFIRE.printDrops();
//aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10));
}
public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened) { public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened) {
return GenerateMegaPiece(mat_type, hardened, false); return GenerateMegaPiece(mat_type, hardened, false);
} }
@ -38,6 +127,7 @@ public class Loot {
} }
public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened, boolean setitem, int settier, Entity damager, Monster m) { public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened, boolean setitem, int settier, Entity damager, Monster m) {
TwosideKeeper.log("Calling this with "+mat_type.name()+","+hardened+","+setitem+".", 2);
ItemStack raresword = new ItemStack(mat_type); ItemStack raresword = new ItemStack(mat_type);
ItemMeta sword_meta = raresword.getItemMeta(); ItemMeta sword_meta = raresword.getItemMeta();
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type)); sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type));
@ -54,8 +144,9 @@ public class Loot {
raresword.setItemMeta(sword_meta); raresword.setItemMeta(sword_meta);
raresword = addEnchantments(raresword,true); raresword = addEnchantments(raresword,true);
} }
/* //LEGACY CODE.
if (setitem && (raresword.getType().toString().contains("SWORD") || GenericFunctions.isArmor(raresword))) { if (setitem && (raresword.getType().toString().contains("SWORD") || GenericFunctions.isArmor(raresword))) {
if (damager==null && m==null) { if (damager==null && m==null) {
raresword = GenerateSetPiece(raresword,hardened,settier); raresword = GenerateSetPiece(raresword,hardened,settier);
} else { } else {
@ -73,13 +164,13 @@ public class Loot {
MonsterDifficulty md = MonsterController.getMonsterDifficulty(m); MonsterDifficulty md = MonsterController.getMonsterDifficulty(m);
ItemSet set = null; ItemSet set = null;
if (p!=null) { if (p!=null) {
if (GenericFunctions.isStriker(p)) { if (PlayerMode.isStriker(p)) {
set=ItemSet.PANROS; set=ItemSet.PANROS;
} else } else
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
set = PickRandomRangerSet(); set = PickRandomRangerSet();
} else } else
if (GenericFunctions.isDefender(p)) { if (PlayerMode.isDefender(p)) {
set=ItemSet.SONGSTEEL; set=ItemSet.SONGSTEEL;
} else { } else {
//RANDOM SET! because we are not a mode of any sort. //RANDOM SET! because we are not a mode of any sort.
@ -101,33 +192,33 @@ public class Loot {
raresword = GenerateSetPiece(new ItemStack(Material.STONE_SWORD),hardened,settier+2); raresword = GenerateSetPiece(new ItemStack(Material.STONE_SWORD),hardened,settier+2);
}break; }break;
case DANGEROUS:{ case DANGEROUS:{
if (Math.random()<=0.2) { if (Math.random()<=0.1) {
if (GenericFunctions.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. if (PlayerMode.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires.
raresword = GenerateSetPiece(new ItemStack(Material.IRON_SWORD),set,(Math.random()<=0.1)?true:false,settier); raresword = GenerateSetPiece(new ItemStack(Material.IRON_SWORD),set,(Math.random()<=0.1)?true:false,settier);
} }
} else { } else {
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.IRON_HELMET),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.IRON_HELMET),set,hardened,settier+1);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.IRON_CHESTPLATE),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.IRON_CHESTPLATE),set,hardened,settier+1);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.IRON_LEGGINGS),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.IRON_LEGGINGS),set,hardened,settier+1);
} }
} else { } else {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.IRON_BOOTS),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.IRON_BOOTS),set,hardened,settier+1);
@ -136,33 +227,33 @@ public class Loot {
} }
}break; }break;
case DEADLY:{ case DEADLY:{
if (Math.random()<=0.2) { if (Math.random()<=0.1) {
if (GenericFunctions.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires. if (PlayerMode.isStriker(p)) { //Only do this weapon for all tiers since the other weapons don't have tiers. Those require hellfires.
raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_SWORD),set,(Math.random()<=0.1)?true:false,settier); raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_SWORD),set,(Math.random()<=0.1)?true:false,settier);
} }
} else { } else {
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_HELMET),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_HELMET),set,hardened,settier);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_CHESTPLATE),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_CHESTPLATE),set,hardened,settier);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_LEGGINGS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_LEGGINGS),set,hardened,settier);
} }
} else { } else {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_BOOTS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.DIAMOND_BOOTS),set,hardened,settier);
@ -171,31 +262,31 @@ public class Loot {
} }
}break; }break;
case HELLFIRE:{ case HELLFIRE:{
if (Math.random()<=0.2) { if (Math.random()<=0.1) {
raresword = GenerateSetPiece(new ItemStack(Material.GOLD_SWORD),set,(Math.random()<=0.1)?true:false,settier); raresword = GenerateSetPiece(new ItemStack(Material.GOLD_SWORD),set,(Math.random()<=0.1)?true:false,settier);
} else { } else {
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_HELMET),set,hardened,settier+1);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.GOLD_HELMET),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.GOLD_HELMET),set,hardened,settier);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_CHESTPLATE),set,hardened,settier+1);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.GOLD_CHESTPLATE),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.GOLD_CHESTPLATE),set,hardened,settier);
} }
} else } else
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_LEGGINGS),set,hardened,settier+1);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.GOLD_LEGGINGS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.GOLD_LEGGINGS),set,hardened,settier);
} }
} else { } else {
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier+1); raresword = GenerateSetPiece(new ItemStack(Material.LEATHER_BOOTS),set,hardened,settier+1);
} else { } else {
raresword = GenerateSetPiece(new ItemStack(Material.GOLD_BOOTS),set,hardened,settier); raresword = GenerateSetPiece(new ItemStack(Material.GOLD_BOOTS),set,hardened,settier);
@ -209,7 +300,7 @@ public class Loot {
} }
} }
} }
raresword = addEnchantments(raresword,hardened);*/
return raresword; return raresword;
} }
@ -355,6 +446,7 @@ public class Loot {
} }
public static ItemStack GenerateSetPiece(ItemStack item, ItemSet set, boolean hardened, int tierbonus) { public static ItemStack GenerateSetPiece(ItemStack item, ItemSet set, boolean hardened, int tierbonus) {
item = GenerateMegaPiece(item.getType(),hardened).clone();
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();
String set_name = ""; String set_name = "";
String prefix = ""; String prefix = "";

View File

@ -1,19 +1,25 @@
package sig.plugin.TwosideKeeper.HelperStructures; package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import aPlugin.API.Chests;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@ -223,6 +229,9 @@ public enum MonsterDifficulty {
} }
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger, Entity damager, Monster m) { public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger, Entity damager, Monster m) {
MonsterDifficulty diff = MonsterController.getMonsterDifficulty(m);
TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5); TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5);
List<ItemStack> droplist = new ArrayList<ItemStack>(); List<ItemStack> droplist = new ArrayList<ItemStack>();
dropmult += 1; //Base dropmult is 1.0. dropmult += 1; //Base dropmult is 1.0.
@ -236,185 +245,173 @@ public enum MonsterDifficulty {
//an additional roll.) //an additional roll.)
for (int i=0;i<dropmult;i++) { for (int i=0;i<dropmult;i++) {
TwosideKeeper.Loot_Logger.AddLootRoll(); TwosideKeeper.Loot_Logger.AddLootRoll();
//First do a common roll. TwosideKeeper.log("Attempting a roll...", 2);
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE && ItemStack goodie = null;
this.loot_regular.length>0) { if (Math.random()<=0.1 || isBoss) {
TwosideKeeper.log(">Attempting Common roll.", 4); TwosideKeeper.log("Inside!", 5);
//This is a common roll. switch (diff) {
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger, damager, m); case DANGEROUS:{
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); goodie=aPlugin.API.Chests.LOOT_DANGEROUS.getSingleDrop();
droplist.add(gen_loot); KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DANGEROUS, damager);
}break;
case DEADLY:{
goodie=aPlugin.API.Chests.LOOT_DEADLY.getSingleDrop();
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_DEADLY, damager);
}break;
case HELLFIRE:{
goodie=aPlugin.API.Chests.LOOT_HELLFIRE.getSingleDrop();
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_HELLFIRE, damager);
}break;
case ELITE:{
}break;
default:{
goodie=aPlugin.API.Chests.LOOT_NORMAL.getSingleDrop();
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_NORMAL, damager);
}
}
TwosideKeeper.Loot_Logger.AddCommonLoot(); TwosideKeeper.Loot_Logger.AddCommonLoot();
} ModifyAndAddDropToList(droplist,goodie,damager);
//Rare Loot roll.
if (Math.random()<TwosideKeeper.RARE_DROP_RATE &&
this.loot_rare.length>0) {
TwosideKeeper.log(">Attempting Rare roll.", 3);
//This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger, damager, m);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
double randomness = Math.random();
TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4);
if (randomness<=0.2) {
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 4);
switch (this) {
case DANGEROUS:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE));
break;
case DEADLY:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_ESSENCE));
break;
case HELLFIRE:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE));
break;
case ELITE:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE));
break;
case NORMAL:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE));
break;
default: {
TwosideKeeper.log("Invalid Monster Type!", 1);
}
}
}
TwosideKeeper.Loot_Logger.AddRareLoot();
}
//Legendary Loot roll.
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE &&
this.loot_legendary.length>0) {
TwosideKeeper.log(">Attempting Legendary roll.", 3);
//This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger, damager, m);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
double randomness = Math.random();
if (this.equals(MonsterDifficulty.HELLFIRE) || this.equals(MonsterDifficulty.ELITE)) {
if (randomness<=0.5) {
ItemStack hunters_compass = TwosideKeeper.HUNTERS_COMPASS.getItemStack();
droplist.add(hunters_compass);
}
}
randomness = Math.random();
TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4);
if (randomness<=0.2) {
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 4);
switch (this) {
case DANGEROUS:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE));
break;
case DEADLY:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.LOST_CORE));
break;
case HELLFIRE:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
break;
case ELITE:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
break;
case NORMAL:
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE));
break;
default: {
TwosideKeeper.log("Invalid Monster Type!", 1);
}
}
}
randomness = Math.random();
TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4);
if (randomness<=0.6) {
switch (this) {
case NORMAL:
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Mysterious Essence!", 4);
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE));
break;
}
}
TwosideKeeper.Loot_Logger.AddLegendaryLoot();
}
if (isBoss) { //50% of the time, we drop something great.
if (Math.random()<=0.5 && this.loot_legendary.length>0) {
TwosideKeeper.log(">Boss Legendary roll.", 1);
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger, damager, m);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
TwosideKeeper.Loot_Logger.AddLegendaryLoot();
}
else
if (this.loot_rare.length>0) { //Consolation Prize.
TwosideKeeper.log(">Boss Rare roll.", 1);
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger, damager, m);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
TwosideKeeper.Loot_Logger.AddRareLoot();
}
} }
} }
TwosideKeeper.log(" Drop List "+"["+(droplist.size())+"]: "+ChatColor.LIGHT_PURPLE+ChatColor.stripColor(droplist.toString()),5); TwosideKeeper.log("New Droplist: "+droplist.toString(), 5);
return droplist; return droplist;
} }
private ItemStack DistributeRandomLoot(LootStructure[] lootlist, boolean isRanger, Entity damager, Monster m) { public void KeepRollingForBosses(boolean isBoss, List<ItemStack> droplist, ItemStack goodie, Chests chest, Entity damager) {
//Choose an item randomly from the loot list. int roll=0;
if (lootlist.length>0) { while (isBoss && !GenericFunctions.isEquip(goodie) && roll<50) {
//Choose an element. goodie=chest.getSingleDrop();
LootStructure ls = lootlist[(int)((Math.random())*lootlist.length)]; ModifyAndAddDropToList(droplist,goodie,damager);
if (ls.GetMaterial()==Material.PRISMARINE_SHARD) { roll++;
ItemStack item = TwosideKeeper.UPGRADE_SHARD.getItemStack(); TwosideKeeper.Loot_Logger.AddCommonLoot();
return item;
}
if (ls.GetMaterial()==Material.POTION) {
//Create a Strengthing Vial.
if (Math.random()<=0.85) {
ItemStack item = TwosideKeeper.STRENGTHENING_VIAL.getItemStack();
return item;
} else if (Math.random()<=0.85) {
ItemStack item = TwosideKeeper.LIFE_VIAL.getItemStack();
return item;
} else {
ItemStack item = TwosideKeeper.HARDENING_VIAL.getItemStack();
return item;
}
}
if (ls.GetMinSetLevel()>0) {
//Make a set piece.
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),true,ls.GetMinSetLevel());
}
if (GenericFunctions.isEquip(new ItemStack(ls.GetMaterial()))) {
//Turn it into a Mega Piece.
if (GenericFunctions.isTool(new ItemStack(ls.GetMaterial()))) {
if (Math.random()<=0.1) {
if (Math.random()<=0.8) {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(), true, 0, damager, m);
} else {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false);
}
} else {
return new ItemStack(ls.GetMaterial(),1,(short)(Math.random()*ls.GetMaterial().getMaxDurability()));
}
} else {
/*if (ls.GetMaterial().toString().contains("LEATHER")) { //LEGACY CODE.
if (isRanger) {
return Loot.GenerateRangerPiece(ls.GetMaterial(), ls.GetHardened(), ls.GetAmount());
} else {
//Re-roll if a ranger did not kill, as we cannot reward ranger armor to non-rangers.
return DistributeRandomLoot(lootlist,isRanger);
}
} else {*/
if (Math.random()<=0.8) {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(), true, 0, damager, m);
} else {
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened(),false);
}
//} //LEGACY CODE.
}
} else {
//Turn it into a normal item.
return new ItemStack(ls.GetMaterial(),ls.GetAmount());
}
} else { //Something bad happened if we got here...
return new ItemStack(Material.AIR);
} }
} }
private void ModifyAndAddDropToList(List<ItemStack> droplist, ItemStack goodie, Entity damager) {
LivingEntity shooter = CustomDamage.getDamagerEntity(damager);
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (GenericFunctions.isEquip(goodie)) {
if (Math.random()<0.8 && isValidSetItem(goodie)) {
//Convert it to a set piece.
PlayerMode pm = PlayerMode.getPlayerMode(p);
ItemSet set = PickAnItemSet(pm);
goodie = ConvertSetPieceIfNecessary(goodie, set);
goodie = Loot.GenerateSetPiece(goodie.getType(), set, (Math.random()<0.1)?true:false, 0);
} else {
//Convert it to a mega piece.
PlayerMode pm = PlayerMode.getPlayerMode(p);
goodie = Loot.GenerateMegaPiece(goodie.getType(), (Math.random()<0.1)?true:false);
}
}
}
TwosideKeeper.log("Adding item "+goodie, 2);
droplist.add(goodie);
}
private ItemStack ConvertSetPieceIfNecessary(ItemStack goodie, ItemSet set) {
if ((set==ItemSet.JAMDAK ||
set==ItemSet.ALIKAHN ||
set==ItemSet.DARNYS ||
set==ItemSet.LORASAADI) &&
!goodie.getType().name().contains("LEATHER") &&
GenericFunctions.isArmor(goodie)) {
goodie.setType(Material.valueOf("LEATHER_"+goodie.getType().name().split("_")[1]));
} else
if (goodie.getType().name().contains("LEATHER") &&
!(set==ItemSet.JAMDAK ||
set==ItemSet.ALIKAHN ||
set==ItemSet.DARNYS ||
set==ItemSet.LORASAADI) &&
GenericFunctions.isArmor(goodie)) {
goodie.setType(Material.valueOf("IRON_"+goodie.getType().name().split("_")[1]));
}
return goodie;
}
private boolean isValidSetItem(ItemStack goodie) {
return TwosideKeeper.validsetitems.contains(goodie.getType());
}
public ItemSet PickAnItemSet(PlayerMode pm) {
ItemSet set;
switch (pm) {
case STRIKER:{
set = ItemSet.PANROS;
}break;
case DEFENDER:{
set = ItemSet.SONGSTEEL;
}break;
case BARBARIAN:{
set = ItemSet.DAWNTRACKER;
}break;
case RANGER:{
final int NUMBER_OF_MODES=4;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
set = ItemSet.JAMDAK;
} else
if (selectweight<100) {
set = ItemSet.ALIKAHN;
} else
if (selectweight<150) {
set = ItemSet.DARNYS;
} else
{
set = ItemSet.LORASAADI;
}
}break;
case SLAYER:{
final int NUMBER_OF_MODES=3;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
set = ItemSet.LORASYS;
} else
if (selectweight<100) {
set = ItemSet.MOONSHADOW;
} else
{
set = ItemSet.GLADOMAIN;
}
}break;
default:{
set = PickRandomSet();
}
}
return set;
}
private ItemSet PickRandomSet() {
final int NUMBER_OF_MODES=4;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
return ItemSet.PANROS;
} else
if (selectweight<100) {
return ItemSet.SONGSTEEL;
} else
if (selectweight<150) {
return ItemSet.DAWNTRACKER;
} else
if (selectweight<200) {
//12.5 per set type.
if (selectweight<162.5) {
return ItemSet.JAMDAK;
} else
if (selectweight<175) {
return ItemSet.ALIKAHN;
} else
if (selectweight<187.5) {
return ItemSet.DARNYS;
} else
if (selectweight<200) {
return ItemSet.LORASAADI;
}
}
return ItemSet.PANROS;
}
} }

View File

@ -0,0 +1,127 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum PlayerMode {
STRIKER(ChatColor.RED,"S","Striker"),
RANGER(ChatColor.GREEN,"R","Ranger"),
DEFENDER(ChatColor.GRAY,"D","Defender"),
BARBARIAN(ChatColor.GOLD,"B","Barbarian"),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer"),
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner"),
NORMAL(ChatColor.WHITE,"","");
;
final public static int UPDATE_GRACE_PERIOD=9; //How often to update the mode of the player.
ChatColor col=ChatColor.WHITE;
String symbol="";
public ChatColor getColor() {
return col;
}
public String getAbbreviation() {
return symbol;
}
public String getName() {
return name;
}
public static PlayerMode getPlayerMode(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (isStriker(p)) {
pd.lastmode=PlayerMode.STRIKER;
} else
if (isDefender(p)) {
pd.lastmode=PlayerMode.DEFENDER;
} else
if (isRanger(p)) {
pd.lastmode=PlayerMode.RANGER;
} else {
pd.lastmode=PlayerMode.NORMAL;
}
return pd.lastmode;
} else {
return pd.lastmode;
}
}
public static boolean needsUpdating(PlayerStructure pd) {
return pd.lastmodeupdate+UPDATE_GRACE_PERIOD<=TwosideKeeper.getServerTickTime();
}
public static boolean isRanger(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if ((((p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow in main hand.
(p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && p.getInventory().getExtraContents()[0]!=null && !GenericFunctions.isEquip(p.getInventory().getExtraContents()[0])) || /*Satisfy a bow 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) || /*Satisfy a bow 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)) /*Satisfy just a bow in off-hand.*/ &&
GenericFunctions.AllLeatherArmor(p))) {
return true;
} else {
return false;
}
} else {
return pd.lastmode==PlayerMode.RANGER;
}
} else {
return false;
}
}
public static boolean isDefender(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.SHIELD) {
return true;
} else {
return false;
}
} else {
return pd.lastmode==PlayerMode.DEFENDER;
}
} else {
return false;
}
}
public static boolean isStriker(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType().toString().contains("SWORD") &&
p.getInventory().getExtraContents()[0]==null) {
return true;
} else {
return false;
}
} else {
return pd.lastmode==PlayerMode.STRIKER;
}
} else {
return false;
}
}
String name="";
PlayerMode(ChatColor col, String abbreviation, String fullname) {
this.col=col;
this.symbol=abbreviation;
this.name=fullname;
}
}

View File

@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.WorldShopManager; import sig.plugin.TwosideKeeper.WorldShopManager;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;

View File

@ -171,6 +171,7 @@ public class MonsterController {
* Lv2: Iron/Diamond Armor. * Lv2: Iron/Diamond Armor.
* Lv3: Diamond Armor. * Lv3: Diamond Armor.
*/ */
m.setCanPickupItems(false);
switch (lv) { switch (lv) {
case 1:{ case 1:{
if (Math.random()<0.5) { if (Math.random()<0.5) {

View File

@ -22,6 +22,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure; import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
import sig.plugin.TwosideKeeper.Logging.DamageLogger; import sig.plugin.TwosideKeeper.Logging.DamageLogger;
@ -97,6 +98,10 @@ public class PlayerStructure {
public String lasthitdesc=""; public String lasthitdesc="";
public double lastdamagetaken=0; public double lastdamagetaken=0;
public double lastrawdamage=0; public double lastrawdamage=0;
public long lastmodeupdate=0;
public long lastsprintcheck=0;
public int swiftaegisamt=0;
public PlayerMode lastmode=PlayerMode.NORMAL;
public long iframetime = 0; public long iframetime = 0;

View File

@ -194,7 +194,7 @@ public class RecyclingCenter {
} }
c.getBlockInventory().setItem(itemslot, i.getItemStack()); c.getBlockInventory().setItem(itemslot, i.getItemStack());
populateItemList(i.getItemStack()); populateItemList(i.getItemStack());
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i.getItemStack())+((i.getItemStack().getAmount()>1)?ChatColor.YELLOW+" x"+i.getItemStack().getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),3); TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i.getItemStack())+((i.getItemStack().getAmount()>1)?ChatColor.YELLOW+" x"+i.getItemStack().getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2);
} }
} }
} }

View File

@ -112,6 +112,7 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.inventory.PrepareAnvilEvent; import org.bukkit.event.inventory.PrepareAnvilEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
@ -138,6 +139,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleCreateEvent;
@ -175,6 +177,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import aPlugin.DiscordMessageSender; import aPlugin.DiscordMessageSender;
import events.PluginLoadEvent;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
@ -195,19 +198,17 @@ import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem; import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
import sig.plugin.TwosideKeeper.HelperStructures.CustomPotion; import sig.plugin.TwosideKeeper.HelperStructures.CustomPotion;
import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe; import sig.plugin.TwosideKeeper.HelperStructures.CustomRecipe;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
import sig.plugin.TwosideKeeper.HelperStructures.ItemRarity;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest; import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.Pronouns; import sig.plugin.TwosideKeeper.HelperStructures.Pronouns;
import sig.plugin.TwosideKeeper.HelperStructures.QuestStatus; import sig.plugin.TwosideKeeper.HelperStructures.QuestStatus;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
import sig.plugin.TwosideKeeper.HelperStructures.SessionState; import sig.plugin.TwosideKeeper.HelperStructures.SessionState;
import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena; import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena;
import sig.plugin.TwosideKeeper.HelperStructures.UpgradePath;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession; import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@ -260,10 +261,97 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static int COMMONITEMPCT=3; public static int COMMONITEMPCT=3;
public static long LAST_ELITE_SPAWN = 0; public static long LAST_ELITE_SPAWN = 0;
public static Location ELITE_LOCATION = null; public static Location ELITE_LOCATION = null;
public static boolean LOOT_TABLE_NEEDS_POPULATING=true;
public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>(); public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
public static CustomItem HUNTERS_COMPASS; public static CustomItem HUNTERS_COMPASS;
public static CustomItem UPGRADE_SHARD; public static CustomItem UPGRADE_SHARD;
public static CustomItem ITEM_CUBE;
public static CustomItem LARGE_ITEM_CUBE;
public static CustomItem ENDER_ITEM_CUBE;
public static CustomItem DUPLICATE_ENDER_ITEM_CUBE;
public static CustomItem ARROW_QUIVER;
public static CustomItem HARDENED_IRON_HELMET;
public static CustomItem HARDENED_IRON_CHESTPLATE;
public static CustomItem HARDENED_IRON_LEGGINGS;
public static CustomItem HARDENED_IRON_BOOTS;
public static CustomItem HARDENED_DIAMOND_HELMET;
public static CustomItem HARDENED_DIAMOND_CHESTPLATE;
public static CustomItem HARDENED_DIAMOND_LEGGINGS;
public static CustomItem HARDENED_DIAMOND_BOOTS;
public static CustomItem HARDENED_GOLD_HELMET;
public static CustomItem HARDENED_GOLD_CHESTPLATE;
public static CustomItem HARDENED_GOLD_LEGGINGS;
public static CustomItem HARDENED_GOLD_BOOTS;
public static CustomItem WOOL_RECOLOR;
public static CustomItem SLAB_RECONSTRUCTION;
public static CustomItem ARTIFACT_RECIPE_T1;
public static CustomItem ARTIFACT_RECIPE_T2;
public static CustomItem ARTIFACT_RECIPE_T3;
public static CustomItem ARTIFACT_RECIPE_T4;
public static CustomItem ARTIFACT_RECIPE_T5;
public static CustomItem ARTIFACT_RECIPE_T6;
public static CustomItem ARTIFACT_RECIPE_T7;
public static CustomItem ARTIFACT_RECIPE_T8;
public static CustomItem ARTIFACT_RECIPE_T9;
public static CustomItem ARTIFACT_RECIPE_T10;
public static CustomItem ARTIFACT_RECIPE_T11;
public static CustomItem ARTIFACT_RECIPE_T12;
public static CustomItem ARTIFACT_RECIPE_T13;
public static CustomItem ARTIFACT_RECIPE_T14;
public static CustomItem ARTIFACT_RECIPE_T15;
public static CustomItem INCREASE_ARTIFACT_CRAFTING_TIER;
public static CustomItem DECREASE_ARTIFACT_CRAFTING_TIER;
public static CustomItem EMPOWER_ARTIFACT_CRAFTING_ITEM;
public static CustomItem MONEY_CHECK;
public static CustomItem HANDMADE_ARROW;
public static CustomItem DIAMONDTIPPED_ARROW;
public static CustomItem POISON_ARROW;
public static CustomItem TRAPPING_ARROW;
public static CustomItem EXPLODING_ARROW;
public static ShapedRecipe ITEM_CUBE_RECIPE;
public static ShapedRecipe LARGE_ITEM_CUBE_RECIPE;
public static ShapedRecipe ENDER_ITEM_CUBE_RECIPE;
public static ShapedRecipe DUPLICATE_ENDER_ITEM_CUBE_RECIPE;
public static ShapedRecipe ARROW_QUIVER_RECIPE;
public static ShapedRecipe HARDENED_IRON_HELMET_RECIPE;
public static ShapedRecipe HARDENED_IRON_CHESTPLATE_RECIPE;
public static ShapedRecipe HARDENED_IRON_LEGGINGS_RECIPE;
public static ShapedRecipe HARDENED_IRON_BOOTS_RECIPE;
public static ShapedRecipe HARDENED_DIAMOND_HELMET_RECIPE;
public static ShapedRecipe HARDENED_DIAMOND_CHESTPLATE_RECIPE;
public static ShapedRecipe HARDENED_DIAMOND_LEGGINGS_RECIPE;
public static ShapedRecipe HARDENED_DIAMOND_BOOTS_RECIPE;
public static ShapedRecipe HARDENED_GOLD_HELMET_RECIPE;
public static ShapedRecipe HARDENED_GOLD_CHESTPLATE_RECIPE;
public static ShapedRecipe HARDENED_GOLD_LEGGINGS_RECIPE;
public static ShapedRecipe HARDENED_GOLD_BOOTS_RECIPE;
public static ShapedRecipe WOOL_RECOLOR_RECIPE;
public static ShapedRecipe SLAB_RECONSTRUCTION_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T1_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T2_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T3_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T4_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T5_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T6_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T7_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T8_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T9_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T10_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T11_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T12_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T13_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T14_RECIPE;
public static ShapedRecipe ARTIFACT_RECIPE_T15_RECIPE;
public static ShapedRecipe INCREASE_ARTIFACT_CRAFTING_TIER_RECIPE;
public static ShapedRecipe DECREASE_ARTIFACT_CRAFTING_TIER_RECIPE;
public static ShapedRecipe EMPOWER_ARTIFACT_CRAFTING_ITEM_RECIPE;
public static ShapedRecipe MONEY_CHECK_RECIPE;
public static ShapedRecipe HANDMADE_ARROW_RECIPE;
public static ShapedRecipe DIAMONDTIPPED_ARROW_RECIPE;
public static ShapedRecipe POISON_ARROW_RECIPE;
public static ShapedRecipe TRAPPING_ARROW_RECIPE;
public static ShapedRecipe EXPLODING_ARROW_RECIPE;
public static CustomPotion STRENGTHENING_VIAL; public static CustomPotion STRENGTHENING_VIAL;
public static CustomPotion LIFE_VIAL; public static CustomPotion LIFE_VIAL;
public static CustomPotion HARDENING_VIAL; public static CustomPotion HARDENING_VIAL;
@ -303,6 +391,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static Plugin plugin; public static Plugin plugin;
public int sleepingPlayers=0; public int sleepingPlayers=0;
public static List<Material> validsetitems = new ArrayList<Material>();
boolean reloadedchunk=false; boolean reloadedchunk=false;
@ -409,14 +498,35 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
banksessions = new HashMap(); banksessions = new HashMap();
monsterdata = new HashMap<UUID,MonsterStructure>(); monsterdata = new HashMap<UUID,MonsterStructure>();
validsetitems.add(Material.LEATHER_BOOTS);
validsetitems.add(Material.LEATHER_CHESTPLATE);
validsetitems.add(Material.LEATHER_HELMET);
validsetitems.add(Material.LEATHER_LEGGINGS);
validsetitems.add(Material.IRON_BOOTS);
validsetitems.add(Material.IRON_CHESTPLATE);
validsetitems.add(Material.IRON_HELMET);
validsetitems.add(Material.IRON_LEGGINGS);
validsetitems.add(Material.DIAMOND_BOOTS);
validsetitems.add(Material.DIAMOND_CHESTPLATE);
validsetitems.add(Material.DIAMOND_HELMET);
validsetitems.add(Material.DIAMOND_LEGGINGS);
validsetitems.add(Material.GOLD_BOOTS);
validsetitems.add(Material.GOLD_CHESTPLATE);
validsetitems.add(Material.GOLD_HELMET);
validsetitems.add(Material.GOLD_LEGGINGS);
validsetitems.add(Material.STONE_SWORD);
validsetitems.add(Material.IRON_SWORD);
validsetitems.add(Material.DIAMOND_SWORD);
validsetitems.add(Material.GOLD_SWORD);
TEMPORARYABILITIES.add(ArtifactAbility.GREED); TEMPORARYABILITIES.add(ArtifactAbility.GREED);
TEMPORARYABILITIES.add(ArtifactAbility.SURVIVOR); TEMPORARYABILITIES.add(ArtifactAbility.SURVIVOR);
HUNTERS_COMPASS = DefineHuntersCompass(); HUNTERS_COMPASS = CustomRecipe.DefineHuntersCompass();
UPGRADE_SHARD = DefineUpgradeShard(); UPGRADE_SHARD = CustomRecipe.DefineUpgradeShard();
STRENGTHENING_VIAL = DefineStrengtheningVial(); STRENGTHENING_VIAL = CustomRecipe.DefineStrengtheningVial();
LIFE_VIAL = DefineLifeVial(); LIFE_VIAL = CustomRecipe.DefineLifeVial();
HARDENING_VIAL = DefineHardeningVial(); HARDENING_VIAL = CustomRecipe.DefineHardeningVial();
//tpstracker = new Lag(); //tpstracker = new Lag();
//Let's not assume there are no players online. Load their data. //Let's not assume there are no players online. Load their data.
@ -427,6 +537,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player p; Player p;
//Announce the server has restarted soon after. //Announce the server has restarted soon after.
if (!LOOT_TABLE_NEEDS_POPULATING) {
Loot.DefineLootChests();
}
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){
for (Player p : Bukkit.getOnlinePlayers()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
PlayerMode.getPlayerMode(p);
}
}
},0l,10l);
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){ public void run(){
//Control charge zombies.. //Control charge zombies..
@ -653,6 +777,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
pd.debuffcount=GenericFunctions.CountDebuffs(p); pd.debuffcount=GenericFunctions.CountDebuffs(p);
if (p.isSprinting() && pd.lastsprintcheck+(20*5)<getServerTickTime()) {
pd.lastsprintcheck=getServerTickTime();
GenericFunctions.ApplySwiftAegis(p);
}
if (banksessions.containsKey(p.getUniqueId())) { if (banksessions.containsKey(p.getUniqueId())) {
//See if it expired. //See if it expired.
BankSession bs = (BankSession)banksessions.get(p.getUniqueId()); BankSession bs = (BankSession)banksessions.get(p.getUniqueId());
@ -723,6 +852,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4);
totalregen += bonusregen; totalregen += bonusregen;
@ -942,105 +1073,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}, 20l, 20l); }, 20l, 20l);
} }
private CustomPotion DefineHardeningVial() {
ItemStack HARDENING_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)HARDENING_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Hardening Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
HARDENING_VIAL.setItemMeta(pm);
return new CustomPotion(HARDENING_VIAL,effects,6,9);
}
private CustomPotion DefineLifeVial() {
ItemStack LIFE_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.ABSORPTION,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)LIFE_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Life Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
LIFE_VIAL.setItemMeta(pm);
return new CustomPotion(LIFE_VIAL,effects,50,100);
}
private CustomPotion DefineStrengtheningVial() {
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
List<PotionEffect> effects = new ArrayList<PotionEffect>();
effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,0));
List<String> lore = new ArrayList<String>();
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
pm.setLore(lore);
pm.setDisplayName(ChatColor.GREEN+"Strengthing Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
STRENGTHENING_VIAL.setItemMeta(pm);
return new CustomPotion(STRENGTHENING_VIAL,effects,20,40);
/*//LEGACY CODE
ItemStack STRENGTHENING_VIAL = new ItemStack(Material.POTION);
PotionMeta pm = (PotionMeta)STRENGTHENING_VIAL.getItemMeta();
int val=(int)(Math.random()*20+20);
pm.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,20*60*15,val+1), true);
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY+"Strength "+WorldShop.toRomanNumeral(val)+" ("+WorldShop.toReadableDuration(20*60*15)+")");
lore.add("");
lore.add("A fantastic potion, it comes straight");
lore.add("from the elixir of the gods.");
pm.setLore(lore);
pm.setDisplayName("Strengthing Vial");
pm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
STRENGTHENING_VIAL.setItemMeta(pm);
return new CustomItem(STRENGTHENING_VIAL);*/
}
private CustomItem DefineUpgradeShard() {
ItemStack UPGRADE_SHARD = new ItemStack(Material.PRISMARINE_SHARD);
ItemMeta meta = UPGRADE_SHARD.getItemMeta();
meta.setDisplayName(ChatColor.GREEN+"Upgrade Shard");
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
List<String> UPGRADE_SHARD_lore = new ArrayList<String>();
UPGRADE_SHARD_lore.add("An eerie glow radiates from");
UPGRADE_SHARD_lore.add("this item. It seems to possess");
UPGRADE_SHARD_lore.add("some other-worldly powers.");
meta.setLore(UPGRADE_SHARD_lore);
UPGRADE_SHARD.setItemMeta(meta);
UPGRADE_SHARD.addUnsafeEnchantment(Enchantment.LUCK, 1);
return new CustomItem(UPGRADE_SHARD);
}
private CustomItem DefineHuntersCompass() {
ItemStack temp = new ItemStack(Material.COMPASS);
temp.addUnsafeEnchantment(Enchantment.LUCK, 1);
ItemMeta m = temp.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
m.setDisplayName(ChatColor.RED+"Hunter's Compass");
List<String> lore = new ArrayList<String>();
lore.add("A compass for the true hunter.");
lore.add("Legends tell of hunters that have");
lore.add("come back with great treasures and");
lore.add("much wealth from following the.");
lore.add("directions of the guided arrow.");
lore.add("");
lore.add("You may need to calibrate it by");
lore.add("right-clicking with it first.");
lore.add("");
lore.add("The compass appears to be slightly");
lore.add("unstable...");
m.setLore(lore);
temp.setItemMeta(m);
temp.addUnsafeEnchantment(Enchantment.LUCK, 1);
return new CustomItem(temp);
}
@Override @Override
public void onDisable() { public void onDisable() {
// TODO Insert logic to be performed when the plugin is disabled // TODO Insert logic to be performed when the plugin is disabled
@ -1126,7 +1158,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (p.getLocation().add(0,0,0).getBlock().getType()==Material.PISTON_MOVING_PIECE) { if (p.getLocation().add(0,0,0).getBlock().getType()==Material.PISTON_MOVING_PIECE) {
p.getLocation().add(0,0,0).getBlock().setType(Material.AIR); p.getLocation().add(0,0,0).getBlock().setType(Material.AIR);
} }
if (SERVER_TYPE==ServerType.TEST || SERVER_TYPE==ServerType.QUIET || p.isOp()) { if (SERVER_TYPE==ServerType.TEST && p.isOp()) {
/*PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); /*PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.swordcombo=20;*/ pd.swordcombo=20;*/
/*float f = ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().getAbsorptionHearts(); /*float f = ((org.bukkit.craftbukkit.v1_9_R1.entity.CraftLivingEntity)p).getHandle().getAbsorptionHearts();
@ -1432,12 +1464,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}*/ // }*/ //
if (!msg.equalsIgnoreCase("")) { if (!msg.equalsIgnoreCase("")) {
if (SERVER_TYPE==ServerType.MAIN) { if (SERVER_TYPE==ServerType.MAIN) {
DiscordMessageSender.sendItalicizedRawMessageDiscord(SERVER_TYPE.GetServerName()+msg); aPlugin.API.discordSendRawItalicized(SERVER_TYPE.GetServerName()+msg);
} }
Bukkit.broadcastMessage(msg); Bukkit.broadcastMessage(msg);
} }
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onServerCommand(PluginLoadEvent ev) {
//log("Called",2);
LOOT_TABLE_NEEDS_POPULATING=false;
Loot.DefineLootChests();
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onWorldSave(WorldSaveEvent ev) { public void onWorldSave(WorldSaveEvent ev) {
if (ev.getWorld().getName().equalsIgnoreCase("world")) { if (ev.getWorld().getName().equalsIgnoreCase("world")) {
@ -1495,7 +1534,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
if (Bukkit.getOnlinePlayers().size()==0 && restarting_server) { if (Bukkit.getOnlinePlayers().size()==0 && restarting_server) {
Bukkit.savePlayers(); Bukkit.savePlayers();
DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down..."); aPlugin.API.discordSendRawItalicized("All players have disconnected. Server is shutting down...");
for (int i=0;i<Bukkit.getWorlds().size();i++) { for (int i=0;i<Bukkit.getWorlds().size();i++) {
Bukkit.getWorlds().get(i).save(); Bukkit.getWorlds().get(i).save();
} }
@ -2069,13 +2108,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
pos = ev.getMessage().indexOf("[]"); pos = ev.getMessage().indexOf("[]");
ev.setMessage(ev.getMessage().replace("[]", "")); ev.setMessage(ev.getMessage().replace("[]", ""));
log("pos is "+pos+" message is: {"+ev.getMessage()+"}",5); log("pos is "+pos+" message is: {"+ev.getMessage()+"}",5);
DiscordMessageSender.sendRawMessageDiscord(("**"+ev.getPlayer().getName()+"** "+ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos))); //aPlugin.API.discordSendRaw(("**"+ev.getPlayer().getName()+"** "+ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos)));
aPlugin.API.discordSendChat(ev.getPlayer().getName(), ev.getMessage().substring(0, pos)+"**["+ChatColor.stripColor(GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand()))+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+"]**"+"\n```"+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand())+" ```\n"+ev.getMessage().substring(pos));
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\"<"+ev.getPlayer().getName()+"> \"},{\"text\":\""+ev.getMessage().substring(0, pos)+"\"},{\"text\":\""+ChatColor.GREEN+"["+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+ChatColor.RESET+ChatColor.YELLOW+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+ChatColor.GREEN+"]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+""+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand()).replace("\"", "\\\"")+"\"}},{\"text\":\""+ev.getMessage().substring(pos)+"\"}]"); Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\"<"+ev.getPlayer().getName()+"> \"},{\"text\":\""+ev.getMessage().substring(0, pos)+"\"},{\"text\":\""+ChatColor.GREEN+"["+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+ChatColor.RESET+ChatColor.YELLOW+((ev.getPlayer().getEquipment().getItemInMainHand().getAmount()>1)?" x"+ev.getPlayer().getEquipment().getItemInMainHand().getAmount():"")+ChatColor.GREEN+"]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+GenericFunctions.GetItemName(ev.getPlayer().getEquipment().getItemInMainHand())+""+WorldShop.GetItemInfo(ev.getPlayer().getEquipment().getItemInMainHand()).replace("\"", "\\\"")+"\"}},{\"text\":\""+ev.getMessage().substring(pos)+"\"}]");
ev.setCancelled(true); ev.setCancelled(true);
} }
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]"); //Bukkit.dispatchCommand(Bukkit.getConsoleSender(),"tellraw @a [\"\",{\"text\":\""+ChatColor.GREEN+"[Item]"+ChatColor.WHITE+"\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""+(ev.getPlayer().getEquipment().getItemInMainHand().getType())+"\"}},{\"text\":\" "+ev.getMessage().substring(0, pos)+" \"}]");
} }
} }
} }
@ -2221,7 +2260,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|| ev.getAction()==Action.LEFT_CLICK_BLOCK || ev.getAction()==Action.LEFT_CLICK_BLOCK
|| ev.getAction()==Action.LEFT_CLICK_AIR) { || ev.getAction()==Action.LEFT_CLICK_AIR) {
Player p = ev.getPlayer(); Player p = ev.getPlayer();
if (GenericFunctions.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) { if (PlayerMode.isRanger(p) && p.isSneaking() && p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
//Rotate Bow Modes. //Rotate Bow Modes.
p.removePotionEffect(PotionEffectType.SLOW); p.removePotionEffect(PotionEffectType.SLOW);
BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand()); BowMode mode = GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand());
@ -2264,7 +2303,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Check for a Sword left click. //Check for a Sword left click.
if (ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK) { if (ev.getAction()==Action.LEFT_CLICK_AIR || ev.getAction()==Action.LEFT_CLICK_BLOCK) {
Player p = ev.getPlayer(); Player p = ev.getPlayer();
if (GenericFunctions.isStriker(p)) { if (PlayerMode.isStriker(p)) {
//Check for nearby arrows to deflect. //Check for nearby arrows to deflect.
List<Entity> nearby = p.getNearbyEntities(3.5, 3.5, 3.5); List<Entity> nearby = p.getNearbyEntities(3.5, 3.5, 3.5);
for (int i=0;i<nearby.size();i++) { for (int i=0;i<nearby.size();i++) {
@ -2334,7 +2373,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
if (player.isBlocking()) { if (player.isBlocking()) {
//Give absorption hearts. //Give absorption hearts.
if (GenericFunctions.isDefender(player)) { if (PlayerMode.isDefender(player)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,1)); player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,200,1));
List<Entity> entities = player.getNearbyEntities(16, 16, 16); List<Entity> entities = player.getNearbyEntities(16, 16, 16);
for (int i=0;i<entities.size();i++) { for (int i=0;i<entities.size();i++) {
@ -2856,6 +2895,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
double dmg = GenericFunctions.getAbilityValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand()); double dmg = GenericFunctions.getAbilityValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand());
//Look for nearby mobs up to 10 blocks away. //Look for nearby mobs up to 10 blocks away.
List<Entity> nearby = player.getNearbyEntities(10, 10, 10); List<Entity> nearby = player.getNearbyEntities(10, 10, 10);
boolean reset=false;
for (int i=0;i<nearby.size();i++) { for (int i=0;i<nearby.size();i++) {
if (nearby.get(i) instanceof Monster) { if (nearby.get(i) instanceof Monster) {
Monster m = (Monster)nearby.get(i); Monster m = (Monster)nearby.get(i);
@ -2863,19 +2903,28 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//This has stacks, burst! //This has stacks, burst!
bursted=true; bursted=true;
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240); aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 240);
pd.last_deathmark = getServerTickTime(); pd.last_deathmark = getServerTickTime();
int stackamt = GenericFunctions.GetDeathMarkAmt(m); int stackamt = GenericFunctions.GetDeathMarkAmt(m);
m.setLastDamage(0);
m.setNoDamageTicks(0);
m.setMaximumNoDamageTicks(0);
//GenericFunctions.DealDamageToMob(stackamt*dmg, m, player, null, "Death Mark"); //GenericFunctions.DealDamageToMob(stackamt*dmg, m, player, null, "Death Mark");
GenericFunctions.removeNoDamageTick(m, player);
CustomDamage.ApplyDamage(stackamt*dmg, player, m, null, "Death Mark", CustomDamage.TRUEDMG); CustomDamage.ApplyDamage(stackamt*dmg, player, m, null, "Death Mark", CustomDamage.TRUEDMG);
m.removePotionEffect(PotionEffectType.UNLUCK); if (m.getHealth()<=0 || m.isDead()) {
reset=true;
}
if (stackamt<5) {
m.removePotionEffect(PotionEffectType.UNLUCK);
} else {
m.addPotionEffect(new PotionEffect(PotionEffectType.UNLUCK,99,stackamt/2),true);
GenericFunctions.ApplyDeathMark(m);
}
player.playSound(m.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f); player.playSound(m.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1.0f, 1.0f);
} }
} }
} }
if (reset) {
pd.last_deathmark = getServerTickTime()-DEATHMARK_COOLDOWN+20;
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 20);
}
} }
} }
return bursted; return bursted;
@ -3160,6 +3209,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void togglesprint(PlayerToggleSprintEvent ev) {
//log("Toggled: "+ev.isSprinting(),2);
if (ev.isSprinting()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
pd.lastsprintcheck=getServerTickTime();
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onPlayerDropItem(PlayerDropItemEvent ev) { public void onPlayerDropItem(PlayerDropItemEvent ev) {
@ -3355,16 +3413,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
amounttotake = diff; amounttotake = diff;
givePlayerBankMoney(p,-amounttotake); givePlayerBankMoney(p,-amounttotake);
} }
deathloc.getWorld().loadChunk(deathloc.getChunk()); Inventory contents = Bukkit.createInventory(p, 45);
log("Contents list includes ",2);
for (int i=0;i<p.getOpenInventory().getTopInventory().getSize();i++) { for (int i=0;i<p.getOpenInventory().getTopInventory().getSize();i++) {
if (p.getOpenInventory().getTopInventory().getItem(i)!=null && if (p.getOpenInventory().getTopInventory().getItem(i)!=null) {
p.getOpenInventory().getTopInventory().getItem(i).getType()!=Material.AIR) { //p.sendMessage("Saving item "+p.getOpenInventory().getTopInventory().getItem(i).toString()+" in slot "+i);
Item it = deathloc.getWorld().dropItemNaturally(deathloc, p.getOpenInventory().getTopInventory().getItem(i)); log(p.getOpenInventory().getTopInventory().getItem(i).toString(),2);
it.setInvulnerable(true); contents.addItem(p.getOpenInventory().getTopInventory().getItem(i));
log("Dropping "+p.getOpenInventory().getTopInventory().getItem(i).toString()+" at Death location "+deathloc,3); } else {
//p.sendMessage("Saving item AIR in slot "+i);
contents.addItem(new ItemStack(Material.AIR));
} }
} }
DeathManager.removeDeathStructure(p); log("-------",2);
Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,contents,deathloc),1);
} }
PlayerStructure pd = (PlayerStructure) playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure) playerdata.get(p.getUniqueId());
@ -3415,6 +3478,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
public void AttemptToDropItems(Player p, Location deathloc) {
deathloc.getWorld().loadChunk(deathloc.getChunk());
if (deathloc.getChunk().isLoaded()) {
for (int i=0;i<p.getOpenInventory().getTopInventory().getSize();i++) {
if (p.getOpenInventory().getTopInventory().getItem(i)!=null &&
p.getOpenInventory().getTopInventory().getItem(i).getType()!=Material.AIR) {
Item it = deathloc.getWorld().dropItemNaturally(deathloc, p.getOpenInventory().getTopInventory().getItem(i));
it.setInvulnerable(true);
log("Dropping "+p.getOpenInventory().getTopInventory().getItem(i).toString()+" at Death location "+deathloc,2);
}
}
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent ev) { public void onInventoryDrag(InventoryDragEvent ev) {
//You are not allowed to drag arrow quivers. //You are not allowed to drag arrow quivers.
@ -3510,12 +3587,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(player.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(player.getUniqueId());
pd.isViewingInventory=true; pd.isViewingInventory=true;
log("Raw Slot Clicked: "+ev.getRawSlot(),5); //5,6,7,8 for gear slots. log("Raw Slot Clicked: "+ev.getRawSlot(),5); //5,6,7,8 for gear slots.
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { log("Slot Type: "+ev.getSlotType().name(),5); //5,6,7,8 for gear slots.
@Override if (ev.getSlotType()==SlotType.ARMOR || ev.getSlotType()==SlotType.QUICKBAR) {
public void run() { log("Triggered.",5); //5,6,7,8 for gear slots.
setPlayerMaxHealth(player); Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
} @Override
},1); public void run() {
setPlayerMaxHealth(player);
}
},5);
}
if (DeathManager.deathStructureExists(player) && ev.getInventory().getTitle().equalsIgnoreCase("Death Loot")) { if (DeathManager.deathStructureExists(player) && ev.getInventory().getTitle().equalsIgnoreCase("Death Loot")) {
//See how many items are in our inventory. Determine final balance. //See how many items are in our inventory. Determine final balance.
@ -4234,7 +4315,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
double dmgdealt=0; double dmgdealt=0;
dmgdealt=getMaxThornsLevelOnEquipment(ev.getDamager()); dmgdealt=getMaxThornsLevelOnEquipment(ev.getDamager());
if (ev.getEntity() instanceof Player) { if (ev.getEntity() instanceof Player) {
if (GenericFunctions.isRanger((Player)ev.getEntity())) { if (PlayerMode.isRanger((Player)ev.getEntity())) {
dmgdealt=0.25; dmgdealt=0.25;
} }
} }
@ -4268,7 +4349,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) { if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) {
Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager()); Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager());
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (GenericFunctions.isDefender(p) && ItemSet.GetSetCount(ItemSet.SONGSTEEL, p)>=5 && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead. if (PlayerMode.isDefender(p) && ItemSet.GetSetCount(ItemSet.SONGSTEEL, p)>=5 && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead.
p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f); p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f);
double dmg = pd.vendetta_amt; double dmg = pd.vendetta_amt;
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta"); CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
@ -4360,7 +4441,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Monster m = (Monster)ev.getEntity(); Monster m = (Monster)ev.getEntity();
if (m.getTarget() instanceof Player) { if (m.getTarget() instanceof Player) {
Player p = (Player)m.getTarget(); Player p = (Player)m.getTarget();
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
//Teleport it into oblivion. //Teleport it into oblivion.
log("Going into another dimension...",5); log("Going into another dimension...",5);
m.teleport(new Location(Bukkit.getWorld("world_nether"),m.getLocation().getX(),m.getLocation().getY(),m.getLocation().getZ())); m.teleport(new Location(Bukkit.getWorld("world_nether"),m.getLocation().getX(),m.getLocation().getY(),m.getLocation().getZ()));
@ -4448,8 +4529,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
break; break;
} }
} }
if (em.targetlist.size()==0) { if (em!=null && em.targetlist.size()==0) {
if (em!=null && (ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) { if ((ev.getTarget() instanceof Player) && !em.targetlist.contains((Player)ev.getTarget())) {
Player p = (Player)ev.getTarget(); Player p = (Player)ev.getTarget();
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime() && !CustomDamage.isInIframe(p)) { if (pd.lastdeath+em.WAIT_TIME<=TwosideKeeper.getServerTickTime() && !CustomDamage.isInIframe(p)) {
@ -4542,7 +4623,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Killed by a player.",5); log("Killed by a player.",5);
killedByPlayer = true; killedByPlayer = true;
Player p = (Player)ms.GetTarget(); Player p = (Player)ms.GetTarget();
if (p!=null && p.isOnline()) { if (p!=null) {
if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) && if (GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand()) && GenericFunctions.isArtifactWeapon(p.getEquipment().getItemInMainHand()) &&
p.getEquipment().getItemInMainHand().getType()==Material.BOW) { p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
@ -4555,7 +4636,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
if (GenericFunctions.isRanger(p) && if (PlayerMode.isRanger(p) &&
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) { GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
pd.fulldodge=true; pd.fulldodge=true;
} }
@ -4565,6 +4646,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (item!=null && if (item!=null &&
item.getType()!=Material.AIR && item.getType()!=Material.AIR &&
GenericFunctions.isWeapon(item)) { GenericFunctions.isWeapon(item)) {
log("Adding "+(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1)+"to dropmult for Looting.",5);
dropmult+=item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1; //Looting increases drop rate by 10% per level. dropmult+=item.getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)*0.1; //Looting increases drop rate by 10% per level.
} }
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) { for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
@ -4609,7 +4691,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ms = (MonsterStructure)monsterdata.get(m.getUniqueId()); ms = (MonsterStructure)monsterdata.get(m.getUniqueId());
Player p = (Player)ms.GetTarget(); Player p = (Player)ms.GetTarget();
boolean isRanger=GenericFunctions.isRanger(p); boolean isRanger=PlayerMode.isRanger(p);
if (isRanger) { if (isRanger) {
switch (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())) { switch (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())) {
@ -5214,7 +5296,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//See if this armor type is not being worn by the player. //See if this armor type is not being worn by the player.
if (armor.getType().toString().contains("BOOTS") && if (armor.getType().toString().contains("BOOTS") &&
p.getEquipment().getBoots()==null && p.getEquipment().getBoots()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) { (!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setBoots(armor); p.getEquipment().setBoots(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5223,7 +5305,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (armor.getType().toString().contains("LEGGINGS") && if (armor.getType().toString().contains("LEGGINGS") &&
p.getEquipment().getLeggings()==null && p.getEquipment().getLeggings()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) { (!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setLeggings(armor); p.getEquipment().setLeggings(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5232,7 +5314,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (armor.getType().toString().contains("CHESTPLATE") && if (armor.getType().toString().contains("CHESTPLATE") &&
p.getEquipment().getChestplate()==null && p.getEquipment().getChestplate()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) { (!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setChestplate(armor); p.getEquipment().setChestplate(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5241,7 +5323,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (armor.getType().toString().contains("HELMET") && if (armor.getType().toString().contains("HELMET") &&
p.getEquipment().getHelmet()==null && p.getEquipment().getHelmet()==null &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) { (!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getEquipment().setHelmet(armor); p.getEquipment().setHelmet(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5250,8 +5332,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else } else
if (armor.getType().toString().contains("SHIELD") && if (armor.getType().toString().contains("SHIELD") &&
p.getInventory().getExtraContents()[0]==null && p.getInventory().getExtraContents()[0]==null &&
!GenericFunctions.isStriker(p) && !PlayerMode.isStriker(p) &&
(!GenericFunctions.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) { (!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
p.getInventory().setExtraContents(new ItemStack[]{armor}); p.getInventory().setExtraContents(new ItemStack[]{armor});
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item))); p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f); p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5325,7 +5407,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
log("Setup new target: "+p.getName(),5); log("Setup new target: "+p.getName(),5);
} }
if (GenericFunctions.isRanger(p)) { if (PlayerMode.isRanger(p)) {
LivingEntity findtarget = aPlugin.API.rayTraceTargetEntity(p,100); LivingEntity findtarget = aPlugin.API.rayTraceTargetEntity(p,100);
if (findtarget==null || !p.hasLineOfSight(findtarget)) { if (findtarget==null || !p.hasLineOfSight(findtarget)) {
if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));} if (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE) {arr.setVelocity(arr.getVelocity().multiply(1000));}
@ -5348,7 +5430,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId());
pd.lastarrowpower=arr.getVelocity().lengthSquared(); pd.lastarrowpower=arr.getVelocity().lengthSquared();
pd.lastarrowwasinrangermode=(GenericFunctions.isRanger(p)&&GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE); pd.lastarrowwasinrangermode=(PlayerMode.isRanger(p)&&GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.SNIPE);
log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5); log("Arrow velocity is "+arr.getVelocity().lengthSquared(),5);
if (arr.getType()==EntityType.TIPPED_ARROW) { if (arr.getType()==EntityType.TIPPED_ARROW) {
@ -6482,7 +6564,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
log("maxdeduction is "+maxdeduction,5); log("maxdeduction is "+maxdeduction,5);
if (GenericFunctions.isDefender(p)) { if (PlayerMode.isDefender(p)) {
hp+=10; hp+=10;
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0)); p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0));
} }
@ -6507,11 +6589,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
}*/ }*/
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+ /*hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+ ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+ ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 4, 4); ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.JAMDAK, 4, 4);*/
hp*=maxdeduction; hp*=maxdeduction;
@ -6767,7 +6849,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@Override @Override
public void run() { public void run() {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater); Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater);
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server is restarting in 1 minute for a plugin update!"); aPlugin.API.discordSendRawItalicized("The server is restarting in 1 minute for a plugin update!");
Bukkit.broadcastMessage(ChatColor.YELLOW+"The server is restarting in 1 minute for a plugin update!"); Bukkit.broadcastMessage(ChatColor.YELLOW+"The server is restarting in 1 minute for a plugin update!");
} }
},20*120); },20*120);
@ -6775,7 +6857,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@Override @Override
public void run() { public void run() {
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater); Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater);
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server is restarting in 10 seconds!"); aPlugin.API.discordSendRawItalicized("The server is restarting in 10 seconds!");
Bukkit.broadcastMessage(ChatColor.RED+"The server is restarting in 10 seconds!"); Bukkit.broadcastMessage(ChatColor.RED+"The server is restarting in 10 seconds!");
} }
},20*170); },20*170);
@ -6785,7 +6867,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public void run() { public void run() {
Bukkit.getScheduler().runTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater); Bukkit.getScheduler().runTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), pluginupdater);
Bukkit.savePlayers(); Bukkit.savePlayers();
DiscordMessageSender.sendItalicizedRawMessageDiscord("Server is shutting down..."); aPlugin.API.discordSendRawItalicized("Server is shutting down...");
for (int i=0;i<Bukkit.getWorlds().size();i++) { for (int i=0;i<Bukkit.getWorlds().size();i++) {
Bukkit.getWorlds().get(i).save(); Bukkit.getWorlds().get(i).save();
} }
@ -6815,7 +6897,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%"); receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Life Steal: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100)+"%"); receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Life Steal: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100)+"%");
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Critical Strike Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.calculateCriticalStrikeChance(p.getEquipment().getItemInMainHand(), p))*100)+"%"); receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Critical Strike Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.calculateCriticalStrikeChance(p.getEquipment().getItemInMainHand(), p))*100)+"%");
if (GenericFunctions.isDefender(p)) { if (PlayerMode.isDefender(p)) {
double dodgechance=0.0; double dodgechance=0.0;
if (!p.isBlocking()) { if (!p.isBlocking()) {
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d; dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d;
@ -6922,7 +7004,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static void announcePluginVersions() { public static void announcePluginVersions() {
if (SERVER_TYPE!=ServerType.QUIET) { if (SERVER_TYPE!=ServerType.QUIET) {
DiscordMessageSender.sendItalicizedRawMessageDiscord(SERVER_TYPE.GetServerName()+"Server has been restarted.\nRunning v."+Bukkit.getPluginManager().getPlugin("TwosideKeeper").getDescription().getVersion()+" of TwosideKeeper\nRunning v"+Bukkit.getPluginManager().getPlugin("aPlugin").getDescription().getVersion()+" of Jobs."); aPlugin.API.discordSendRawItalicized(SERVER_TYPE.GetServerName()+"Server has been restarted.\nRunning v."+Bukkit.getPluginManager().getPlugin("TwosideKeeper").getDescription().getVersion()+" of TwosideKeeper\nRunning v"+Bukkit.getPluginManager().getPlugin("aPlugin").getDescription().getVersion()+" of Jobs.");
} }
} }

View File

@ -19,6 +19,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
@ -338,12 +339,19 @@ public final class TwosideKeeperAPI {
public static String getLocalizedItemName(Material i) { public static String getLocalizedItemName(Material i) {
return GenericFunctions.UserFriendlyMaterialName(i); return GenericFunctions.UserFriendlyMaterialName(i);
} }
@Deprecated
public static String getLocalizedItemName(Material i, byte data) { public static String getLocalizedItemName(Material i, byte data) {
return GenericFunctions.UserFriendlyMaterialName(i,data); return GenericFunctions.UserFriendlyMaterialName(i,data);
} }
public static String getLocalizedItemName(Material i, short data) {
return GenericFunctions.UserFriendlyMaterialName(i,data);
}
//Player COMMANDS. //Player COMMANDS.
public static double getPlayerVelocity(Player p) { public static double getPlayerVelocity(Player p) {
return GenericFunctions.GetPlayerVelocity(p); return GenericFunctions.GetPlayerVelocity(p);
} }
public static PlayerMode getPlayerMode(Player p) {
return PlayerMode.getPlayerMode(p);
}
} }