->Fixed a bug where the number of drops was exponentially increased
based on drop bonuses. ->Fix a bug with identifying valid Malleable Base Quest item types properly. ->Fixed a bug where 1 player sleeping would cause the server tick time to be modified drastically. ->Artifact base weapon damages have been buffed to reflect their wooden counterparts. ->The size of Hellfire Creeper and Deadly Creeper angry explosions have been reduced. ->Add getPlayerVelocity(Player) to API. (Returns player velocity in m/sec.) ->Added DPS meter/Damage breakdown. Start the tracker with /dps. Stop it again with /dps to view results. ->Fix "Piercing" Artifact Ability displayed value. ->Strikers are now invulnerable during the dash of Line Drive. ->Defenders can now press Q (drop key) to activate "Rejuvenation", which gives a 2 second invulnerability window, and 10 seconds of Regeneration X. Costs 20 shield durability. 2 minute cooldown. ->Wither skeletons, Guardian Bosses, and Pig Zombie Leaders are now named properly. ->Using [] now displays the amount of items being held when linking items. ->Server Icon updated with a night time picture of Twoside. ->Fix a bug where two minecarts would be produced when shooting a minecart with a bow while riding in it. ->World shops now automatically sell the next available item stored in the world shop chest when it sells out. (Ex. Putting stone and cobblestone in a shop will switch the item to cobblestone once stone sells. The price is not modified however.) ->Added isWorldShop(Block) to API. ->Deadly mobs had their base stats buffed slightly to decrease the difficulty gap between Deadly and Hellfire mobs, while increasing the step up from Dangerous to Deadly tier. ->Increased the Resistances of Dangerous, Deadly, and Hellfire Mobs that do not wear armor normally. ->Eruption and Earth Wave damage values have been buffed significantly. ->Line Drive and Tumble are now activated by pressing Q (drop key) instead of Shift+Q and Left-Click + Shift. Pressing Shift+Q during Tumble will perform a backwards jump, while pressing Q will do the current behavior. ->The Mysterous Entity no longer laughs at you repeatedly when dying in the void. ->Cooldowns of skills now show up right when you login, so there is no confusion about when you can first execute them. ->Modification to Ranger Mode: Only Sniping mode shoots lightning-fast arrows now. Debilitation and Close Range mode shoot normal speed arrows.
This commit is contained in:
parent
295a120e3b
commit
4506d0b7c1
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.6.2r3
|
version: 3.7.0
|
||||||
commands:
|
commands:
|
||||||
money:
|
money:
|
||||||
description: Tells the player the amount of money they are holding.
|
description: Tells the player the amount of money they are holding.
|
||||||
@ -102,3 +102,8 @@ commands:
|
|||||||
usage: /mode <modename>
|
usage: /mode <modename>
|
||||||
permission: TwosideKeeper.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
|
dps:
|
||||||
|
description: DPS Logger.
|
||||||
|
usage: /dps
|
||||||
|
permission: TwosideKeeper.money
|
||||||
|
permission-message: No permissions!
|
@ -109,7 +109,7 @@ public class AwakenedArtifact {
|
|||||||
tc.addExtra(ac);
|
tc.addExtra(ac);
|
||||||
tc.addExtra(" to open up the ability upgrade menu.");
|
tc.addExtra(" to open up the ability upgrade menu.");
|
||||||
p.spigot().sendMessage(tc);*/
|
p.spigot().sendMessage(tc);*/
|
||||||
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), TwosideKeeper.CalculateWeaponDamage(p,null), artifact,GenericFunctions.CalculateSlot(artifact,p)));
|
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(artifact,p))).getUpgradePath(), NewCombat.CalculateWeaponDamage(p,null), artifact,GenericFunctions.CalculateSlot(artifact,p)));
|
||||||
return item;
|
return item;
|
||||||
} else {
|
} else {
|
||||||
return setEXP(artifact,totalval);
|
return setEXP(artifact,totalval);
|
||||||
|
@ -5,8 +5,6 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
|
|
||||||
import aPlugin.BlockUtils;
|
|
||||||
import aPlugin.Utils;
|
|
||||||
import net.minecraft.server.v1_9_R1.BlockPosition;
|
import net.minecraft.server.v1_9_R1.BlockPosition;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.BlockToughness;
|
import sig.plugin.TwosideKeeper.HelperStructures.BlockToughness;
|
||||||
|
|
||||||
@ -35,7 +33,7 @@ public class ChargeZombie {
|
|||||||
if (Math.abs(x)<outerradius &&
|
if (Math.abs(x)<outerradius &&
|
||||||
Math.abs(y)<outerradius+1 &&
|
Math.abs(y)<outerradius+1 &&
|
||||||
Math.abs(z)<outerradius &&
|
Math.abs(z)<outerradius &&
|
||||||
!BlockUtils.isExplosionProof(m.getLocation().add(x,y,z).getBlock().getType()) ||
|
aPlugin.API.isDestroyable(m.getLocation().add(x,y,z).getBlock()) ||
|
||||||
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) {
|
m.getLocation().add(x,y,z).getBlock().getType()==Material.OBSIDIAN) {
|
||||||
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
|
if (!(y==0 && m.getTarget().getLocation().getY()>m.getLocation().getY()) || !m.getLocation().add(x,y,z).getBlock().getType().isSolid()) { //Player is higher than zombie. Don't break blocks in front of it. Climb up them. Unless it's lava.
|
||||||
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
|
if (!(y<0 && (m.getTarget().getLocation().getY()>m.getLocation().getY()-1))) { //Player is lower than zombie. Break blocks below it to get to the player.
|
||||||
@ -56,9 +54,9 @@ public class ChargeZombie {
|
|||||||
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
|
m.getLocation().getWorld().playSound(m.getLocation().add(x,y,z),Sound.BLOCK_STONE_BREAK, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
m.getLocation().add(x,y,z).getBlock().breakNaturally();
|
m.getLocation().add(x,y,z).getBlock().breakNaturally();
|
||||||
Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), -1, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock()));
|
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1);
|
||||||
} else {
|
} else {
|
||||||
Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), 4, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock()));
|
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), (int)(Math.random()*6)+3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +67,7 @@ public class ChargeZombie {
|
|||||||
//This block can be destroyed if it is a liquid.
|
//This block can be destroyed if it is a liquid.
|
||||||
if (m.getLocation().add(x,y,z).getBlock().isLiquid()) {
|
if (m.getLocation().add(x,y,z).getBlock().isLiquid()) {
|
||||||
m.getLocation().add(x,y,z).getBlock().breakNaturally();
|
m.getLocation().add(x,y,z).getBlock().breakNaturally();
|
||||||
Utils.sendBlockBreakAnimation(null, new BlockPosition(m.getLocation().add(x,y,z).getBlockX(),m.getLocation().add(x,y,z).getBlockY(),m.getLocation().add(x,y,z).getBlockZ()), -1, Utils.seedRandomID(m.getLocation().add(x,y,z).getBlock()));
|
aPlugin.API.sendBlockBreakPacket(m.getLocation().add(x,y,z).getBlock(), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
src/sig/plugin/TwosideKeeper/DiscordStatusUpdater.java
Normal file
24
src/sig/plugin/TwosideKeeper/DiscordStatusUpdater.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import aPlugin.DiscordMessageSender;
|
||||||
|
import net.minecraft.server.v1_9_R1.MinecraftServer;
|
||||||
|
|
||||||
|
public class DiscordStatusUpdater implements Runnable{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
DiscordMessageSender.setPlaying(ProduceMessage());
|
||||||
|
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), this, 300l);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ProduceMessage() {
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
return ChatColor.stripColor("TPS: "+df.format(MinecraftServer.getServer().recentTps[0])+" "+TwosideKeeper.getWeatherIcon()+" "+TwosideKeeper.getTimeOfDay()+" ("+Bukkit.getOnlinePlayers().size()+")");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -18,6 +18,7 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
|
|||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||||
|
import sig.plugin.TwosideKeeper.NewCombat;
|
||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
|
||||||
@ -87,11 +88,11 @@ public enum ArtifactAbility {
|
|||||||
|
|
||||||
//Shovel abilities
|
//Shovel abilities
|
||||||
SUPPRESS("Suppression",ChatColor.GRAY+"[Unimplemented] Suppresses a mob on hit for [VAL] seconds.\n\n"
|
SUPPRESS("Suppression",ChatColor.GRAY+"[Unimplemented] Suppresses a mob on hit for [VAL] seconds.\n\n"
|
||||||
+ "Suppression prevents movement, attacking, and teleportation.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
+ "Suppression prevents movement, attacking, exploding, and teleportation.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
||||||
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SHOVEL),
|
new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.SHOVEL),
|
||||||
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [VAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{6.0,7,8.0,9,10.0,11,12.0,13,14.0,15},
|
ERUPTION("Eruption","Sneak while Left-clicking a mob to damage mobs for [VAL] damage and knock them up. The eruption also destroys the ground beneath you.",new double[]{11.0,13,15.0,17,19.0,21,24.0,27,30.0,40},
|
||||||
new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.4,0.325},100,40,UpgradePath.SHOVEL),
|
new double[]{1.0,0.925,0.85,0.775,0.7,0.625,0.55,0.475,0.4,0.325},100,40,UpgradePath.SHOVEL),
|
||||||
EARTHWAVE("Earth Wave","While in combat, destroy a block to send a wave of earth towards your enemies. Enemies standing inside of the waves take [VAL] damage every second.",new double[]{8,9,10,11,12,13,14,15,16,18},
|
EARTHWAVE("Earth Wave","While in combat, destroy a block to send a wave of earth towards your enemies. Enemies standing inside of the waves take [VAL] damage every second.",new double[]{10,12,14,16,18,20,22,24,26,30},
|
||||||
new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2},100,100,UpgradePath.SHOVEL),
|
new double[]{2.4,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.2},100,100,UpgradePath.SHOVEL),
|
||||||
|
|
||||||
//Axe abilities
|
//Axe abilities
|
||||||
@ -435,7 +436,7 @@ public enum ArtifactAbility {
|
|||||||
tc.addExtra(ac);
|
tc.addExtra(ac);
|
||||||
tc.addExtra(" to open up the ability upgrade menu.");;*/
|
tc.addExtra(" to open up the ability upgrade menu.");;*/
|
||||||
p.spigot().sendMessage(tc);
|
p.spigot().sendMessage(tc);
|
||||||
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), TwosideKeeper.CalculateWeaponDamage(p,null), item,GenericFunctions.CalculateSlot(item,p)));
|
p.spigot().sendMessage(ArtifactAbility.GenerateMenu(ArtifactItemType.getArtifactItemTypeFromItemStack(p.getInventory().getItem(GenericFunctions.CalculateSlot(item,p))).getUpgradePath(), NewCombat.CalculateWeaponDamage(p,null), item,GenericFunctions.CalculateSlot(item,p)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ability.GetMaxLevel()<=level) {
|
if (ability.GetMaxLevel()<=level) {
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines all the effects and calculations applied by artifact abilities.
|
||||||
|
*/
|
||||||
|
public class ArtifactAbilityApplyEffects {
|
||||||
|
//Returns true if the player has this artifact ability on one of their equipment.
|
||||||
|
public static boolean canExecuteArtifactAbility(ArtifactAbility ab, Player p) {
|
||||||
|
//First check the main hand.
|
||||||
|
ItemStack[] testitems = {
|
||||||
|
p.getEquipment().getItemInMainHand(),
|
||||||
|
p.getEquipment().getHelmet(),
|
||||||
|
p.getEquipment().getChestplate(),
|
||||||
|
p.getEquipment().getLeggings(),
|
||||||
|
p.getEquipment().getBoots(),
|
||||||
|
};
|
||||||
|
for (int i=0;i<testitems.length;i++) {
|
||||||
|
if (GenericFunctions.isArtifactEquip(testitems[i]) &&
|
||||||
|
ArtifactAbility.containsEnchantment(ab, testitems[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures.Common;
|
||||||
|
|
||||||
|
import org.bukkit.entity.AreaEffectCloud;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
|
||||||
|
public enum DamageType {
|
||||||
|
PLAYERVSMOB,
|
||||||
|
MOBVSPLAYER,
|
||||||
|
MOBPROJECTILEVSPLAYER,
|
||||||
|
MOBPROJECTILEVSMOB,
|
||||||
|
MOBVSMOB,
|
||||||
|
SPELLVSMOB,
|
||||||
|
PLAYERPROJECTILEVSMOB,
|
||||||
|
OTHER;
|
||||||
|
|
||||||
|
public static DamageType DetectType(LivingEntity target, Entity damager) {
|
||||||
|
if ((damager instanceof Player) &&
|
||||||
|
(target instanceof LivingEntity)) {
|
||||||
|
return PLAYERVSMOB;
|
||||||
|
} else
|
||||||
|
if ((target instanceof Player) &&
|
||||||
|
(damager instanceof LivingEntity)) {
|
||||||
|
return MOBVSPLAYER;
|
||||||
|
} else
|
||||||
|
if ((damager instanceof Projectile) &&
|
||||||
|
((Projectile)damager).getShooter()!=null &&
|
||||||
|
(((Projectile)damager).getShooter() instanceof LivingEntity) &&
|
||||||
|
(target instanceof Player)) {
|
||||||
|
return MOBPROJECTILEVSPLAYER;
|
||||||
|
} else
|
||||||
|
if ((damager instanceof Projectile) &&
|
||||||
|
((Projectile)damager).getShooter()!=null &&
|
||||||
|
(((Projectile)damager).getShooter() instanceof Player) &&
|
||||||
|
(target instanceof LivingEntity)) {
|
||||||
|
return PLAYERPROJECTILEVSMOB;
|
||||||
|
} else
|
||||||
|
if ((damager instanceof Projectile) &&
|
||||||
|
((Projectile)damager).getShooter()!=null &&
|
||||||
|
(((Projectile)damager).getShooter() instanceof LivingEntity) &&
|
||||||
|
(target instanceof LivingEntity)) {
|
||||||
|
return MOBPROJECTILEVSMOB;
|
||||||
|
} else
|
||||||
|
if ((target instanceof LivingEntity) &&
|
||||||
|
(damager instanceof LivingEntity)) {
|
||||||
|
return MOBVSMOB;
|
||||||
|
} else
|
||||||
|
if ((target instanceof LivingEntity) &&
|
||||||
|
(damager instanceof AreaEffectCloud)) {
|
||||||
|
return SPELLVSMOB;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
TwosideKeeper.log("Detected a OTHER event. Target was "+target.getType().name()+" and damager was "+damager.getType().name(), 2);
|
||||||
|
return OTHER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,10 @@
|
|||||||
package sig.plugin.TwosideKeeper.HelperStructures.Common;
|
package sig.plugin.TwosideKeeper.HelperStructures.Common;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -12,14 +15,17 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Guardian;
|
import org.bukkit.entity.Guardian;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
@ -31,7 +37,11 @@ import org.bukkit.material.MaterialData;
|
|||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Functions;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -42,6 +52,7 @@ import sig.plugin.TwosideKeeper.Artifact;
|
|||||||
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
import sig.plugin.TwosideKeeper.AwakenedArtifact;
|
||||||
import sig.plugin.TwosideKeeper.MonsterController;
|
import sig.plugin.TwosideKeeper.MonsterController;
|
||||||
import sig.plugin.TwosideKeeper.MonsterStructure;
|
import sig.plugin.TwosideKeeper.MonsterStructure;
|
||||||
|
import sig.plugin.TwosideKeeper.NewCombat;
|
||||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||||
@ -75,7 +86,6 @@ public class GenericFunctions {
|
|||||||
return breakHardenedItem(item,null);
|
return breakHardenedItem(item,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ItemStack breakHardenedItem(ItemStack item, Player p) {
|
public static ItemStack breakHardenedItem(ItemStack item, Player p) {
|
||||||
int break_count = getHardenedItemBreaks(item);
|
int break_count = getHardenedItemBreaks(item);
|
||||||
boolean is_magic = false;
|
boolean is_magic = false;
|
||||||
@ -1534,6 +1544,15 @@ public class GenericFunctions {
|
|||||||
case HAY_BLOCK:{
|
case HAY_BLOCK:{
|
||||||
return "Hay Bale";
|
return "Hay Bale";
|
||||||
}
|
}
|
||||||
|
case SKULL:{
|
||||||
|
return "Wither Skeleton Skull";
|
||||||
|
}
|
||||||
|
case SPECKLED_MELON:{
|
||||||
|
return "Glistering Melon";
|
||||||
|
}
|
||||||
|
case WORKBENCH:{
|
||||||
|
return "Crafting Table";
|
||||||
|
}
|
||||||
default:{
|
default:{
|
||||||
return GenericFunctions.CapitalizeFirstLetters(type.getType().toString().replace("_", " "));
|
return GenericFunctions.CapitalizeFirstLetters(type.getType().toString().replace("_", " "));
|
||||||
}
|
}
|
||||||
@ -1741,7 +1760,7 @@ public class GenericFunctions {
|
|||||||
item.getType().toString().contains("AXE") ||
|
item.getType().toString().contains("AXE") ||
|
||||||
item.getType().toString().contains("SWORD") ||
|
item.getType().toString().contains("SWORD") ||
|
||||||
item.getType().toString().contains("BOW") ||
|
item.getType().toString().contains("BOW") ||
|
||||||
item.getType().toString().contains("ROD") ||
|
item.getType().toString().contains("FISHING_ROD") ||
|
||||||
item.getType().toString().contains("HOE") ||
|
item.getType().toString().contains("HOE") ||
|
||||||
item.getType().toString().contains("BOOTS") ||
|
item.getType().toString().contains("BOOTS") ||
|
||||||
item.getType().toString().contains("CHESTPLATE") ||
|
item.getType().toString().contains("CHESTPLATE") ||
|
||||||
@ -1855,9 +1874,11 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static boolean isRanger(Player p) {
|
public static boolean isRanger(Player p) {
|
||||||
if (p!=null && !p.isDead() && p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW &&
|
if (p!=null && !p.isDead() && (((p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && (p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType()==Material.AIR)) || //Satisfy just a bow in main hand.
|
||||||
(p.getInventory().getExtraContents()[0]==null || !p.getInventory().getExtraContents()[0].getType().toString().contains("SHIELD")) &&
|
(p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()!=Material.SHIELD) || /*Satisfy a bow in main hand and no shield in off-hand.*/
|
||||||
AllLeatherArmor(p)) {
|
(p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()!=Material.SHIELD && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()==Material.BOW) || /*Satisfy a bow in off-hand and no shield in main hand.*/
|
||||||
|
((p.getEquipment().getItemInMainHand()==null || p.getEquipment().getItemInMainHand().getType()==Material.AIR) && p.getInventory().getExtraContents()[0]!=null && p.getInventory().getExtraContents()[0].getType()==Material.BOW)) /*Satisfy just a bow in off-hand.*/ &&
|
||||||
|
AllLeatherArmor(p))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -2257,15 +2278,17 @@ public class GenericFunctions {
|
|||||||
if (ent instanceof Monster) {
|
if (ent instanceof Monster) {
|
||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomNameVisible(false);
|
m.setCustomNameVisible(false);
|
||||||
|
if (m.getCustomName()!=null) {
|
||||||
m.setCustomName(ChatColor.stripColor(m.getCustomName()));
|
m.setCustomName(ChatColor.stripColor(m.getCustomName()));
|
||||||
if (m.getCustomName().contains("Dangerous")) {
|
if (m.getCustomName().contains("Dangerous")) {
|
||||||
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
m.setCustomName(ChatColor.DARK_AQUA+m.getCustomName());
|
||||||
}
|
}
|
||||||
if (m.getCustomName().contains("Deadly")) {
|
if (m.getCustomName().contains("Deadly")) {
|
||||||
m.setCustomName(ChatColor.GOLD+m.getCustomName());
|
m.setCustomName(ChatColor.GOLD+m.getCustomName());
|
||||||
}
|
}
|
||||||
if (m.getCustomName().contains("Hellfire")) {
|
if (m.getCustomName().contains("Hellfire")) {
|
||||||
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
m.setCustomName(ChatColor.DARK_RED+m.getCustomName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2326,7 +2349,7 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
|
||||||
if (rangerarmort1==4 || rangerarmort2==4 || rangerarmort3==4 || rangerarmort4==4) {
|
if (rangerarmort1==4 || rangerarmort2==4 || rangerarmort3==4 || rangerarmort4==4) {
|
||||||
//Player has the full set.
|
//Player has the full set.
|
||||||
@ -2366,7 +2389,7 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.SHADOWWALKER, p.getEquipment().getItemInMainHand()) &&
|
||||||
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
p.isOnGround() && p.getLocation().getY()>=0 && p.getLocation().add(0,0,0).getBlock().getLightLevel()<=4) {
|
||||||
@ -2518,28 +2541,13 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, boolean truedmg) {
|
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager, boolean truedmg) {
|
||||||
if (damager!=null && (target instanceof Monster) && !target.isDead()) {
|
DealDamageToMob(dmg,target,damager);
|
||||||
Monster m = (Monster)target;
|
}
|
||||||
m.setTarget(damager);
|
|
||||||
}
|
|
||||||
|
|
||||||
double finaldmg = 0;
|
public static void DealDamageToMob(double dmg, LivingEntity target, LivingEntity damager) {
|
||||||
if (truedmg) {
|
if (damager!=null && (target instanceof Monster)) {
|
||||||
finaldmg = dmg;
|
|
||||||
} else {
|
|
||||||
finaldmg = TwosideKeeper.CalculateDamageReduction(dmg, target, damager);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.hasPotionEffect(PotionEffectType.ABSORPTION)) {
|
|
||||||
//We attempt to absorb the amount of damage of absorption level we have.
|
|
||||||
finaldmg-=(GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, target)+1)*4;
|
|
||||||
if (finaldmg<0) {
|
|
||||||
finaldmg=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((target instanceof Monster) && damager!=null) {
|
|
||||||
Monster m = (Monster)target;
|
Monster m = (Monster)target;
|
||||||
m.setTarget(damager);
|
m.setTarget(damager);
|
||||||
if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) {
|
if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) {
|
||||||
@ -2549,19 +2557,14 @@ public class GenericFunctions {
|
|||||||
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(damager));
|
TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(damager));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TwosideKeeper.log("Attack is dealing "+finaldmg, 2);
|
aPlugin.API.sendEntityHurtAnimation(target);
|
||||||
if (target.getHealth()>finaldmg) {
|
TwosideKeeper.log("Call event with "+dmg, 5);
|
||||||
TwosideKeeper.log("NOT FULL HEALTH. HP: "+target.getHealth(), 5);
|
TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(damager)+"->"+
|
||||||
target.setHealth(target.getHealth()-finaldmg);
|
GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2);
|
||||||
target.damage(0.000001);
|
double oldhp=((LivingEntity)target).getHealth();
|
||||||
target.setNoDamageTicks(20);
|
GenericFunctions.subtractHealth(target, dmg);
|
||||||
} else {
|
TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3);
|
||||||
//Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,target,DamageCause.ENTITY_ATTACK,finaldmg));
|
}
|
||||||
target.setHealth(0.0001);
|
|
||||||
target.damage(99999);
|
|
||||||
target.setHealth(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean searchfor(List<String> stringy, String searchfor) {
|
public static boolean searchfor(List<String> stringy, String searchfor) {
|
||||||
for (int i=0;i<stringy.size();i++) {
|
for (int i=0;i<stringy.size();i++) {
|
||||||
@ -2588,10 +2591,10 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void PerformDodge(Player p) {
|
public static void PerformDodge(Player p) {
|
||||||
if (p.isSneaking() && p.isOnGround() && GenericFunctions.isRanger(p) &&
|
if (p.isOnGround() && GenericFunctions.isRanger(p) &&
|
||||||
GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE) {
|
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE)) {
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (pd.last_dodge+100<=TwosideKeeper.getServerTickTime()) {
|
if (pd.last_dodge+TwosideKeeper.DODGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
|
||||||
pd.last_dodge=TwosideKeeper.getServerTickTime();
|
pd.last_dodge=TwosideKeeper.getServerTickTime();
|
||||||
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
||||||
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
|
||||||
@ -2603,7 +2606,11 @@ public class GenericFunctions {
|
|||||||
dodgeduration=60;
|
dodgeduration=60;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setVelocity(p.getLocation().getDirection().multiply(1.4f));
|
if (p.isSneaking()) { //Do a backwards dodge + jump.
|
||||||
|
p.setVelocity(p.getLocation().getDirection().multiply(-0.7f));
|
||||||
|
} else {
|
||||||
|
p.setVelocity(p.getLocation().getDirection().multiply(1.4f));
|
||||||
|
}
|
||||||
|
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,dodgeduration,0));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,dodgeduration,0));
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,dodgeduration,2));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,dodgeduration,2));
|
||||||
@ -2611,4 +2618,86 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String GetEntityDisplayName(Entity e) {
|
||||||
|
if (e instanceof LivingEntity) {
|
||||||
|
LivingEntity l = (LivingEntity)e;
|
||||||
|
if (l.getCustomName()!=null) {
|
||||||
|
return l.getCustomName();
|
||||||
|
}
|
||||||
|
if (l instanceof Player) {
|
||||||
|
Player p = (Player)l;
|
||||||
|
return p.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e instanceof Projectile) {
|
||||||
|
Projectile proj = (Projectile)e;
|
||||||
|
String finalname = CapitalizeFirstLetters(proj.getType().name().replace("_", " "));
|
||||||
|
if (proj.getShooter() instanceof LivingEntity) {
|
||||||
|
LivingEntity l = (LivingEntity)proj.getShooter();
|
||||||
|
if (l.getCustomName()!=null) {
|
||||||
|
return finalname+"("+l.getCustomName()+ChatColor.GRAY+")";
|
||||||
|
}
|
||||||
|
if (l instanceof Player) {
|
||||||
|
Player p = (Player)l;
|
||||||
|
return finalname+"("+p.getName()+ChatColor.GRAY+")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e.getType().name()+ChatColor.WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Returns player velocity in m/sec.
|
||||||
|
public static double GetPlayerVelocity(Player p) {
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
return 93.182445*pd.velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getAbilityValue(ArtifactAbility ab, ItemStack weapon) {
|
||||||
|
return ArtifactAbility.calculateValue(ab, weapon.getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ab, weapon));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void subtractHealth(final LivingEntity entity, double dmg) {
|
||||||
|
if (entity.getHealth()>dmg) {
|
||||||
|
entity.setHealth(entity.getHealth()-dmg);
|
||||||
|
} else {
|
||||||
|
/*List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
|
EntityDeathEvent ev = new EntityDeathEvent(entity,drops);
|
||||||
|
Bukkit.getPluginManager().callEvent(ev);
|
||||||
|
entity.setHealth(0);*/
|
||||||
|
entity.damage(Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isViewingInventory(Player p) {
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
return pd.isViewingInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addIFrame(Player p, int ticks) {
|
||||||
|
p.removePotionEffect(PotionEffectType.GLOWING);
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,ticks,0));
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,ticks,0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PerformRejuvenate(Player player) {
|
||||||
|
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(player.getUniqueId());
|
||||||
|
if (pd.last_rejuvenate+TwosideKeeper.REJUVENATE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
|
||||||
|
addIFrame(player,40);
|
||||||
|
player.removePotionEffect(PotionEffectType.REGENERATION);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,200,9));
|
||||||
|
aPlugin.API.damageItem(player, player.getEquipment().getItemInMainHand(), 20);
|
||||||
|
pd.last_rejuvenate = TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isArmoredMob(Monster m) {
|
||||||
|
if (m.getType()==EntityType.ZOMBIE ||
|
||||||
|
m.getType()==EntityType.PIG_ZOMBIE ||
|
||||||
|
m.getType()==EntityType.SKELETON) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,12 +192,6 @@ public class Loot {
|
|||||||
if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));}
|
if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));}
|
||||||
//item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
//item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
|
||||||
if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
|
if (Math.random()<0.001*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
|
||||||
} else
|
|
||||||
if (item.getType()==Material.FISHING_ROD) {
|
|
||||||
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));
|
|
||||||
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
|
|
||||||
item.addUnsafeEnchantment(Enchantment.LUCK, GetEnchantmentLevels(item.getType(),hardened));
|
|
||||||
item.addUnsafeEnchantment(Enchantment.LURE, (int)(((Math.random()*3)+2)*((hardened)?HARDENED_ENCHANT_MULT:1)));
|
|
||||||
} else {
|
} else {
|
||||||
//Generic Random Enchantments.
|
//Generic Random Enchantments.
|
||||||
for (int i=0;i<Enchantment.values().length;i++) {
|
for (int i=0;i<Enchantment.values().length;i++) {
|
||||||
@ -206,6 +200,12 @@ public class Loot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (item.getType()==Material.FISHING_ROD) {
|
||||||
|
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));
|
||||||
|
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
|
||||||
|
item.addUnsafeEnchantment(Enchantment.LUCK, GetEnchantmentLevels(item.getType(),hardened));
|
||||||
|
item.addUnsafeEnchantment(Enchantment.LURE, (int)(((Math.random()*3)+2)*((hardened)?HARDENED_ENCHANT_MULT:1)));
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,18 +115,6 @@ public class MalleableBaseQuest {
|
|||||||
ItemMeta m = base.getItemMeta();
|
ItemMeta m = base.getItemMeta();
|
||||||
List<String> lore = m.getLore();
|
List<String> lore = m.getLore();
|
||||||
String material_name = lore.get(1).split("'")[1];
|
String material_name = lore.get(1).split("'")[1];
|
||||||
if (lore.get(1).contains("Arrow of")) {
|
|
||||||
return "Tipped Arrow";
|
|
||||||
} else
|
|
||||||
if (lore.get(1).contains("Splash Potion")) {
|
|
||||||
return "Splash Potion";
|
|
||||||
} else
|
|
||||||
if (lore.get(1).contains("Lingering Potion")) {
|
|
||||||
return "Lingering Potion";
|
|
||||||
} else
|
|
||||||
if (lore.get(1).contains("Potion")) {
|
|
||||||
return "Potion";
|
|
||||||
} else
|
|
||||||
if (lore.get(1).contains("Jack o")) {
|
if (lore.get(1).contains("Jack o")) {
|
||||||
return "Jack o'Lantern";
|
return "Jack o'Lantern";
|
||||||
} else {
|
} else {
|
||||||
|
@ -204,7 +204,7 @@ public enum MonsterDifficulty {
|
|||||||
for (int i=0;i<dropmult;i++) {
|
for (int i=0;i<dropmult;i++) {
|
||||||
TwosideKeeper.Loot_Logger.AddLootRoll();
|
TwosideKeeper.Loot_Logger.AddLootRoll();
|
||||||
//First do a common roll.
|
//First do a common roll.
|
||||||
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE*dropmult &&
|
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE &&
|
||||||
this.loot_regular.length>0) {
|
this.loot_regular.length>0) {
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
|
||||||
@ -213,7 +213,7 @@ public enum MonsterDifficulty {
|
|||||||
TwosideKeeper.Loot_Logger.AddCommonLoot();
|
TwosideKeeper.Loot_Logger.AddCommonLoot();
|
||||||
}
|
}
|
||||||
//Rare Loot roll.
|
//Rare Loot roll.
|
||||||
if (Math.random()<TwosideKeeper.RARE_DROP_RATE*dropmult &&
|
if (Math.random()<TwosideKeeper.RARE_DROP_RATE &&
|
||||||
this.loot_rare.length>0) {
|
this.loot_rare.length>0) {
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
|
||||||
@ -238,7 +238,7 @@ public enum MonsterDifficulty {
|
|||||||
TwosideKeeper.Loot_Logger.AddRareLoot();
|
TwosideKeeper.Loot_Logger.AddRareLoot();
|
||||||
}
|
}
|
||||||
//Legendary Loot roll.
|
//Legendary Loot roll.
|
||||||
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE*dropmult &&
|
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE &&
|
||||||
this.loot_legendary.length>0) {
|
this.loot_legendary.length>0) {
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
|
||||||
|
@ -16,22 +16,22 @@ import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
|||||||
public class ShopPurchase {
|
public class ShopPurchase {
|
||||||
String player;
|
String player;
|
||||||
String customer;
|
String customer;
|
||||||
int shopID;
|
ItemStack item;
|
||||||
double money;
|
double money;
|
||||||
int amt;
|
int amt;
|
||||||
boolean sell;
|
boolean sell;
|
||||||
|
|
||||||
public ShopPurchase(String p, Player customer, int shopID, double money, int amt) {
|
public ShopPurchase(String p, Player customer, ItemStack item, double money, int amt) {
|
||||||
ShopPurchase(p,customer,shopID,money,amt,true); //Assume this is a selling purchase by default.
|
ShopPurchase(p,customer,item,money,amt,true); //Assume this is a selling purchase by default.
|
||||||
}
|
}
|
||||||
public ShopPurchase(String p, Player customer, int shopID, double money, int amt, boolean sell) {
|
public ShopPurchase(String p, Player customer, ItemStack item, double money, int amt, boolean sell) {
|
||||||
ShopPurchase(p,customer,shopID,money,amt,sell); //Assume this is a selling purchase by default.
|
ShopPurchase(p,customer,item,money,amt,sell); //Assume this is a selling purchase by default.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShopPurchase(String p, Player customer, int shopID, double money, int amt, boolean sell) {
|
public void ShopPurchase(String p, Player customer, ItemStack item, double money, int amt, boolean sell) {
|
||||||
this.player = p;
|
this.player = p;
|
||||||
this.customer=customer.getName();
|
this.customer=customer.getName();
|
||||||
this.shopID = shopID;
|
this.item=item;
|
||||||
this.money = money;
|
this.money = money;
|
||||||
this.amt=amt;
|
this.amt=amt;
|
||||||
this.sell=sell;
|
this.sell=sell;
|
||||||
@ -47,20 +47,18 @@ public class ShopPurchase {
|
|||||||
public TextComponent announcementString() {
|
public TextComponent announcementString() {
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
if (sell) {
|
if (sell) {
|
||||||
WorldShop ss = TwosideKeeper.TwosideShops.LoadWorldShopData(shopID);
|
|
||||||
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has purchased "+ChatColor.YELLOW+amt+ChatColor.WHITE+" of your ");
|
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has purchased "+ChatColor.YELLOW+amt+ChatColor.WHITE+" of your ");
|
||||||
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(ss.GetItem())+ChatColor.RESET+""+ChatColor.GREEN+"]");
|
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]");
|
||||||
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(ss.GetItem())+WorldShop.GetItemInfo(ss.GetItem())).create()));
|
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create()));
|
||||||
TextComponent message3 = new TextComponent(". You have earned $"+df.format(money)+". "+ChatColor.GRAY+""+ChatColor.ITALIC+"(See /money)");
|
TextComponent message3 = new TextComponent(". You have earned $"+df.format(money)+". "+ChatColor.GRAY+""+ChatColor.ITALIC+"(See /money)");
|
||||||
TextComponent finalmsg = message1;
|
TextComponent finalmsg = message1;
|
||||||
finalmsg.addExtra(message2);
|
finalmsg.addExtra(message2);
|
||||||
finalmsg.addExtra(message3);
|
finalmsg.addExtra(message3);
|
||||||
return finalmsg;
|
return finalmsg;
|
||||||
} else {
|
} else {
|
||||||
WorldShop ss = TwosideKeeper.TwosideShops.LoadWorldShopData(shopID);
|
|
||||||
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has sold "+ChatColor.YELLOW+amt+ChatColor.WHITE+" ");
|
TextComponent message1 = new TextComponent("Player "+ChatColor.BLUE+customer+ChatColor.WHITE+" has sold "+ChatColor.YELLOW+amt+ChatColor.WHITE+" ");
|
||||||
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(ss.GetItem())+ChatColor.RESET+""+ChatColor.GREEN+"]");
|
TextComponent message2 = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(this.item)+ChatColor.RESET+""+ChatColor.GREEN+"]");
|
||||||
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(ss.GetItem())+WorldShop.GetItemInfo(ss.GetItem())).create()));
|
message2.setHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(GenericFunctions.GetItemName(this.item)+WorldShop.GetItemInfo(this.item)).create()));
|
||||||
TextComponent message3 = new TextComponent(" to you. $"+df.format(money)+" has been deducted from your bank account. "+ChatColor.GRAY+""+ChatColor.ITALIC+"(Check your shop to collect your items.)");
|
TextComponent message3 = new TextComponent(" to you. $"+df.format(money)+" has been deducted from your bank account. "+ChatColor.GRAY+""+ChatColor.ITALIC+"(Check your shop to collect your items.)");
|
||||||
TextComponent finalmsg = message1;
|
TextComponent finalmsg = message1;
|
||||||
finalmsg.addExtra(message2);
|
finalmsg.addExtra(message2);
|
||||||
|
@ -80,6 +80,9 @@ public class WorldShop {
|
|||||||
public void UpdateUnitPrice(double price) {
|
public void UpdateUnitPrice(double price) {
|
||||||
this.price=price;
|
this.price=price;
|
||||||
}
|
}
|
||||||
|
public void UpdateItem(ItemStack item) {
|
||||||
|
this.item=item;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack GetItem() {
|
public ItemStack GetItem() {
|
||||||
return item;
|
return item;
|
||||||
@ -714,6 +717,38 @@ public class WorldShop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeShopItem(Sign s, WorldShop shop) {
|
||||||
|
Collection<Entity> nearby = WorldShop.getBlockShopSignAttachedTo(s).getWorld().getNearbyEntities(WorldShop.getBlockShopSignAttachedTo(s).getLocation().add(0.5,0,0.5), 0.3, 1, 0.3);
|
||||||
|
for (int i=0;i<nearby.size();i++) {
|
||||||
|
Entity e = Iterables.get(nearby, i);
|
||||||
|
if (e.getType()==EntityType.DROPPED_ITEM) {
|
||||||
|
TwosideKeeper.log("Found a drop.",5);
|
||||||
|
Item it = (Item)e;
|
||||||
|
|
||||||
|
ItemStack checkdrop = shop.GetItem().clone();
|
||||||
|
checkdrop = Artifact.convert(checkdrop);
|
||||||
|
checkdrop.removeEnchantment(Enchantment.LUCK);
|
||||||
|
ItemMeta m = checkdrop.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
if (m.hasLore()) {
|
||||||
|
lore = m.getLore();
|
||||||
|
}
|
||||||
|
lore.add("WorldShop Display Item");
|
||||||
|
m.setLore(lore);
|
||||||
|
checkdrop.setItemMeta(m);
|
||||||
|
|
||||||
|
TwosideKeeper.log("Comparing item "+it.getItemStack().toString()+" to "+checkdrop.toString(),5);
|
||||||
|
if (it.getItemStack().isSimilar(checkdrop) &&
|
||||||
|
Artifact.isArtifact(it.getItemStack())) {
|
||||||
|
TwosideKeeper.log("Same type.",5);
|
||||||
|
e.remove();
|
||||||
|
e.setCustomNameVisible(false);
|
||||||
|
e.setCustomName(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void spawnShopItem(PlayerInteractEvent ev, Location loc, WorldShop shop) {
|
public static void spawnShopItem(PlayerInteractEvent ev, Location loc, WorldShop shop) {
|
||||||
//See if a drop entity is already here.
|
//See if a drop entity is already here.
|
||||||
boolean item_here=false;
|
boolean item_here=false;
|
||||||
|
@ -17,14 +17,14 @@ public class ItemCubeWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addItemCubeWindow(Player p, int id, int size) {
|
public static void addItemCubeWindow(Player p, int id, int size) {
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
pd.openeditemcube.add(new ItemCubeWindow(id, size));
|
pd.openeditemcube.add(new ItemCubeWindow(id, size));
|
||||||
pd.opened_inventory = true;
|
pd.opened_inventory = true;
|
||||||
TwosideKeeper.log("Item Cube Window added. List is now size "+pd.openeditemcube.size(),2);
|
TwosideKeeper.log("Item Cube Window added. List is now size "+pd.openeditemcube.size(),2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void popItemCubeWindow(Player p) {
|
public static void popItemCubeWindow(Player p) {
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (!pd.opened_inventory &&
|
if (!pd.opened_inventory &&
|
||||||
pd.openeditemcube.size()>0) {
|
pd.openeditemcube.size()>0) {
|
||||||
ItemCubeWindow window = pd.openeditemcube.remove(pd.openeditemcube.size()-1);
|
ItemCubeWindow window = pd.openeditemcube.remove(pd.openeditemcube.size()-1);
|
||||||
@ -36,14 +36,14 @@ public class ItemCubeWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAllItemCubeWindows(Player p) {
|
public static void removeAllItemCubeWindows(Player p) {
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
pd.openeditemcube.clear();
|
pd.openeditemcube.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//New open item cube method to handle all opening of item cubes.
|
//New open item cube method to handle all opening of item cubes.
|
||||||
public static void openItemCube(Player p, int id, int size, boolean addToList) {
|
public static void openItemCube(Player p, int id, int size, boolean addToList) {
|
||||||
TwosideKeeper.log("Called.", 2);
|
TwosideKeeper.log("Called.", 2);
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (addToList &&
|
if (addToList &&
|
||||||
isViewingItemCubeInventory(p)) {
|
isViewingItemCubeInventory(p)) {
|
||||||
addItemCubeWindow(p,getViewingItemCubeID(p),getViewingItemCubeInventorySize(p));
|
addItemCubeWindow(p,getViewingItemCubeID(p),getViewingItemCubeInventorySize(p));
|
||||||
@ -62,7 +62,7 @@ public class ItemCubeWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isViewingItemCubeInventory(Player p) {
|
public static boolean isViewingItemCubeInventory(Player p) {
|
||||||
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(p.getUniqueId());
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
TwosideKeeper.log("Are we viewing it? "+pd.isViewingItemCube,2);
|
TwosideKeeper.log("Are we viewing it? "+pd.isViewingItemCube,2);
|
||||||
return pd.isViewingItemCube;
|
return pd.isViewingItemCube;
|
||||||
}
|
}
|
||||||
|
132
src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
Normal file
132
src/sig/plugin/TwosideKeeper/Logging/DamageLogger.java
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.Logging;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
|
||||||
|
public class DamageLogger {
|
||||||
|
HashMap<String,Double> breakdownlist;
|
||||||
|
double totaldmg;
|
||||||
|
double actualtotaldmg=0.0;
|
||||||
|
double calculatedtotaldmg=0.0;
|
||||||
|
double totalmult=0.0;
|
||||||
|
int totalhits=0;
|
||||||
|
String player;
|
||||||
|
long recordtime;
|
||||||
|
|
||||||
|
public DamageLogger(Player p) {
|
||||||
|
this.breakdownlist=new HashMap<String,Double>();
|
||||||
|
totaldmg=0;
|
||||||
|
this.player=p.getName();
|
||||||
|
this.recordtime=TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startRecording() {
|
||||||
|
this.totaldmg=0;
|
||||||
|
this.calculatedtotaldmg=0.0;
|
||||||
|
this.actualtotaldmg=0.0;
|
||||||
|
this.breakdownlist.clear();
|
||||||
|
this.totalmult=0.0;
|
||||||
|
this.totalhits=0;
|
||||||
|
this.recordtime=TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMultiplierToLogger(String name, double val) {
|
||||||
|
if (val!=1.0) {
|
||||||
|
if (breakdownlist.containsKey(name)) {
|
||||||
|
//Add to the already existing value.
|
||||||
|
double dmg = breakdownlist.get(name);
|
||||||
|
dmg+=val;
|
||||||
|
breakdownlist.put(name, dmg);
|
||||||
|
} else {
|
||||||
|
breakdownlist.put(name, val);
|
||||||
|
}
|
||||||
|
totalmult+=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEventToLogger(String name, double val) {
|
||||||
|
if (val!=0.0) {
|
||||||
|
if (breakdownlist.containsKey(name)) {
|
||||||
|
//Add to the already existing value.
|
||||||
|
double dmg = breakdownlist.get(name);
|
||||||
|
dmg+=val;
|
||||||
|
breakdownlist.put(name, dmg);
|
||||||
|
} else {
|
||||||
|
breakdownlist.put(name, val);
|
||||||
|
}
|
||||||
|
totaldmg+=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCalculatedActualDamage(double val) {
|
||||||
|
this.actualtotaldmg+=val;
|
||||||
|
this.totalhits++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCalculatedTotalDamage(double val) {
|
||||||
|
this.calculatedtotaldmg+=val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String OutputResults() {
|
||||||
|
StringBuilder finalstring = new StringBuilder();
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
for (int i=0;i<breakdownlist.size();i++) {
|
||||||
|
if (((String)breakdownlist.keySet().toArray()[i]).contains("Mult")) {
|
||||||
|
if (breakdownlist.get(breakdownlist.keySet().toArray()[i])!=1.0d && ((this.actualtotaldmg-this.totaldmg)*(breakdownlist.get(breakdownlist.keySet().toArray()[i])/this.totalmult))>0) {
|
||||||
|
finalstring.append(breakdownlist.keySet().toArray()[i]+": "+getPercentColor(breakdownlist.get(breakdownlist.keySet().toArray()[i]),totalmult)+"x"+df.format(breakdownlist.get(breakdownlist.keySet().toArray()[i])/this.totalhits)+" - "+df.format(((this.actualtotaldmg-this.totaldmg)*(breakdownlist.get(breakdownlist.keySet().toArray()[i])/this.totalmult)))+" dmg");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (breakdownlist.get(breakdownlist.keySet().toArray()[i])!=0.0d) {
|
||||||
|
finalstring.append(breakdownlist.keySet().toArray()[i]+": "+getPercentColor(breakdownlist.get(breakdownlist.keySet().toArray()[i]),totaldmg)+df.format(breakdownlist.get(breakdownlist.keySet().toArray()[i])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finalstring.append("\n");
|
||||||
|
}
|
||||||
|
finalstring.append(ChatColor.GRAY+""+ChatColor.BOLD+" Raw Damage: "+df.format(actualtotaldmg)+"\n");
|
||||||
|
finalstring.append(ChatColor.GOLD+""+ChatColor.ITALIC+" Final Damage: "+df.format(calculatedtotaldmg)+" (Average "+df.format((1-(this.calculatedtotaldmg/this.actualtotaldmg))*100)+"% Reduction)\n");
|
||||||
|
double elapsedtime = ((TwosideKeeper.getServerTickTime()-recordtime)/20d);
|
||||||
|
double dps = actualtotaldmg/elapsedtime;
|
||||||
|
finalstring.append(ChatColor.YELLOW+" Elapsed Time: "+ChatColor.AQUA+df.format(elapsedtime)+"s "+ChatColor.WHITE+"("+df.format(dps)+" damage/sec)");
|
||||||
|
return finalstring.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChatColor getPercentColor(Double val, Double total) {
|
||||||
|
if (val/total>=0.9) {
|
||||||
|
return ChatColor.DARK_RED;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.8) {
|
||||||
|
return ChatColor.RED;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.7) {
|
||||||
|
return ChatColor.GOLD;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.5) {
|
||||||
|
return ChatColor.YELLOW;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.3) {
|
||||||
|
return ChatColor.GREEN;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.2) {
|
||||||
|
return ChatColor.AQUA;
|
||||||
|
}else
|
||||||
|
if (val/total>=0.1) {
|
||||||
|
return ChatColor.DARK_AQUA;
|
||||||
|
}
|
||||||
|
return ChatColor.GRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddNewCalculation(Player p, String name, double val, double reducedval) {
|
||||||
|
PlayerStructure pd = TwosideKeeper.playerdata.get(p.getUniqueId());
|
||||||
|
pd.damagedata.addEventToLogger(name, val);
|
||||||
|
pd.damagedata.addCalculatedActualDamage(val);
|
||||||
|
pd.damagedata.addCalculatedTotalDamage(reducedval);
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ import org.bukkit.block.banner.Pattern;
|
|||||||
import org.bukkit.block.banner.PatternType;
|
import org.bukkit.block.banner.PatternType;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Guardian;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
@ -65,7 +66,7 @@ public class MonsterController {
|
|||||||
} else {
|
} else {
|
||||||
if (isZombieLeader(ent)) {
|
if (isZombieLeader(ent)) {
|
||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomName(ChatColor.WHITE+"Zombie Leader");
|
SetupCustomName("",m);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -78,7 +79,7 @@ public class MonsterController {
|
|||||||
} else {
|
} else {
|
||||||
if (isZombieLeader(ent)) {
|
if (isZombieLeader(ent)) {
|
||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomName(ChatColor.WHITE+"Zombie Leader");
|
SetupCustomName("",m);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -92,7 +93,7 @@ public class MonsterController {
|
|||||||
} else {
|
} else {
|
||||||
if (isZombieLeader(ent)) {
|
if (isZombieLeader(ent)) {
|
||||||
Monster m = (Monster)ent;
|
Monster m = (Monster)ent;
|
||||||
m.setCustomName(ChatColor.WHITE+"Zombie Leader");
|
SetupCustomName("",m);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -515,7 +516,7 @@ public class MonsterController {
|
|||||||
(
|
(
|
||||||
(md==MonsterDifficulty.NORMAL && ent.getMaxHealth()>20) ||
|
(md==MonsterDifficulty.NORMAL && ent.getMaxHealth()>20) ||
|
||||||
(md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) ||
|
(md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) ||
|
||||||
(md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*2) ||
|
(md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*3) ||
|
||||||
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4)
|
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -560,11 +561,27 @@ public class MonsterController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetupCustomName(String prefix, Monster m) {
|
||||||
|
String MonsterName = m.getType().toString().toLowerCase();
|
||||||
|
if (m.getType()==EntityType.SKELETON) {
|
||||||
|
Skeleton ss = (Skeleton)m;
|
||||||
|
if (ss.getSkeletonType()==SkeletonType.WITHER) {
|
||||||
|
MonsterName = "wither skeleton";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m.getType()==EntityType.GUARDIAN) {
|
||||||
|
Guardian gg = (Guardian)m;
|
||||||
|
if (gg.isElder()) {
|
||||||
|
MonsterName = "guardian boss";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.setCustomName(prefix.equalsIgnoreCase("")?"":(prefix+" ")+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
|
||||||
|
}
|
||||||
|
|
||||||
public static Monster convertMonster(Monster m, MonsterDifficulty md) {
|
public static Monster convertMonster(Monster m, MonsterDifficulty md) {
|
||||||
switch (md) {
|
switch (md) {
|
||||||
case DANGEROUS: {
|
case DANGEROUS: {
|
||||||
String MonsterName = m.getType().toString().toLowerCase();
|
SetupCustomName(ChatColor.DARK_AQUA+"Dangerous",m);
|
||||||
m.setCustomName(ChatColor.DARK_AQUA+"Dangerous "+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
|
|
||||||
m.setMaxHealth(m.getMaxHealth()*2.0);
|
m.setMaxHealth(m.getMaxHealth()*2.0);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
if (isAllowedToEquipItems(m)) {
|
if (isAllowedToEquipItems(m)) {
|
||||||
@ -576,11 +593,13 @@ public class MonsterController {
|
|||||||
m.setMaxHealth(20);
|
m.setMaxHealth(20);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
}
|
}
|
||||||
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1));
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
case DEADLY: {
|
case DEADLY: {
|
||||||
String MonsterName = m.getType().toString().toLowerCase();
|
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
||||||
m.setCustomName(ChatColor.GOLD+"Deadly "+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
|
m.setMaxHealth(m.getMaxHealth()*3.0);
|
||||||
m.setMaxHealth(m.getMaxHealth()*2.0);
|
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
if (isAllowedToEquipItems(m)) {
|
if (isAllowedToEquipItems(m)) {
|
||||||
m.getEquipment().clear();
|
m.getEquipment().clear();
|
||||||
@ -592,10 +611,12 @@ public class MonsterController {
|
|||||||
m.setMaxHealth(50);
|
m.setMaxHealth(50);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
}
|
}
|
||||||
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,3));
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
case HELLFIRE:{
|
case HELLFIRE:{
|
||||||
String MonsterName = m.getType().toString().toLowerCase();
|
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
||||||
m.setCustomName(ChatColor.DARK_RED+"Hellfire "+GenericFunctions.CapitalizeFirstLetters(MonsterName.replaceAll("_", " ")+(isZombieLeader(m)?" Leader":"")));
|
|
||||||
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
|
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
|
||||||
//m.setCustomNameVisible(true);
|
//m.setCustomNameVisible(true);
|
||||||
m.setMaxHealth(m.getMaxHealth()*4.0);
|
m.setMaxHealth(m.getMaxHealth()*4.0);
|
||||||
@ -615,15 +636,16 @@ public class MonsterController {
|
|||||||
m.setMaxHealth(200);
|
m.setMaxHealth(200);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
}
|
}
|
||||||
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,5));
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
default: {
|
default: {
|
||||||
if (isAllowedToEquipItems(m)) {
|
if (isAllowedToEquipItems(m)) {
|
||||||
m.getEquipment().clear();
|
m.getEquipment().clear();
|
||||||
RandomizeEquipment(m,0);
|
RandomizeEquipment(m,0);
|
||||||
}
|
}
|
||||||
if (isZombieLeader(m)) {
|
SetupCustomName("",m);
|
||||||
m.setCustomName(ChatColor.WHITE+"Zombie Leader");
|
|
||||||
}
|
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
m.setMaxHealth(40);
|
m.setMaxHealth(40);
|
||||||
@ -693,4 +715,24 @@ public class MonsterController {
|
|||||||
Monster m = (Monster)loc.getWorld().spawnEntity(loc, et);
|
Monster m = (Monster)loc.getWorld().spawnEntity(loc, et);
|
||||||
return MonsterController.convertMonster(m);
|
return MonsterController.convertMonster(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isChargeZombie(Monster m) {
|
||||||
|
if (m.getType()==EntityType.ZOMBIE &&
|
||||||
|
MonsterController.getMonsterDifficulty((Monster)m)==MonsterDifficulty.HELLFIRE &&
|
||||||
|
!TwosideKeeper.chargezombies.contains((Monster)m)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUndead(Monster m) {
|
||||||
|
if (m.getType()==EntityType.ZOMBIE ||
|
||||||
|
m.getType()==EntityType.PIG_ZOMBIE ||
|
||||||
|
m.getType()==EntityType.GIANT ||
|
||||||
|
m.getType()==EntityType.SKELETON
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1264
src/sig/plugin/TwosideKeeper/NewCombat.java
Normal file
1264
src/sig/plugin/TwosideKeeper/NewCombat.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ package sig.plugin.TwosideKeeper;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -18,6 +19,8 @@ import org.bukkit.inventory.InventoryView;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.Logging.DamageLogger;
|
||||||
|
|
||||||
/*PLAYER STRUCTURE
|
/*PLAYER STRUCTURE
|
||||||
*
|
*
|
||||||
* Keeps external data and info about the player
|
* Keeps external data and info about the player
|
||||||
@ -64,11 +67,16 @@ public class PlayerStructure {
|
|||||||
public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow.
|
public int nextarrowxp = 0; //How much bonus XP to give to an Artifact Bow.
|
||||||
public boolean hasfullrangerset=false;
|
public boolean hasfullrangerset=false;
|
||||||
public double lastarrowpower=0;
|
public double lastarrowpower=0;
|
||||||
|
public boolean lastarrowwasinrangermode=false; //true is ranger mode.
|
||||||
public int headshotcombo=0;
|
public int headshotcombo=0;
|
||||||
public List<ItemCubeWindow> openeditemcube;
|
public List<ItemCubeWindow> openeditemcube;
|
||||||
public boolean openinginventory=false;
|
public boolean openinginventory=false;
|
||||||
public boolean fulldodge=false;
|
public boolean fulldodge=false;
|
||||||
public long last_dodge=TwosideKeeper.getServerTickTime();
|
public long last_dodge=TwosideKeeper.getServerTickTime();
|
||||||
|
public long last_laugh_time=TwosideKeeper.getServerTickTime();
|
||||||
|
public long last_rejuvenate=TwosideKeeper.getServerTickTime();
|
||||||
|
public DamageLogger damagedata;
|
||||||
|
public boolean damagelogging=false;
|
||||||
|
|
||||||
public double prev_weapondmg=0.0;
|
public double prev_weapondmg=0.0;
|
||||||
public double prev_buffdmg=0.0;
|
public double prev_buffdmg=0.0;
|
||||||
@ -76,6 +84,8 @@ public class PlayerStructure {
|
|||||||
public double prev_armordef=0.0;
|
public double prev_armordef=0.0;
|
||||||
|
|
||||||
public int debuffcount=0;
|
public int debuffcount=0;
|
||||||
|
public boolean isViewingInventory=false;
|
||||||
|
public boolean destroyedminecart=false;
|
||||||
|
|
||||||
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
|
//Needs the instance of the player object to get all other info. Only to be called at the beginning.
|
||||||
public PlayerStructure(Player p, long serverTickTime) {
|
public PlayerStructure(Player p, long serverTickTime) {
|
||||||
@ -114,10 +124,17 @@ public class PlayerStructure {
|
|||||||
this.openinginventory = false;
|
this.openinginventory = false;
|
||||||
this.fulldodge=false;
|
this.fulldodge=false;
|
||||||
this.last_dodge=TwosideKeeper.getServerTickTime();
|
this.last_dodge=TwosideKeeper.getServerTickTime();
|
||||||
|
this.lastarrowwasinrangermode=false;
|
||||||
|
this.isViewingInventory=false;
|
||||||
|
this.destroyedminecart=false;
|
||||||
|
this.last_laugh_time=TwosideKeeper.getServerTickTime();
|
||||||
|
this.last_rejuvenate=TwosideKeeper.getServerTickTime();
|
||||||
|
this.damagedata = new DamageLogger(p);
|
||||||
|
this.damagelogging=false;
|
||||||
//Set defaults first, in case this is a new user.
|
//Set defaults first, in case this is a new user.
|
||||||
|
setDefaultCooldowns(p);
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
||||||
p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
|
||||||
|
|
||||||
//Check if new player.
|
//Check if new player.
|
||||||
if (this.firstjoined == serverTickTime) {
|
if (this.firstjoined == serverTickTime) {
|
||||||
@ -149,6 +166,27 @@ public class PlayerStructure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDefaultCooldowns(Player p) {
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.BOW, TwosideKeeper.DODGE_COOLDOWN);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.BOW, TwosideKeeper.DODGE_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"HOE",TwosideKeeper.DEATHMARK_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"HOE",TwosideKeeper.DEATHMARK_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"SPADE",TwosideKeeper.EARTHWAVE_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"SPADE",TwosideKeeper.EARTHWAVE_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"SWORD",TwosideKeeper.LINEDRIVE_COOLDOWN);
|
||||||
|
applyCooldownToAllTypes(p,"SWORD",TwosideKeeper.LINEDRIVE_COOLDOWN);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, TwosideKeeper.REJUVENATE_COOLDOWN);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, TwosideKeeper.REJUVENATE_COOLDOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyCooldownToAllTypes(Player p, String item, int cooldown) {
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.valueOf("WOOD_"+item), cooldown);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.valueOf("IRON_"+item), cooldown);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.valueOf("STONE_"+item), cooldown);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.valueOf("DIAMOND_"+item), cooldown);
|
||||||
|
aPlugin.API.sendCooldownPacket(p, Material.valueOf("GOLD_"+item), cooldown);
|
||||||
|
}
|
||||||
|
|
||||||
//Save the configuration.
|
//Save the configuration.
|
||||||
public void saveConfig() {
|
public void saveConfig() {
|
||||||
File config;
|
File config;
|
||||||
@ -218,4 +256,13 @@ public class PlayerStructure {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlayerStructure GetPlayerStructure(Player p) {
|
||||||
|
if (TwosideKeeper.playerdata.containsKey(p.getUniqueId())) {
|
||||||
|
return TwosideKeeper.playerdata.get(p.getUniqueId());
|
||||||
|
} else {
|
||||||
|
TwosideKeeper.log(ChatColor.DARK_RED+"[ERROR] Player Structure for player "+p.getName()+" was not initialized! Now creating one...",0);
|
||||||
|
return TwosideKeeper.playerdata.put(p.getUniqueId(), new PlayerStructure(p,TwosideKeeper.getServerTickTime()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Vector;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -98,4 +99,8 @@ public class RecyclingCenter {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isRecyclingCenter(Block b) {
|
||||||
|
return TwosideKeeper.TwosideRecyclingCenter.nodes.contains(new Location(b.getWorld(),b.getLocation().getBlockX(),b.getLocation().getBlockY(),b.getLocation().getBlockZ()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
@ -16,6 +17,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
|
|
||||||
public final class TwosideKeeperAPI {
|
public final class TwosideKeeperAPI {
|
||||||
@ -157,6 +159,16 @@ public final class TwosideKeeperAPI {
|
|||||||
return SpleefManager.playerIsPlayingSpleef(p);
|
return SpleefManager.playerIsPlayingSpleef(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//World Shop COMMANDS.
|
||||||
|
public static boolean isWorldShop(Location l) {
|
||||||
|
return WorldShop.shopSignExists(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Recycling Center COMMANDS.
|
||||||
|
public static boolean isRecyclingCenter(Block b) {
|
||||||
|
return RecyclingCenter.isRecyclingCenter(b);
|
||||||
|
}
|
||||||
|
|
||||||
//Localization COMMANDS.
|
//Localization COMMANDS.
|
||||||
public static String getLocalizedItemName(ItemStack i) {
|
public static String getLocalizedItemName(ItemStack i) {
|
||||||
return GenericFunctions.UserFriendlyMaterialName(i);
|
return GenericFunctions.UserFriendlyMaterialName(i);
|
||||||
@ -167,4 +179,9 @@ public final class TwosideKeeperAPI {
|
|||||||
public static String getLocalizedItemName(Material i, byte data) {
|
public static String getLocalizedItemName(Material i, byte data) {
|
||||||
return GenericFunctions.UserFriendlyMaterialName(i,data);
|
return GenericFunctions.UserFriendlyMaterialName(i,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Player COMMANDS.
|
||||||
|
public static double getPlayerVelocity(Player p) {
|
||||||
|
return GenericFunctions.GetPlayerVelocity(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -216,11 +217,11 @@ public class WorldShopManager {
|
|||||||
sessions.remove(ss);
|
sessions.remove(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewPurchase(String owner, Player purchaser, int shopID, double price, int amt) {
|
public void AddNewPurchase(String owner, Player purchaser, ItemStack item, double price, int amt) {
|
||||||
purchases.add(new ShopPurchase(owner, purchaser, shopID, price, amt));
|
purchases.add(new ShopPurchase(owner, purchaser, item, price, amt));
|
||||||
}
|
}
|
||||||
public void AddNewPurchase(String owner, Player purchaser, int shopID, double price, int amt, boolean sell) {
|
public void AddNewPurchase(String owner, Player purchaser, ItemStack item, double price, int amt, boolean sell) {
|
||||||
purchases.add(new ShopPurchase(owner, purchaser, shopID, price, amt, sell));
|
purchases.add(new ShopPurchase(owner, purchaser, item, price, amt, sell));
|
||||||
}
|
}
|
||||||
public boolean PlayerHasPurchases(Player p) {
|
public boolean PlayerHasPurchases(Player p) {
|
||||||
for (int i=0;i<purchases.size();i++) {
|
for (int i=0;i<purchases.size();i++) {
|
||||||
@ -240,6 +241,33 @@ public class WorldShopManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorldShop SetupNextItemShop(WorldShop shop, Chest shopchest, final Sign s) {
|
||||||
|
boolean founditem=false;
|
||||||
|
final WorldShop oldshop = new WorldShop(shop.GetItem().clone(), shop.GetAmount(), shop.GetStoredAmount(), shop.GetUnitPrice(), shop.GetOwner(), shop.getID());
|
||||||
|
if (shop.GetAmount()==0) {
|
||||||
|
TwosideKeeper.log("Amount is 0. Proceed to look for next item.", 5);
|
||||||
|
for (int i=0;i<shopchest.getInventory().getSize();i++) {
|
||||||
|
if (shopchest.getInventory().getItem(i)!=null &&
|
||||||
|
shopchest.getInventory().getItem(i).getType()!=Material.AIR) {
|
||||||
|
//Use this as the next world shop.
|
||||||
|
TwosideKeeper.log("Found item for slot "+i, 5);
|
||||||
|
shop.UpdateItem(shopchest.getInventory().getItem(i));
|
||||||
|
shop.UpdateAmount(GenericFunctions.CountItems(shopchest.getInventory(), shopchest.getInventory().getItem(i)));
|
||||||
|
founditem=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final WorldShop sh = shop;
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sh.removeShopItem(s, oldshop);
|
||||||
|
sh.spawnShopItem(s.getLocation(), sh);
|
||||||
|
}},1);
|
||||||
|
return shop;
|
||||||
|
}
|
||||||
|
|
||||||
public void Cleanup() {
|
public void Cleanup() {
|
||||||
//Removes all shop sessions.
|
//Removes all shop sessions.
|
||||||
sessions.clear();
|
sessions.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user