+>'/fix price' and '/fix price <price>' commands have been added. These

commands lets you view the base price of the item you are holding at a
world shop, and allows you to set the price to a different amount. (Only
Aristo has permission to do this)
>Special Arrows being shot from a quiver has been fixed.
>Cooldowns are now saved between logins. This means you will login with
the cooldowns you last had instead of it resetting on each relog.
>Leader Wither now displays a Damage Breakdown when the fight is won or
lost.
>Applied a new Assassinate algorithm.
>Fixed Fireworks from Christmas Boxes and Dimensional Boxes from having
no effects.
>The Leader Wither no longer drops down as dramatically when reaching
the upper boundary of the Nether.
>Significantly decreased the block destruction capabilities of End,
Hellfire, and Deadly tier monster afterdeath explosions.
>Increased the damage dealt by afterdeath explosions of End, Hellfire,
and Deadly tier monsters.
>Deal of the Day price sale percentages can now vary by more than 20%.
>Hellfire Zombie and Pig Zombie behavior slightly modified.
testdev
sigonasr2 8 years ago
parent bb59525e12
commit ad79fef027
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 2
      src/sig/plugin/TwosideKeeper/ChargeZombie.java
  4. 20
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  5. 20
      src/sig/plugin/TwosideKeeper/Drops/DropRandomFirework.java
  6. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java
  7. 47
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  8. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  9. 31
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  10. 3
      src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
  11. 96
      src/sig/plugin/TwosideKeeper/Monster/Wither.java
  12. 2
      src/sig/plugin/TwosideKeeper/MonsterController.java
  13. 92
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  14. 139
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  15. 330
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

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

