mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-28 10:12:14 +01:00
Fix some bugs with sounds
This commit is contained in:
parent
7a12d26a8e
commit
355b46e573
@ -1252,9 +1252,21 @@ public class NPCCommands {
|
||||
hurtSound = args.getFlag("hurt").equals("d") ? null : NMS.getSound(args.getFlag("hurt"));
|
||||
}
|
||||
}
|
||||
npc.data().setPersistent(NPC.DEATH_SOUND_METADATA, deathSound);
|
||||
npc.data().setPersistent(NPC.HURT_SOUND_METADATA, hurtSound);
|
||||
npc.data().setPersistent(NPC.AMBIENT_SOUND_METADATA, ambientSound);
|
||||
if (deathSound == null) {
|
||||
npc.data().remove(NPC.DEATH_SOUND_METADATA);
|
||||
} else {
|
||||
npc.data().setPersistent(NPC.DEATH_SOUND_METADATA, deathSound);
|
||||
}
|
||||
if (hurtSound == null) {
|
||||
npc.data().remove(NPC.HURT_SOUND_METADATA);
|
||||
} else {
|
||||
npc.data().setPersistent(NPC.HURT_SOUND_METADATA, hurtSound);
|
||||
}
|
||||
if (ambientSound == null) {
|
||||
npc.data().remove(ambientSound);
|
||||
} else {
|
||||
npc.data().setPersistent(NPC.AMBIENT_SOUND_METADATA, ambientSound);
|
||||
}
|
||||
|
||||
Messaging.sendTr(sender, Messages.SOUND_SET, npc.getName(), ambientSound, hurtSound, deathSound);
|
||||
}
|
||||
|
@ -59,12 +59,13 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String aS() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aS());
|
||||
return npc == null || !npc.data().has(NPC.HURT_SOUND_METADATA) ? super.aS() : npc.data().get(
|
||||
NPC.HURT_SOUND_METADATA, super.aS());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String aT() {
|
||||
return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aT());
|
||||
return npc == null || !npc.data().has(NPC.DEATH_SOUND_METADATA) ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aT());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -148,7 +149,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,7 +177,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +174,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,7 +177,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +176,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +156,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,7 +192,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
private void updateAIWithMovement() {
|
||||
|
@ -118,7 +118,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,7 +152,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
private void updateAIWithMovement() {
|
||||
|
@ -149,7 +149,7 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +161,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,7 +167,7 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +161,7 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,7 +178,7 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,7 +128,7 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
private void updateAIWithMovement() {
|
||||
|
@ -162,7 +162,7 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
protected String t() {
|
||||
return npc == null ? super.aS() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.t() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user