2011-07-23 21:00:47 +02:00
|
|
|
package com.Acrobot.ChestShop.Utils;
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
import com.Acrobot.ChestShop.ChestShop;
|
2011-07-23 21:00:47 +02:00
|
|
|
import org.bukkit.util.config.Configuration;
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
import java.io.File;
|
|
|
|
|
2011-07-23 21:00:47 +02:00
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class uLongName {
|
2011-09-06 19:01:57 +02:00
|
|
|
public static Configuration config = new Configuration(new File(ChestShop.folder, "longName.storage"));
|
2011-07-23 21:00:47 +02:00
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
public static String getName(final String shortName) {
|
2011-07-23 21:00:47 +02:00
|
|
|
return config.getString(shortName, shortName);
|
|
|
|
}
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
public static void saveName(String name) {
|
|
|
|
if (name.length() != 16) return;
|
|
|
|
config.setProperty(name.substring(0, 15), name);
|
2011-07-23 21:00:47 +02:00
|
|
|
reloadConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String stripName(String name) {
|
|
|
|
return (name.length() > 15 ? name.substring(0, 15) : name);
|
|
|
|
}
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
private static void reloadConfig() {
|
2011-07-23 21:00:47 +02:00
|
|
|
config.save();
|
|
|
|
config.load();
|
|
|
|
}
|
|
|
|
}
|