mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-02 13:31:43 +01:00
Remove debugging code and make vehicle enter blocked for boats/minecarts if Controllable is not enabled
This commit is contained in:
parent
b1afe0de03
commit
73854b8107
@ -12,6 +12,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -490,7 +491,8 @@ public class EventListen implements Listener {
|
||||
if (!npcRegistry.isNPC(event.getEntered()))
|
||||
return;
|
||||
NPC npc = npcRegistry.getNPC(event.getEntered());
|
||||
if (npc.getEntity().getType() == EntityType.HORSE && !npc.getTrait(Controllable.class).isEnabled()) {
|
||||
if ((npc.getEntity().getType() == EntityType.HORSE || npc.getEntity().getType() == EntityType.BOAT
|
||||
|| npc.getEntity() instanceof Minecart) && !npc.getTrait(Controllable.class).isEnabled()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
@ -1013,7 +1011,6 @@ public class NPCCommands {
|
||||
Messaging.send(sender,
|
||||
String.format(format, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getWorld().getName()));
|
||||
}
|
||||
((LivingEntity) npc.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1, 10));
|
||||
Messaging.send(sender, " <a>Traits<e>");
|
||||
for (Trait trait : npc.getTraits()) {
|
||||
if (CitizensAPI.getTraitFactory().isInternalTrait(trait))
|
||||
|
@ -0,0 +1,44 @@
|
||||
package net.citizensnpcs.npc.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.citizensnpcs.api.astar.pathfinder.BlockSource;
|
||||
import net.citizensnpcs.api.astar.pathfinder.NeighbourGeneratorBlockExaminer;
|
||||
import net.citizensnpcs.api.astar.pathfinder.PathPoint;
|
||||
|
||||
public class EnhancedMovementExaminer implements NeighbourGeneratorBlockExaminer {
|
||||
@Override
|
||||
public float getCost(BlockSource source, PathPoint point) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PathPoint> getNeighbours(BlockSource source, PathPoint point) {
|
||||
Vector location = point.getVector();
|
||||
List<PathPoint> neighbours = Lists.newArrayList();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x == 0 && y == 0 && z == 0)
|
||||
continue;
|
||||
if (x != 0 && z != 0)
|
||||
continue;
|
||||
Vector mod = location.clone().add(new Vector(x, y, z));
|
||||
if (mod.equals(location))
|
||||
continue;
|
||||
neighbours.add(point.createAtOffset(mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PassableState isPassable(BlockSource source, PathPoint point) {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user