+>Display Applied Damage for players to reveal how much damage is dealt

with buffs and bonuses on.
+>Rangers now see their base damage and applied damage properly.
+>Added isArtifactDust(), getArtifactDustTime(), setArtifactDustTime(),
and addArtifactDustTime() to the API.
>Fixed a bug causing certain artifact pieces to be duplicated when
turned to dust while other artifact pieces were not.
>Fixed a bug preventing damage breakdown from showing when only a single
player was online and attempting to solo elites/bosses and dies in the
process.
testdev
sigonasr2 8 years ago
parent ad79fef027
commit 419b04cd17
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 80
      src/sig/plugin/TwosideKeeper/Boss/EliteGuardian.java
  4. 10
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  5. 20
      src/sig/plugin/TwosideKeeper/EliteMonster.java
  6. 20
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  7. 14
      src/sig/plugin/TwosideKeeper/HelperStructures/Utils/ItemUtils.java
  8. 2
      src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
  9. 6
      src/sig/plugin/TwosideKeeper/Monster/Wither.java
  10. 103
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  11. 40
      src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java
  12. 1
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

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

@ -0,0 +1,80 @@
package sig.plugin.TwosideKeeper.Boss;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.EliteMonster;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class EliteGuardian extends EliteMonster{
Location firstHitLoc = null;
boolean cutsceneplayed=false;
STATE state = STATE.WAITINGFORCUTSCENE;
int cutscenetimer=0;
public EliteGuardian(Monster m) {
super(m);
}
public void runTick() {
//This monster constantly gives itself its buffs as it may lose some (Debilitation mode).
increaseBarTextScroll();
dontDrown();
regenerateHealth();
resetToSpawn();
createBossHealthbar();
ignoreAllOtherTargets();
runStateMachine();
if (m.isValid() && targetlist.size()>0) {
getGlow();
}
}
private void runStateMachine() {
switch (state) {
case PASSIVE:
m.setAI(true);
break;
case WAITINGFORCUTSCENE:
List<Player> nearby = GenericFunctions.getNearbyPlayers(m.getLocation(), 4);
if (nearby.size()>0) {
List<Player> nearby2 = GenericFunctions.getNearbyPlayers(m.getLocation(), 16);
//Play the cutscene for all of these players.
for (Player p : nearby2) {
p.setVelocity(new Vector(0,0,0));
if (cutscenetimer==0) {
p.setGameMode(GameMode.SPECTATOR);
p.setSpectatorTarget(m);
}
}
if (cutscenetimer==0) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS, 40, 1, m);
}
cutscenetimer++;
if (cutscenetimer>100) {
state=STATE.PASSIVE;
}
}
m.setAI(false);
break;
default:
break;
}
}
public void runHitEvent(LivingEntity damager, double dmg) {
super.runHitEvent(damager,dmg);
}
enum STATE {
PASSIVE, //Just works like vanilla Minecraft behavior.
WAITINGFORCUTSCENE, //A mode where the game is waiting for a cutscene to occur. The Elite Guardian does not move during this time.
}
}

