mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-15 23:26:16 +01:00
Controllable should allow donkeys/mules to use horse physics, and delay skin respawning by a tick
This commit is contained in:
parent
9a4c8e73c2
commit
a9ddebd8f8
@ -77,7 +77,6 @@ import net.citizensnpcs.api.trait.trait.Speech;
|
||||
import net.citizensnpcs.api.util.Colorizer;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.api.util.Paginator;
|
||||
import net.citizensnpcs.api.util.Placeholders;
|
||||
import net.citizensnpcs.npc.EntityControllers;
|
||||
import net.citizensnpcs.npc.NPCSelector;
|
||||
import net.citizensnpcs.npc.Template;
|
||||
@ -409,7 +408,7 @@ public class NPCCommands {
|
||||
permission = "citizens.npc.create")
|
||||
@Requirements
|
||||
public void create(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
String name = Placeholders.replace(Colorizer.parseColors(args.getJoinedStrings(1).trim()), sender, null);
|
||||
String name = Colorizer.parseColors(args.getJoinedStrings(1).trim());
|
||||
EntityType type = EntityType.PLAYER;
|
||||
if (args.hasValueFlag("type")) {
|
||||
String inputType = args.getFlag("type");
|
||||
|
@ -136,10 +136,15 @@ public class Skin {
|
||||
|
||||
NPC npc = entity.getNPC();
|
||||
|
||||
if (npc.isSpawned()) {
|
||||
npc.despawn(DespawnReason.PENDING_RESPAWN);
|
||||
npc.spawn(npc.getStoredLocation(), SpawnReason.RESPAWN);
|
||||
}
|
||||
if (!npc.isSpawned())
|
||||
return;
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
npc.despawn(DespawnReason.PENDING_RESPAWN);
|
||||
npc.spawn(npc.getStoredLocation(), SpawnReason.RESPAWN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fetch() {
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -312,7 +311,7 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
boolean onGround = NMS.isOnGround(npc.getEntity());
|
||||
float speedMod = npc.getNavigator().getDefaultParameters()
|
||||
.modifiedSpeed((onGround ? GROUND_SPEED : AIR_SPEED));
|
||||
if (!(npc.getEntity() instanceof Horse)) { // just use minecraft horse physics
|
||||
if (!Util.isHorse(npc.getEntity().getType())) { // just use minecraft horse physics
|
||||
speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, speedMod);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user