Jump to content
  • 0

Java script help


Cay2

Question

Hey im not sure if i should be asking on here but my java script isnt working idk if its minehuts problem or my side

 

my yml 

name: SkibidiPlugin
version: 1.0
main: com.example.skibidi.Skibidi
description: My Paper Plugin
api-version: "1.20.4"

my java script code
 
    package com.example.skibidi;
 
    public class Skibidi {
    var Bukkit = org.bukkit.Bukkit;
    var Material = org.bukkit.Material;
    var InventoryType = org.bukkit.event.inventory.InventoryType;
 
    function onPlayerInteract(event) {
        var player = event.getPlayer();
        var action = event.getAction();
        var itemInHand = player.getInventory().getItemInMainHand(); // Use getItemInMainHand for Paper
 
        if (action === org.bukkit.event.block.Action.RIGHT_CLICK_AIR || action === org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
            // Check if the player is holding a chest
            if (itemInHand.getType() === Material.CHEST) {
                // Open a chest inventory
                var chestInventory = Bukkit.createInventory(player, InventoryType.CHEST);
                player.openInventory(chestInventory);
 
                // Cancel the event to prevent default chest interaction
                event.setCancelled(true);
            }
        }
    }
 
    // Register the event listener
    events.on('player.PlayerInteractEvent', onPlayerInteract);
    }

And i get this error
 
 
[02:45:19 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'Skibidi.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.20.4
	at org.bukkit.craftbukkit.v1_20_R3.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:384) ~[paper-1.20.4.jar:git-Paper-336]
	at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:119) ~[paper-1.20.4.jar:git-Paper-336]
	at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.20.4.jar:git-Paper-336]
	at io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy.loadProviders(ModernPluginLoadingStrategy.java:116) ~[paper-1.20.4.jar:git-Paper-336]
	at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:38) ~[paper-1.20.4.jar:git-Paper-336]
	at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[paper-1.20.4.jar:git-Paper-336]
	at org.bukkit.craftbukkit.v1_20_R3.CraftServer.loadPlugins(CraftServer.java:505) ~[paper-1.20.4.jar:git-Paper-336]
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.20.4.jar:git-Paper-336]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1132) ~[paper-1.20.4.jar:git-Paper-336]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[paper-1.20.4.jar:git-Paper-336]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]


And thats my error idk why the text is red and all that  sorry if this is hard to read
  • Like 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Change the API version to "1.20", I don't believe API versions work for things like "1.20.4" or "1.19.2", but just the release version "1.20", "1.18", "1.19", etc.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

  • 0
7 hours ago, rosabel said:

Change the API version to "1.20", I don't believe API versions work for things like "1.20.4" or "1.19.2", but just the release version "1.20", "1.18", "1.19", etc.

That didn't work so i changed the api version here
and i cant make the paper version 1.20 so i did 1.9 

im using vscode no maven
 

name: SkibidiPlugin
version: 1.0
main: com.example.skibidi.Skibidi
description: My Paper Plugin
api-version: 1.20
Edited by Cay2
  • Like 1
Link to comment
Share on other sites

  • 0
On 1/31/2024 at 10:10 AM, Cay2 said:

That didn't work so i changed the api version here
and i cant make the paper version 1.20 so i did 1.9 

im using vscode no maven
 

name: SkibidiPlugin
version: 1.0
main: com.example.skibidi.Skibidi
description: My Paper Plugin
api-version: 1.20


I'm sorry, my experience with Javascript and Visual Studio Code is limited.

Is it still giving you an unsupported APIversion error? Also, maybe put your API-version in quotes like "1.20" ? I am not quite sure if that's how you do it combined with all the previous things, but the requirements for a plugin.yml file should be universal.

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...