@ -10,6 +10,8 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class ChargeZombie {
Monster m;
long stuckTimer=0;
Location lastLoc = null;
public ChargeZombie(Monster m) {
this.m=m;

@ -4,6 +4,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import org.bukkit.Achievement;
import org.bukkit.Bukkit;
@ -538,11 +539,14 @@ public class CustomDamage {
if ((shooter instanceof Player) && target!=null) {
Player p = (Player)shooter;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (damager instanceof TippedArrow) {
TippedArrow a = (TippedArrow)damager;
//TwosideKeeper.log("Exploding Arrow 2. Damager is "+GenericFunctions.GetEntityDisplayName(damager), 0);
if (damager instanceof Arrow || damager instanceof TippedArrow) {
Arrow a = (Arrow)damager;
//TwosideKeeper.log("Exploding Arrow 1", 0);
if (a.hasMetadata("EXPLODE_ARR")) {
//Create an explosion.
TwosideKeeper.log("In here", 5);
//TwosideKeeper.log("Exploding Arrow", 0);
Location hitloc = aPlugin.API.getArrowHitLocation(target, a);
GenericFunctions.DealExplosionDamageToEntities(hitloc, getBaseWeaponDamage(weapon,damager,target)+60, 6);
SoundUtils.playGlobalSound(hitloc, Sound.ENTITY_ENDERDRAGON_FIREBALL_EXPLODE, 0.5f, 1.0f);
@ -1205,6 +1209,15 @@ public class CustomDamage {
}
}
}
if (target instanceof Wither) {
Wither w = (Wither)target;
for (UUID id : TwosideKeeper.custommonsters.keySet()) {
if (id.equals(w.getUniqueId())) {
sig.plugin.TwosideKeeper.Monster.Wither wi = (sig.plugin.TwosideKeeper.Monster.Wither)TwosideKeeper.custommonsters.get(id);
wi.runHitEvent(p, dmg);
}
}
}
}
private static void addHealthFromLifesteal(Player p, double damage, ItemStack weapon, String reason) {
@ -1809,6 +1822,7 @@ public class CustomDamage {
double darknessdiv = 0;
double playermodediv = 0;
double witherdiv = 0;
double artifactmult = 0;
if (target instanceof LivingEntity) {
ItemStack[] armor = GenericFunctions.getArmor(target);
@ -1873,6 +1887,7 @@ public class CustomDamage {
double dmgval=-1;
if (dmgval!=-1) {
dmgreduction += dmgval;
artifactmult += 0.08;
}
} else {
switch (armor[i].getType()) {
@ -2008,6 +2023,7 @@ public class CustomDamage {
*(1d-tacticspct)
*(1d-playermodediv)
*(1d-witherdiv)
*(1d-artifactmult)
*setbonus
*((target instanceof Player && ((Player)target).isBlocking())?(PlayerMode.isDefender((Player)target))?0.30:0.50:1)
*((target instanceof Player)?((PlayerMode.isDefender((Player)target))?0.9:(target.getEquipment().getItemInOffHand()!=null && target.getEquipment().getItemInOffHand().getType()==Material.SHIELD)?0.95:1):1);

@ -0,0 +1,20 @@
package sig.plugin.TwosideKeeper.Drops;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import aPlugin.Drop;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
public class DropRandomFirework extends Drop {
public DropRandomFirework(int min, int max, int weight) {
super(min,max,weight,"Holiday Firework");
}
@Override
public ItemStack getItemStack() {
return ItemUtils.createRandomFirework();
}
}

@ -32,7 +32,7 @@ public enum ArtifactAbility {
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC),
EXECUTION("Execute","Deals [VAL] extra damage for every 20% of target's missing health.",new double[]{0.3,0.45,0.6,0.75,0.9,1.05,1.2,1.35,1.50,1.65,1.80,1.95,2.10,2.40,2.70},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.4},100,1,UpgradePath.BASIC),
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.8,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.6,6.4,7.2,8.0,8.8},
LIFESTEAL("Lifesteal","Heals [VAL]% of the damage dealt to targets back to your health pool.",new double[]{0.2,0.3,0.6,0.7,0.8,0.9,1.1,1.3,1.4,1.5,1.6,1.8,2.1,2.6,2.8,3.5},
new double[]{1.0,1.0,0.9,0.9,0.8,0.8,0.75,0.75,0.7,0.7,0.6,0.6,0.5,0.5,0.4},100,1,UpgradePath.WEAPON),
CRITICAL("Critical","[VAL]% chance to deal critical strikes.",new double[]{1.0,1.25,1.5,1.75,2.0,2.25,2.50,2.75,3.0,3.25,3.50,3.75,4.00,4.25,4.50},
new double[]{1.0,0.975,0.95,0.925,0.9,0.875,0.85,0.825,0.8,0.75,0.7,0.65,0.6,0.55,0.5},100,1,UpgradePath.WEAPON),

@ -3689,7 +3689,7 @@ public class GenericFunctions {
return pct;
}
public static void setGlowing(Monster m, Color color) {
public static void setGlowing(LivingEntity m, Color color) {
/*
for (Player p : Bukkit.getOnlinePlayers()) {
GlowAPI.setGlowing(m, false, p);
@ -3792,6 +3792,17 @@ public class GenericFunctions {
return monsterlist;
}
public static List<LivingEntity> getNearbyMonsters(Location l, int range) {
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, range, range, range);
List<LivingEntity> monsterlist = new ArrayList<LivingEntity>();
for (Entity e : ents) {
if ((e instanceof LivingEntity) && !(e instanceof Player)) {
monsterlist.add((LivingEntity)e);
}
}
return monsterlist;
}
public static List<Player> getNearbyPlayers(Location l, int range) {
List<Player> players = new ArrayList<Player>();
Collection<Entity> nearbyentities = l.getWorld().getNearbyEntities(l, range, range, range);
@ -3837,7 +3848,7 @@ public class GenericFunctions {
}
public static void generateNewElite(Player p, String name) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 20l);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new EliteMonsterLocationFinder(p,name), 2l);
}
public static boolean isHunterCompass(ItemStack item) {
@ -4328,7 +4339,33 @@ public class GenericFunctions {
public static void PerformAssassinate(Player player, Material name) {
//Try to find a target to look at.
//LivingEntity target = aPlugin.API.rayTraceTargetEntity(player, 100);
Location originalloc = player.getLocation().clone();
if (aPlugin.API.performAssassinate(player)) {
SoundUtils.playGlobalSound(player.getLocation(), Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
LivingEntity target = aPlugin.API.getTargetEntity(player, 100);
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player));
}
pd.lastassassinatetime=TwosideKeeper.getServerTickTime();
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 5)) {
GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 5, 4));
} else {
GenericFunctions.addIFrame(player, 10);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 3)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED, 100, 4, player);
GenericFunctions.addSuppressionTime(target, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 3, 3));
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(player), player, ItemSet.WOLFSBANE, 7) &&
target.getLocation().distanceSquared(originalloc)<=25) {
pd.lastassassinatetime = TwosideKeeper.getServerTickTime()-TwosideKeeper.ASSASSINATE_COOLDOWN+40;
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
aPlugin.API.sendCooldownPacket(player, name, 40);
}
}
}
/*LivingEntity target = aPlugin.API.getTargetEntity(player, 100);
if (target!=null && !target.isDead()) {
//We found a target, try to jump behind them now.
double mult = 0.0;
@ -4340,7 +4377,7 @@ public class GenericFunctions {
Location originalloc = player.getLocation().clone();
Location teleloc = target.getLocation().add(target.getLocation().getDirection().multiply(-1.0-mult));
int i=0;
/*while (!(teleloc.getBlock().getRelative(0, -1, 0).getType().isSolid() && teleloc.getBlock().getType()==Material.AIR && teleloc.getBlock().getRelative(0, 1, 0).getType()==Material.AIR)) {
while (!(teleloc.getBlock().getRelative(0, -1, 0).getType().isSolid() && teleloc.getBlock().getType()==Material.AIR && teleloc.getBlock().getRelative(0, 1, 0).getType()==Material.AIR)) {
if (i==0) {
teleloc=target.getLocation();
} else
@ -4359,7 +4396,7 @@ public class GenericFunctions {
teleloc=teleloc.add(0,1,0);
}
i++;
}*/
}
int tries = 0;
while (tries<2) {
if ((TwosideKeeper.isNatural.contains(teleloc.getBlock().getType()) || teleloc.getBlock().getType()==Material.AIR) &&
@ -4405,7 +4442,7 @@ public class GenericFunctions {
aPlugin.API.sendCooldownPacket(player, name, 40);
}
}
}
}*/
}
public static void DamageRandomTool(Player p) {

@ -18,7 +18,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum ItemSet {
PANROS(1,1, 6,4, 10,10, 20,10),
SONGSTEEL(4,2, 6,2, 8,8, 20,10),
DAWNTRACKER(2,1, 20,10, 20,10, 10,5),
DAWNTRACKER(2,1, 20,10, 10,5, 10,5),
LORASYS(2,2, 0,0, 0,0, 0,0),
JAMDAK(3,3, 5,1, 10,1, 10,2), //Graceful Dodge is in ticks.
DARNYS(2,1, 10,5, 20,5, 1,1),

@ -143,7 +143,7 @@ public class WorldShop {
price = pricelist.get(item.getType().name());
}
if (TwosideKeeper.DEAL_OF_THE_DAY_ITEM.isSimilar(item)) {
return price*0.8;
return price*(1-TwosideKeeper.DEAL_OF_THE_DAY_PCT);
}
return ModifyPriceBasedOnLocation(price);
}
@ -219,6 +219,23 @@ public class WorldShop {
}
}
public static void SaveAllPriceEntriesToFile() {
try(
FileWriter fw = new FileWriter(price_file);
BufferedWriter bw = new BufferedWriter(fw);)
{
for (String str : pricelist.keySet()) {
bw.write(str+","+pricelist.get(str));
bw.newLine();
}
bw.close();
TwosideKeeper.log("Saved all Shop Price entries to "+price_file, 2);
} catch (IOException e) {
e.printStackTrace();
TwosideKeeper.log("Something terrible happened while trying to save Shop Price entries!", 0);
}
}
public int getID() {
return id;
}
@ -1249,6 +1266,18 @@ public class WorldShop {
}
}
//Returns 0.0-1.0 of the Percent off of the Deal of the Day.
public static double generatePercentOffForDealOftheDay() {
Calendar cal = Calendar.getInstance();
int seed = cal.get(Calendar.YEAR)*cal.get(Calendar.DAY_OF_YEAR);
Random r = new Random();
r.setSeed(seed);
Set<String> items = WorldShop.pricelist.keySet();
int rand = r.nextInt(5); //20-60%
double pctoff = 0.2+(rand*0.1);
return pctoff;
}
public static ItemStack generateItemDealOftheDay(int iter) {
Calendar cal = Calendar.getInstance();
int seed = cal.get(Calendar.YEAR)*cal.get(Calendar.DAY_OF_YEAR)*iter;

@ -41,6 +41,7 @@ import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.Drops.DropRandomFirework;
import sig.plugin.TwosideKeeper.Drops.SigDrop;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
@ -534,7 +535,7 @@ public class Christmas {
c.addDrop(new DropMaterial(Material.LAPIS_BLOCK,1,4,5));
c.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,1,4,5));
c.addDrop(new DropMaterial(Material.EMERALD_BLOCK,1,4,5));
c.addDrop(new DropMaterial(Material.FIREWORK,32,64,30));
c.addDrop(new DropRandomFirework(32,64,30));
c.addDrop(new DropMaterial(Material.NETHER_STAR,1));
c.addDrop(new DropItem(getCookieItem(),1,3,20));
c.addDrop(new DropItem(getSmallCandyItem(),1,3,5));

@ -1,9 +1,15 @@
package sig.plugin.TwosideKeeper.Monster;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
@ -12,6 +18,7 @@ import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import sig.plugin.TwosideKeeper.ChargeZombie;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.CustomMonster;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
@ -24,6 +31,8 @@ public class Wither extends CustomMonster{
private long lastWitherSkeletonSpawned=0;
private long stuckTimer=0;
private Location lastLoc = null;
private List<Player> activeplayers = new ArrayList<Player>();
private HashMap<String,Double> dmgbreakdown = new HashMap<String,Double>();
public Wither(LivingEntity m) {
super(m);
@ -38,8 +47,29 @@ public class Wither extends CustomMonster{
this.lastSkullShot = TwosideKeeper.getServerTickTime();
}
public void runHitEvent(Entity damager, double damage) { //Runs when this monster gets hit.
LivingEntity shooter = CustomDamage.getDamagerEntity(damager);
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (dmgbreakdown.containsKey(p.getName())) {
dmgbreakdown.put(p.getName(), dmgbreakdown.get(p.getName())+damage);
} else {
dmgbreakdown.put(p.getName(), damage);
}
if (!activeplayers.contains(p)) {
activeplayers.add(p);
}
}
}
public void runTick() {
if (m instanceof Monster) {
RemoveInactivePlayers();
if (activeplayers.size()==0 && dmgbreakdown.size()>0) {
DisplayFailedDPSReport();
}
if (((Monster) m).getTarget()!=null) {
ChargeZombie.BreakBlocksAroundArea((Monster)m, 2);
}
@ -57,7 +87,7 @@ public class Wither extends CustomMonster{
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(Math.random()*10-5,0,0));
} else
if (numb<=0.33) {
if (numb<=0.5) {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(0,0,Math.random()*10-5));
} else
@ -70,8 +100,13 @@ public class Wither extends CustomMonster{
if (m.getHealth()<m.getMaxHealth()) {
m.setHealth(Math.min(m.getMaxHealth(), m.getHealth()+5));
}
if (m.getLocation().getY()>=128) {
m.teleport(m.getLocation().add(0,-32,0));
if (m.getWorld().getName().equalsIgnoreCase("world_nether") && m.getLocation().getY()>=128) {
m.teleport(m.getLocation().add(0,-4,0));
} else
if (m.getWorld().getName().equalsIgnoreCase("world") && m.getLocation().getY()>=164) {
Location newloc = m.getLocation().clone();
newloc.setY(164);
m.teleport(newloc);
}
if (m.getHealth()<86000 && lastWitherSkeletonSpawned+40<TwosideKeeper.getServerTickTime() &&
GenericFunctions.GetNearbyMonsterCount(m, 32)<50) {
@ -92,6 +127,61 @@ public class Wither extends CustomMonster{
}
}
private void RemoveInactivePlayers() {
for (Player pl : activeplayers) {
if (pl==null || !pl.isValid() || pl.isDead() || !pl.isOnline()) {
TwosideKeeper.ScheduleRemoval(activeplayers, pl);
}
}
}
private void DisplayFailedDPSReport() {
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```");
dmgbreakdown.clear();
}
public void DisplaySuccessfulDPSReport() {
Bukkit.getServer().broadcastMessage(GenericFunctions.getDisplayName(m)+" has been defeated!");
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(generateDPSReport());
aPlugin.API.discordSendRaw(GenericFunctions.getDisplayName(m)+" has been defeated!\n\n"+ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+generateDPSReport()+"\n```");
dmgbreakdown.clear();
}
public String generateDPSReport() {
//Sorts a list of players by DPS contribution.
List<Double> sorted_dmg = new ArrayList<Double>();
List<String> sorted_pl = new ArrayList<String>();
double totaldmg = 0;
for (String pl : dmgbreakdown.keySet()) {
double dmg = dmgbreakdown.get(pl);
int slot = 0;
totaldmg+=dmg;
for (int i=0;i<sorted_dmg.size();i++) {
if (dmg>sorted_dmg.get(i)) {
break;
} else {
slot++;
}
}
sorted_pl.add(slot,pl);
sorted_dmg.add(slot,dmg);
}
StringBuilder finalstr = new StringBuilder();
DecimalFormat df = new DecimalFormat("0.00");
for (int i=0;i<sorted_pl.size();i++) {
if (finalstr.length()!=0) {
finalstr.append("\n");
}
finalstr.append(sorted_pl.get(i)+": "+df.format(sorted_dmg.get(i))+" dmg ("+df.format((sorted_dmg.get(i)/totaldmg)*100)+"%)");
}
return finalstr.toString();
}
private Player FindClosestNearbyTarget() {
Player closestplayer=null;
double dist=999999;

@ -1313,6 +1313,8 @@ public class MonsterController {
LivingEntityStructure les = LivingEntityStructure.getLivingEntityStructure(ent);
les.SetLeader(true);
les.m.setMaxHealth(480000);
les.m.setCustomName(ChatColor.RED+"Leader Wither");
les.m.setCustomNameVisible(true);
les.m.setHealth(les.m.getMaxHealth());
if (les.m.getLocation().getY()>=128) {
les.m.teleport(les.m.getLocation().add(0,-32,0));

@ -25,6 +25,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.BowMode;
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.Logging.DamageLogger;
//import com.google.common.graph.*;
@ -242,7 +243,6 @@ public class PlayerStructure {
this.isPlayingSpleef=false;
this.iframetime=TwosideKeeper.getServerTickTime();
//Set defaults first, in case this is a new user.
setDefaultCooldowns(p);
loadConfig();
p.getInventory().addItem(new ItemStack(Material.PORTAL));
@ -282,17 +282,20 @@ public class PlayerStructure {
//Joined always gets set to new time.
this.joined = serverTickTime;
setDefaultCooldowns(p);
}
}
private void setDefaultCooldowns(Player p) {
aPlugin.API.sendCooldownPacket(p, Material.BOW, TwosideKeeper.DODGE_COOLDOWN);
applyCooldownToAllTypes(p,"HOE",TwosideKeeper.DEATHMARK_COOLDOWN);
applyCooldownToAllTypes(p,"SPADE",TwosideKeeper.EARTHWAVE_COOLDOWN);
applyCooldownToAllTypes(p,"SWORD",TwosideKeeper.LINEDRIVE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, TwosideKeeper.REJUVENATE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, TwosideKeeper.LIFESAVER_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.WATCH, TwosideKeeper.ICEWAND_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.BOW, GenericFunctions.GetRemainingCooldownTime(p, last_dodge, TwosideKeeper.DODGE_COOLDOWN));
applyCooldownToAllTypes(p,"HOE",GenericFunctions.GetRemainingCooldownTime(p, last_deathmark, TwosideKeeper.DEATHMARK_COOLDOWN));
applyCooldownToAllTypes(p,"SPADE",GenericFunctions.GetRemainingCooldownTime(p, lastusedearthwave, TwosideKeeper.EARTHWAVE_COOLDOWN));
applyCooldownToAllTypes(p,"SWORD",GenericFunctions.GetRemainingCooldownTime(p, last_strikerspell, TwosideKeeper.LINEDRIVE_COOLDOWN));
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, GenericFunctions.GetRemainingCooldownTime(p, last_rejuvenate, TwosideKeeper.REJUVENATE_COOLDOWN));
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetRemainingCooldownTime(p, lastlifesavertime, TwosideKeeper.LIFESAVER_COOLDOWN));
aPlugin.API.sendCooldownPacket(p, Material.WATCH, GenericFunctions.GetRemainingCooldownTime(p, icewandused, TwosideKeeper.ICEWAND_COOLDOWN));
aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, GenericFunctions.GetRemainingCooldownTime(p, lastcandyconsumed, 40));
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, GenericFunctions.GetRemainingCooldownTime(p, lastrevivecandyconsumed, 200));
}
private void applyCooldownToAllTypes(Player p, String item, int cooldown) {
@ -306,7 +309,7 @@ public class PlayerStructure {
//Save the configuration.
public void saveConfig() {
File config;
config = new File(TwosideKeeper.filesave,"users/"+name+".data");
config = new File(TwosideKeeper.filesave,"users/"+Bukkit.getPlayer(name).getUniqueId()+".data");
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
workable.set("name", name);
@ -351,6 +354,25 @@ public class PlayerStructure {
workable.set("deathloc_y", deathloc_y);
workable.set("deathloc_z", deathloc_z);
workable.set("deathloc_world", deathloc_world);
workable.set("COOLDOWN_deathmark", last_deathmark);
workable.set("COOLDOWN_shovelspell", last_shovelspell);
workable.set("COOLDOWN_strikerspell", last_strikerspell);
workable.set("COOLDOWN_usedearthwave", lastusedearthwave);
workable.set("COOLDOWN_arrowbarrage", last_arrowbarrage);
workable.set("COOLDOWN_laughtime", last_laugh_time);
workable.set("COOLDOWN_rejuvenate", last_rejuvenate);
workable.set("COOLDOWN_swordhit", last_swordhit);
workable.set("COOLDOWN_strikerspell", last_strikerspell);
workable.set("COOLDOWN_absorptionhealthgiven", lastabsorptionhealthgiven);
workable.set("COOLDOWN_ignoretargetarmor", ignoretargetarmor);
workable.set("COOLDOWN_lastrevivecandyconsumed", lastrevivecandyconsumed);
workable.set("COOLDOWN_lastcandyconsumed", lastcandyconsumed);
workable.set("COOLDOWN_icewandused", icewandused);
workable.set("COOLDOWN_lastdodge", last_dodge);
workable.set("COOLDOWN_lastsiphon", last_siphon);
workable.set("COOLDOWN_lastmock", last_mock);
workable.set("COOLDOWN_lastassassinatetime", lastassassinatetime);
workable.set("COOLDOWN_lastlifesavertime", lastlifesavertime);
try {
workable.save(config);
@ -361,8 +383,14 @@ public class PlayerStructure {
//Create a config for the player.
public void loadConfig(){
File config;
config = new File(TwosideKeeper.filesave,"users/"+name+".data");
Player p = Bukkit.getPlayer(name);
File config,testconfig;
testconfig = new File(TwosideKeeper.filesave,"users/"+name+".data");
config = new File(TwosideKeeper.filesave,"users/"+p.getUniqueId()+".data");
if (testconfig.exists()) {
TwosideKeeper.log("Renaming old config for player "+ChatColor.YELLOW+name+ChatColor.RESET+" to UUID "+ChatColor.YELLOW+p.getUniqueId(), 1);
testconfig.renameTo(config);
}
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
//Add all our default settings here.
@ -382,6 +410,7 @@ public class PlayerStructure {
workable.addDefault("weaponcharges", weaponcharges);
workable.addDefault("lifestealstacks", lifestealstacks);
workable.addDefault("vendetta_amt", vendetta_amt);
workable.addDefault("lastvendettastack", lastvendettastack);
workable.addDefault("weatherwatch", weatherwatch);
workable.addDefault("weatherwatch_user", weatherwatch_user);
workable.addDefault("holidaychest1", holidaychest1);
@ -390,12 +419,31 @@ public class PlayerStructure {
workable.addDefault("holidaychest4", holidaychest4);
workable.addDefault("lastsantabox2", lastsantabox2);
workable.addDefault("playermode_on_death", playermode_on_death.name());
workable.addDefault("COOLDOWN_deathmark", last_deathmark);
workable.addDefault("COOLDOWN_shovelspell", last_shovelspell);
workable.addDefault("COOLDOWN_strikerspell", last_strikerspell);
workable.addDefault("COOLDOWN_usedearthwave", lastusedearthwave);
workable.addDefault("COOLDOWN_arrowbarrage", last_arrowbarrage);
workable.addDefault("COOLDOWN_laughtime", last_laugh_time);
workable.addDefault("COOLDOWN_rejuvenate", last_rejuvenate);
workable.addDefault("COOLDOWN_swordhit", last_swordhit);
workable.addDefault("COOLDOWN_strikerspell", last_strikerspell);
workable.addDefault("COOLDOWN_absorptionhealthgiven", lastabsorptionhealthgiven);
workable.addDefault("COOLDOWN_ignoretargetarmor", ignoretargetarmor);
workable.addDefault("COOLDOWN_lastrevivecandyconsumed", lastrevivecandyconsumed);
workable.addDefault("COOLDOWN_lastcandyconsumed", lastcandyconsumed);
workable.addDefault("COOLDOWN_icewandused", icewandused);
workable.addDefault("COOLDOWN_lastdodge", last_dodge);
workable.addDefault("COOLDOWN_lastsiphon", last_siphon);
workable.addDefault("COOLDOWN_lastmock", last_mock);
workable.addDefault("COOLDOWN_lastassassinatetime", lastassassinatetime);
workable.addDefault("COOLDOWN_lastlifesavertime", lastlifesavertime);
workable.options().copyDefaults();
//Set all variables.
this.name = workable.getString("name");
//this.name = workable.getString("name");
//this.displayName = workable.getString("displayName");
this.joined = workable.getLong("joined");
this.firstjoined = workable.getLong("firstjoined");
@ -424,7 +472,27 @@ public class PlayerStructure {
this.holidaychest3 = workable.getBoolean("holidaychest3");
this.holidaychest4 = workable.getBoolean("holidaychest4");
this.lastsantabox2 = workable.getLong("lastsantabox2");
this.lastvendettastack = workable.getLong("lastvendettastack");
this.playermode_on_death = PlayerMode.valueOf(workable.getString("playermode_on_death"));
this.last_deathmark = workable.getLong("COOLDOWN_deathmark");
this.last_shovelspell = workable.getLong("COOLDOWN_shovelspell");
this.last_strikerspell = workable.getLong("COOLDOWN_strikerspell");
this.lastusedearthwave = workable.getLong("COOLDOWN_usedearthwave");
this.last_arrowbarrage = workable.getLong("COOLDOWN_arrowbarrage");
this.last_laugh_time = workable.getLong("COOLDOWN_laughtime");
this.last_rejuvenate = workable.getLong("COOLDOWN_rejuvenate");
this.last_swordhit = workable.getLong("COOLDOWN_swordhit");
this.last_strikerspell = workable.getLong("COOLDOWN_strikerspell");
this.lastabsorptionhealthgiven = workable.getLong("COOLDOWN_absorptionhealthgiven");
this.ignoretargetarmor = workable.getLong("COOLDOWN_ignoretargetarmor");
this.lastrevivecandyconsumed = workable.getLong("COOLDOWN_lastrevivecandyconsumed");
this.lastcandyconsumed = workable.getLong("COOLDOWN_lastcandyconsumed");
this.icewandused = workable.getLong("COOLDOWN_icewandused");
this.last_dodge = workable.getLong("COOLDOWN_lastdodge");
this.last_siphon = workable.getLong("COOLDOWN_lastsiphon");
this.last_mock = workable.getLong("COOLDOWN_lastmock");
this.lastassassinatetime = workable.getLong("COOLDOWN_lastassassinatetime");
this.lastlifesavertime = workable.getLong("COOLDOWN_lastlifesavertime");
if (this.hasDied) {
List<ItemStack> deathlootlist = new ArrayList<ItemStack>();

@ -480,6 +480,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public int sleepingPlayers=0;
public static List<Material> validsetitems = new ArrayList<Material>();
public static double DEAL_OF_THE_DAY_PCT=0.2;
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.
@ -653,37 +655,73 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else {
//This is fine! Clear away blocks.
Monster m = cz.GetZombie();
if (cz.lastLoc!=null && cz.lastLoc.distance(m.getLocation())<=0.4) {
cz.stuckTimer++;
//TwosideKeeper.log("Stuck. "+stuckTimer, 0);
} else {
cz.stuckTimer=0;
}
cz.lastLoc = m.getLocation().clone();
if (cz.stuckTimer>5) {
//Teleport randomly.
double numb = Math.random();
if (numb<=0.33) {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(Math.random()*6-3,0,0));
} else
if (numb<=0.5) {
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(0,0,Math.random()*6-3));
} else
{
SoundUtils.playGlobalSound(m.getLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0f, 1.0f);
m.teleport(m.getLocation().add(0,Math.random()*6-3,0));
}
cz.stuckTimer=0;
}
if (m.getTarget().getLocation().getY()>=m.getLocation().getY()+2 &&
Math.abs(m.getTarget().getLocation().getX()-m.getLocation().getX())<1 &&
Math.abs(m.getTarget().getLocation().getZ()-m.getLocation().getZ())<1) {
Math.abs(m.getTarget().getLocation().getX()-m.getLocation().getX())<3 &&
Math.abs(m.getTarget().getLocation().getZ()-m.getLocation().getZ())<3) {
//This target is higher than we can reach... Let's pillar.
Random r = new Random();
r.setSeed(m.getUniqueId().getMostSignificantBits());
//Block type is chosen based on the seed. Will be cobblestone, dirt, or gravel.
if (m.getLocation().getBlock().getType()==Material.AIR &&
m.getLocation().add(0,-1,0).getBlock().getType()!=Material.AIR &&
!m.getLocation().add(0,-1,0).getBlock().isLiquid()) {
for (int x=-1;x<2;x++) {
for (int z=-1;z<2;z++) {
if (m.getLocation().add(x,-1,z).getBlock().getType()==Material.AIR ||
m.getLocation().add(x,-1,z).getBlock().isLiquid()) {
m.setVelocity(new Vector(0,0.5,0));
if (m.getLocation().getWorld().getName().equalsIgnoreCase("world_nether")) {
m.getLocation().getBlock().setType(Material.NETHERRACK);
m.getLocation().getBlock().getRelative(x,0,z).setType(Material.NETHERRACK);
SoundUtils.playGlobalSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f);
} else {
switch (r.nextInt(3)) {
case 0:{
SoundUtils.playGlobalSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f);
m.getLocation().getBlock().getRelative(x,0,z).setType(Material.DIRT);
SoundUtils.playGlobalSound(m.getLocation().add(x,0,z), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f);
}break;
case 1:{
m.getLocation().getBlock().setType(Material.COBBLESTONE);
SoundUtils.playGlobalSound(m.getLocation(), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f);
m.getLocation().getBlock().getRelative(x,0,z).setType(Material.COBBLESTONE);
SoundUtils.playGlobalSound(m.getLocation().add(x,0,z), Sound.BLOCK_STONE_PLACE, 1.0f, 1.0f);
}break;
case 2:{
m.getLocation().getBlock().setType(Material.GRAVEL);
SoundUtils.playGlobalSound(m.getLocation(), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f);
m.getLocation().getBlock().getRelative(x,0,z).setType(Material.GRAVEL);
SoundUtils.playGlobalSound(m.getLocation().add(x,0,z), Sound.BLOCK_GRAVEL_PLACE, 1.0f, 1.0f);
}break;
}
}
}
}
}
//Command all nearby entities to jump too.
List<LivingEntity> ents = GenericFunctions.getNearbyMonsters(m.getLocation(), 2);
for (LivingEntity ent : ents) {
if (!ent.equals(m)) {
ent.setVelocity(new Vector(0,0.5,0));
}
}
}
ChargeZombie.BreakBlocksAroundArea(cz.m,1);
}
}
@ -893,6 +931,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
WorldShop.createWorldShopRecipes();
WorldShop.loadShopPrices();
TwosideKeeper.DEAL_OF_THE_DAY_ITEM = WorldShop.generateItemDealOftheDay(1);
TwosideKeeper.DEAL_OF_THE_DAY_PCT = WorldShop.generatePercentOffForDealOftheDay();
log("Deal of the day loaded successfully: "+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM),2);
if (!LOOT_TABLE_NEEDS_POPULATING) {
@ -1155,6 +1194,49 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (p.getLocation().add(0,0,0).getBlock().getType()==Material.PISTON_MOVING_PIECE) {
p.getLocation().add(0,0,0).getBlock().setType(Material.AIR);
}
if (args.length>0) {
ItemStack item = new ItemStack(p.getEquipment().getItemInMainHand().getType(),1,p.getEquipment().getItemInMainHand().getDurability());
if (GenericFunctions.isEquip(item)) {
item.setDurability((short) 0);
}
switch (args[0]) {
case "price":{
if (args.length<2) { //Display the price of the item in hand.
if (item!=null && item.getType()!=Material.AIR) {
double price = WorldShop.getBaseWorldShopPrice(item);
p.sendMessage("The base shop price of "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.RESET+" is "+ChatColor.GREEN+"$"+df.format(price)+ChatColor.RESET+".");
} else {
p.sendMessage("That is an invalid item!");
}
} else {
if (p.getName().equalsIgnoreCase("ishiyama") || p.isOp()) {
if (isNumeric(args[1])) {
double newprice = Double.parseDouble(args[1]);
if (item!=null && item.getType()!=Material.AIR) {
double price = WorldShop.getBaseWorldShopPrice(item);
Bukkit.broadcastMessage(ChatColor.YELLOW+"The base cost of "+ChatColor.GREEN+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.YELLOW+" has been updated!");
Bukkit.broadcastMessage(" "+ChatColor.GRAY+ChatColor.STRIKETHROUGH+"$"+df.format(price)+ChatColor.RESET+" -> "+ChatColor.BLUE+ChatColor.BOLD+"$"+df.format(newprice));
aPlugin.API.discordSendRawItalicized(ChatColor.YELLOW+"The base cost of **"+ChatColor.GREEN+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.YELLOW+"** has been updated!");
aPlugin.API.discordSendRawItalicized(" ~~"+ChatColor.GRAY+ChatColor.STRIKETHROUGH+"$"+df.format(price)+ChatColor.RESET+"~~ -> **"+ChatColor.BLUE+ChatColor.BOLD+"$"+df.format(newprice)+"**");
String searchstring = item.getType().name();
if (item.getDurability()!=0) {
searchstring = item.getType().name()+","+item.getDurability();
}
WorldShop.pricelist.put(searchstring, newprice);
WorldShop.SaveAllPriceEntriesToFile();
} else {
p.sendMessage("That is an invalid item!");
}
} else {
p.sendMessage("That is an invalid price!");
}
} else {
p.sendMessage("No permission!");
}
}
}break;
}
}
if (p.isOp()) {
/*PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.swordcombo=20;*/
@ -2194,7 +2276,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.sendMessage("--------------------");
p.sendMessage(ChatColor.DARK_AQUA+""+ChatColor.BOLD+"Deal of the Day:");
DecimalFormat df = new DecimalFormat("0.00");
p.sendMessage(" "+ChatColor.GREEN+""+ChatColor.BOLD+""+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+" "+ChatColor.RESET+ChatColor.STRIKETHROUGH+"$"+df.format(TwosideKeeperAPI.getWorldShopItemBasePrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+ChatColor.RESET+ChatColor.GOLD+""+ChatColor.BOLD+" $"+df.format(TwosideKeeperAPI.getWorldShopItemBasePrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*0.8)+" "+ChatColor.DARK_GREEN+ChatColor.BOLD+"20% Off");
DecimalFormat df2 = new DecimalFormat("0");
p.sendMessage(" "+ChatColor.GREEN+""+ChatColor.BOLD+""+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+" "+ChatColor.RESET+ChatColor.STRIKETHROUGH+"$"+df.format(TwosideKeeperAPI.getWorldShopItemBasePrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+ChatColor.RESET+ChatColor.GOLD+""+ChatColor.BOLD+" $"+df.format(TwosideKeeperAPI.getWorldShopItemBasePrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*(1-TwosideKeeper.DEAL_OF_THE_DAY_PCT))+" "+ChatColor.DARK_GREEN+ChatColor.BOLD+""+df2.format(TwosideKeeper.DEAL_OF_THE_DAY_PCT*100)+"% Off");
p.sendMessage(" "+ChatColor.RED+ChatColor.BOLD+"TODAY ONLY!"+ChatColor.RESET+ChatColor.YELLOW+" Find the offer at your local world shops!");
p.sendMessage("--------------------");
}
@ -5985,6 +6068,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("In here 1",5);
Monster m = (Monster)ev.getEntity();
if (ev.getTarget() instanceof Monster &&
m.getTarget() instanceof Player) {
ev.setCancelled(true); //Monsters will not target other Monsters if they are already targeting a player.
return;
}
if (ev.getTarget() instanceof Wither) {
ev.setCancelled(true);
return; //Monsters will not target the Wither, even with friendly fire.
@ -6369,6 +6458,13 @@ 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()) {
if (id.equals(m.getUniqueId())) {
sig.plugin.TwosideKeeper.Monster.Wither w = (sig.plugin.TwosideKeeper.Monster.Wither)custommonsters.get(id);
w.DisplaySuccessfulDPSReport();
break;
}
}
}
if (isElite && m instanceof Monster) {
@ -6409,7 +6505,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
it.setPickupDelay(0);
}
}
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" "+(participants_list.length()==1?"has single-handedly taken down the ":"have successfully slain ")+GenericFunctions.getDisplayName(m)+ChatColor.WHITE+"!");
aPlugin.API.discordSendRaw(ChatColor.GREEN+participants_list.toString()+ChatColor.WHITE+" "+(participants_list.length()==1?"has single-handedly taken down the ":"have successfully slain ")+"**"+GenericFunctions.getDisplayName(m)+ChatColor.WHITE+"**!");
m.getWorld().spawnEntity(m.getLocation(), EntityType.LIGHTNING);
@ -6419,6 +6514,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
Bukkit.getServer().broadcastMessage(ChatColor.YELLOW+"DPS Breakdown:");
Bukkit.getServer().broadcastMessage(em.generateDPSReport());
aPlugin.API.discordSendRaw(ChatColor.YELLOW+"DPS Breakdown:"+"\n```\n"+em.generateDPSReport()+"\n```");
em.Cleanup();
@ -6474,11 +6570,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (!mer.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer.getLocation().getBlockY()<48) {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 3.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 3);
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 1.5f, false, true);
aPlugin.API.sendSoundlessExplosion(mer.getLocation(), 3.0f);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 20, 3);
} else {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 6);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 20, 6);
}
}}
,30);
@ -6505,12 +6602,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (!mer1.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer1.getLocation().getBlockY()<48) {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 5);
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 2.0f, false, true);
aPlugin.API.sendSoundlessExplosion(mer1.getLocation(), 5.0f);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 36, 5);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),2);
} else {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 6);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 36, 6);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),3);
}
}}
@ -6538,7 +6636,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (!mer4.getLocation().getWorld().getName().equalsIgnoreCase("world") || mer4.getLocation().getBlockY()<48) {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true);
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 2.0f, false, true);
aPlugin.API.sendSoundlessExplosion(mer4.getLocation(), 5.0f);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 150, 5);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2);
} else {

@ -78,14 +78,15 @@ final class runServerHeartbeat implements Runnable {
//SAVE SERVER SETTINGS.
final long serverTickTime = TwosideKeeper.getServerTickTime();
if (serverTickTime-TwosideKeeper.LASTSERVERCHECK>=TwosideKeeper.SERVERCHECKERTICKS) { //15 MINUTES (DEFAULT)
if (TwosideKeeper.LAST_DEAL!=Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) {
//This means the deal of the day has to be updated!
TwosideKeeper.LAST_DEAL = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
TwosideKeeper.DEAL_OF_THE_DAY_ITEM = WorldShop.generateItemDealOftheDay(1);
TwosideKeeper.DEAL_OF_THE_DAY_PCT = WorldShop.generatePercentOffForDealOftheDay();
if (TwosideKeeper.SERVER_TYPE!=ServerType.QUIET) {
DecimalFormat df = new DecimalFormat("0.00");
aPlugin.API.discordSendRaw("*The Deal of the Day has been updated!*\n **"+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+"** ~~$"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+"~~ $"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*0.8)+" **20% Off!**");
DecimalFormat df2 = new DecimalFormat("0");
aPlugin.API.discordSendRaw("*The Deal of the Day has been updated!*\n **"+GenericFunctions.UserFriendlyMaterialName(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)+"** ~~$"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM))+"~~ $"+df.format(WorldShop.getBaseWorldShopPrice(TwosideKeeper.DEAL_OF_THE_DAY_ITEM)*(1-TwosideKeeper.DEAL_OF_THE_DAY_PCT))+" **"+df2.format(TwosideKeeper.DEAL_OF_THE_DAY_PCT*100)+"% Off!**");
//MessageUtils.announceMessage("The Deal of the Day has been updated!");
}
for (Player p : Bukkit.getOnlinePlayers()) {
@ -193,49 +194,119 @@ final class runServerHeartbeat implements Runnable {
}
if (!aPlugin.API.isAFK(p)) {
if (TwosideKeeper.TwosideShops.IsPlayerUsingTerminal(p) &&
(TwosideKeeper.TwosideShops.GetSession(p).GetSign().getBlock()==null || TwosideKeeper.TwosideShops.GetSession(p).IsTimeExpired())) {
p.sendMessage(ChatColor.RED+"Ran out of time! "+ChatColor.WHITE+"Shop session closed.");
TwosideKeeper.TwosideShops.RemoveSession(p);
}
EndShopSession(p);
GenericFunctions.RemoveNewDebuffs(p);
if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)>0) {
double spdmult = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)/100d;
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
ModifyDasherSetSpeedMultiplier(p);
ManageHighwinder(p, pd);
RemoveInvalidTarget(p, pd);
GiveArtifactBowXP(serverTickTime, p, pd);
ReduceFireResistanceDuration(p);
ControlTheEnd(p, pd);
ItemStack[] equips = p.getEquipment().getArmorContents();
ShadowWalkerApplication(p, equips);
//PopulatePlayerBlockList(p,15,15,2,5,false);
PopRandomLavaBlock(p);
GenericFunctions.sendActionBarMessage(p, "");
GenericFunctions.AutoRepairItems(p);
if (GenericFunctions.hasStealth(p)) {GenericFunctions.DamageRandomTool(p);}
//See if this player is sleeping.
HealForSleeping(p, pd);
//We need to see if this player's damage reduction has changed recently. If so, notify them.
//Check damage reduction by sending an artifical "1" damage to the player.
ManagePlayerScoreboardAndHealth(p);
if (PlayerMode.isBarbarian(p)) {
AutoConsumeFoods(p);
}
}
pd.highwinder=ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
if (pd.highwinder) {
pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
ModifyArmorBar(p);
ItemStack[] equips = p.getEquipment().getArmorContents();
ResetVendetta(serverTickTime, pd);
ResetLifestealStacks(serverTickTime, pd);
ManagePlayerLink(p, pd);
DepleteDamagePool(serverTickTime, p, pd);
AdventurerModeSetExhaustion(p);
CalculateHealthRegeneration(serverTickTime, p, pd, equips);
ResetSwordCombo(serverTickTime, p, pd);
ResetSlayerAggro(serverTickTime, p, pd);
ApplyCometRegenBonus(p);
DasherFoodRegenPerk(p);
GivePartyNightVision(p);
}
if (93.182445*pd.velocity>4.317) {
pd.velocity/=2;
} else {
pd.velocity=0;
//TwosideKeeper.outputArmorDurability(p,">");
}
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,pd.highwinderdmg),true);
ManageSnowmanHunt();
CheckAndAnnounceWeather();
Christmas.ChristmasHeartbeat();
MaintainMonsterData();
PartyManager.SetupParties();
TwosideKeeper.TwosideSpleefGames.TickEvent();
performTimingsReport();
}
if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())>256) {
pd.target=null;
private void ManagePlayerScoreboardAndHealth(Player p) {
if (!p.isDead()) {TwosideKeeper.log("Player is not dead.",5); TwosideKeeper.setPlayerMaxHealth(p);}
if (p.getScoreboard().getTeam(p.getName().toLowerCase())==null) {
p.getScoreboard().registerNewTeam(p.getName().toLowerCase()).addPlayer(p);
}
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
}
if (pd.lasthittarget+20*15<=serverTickTime && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 4);
pd.storedbowxp=0;
private void HealForSleeping(Player p, PlayerStructure pd) {
if (p.isSleeping()) {
p.setHealth(Bukkit.getPlayer(pd.name).getMaxHealth()); //Heals the player fully when sleeping.
}
}
if (p.getFireTicks()>0 && p.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
int duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.FIRE_RESISTANCE, p);
int lv = GenericFunctions.getPotionEffectLevel(PotionEffectType.FIRE_RESISTANCE, p);
if (lv>10) {lv=10;}
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.FIRE_RESISTANCE, duration-(20*(10-lv)), lv, p, true);
private void ShadowWalkerApplication(Player p, ItemStack[] equips) {
for (ItemStack equip : equips) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, equip) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
}
}
if (p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand())) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
}
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
}
}
private void ControlTheEnd(Player p, PlayerStructure pd) {
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
if (!pd.endnotification) {
pd.endnotification=true;
@ -247,49 +318,67 @@ final class runServerHeartbeat implements Runnable {
pd.endnotification=false;
}
}
}
ItemStack[] equips = p.getEquipment().getArmorContents();
for (ItemStack equip : equips) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, equip) &&
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
private void ReduceFireResistanceDuration(Player p) {
if (p.getFireTicks()>0 && p.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
int duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.FIRE_RESISTANCE, p);
int lv = GenericFunctions.getPotionEffectLevel(PotionEffectType.FIRE_RESISTANCE, p);
if (lv>10) {lv=10;}
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.FIRE_RESISTANCE, duration-(20*(10-lv)), lv, p, true);
}
}
if (p.getLocation().getY()>=0 && p.getLocation().getY()<=255 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=7) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand())) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SPEED,20,1,p);
private void GiveArtifactBowXP(final long serverTickTime, Player p, PlayerStructure pd) {
if (pd.lasthittarget+20*15<=serverTickTime && pd.storedbowxp>0 && GenericFunctions.isArtifactEquip(p.getEquipment().getItemInMainHand()) &&
p.getEquipment().getItemInMainHand().getType()==Material.BOW) {
AwakenedArtifact.addPotentialEXP(p.getEquipment().getItemInMainHand(), pd.storedbowxp, p);
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 4);
pd.storedbowxp=0;
}
//log("Apply speed. The light level here is "+p.getLocation().add(0,-1,0).getBlock().getLightLevel(),2);
}
//PopulatePlayerBlockList(p,15,15,2,5,false);
PopRandomLavaBlock(p);
GenericFunctions.sendActionBarMessage(p, "");
GenericFunctions.AutoRepairItems(p);
if (GenericFunctions.hasStealth(p)) {GenericFunctions.DamageRandomTool(p);}
private void RemoveInvalidTarget(Player p, PlayerStructure pd) {
if (pd.target!=null && !pd.target.isDead() && pd.target.getLocation().getWorld().equals(p.getWorld()) && pd.target.getLocation().distanceSquared(p.getLocation())>256) {
pd.target=null;
}
}
//See if this player is sleeping.
if (p.isSleeping()) {
p.setHealth(Bukkit.getPlayer(pd.name).getMaxHealth()); //Heals the player fully when sleeping.
private void ManageHighwinder(Player p, PlayerStructure pd) {
pd.highwinder=ArtifactAbility.containsEnchantment(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
if (pd.highwinder) {
pd.highwinderdmg=GenericFunctions.getAbilityValue(ArtifactAbility.HIGHWINDER, p.getEquipment().getItemInMainHand());
}
if (93.182445*pd.velocity>4.317) {
pd.velocity/=2;
} else {
pd.velocity=0;
}
if (pd.highwinder && pd.target!=null && !pd.target.isDead()) {
GenericFunctions.sendActionBarMessage(p, TwosideKeeper.drawVelocityBar(pd.velocity,pd.highwinderdmg),true);
}
}
//We need to see if this player's damage reduction has changed recently. If so, notify them.
//Check damage reduction by sending an artifical "1" damage to the player.
if (!p.isDead()) {TwosideKeeper.log("Player is not dead.",5); TwosideKeeper.setPlayerMaxHealth(p);}
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(TwosideKeeper.createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
private void ModifyDasherSetSpeedMultiplier(Player p) {
if (ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)>0) {
double spdmult = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DASHER)/100d;
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
}
}
if (PlayerMode.isBarbarian(p)) {
AutoConsumeFoods(p);
private void EndShopSession(Player p) {
if (TwosideKeeper.TwosideShops.IsPlayerUsingTerminal(p) &&
(TwosideKeeper.TwosideShops.GetSession(p).GetSign().getBlock()==null || TwosideKeeper.TwosideShops.GetSession(p).IsTimeExpired())) {
p.sendMessage(ChatColor.RED+"Ran out of time! "+ChatColor.WHITE+"Shop session closed.");
TwosideKeeper.TwosideShops.RemoveSession(p);
}
}
private void ModifyArmorBar(Player p) {
p.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(20*(1.0d-CustomDamage.CalculateDamageReduction(1,p,null))+subtractVanillaArmorBar(p.getEquipment().getArmorContents()));
}
ItemStack[] equips = p.getEquipment().getArmorContents();
private void ResetVendetta(final long serverTickTime, PlayerStructure pd) {
if (pd.lastcombat+(20*60)<serverTickTime) {
pd.vendetta_amt=0;
pd.thorns_amt=0;
@ -298,13 +387,16 @@ final class runServerHeartbeat implements Runnable {
if (pd.vendetta_amt>0 && pd.lastvendettastack+200<serverTickTime) {
pd.vendetta_amt=0;
}
pd.vendetta_amt=50000;
pd.lastvendettastack=TwosideKeeper.getServerTickTime()+500;
}
private void ResetLifestealStacks(final long serverTickTime, PlayerStructure pd) {
if (pd.lastattacked+(20*5)<serverTickTime) {
pd.lastattacked=0;
pd.lifestealstacks=0;
}
}
private void ManageSnowmanHunt() {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.LastSnowmanHunt+36000<TwosideKeeper.getServerTickTime() && TwosideKeeper.SnowmanHuntList.size()>7) {
TwosideKeeper.HuntingForSnowman = TwosideKeeper.SnowmanHuntList.get((int)(Math.random()*TwosideKeeper.SnowmanHuntList.size()));
@ -314,7 +406,9 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.LastSnowmanHunt=TwosideKeeper.getServerTickTime();
}
}
}
private void ManagePlayerLink(Player p, PlayerStructure pd) {
if (pd.linkplayer!=null && pd.linkplayer.isValid()) {
GlowAPI.setGlowing(pd.linkplayer, true, p);
if (pd.lastlinkteleport!=0 && pd.lastlinkteleport+12000<TwosideKeeper.getServerTickTime()) {
@ -326,7 +420,9 @@ final class runServerHeartbeat implements Runnable {
GlowAPI.setGlowing(pd.linkplayer, false, p);
pd.linkplayer=null;
}
}
private void DepleteDamagePool(final long serverTickTime, Player p, PlayerStructure pd) {
if (pd.damagepool>0 && pd.damagepooltime+20<=serverTickTime) {
double transferdmg = CustomDamage.getTransferDamage(p)+(pd.damagepool*0.01);
TwosideKeeper.log("Transfer Dmg is "+transferdmg+". Damage Pool: "+pd.damagepool, 5);
@ -337,11 +433,67 @@ final class runServerHeartbeat implements Runnable {
pd.damagepool-=transferdmg;
}
}
}
private void AdventurerModeSetExhaustion(Player p) {
if (PlayerMode.getPlayerMode(p)==PlayerMode.NORMAL) {
p.setExhaustion(Math.max(0, p.getExhaustion()-0.5f));
}
}
private void DasherFoodRegenPerk(Player p) {
if (p.isSprinting() && p.getFoodLevel()<20
&& ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.DASHER, 4)) {
p.setFoodLevel(p.getFoodLevel()+1);
}
}
private void GivePartyNightVision(Player p) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.RUDOLPH, 4)) {
if (!p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, p, true);
}
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
if (!pl.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, pl, true);
}
}
}
}
private void ApplyCometRegenBonus(Player p) {
double regenbuff = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.COMET);
if (regenbuff>0) {
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
PlayerStructure pld = PlayerStructure.GetPlayerStructure(pl);
pld.pctbonusregen=regenbuff/100d;
pld.pctbonusregentime=TwosideKeeper.getServerTickTime();
}
}
}
private void ResetSlayerAggro(final long serverTickTime, Player p, PlayerStructure pd) {
if (PlayerMode.isSlayer(p)) {
if (pd.lastsneak+50<=serverTickTime &&
p.isSneaking() &&
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
GenericFunctions.deAggroNearbyTargets(p);
GenericFunctions.applyStealth(p, true);
}
}
}
private void ResetSwordCombo(final long serverTickTime, Player p, PlayerStructure pd) {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
pd.last_swordhit+40<serverTickTime) {
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
}
}
private void CalculateHealthRegeneration(final long serverTickTime, Player p, PlayerStructure pd,
ItemStack[] equips) {
if (pd.last_regen_time+TwosideKeeper.HEALTH_REGENERATION_RATE<=serverTickTime) {
pd.last_regen_time=serverTickTime;
//See if this player needs to be healed.
@ -381,62 +533,6 @@ final class runServerHeartbeat implements Runnable {
}
}
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
pd.last_swordhit+40<serverTickTime) {
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
}
if (PlayerMode.isSlayer(p)) {
if (pd.lastsneak+50<=serverTickTime &&
p.isSneaking() &&
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
GenericFunctions.deAggroNearbyTargets(p);
GenericFunctions.applyStealth(p, true);
}
}
double regenbuff = ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.COMET);
if (regenbuff>0) {
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
PlayerStructure pld = PlayerStructure.GetPlayerStructure(pl);
pld.pctbonusregen=regenbuff/100d;
pld.pctbonusregentime=TwosideKeeper.getServerTickTime();
}
}
if (p.isSprinting() && p.getFoodLevel()<20
&& ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.DASHER, 4)) {
p.setFoodLevel(p.getFoodLevel()+1);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getArmor(p), p, ItemSet.RUDOLPH, 4)) {
if (!p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, p, true);
}
List<Player> partymembers = PartyManager.getPartyMembers(p);
for (Player pl : partymembers) {
if (!pl.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1, pl, true);
}
}
}
}
//TwosideKeeper.outputArmorDurability(p,">");
}
CheckAndAnnounceWeather();
Christmas.ChristmasHeartbeat();
MaintainMonsterData();
PartyManager.SetupParties();
TwosideKeeper.TwosideSpleefGames.TickEvent();
performTimingsReport();
}

Loading…
Cancel
Save