@ -247,10 +247,12 @@ public class CustomDamage {
dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target)); dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target)); dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target));
dmg += addMultiplierToPlayerLogger(damager,target,"Airborne Mult",dmg * calculateAirborneAttackMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Airborne Mult",dmg * calculateAirborneAttackMultiplier(shooter));
double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags)); if (reason==null || !reason.equalsIgnoreCase("Test Damage")) {
if (critdmg!=0.0) {crit=true; double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags));
aPlugin.API.critEntity(target, 15);} if (critdmg!=0.0) {crit=true;
dmg += critdmg; aPlugin.API.critEntity(target, 15);}
dmg += critdmg;
}
double armorpendmg = addToPlayerLogger(damager,target,"Armor Pen",calculateArmorPen(damager,dmg,weapon)); double armorpendmg = addToPlayerLogger(damager,target,"Armor Pen",calculateArmorPen(damager,dmg,weapon));
if (!isFlagSet(flags, TRUEDMG) && (target instanceof Player && PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN)) { if (!isFlagSet(flags, TRUEDMG) && (target instanceof Player && PlayerMode.getPlayerMode((Player)target)!=PlayerMode.BARBARIAN)) {
dmg -= getDamageFromBarbarianSetBonus(target); dmg -= getDamageFromBarbarianSetBonus(target);

@ -140,15 +140,9 @@ public class EliteMonster {
} }
m.teleport(myspawn); m.teleport(myspawn);
m.setHealth(m.getMaxHealth()); m.setHealth(m.getMaxHealth());
if (dpslist.size()>0) { AnnounceFailedTakedown();
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed...");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(generateDPSReport());
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
}
bar.setColor(BarColor.WHITE); bar.setColor(BarColor.WHITE);
first_willpower_notification=false; first_willpower_notification=false;
dpslist.clear();
willpower=0; willpower=0;
bar.removeAll(); bar.removeAll();
willpower_bar.removeAll(); willpower_bar.removeAll();
@ -168,6 +162,16 @@ public class EliteMonster {
} }
} }
private void AnnounceFailedTakedown() {
if (dpslist.size()>0) {
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" Takedown Failed...");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(generateDPSReport());
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" Takedown Failed...\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
dpslist.clear();
}
}
protected void dontDrown() { protected void dontDrown() {
m.setRemainingAir(m.getMaximumAir()); m.setRemainingAir(m.getMaximumAir());
} }
@ -259,6 +263,7 @@ public class EliteMonster {
currentdps = dpslist.get(p.getName()); currentdps = dpslist.get(p.getName());
} }
dpslist.put(p.getName(), currentdps+dmg); dpslist.put(p.getName(), currentdps+dmg);
TwosideKeeper.log(p.getName()+"'s Damage: "+dpslist.get(p.getName()), 0);
} }
last_regen_time=TwosideKeeper.getServerTickTime(); last_regen_time=TwosideKeeper.getServerTickTime();
} }
@ -358,6 +363,7 @@ public class EliteMonster {
public void Cleanup() { public void Cleanup() {
// Remove all healthbars before destroying. // Remove all healthbars before destroying.
AnnounceFailedTakedown();
removeAllHealthbars(); removeAllHealthbars();
} }
} }

@ -69,6 +69,7 @@ import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.Recipes; import sig.plugin.TwosideKeeper.Recipes;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.TwosideKeeperAPI; import sig.plugin.TwosideKeeper.TwosideKeeperAPI;
import sig.plugin.TwosideKeeper.Boss.EliteGuardian;
import sig.plugin.TwosideKeeper.Boss.EliteZombie; import sig.plugin.TwosideKeeper.Boss.EliteZombie;
import sig.plugin.TwosideKeeper.Boss.MegaWither; import sig.plugin.TwosideKeeper.Boss.MegaWither;
import sig.plugin.TwosideKeeper.Events.PlayerLineDriveEvent; import sig.plugin.TwosideKeeper.Events.PlayerLineDriveEvent;
@ -111,6 +112,13 @@ public class GenericFunctions {
} }
public static ItemStack breakHardenedItem(ItemStack item, Player p) { public static ItemStack breakHardenedItem(ItemStack item, Player p) {
/*StackTraceElement[] stacktrace = new Throwable().getStackTrace();
StringBuilder stack = new StringBuilder("Mini stack tracer:");
for (int i=0;i<Math.min(10, stacktrace.length);i++) {
stack.append("\n"+stacktrace[i].getClassName()+": **"+stacktrace[i].getFileName()+"** "+stacktrace[i].getMethodName()+"():"+stacktrace[i].getLineNumber());
}
TwosideKeeper.log("Trace:"+stack, 0);*/
int break_count = getHardenedItemBreaks(item); int break_count = getHardenedItemBreaks(item);
if (break_count>0) { if (break_count>0) {
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
@ -159,8 +167,7 @@ public class GenericFunctions {
if (p!=null) { if (p!=null) {
p.sendMessage(ChatColor.LIGHT_PURPLE+"You still feel the artifact's presence inside of you..."); p.sendMessage(ChatColor.LIGHT_PURPLE+"You still feel the artifact's presence inside of you...");
} }
convertArtifactToDust(item); return convertArtifactToDust(item);
return null;
} }
return null; return null;
} }
@ -189,7 +196,7 @@ public class GenericFunctions {
item.setItemMeta(m); item.setItemMeta(m);
item.setType(Material.SULPHUR); item.setType(Material.SULPHUR);
item.setDurability((short)0); item.setDurability((short)0);
item.setAmount(1); //item.setAmount(1);
return item; return item;
} }
@ -4632,6 +4639,13 @@ public class GenericFunctions {
target.setHealth(188000); target.setHealth(188000);
return new MegaWither(target); return new MegaWither(target);
} }
if (TwosideKeeper.ELITEGUARDIANS_ACTIVATED) {
if (target instanceof Guardian) {
target.setMaxHealth(120000);
target.setHealth(120000);
return new EliteGuardian(target);
}
}
TwosideKeeper.log("Elite Monster for monster "+target.getName()+" UNDEFINED. Defaulting to EliteZombie type.", 0); TwosideKeeper.log("Elite Monster for monster "+target.getName()+" UNDEFINED. Defaulting to EliteZombie type.", 0);
return new EliteZombie(target); return new EliteZombie(target);
} }

