Read desc

Tried a little fix for sounds.
Hopefully made a fix for concurrent modification errors
Fixed typo in disguise player command
Added warning and disable if ProtocolLib isn't found
This commit is contained in:
Andrew 2013-05-30 02:25:00 +12:00
parent 0b605b0780
commit c78843aa2a
5 changed files with 19 additions and 11 deletions

View File

@ -2,7 +2,7 @@ name: LibsDisguises
main: me.libraryaddict.disguise.LibsDisguises
version: ${project.version}
author: libraryaddict
depend: [ProtocolLib]
softdepend: [ProtocolLib]
commands:
disguise:
aliases: [d, dis]

View File

@ -69,7 +69,7 @@ public class DisguisePlayerCommand implements CommandExecutor {
} else
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
} else {
if (args.length == 1) {
if (args.length > 1) {
Player p = Bukkit.getPlayer(args[0]);
if (p != null) {
if (args[1].equalsIgnoreCase("undiguise") || args[1].equalsIgnoreCase("undis")

View File

@ -107,6 +107,7 @@ public class DisguiseAPI {
}
}
if (disguisedEntity != null) {
// TODO Check if they been damage with invincibility ticks
Sound sound = null;
DisguiseSound dSound = DisguiseSound.getType(DisguiseAPI.getDisguise(disguisedEntity).getType().name());
if (dSound != null)
@ -150,9 +151,8 @@ public class DisguiseAPI {
EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) entity).getHandle().world).tracker.trackedEntities
.get(entity.getEntityId());
if (entry != null) {
Iterator itel = entry.trackedPlayers.iterator();
while (itel.hasNext()) {
EntityPlayer player = (EntityPlayer) itel.next();
EntityPlayer[] players = (EntityPlayer[]) entry.trackedPlayers.toArray();
for (EntityPlayer player : players) {
if (entity instanceof Player && !player.getBukkitEntity().canSee((Player) entity))
continue;
entry.clear(player);

View File

@ -12,7 +12,7 @@ public enum DisguiseSound {
BLAZE(Sound.BLAZE_HIT, null, Sound.BLAZE_DEATH, Sound.BLAZE_BREATH),
CAVE_SPIDER(Sound.SPIDER_IDLE, Sound.SPIDER_WALK, Sound.SPIDER_DEATH, null),
CAVE_SPIDER(Sound.SPIDER_IDLE, Sound.SPIDER_WALK, Sound.SPIDER_DEATH, Sound.PIG_IDLE),
CHICKEN(Sound.CHICKEN_HURT, Sound.CHICKEN_WALK, Sound.CHICKEN_HURT, Sound.CHICKEN_IDLE, Sound.CHICKEN_EGG_POP),
@ -28,9 +28,9 @@ public enum DisguiseSound {
GHAST(Sound.GHAST_SCREAM, null, Sound.GHAST_DEATH, Sound.GHAST_MOAN, Sound.GHAST_CHARGE, Sound.GHAST_FIREBALL,
Sound.GHAST_SCREAM2),
GIANT_ZOMBIE(Sound.HURT_FLESH, Sound.STEP_GRASS),
GIANT_ZOMBIE(Sound.HURT_FLESH, Sound.STEP_GRASS, null, null),
IRON_GOLEM(Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_WALK, Sound.IRONGOLEM_DEATH, null, Sound.IRONGOLEM_THROW),
IRON_GOLEM(Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_WALK, Sound.IRONGOLEM_DEATH, Sound.IRONGOLEM_THROW),
MAGMA_CUBE(Sound.SLIME_ATTACK, Sound.SLIME_WALK2, null, null, Sound.SLIME_WALK),
@ -38,13 +38,13 @@ public enum DisguiseSound {
OCELOT(Sound.CAT_HIT, Sound.STEP_GRASS, Sound.CAT_HIT, Sound.CAT_MEOW, Sound.CAT_PURR, Sound.CAT_PURREOW),
PIG(Sound.PIG_IDLE, Sound.PIG_WALK, Sound.PIG_DEATH, null),
PIG(Sound.PIG_IDLE, Sound.PIG_WALK, Sound.PIG_DEATH, Sound.PIG_IDLE),
PIG_ZOMBIE(Sound.ZOMBIE_PIG_HURT, null, Sound.ZOMBIE_PIG_DEATH, Sound.ZOMBIE_PIG_IDLE, Sound.ZOMBIE_PIG_ANGRY),
PLAYER(Sound.HURT_FLESH, Sound.STEP_GRASS),
SHEEP(Sound.SHEEP_IDLE, Sound.SHEEP_WALK, null, null, null, Sound.SHEEP_SHEAR),
SHEEP(Sound.SHEEP_IDLE, Sound.SHEEP_WALK, null, Sound.SHEEP_IDLE, Sound.SHEEP_SHEAR),
SILVERFISH(Sound.SILVERFISH_HIT, Sound.SILVERFISH_WALK, Sound.SILVERFISH_KILL, Sound.SILVERFISH_IDLE),
@ -52,7 +52,7 @@ public enum DisguiseSound {
SLIME(Sound.SLIME_ATTACK, Sound.SLIME_WALK2, null, null, Sound.SLIME_WALK),
SPIDER(Sound.SPIDER_IDLE, Sound.SPIDER_WALK, Sound.SPIDER_DEATH, null),
SPIDER(Sound.SPIDER_IDLE, Sound.SPIDER_WALK, Sound.SPIDER_DEATH, Sound.PIG_IDLE),
WITHER(Sound.WITHER_HURT, null, Sound.WITHER_DEATH, Sound.WITHER_IDLE, Sound.WITHER_SHOOT, Sound.WITHER_SPAWN),

View File

@ -10,6 +10,8 @@ import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.DisguiseTypes.DisguiseType;
import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise;
import net.minecraft.server.v1_5_R3.WatchableObject;
import org.bukkit.Bukkit;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.ExperienceOrb;
@ -30,6 +32,12 @@ public class LibsDisguises extends JavaPlugin {
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
System.out.print("[LibsDisguises] WARNING! WARNING! LibsDisguises couldn't find ProtocolLib! This plugin depends on it to run!");
System.out.print("[LibsDisguises] WARNING! WARNING! LibsDisguises couldn't find ProtocolLib! LibsDisguises is now shutting down!");
getPluginLoader().disablePlugin(this);
return;
}
DisguiseAPI.init(this);
DisguiseAPI.enableSounds(true);
final ProtocolManager manager = ProtocolLibrary.getProtocolManager();