Updates and Bugfixes

This commit is contained in:
GeorgH93 2015-09-17 15:10:00 +02:00
parent c12bfb006e
commit 95f6a4d09b
6 changed files with 40 additions and 24 deletions

5
.gitignore vendored
View File

@ -56,7 +56,4 @@ Temporary Items
/target/ /target/
/bin/ /bin/
*.iml *.iml
/.idea/ /.idea/
jar_libs/bukkit.jar

View File

@ -43,6 +43,7 @@ Database:
# true: Only to use if your server is running in online mode and your minecraft version is 1.7.5 or newer # true: Only to use if your server is running in online mode and your minecraft version is 1.7.5 or newer
# false: In offline mode or for minecraft version below 1.7.5 # false: In offline mode or for minecraft version below 1.7.5
# Should be configured automaticaly based on your minecraft version and online mode settings # Should be configured automaticaly based on your minecraft version and online mode settings
# If you are using BungeeCord please set this setting based on your BungeeCord's online mode.
UseUUIDs: true UseUUIDs: true
# Defines the storage format for UUIDs for compatibility with other plugins (shared tables) # Defines the storage format for UUIDs for compatibility with other plugins (shared tables)
# true: format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # true: format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
@ -74,5 +75,5 @@ Database:
# Enables/Disables the auto-update function of the plugin. # Enables/Disables the auto-update function of the plugin.
auto-update: true auto-update: true
# Config File Version. Don't touch it! # Config file version. Don't touch it!
Version: 9 Version: 9

View File

@ -1,4 +1,3 @@
Version: 3
Language: Language:
Console: Console:
Enabled: MinePacks wurde aktiviert! Enabled: MinePacks wurde aktiviert!
@ -6,16 +5,19 @@ Language:
NotFromConsole: Befehlt nicht von der Console aus verwendbar. NotFromConsole: Befehlt nicht von der Console aus verwendbar.
LangUpdated: Sprachdatei wurde aktualisiert. LangUpdated: Sprachdatei wurde aktualisiert.
UpdateUUIDs: Starte Datenbank Update auf UUIDs ... UpdateUUIDs: Starte Datenbank Update auf UUIDs ...
UpdatedUUIDs: '%s Datensätze wurden auf UUIDs geupdated.' UpdatedUUIDs: '%s Datens<EFBFBD>tze wurden auf UUIDs geupdated.'
Ingame: Ingame:
NoPermission: 'Dir fehlen die Rechte dafür.' NoPermission: 'Dir fehlen die Rechte daf<EFBFBD>r.'
OwnBackPackClose: 'Rucksack geschlossen!' OwnBackPackClose: 'Rucksack geschlossen!'
PlayerBackPackClose: "%s's Rucksack geschlossen!" PlayerBackPackClose: "%s's Rucksack geschlossen!"
InvalidBackpack: Rucksack fehlerhaft. InvalidBackpack: Rucksack fehlerhaft.
BackpackCleaned: Rucksack gelehrt. BackpackCleaned: Rucksack gelehrt.
Cooldown: 'Bitte warte etwas bis du deinen Rucksack erneut öffnest.' Cooldown: 'Bitte warte etwas bis du deinen Rucksack erneut <EFBFBD>ffnest.'
Description: Description:
Backpack: Öffnet deinen Rucksack. Backpack: <EFBFBD>ffnet deinen Rucksack.
Clean: Leert deinen Rucksack. Clean: Leert deinen Rucksack.
CleanOther: Leert den Rucksack von Spielern. CleanOther: Leert den Rucksack von Spielern.
View: Zeigt den Rucksack von anderen Spielern. View: Zeigt den Rucksack von anderen Spielern.
# Language file version. Don't touch it!
Version: 3

View File

@ -1,4 +1,3 @@
Version: 3
Language: Language:
Console: Console:
Enabled: MinePacks has been enabled! Enabled: MinePacks has been enabled!
@ -18,4 +17,7 @@ Language:
Backpack: Opens your backpack. Backpack: Opens your backpack.
Clean: Cleans your backpack. Clean: Cleans your backpack.
CleanOther: Cleans the backpack of other players. CleanOther: Cleans the backpack of other players.
View: Shows the backpack of other player. View: Shows the backpack of other player.
# Language file version. Don't touch it!
Version: 3

View File

@ -37,26 +37,36 @@ public Config(JavaPlugin plugin)
@Override @Override
protected boolean newConfigCreated() protected boolean newConfigCreated()
{ {
config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); config.set("Database.UseUUIDs", plugin.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible());
return true; return !(plugin.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible());
} }
@Override @Override
protected void doUpdate(int version) protected void doUpdate()
{ {
// Nothing to update yet // Nothing to update yet
} }
@Override @Override
protected void doUpgrade(Configuration oldConfiguration) protected void doUpgrade(Configuration oldConfig)
{ {
Set<String> keys = oldConfiguration.getConfig().getKeys(true); Set<String> keys = oldConfig.getConfig().getKeys(true);
for(String key : keys) for(String key : keys)
{ {
if(key.equals("Database.UseUUIDs") || key.equals("UseUUIDs")) continue; if(key.equals("UseUUIDs") || key.equals("Version")) continue;
config.set(key, oldConfiguration.getConfig().get(key)); config.set(key, oldConfig.getConfig().get(key));
}
if(!oldConfig.getConfig().isSet("Database.UseUUIDs"))
{
if(oldConfig.getConfig().isSet("UseUUIDs"))
{
config.set("Database.UseUUIDs", config.getBoolean("UseUUIDs"));
}
else
{
config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible());
}
} }
config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible());
} }
// Getter // Getter

View File

@ -33,9 +33,9 @@
public class MinePacks extends JavaPlugin public class MinePacks extends JavaPlugin
{ {
public final Logger log = getLogger(); public Logger log;
public final Config config = new Config(this); public Config config;
public final Language lang = new Language(this); public Language lang;
public Database DB; public Database DB;
public HashMap<Player, Long> cooldowns = new HashMap<>(); public HashMap<Player, Long> cooldowns = new HashMap<>();
@ -46,6 +46,10 @@ public class MinePacks extends JavaPlugin
@Override @Override
public void onEnable() public void onEnable()
{ {
log = getLogger();
config = new Config(this);
lang = new Language(this);
lang.load(config.getLanguage(), config.getLanguageUpdateMode()); lang.load(config.getLanguage(), config.getLanguageUpdateMode());
DB = Database.getDatabase(this); DB = Database.getDatabase(this);
getCommand("backpack").setExecutor(new OnCommand(this)); getCommand("backpack").setExecutor(new OnCommand(this));