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:
		@@ -41,6 +41,7 @@ import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.concurrent.ExecutionException;
 | 
			
		||||
import java.util.concurrent.Future;
 | 
			
		||||
import java.util.function.Consumer;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.bukkit.command.Command;
 | 
			
		||||
@@ -364,13 +365,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
 | 
			
		||||
            this.setCommandExecutor("anycontainer", settingCommand);
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            this.getLogger().info("Your version of CraftBukkit (" + this.accessor.getVersion() + ") is not supported.");
 | 
			
		||||
            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.");
 | 
			
		||||
            this.sendVersionError(this.getLogger()::warning);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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) {
 | 
			
		||||
        PluginCommand command = this.getCommand(commandName);
 | 
			
		||||
        if (command != null) {
 | 
			
		||||
@@ -381,8 +385,7 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
 | 
			
		||||
        if (!this.accessor.isSupported()) {
 | 
			
		||||
            sender.sendMessage("Your server version (" + this.accessor.getVersion() + ") is not supported.");
 | 
			
		||||
            sender.sendMessage("Please check https://github.com/lishid/OpenInv/releases for an update.");
 | 
			
		||||
            this.sendVersionError(sender::sendMessage);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,45 @@ public class InternalAccessor {
 | 
			
		||||
        } 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,
 | 
			
		||||
            final Object... params) throws ClassCastException, ClassNotFoundException,
 | 
			
		||||
            InstantiationException, IllegalAccessException, IllegalArgumentException,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user