mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Should work better :D
This commit is contained in:
parent
56cb409a43
commit
0a66fad271
@ -381,6 +381,7 @@ public enum C {
|
||||
* Custom
|
||||
*/
|
||||
CUSTOM_STRING("-");
|
||||
static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
|
||||
private static TranslationManager manager;
|
||||
private static TranslationFile defaultFile;
|
||||
/**
|
||||
@ -422,9 +423,8 @@ public enum C {
|
||||
// FIXME: generating a blank file
|
||||
// FIXME: translations aren't customizable
|
||||
// FIXME: Some messages still have the %arg stuff in them
|
||||
|
||||
if (defaultFile == null) {
|
||||
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(PlotMain.getPlugin(PlotMain.class)), TranslationLanguage.englishAmerican, "PlotSquared", manager)
|
||||
defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(PlotMain.getPlugin(PlotMain.class)), lang, "PlotSquared", manager)
|
||||
.read();
|
||||
}
|
||||
// register everything in this class
|
||||
@ -455,7 +455,7 @@ public enum C {
|
||||
* @return translated if exists else default
|
||||
*/
|
||||
public String s() {
|
||||
return manager.getTranslated(toString(), TranslationLanguage.englishAmerican).getTranslated().replaceAll("&-", "\n").replaceAll("\\n", "\n");
|
||||
return manager.getTranslated(toString(), lang).getTranslated().replaceAll("&-", "\n").replaceAll("\\n", "\n");
|
||||
/*
|
||||
if (PlotMain.translations != null) {
|
||||
final String t = PlotMain.translations.getString(this.toString());
|
||||
|
@ -36,31 +36,47 @@ import java.util.*;
|
||||
*/
|
||||
public class SQLManager extends AbstractDB {
|
||||
|
||||
private Connection connection;
|
||||
private String prefix;
|
||||
public final String SET_OWNER =
|
||||
"UPDATE `" + prefix + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ?";
|
||||
// TODO MongoDB @Brandon
|
||||
public String GET_ALL_PLOTS =
|
||||
"SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `" + prefix + "plot`";
|
||||
public String CREATE_PLOTS =
|
||||
"INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ";
|
||||
public String CREATE_SETTINGS =
|
||||
"INSERT INTO `" + prefix + "plot_settings` (`plot_plot_id`) values ";
|
||||
public String CREATE_HELPERS =
|
||||
"INSERT INTO `" + prefix + "plot_helpers` (`plot_plot_id`, `user_uuid`) values ";
|
||||
public String CREATE_PLOT =
|
||||
"INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) VALUES(?, ?, ?, ?)";
|
||||
// Public final
|
||||
public final String SET_OWNER;
|
||||
public final String GET_ALL_PLOTS;
|
||||
public final String CREATE_PLOTS;
|
||||
public final String CREATE_SETTINGS;
|
||||
public final String CREATE_HELPERS;
|
||||
public final String CREATE_PLOT;
|
||||
// Private Final
|
||||
private final Connection connection;
|
||||
private final String prefix;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param c connection
|
||||
* @param p prefix
|
||||
*/
|
||||
public SQLManager(Connection c, String p) {
|
||||
// Private final
|
||||
connection = c;
|
||||
prefix = p;
|
||||
// Public final
|
||||
SET_OWNER =
|
||||
"UPDATE `" + prefix + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ?";
|
||||
GET_ALL_PLOTS =
|
||||
"SELECT `id`, `plot_id_x`, `plot_id_z`, `world` FROM `" + prefix + "plot`";
|
||||
CREATE_PLOTS =
|
||||
"INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) values ";
|
||||
CREATE_SETTINGS =
|
||||
"INSERT INTO `" + prefix + "plot_settings` (`plot_plot_id`) values ";
|
||||
CREATE_HELPERS =
|
||||
"INSERT INTO `" + prefix + "plot_helpers` (`plot_plot_id`, `user_uuid`) values ";
|
||||
CREATE_PLOT =
|
||||
"INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) VALUES(?, ?, ?, ?)";
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Plot owner
|
||||
*
|
||||
* @param plot
|
||||
* @param uuid
|
||||
* @param plot Plot Object
|
||||
* @param uuid Owner UUID
|
||||
*/
|
||||
@Override
|
||||
public void setOwner(final Plot plot, final UUID uuid) {
|
||||
@ -123,7 +139,7 @@ public class SQLManager extends AbstractDB {
|
||||
}
|
||||
|
||||
// add plot settings
|
||||
final Integer[] ids = helpers.keySet().toArray(new Integer[0]);
|
||||
final Integer[] ids = helpers.keySet().toArray(new Integer[helpers.keySet().size()]);
|
||||
StringBuilder statement = new StringBuilder(CREATE_SETTINGS);
|
||||
for (int i = 0; i < (ids.length - 1); i++) {
|
||||
statement.append("(?),");
|
||||
|
Loading…
Reference in New Issue
Block a user