Bugfix for error on unsupported MC versions

This commit is contained in:
GeorgH93 2017-05-23 18:56:31 +02:00
parent ba6915bfb5
commit 2c95f2bed9
5 changed files with 6 additions and 8 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId> <groupId>at.pcgamingfreaks</groupId>
<artifactId>MinePacks</artifactId> <artifactId>MinePacks</artifactId>
<version>1.16.7</version> <version>1.17-SNAPSHOT</version>
<scm> <scm>
<connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection> <connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection>

View File

@ -6,7 +6,6 @@ Language:
LangUpdated: Die Sprachdatei wurde aktualisiert. LangUpdated: Die Sprachdatei wurde aktualisiert.
UpdateUUIDs: Beginne die Spielernamen in UUIDs umzuwandeln... UpdateUUIDs: Beginne die Spielernamen in UUIDs umzuwandeln...
UpdatedUUIDs: 'Es wurden %d Spielernamen in UUIDs umgewandelt.' UpdatedUUIDs: 'Es wurden %d Spielernamen in UUIDs umgewandelt.'
MinecraftVersionNotCompatible: "Deine Minecraft Version (MC %1$s) ist mit der Version des Plugins (%2$s) nicht kompatibel! Bitte prüfe ob ein update verfügbar ist!"
Ingame: Ingame:
NoPermission: 'Dir fehlen die Rechte dafür.' NoPermission: 'Dir fehlen die Rechte dafür.'
OwnBackPackClose: 'Rucksack geschlossen.' OwnBackPackClose: 'Rucksack geschlossen.'

View File

@ -6,7 +6,6 @@ Language:
LangUpdated: Language File has been updated. LangUpdated: Language File has been updated.
UpdateUUIDs: Start updating database to UUIDs ... UpdateUUIDs: Start updating database to UUIDs ...
UpdatedUUIDs: 'Updated %s accounts to UUIDs.' UpdatedUUIDs: 'Updated %s accounts to UUIDs.'
MinecraftVersionNotCompatible: "Your minecraft version (MC %1$s) is currently not compatible with this plugins version (%2$s). Please check for updates!"
Ingame: Ingame:
NoPermission: You don't have the Permission to do that. NoPermission: You don't have the Permission to do that.
OwnBackPackClose: 'Backpack closed!' OwnBackPackClose: 'Backpack closed!'

View File

@ -36,7 +36,7 @@ protected void doUpdate()
{ {
case 1: lang.set("Language.Ingame.Cooldown", "Please wait till you reopen your backpack."); case 1: lang.set("Language.Ingame.Cooldown", "Please wait till you reopen your backpack.");
case 2: lang.set("Language.Ingame.InvalidBackpack", lang.getString("Language.Ingame.IvalidBackpack", "Invalid backpack.")); case 2: lang.set("Language.Ingame.InvalidBackpack", lang.getString("Language.Ingame.IvalidBackpack", "Invalid backpack."));
case 3: lang.set("Language.Console.MinecraftVersionNotCompatible", "Your minecraft version (MC %1$s) is currently not compatible with this plugins version (%2$s). Please check for updates!"); case 3:
case 4: lang.set("Language.Ingame.WrongGameMode", "You are not allowed to open your backpack in your current game-mode."); case 4: lang.set("Language.Ingame.WrongGameMode", "You are not allowed to open your backpack in your current game-mode.");
break; break;
} }

View File

@ -113,23 +113,23 @@ public void onDone(UpdateResult updateResult)
public void onDisable() public void onDisable()
{ {
Updater updater = null; Updater updater = null;
if(config.getAutoUpdate()) // Lets check for updates if(config != null && config.getAutoUpdate()) // Lets check for updates
{ {
log.info("Checking for updates ..."); log.info("Checking for updates ...");
updater = new Updater(this, this.getFile(), true, 83445); // Create a new updater with dev.bukkit.org as update provider updater = new Updater(this, this.getFile(), true, 83445); // Create a new updater with dev.bukkit.org as update provider
updater.update(); // Starts the update, if there is a new update available it will download while we close the rest updater.update(); // Starts the update, if there is a new update available it will download while we close the rest
} }
getServer().getScheduler().cancelTasks(this); // Stop the listener, we don't need them any longer getServer().getScheduler().cancelTasks(this); // Stop the listener, we don't need them any longer
DB.close(); // Close the DB connection, we won't need them any longer if(DB != null) DB.close(); // Close the DB connection, we won't need them any longer
if(updater != null) updater.waitForAsyncOperation(); // The update can download while we kill the listeners and close the DB connections if(updater != null) updater.waitForAsyncOperation(); // The update can download while we kill the listeners and close the DB connections
instance = null; instance = null;
log.info(lang.get("Console.Disabled")); if(lang != null) log.info(lang.get("Console.Disabled"));
} }
public void warnOnVersionIncompatibility(String version) public void warnOnVersionIncompatibility(String version)
{ {
log.warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET); log.warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
log.warning(ConsoleColor.RED + String.format(lang.getTranslated("Console.MinecraftVersionNotCompatible"), version, getDescription().getVersion()) + ConsoleColor.RESET); log.warning(ConsoleColor.RED + String.format("Your minecraft version (MC %1$s) is currently not compatible with this plugins version (%2$s). Please check for updates!", version, getDescription().getVersion()) + ConsoleColor.RESET);
log.warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET); log.warning(ConsoleColor.RED + "################################" + ConsoleColor.RESET);
Utils.blockThread(5); Utils.blockThread(5);
} }