mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-06-28 08:50:57 +00:00
Add several version warning messages
This commit is contained in:
parent
4011810536
commit
35a2a4d803
|
@ -172,6 +172,10 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||||
|
|
||||||
Console.setInstance(this);
|
Console.setInstance(this);
|
||||||
|
|
||||||
|
if (!VersionUtil.isServerSupported()) {
|
||||||
|
getLogger().severe(tl("serverUnsupported"));
|
||||||
|
}
|
||||||
|
|
||||||
final PluginManager pm = getServer().getPluginManager();
|
final PluginManager pm = getServer().getPluginManager();
|
||||||
for (Plugin plugin : pm.getPlugins()) {
|
for (Plugin plugin : pm.getPlugins()) {
|
||||||
if (plugin.getDescription().getName().startsWith("Essentials") && !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()) && !plugin.getDescription().getName().equals("EssentialsAntiCheat")) {
|
if (plugin.getDescription().getName().startsWith("Essentials") && !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()) && !plugin.getDescription().getName().equals("EssentialsAntiCheat")) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.earth2me.essentials.metrics.Metrics;
|
||||||
import com.earth2me.essentials.utils.DateUtil;
|
import com.earth2me.essentials.utils.DateUtil;
|
||||||
import com.earth2me.essentials.utils.FloatUtil;
|
import com.earth2me.essentials.utils.FloatUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
|
import com.earth2me.essentials.utils.VersionUtil;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -36,7 +37,22 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
private final List<String> versionPlugins = Arrays.asList(
|
private final List<String> versionPlugins = Arrays.asList(
|
||||||
"Vault",
|
"Vault",
|
||||||
"LuckPerms",
|
"LuckPerms",
|
||||||
"PermissionsEx"
|
"PermissionsEx",
|
||||||
|
"GroupManager"
|
||||||
|
);
|
||||||
|
|
||||||
|
private final List<String> officialPlugins = Arrays.asList(
|
||||||
|
"EssentialsAntiBuild",
|
||||||
|
"EssentialsChat",
|
||||||
|
"EssentialsGeoIP",
|
||||||
|
"EssentialsProtect",
|
||||||
|
"EssentialsSpawn",
|
||||||
|
"EssentialsXMPP"
|
||||||
|
);
|
||||||
|
|
||||||
|
private final List<String> warnPlugins = Arrays.asList(
|
||||||
|
"PermissionsEx",
|
||||||
|
"GroupManager"
|
||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -318,11 +334,13 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
|
|
||||||
boolean isMismatched = false;
|
boolean isMismatched = false;
|
||||||
boolean isVaultInstalled = false;
|
boolean isVaultInstalled = false;
|
||||||
|
boolean isUnsupported = false;
|
||||||
|
final boolean isServerSupported = VersionUtil.isServerSupported();
|
||||||
final PluginManager pm = server.getPluginManager();
|
final PluginManager pm = server.getPluginManager();
|
||||||
final String essVer = pm.getPlugin("Essentials").getDescription().getVersion();
|
final String essVer = pm.getPlugin("Essentials").getDescription().getVersion();
|
||||||
|
|
||||||
sender.sendMessage("Server version: " + server.getBukkitVersion() + " " + server.getVersion());
|
sender.sendMessage(tl(isServerSupported ? "versionOutputFine" : "versionOutputWarn", "Server", server.getBukkitVersion() + " " + server.getVersion()));
|
||||||
sender.sendMessage("EssentialsX version: " + essVer);
|
sender.sendMessage(tl("versionOutputFine", "EssentialsX", essVer));
|
||||||
|
|
||||||
for (Plugin plugin : pm.getPlugins()) {
|
for (Plugin plugin : pm.getPlugins()) {
|
||||||
final PluginDescriptionFile desc = plugin.getDescription();
|
final PluginDescriptionFile desc = plugin.getDescription();
|
||||||
|
@ -330,15 +348,28 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
String version = desc.getVersion();
|
String version = desc.getVersion();
|
||||||
|
|
||||||
if (name.startsWith("Essentials") && !name.equalsIgnoreCase("Essentials")) {
|
if (name.startsWith("Essentials") && !name.equalsIgnoreCase("Essentials")) {
|
||||||
if (!version.equalsIgnoreCase(essVer)) {
|
if (officialPlugins.contains(name)) {
|
||||||
version = "\u00a7c" + version;
|
name = name.replace("Essentials", "EssentialsX");
|
||||||
isMismatched = true;
|
|
||||||
|
if (!version.equalsIgnoreCase(essVer)) {
|
||||||
|
isMismatched = true;
|
||||||
|
sender.sendMessage(tl("versionOutputWarn", name, version));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(tl("versionOutputFine", name, version));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(tl("versionOutputUnsupported", name, version));
|
||||||
|
isUnsupported = true;
|
||||||
}
|
}
|
||||||
sender.sendMessage(name.replace("Essentials", "EssentialsX") + " version: " + version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (versionPlugins.contains(name)) {
|
if (versionPlugins.contains(name)) {
|
||||||
sender.sendMessage(name + " version: " + version);
|
if (warnPlugins.contains(name)) {
|
||||||
|
sender.sendMessage(tl("versionOutputUnsupported", name, version));
|
||||||
|
isUnsupported = true;
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(tl("versionOutputFine", name, version));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.equals("Vault")) isVaultInstalled = true;
|
if (name.equals("Vault")) isVaultInstalled = true;
|
||||||
|
@ -349,7 +380,15 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isVaultInstalled) {
|
if (!isVaultInstalled) {
|
||||||
sender.sendMessage("Vault is not installed - chat and permissions may not work.");
|
sender.sendMessage(tl("versionOutputVaultMissing"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isUnsupported) {
|
||||||
|
sender.sendMessage(tl("versionOutputUnsupportedPlugins"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!VersionUtil.isServerSupported()) {
|
||||||
|
sender.sendMessage(tl("serverUnsupported"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
//1.13.1-R0.1-SNAPSHOT
|
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
public static final BukkitVersion v1_8_8_R01 = BukkitVersion.fromString("1.8.8-R0.1-SNAPSHOT");
|
public static final BukkitVersion v1_8_8_R01 = BukkitVersion.fromString("1.8.8-R0.1-SNAPSHOT");
|
||||||
|
@ -22,11 +21,11 @@ public class VersionUtil {
|
||||||
|
|
||||||
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01);
|
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01);
|
||||||
|
|
||||||
public static final BukkitVersion getServerBukkitVersion() {
|
public static BukkitVersion getServerBukkitVersion() {
|
||||||
return BukkitVersion.fromString(Bukkit.getServer().getBukkitVersion());
|
return BukkitVersion.fromString(Bukkit.getServer().getBukkitVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final boolean isServerSupported() {
|
public static boolean isServerSupported() {
|
||||||
return supportedVersions.contains(getServerBukkitVersion());
|
return supportedVersions.contains(getServerBukkitVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ public class VersionUtil {
|
||||||
if (!Bukkit.getName().equals("Essentials Fake Server")) {
|
if (!Bukkit.getName().equals("Essentials Fake Server")) {
|
||||||
throw new IllegalArgumentException(string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
throw new IllegalArgumentException(string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||||
}
|
}
|
||||||
matcher = VERSION_PATTERN.matcher(v1_8_8_R01.toString());
|
matcher = VERSION_PATTERN.matcher(v1_13_2_R01.toString());
|
||||||
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||||
}
|
}
|
||||||
return new BukkitVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)), Double.parseDouble(matcher.group(4)));
|
return new BukkitVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)), Double.parseDouble(matcher.group(4)));
|
||||||
|
|
|
@ -467,6 +467,7 @@ sellBulkPermission=\u00a76You do not have permission to bulk sell.
|
||||||
sellHandPermission=\u00a76You do not have permission to hand sell.
|
sellHandPermission=\u00a76You do not have permission to hand sell.
|
||||||
serverFull=Server is full\!
|
serverFull=Server is full\!
|
||||||
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
||||||
|
serverUnsupported=\u00a7cYou are running an unsupported server version!
|
||||||
setBal=\u00a7aYour balance was set to {0}.
|
setBal=\u00a7aYour balance was set to {0}.
|
||||||
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
||||||
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
||||||
|
@ -569,6 +570,11 @@ userUnknown=\u00a74Warning\: The user ''\u00a7c{0}\u00a74'' has never joined thi
|
||||||
usingTempFolderForTesting=Using temp folder for testing\:
|
usingTempFolderForTesting=Using temp folder for testing\:
|
||||||
vanish=\u00a76Vanish for {0}\u00a76\: {1}
|
vanish=\u00a76Vanish for {0}\u00a76\: {1}
|
||||||
vanished=\u00a76You are now completely invisible to normal users, and hidden from in-game commands.
|
vanished=\u00a76You are now completely invisible to normal users, and hidden from in-game commands.
|
||||||
|
versionOutputVaultMissing=\u00a74Vault is not installed. Chat and permissions may not work.
|
||||||
|
versionOutputFine=\u00a76{0} version: \u00a7a{1}
|
||||||
|
versionOutputWarn=\u00a76{0} version: \u00a7c{1}
|
||||||
|
versionOutputUnsupported=\u00a7d{0} \u00a76version: \u00a7d{1}
|
||||||
|
versionOutputUnsupportedPlugins=\u00a76You are running \u00a7dunsupported plugins\u00a76!
|
||||||
versionMismatch=\u00a74Version mismatch\! Please update {0} to the same version.
|
versionMismatch=\u00a74Version mismatch\! Please update {0} to the same version.
|
||||||
versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version.
|
versionMismatchAll=\u00a74Version mismatch\! Please update all Essentials jars to the same version.
|
||||||
voiceSilenced=\u00a76Your voice has been silenced\!
|
voiceSilenced=\u00a76Your voice has been silenced\!
|
||||||
|
|
|
@ -467,6 +467,7 @@ sellBulkPermission=\u00a76You do not have permission to bulk sell.
|
||||||
sellHandPermission=\u00a76You do not have permission to hand sell.
|
sellHandPermission=\u00a76You do not have permission to hand sell.
|
||||||
serverFull=Server is full\!
|
serverFull=Server is full\!
|
||||||
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
||||||
|
serverUnsupported=\u00a76You are running an \u00a74unsupported server version\u00a76.
|
||||||
setBal=\u00a7aYour balance was set to {0}.
|
setBal=\u00a7aYour balance was set to {0}.
|
||||||
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
||||||
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
||||||
|
|
Loading…
Reference in a new issue