@ -150,7 +150,7 @@ public class ItemUtils {
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) { if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
//See what the previous time was. //See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
return (time+12096000 - TwosideKeeper.getServerTickTime()); return (time + 12096000 - TwosideKeeper.getServerTickTime());
} }
} }
} }
@ -160,7 +160,7 @@ public class ItemUtils {
/** /**
* Set a new amount of time in ticks required before the item will turn from dust back into an artifact. * Set a new amount of time in ticks required before the item will turn from dust back into an artifact.
* Returns a new modified version of the item. * Returns a new modified version of the item. If the time remaining of the Artifact Dust is 0 or lower, it will automatically turn into a regular item again!
*/ */
public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) { public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) {
if (isArtifactDust(item)) { if (isArtifactDust(item)) {
@ -170,12 +170,15 @@ public class ItemUtils {
if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) { if (oldlore.get(i).contains(ChatColor.BLUE+""+ChatColor.MAGIC)) {
//See what the previous time was. //See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+(TwosideKeeper.getServerTickTime()-newtime+12096000)); oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+(TwosideKeeper.getServerTickTime() - 12096000 + newtime));
} }
} }
ItemMeta m = item.getItemMeta(); ItemMeta m = item.getItemMeta();
m.setLore(oldlore); m.setLore(oldlore);
item.setItemMeta(m); item.setItemMeta(m);
if (newtime<=0) {
item = GenericFunctions.convertArtifactDustToItem(item);
}
} }
return item; return item;
} }
@ -188,7 +191,7 @@ public class ItemUtils {
* <br><br> * <br><br>
* Returns a modified version of the item. * Returns a modified version of the item.
*/ */
public static void addArtifactDustTime(ItemStack item, long amt) { public static ItemStack addArtifactDustTime(ItemStack item, long amt) {
if (isArtifactDust(item)) { if (isArtifactDust(item)) {
long time = TwosideKeeper.getServerTickTime(); long time = TwosideKeeper.getServerTickTime();
List<String> oldlore = item.getItemMeta().getLore(); List<String> oldlore = item.getItemMeta().getLore();
@ -197,7 +200,7 @@ public class ItemUtils {
//See what the previous time was. //See what the previous time was.
time = Long.parseLong(ChatColor.stripColor(oldlore.get(i))); time = Long.parseLong(ChatColor.stripColor(oldlore.get(i)));
time += amt; time += amt;
oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+TwosideKeeper.getServerTickTime()); oldlore.set(i, ChatColor.BLUE+""+ChatColor.MAGIC+time);
TwosideKeeper.log("Time is "+time, 5); TwosideKeeper.log("Time is "+time, 5);
break; break;
} }
@ -209,6 +212,7 @@ public class ItemUtils {
item = GenericFunctions.convertArtifactDustToItem(item); item = GenericFunctions.convertArtifactDustToItem(item);
} }
} }
return item;
} }
public static ItemStack createRandomFirework() { public static ItemStack createRandomFirework() {

@ -13,7 +13,7 @@ import sig.plugin.TwosideKeeper.TwosideKeeper;
public class DamageLogger { public class DamageLogger {
public HashMap<String,Double> breakdownlist; public HashMap<String,Double> breakdownlist;
double totaldmg; double totaldmg;
double actualtotaldmg=0.0; public double actualtotaldmg=0.0;
double calculatedtotaldmg=0.0; double calculatedtotaldmg=0.0;
double totalmult=0.0; double totalmult=0.0;
double lasttotaldmg=0.0; double lasttotaldmg=0.0;

@ -193,4 +193,10 @@ public class Wither extends CustomMonster{
} }
return closestplayer; return closestplayer;
} }
public void Cleanup() {
if (dmgbreakdown.size()>0) {
DisplayFailedDPSReport();
}
}
} }

