mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-15 23:26:16 +01:00
Fix skin trait and text bugs
This commit is contained in:
parent
261ac1b4b1
commit
918fcb9ca7
@ -1851,8 +1851,12 @@ public class NPCCommands {
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
trait.setSkinPersistent(uuid, signature, textureEncoded);
|
||||
Messaging.sendTr(sender, Messages.SKIN_URL_SET, npc.getName(), url);
|
||||
try {
|
||||
trait.setSkinPersistent(uuid, signature, textureEncoded);
|
||||
Messaging.sendTr(sender, Messages.SKIN_URL_SET, npc.getName(), url);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Messaging.sendErrorTr(sender, Messages.ERROR_SETTING_SKIN_URL, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.citizensnpcs.npc.ai.speech;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.ai.speech.SpeechContext;
|
||||
import net.citizensnpcs.api.ai.speech.Talkable;
|
||||
@ -9,10 +13,6 @@ import net.citizensnpcs.api.ai.speech.event.SpeechTargetedEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TalkableEntity implements Talkable {
|
||||
Entity entity;
|
||||
|
||||
@ -66,9 +66,9 @@ public class TalkableEntity implements Talkable {
|
||||
}
|
||||
}
|
||||
|
||||
private void talk(String message) {
|
||||
private void talk(NPC npc, String message) {
|
||||
if (entity instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(entity)) {
|
||||
Messaging.send((Player) entity, message);
|
||||
Messaging.sendWithNPC(entity, message, npc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,8 @@ public class TalkableEntity implements Talkable {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
talk(event.getMessage());
|
||||
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getContext().getTalker().getEntity());
|
||||
talk(npc, event.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,7 +88,8 @@ public class TalkableEntity implements Talkable {
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
talk(event.getMessage());
|
||||
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getContext().getTalker().getEntity());
|
||||
talk(npc, event.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class SkinTrait extends Trait {
|
||||
Preconditions.checkNotNull(data);
|
||||
|
||||
setSkinNameInternal(skinName);
|
||||
String json = new String(BaseEncoding.base64().decode(textureRaw), Charsets.UTF_8);
|
||||
String json = new String(BaseEncoding.base64().decode(data), Charsets.UTF_8);
|
||||
if (!json.contains("textures")) {
|
||||
throw new IllegalArgumentException("Invalid texture data");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user