Skip to content

Commit

Permalink
#12 Silent updates / K-9 sound fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eccentricdevotion committed Mar 12, 2022
1 parent 7904852 commit d0439cd
Show file tree
Hide file tree
Showing 22 changed files with 285 additions and 247 deletions.
Binary file modified lib/CitizensAPI.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.eccentric_nz.tardisweepingangels</groupId>
<artifactId>TARDISWeepingAngels</artifactId>
<version>3.5.0</version>
<version>3.6.1</version>
<name>TARDISWeepingAngels</name>
<repositories>
<repository>
Expand Down Expand Up @@ -65,22 +65,22 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<version>1.18.2-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizensapi</artifactId>
<version>2.0.27-SNAPSHOT</version>
<version>2.0.29-SNAPSHOT</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/lib/CitizensAPI.jar</systemPath>
</dependency>
<dependency>
<groupId>me.eccentric_nz.tardischunkgenerator</groupId>
<artifactId>TARDISChunkGenerator</artifactId>
<version>4.8.0</version>
<version>4.9.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import me.eccentric_nz.tardisweepingangels.commands.TabComplete;
import me.eccentric_nz.tardisweepingangels.death.Death;
import me.eccentric_nz.tardisweepingangels.death.PlayerDeath;
import me.eccentric_nz.tardisweepingangels.death.RainDamage;
import me.eccentric_nz.tardisweepingangels.equip.MonsterEquipment;
import me.eccentric_nz.tardisweepingangels.equip.PlayerUndisguise;
import me.eccentric_nz.tardisweepingangels.monsters.cybermen.CybermanRunnable;
Expand All @@ -24,9 +23,9 @@
import me.eccentric_nz.tardisweepingangels.monsters.ood.OodListener;
import me.eccentric_nz.tardisweepingangels.monsters.ood.VillagerCuredListener;
import me.eccentric_nz.tardisweepingangels.monsters.ood.VillagerSpawnListener;
import me.eccentric_nz.tardisweepingangels.monsters.silent.AntiTeleport;
import me.eccentric_nz.tardisweepingangels.monsters.silent.CleanGuardians;
import me.eccentric_nz.tardisweepingangels.monsters.silent.SilentRunnable;
import me.eccentric_nz.tardisweepingangels.monsters.silent.SilentTarget;
import me.eccentric_nz.tardisweepingangels.monsters.silurians.SilurianSpawnerListener;
import me.eccentric_nz.tardisweepingangels.monsters.sontarans.Butler;
import me.eccentric_nz.tardisweepingangels.monsters.sontarans.SontaranRunnable;
Expand Down Expand Up @@ -123,9 +122,8 @@ public void onEnable() {
pm.registerEvents(new GasMask(this), this);
pm.registerEvents(new Butler(this), this);
pm.registerEvents(new HelmetChecker(), this);
pm.registerEvents(new AntiTeleport(this), this);
pm.registerEvents(new SilentTarget(this), this);
pm.registerEvents(new K9Listener(this), this);
pm.registerEvents(new RainDamage(), this);
pm.registerEvents(new ChunkLoad(), this);
pm.registerEvents(new SilurianSpawnerListener(this), this);
pm.registerEvents(new OodListener(), this);
Expand All @@ -148,7 +146,7 @@ public void onEnable() {
getCommand("twa").setExecutor(new TARDISWeepingAngelsCommand(this));
// set tab completion
getCommand("twa").setTabCompleter(new TabComplete(this));
// remove invisible Guardians not riding an Enderman
// remove invisible Guardians not riding a Skeleton
getServer().getScheduler().scheduleSyncRepeatingTask(this, new CleanGuardians(this), 100L, 6000L);
// start repeating spawn tasks
long delay = getConfig().getLong("spawn_rate.how_often");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public boolean count(CommandSender sender, String[] args) {
break;
case SILENT:
what = "Silence";
Collection<Enderman> silence = w.getEntitiesByClass(Enderman.class);
for (Enderman m : silence) {
Collection<Skeleton> silence = w.getEntitiesByClass(Skeleton.class);
for (Skeleton m : silence) {
if (m.getPersistentDataContainer().has(TARDISWeepingAngels.SILENT, PersistentDataType.INTEGER)) {
count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,20 @@ public boolean kill(CommandSender sender, String[] args) {
try {
monster = Monster.valueOf(which);
} catch (IllegalArgumentException e) {
sender.sendMessage(plugin.pluginName + "Invalid monster type!");
// kill old silent
if (which.equals("OLD_SILENT")) {
Collection<Enderman> silence = w.getEntitiesByClass(Enderman.class);
for (Enderman m : silence) {
if (!m.getPassengers().isEmpty() && m.getPassengers().get(0) != null && m.getPassengers().get(0).getType().equals(EntityType.GUARDIAN)) {
m.getPassengers().get(0).remove();
m.remove();
count++;
}
}
sender.sendMessage(plugin.pluginName + "Removed " + count + " Silent Endermen in " + w.getName());
} else {
sender.sendMessage(plugin.pluginName + "Invalid monster type!");
}
return true;
}
switch (monster) {
Expand Down Expand Up @@ -145,8 +158,8 @@ public boolean kill(CommandSender sender, String[] args) {
break;
case SILENT:
what = "Silence";
Collection<Enderman> silence = w.getEntitiesByClass(Enderman.class);
for (Enderman m : silence) {
Collection<Skeleton> silence = w.getEntitiesByClass(Skeleton.class);
for (Skeleton m : silence) {
if (!m.getPassengers().isEmpty() && m.getPassengers().get(0) != null && m.getPassengers().get(0).getType().equals(EntityType.GUARDIAN)) {
m.getPassengers().get(0).remove();
m.remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ public boolean spawn(CommandSender sender, String[] args) {
plugin.getServer().getPluginManager().callEvent(new TARDISWeepingAngelSpawnEvent(ood, EntityType.ARMOR_STAND, Monster.OOD, eyeLocation));
break;
case SILENT:
LivingEntity l = (LivingEntity) world.spawnEntity(eyeLocation, EntityType.ENDERMAN);
LivingEntity l = (LivingEntity) world.spawnEntity(eyeLocation, EntityType.SKELETON);
l.setSilent(true);
SilentEquipment.set(l, false);
player.playSound(l.getLocation(), "silence", 1.0f, 1.0f);
plugin.getServer().getPluginManager().callEvent(new TARDISWeepingAngelSpawnEvent(l, EntityType.ENDERMAN, Monster.SILENT, eyeLocation));
plugin.getServer().getPluginManager().callEvent(new TARDISWeepingAngelSpawnEvent(l, EntityType.SKELETON, Monster.SILENT, eyeLocation));
break;
case SILURIAN:
LivingEntity s = (LivingEntity) world.spawnEntity(eyeLocation, EntityType.SKELETON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public TabComplete(TARDISWeepingAngels plugin) {
for (Monster m : Monster.values()) {
tmp.add(m.toString());
}
tmp.add("OLD_SILENT");
MONSTER_SUBS = ImmutableList.copyOf(tmp);
List<String> worlds = new ArrayList<>();
this.plugin.getServer().getWorlds().forEach((w) -> {
Expand Down
42 changes: 20 additions & 22 deletions src/main/java/me/eccentric_nz/tardisweepingangels/death/Death.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,26 @@ public void onEntityDeath(EntityDeathEvent event) {
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), stack);
return;
}
if (pdc.has(TARDISWeepingAngels.SILENT, PersistentDataType.INTEGER)) {
// remove the guardian as well
Entity guardian = (event.getEntity().getPassengers().size() > 0) ? event.getEntity().getPassengers().get(0) : null;
if (guardian != null) {
guardian.remove();
}
event.getDrops().clear();
ItemStack stack;
if (TARDISWeepingAngels.random.nextInt(100) < 3) {
stack = new ItemStack(Material.END_STONE, 1);
ItemMeta im = stack.getItemMeta();
im.getPersistentDataContainer().set(TARDISWeepingAngels.MONSTER_HEAD, PersistentDataType.INTEGER, 99);
im.setDisplayName("Silent Head");
im.setCustomModelData(3);
stack.setItemMeta(im);
} else {
stack = new ItemStack(silent_drops.get(TARDISWeepingAngels.random.nextInt(silent_drops.size())), TARDISWeepingAngels.random.nextInt(1) + 1);
}
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), stack);
}
}
if (event.getEntityType().equals(EntityType.ZOMBIFIED_PIGLIN)) {
if (pdc.has(TARDISWeepingAngels.WARRIOR, PersistentDataType.INTEGER)) {
Expand Down Expand Up @@ -266,27 +286,5 @@ public void onEntityDeath(EntityDeathEvent event) {
}
}
}
if (event.getEntityType().equals(EntityType.ENDERMAN)) {
if (pdc.has(TARDISWeepingAngels.SILENT, PersistentDataType.INTEGER)) {
// remove the guardian as well
Entity guardian = (event.getEntity().getPassengers().size() > 0) ? event.getEntity().getPassengers().get(0) : null;
if (guardian != null) {
guardian.remove();
}
event.getDrops().clear();
ItemStack stack;
if (TARDISWeepingAngels.random.nextInt(100) < 3) {
stack = new ItemStack(Material.END_STONE, 1);
ItemMeta im = stack.getItemMeta();
im.getPersistentDataContainer().set(TARDISWeepingAngels.MONSTER_HEAD, PersistentDataType.INTEGER, 99);
im.setDisplayName("Silent Head");
im.setCustomModelData(3);
stack.setItemMeta(im);
} else {
stack = new ItemStack(silent_drops.get(TARDISWeepingAngels.random.nextInt(silent_drops.size())), TARDISWeepingAngels.random.nextInt(1) + 1);
}
event.getEntity().getWorld().dropItemNaturally(event.getEntity().getLocation(), stack);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,9 @@ public void onPlayerDeath(PlayerDeathEvent event) {
return;
}
}
if (attacker instanceof Enderman) {
if (!attacker.getPassengers().isEmpty()) {
Entity passenger = attacker.getPassengers().get(0);
if (passenger != null && passenger.getType().equals(EntityType.GUARDIAN)) {
event.setDeathMessage(name + " was slain by a Silent");
return;
}
}
}
if (attacker instanceof Guardian) {
Entity silent = attacker.getVehicle();
if (silent != null && silent.getType().equals(EntityType.ENDERMAN)) {
if (silent != null && silent.getType().equals(EntityType.SKELETON)) {
event.setDeathMessage(name + " was slain by a Silent");
return;
}
Expand Down Expand Up @@ -106,6 +97,13 @@ public void onPlayerDeath(PlayerDeathEvent event) {
event.setDeathMessage(name + " was slain by a Silurian");
return;
}
if (!attacker.getPassengers().isEmpty()) {
Entity passenger = attacker.getPassengers().get(0);
if (passenger != null && passenger.getType().equals(EntityType.GUARDIAN)) {
event.setDeathMessage(name + " was slain by a Silent");
return;
}
}
}
}
if (attacker.getType().equals(EntityType.ARROW)) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,10 @@ public boolean isWeepingAngelMonster(Entity entity) {
if (pdc.has(TARDISWeepingAngels.CYBERMAN, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.DALEK, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.EMPTY, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.WARRIOR, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.SILURIAN, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.SONTARAN, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.STRAX, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.VASHTA, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.ANGEL, PersistentDataType.INTEGER) || pdc.has(TARDISWeepingAngels.ZYGON, PersistentDataType.INTEGER)) {
return true;
}
} else if (entity instanceof Enderman) {
if (!entity.getPassengers().isEmpty()) {
Entity passenger = entity.getPassengers().get(0);
if (passenger != null && passenger.getType().equals(EntityType.GUARDIAN)) {
return true;
}
} else if (entity instanceof Skeleton && !entity.getPassengers().isEmpty()) {
Entity passenger = entity.getPassengers().get(0);
if (passenger != null && passenger.getType().equals(EntityType.GUARDIAN)) {
return true;
}
} else if (entity instanceof Bee) {
if (!entity.getPassengers().isEmpty()) {
Expand All @@ -160,7 +158,7 @@ public boolean isWeepingAngelMonster(Entity entity) {

@Override
public Monster getWeepingAngelMonsterType(Entity entity) {
if (entity instanceof Zombie || entity instanceof PigZombie || entity instanceof Skeleton || entity instanceof Enderman) {
if (entity instanceof Zombie || entity instanceof PigZombie || entity instanceof Skeleton || entity instanceof Skeleton) {
PersistentDataContainer pdc = entity.getPersistentDataContainer();
if (pdc.has(TARDISWeepingAngels.CYBERMAN, PersistentDataType.INTEGER)) {
return Monster.CYBERMAN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void onIronTrapdoorPlace(BlockPlaceEvent event) {
event.getPlayer().sendMessage(plugin.pluginName + "You don't have permission to build a Judoon!");
return;
}
// we're building an Judoon
// we're building a Judoon
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
placed.setType(Material.AIR);
below.setType(Material.AIR);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void run() {
if (plugin.getConfig().getInt("silent.worlds." + name) > 0) {
Collection<Guardian> guardians = w.getEntitiesByClass(Guardian.class);
guardians.forEach((g) -> {
// does it have invisibility but not riding an Enderman
// does it have invisibility but not riding a Skeleton
if (g.hasPotionEffect(PotionEffectType.INVISIBILITY) && g.getVehicle() == null) {
g.remove();
}
Expand Down
Loading

0 comments on commit d0439cd

Please sign in to comment.