@ -44,6 +44,7 @@ import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.entity.Blaze; import org.bukkit.entity.Blaze;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.EnderDragon.Phase; import org.bukkit.entity.EnderDragon.Phase;
@ -53,6 +54,7 @@ import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.Ghast; import org.bukkit.entity.Ghast;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
@ -485,6 +487,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public final static boolean CHRISTMASEVENT_ACTIVATED=false; public final static boolean CHRISTMASEVENT_ACTIVATED=false;
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false; //Limited Christmas drops/functionality remain while the majority of it is turned off. public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false; //Limited Christmas drops/functionality remain while the majority of it is turned off.
public final static boolean ELITEGUARDIANS_ACTIVATED=true;
public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of( public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of(
EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN, EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN,
EntityType.COW,EntityType.CREEPER,EntityType.HORSE,EntityType.GUARDIAN,EntityType.ENDER_DRAGON, EntityType.COW,EntityType.CREEPER,EntityType.HORSE,EntityType.GUARDIAN,EntityType.ENDER_DRAGON,
@ -728,6 +732,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
for (CustomMonster cs : custommonsters.values()) { for (CustomMonster cs : custommonsters.values()) {
if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) { if (cs.m==null || !cs.m.isValid() || !cs.isAlive()) {
//This has to be removed... //This has to be removed...
if (cs instanceof sig.plugin.TwosideKeeper.Monster.Wither) {
sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)cs;
w.Cleanup();
}
ScheduleRemoval(custommonsters,cs.m.getUniqueId()); ScheduleRemoval(custommonsters,cs.m.getUniqueId());
} else { } else {
cs.runTick(); cs.runTick();
@ -736,6 +744,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//Control elite monsters. //Control elite monsters.
for (EliteMonster em : elitemonsters) { for (EliteMonster em : elitemonsters) {
if (!em.m.isValid()) { if (!em.m.isValid()) {
em.Cleanup();
ScheduleRemoval(elitemonsters,em); ScheduleRemoval(elitemonsters,em);
} else { } else {
em.runTick(); em.runTick();
@ -1073,13 +1082,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int spl = TwosideSpleefGames.spleef_game_list.size(); int spl = TwosideSpleefGames.spleef_game_list.size();
int nod = TwosideRecyclingCenter.nodes.size(); int nod = TwosideRecyclingCenter.nodes.size();
int ite = TwosideRecyclingCenter.itemmap.size(); int ite = TwosideRecyclingCenter.itemmap.size();
HashMap<Player,Integer> ope = GetFullStructureMap("ope"); int pri = WorldShop.pricelist.size();
HashMap<Player,Integer> dam = GetFullStructureMap("dam"); int ope = GetFullStructureMap("ope");
HashMap<Player,Integer> dea = GetFullStructureMap("dea"); int dam = GetFullStructureMap("dam");
HashMap<Player,Integer> hit = GetFullStructureMap("hit"); int dea = GetFullStructureMap("dea");
HashMap<Player,Integer> ite2 = GetFullStructureMap("ite"); int hit = GetFullStructureMap("hit");
HashMap<Player,Integer> las = GetFullStructureMap("las"); int ite2 = GetFullStructureMap("ite");
HashMap<Player,Integer> blo2 = GetFullStructureMap("blo2"); int las = GetFullStructureMap("las");
int blo2 = GetFullStructureMap("blo2");
DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df = new DecimalFormat("0.00");
sender.sendMessage(ChatColor.WHITE+"TPS: "+GetTPSColor(tps)+df.format(tps)); sender.sendMessage(ChatColor.WHITE+"TPS: "+GetTPSColor(tps)+df.format(tps));
sender.sendMessage(ChatColor.WHITE+Display("SNO",sno)+Display("PLA",pla)+Display("LIV",liv)); sender.sendMessage(ChatColor.WHITE+Display("SNO",sno)+Display("PLA",pla)+Display("LIV",liv));
@ -1090,9 +1100,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
sender.sendMessage(ChatColor.WHITE+Display("VAL",val)+Display("TEM4",tem4)+Display("NOT",not)); sender.sendMessage(ChatColor.WHITE+Display("VAL",val)+Display("TEM4",tem4)+Display("NOT",not));
sender.sendMessage(ChatColor.WHITE+Display("SUP",sup)+Display("LAV",lav)+Display("LOC",loc)); sender.sendMessage(ChatColor.WHITE+Display("SUP",sup)+Display("LAV",lav)+Display("LOC",loc));
sender.sendMessage(ChatColor.WHITE+Display("STA",sta)+Display("SPL",spl)+Display("NOD",nod)); sender.sendMessage(ChatColor.WHITE+Display("STA",sta)+Display("SPL",spl)+Display("NOD",nod));
sender.sendMessage(ChatColor.WHITE+Display("ITE",ite)+Display("P-OPE",ope.size())+Display("P-DAM",dam.size())); sender.sendMessage(ChatColor.WHITE+Display("ITE",ite)+Display("PRI",pri)+Display("P-OPE",ope));
sender.sendMessage(ChatColor.WHITE+Display("P-DEA",dea.size())+Display("P-HIT",hit.size())+Display("P-ITE2",ite2.size())); sender.sendMessage(ChatColor.WHITE+Display("P-DEA",dea)+Display("P-HIT",hit)+Display("P-ITE2",ite2));
sender.sendMessage(ChatColor.WHITE+Display("P-LAS",las.size())+Display("P-BLO2",blo2.size())); sender.sendMessage(ChatColor.WHITE+Display("P-LAS",las)+Display("P-BLO2",blo2)+Display("P-DAM",dam));
sender.sendMessage(ChatColor.WHITE+DisplayPlayerBar()); sender.sendMessage(ChatColor.WHITE+DisplayPlayerBar());
sender.sendMessage(ChatColor.WHITE+"To view a specific player's usage, use "+ChatColor.GREEN+"\"/debugreport <name>\""); sender.sendMessage(ChatColor.WHITE+"To view a specific player's usage, use "+ChatColor.GREEN+"\"/debugreport <name>\"");
sender.sendMessage(ChatColor.WHITE+"To view specific entities' usage, use "+ChatColor.GREEN+"\"/debugreport ALLENTS\""); sender.sendMessage(ChatColor.WHITE+"To view specific entities' usage, use "+ChatColor.GREEN+"\"/debugreport ALLENTS\"");
@ -2019,34 +2029,34 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return totalsize; return totalsize;
} }
private HashMap<Player, Integer> GetFullStructureMap(String string) { private int GetFullStructureMap(String string) {
HashMap<Player,Integer> newmap = new HashMap<Player,Integer>(); int total = 0;
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
switch (string) { switch (string) {
case "ope":{ case "ope":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).openeditemcube.size()); total+=PlayerStructure.GetPlayerStructure(p).openeditemcube.size();
}break; }break;
case "dam":{ case "dam":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size()); total+=PlayerStructure.GetPlayerStructure(p).damagedata.breakdownlist.size();
}break; }break;
case "dea":{ case "dea":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).deathloot.size()); total+=PlayerStructure.GetPlayerStructure(p).deathloot.size();
}break; }break;
case "hit":{ case "hit":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).hitlist.size()); total+=PlayerStructure.GetPlayerStructure(p).hitlist.size();
}break; }break;
case "ite":{ case "ite":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).itemcubelist.size()); total+=PlayerStructure.GetPlayerStructure(p).itemcubelist.size();
}break; }break;
case "las":{ case "las":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).lasteffectlist.size()); total+=PlayerStructure.GetPlayerStructure(p).lasteffectlist.size();
}break; }break;
case "blo":{ case "blo":{
newmap.put(p, PlayerStructure.GetPlayerStructure(p).blockscanlist.size()); total+=PlayerStructure.GetPlayerStructure(p).blockscanlist.size();
}break; }break;
} }
} }
return newmap; return total;
} }
@ -5362,7 +5372,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onChunkLoadEvent(ChunkLoadEvent ev) { public void onChunkLoadEvent(ChunkLoadEvent ev) {
//Grab all entities. Create monster structures for all monsters. Detect elites and leaders and set their status accordingly. //Grab all entities. Create monster structures for all monsters. Detect elites and leaders and set their status accordingly.
if (TwosideKeeper.livingentitydata!=null) { if (TwosideKeeper.livingentitydata!=null) {
for (Entity e : ev.getChunk().getEntities()) { for (Entity e : ev.getChunk().getEntities()) {
if (e!=null && e.isValid() && (e instanceof LivingEntity)) { if (e!=null && e.isValid() && (e instanceof LivingEntity)) {
@ -5419,6 +5428,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (m instanceof Wither) { if (m instanceof Wither) {
ms.SetLeader(true); ms.SetLeader(true);
} }
if (TwosideKeeper.ELITEGUARDIANS_ACTIVATED) {
if (m instanceof Guardian) {
Guardian g = (Guardian)m;
if (g.isElder()) {
ms.SetElite(true);
g.setCustomName(ChatColor.LIGHT_PURPLE+"Elite Guardian");
g.setCustomNameVisible(true);
}
}
}
} }
} }
@ -6459,7 +6478,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
AttemptToPlaceChest(m.getLocation(),1,1,1,aPlugin.API.Chests.LOOT_CUSTOM_5); AttemptToPlaceChest(m.getLocation(),1,1,1,aPlugin.API.Chests.LOOT_CUSTOM_5);
for (UUID id : custommonsters.keySet()) { for (UUID id : custommonsters.keySet()) {
if (id.equals(m.getUniqueId())) { if (id.equals(m.getUniqueId())) {
sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)custommonsters.get(id); sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)custommonsters.get(id);
w.DisplaySuccessfulDPSReport(); w.DisplaySuccessfulDPSReport();
break; break;
@ -6477,7 +6496,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player pl = participants.get(i); Player pl = participants.get(i);
if (pl!=null && pl.isOnline()) { if (pl!=null && pl.isOnline()) {
ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300); ExperienceOrb exp = GenericFunctions.spawnXP(pl.getLocation(), ev.getDroppedExp()*300);
exp.setInvulnerable(true); exp.setInvulnerable(true);
if (m instanceof Zombie) { if (m instanceof Zombie) {
Zombie z = (Zombie)m; Zombie z = (Zombie)m;
if (z.isBaby()) { if (z.isBaby()) {
@ -6797,7 +6816,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW)
public void onBrokenItem(PlayerItemBreakEvent ev) { public void onBrokenItem(PlayerItemBreakEvent ev) {
//When an item breaks, check if it has the ChatColor.GRAY+"Breaks Remaining: " line. //When an item breaks, check if it has the ChatColor.GRAY+"Breaks Remaining: " line.
//If it does, that means it can still be alive longer and not break. //If it does, that means it can still be alive longer and not break.
@ -6812,8 +6831,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ItemStack test = GenericFunctions.breakHardenedItem(item,p); ItemStack test = GenericFunctions.breakHardenedItem(item,p);
if (test!=null) { if (test!=null) {
//We have to give this player the item! //We have to give this player the item!
TwosideKeeper.log("We have to give this player the item", 0); if (test.getAmount()==0) {
GenericFunctions.giveItem(p, test); test.setAmount(1); //We can't give 0 of something.
}
//Scan the inventory for this item. If it already exists do not give one.
boolean foundone=false;
for (ItemStack items : p.getInventory().getContents()) {
if (test.isSimilar(items)) {
foundone=true;
TwosideKeeper.log("Found one of these in the player's inventory already. Do not allow this item to be duplicated!", 0);
break;
}
}
if (!foundone) {
GenericFunctions.giveItem(p, test);
}
} }
breakdownItem(item,p); breakdownItem(item,p);
} }
@ -7018,7 +7050,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onaPluginPickupEvent(PlayerGainItemEvent ev) { public void onaPluginPickupEvent(PlayerGainItemEvent ev) {
//TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerGainItemEvent fired w/ "+ev.getItemStack(), 1); TwosideKeeper.log("["+TwosideKeeper.getServerTickTime()+"] PlayerGainItemEvent fired w/ "+ev.getItemStack(), 1);
Player p = ev.getPlayer(); Player p = ev.getPlayer();
ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItemStack()); ItemStack newstack = InventoryUtils.AttemptToFillPartialSlotsFirst(p,ev.getItemStack());
if (newstack==null) { if (newstack==null) {
@ -9167,7 +9199,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
boolean all = (additional.equalsIgnoreCase("all")); boolean all = (additional.equalsIgnoreCase("all"));
boolean equip = (additional.equalsIgnoreCase("equip")); boolean equip = (additional.equalsIgnoreCase("equip"));
if (all) {receiver.sendMessage("Habitat Quality: "+habitat_data.getHabitationLevel(p.getLocation()));} if (all) {receiver.sendMessage("Habitat Quality: "+habitat_data.getHabitationLevel(p.getLocation()));}
Arrow temporaryarrow = (Arrow)p.getWorld().spawnArrow(p.getLocation().add(0,1000000,0), new Vector(1,1,1), 0.6f, 12f);
temporaryarrow.setShooter(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) {
store2=CustomDamage.getBaseWeaponDamage(p.getEquipment().getItemInMainHand(), temporaryarrow, null);
}
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2)); receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Base Damage: "+ChatColor.RESET+""+ChatColor.DARK_PURPLE+df.format(store2));
Chicken temporarychicken = (Chicken)p.getWorld().spawnEntity(p.getLocation().add(0,1000000,0), EntityType.CHICKEN); //Why are you so cruel to the chicken sig.
HashMap<String,Double> origmap = (HashMap<String, Double>) pd.damagedata.breakdownlist.clone();
double origdmg = pd.damagedata.actualtotaldmg;
if (PlayerMode.getPlayerMode(p)==PlayerMode.RANGER) {
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Applied Damage: "+ChatColor.RESET+""+ChatColor.LIGHT_PURPLE+df.format(CustomDamage.CalculateDamage(store2,temporaryarrow,temporarychicken,null, "Test Damage")));
} else {
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Applied Damage: "+ChatColor.RESET+""+ChatColor.LIGHT_PURPLE+df.format(CustomDamage.CalculateDamage(store2,p,temporarychicken,p.getEquipment().getItemInMainHand(), "Test Damage")));
}
pd.damagedata.actualtotaldmg=origdmg;
pd.damagedata.breakdownlist=origmap;
temporarychicken.remove();
temporaryarrow.remove();
double damagereduction = (1.0-store1)*100; double damagereduction = (1.0-store1)*100;
if (all || damagereduction>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");} if (all || damagereduction>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Damage Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((1.0-store1)*100)+"%");}
double lifestealamt = CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100; double lifestealamt = CustomDamage.calculateLifeStealAmount(p,p.getEquipment().getItemInMainHand())*100;

@ -28,6 +28,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public final class TwosideKeeperAPI { public final class TwosideKeeperAPI {
//MONEY COMMANDS. //MONEY COMMANDS.
@ -175,6 +176,45 @@ public final class TwosideKeeperAPI {
return AwakenedArtifact.addMaxAP(item, maxap); return AwakenedArtifact.addMaxAP(item, maxap);
} }
//Artifact Dust Commands.
/**
* Returns true if the item is an Artifact Dust. False otherwise.
*/
public static boolean isArtifactDust(ItemStack item) {
return ItemUtils.isArtifactDust(item);
}
/**
* Returns the amount of time in ticks remaining before the Artifact Dust will
* successfully convert back to an item.
*/
public static long getArtifactDustTimeRemaining(ItemStack item) {
return ItemUtils.getArtifactDustTimeRemaining(item);
}
/**
* Sets the amount of time in ticks remaining before the Artifact Dust will
* successfully convert back to an item.
* <br><br>
* If <b>newtime</b> is set to 0 or less, the item will automatically convert
* back to its original artifact state.
*
* @return The ItemStack modified.
*/
public static ItemStack setArtifactDustTimeRemaining(ItemStack item, long newtime) {
return ItemUtils.setArtifactDustTimeRemaining(item, newtime);
}
/**
* Adjusts the amount of time in ticks remaining before the Artifact Dust will
* successfully convert back to an item.
* <br><br>
* If the value of <b>amt</b> is negative and <b>Math.abs(amt)</b> is greater than the
* amount of dust time currently on the item, it will automatically convert back
* to its original artifact state.
* @return The ItemStack modified.
*/
public static ItemStack addArtifactDustTimeRemaining(ItemStack item, long amt) {
return ItemUtils.addArtifactDustTime(item, amt);
}
//Time Commands. //Time Commands.
public static long getServerTickTime() { public static long getServerTickTime() {
return TwosideKeeper.getServerTickTime(); return TwosideKeeper.getServerTickTime();

@ -782,6 +782,7 @@ final class runServerHeartbeat implements Runnable {
} }
} }
if (!hasstruct) { if (!hasstruct) {
TwosideKeeper.log("Added Elite Monster "+ms.m, 0);
TwosideKeeper.elitemonsters.add(GenericFunctions.getProperEliteMonster((Monster)(ms.m))); TwosideKeeper.elitemonsters.add(GenericFunctions.getProperEliteMonster((Monster)(ms.m)));
} }
} }

Loading…
Cancel
Save