-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
SentinelCrackShot.java
48 lines (43 loc) · 1.68 KB
/
SentinelCrackShot.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.mcmonkey.sentinel.integration;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import org.mcmonkey.sentinel.SentinelIntegration;
import org.mcmonkey.sentinel.SentinelTrait;
import com.shampaggon.crackshot.CSDirector;
public class SentinelCrackShot extends SentinelIntegration {
@Override
public String getTargetHelp() {
return "";
}
@Override
public String[] getTargetPrefixes() {
return new String[0];
}
@Override
public boolean tryAttack(SentinelTrait st, LivingEntity ent) {
if (!(st.getLivingEntity() instanceof Player)) {
return false;
}
CSDirector direc = (CSDirector) Bukkit.getPluginManager().getPlugin("CrackShot");
String node = direc.returnParentNode((Player) st.getLivingEntity());
if (node == null) {
return false;
}
Vector faceAcc = ent.getEyeLocation().toVector().subtract(st.getLivingEntity().getEyeLocation().toVector());
if (faceAcc.lengthSquared() > 0.0) {
faceAcc = faceAcc.normalize();
}
faceAcc = st.fixForAcc(faceAcc);
st.faceLocation(st.getLivingEntity().getEyeLocation().clone().add(faceAcc.multiply(10)));
ItemStack itm = ((Player) st.getLivingEntity()).getItemInHand();
direc.csminion.weaponInteraction((Player) st.getLivingEntity(), node, false);
((Player) st.getLivingEntity()).setItemInHand(itm);
if (st.rangedChase) {
st.attackHelper.rechase();
}
return true;
}
}