Start of: operation: letuserstranslatethepluginforus

This commit is contained in:
Zino 2013-08-06 22:55:27 +02:00
parent 028079d885
commit 5f5229a997
3 changed files with 284 additions and 271 deletions

View File

@ -431,7 +431,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public String getPromptText(ConversationContext context) {
String text = GOLD + "- Create Quest -\n";
text += AQUA + "Create new Quest " + GOLD + "- Enter a name for the Quest (Or enter \'cancel\' to return)";
text += AQUA + "Create new Quest " + GOLD + "- " + Lang.get("enterQuestName");
return text;

View File

@ -69,6 +69,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
public final static Logger log = Logger.getLogger("Minecraft");
public static Economy economy = null;
public static Permission permission = null;
public static mcMMO mcmmo = null;
@ -77,35 +78,35 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
public static boolean npcEffects = true;
public static boolean broadcastPartyCreation = true;
public static int maxPartySize = 0;
public static String effect = "note";
final List<String> questerBlacklist = new LinkedList<String>();
public ConversationFactory conversationFactory;
ConversationFactory NPCConversationFactory;
QuestFactory questFactory;
EventFactory eventFactory;
Vault vault = null;
public CitizensPlugin citizens;
PlayerListener pListener;
NpcEffectThread effListener;
NpcListener npcListener;
EpicBossListener bossListener;
public Denizen denizen = null;
QuestTaskTrigger trigger;
final Map<String, Quester> questers = new HashMap<String, Quester>();
final LinkedList<Quest> quests = new LinkedList<Quest>();
public final LinkedList<Event> events = new LinkedList<Event>();
final LinkedList<NPC> questNPCs = new LinkedList<NPC>();
boolean allowCommands = true;
boolean allowCommandsForNpcQuests = false;
boolean showQuestReqs = true;
boolean allowQuitting = true;
boolean debug = false;
boolean load = false;
int killDelay = 0;
public static int acceptTimeout = 20;
public static int inviteTimeout = 20;
int totalQuestPoints = 0;
public final static Logger log = Logger.getLogger("Minecraft");
public static String effect = "note";
public final Map<String, Quester> questers = new HashMap<String, Quester>();
public final List<String> questerBlacklist = new LinkedList<String>();
public final LinkedList<Quest> quests = new LinkedList<Quest>();
public final LinkedList<Event> events = new LinkedList<Event>();
public final LinkedList<NPC> questNPCs = new LinkedList<NPC>();
public ConversationFactory conversationFactory;
public ConversationFactory NPCConversationFactory;
public QuestFactory questFactory;
public EventFactory eventFactory;
public Vault vault = null;
public CitizensPlugin citizens;
public PlayerListener pListener;
public NpcListener npcListener;
public EpicBossListener bossListener;
public NpcEffectThread effListener;
public Denizen denizen = null;
public QuestTaskTrigger trigger;
public boolean allowCommands = true;
public boolean allowCommandsForNpcQuests = false;
public boolean showQuestReqs = true;
public boolean allowQuitting = true;
public boolean debug = false;
public boolean load = false;
public int killDelay = 0;
public int totalQuestPoints = 0;
public Lang lang;
@Override
public void onEnable() {
@ -180,7 +181,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
loadConfig();
Lang.initPhrases();
lang = new Lang(this);
lang.initPhrases();
lang.save();
if (new File(this.getDataFolder(), "quests.yml").exists() == false) {
printInfo("[Quests] Quest data not found, writing default to file.");
@ -327,6 +330,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
killDelay = config.getInt("kill-delay");
acceptTimeout = config.getInt("accept-timeout");
if (config.contains("language")) {
Lang.lang = config.getString("language");
} else {
config.set("language", "en");
}
if(config.contains("broadcast-party-creation")){
broadcastPartyCreation = config.getBoolean("broadcast-party-creation");
}else{

View File

@ -1,50 +1,32 @@
package me.blackvein.quests.util;
import java.util.HashMap;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import me.blackvein.quests.Quests;
import org.bukkit.configuration.file.YamlConfiguration;
public class Lang {
public static String lang = "en";
private static Map<String, String> en = new HashMap<String, String>();
private static Map<String, String> fr = new HashMap<String, String>();
private static Map<String, String> es = new HashMap<String, String>();
private static Map<String, String> de = new HashMap<String, String>();
private static Map<String, String> sv = new HashMap<String, String>();
private static Map<String, String> nl = new HashMap<String, String>();
private static Map<String, String> pl = new HashMap<String, String>();
private static Map<String, String> da = new HashMap<String, String>();
private static Map<String, String> zh = new HashMap<String, String>();
private static Map<String, String> no = new HashMap<String, String>();
public static String get(String key){
private static Map<String, String> en = new LinkedHashMap<String, String>();
if(lang.equals("en"))
return en.get(key);
else if(lang.equals("fr"))
return fr.get(key);
else if(lang.equals("es"))
return es.get(key);
else if(lang.equals("de"))
return de.get(key);
else if(lang.equals("sv"))
return sv.get(key);
else if(lang.equals("nl"))
return nl.get(key);
else if(lang.equals("pl"))
return pl.get(key);
else if(lang.equals("da"))
return da.get(key);
else if(lang.equals("zh"))
return zh.get(key);
else if(lang.equals("no"))
return no.get(key);
else
return en.get(key);
private Quests plugin;
public Lang (Quests plugin) {
this.plugin = plugin;
}
public static void initPhrases(){
public static String get(String key){
return en.get(key);
}
public void initPhrases(){
//English
@ -193,8 +175,8 @@ public class Lang {
en.put("eventEditorCommandsNote", "Note: You may use <player> to refer to the player's name.");
en.put("eventEditorSetCommandsPrompt", "Enter commands separating each one by a comma, or enter \"clear\" to clear the list, or enter \"cancel\" to return.");
en.put("eventEditorSet", "");
en.put("eventEditorSet", "");
en.put("eventEditorSet", "");
//en.put("eventEditorSet", "");
//en.put("eventEditorSet", "");
//
@ -238,5 +220,27 @@ public class Lang {
//
//
File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml");
YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file);
for (Entry<String, Object> e : langFile.getValues(true).entrySet()) {
en.put(e.getKey(), (String) e.getValue());
}
}
public void save() {
File file = new File(plugin.getDataFolder(), "/lang/" + lang + ".yml");
YamlConfiguration langFile = YamlConfiguration.loadConfiguration(file);
for (Entry<String, String> e : en.entrySet()) {
langFile.set(e.getKey(), e.getValue());
}
try {
langFile.save(file);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}