mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-22 21:41:23 +01:00
Add warning and stop startup when plugin is used with a minecraft version that has not been tested yet (I hope this reduce confusion on the next major minecraft update)
This commit is contained in:
parent
900d106a7c
commit
4228867c1c
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>MinePacks</artifactId>
|
||||
<version>1.15</version>
|
||||
<version>1.16-SNAPSHOT</version>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection>
|
||||
|
@ -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
|
||||
Version: 4
|
@ -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
|
||||
Version: 4
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<Player, Long> 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--)
|
||||
|
Loading…
Reference in New Issue
Block a user