diff --git a/pom.xml b/pom.xml index 1891841..d0bd3ac 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 at.pcgamingfreaks MinePacks - 1.15 + 1.16-SNAPSHOT scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git diff --git a/resources/lang/de.yml b/resources/lang/de.yml index c132fd8..db9ce07 100644 --- a/resources/lang/de.yml +++ b/resources/lang/de.yml @@ -6,6 +6,7 @@ Language: LangUpdated: Die Sprachdatei wurde aktualisiert. UpdateUUIDs: Beginne die Spielernamen in UUIDs umzuwandeln... 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: NoPermission: 'Dir fehlen die Rechte dafür.' OwnBackPackClose: 'Rucksack geschlossen.' @@ -20,4 +21,4 @@ Language: View: Öffnet den Rucksack eines anderen Spielers. # Language file version. Don't touch it! -Version: 3 \ No newline at end of file +Version: 4 \ No newline at end of file diff --git a/resources/lang/en.yml b/resources/lang/en.yml index 717f345..01b594c 100644 --- a/resources/lang/en.yml +++ b/resources/lang/en.yml @@ -6,6 +6,7 @@ Language: LangUpdated: Language File has been updated. UpdateUUIDs: Start updating database 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: NoPermission: You don't have the Permission to do that. OwnBackPackClose: 'Backpack closed!' @@ -20,4 +21,4 @@ Language: View: Shows the backpack of other player. # Language file version. Don't touch it! -Version: 3 \ No newline at end of file +Version: 4 \ No newline at end of file diff --git a/src/at/pcgamingfreaks/MinePacks/Database/InventorySerializer.java b/src/at/pcgamingfreaks/MinePacks/Database/InventorySerializer.java index 118707d..7ea771c 100644 --- a/src/at/pcgamingfreaks/MinePacks/Database/InventorySerializer.java +++ b/src/at/pcgamingfreaks/MinePacks/Database/InventorySerializer.java @@ -20,6 +20,7 @@ import at.pcgamingfreaks.Bukkit.ItemStackSerializer.BukkitItemStackSerializer; import at.pcgamingfreaks.Bukkit.ItemStackSerializer.ItemStackSerializer; import at.pcgamingfreaks.Bukkit.ItemStackSerializer.NBTItemStackSerializer; + import org.bukkit.Bukkit; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/at/pcgamingfreaks/MinePacks/Database/Language.java b/src/at/pcgamingfreaks/MinePacks/Database/Language.java index 0eb5b1e..d356d72 100644 --- a/src/at/pcgamingfreaks/MinePacks/Database/Language.java +++ b/src/at/pcgamingfreaks/MinePacks/Database/Language.java @@ -21,7 +21,7 @@ public class Language extends at.pcgamingfreaks.Bukkit.Language { - private static final int LANG_VERSION = 3; + private static final int LANG_VERSION = 4; public Language(JavaPlugin plugin) { @@ -35,6 +35,7 @@ protected void doUpdate() { 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 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!"); break; } } diff --git a/src/at/pcgamingfreaks/MinePacks/MinePacks.java b/src/at/pcgamingfreaks/MinePacks/MinePacks.java index 56cfadb..4420964 100644 --- a/src/at/pcgamingfreaks/MinePacks/MinePacks.java +++ b/src/at/pcgamingfreaks/MinePacks/MinePacks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 GeorgH93 + * Copyright (C) 2014-2016 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,18 +17,22 @@ package at.pcgamingfreaks.MinePacks; -import java.util.HashMap; -import java.util.logging.Logger; +import at.pcgamingfreaks.MinePacks.Database.Config; +import at.pcgamingfreaks.MinePacks.Database.Database; +import at.pcgamingfreaks.MinePacks.Database.Language; import net.gravitydevelopment.Updater.Bukkit_Updater; import net.gravitydevelopment.Updater.UpdateType; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; -import at.pcgamingfreaks.MinePacks.Database.*; +import java.util.HashMap; +import java.util.logging.Logger; public class MinePacks extends JavaPlugin { @@ -38,9 +42,9 @@ public class MinePacks extends JavaPlugin public Config config; public Language lang; public Database DB; - + public HashMap cooldowns = new HashMap<>(); - + public static String BackpackTitle; public String Message_InvalidBackpack; @@ -53,6 +57,16 @@ public static MinePacks getInstance() public void onEnable() { log = getLogger(); + + String name = Bukkit.getServer().getClass().getPackage().getName(); + String[] version = name.substring(name.lastIndexOf('.') + 2).split("_"); + if((version[0].equals("1") && Integer.valueOf(version[1]) > 9) || Integer.valueOf(version[0]) > 1) + { + MinePacks.getInstance().warnOnVersionIncompatibility(version[0] + "." + version[1]); + this.setEnabled(false); + return; + } + config = new Config(this); lang = new Language(this); @@ -67,7 +81,7 @@ public void onEnable() { (new ItemsCollector(this)).runTaskTimer(this, config.getFullInvCheckInterval(), config.getFullInvCheckInterval()); } - + BackpackTitle = config.getBPTitle(); Message_InvalidBackpack = lang.getTranslated("Ingame.InvalidBackpack"); getServer().getServicesManager().register(MinePacks.class, this, this, ServicePriority.Normal); @@ -85,7 +99,22 @@ public void onDisable() } log.info(lang.get("Console.Disabled")); } - + + public void warnOnVersionIncompatibility(String version) + { + log.warning(ChatColor.RED + "################################"); + log.warning(ChatColor.RED + String.format(MinePacks.getInstance().lang.getTranslated("Console.MinecraftVersionNotCompatible"), version)); + log.warning(ChatColor.RED + "################################"); + try + { + Thread.sleep(5000L); + } + catch(InterruptedException e) + { + e.printStackTrace(); + } + } + public void openBackpack(final Player opener, OfflinePlayer owner, final boolean editable) { if(owner == null) @@ -104,7 +133,7 @@ public void onResult(Backpack backpack) public void onFail() {} }); } - + public void openBackpack(Player opener, Backpack backpack, boolean editable) { if(backpack == null) @@ -114,7 +143,7 @@ public void openBackpack(Player opener, Backpack backpack, boolean editable) } backpack.open(opener, editable); } - + public int getBackpackPermSize(Player player) { for(int i = 9; i > 1; i--)