mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Translate yet more strings
This commit is contained in:
parent
14af55efa5
commit
7d6dc1c40a
@ -2,6 +2,7 @@ package net.citizensnpcs.editor;
|
|||||||
|
|
||||||
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.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -23,13 +24,12 @@ public class EquipmentEditor extends Editor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void begin() {
|
public void begin() {
|
||||||
Messaging.send(player, "<b>Entered the equipment editor!");
|
Messaging.sendTr(player, Messages.EQUIPMENT_EDITOR_BEGIN);
|
||||||
Messaging.send(player, "<e>Right click <a>to equip the NPC!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void end() {
|
public void end() {
|
||||||
Messaging.send(player, "<a>Exited the equipment editor.");
|
Messaging.sendTr(player, Messages.EQUIPMENT_EDITOR_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -13,6 +13,7 @@ import net.citizensnpcs.api.trait.trait.Spawned;
|
|||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
import net.citizensnpcs.npc.ai.CitizensNavigator;
|
import net.citizensnpcs.npc.ai.CitizensNavigator;
|
||||||
import net.citizensnpcs.trait.CurrentLocation;
|
import net.citizensnpcs.trait.CurrentLocation;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
import net.minecraft.server.EntityPlayer;
|
import net.minecraft.server.EntityPlayer;
|
||||||
@ -90,10 +91,7 @@ public abstract class CitizensNPC extends AbstractNPC {
|
|||||||
} else {
|
} else {
|
||||||
trait = CitizensAPI.getTraitFactory().getTrait(traitKey.name());
|
trait = CitizensAPI.getTraitFactory().getTrait(traitKey.name());
|
||||||
if (trait == null) {
|
if (trait == null) {
|
||||||
Messaging
|
Messaging.severeTr(Messages.SKIPPING_BROKEN_TRAIT, traitKey.name(), getId());
|
||||||
.severeF(
|
|
||||||
"Skipped broken or missing trait '%s' while loading ID '%d'. Has the name changed?",
|
|
||||||
traitKey.name(), getId());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addTrait(trait);
|
addTrait(trait);
|
||||||
@ -101,8 +99,7 @@ public abstract class CitizensNPC extends AbstractNPC {
|
|||||||
try {
|
try {
|
||||||
trait.load(traitKey);
|
trait.load(traitKey);
|
||||||
} catch (NPCLoadException ex) {
|
} catch (NPCLoadException ex) {
|
||||||
Messaging.logF("The trait '%s' failed to load for NPC ID: '%d'.", traitKey.name(), getId(),
|
Messaging.logTr(Messages.TRAIT_LOAD_FAILED, traitKey.name(), getId());
|
||||||
ex.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +171,7 @@ public abstract class CitizensNPC extends AbstractNPC {
|
|||||||
if (isSpawned())
|
if (isSpawned())
|
||||||
navigator.update();
|
navigator.update();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Messaging.logF("Exception while updating %d: %s.", getId(), ex.getMessage());
|
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.citizensnpcs.editor.Equipable;
|
|||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
@ -28,14 +29,14 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
|||||||
@Override
|
@Override
|
||||||
public void equip(Player equipper, ItemStack hand) {
|
public void equip(Player equipper, ItemStack hand) {
|
||||||
if (!hand.getType().isBlock()) {
|
if (!hand.getType().isBlock()) {
|
||||||
Messaging.sendError(equipper, "Invalid block!");
|
Messaging.sendErrorTr(equipper, Messages.EQUIPMENT_EDITOR_INVALID_BLOCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialData carried = getBukkitEntity().getCarriedMaterial();
|
MaterialData carried = getBukkitEntity().getCarriedMaterial();
|
||||||
if (carried.getItemType() == Material.AIR) {
|
if (carried.getItemType() == Material.AIR) {
|
||||||
if (hand.getType() == Material.AIR) {
|
if (hand.getType() == Material.AIR) {
|
||||||
Messaging.sendError(equipper, "Invalid block!");
|
Messaging.sendErrorTr(equipper, Messages.EQUIPMENT_EDITOR_INVALID_BLOCK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,6 +4,7 @@ import net.citizensnpcs.api.CitizensAPI;
|
|||||||
import net.citizensnpcs.api.trait.trait.Equipment;
|
import net.citizensnpcs.api.trait.trait.Equipment;
|
||||||
import net.citizensnpcs.editor.Equipable;
|
import net.citizensnpcs.editor.Equipable;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
@ -88,7 +89,7 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
|
|||||||
trait.set(i, null);
|
trait.set(i, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendF(equipper, "<e>%s<a> had all of its items removed.", getName());
|
Messaging.sendTr(equipper, Messages.EQUIPMENT_EDITOR_ALL_ITEMS_REMOVED, getName());
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import net.citizensnpcs.npc.CitizensNPC;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.trait.Sheared;
|
import net.citizensnpcs.trait.Sheared;
|
||||||
import net.citizensnpcs.trait.WoolColor;
|
import net.citizensnpcs.trait.WoolColor;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
@ -15,6 +16,7 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.EntitySheep;
|
import net.minecraft.server.EntitySheep;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -39,16 +41,15 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
|
|||||||
|
|
||||||
DyeColor color = DyeColor.getByData((byte) (15 - hand.getData().getData()));
|
DyeColor color = DyeColor.getByData((byte) (15 - hand.getData().getData()));
|
||||||
getTrait(WoolColor.class).setColor(color);
|
getTrait(WoolColor.class).setColor(color);
|
||||||
Messaging.send(
|
Messaging.sendTr(equipper, ChatColor.GREEN, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED,
|
||||||
equipper,
|
StringHelper.wrap(getName()),
|
||||||
StringHelper.wrap(getName()) + " is now "
|
StringHelper.wrap(color.name().toLowerCase().replace("_", " ")));
|
||||||
+ StringHelper.wrap(color.name().toLowerCase().replace("_", " ")) + ".");
|
|
||||||
|
|
||||||
hand.setAmount(hand.getAmount() - 1);
|
hand.setAmount(hand.getAmount() - 1);
|
||||||
} else {
|
} else {
|
||||||
getTrait(WoolColor.class).setColor(DyeColor.WHITE);
|
getTrait(WoolColor.class).setColor(DyeColor.WHITE);
|
||||||
Messaging.send(equipper, StringHelper.wrap(getName()) + " is now " + StringHelper.wrap("white")
|
Messaging.sendTr(equipper, ChatColor.GREEN, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED,
|
||||||
+ ".");
|
StringHelper.wrap(getName()), StringHelper.wrap("white"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package net.citizensnpcs.trait;
|
|||||||
import net.citizensnpcs.api.exception.NPCLoadException;
|
import net.citizensnpcs.api.exception.NPCLoadException;
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
|
|
||||||
@ -18,8 +19,8 @@ public class Age extends Trait implements Toggleable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void describe(CommandSender sender) {
|
public void describe(CommandSender sender) {
|
||||||
Messaging.sendF(sender, "%s's age is %s and %s locked.", StringHelper.wrap(npc.getName()),
|
Messaging.sendTr(sender, Messages.AGE_TRAIT_DESCRIPTION, StringHelper.wrap(npc.getName()),
|
||||||
StringHelper.wrap(age), StringHelper.wrap(locked ? "is" : "isn't"));
|
StringHelper.wrap(age), StringHelper.wrap(locked));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAgeable() {
|
private boolean isAgeable() {
|
||||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
import net.citizensnpcs.api.exception.NPCLoadException;
|
import net.citizensnpcs.api.exception.NPCLoadException;
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
import net.citizensnpcs.api.util.DataKey;
|
import net.citizensnpcs.api.util.DataKey;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.Pose;
|
import net.citizensnpcs.util.Pose;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
@ -52,7 +53,7 @@ public class Poses extends Trait {
|
|||||||
String[] parts = sub.getString("").split(";");
|
String[] parts = sub.getString("").split(";");
|
||||||
poses.add(new Pose(parts[0], Float.valueOf(parts[1]), Float.valueOf(parts[2])));
|
poses.add(new Pose(parts[0], Float.valueOf(parts[1]), Float.valueOf(parts[2])));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Messaging.logF("Skipping pose %s - invalid yaw/pitch (%s).", sub.name(), e.getMessage());
|
Messaging.logTr(Messages.SKIPPING_INVALID_POSE, sub.name(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import net.citizensnpcs.api.util.DataKey;
|
|||||||
import net.citizensnpcs.editor.Editor;
|
import net.citizensnpcs.editor.Editor;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.trait.Toggleable;
|
import net.citizensnpcs.trait.Toggleable;
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.Paginator;
|
import net.citizensnpcs.util.Paginator;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
@ -70,13 +71,13 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void begin() {
|
public void begin() {
|
||||||
Messaging.send(player, "<b>Entered the text editor!");
|
Messaging.sendTr(player, Messages.TEXT_EDITOR_BEGIN);
|
||||||
conversation.begin();
|
conversation.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void end() {
|
public void end() {
|
||||||
Messaging.send(player, "<a>Exited the text editor.");
|
Messaging.sendTr(player, Messages.TEXT_EDITOR_END);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -102,7 +103,6 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
|||||||
range = key.getDouble("range", range);
|
range = key.getDouble("range", range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onRightClick(NPCRightClickEvent event) {
|
public void onRightClick(NPCRightClickEvent event) {
|
||||||
if (!event.getNPC().equals(npc))
|
if (!event.getNPC().equals(npc))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.citizensnpcs.trait.text;
|
package net.citizensnpcs.trait.text;
|
||||||
|
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
@ -10,7 +10,7 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class TextAddPrompt extends StringPrompt {
|
public class TextAddPrompt extends StringPrompt {
|
||||||
private Text text;
|
private final Text text;
|
||||||
|
|
||||||
public TextAddPrompt(Text text) {
|
public TextAddPrompt(Text text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
@ -19,13 +19,12 @@ public class TextAddPrompt extends StringPrompt {
|
|||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
text.add(input);
|
text.add(input);
|
||||||
Messaging.send((Player) context.getForWhom(),
|
Messaging.sendTr((Player) context.getForWhom(), Messages.TEXT_EDITOR_ADDED_ENTRY, input);
|
||||||
StringHelper.parseColors("<e>Added <a>the entry <e>" + input + "."));
|
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
return ChatColor.GREEN + "Enter text to add to the NPC.";
|
return ChatColor.GREEN + Messaging.tr(Messages.TEXT_EDITOR_ADD_PROMPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,16 @@
|
|||||||
package net.citizensnpcs.trait.text;
|
package net.citizensnpcs.trait.text;
|
||||||
|
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
import org.bukkit.conversations.StringPrompt;
|
import org.bukkit.conversations.StringPrompt;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class TextEditPrompt extends StringPrompt {
|
public class TextEditPrompt extends StringPrompt {
|
||||||
private Text text;
|
private final Text text;
|
||||||
|
|
||||||
public TextEditPrompt(Text text) {
|
public TextEditPrompt(Text text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
@ -19,13 +20,13 @@ public class TextEditPrompt extends StringPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
int index = (Integer) context.getSessionData("index");
|
int index = (Integer) context.getSessionData("index");
|
||||||
text.edit(index, input);
|
text.edit(index, input);
|
||||||
Messaging.send((Player) context.getForWhom(), "<a>Changed entry at index <e>" + index + " <a>to <e>"
|
Messaging
|
||||||
+ input + "<a>.");
|
.sendTr((CommandSender) context.getForWhom(), Messages.TEXT_EDITOR_EDITED_TEXT, index, input);
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
return ChatColor.GREEN + "Enter text to edit the entry.";
|
return ChatColor.GREEN + Messaging.tr(Messages.TEXT_EDITOR_EDIT_PROMPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package net.citizensnpcs.trait.text;
|
package net.citizensnpcs.trait.text;
|
||||||
|
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
|
||||||
|
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
@ -9,7 +9,7 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class TextEditStartPrompt extends StringPrompt {
|
public class TextEditStartPrompt extends StringPrompt {
|
||||||
private Text text;
|
private final Text text;
|
||||||
|
|
||||||
public TextEditStartPrompt(Text text) {
|
public TextEditStartPrompt(Text text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
@ -21,7 +21,7 @@ public class TextEditStartPrompt extends StringPrompt {
|
|||||||
try {
|
try {
|
||||||
int index = Integer.parseInt(input);
|
int index = Integer.parseInt(input);
|
||||||
if (!text.hasIndex(index)) {
|
if (!text.hasIndex(index)) {
|
||||||
Messaging.sendError(player, "'" + index + "' is not a valid index!");
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
context.setSessionData("index", index);
|
context.setSessionData("index", index);
|
||||||
@ -32,14 +32,13 @@ public class TextEditStartPrompt extends StringPrompt {
|
|||||||
return new PageChangePrompt(text);
|
return new PageChangePrompt(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendError(player, "Invalid input.");
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
text.sendPage(((Player) context.getForWhom()), 1);
|
text.sendPage(((Player) context.getForWhom()), 1);
|
||||||
return StringHelper
|
return Messaging.tr(Messages.TEXT_EDITOR_EDIT_BEGIN_PROMPT);
|
||||||
.parseColors("<a>Enter the index of the entry you wish to edit or <e>page <a>to view more pages.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package net.citizensnpcs.trait.text;
|
package net.citizensnpcs.trait.text;
|
||||||
|
|
||||||
|
import net.citizensnpcs.util.Messages;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ public class TextRemovePrompt extends StringPrompt {
|
|||||||
try {
|
try {
|
||||||
int index = Integer.parseInt(input);
|
int index = Integer.parseInt(input);
|
||||||
if (!text.hasIndex(index)) {
|
if (!text.hasIndex(index)) {
|
||||||
Messaging.sendErrorF(player, "'%d' is not a valid index!", index);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
text.remove(index);
|
text.remove(index);
|
||||||
@ -33,7 +34,7 @@ public class TextRemovePrompt extends StringPrompt {
|
|||||||
return new PageChangePrompt(text);
|
return new PageChangePrompt(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendError(player, "Invalid input.");
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||||
return new StartPrompt(text);
|
return new StartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,4 +17,9 @@ public class EntityEnderCrystalMarker extends EntityEnderCrystal {
|
|||||||
@Override
|
@Override
|
||||||
public void h_() {
|
public void h_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean L() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,25 @@ public class Messages {
|
|||||||
public static final String UNKNOWN_COMMAND = "citizens.commands.unknown-command";
|
public static final String UNKNOWN_COMMAND = "citizens.commands.unknown-command";
|
||||||
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider-message";
|
public static final String WAYPOINT_PROVIDER_SET = "citizens.waypoints.set-provider-message";
|
||||||
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
public static final String WRITING_DEFAULT_SETTING = "citizens.settings.writing-default";
|
||||||
|
public static final String EQUIPMENT_EDITOR_BEGIN = "citizens.editors.equipment.begin-message";
|
||||||
|
public static final String EQUIPMENT_EDITOR_END = "citizens.editors.equipment.end-message";
|
||||||
|
public static final String SKIPPING_BROKEN_TRAIT = "citizens.notifications.skipping-broken-trait";
|
||||||
|
public static final String TRAIT_LOAD_FAILED = "citizens.notifications.trait-load-failed";
|
||||||
|
public static final String EXCEPTION_UPDATING_NPC = "citizens.notifications.exception-updating-npc";
|
||||||
|
public static final String EQUIPMENT_EDITOR_INVALID_BLOCK = "citizens.editors.equipment.invalid-block";
|
||||||
|
public static final String EQUIPMENT_EDITOR_SHEEP_COLOURED = "citizens.editors.equipment.sheep-coloured";
|
||||||
|
public static final String EQUIPMENT_EDITOR_ALL_ITEMS_REMOVED = "citizens.editors.equipment.all-items-removed";
|
||||||
|
public static final String AGE_TRAIT_DESCRIPTION = "citizens.traits.age-description";
|
||||||
|
public static final String SKIPPING_INVALID_POSE = "citizens.notifications.skipping-invalid-pose";
|
||||||
|
public static final String TEXT_EDITOR_END = "citizens.editors.text.end-message";
|
||||||
|
public static final String TEXT_EDITOR_BEGIN = "citizens.editors.text.begin-message";
|
||||||
|
public static final String TEXT_EDITOR_ADDED_ENTRY = "citizens.editors.text.added-entry";
|
||||||
|
public static final String TEXT_EDITOR_ADD_PROMPT = "citizens.editors.text.add-prompt";
|
||||||
|
public static final String TEXT_EDITOR_EDIT_PROMPT = "citizens.editors.text.edit-prompt";
|
||||||
|
public static final String TEXT_EDITOR_EDITED_TEXT = "citizens.editors.text.edited-text";
|
||||||
|
public static final String TEXT_EDITOR_INVALID_INDEX = "citizens.editors.text.invalid-index";
|
||||||
|
public static final String TEXT_EDITOR_INVALID_INPUT = "citizens.editors.text.invalid-input";
|
||||||
|
public static final String TEXT_EDITOR_EDIT_BEGIN_PROMPT = "citizens.editors.text.edit-begin-prompt";
|
||||||
|
|
||||||
private static Properties getDefaultBundleProperties() {
|
private static Properties getDefaultBundleProperties() {
|
||||||
Properties defaults = new Properties();
|
Properties defaults = new Properties();
|
||||||
|
@ -2,6 +2,7 @@ package net.citizensnpcs.util;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import net.citizensnpcs.Settings.Setting;
|
import net.citizensnpcs.Settings.Setting;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
@ -13,6 +14,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
|
||||||
public class Messaging {
|
public class Messaging {
|
||||||
private static final Joiner SPACE = Joiner.on(" ").useForNull("null");
|
private static final Joiner SPACE = Joiner.on(" ").useForNull("null");
|
||||||
@ -70,9 +72,13 @@ public class Messaging {
|
|||||||
sendMessageTo(sender, getFormatted(msg));
|
sendMessageTo(sender, getFormatted(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendMessageTo(CommandSender sender, String msg) {
|
private static final Pattern CHAT_NEWLINE = Pattern.compile("<br>|<n>|\\n", Pattern.MULTILINE);
|
||||||
msg = StringHelper.parseColors(msg);
|
private static final Splitter CHAT_NEWLINE_SPLITTER = Splitter.on(CHAT_NEWLINE);
|
||||||
sender.sendMessage(msg);
|
|
||||||
|
private static void sendMessageTo(CommandSender sender, String rawMessage) {
|
||||||
|
rawMessage = StringHelper.parseColors(rawMessage);
|
||||||
|
for (String message : CHAT_NEWLINE_SPLITTER.split(rawMessage))
|
||||||
|
sender.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTr(CommandSender sender, ChatColor rootColour, String key, Object... msg) {
|
public static void sendTr(CommandSender sender, ChatColor rootColour, String key, Object... msg) {
|
||||||
|
@ -11,6 +11,21 @@ citizens.commands.unknown-command=Unknown command. Did you mean:
|
|||||||
citizens.economy.error-loading=Unable to use economy handling. Has Vault been enabled?
|
citizens.economy.error-loading=Unable to use economy handling. Has Vault been enabled?
|
||||||
citizens.economy.minimum-cost-required-message=Need at least {0}.
|
citizens.economy.minimum-cost-required-message=Need at least {0}.
|
||||||
citizens.economy.money-withdrawn=Withdrew {0} for your NPC.
|
citizens.economy.money-withdrawn=Withdrew {0} for your NPC.
|
||||||
|
citizens.editors.equipment.begin-message=<b>Entered the equipment editor!<br><e>Right click <a>to equip the NPC!
|
||||||
|
citizens.editors.equipment.end-message=<a>Exited the equipment editor.
|
||||||
|
citizens.editors.equipment.invalid-block=Invalid block!
|
||||||
|
citizens.editors.equipment.sheep-coloured={0} is now coloured {1}.
|
||||||
|
citizens.editors.equipment.all-items-removed=<e>{0}<a> had all of its items removed.
|
||||||
|
citizens.editors.text.begin-message=<b>Entered the text editor!
|
||||||
|
citizens.editors.text.end-message=<a>Exited the text editor.
|
||||||
|
citizens.editors.text.invalid-index='{0}' is not a valid index!
|
||||||
|
citizens.editors.text.edited-text=<a>Changed entry at index <e>{0}<a>to <e>{1}<a>.
|
||||||
|
citizens.editors.text.added-entry=<e>Added <a>the entry <e>{0}<a>.
|
||||||
|
citizens.editors.text.invalid-input=Invalid input.
|
||||||
|
citizens.editors.text.edit-begin-prompt=<a>Enter the index of the entry you wish to edit or <e>page <a>to view more pages.
|
||||||
|
citizens.editors.text.add-prompt=Enter text to add to the NPC.
|
||||||
|
citizens.editors.text.edit-prompt=Enter text to edit the entry.
|
||||||
|
citizens.traits.age-description={0}'s age is {1}. Locked is {2}.
|
||||||
citizens.limits.over-npc-limt=Over the NPC limit of {0}.
|
citizens.limits.over-npc-limt=Over the NPC limit of {0}.
|
||||||
citizens.load-task-error=NPC load task couldn't be scheduled, disabling...
|
citizens.load-task-error=NPC load task couldn't be scheduled, disabling...
|
||||||
citizens.saves.load-failed=Unable to load saves, disabling...
|
citizens.saves.load-failed=Unable to load saves, disabling...
|
||||||
@ -23,6 +38,10 @@ citizens.notifications.incompatible-version=v{0} is not compatible with Minecraf
|
|||||||
citizens.notifications.locale=Using locale {0}.
|
citizens.notifications.locale=Using locale {0}.
|
||||||
citizens.notifications.metrics-load-error=Unable to start metrics: {0}.
|
citizens.notifications.metrics-load-error=Unable to start metrics: {0}.
|
||||||
citizens.notifications.metrics-started=Metrics started.
|
citizens.notifications.metrics-started=Metrics started.
|
||||||
|
citizens.notifications.exception-updating-npc=Exception while updating {0}: {1}.
|
||||||
|
citizens.notifications.trait-load-failed=The trait '{0}' failed to load for NPC ID: '{1}'.
|
||||||
|
citizens.notifications.skipping-invalid-pose=Skipping pose {0} - invalid yaw/pitch ({1}).
|
||||||
|
citizens.notifications.skipping-broken-trait=Skipped broken or missing trait '{0}' while loading ID '{1}'. Has the name changed?
|
||||||
citizens.notifications.npc-name-not-found=Could not find a name for ID '{0}'.
|
citizens.notifications.npc-name-not-found=Could not find a name for ID '{0}'.
|
||||||
citizens.notifications.npcs-loaded=Loaded {0} NPCs ({1} spawned).
|
citizens.notifications.npcs-loaded=Loaded {0} NPCs ({1} spawned).
|
||||||
citizens.notifications.save-method-set=Save method set to {0}.
|
citizens.notifications.save-method-set=Save method set to {0}.
|
||||||
|
Loading…
Reference in New Issue
Block a user