mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Clarify download locations for older versions
Hopefully this will help people figure out where they've gone wrong. Maybe I should be stating supported versions in release notes too.
This commit is contained in:
parent
9705cb156b
commit
f45d332727
2 changed files with 47 additions and 5 deletions
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -364,13 +365,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
|
||||||
this.setCommandExecutor("anycontainer", settingCommand);
|
this.setCommandExecutor("anycontainer", settingCommand);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.getLogger().info("Your version of CraftBukkit (" + this.accessor.getVersion() + ") is not supported.");
|
this.sendVersionError(this.getLogger()::warning);
|
||||||
this.getLogger().info("If this version is a recent release, check for an update.");
|
|
||||||
this.getLogger().info("If this is an older version, ensure that you've downloaded the legacy support version.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendVersionError(Consumer<String> messageMethod) {
|
||||||
|
messageMethod.accept("Your server version (" + this.accessor.getVersion() + ") is not supported.");
|
||||||
|
messageMethod.accept("Please obtain an appropriate version here: " + accessor.getReleasesLink());
|
||||||
|
}
|
||||||
|
|
||||||
private void setCommandExecutor(String commandName, CommandExecutor executor) {
|
private void setCommandExecutor(String commandName, CommandExecutor executor) {
|
||||||
PluginCommand command = this.getCommand(commandName);
|
PluginCommand command = this.getCommand(commandName);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
|
@ -381,8 +385,7 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!this.accessor.isSupported()) {
|
if (!this.accessor.isSupported()) {
|
||||||
sender.sendMessage("Your server version (" + this.accessor.getVersion() + ") is not supported.");
|
this.sendVersionError(sender::sendMessage);
|
||||||
sender.sendMessage("Please check https://github.com/lishid/OpenInv/releases for an update.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -48,6 +48,45 @@ public class InternalAccessor {
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReleasesLink() {
|
||||||
|
switch (version) {
|
||||||
|
case "1_4_5":
|
||||||
|
case "1_4_6":
|
||||||
|
case "v1_4_R1":
|
||||||
|
case "v1_5_R2":
|
||||||
|
case "v1_5_R3":
|
||||||
|
case "v1_6_R1":
|
||||||
|
case "v1_6_R2":
|
||||||
|
case "v1_6_R3":
|
||||||
|
case "v1_7_R1":
|
||||||
|
case "v1_7_R2":
|
||||||
|
case "v1_7_R3":
|
||||||
|
case "v1_7_R4":
|
||||||
|
case "v1_8_R1":
|
||||||
|
case "v1_8_R2":
|
||||||
|
case "v1_9_R1":
|
||||||
|
case "v1_9_R2":
|
||||||
|
case "v1_10_R1":
|
||||||
|
case "v1_11_R1":
|
||||||
|
case "v1_12_R1":
|
||||||
|
return "https://github.com/lishid/OpenInv/releases/tag/4.0.0 (OpenInv-legacy)";
|
||||||
|
case "v1_13_R1":
|
||||||
|
return "https://github.com/lishid/OpenInv/releases/tag/4.0.0";
|
||||||
|
case "v1_13_R2":
|
||||||
|
return "https://github.com/lishid/OpenInv/releases/tag/4.0.7";
|
||||||
|
case "v1_14_R1":
|
||||||
|
return "https://github.com/lishid/OpenInv/releases/tag/4.1.1";
|
||||||
|
case "v1_16_R1":
|
||||||
|
return "https://github.com/lishid/OpenInv/releases/tag/4.1.4";
|
||||||
|
case "v1_8_R3":
|
||||||
|
case "v1_15_R1":
|
||||||
|
case "v1_16_R2":
|
||||||
|
case "v1_16_R3":
|
||||||
|
default:
|
||||||
|
return "https://github.com/lishid/OpenInv/releases";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> T createObject(final Class<? extends T> assignableClass, final String className,
|
private <T> T createObject(final Class<? extends T> assignableClass, final String className,
|
||||||
final Object... params) throws ClassCastException, ClassNotFoundException,
|
final Object... params) throws ClassCastException, ClassNotFoundException,
|
||||||
InstantiationException, IllegalAccessException, IllegalArgumentException,
|
InstantiationException, IllegalAccessException, IllegalArgumentException,
|
||||||
|
|
Loading…
Reference in a new issue