Holiday event over. "Limited Christmas Mode" is now active. Fixed major

loop issue with Cupid and Defender interaction. Minor bugfixes and
improvements.
testdev
sigonasr2 8 years ago
parent 374b045623
commit 6b5ad31745
  1. BIN
      TwosideKeeper.jar
  2. 8
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  3. 2
      src/sig/plugin/TwosideKeeper/Drops/SigDrop.java
  4. 2
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  5. 12
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporarySnow.java
  6. 8
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  7. 17
      src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
  8. 7
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  9. 24
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -513,7 +513,7 @@ public class CustomDamage {
removePermEnchantments(p,item);
}
damage = calculateDefenderAbsorption(p, damager, damage);
damage = calculateDefenderAbsorption(p, damager, damage, reason);
damage = sendDamageToDamagePool(p, damage, reason);
@ -2347,7 +2347,7 @@ public class CustomDamage {
return mult;
}
public static double calculateDefenderAbsorption(LivingEntity entity, Entity damager, double dmg) {
public static double calculateDefenderAbsorption(LivingEntity entity, Entity damager, double dmg, String reason) {
//See if we're in a party with a defender.
if (entity instanceof Player) {
Player p = (Player)entity;
@ -2359,7 +2359,7 @@ public class CustomDamage {
TwosideKeeper.log("In here",5);
if (!PlayerMode.isDefender(p) && PlayerMode.isDefender(check) &&
check.isBlocking() &&
!p.equals(check)) {
!p.equals(check) && (reason==null || !reason.equalsIgnoreCase("Cupid Set Tank"))) {
//This is a defender. Transfer half the damage to them!
dmg = dmg/2;
//Send the rest of the damage to the defender.
@ -2370,7 +2370,7 @@ public class CustomDamage {
break;
} else
if (!isCupidTank(p) && isCupidTank(check) &&
!p.equals(check)) {
!p.equals(check) && (reason==null || !reason.equalsIgnoreCase("Defender Tank"))) {
//This is a defender. Transfer half the damage to them!
double origdmg = dmg;
dmg = origdmg-(origdmg*(ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(check), check, ItemSet.CUPID)/100d));

@ -144,7 +144,7 @@ public class SigDrop extends Drop{
public ItemStack CreateModifiedLootPiece(Player p, ItemStack item, LivingEntityDifficulty diff2) {
if (isSet) {
ItemSet set = ItemSet.PANROS;
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
if (Math.random()<=0.8) {
set = LivingEntityDifficulty.PickAHolidayItemSet(PlayerMode.getPlayerMode(p),diff2); //This is the set we have to generate.
} else {

@ -3839,7 +3839,7 @@ public class GenericFunctions {
return true;
}
private static boolean isNaturalBlock(Block b) {
public static boolean isNaturalBlock(Block b) {
if (b.getType()==Material.DIRT ||
b.getType()==Material.SOIL ||
b.getType()==Material.MYCEL ||

@ -0,0 +1,12 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.block.Block;
public class TemporarySnow {
Block b;
int lifetime;
public TemporarySnow(Block b,int lifetime) {
this.b=b;
this.lifetime=lifetime;
}
}

@ -47,7 +47,7 @@ public class Loot {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Tool",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.TOOL,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,1,"[Normal] Mega Weapon",SigDrop.NONHARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new SigDrop(1,2,"[Normal] Mega Set Weapon",SigDrop.NONHARDENED,SigDrop.SET,SigDrop.WEAPON,LivingEntityDifficulty.NORMAL));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getCookieItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getSmallCandyItem(),1,3,20));
aPlugin.API.Chests.LOOT_NORMAL.addDrop(new DropItem(Christmas.getLargeCandyItem(),1,3,20));
@ -97,7 +97,7 @@ public class Loot {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,20,"[Dangerous] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new SigDrop(1,60,"[Dangerous] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DANGEROUS));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getCookieItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getSmallCandyItem(),3,5,91800));
aPlugin.API.Chests.LOOT_DANGEROUS.addDrop(new DropItem(Christmas.getLargeCandyItem(),3,5,91800));
@ -128,7 +128,7 @@ public class Loot {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,40,"[Deadly] Hardened Mega Weapon",SigDrop.HARDENED,SigDrop.NONSET,SigDrop.WEAPON,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new SigDrop(1,120,"[Deadly] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.DEADLY));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.LOST_CORE),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,7800));
aPlugin.API.Chests.LOOT_DEADLY.addDrop(new DropItem(Christmas.getChristmasEventToken(),800));
@ -154,7 +154,7 @@ public class Loot {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new SigDrop(1,180,"[Hellfire] Hardened Mega Set Weapon",SigDrop.HARDENED,SigDrop.SET,SigDrop.ARMOR,LivingEntityDifficulty.HELLFIRE));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),400));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),400));
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED || TwosideKeeper.CHRISTMASLINGERINGEVENT_ACTIVATED) {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getHolidayRageCandyBarItem(),1,3,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getSweetCandyItem(),1,3,7800));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Christmas.getChristmasEventToken(),800));

@ -678,13 +678,14 @@ public class Christmas {
private static void UseSantaDimensionalBox(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.lastsantabox+1296000<TwosideKeeper.getServerTickTime()) {
pd.lastsantabox=TwosideKeeper.getServerTickTime();
if (pd.lastsantabox2+1296000<TwosideKeeper.getServerTickTime()) {
pd.lastsantabox2=TwosideKeeper.getServerTickTime();
p.sendMessage("You dig into the box and pull out...");
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
ItemStack itemchosen = aPlugin.API.Chests.LOOT_CUSTOM_2.getSingleDrop(p);
SoundUtils.playLocalSound(p, Sound.ENTITY_CHICKEN_EGG, 1.0f, 1.0f);
p.sendMessage(" "+GenericFunctions.UserFriendlyMaterialName(itemchosen));},20);
p.sendMessage(ChatColor.AQUA+" "+GenericFunctions.UserFriendlyMaterialName(itemchosen)+((itemchosen.getAmount()>1)?" x"+itemchosen.getAmount():""));
GenericFunctions.giveItem(p, itemchosen);},20);
} else {
p.sendMessage(ChatColor.RED+"You must wait 24 hours for Santa's Box to recharge!");
}
@ -762,7 +763,7 @@ public class Christmas {
}
}
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
if (b.getType()==Material.AIR && bbelow.getType().isSolid() && !bbelow.getType().name().contains("STEP") && bbelow.getType()!=Material.OBSIDIAN && b.getTemperature()<=0.95) {
if (b.getWorld().getName().equalsIgnoreCase("world") && b.getType()==Material.AIR && bbelow.getType().isSolid() && !bbelow.getType().name().contains("STEP") && bbelow.getType()!=Material.OBSIDIAN && bbelow.getType()!=Material.SNOW && bbelow.getType()!=Material.ICE && bbelow.getType()!=Material.PACKED_ICE && bbelow.getType()!=Material.FROSTED_ICE && GenericFunctions.isNaturalBlock(bbelow) && b.getTemperature()<=0.95) {
b.setType(Material.SNOW);
b.setData((byte)0);
if (TwosideKeeper.last_snow_golem+TwosideKeeper.SNOW_GOLEM_COOLDOWN<TwosideKeeper.getServerTickTime() && Math.random()<=0.01) {
@ -791,13 +792,13 @@ public class Christmas {
}
} else
if (b.getType()==Material.SNOW && b.getData()<7) {
b.setData((byte)(b.getData()+1));
b.setData((byte)1);
}
}/* else { //Unnecessary. Snow will automatically melt.
} else { //Unnecessary. Snow will automatically melt.
if (b.getType()==Material.SNOW && b.getTemperature()>0.15) {
b.setType(Material.AIR);
}
}*/
}
//aPluginAPIWrapper.sendParticle(loc, EnumParticle.SNO, dx, dy, dz, v, particleCount);
}
}
@ -1050,7 +1051,7 @@ public class Christmas {
public static boolean runInventoryClickEvent(InventoryClickEvent ev) {
if ((ev.getClick()==ClickType.RIGHT) &&
isSantaDimensionalBox(ev.getWhoClicked().getEquipment().getItemInMainHand())) {
isSantaDimensionalBox(ev.getCurrentItem())) {
UseSantaDimensionalBox((Player)ev.getWhoClicked());
ev.setCancelled(true);
return false;

@ -179,6 +179,7 @@ public class PlayerStructure {
public HashMap<Material,Block> blockscanlist=new HashMap<Material,Block>();
public long lastusedrocketbooster=0;
public long lastActionBarMessageTime=0;
public long lastsantabox2;
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
@SuppressWarnings("deprecation")
@ -324,7 +325,7 @@ public class PlayerStructure {
workable.set("holidaychest2", holidaychest2);
workable.set("holidaychest3", holidaychest3);
workable.set("holidaychest4", holidaychest4);
workable.set("lastsantabox", lastsantabox);
workable.set("lastsantabox2", lastsantabox2);
//ConfigurationSection deathlootlist = workable.createSection("deathloot");
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
@ -379,7 +380,7 @@ public class PlayerStructure {
workable.addDefault("holidaychest2", holidaychest2);
workable.addDefault("holidaychest3", holidaychest3);
workable.addDefault("holidaychest4", holidaychest4);
workable.addDefault("lastsantabox", lastsantabox);
workable.addDefault("lastsantabox2", lastsantabox2);
workable.options().copyDefaults();
@ -413,7 +414,7 @@ public class PlayerStructure {
this.holidaychest2 = workable.getBoolean("holidaychest2");
this.holidaychest3 = workable.getBoolean("holidaychest3");
this.holidaychest4 = workable.getBoolean("holidaychest4");
this.lastsantabox = workable.getLong("lastsantabox");
this.lastsantabox2 = workable.getLong("lastsantabox2");
if (this.hasDied) {
List<ItemStack> deathlootlist = new ArrayList<ItemStack>();

@ -456,7 +456,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public int sleepingPlayers=0;
public static List<Material> validsetitems = new ArrayList<Material>();
public final static boolean CHRISTMASEVENT_ACTIVATED=true;
public final static boolean CHRISTMASEVENT_ACTIVATED=false;
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=true; //Limited Christmas drops/functionality remain while the majority of it is turned off.
boolean reloadedchunk=false;
@ -1297,6 +1298,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.giveItem(Bukkit.getPlayer(args[1]), item);
}
}break;
case "CLEARQUARRY":{
Location startblock = p.getLocation().clone();
Block b = startblock.getBlock();
int delay=0;
for (int y=0;y<10;y++) {
for (int x=0;x<340;x++) {
for (int z=0;z<30;z++) {
final int xer = x;
final int yer = y;
final int zer = z;
Bukkit.getScheduler().scheduleSyncDelayedTask(this, ()->{
b.getRelative(xer, yer, zer).setType(Material.AIR);},delay);
}
}
delay++;
}
}
}
}
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
@ -6031,6 +6049,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Last death: "+pd.lastdeath, 2);
}
},1);
} else {
Location newloc = ev.getRespawnLocation();
newloc.setY(newloc.getWorld().getHighestBlockYAt(ev.getRespawnLocation()));
ev.setRespawnLocation(newloc.add(0,10,0));
}
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastdeath=getServerTickTime();

Loading…
Cancel
Save