mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-27 03:28:45 +01:00
Add debug when sending skins to players
This commit is contained in:
parent
5b274ad7a7
commit
6d1e848d89
@ -238,7 +238,7 @@ public class EventListen implements Listener {
|
|||||||
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
|
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return;
|
return;
|
||||||
event.setCancelled(npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true));
|
event.setCancelled(npc.isProtected());
|
||||||
if (event instanceof EntityCombustByEntityEvent) {
|
if (event instanceof EntityCombustByEntityEvent) {
|
||||||
Bukkit.getPluginManager().callEvent(new NPCCombustByEntityEvent((EntityCombustByEntityEvent) event, npc));
|
Bukkit.getPluginManager().callEvent(new NPCCombustByEntityEvent((EntityCombustByEntityEvent) event, npc));
|
||||||
} else if (event instanceof EntityCombustByBlockEvent) {
|
} else if (event instanceof EntityCombustByBlockEvent) {
|
||||||
@ -256,13 +256,13 @@ public class EventListen implements Listener {
|
|||||||
npc = CitizensAPI.getNPCRegistry().getNPC(((EntityDamageByEntityEvent) event).getDamager());
|
npc = CitizensAPI.getNPCRegistry().getNPC(((EntityDamageByEntityEvent) event).getDamager());
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return;
|
return;
|
||||||
event.setCancelled(!npc.data().get(NPC.DAMAGE_OTHERS_METADATA, true));
|
event.setCancelled(!npc.isProtected());
|
||||||
NPCDamageEntityEvent damageEvent = new NPCDamageEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
NPCDamageEntityEvent damageEvent = new NPCDamageEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
||||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true));
|
event.setCancelled(npc.isProtected());
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
NPCDamageByEntityEvent damageEvent = new NPCDamageByEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
NPCDamageByEntityEvent damageEvent = new NPCDamageByEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
||||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||||
@ -341,8 +341,7 @@ public class EventListen implements Listener {
|
|||||||
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getTarget());
|
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getTarget());
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
return;
|
return;
|
||||||
event.setCancelled(
|
event.setCancelled(!npc.data().get(NPC.TARGETABLE_METADATA, !npc.isProtected()));
|
||||||
!npc.data().get(NPC.TARGETABLE_METADATA, !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)));
|
|
||||||
Bukkit.getPluginManager().callEvent(new EntityTargetNPCEvent(event, npc));
|
Bukkit.getPluginManager().callEvent(new EntityTargetNPCEvent(event, npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,21 +110,17 @@ public class WaypointCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "waypoints", "waypoint", "wp" },
|
aliases = { "waypoints", "waypoint", "wp" },
|
||||||
usage = "provider [provider name] (-d)",
|
usage = "provider [provider name]",
|
||||||
desc = "Sets the current waypoint provider",
|
desc = "Sets the current waypoint provider",
|
||||||
modifiers = { "provider" },
|
modifiers = { "provider" },
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 2,
|
max = 2,
|
||||||
flags = "d",
|
|
||||||
permission = "citizens.waypoints.provider")
|
permission = "citizens.waypoints.provider")
|
||||||
public void provider(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
public void provider(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||||
Waypoints waypoints = npc.getOrAddTrait(Waypoints.class);
|
Waypoints waypoints = npc.getOrAddTrait(Waypoints.class);
|
||||||
if (args.argsLength() == 1) {
|
if (args.argsLength() == 1) {
|
||||||
if (args.hasFlag('d')) {
|
|
||||||
waypoints.describeProviders(sender);
|
|
||||||
} else {
|
|
||||||
Messaging.sendTr(sender, Messages.CURRENT_WAYPOINT_PROVIDER, waypoints.getCurrentProviderName());
|
Messaging.sendTr(sender, Messages.CURRENT_WAYPOINT_PROVIDER, waypoints.getCurrentProviderName());
|
||||||
}
|
waypoints.describeProviders(sender);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sender instanceof Player && Editor.hasEditor(((Player) sender))) {
|
if (sender instanceof Player && Editor.hasEditor(((Player) sender))) {
|
||||||
|
@ -28,6 +28,7 @@ import net.citizensnpcs.Settings.Setting;
|
|||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||||
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -328,6 +329,10 @@ public class SkinUpdateTracker {
|
|||||||
public void run() {
|
public void run() {
|
||||||
List<SkinnableEntity> visible = getNearbyNPCs(player, reset, false);
|
List<SkinnableEntity> visible = getNearbyNPCs(player, reset, false);
|
||||||
for (SkinnableEntity skinnable : visible) {
|
for (SkinnableEntity skinnable : visible) {
|
||||||
|
if (Messaging.isDebugging()) {
|
||||||
|
Messaging.debug("Sending skin from", skinnable.getBukkitEntity(), "to", player, "(" + delay,
|
||||||
|
reset + ")");
|
||||||
|
}
|
||||||
skinnable.getSkinTracker().updateViewer(player);
|
skinnable.getSkinTracker().updateViewer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user