Fix Recycling Centers, fix teleportation into nether portals on death,
fix elites going into nether portals.
This commit is contained in:
parent
551fd81699
commit
8e083867e8
Binary file not shown.
@ -361,7 +361,7 @@ public class EliteMonster {
|
|||||||
m.eject();
|
m.eject();
|
||||||
}
|
}
|
||||||
LivingEntity l = m.getTarget();
|
LivingEntity l = m.getTarget();
|
||||||
if (l!=null) {
|
if (l!=null && l.getWorld().equals(m.getWorld())) {
|
||||||
if (l.isDead()) {
|
if (l.isDead()) {
|
||||||
targetlist.remove(l);
|
targetlist.remove(l);
|
||||||
if (targetlist.size()>0) {
|
if (targetlist.size()>0) {
|
||||||
|
@ -3026,7 +3026,7 @@ public class GenericFunctions {
|
|||||||
if (damager!=null) {
|
if (damager!=null) {
|
||||||
if (md.hitlist.containsKey(damager.getUniqueId())) {
|
if (md.hitlist.containsKey(damager.getUniqueId())) {
|
||||||
long time = md.hitlist.get(damager.getUniqueId());
|
long time = md.hitlist.get(damager.getUniqueId());
|
||||||
TwosideKeeper.log("Last hit on "+time+". Current time: "+TwosideKeeper.getServerTickTime(), 2);
|
TwosideKeeper.log("Last hit on "+time+". Current time: "+TwosideKeeper.getServerTickTime(), 5);
|
||||||
if (time+10<TwosideKeeper.getServerTickTime()) {
|
if (time+10<TwosideKeeper.getServerTickTime()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3036,7 +3036,7 @@ public class GenericFunctions {
|
|||||||
} else {
|
} else {
|
||||||
if (md.hitlist.containsKey(m.getUniqueId())) {
|
if (md.hitlist.containsKey(m.getUniqueId())) {
|
||||||
long time = md.hitlist.get(m.getUniqueId());
|
long time = md.hitlist.get(m.getUniqueId());
|
||||||
TwosideKeeper.log("->Last hit on "+time+". Current time: "+TwosideKeeper.getServerTickTime(), 2);
|
TwosideKeeper.log("->Last hit on "+time+". Current time: "+TwosideKeeper.getServerTickTime(), 5);
|
||||||
if (time+10<TwosideKeeper.getServerTickTime()) {
|
if (time+10<TwosideKeeper.getServerTickTime()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3050,7 +3050,7 @@ public class GenericFunctions {
|
|||||||
!(entity instanceof Player)) {
|
!(entity instanceof Player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TwosideKeeper.log("Returning false... "+TwosideKeeper.getServerTickTime(), 2);
|
TwosideKeeper.log("Returning false... "+TwosideKeeper.getServerTickTime(), 5);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3631,16 +3631,34 @@ public class GenericFunctions {
|
|||||||
public static Location FindRandomFreeLocation(Location loc) {
|
public static Location FindRandomFreeLocation(Location loc) {
|
||||||
Location testloc = loc;
|
Location testloc = loc;
|
||||||
if ((testloc.getBlock().getType()==Material.PORTAL ||
|
if ((testloc.getBlock().getType()==Material.PORTAL ||
|
||||||
testloc.getBlock().getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getType()==Material.OBSIDIAN) ||
|
||||||
(testloc.getBlock().getRelative(0, 0, 1).getType()==Material.PORTAL ||
|
(testloc.getBlock().getRelative(0, 0, 1).getType()==Material.PORTAL ||
|
||||||
testloc.getBlock().getRelative(0, 0, 1).getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getRelative(0, 0, 1).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, 1).getType()==Material.OBSIDIAN) ||
|
||||||
(testloc.getBlock().getRelative(0, 0, -1).getType()==Material.PORTAL ||
|
(testloc.getBlock().getRelative(0, 0, -1).getType()==Material.PORTAL ||
|
||||||
testloc.getBlock().getRelative(0, 0, -1).getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getRelative(0, 0, -1).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, -1).getType()==Material.OBSIDIAN) ||
|
||||||
(testloc.getBlock().getRelative(-1, 0, 0).getType()==Material.PORTAL ||
|
(testloc.getBlock().getRelative(-1, 0, 0).getType()==Material.PORTAL ||
|
||||||
testloc.getBlock().getRelative(-1, 0, 0).getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getRelative(-1, 0, 0).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(-1, 0, 0).getType()==Material.OBSIDIAN) ||
|
||||||
(testloc.getBlock().getRelative(1, 0, 0).getType()==Material.PORTAL ||
|
(testloc.getBlock().getRelative(1, 0, 0).getType()==Material.PORTAL ||
|
||||||
testloc.getBlock().getRelative(1, 0, 0).getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getRelative(1, 0, 0).getType()==Material.ENDER_PORTAL ||
|
||||||
testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR) {
|
testloc.getBlock().getRelative(1, 0, 0).getType()==Material.OBSIDIAN) ||
|
||||||
|
(testloc.getBlock().getRelative(0, 0, 2).getType()==Material.PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, 2).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, 2).getType()==Material.OBSIDIAN) ||
|
||||||
|
(testloc.getBlock().getRelative(0, 0, -2).getType()==Material.PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, -2).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(0, 0, -2).getType()==Material.OBSIDIAN) ||
|
||||||
|
(testloc.getBlock().getRelative(-2, 0, 0).getType()==Material.PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(-2, 0, 0).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(-2, 0, 0).getType()==Material.OBSIDIAN) ||
|
||||||
|
(testloc.getBlock().getRelative(2, 0, 0).getType()==Material.PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(2, 0, 0).getType()==Material.ENDER_PORTAL ||
|
||||||
|
testloc.getBlock().getRelative(2, 0, 0).getType()==Material.OBSIDIAN) ||
|
||||||
|
testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR ||
|
||||||
|
!testloc.getBlock().getRelative(0, 0, 0).getType().isSolid()) {
|
||||||
do {
|
do {
|
||||||
testloc = testloc.add(2-Math.random()*4,2-Math.random()*4,2-Math.random()*4);
|
testloc = testloc.add(2-Math.random()*4,2-Math.random()*4,2-Math.random()*4);
|
||||||
TwosideKeeper.log("Testing block "+testloc.getBlock().getType(), 2);
|
TwosideKeeper.log("Testing block "+testloc.getBlock().getType(), 2);
|
||||||
@ -3648,6 +3666,6 @@ public class GenericFunctions {
|
|||||||
testloc.getBlock().getType()==Material.ENDER_PORTAL) ||
|
testloc.getBlock().getType()==Material.ENDER_PORTAL) ||
|
||||||
testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR);
|
testloc.getBlock().getRelative(0, 1, 0).getType()!=Material.AIR);
|
||||||
}
|
}
|
||||||
return testloc;
|
return testloc.getBlock().getLocation().add(0.5, 1.5, 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,7 @@ public class RecyclingCenter {
|
|||||||
|
|
||||||
public void AddItemToRecyclingCenter(Item i) {
|
public void AddItemToRecyclingCenter(Item i) {
|
||||||
//There is a % chance of it going to a recycling center.
|
//There is a % chance of it going to a recycling center.
|
||||||
if ((GenericFunctions.isArtifactEquip(i.getItemStack())) &&
|
if (IsItemAllowed(i.getItemStack())) {
|
||||||
IsItemAllowed(i.getItemStack())) {
|
|
||||||
//Recycle allowed. Now figure out which node to go to.
|
//Recycle allowed. Now figure out which node to go to.
|
||||||
if (getNumberOfNodes()>0) {
|
if (getNumberOfNodes()>0) {
|
||||||
Location rand_node=getRandomNode();
|
Location rand_node=getRandomNode();
|
||||||
|
@ -86,6 +86,7 @@ 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;
|
||||||
|
import org.bukkit.event.entity.EntityPortalEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
@ -4179,10 +4180,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
|
public void onEliteTeleport(EntityPortalEvent ev) {
|
||||||
|
if (ev.getEntity() instanceof Monster && MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).equals(MonsterDifficulty.ELITE)) {
|
||||||
|
ev.setTo(ev.getFrom());
|
||||||
|
ev.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void onEndermanTeleport(EntityTeleportEvent ev) {
|
public void onEndermanTeleport(EntityTeleportEvent ev) {
|
||||||
if (elitemonsters.contains(ev.getEntity())) {
|
if (ev.getEntity() instanceof Monster && MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).equals(MonsterDifficulty.ELITE)) {
|
||||||
|
ev.setTo(ev.getFrom());
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user