Implementation of glow control, and targeting via looking at mobs.
This commit is contained in:
parent
6d82052571
commit
bca56c165c
Binary file not shown.
@ -688,6 +688,7 @@ public class CustomDamage {
|
||||
if (!(target instanceof Player)) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.SetTarget(getDamagerEntity(damager));
|
||||
les.lastHitbyPlayer = TwosideKeeper.getServerTickTime();
|
||||
}
|
||||
EntityUtils.applyDamageIndicator(target, damage, (isFlagSet(pd.lasthitproperties,IS_CRIT))?IndicatorType.CRIT:IndicatorType.REGULAR);
|
||||
} else
|
||||
|
@ -45,6 +45,7 @@ import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@ -100,6 +101,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.WindSlash;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Items.Scepter;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
||||
@ -5716,4 +5718,19 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onlyHoldingScepter(Player p) {
|
||||
return ((p.getEquipment().getItemInMainHand()!=null || p.getEquipment().getItemInMainHand().getType()!=Material.AIR) && Scepter.isScepter(p.getEquipment().getItemInMainHand()))
|
||||
^
|
||||
((p.getEquipment().getItemInOffHand()!=null || p.getEquipment().getItemInOffHand().getType()!=Material.AIR) && Scepter.isScepter(p.getEquipment().getItemInOffHand()));
|
||||
}
|
||||
|
||||
public static void refreshInventoryView(Player p) {
|
||||
InventoryView view = p.getOpenInventory();
|
||||
//TwosideKeeper.log("View size: "+view.countSlots(), 1);
|
||||
for (int i=0;i<view.countSlots()-1;i++) {
|
||||
//TwosideKeeper.log("Checking slot "+i, 1);
|
||||
aPlugin.API.setItem(p, p.getOpenInventory(), i, view.getItem(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,12 @@ public enum ItemSet {
|
||||
LEGION(3,1, 12,12, 1,1, 1,1, 3, 12, 1, 1),
|
||||
PRIDE(10,10, 2,1, 2,2, 1,1, 10, 2, 2, 1),
|
||||
ASSASSIN(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
STEALTH(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0);
|
||||
STEALTH(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
ANDARSA(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
SARIS(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
LENT(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
ENTROPY(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0),
|
||||
AQUIOS(5,5, 0,0, 0,0, 0,0, 5, 0, 0, 0);
|
||||
|
||||
final static String WINDCHARGE_LABEL = ChatColor.BOLD+""+ChatColor.GRAY+"Wind Charge"+ChatColor.RESET;
|
||||
final static String WINDCHARGE_PLURAL_LABEL = ChatColor.BOLD+""+ChatColor.GRAY+"Wind Charges"+ChatColor.RESET;
|
||||
|
@ -0,0 +1,19 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Scepter {
|
||||
ItemStack item;
|
||||
|
||||
public Scepter(ItemStack item) {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isScepter(ItemStack item) {
|
||||
return item.getType()==Material.BONE && (item.hasItemMeta() &&
|
||||
item.getItemMeta().hasLore() &&
|
||||
item.getItemMeta().getLore().contains(ChatColor.LIGHT_PURPLE+"Summoner Gear"));
|
||||
}
|
||||
}
|
@ -143,7 +143,8 @@ enum OptionName{
|
||||
HEALTHBARDISPLAY("Healthbar Display",ChatColor.GRAY+"Toggles the healthbar near the player's cursor\nwhen attacking or getting hit by mobs.",Material.BED,(byte)0),
|
||||
AUTOEQUIPARMOR("Auto-Equip Armor",ChatColor.GRAY+"Toggles automatically equipping appropriate armor.",Material.LEATHER_CHESTPLATE,(byte)0),
|
||||
AUTOEQUIPWEAPON("Auto-Equip Weapon",ChatColor.GRAY+"Toggles automatically equipping appropriate weapons.",Material.IRON_SWORD,(byte)0),
|
||||
SOUNDS("Login/Logout Sounds",ChatColor.GRAY+"Toggles the playing of login/logout sound\nnotifications as well as message sound notifications.",Material.RECORD_7,(byte)0);
|
||||
SOUNDS("Login/Logout Sounds",ChatColor.GRAY+"Toggles the playing of login/logout sound\nnotifications as well as message sound notifications.",Material.RECORD_7,(byte)0),
|
||||
MOUSEOVERHEALTHBAR("Mouseover Healthbar",ChatColor.GRAY+"Toggles the display of a mob's healthbar without having to attack it.",Material.WATCH,(byte)0);
|
||||
|
||||
String title;
|
||||
String description;
|
||||
@ -198,6 +199,12 @@ enum OptionName{
|
||||
}
|
||||
return pd.healthbardisplay;
|
||||
}
|
||||
case MOUSEOVERHEALTHBAR:{
|
||||
if (toggle) {
|
||||
pd.mouseoverhealthbar=!pd.mouseoverhealthbar;
|
||||
}
|
||||
return pd.mouseoverhealthbar;
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("WARNING! Value for Option "+title+" does not exist!", 1);
|
||||
return false;
|
||||
|
79
src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
Normal file
79
src/sig/plugin/TwosideKeeper/HelperStructures/Pet.java
Normal file
@ -0,0 +1,79 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import sig.plugin.TwosideKeeper.LivingEntityStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
||||
|
||||
public class Pet {
|
||||
final static public int LEASHRANGE = 16;
|
||||
final static public int LEASHRANGE_SQUARED = LEASHRANGE*LEASHRANGE;
|
||||
Player owner;
|
||||
Location targetLoc;
|
||||
double moveSpd = 1;
|
||||
LivingEntity ent;
|
||||
String name="";
|
||||
|
||||
public Pet(Player owner, EntityType ent, String nickname) {
|
||||
try {
|
||||
this.ent = (LivingEntity)owner.getLocation().getWorld().spawnEntity(owner.getLocation(), ent);
|
||||
this.owner = owner;
|
||||
this.name = nickname;
|
||||
this.setNickname(nickname);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(this.ent);
|
||||
les.isPet=true;
|
||||
les.petOwner=owner;
|
||||
} catch (ClassCastException e) {
|
||||
TwosideKeeper.log("ERROR! Specified invalid Entity Type when creating Pet!", 0);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (owner==null || !owner.isValid()) {
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
if (owner.getLocation().distanceSquared(ent.getLocation())>LEASHRANGE_SQUARED) {
|
||||
ent.teleport(owner.getLocation());
|
||||
}
|
||||
if (targetLoc!=null && ent.getLocation().distanceSquared(targetLoc)>1) {
|
||||
Vector dirToMove = MovementUtils.getVelocityTowardsLocation(ent.getLocation(), targetLoc, moveSpd);
|
||||
ent.setVelocity(dirToMove);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTargetLocation(Location loc) {
|
||||
this.targetLoc=loc;
|
||||
}
|
||||
|
||||
public void setMoveSpeed(double spd) {
|
||||
this.moveSpd = spd;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.name=nickname;
|
||||
this.ent.setCustomName(nickname);
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Location getTargetLocation() {
|
||||
return targetLoc;
|
||||
}
|
||||
|
||||
public LivingEntity getEntity() {
|
||||
return ent;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
ent.remove();
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@ public enum PlayerMode {
|
||||
BARBARIAN(ChatColor.GOLD,"B","Barbarian",Book.BARBARIANGUIDE
|
||||
),
|
||||
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",Book.SLAYERGUIDE),
|
||||
/*SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
|
||||
Book.SUMMONERGUIDE),*/
|
||||
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
|
||||
Book.SUMMONERGUIDE),
|
||||
NORMAL(ChatColor.WHITE,"A","Adventurer",Book.ADVENTURERGUIDE);
|
||||
;
|
||||
|
||||
@ -62,6 +62,9 @@ public enum PlayerMode {
|
||||
} else
|
||||
if (Check_isRanger(p)) {
|
||||
pd.lastmode=PlayerMode.RANGER;
|
||||
} else
|
||||
if (Check_isSummoner(p)) {
|
||||
pd.lastmode=PlayerMode.SUMMONER;
|
||||
} else {
|
||||
pd.lastmode=PlayerMode.NORMAL;
|
||||
}
|
||||
@ -146,6 +149,19 @@ public enum PlayerMode {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSummoner(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (needsUpdating(pd)) {
|
||||
return getPlayerMode(p)==PlayerMode.SUMMONER;
|
||||
} else {
|
||||
return pd.lastmode==PlayerMode.SUMMONER;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNormal(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
@ -252,6 +268,24 @@ public enum PlayerMode {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean Check_isSummoner(Player p) {
|
||||
if (p!=null && !p.isDead()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (needsUpdating(pd)) {
|
||||
if (GenericFunctions.onlyHoldingScepter(p) &&
|
||||
GenericFunctions.AllLeatherArmor(p)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return pd.lastmode==PlayerMode.SUMMONER;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String name="";
|
||||
Book helperBook;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -50,9 +51,12 @@ public class LivingEntityStructure {
|
||||
public long lastCrippleTick=0;
|
||||
public long lastBurnTick=0;
|
||||
public long lastHit=0;
|
||||
public long lastHitbyPlayer=0;
|
||||
public float MoveSpeedMultBeforeCripple=1f;
|
||||
public Channel currentChannel=null;
|
||||
public boolean isImportantGlowEnemy=true;
|
||||
public boolean isPet=false;
|
||||
public Player petOwner=null;
|
||||
public HashMap<UUID,Integer> aggro_table = new HashMap<UUID,Integer>();
|
||||
|
||||
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
|
||||
@ -190,11 +194,13 @@ public class LivingEntityStructure {
|
||||
}
|
||||
|
||||
public void setGlow(Player p, GlowAPI.Color col) {
|
||||
GlowAPI.setGlowing(m, col, p);
|
||||
glowcolorlist.put(p.getUniqueId(), col);
|
||||
}
|
||||
|
||||
public void setGlobalGlow(GlowAPI.Color col) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
GlowAPI.setGlowing(m, col, p);
|
||||
glowcolorlist.put(p.getUniqueId(), col);
|
||||
}
|
||||
}
|
||||
@ -264,7 +270,7 @@ public class LivingEntityStructure {
|
||||
}
|
||||
}
|
||||
}catch (NullPointerException npe) {
|
||||
|
||||
GlowAPI.setGlowing(m, false, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -506,6 +512,43 @@ public class LivingEntityStructure {
|
||||
if (target!=null && !EntityUtils.isValidEntity(target)) {
|
||||
aggro_table.remove(target.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFriendly(LivingEntity ent1, LivingEntity ent2) {
|
||||
if (!(ent1 instanceof Player) &&
|
||||
!(ent2 instanceof Player)) {
|
||||
LivingEntityStructure les1 = LivingEntityStructure.GetLivingEntityStructure(ent1);
|
||||
LivingEntityStructure les2 = LivingEntityStructure.GetLivingEntityStructure(ent2);
|
||||
if (les1.isPet && les2.isPet) {
|
||||
if (les1.petOwner!=null && les2.petOwner!=null) {
|
||||
return PVP.isFriendly(les1.petOwner, les2.petOwner);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
if (!(ent1 instanceof Player) ^
|
||||
!(ent2 instanceof Player)) {
|
||||
if (ent1 instanceof Player) { //ent2 is the pet.
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent2);
|
||||
if (les.isPet && les.petOwner!=null) {
|
||||
return PVP.isFriendly(les.petOwner,(Player)ent1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else { //ent1 is the pet.
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent1);
|
||||
if (les.isPet && les.petOwner!=null) {
|
||||
return PVP.isFriendly(les.petOwner,(Player)ent2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
return PVP.isFriendly((Player)ent1,(Player)ent2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -39,6 +40,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.CustomModel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DeathStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.OptionsMenu;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
@ -192,6 +194,10 @@ public class PlayerStructure {
|
||||
public double lastPVPHitDamage=0;
|
||||
public boolean blocking=false;
|
||||
public long lastShieldCharge=0;
|
||||
public LivingEntity lastTarget=null;
|
||||
public long lastGrabbedTarget=0;
|
||||
public UUID lastViewedTarget=null;
|
||||
public boolean mouseoverhealthbar=true;
|
||||
/*State 1
|
||||
* 1: Best of 3 Rounds
|
||||
* 2: Best of 5 Rounds
|
||||
@ -270,6 +276,9 @@ public class PlayerStructure {
|
||||
public long lastFailedCastTime=0;
|
||||
public Location locBeforeInstance=null;
|
||||
|
||||
public Pet myPet=null;
|
||||
public int petID=0;
|
||||
|
||||
List<ItemStack> equipmentset = new ArrayList<ItemStack>();
|
||||
|
||||
public HashMap<Material,List<Integer>> filtercubestructure = new HashMap<Material, List<Integer>>();
|
||||
@ -372,6 +381,7 @@ public class PlayerStructure {
|
||||
this.customtitle = new AdvancedTitle(p);
|
||||
this.lastLocationChange = TwosideKeeper.getServerTickTime();
|
||||
this.lastblock = TwosideKeeper.getServerTickTime();
|
||||
//this.myPet = new Pet(p,EntityType.OCELOT,"Test");
|
||||
//Set defaults first, in case this is a new user.
|
||||
loadConfig();
|
||||
//p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
||||
@ -563,6 +573,7 @@ public class PlayerStructure {
|
||||
workable.set("tooConsistentAdjustments", tooConsistentAdjustments);
|
||||
workable.set("freshBlood", freshBlood);
|
||||
workable.set("firstPVPMatch", firstPVPMatch);
|
||||
workable.set("mouseoverhealthbar", mouseoverhealthbar);
|
||||
int buffcounter=0;
|
||||
for (String key : buffs.keySet()) {
|
||||
Buff b = buffs.get(key);
|
||||
@ -681,6 +692,7 @@ public class PlayerStructure {
|
||||
workable.addDefault("tooConsistentAdjustments",tooConsistentAdjustments);
|
||||
workable.addDefault("freshBlood",freshBlood);
|
||||
workable.addDefault("firstPVPMatch",firstPVPMatch);
|
||||
workable.addDefault("mouseoverhealthbar",mouseoverhealthbar);
|
||||
|
||||
workable.options().copyDefaults();
|
||||
|
||||
@ -757,6 +769,7 @@ public class PlayerStructure {
|
||||
String tempworld = workable.getString("restartloc_world");
|
||||
this.freshBlood = workable.getBoolean("freshBlood");
|
||||
this.firstPVPMatch = workable.getBoolean("firstPVPMatch");
|
||||
this.mouseoverhealthbar = workable.getBoolean("mouseoverhealthbar");
|
||||
if (!workable.getString("instanceloc_world").equalsIgnoreCase("null")) {
|
||||
locBeforeInstance = new Location(
|
||||
Bukkit.getWorld(workable.getString("instanceloc_world")),
|
||||
|
@ -241,6 +241,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.OptionsMenu;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pronouns;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.QuestStatus;
|
||||
@ -2835,6 +2836,45 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
pd.myModel = mymod;
|
||||
models.add(pd.myModel);
|
||||
}break;
|
||||
case "PET":{
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.myPet = new Pet(p, EntityType.OCELOT, "Test");
|
||||
}break;
|
||||
case "SCEPTER":{
|
||||
ItemStack scepter = new ItemStack(Material.BONE);
|
||||
ItemMeta meta = scepter.getItemMeta();
|
||||
meta.setLore(Arrays.asList(ChatColor.LIGHT_PURPLE+"Summoner Gear"));
|
||||
scepter.setItemMeta(meta);
|
||||
GenericFunctions.giveItem(p, scepter);
|
||||
}break;
|
||||
case "UNGLOW":{
|
||||
LivingEntity target = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (target!=null) {
|
||||
target.setCustomName("");
|
||||
target.setGlowing(false);
|
||||
GlowAPI.setGlowing(target, false, p);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.setGlow(p, null);
|
||||
}
|
||||
}break;
|
||||
case "GLOW":{
|
||||
LivingEntity target = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (target!=null) {
|
||||
if (args.length>1) {
|
||||
//target.setCustomName(ChatColor.valueOf(args[1])+"");
|
||||
//target.setGlowing(true);
|
||||
//GlowAPI.setGlowing(target, GlowAPI.Color.valueOf(args[1]), p);
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||
les.setGlow(p, GlowAPI.Color.valueOf(args[1]));
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case "HOTBARSWITCH":{
|
||||
TwosideKeeper.log(p.getOpenInventory().toString(), 0);
|
||||
for (int i=0;i<p.getOpenInventory().countSlots();i++) {
|
||||
aPlugin.API.setItem(p, p.getOpenInventory(), i, new ItemStack(Material.ACACIA_DOOR_ITEM));
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||
@ -3649,6 +3689,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
pd.inTankChallengeRoom=false;
|
||||
pd.inParkourChallengeRoom=false;
|
||||
}
|
||||
|
||||
pd.myPet = new Pet(ev.getPlayer(),EntityType.OCELOT,"Test");
|
||||
//ItemCubeUtils.populateItemCubeGraph(ev.getPlayer());
|
||||
if (!ev.getPlayer().isDead() && ChallengeReward.hasRewards(ev.getPlayer())) {
|
||||
ChallengeReward.rewardAwards(ev.getPlayer());
|
||||
@ -3725,6 +3767,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
|
||||
//Make sure to save the config for this player.
|
||||
pd.saveConfig();
|
||||
pd.myPet.cleanup();
|
||||
playerdata.remove(ev.getPlayer().getUniqueId());
|
||||
//Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard players reset "+ev.getPlayer().getName().toLowerCase());
|
||||
log("[TASK] Player Data for "+ev.getPlayer().getName()+" has been removed. Size of array: "+playerdata.size(),4);
|
||||
@ -8447,7 +8490,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
} else {
|
||||
//String finaltext = " ";
|
||||
//String finaltext = TextUtils.createUnderlineBar(,1);
|
||||
String finaltext = finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1);
|
||||
String finaltext = finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)((target.getHealth()-1)/20+1);
|
||||
if (!(target instanceof Player)) {
|
||||
if (les.aggro_table.size()>1) {
|
||||
finaltext = TextUtils.createAggroBar(les.getAggroPercentage(p)) + " "+ finaltext;
|
||||
@ -8965,6 +9008,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
habitat_data.startinglocs.remove(m.getUniqueId());
|
||||
//log("Killed by a player.",0);
|
||||
killedByPlayer = true;
|
||||
if (ms.GetTarget() instanceof Player) {
|
||||
Player p = (Player)ms.GetTarget();
|
||||
if (p!=null) {
|
||||
AwardDeathAchievements(p,ev.getEntity());
|
||||
@ -9007,6 +9051,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
killedByPlayer=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m instanceof LivingEntity) {
|
||||
isBoss=GenericFunctions.isBossMonster(m);
|
||||
@ -9089,7 +9134,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (killedByPlayer) {
|
||||
if (killedByPlayer && (LivingEntityStructure.GetLivingEntityStructure(ev.getEntity()).lastHitbyPlayer+300>TwosideKeeper.getServerTickTime())) {
|
||||
//Get the player that killed the monster.
|
||||
int luckmult = 0;
|
||||
int unluckmult = 0;
|
||||
@ -10289,6 +10334,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
GenericFunctions.playProperEquipSound(p,armor.getType());
|
||||
p.updateInventory();
|
||||
ItemSet.updateItemSets(p);
|
||||
//GenericFunctions.refreshInventoryView(p);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||
|
@ -52,6 +52,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.DamageStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Pet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
@ -318,6 +319,8 @@ final public class runServerHeartbeat implements Runnable {
|
||||
|
||||
performRejuvenationHealing(p,pd);
|
||||
|
||||
RemoveTargetIfInvalid(p,pd);
|
||||
|
||||
updateCustomTitle(p, pd);
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
@ -417,6 +420,18 @@ final public class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
|
||||
}
|
||||
|
||||
private void RemoveTargetIfInvalid(Player p, PlayerStructure pd) {
|
||||
if (pd.lastTarget!=null && !pd.lastTarget.isValid()) {
|
||||
pd.lastTarget=null;
|
||||
} else
|
||||
if (pd.lastTarget!=null && pd.lastTarget.isValid() &&
|
||||
p.getLocation().distanceSquared(pd.lastTarget.getLocation())>Pet.LEASHRANGE_SQUARED) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(pd.lastTarget);
|
||||
les.setGlow(p, null);
|
||||
pd.lastTarget=null;
|
||||
}
|
||||
}
|
||||
|
||||
private void performRejuvenationHealing(Player p, PlayerStructure pd) {
|
||||
if (pd.lastusedRejuvenation+200>TwosideKeeper.getServerTickTime()) {
|
||||
//Regenerate health.
|
||||
|
@ -4,10 +4,16 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.inventivetalent.glow.GlowAPI;
|
||||
import org.inventivetalent.glow.GlowAPI.Color;
|
||||
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomModel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.DamageLabel;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||
|
||||
@ -27,10 +33,43 @@ public class runServerTick implements Runnable{
|
||||
TwosideKeeper.labelqueue.remove(i--);
|
||||
}
|
||||
}
|
||||
/*for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.myModel.displayModel(p.getLocation());
|
||||
}*/
|
||||
//pd.myModel.displayModel(p.getLocation());
|
||||
if (pd.myPet!=null) {
|
||||
pd.myPet.run();
|
||||
}
|
||||
if (PlayerMode.isSummoner(p)) {
|
||||
//long timer = System.nanoTime();
|
||||
LivingEntity targetent = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (targetent!=null) {
|
||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(targetent);
|
||||
if (LivingEntityStructure.isFriendly(p,targetent)) {
|
||||
les.setGlow(p, Color.DARK_AQUA);
|
||||
} else {
|
||||
les.setGlow(p, Color.DARK_GRAY);
|
||||
}
|
||||
if (pd.lastTarget!=null && pd.lastTarget!=targetent) {
|
||||
LivingEntityStructure les2 = LivingEntityStructure.GetLivingEntityStructure(pd.lastTarget);
|
||||
les2.setGlow(p, null);
|
||||
pd.lastTarget.setGlowing(false);
|
||||
GlowAPI.setGlowing(pd.lastTarget, null, p);
|
||||
pd.lastTarget=null;
|
||||
}
|
||||
pd.lastTarget=targetent;
|
||||
}
|
||||
//TwosideKeeper.log("Time Execution took: "+((System.nanoTime()-timer)/1000000)+"ms", 1);
|
||||
}
|
||||
if (pd.mouseoverhealthbar && pd.lastGrabbedTarget+10<=TwosideKeeper.getServerTickTime()) {
|
||||
LivingEntity targetent = aPlugin.API.rayTraceTargetEntity(p, 16);
|
||||
if (targetent!=null && (!(targetent instanceof ArmorStand) || (targetent instanceof ArmorStand && ((ArmorStand)targetent).isVisible())) &&
|
||||
!targetent.hasPotionEffect(PotionEffectType.INVISIBILITY) && (pd.lastViewedTarget==null || !pd.lastViewedTarget.equals(targetent.getUniqueId()))) {
|
||||
pd.customtitle.updateCombatBar(p, targetent);
|
||||
pd.lastGrabbedTarget=TwosideKeeper.getServerTickTime();
|
||||
pd.lastViewedTarget = targetent.getUniqueId();
|
||||
}
|
||||
}
|
||||
}
|
||||
runServerHeartbeat.resetDamageQueue();
|
||||
/*if (Bukkit.getPlayer("sigonasr2")!=null) {
|
||||
Player p = Bukkit.getPlayer("sigonasr2");
|
||||
|
Loading…
x
Reference in New Issue
Block a user