Throw meaningful warnings when wrong Essentials version is used with unsupported mod packs.

This commit is contained in:
KHobbits 2013-11-15 00:22:10 +00:00
parent 82be7546d5
commit 53b1526906
3 changed files with 34 additions and 11 deletions

View File

@ -158,10 +158,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
final int versionNumber = Integer.parseInt(versionMatch.group(1));
if (versionNumber < BUKKIT_VERSION && versionNumber > 100)
{
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
wrongVersion();
this.setEnabled(false);
return;
}
@ -570,6 +567,14 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
}
}
static public void wrongVersion()
{
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
LOGGER.log(Level.SEVERE, " * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! * ! *");
}
@Override
public BukkitScheduler getScheduler()
{

View File

@ -100,14 +100,22 @@ public class Potions
POTIONS.put("wither", PotionEffectType.WITHER);
ALIASPOTIONS.put("decay", PotionEffectType.WITHER);
POTIONS.put("healthboost", PotionEffectType.HEALTH_BOOST);
ALIASPOTIONS.put("boost", PotionEffectType.HEALTH_BOOST);
POTIONS.put("absorption", PotionEffectType.ABSORPTION);
ALIASPOTIONS.put("absorb", PotionEffectType.ABSORPTION);
try // 1.6 update
{
POTIONS.put("healthboost", PotionEffectType.HEALTH_BOOST);
ALIASPOTIONS.put("boost", PotionEffectType.HEALTH_BOOST);
POTIONS.put("saturation", PotionEffectType.SATURATION);
ALIASPOTIONS.put("food", PotionEffectType.SATURATION);
POTIONS.put("absorption", PotionEffectType.ABSORPTION);
ALIASPOTIONS.put("absorb", PotionEffectType.ABSORPTION);
POTIONS.put("saturation", PotionEffectType.SATURATION);
ALIASPOTIONS.put("food", PotionEffectType.SATURATION);
}
catch (java.lang.NoSuchFieldError e)
{
Essentials.wrongVersion();
}
}
public static PotionEffectType getByName(String name)

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.utils;
import com.earth2me.essentials.Essentials;
import static com.earth2me.essentials.I18n._;
import java.util.ArrayList;
import java.util.Collections;
@ -60,7 +61,15 @@ public class LocationUtil
HOLLOW_MATERIALS.add(Material.FENCE_GATE.getId());
HOLLOW_MATERIALS.add(Material.WATER_LILY.getId());
HOLLOW_MATERIALS.add(Material.NETHER_WARTS.getId());
HOLLOW_MATERIALS.add(Material.CARPET.getId());
try // 1.6 update
{
HOLLOW_MATERIALS.add(Material.CARPET.getId());
}
catch (java.lang.NoSuchFieldError e)
{
Essentials.wrongVersion();
}
for (Integer integer : HOLLOW_MATERIALS)
{
@ -160,6 +169,7 @@ public class LocationUtil
public int x;
public int y;
public int z;
public Vector3D(int x, int y, int z)
{
this.x = x;