#api problem

131 messages · Page 1 of 1 (latest)

fresh void
#
Caused by: java.lang.NullPointerException: Cannot invoke "nl.mtvehicles.core.Main.getDataFolder()" because "nl.mtvehicles.core.Main.instance" is null                                                                                    at nl.mtvehicles.core.infrastructure.dataconfig.MessagesConfig.saveLanguageFile(MessagesConfig.java:112) ~[DragonMainCore.jar:?]                                                                                                 at nl.mtvehicles.core.infrastructure.dataconfig.MessagesConfig.<init>(MessagesConfig.java:29) ~[DragonMainCore.jar:?]                                                                                                            at nl.mtvehicles.core.infrastructure.modules.ConfigModule.<clinit>(ConfigModule.java:35) ~[DragonMainCore.jar:?]        at nl.mtvehicles.core.infrastructure.vehicle.VehicleUtils.createAndGetItemByUUID(VehicleUtils.java:200) ~[DragonMainCore.jar:?]
#
package me.barsam.dragonMainCore

import nl.mtvehicles.core.infrastructure.modules.ConfigModule
import nl.mtvehicles.core.infrastructure.vehicle.VehicleUtils
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.bukkit.plugin.java.JavaPlugin

class DragonMainCore : JavaPlugin() {

    override fun onEnable() {
        // Register commands
        getCommand("spawnit")?.setExecutor(this)
    }

    override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<String>): Boolean {
        if (sender !is Player) {
            sender.sendMessage("Only players can execute this command.")
            return true
        }

        val player = sender

        if (command.name.equals("spawnit", ignoreCase = true)) {
            try {
                // Create a vehicle item using VehicleUtils
                val car = VehicleUtils.createAndGetItemByUUID(player, "C4UQZJ")
                player.inventory.addItem(car)
            } catch (e: Exception) {
                player.sendMessage("Failed to spawn the vehicle: ${e.message}")
                e.printStackTrace()
            }
            return true
        }
        return false
    }

    override fun onDisable() {
        // Plugin shutdown logic
    }
}
#

idk whats happenin in api!

azure shadow
#

Did you use #1256563966759407626 or newest file on Spigot?

azure shadow
#

@fresh void

fresh void
#

asdasdasd

#

omggg

#

my bad sorry

#

wait ima look at it

fresh void
#

can you tell me which one should i use?

#

ima test them all but like if u know the main bug its from

#

ok now theres no VehicleUtils?

#

sademoji \

azure shadow
fresh void
#

theres no VehicleUtils

#

:(

fresh void
# azure shadow Wait, what
     <dependency>
            <groupId>nl.mtvehicles</groupId>
            <artifactId>core</artifactId>
            <version>2.5.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/MTVehicles.jar</systemPath>
        </dependency>
#

am i doing something wrong?

#

WWAAAIT

#

YOU ADDED A REPOSITORY?

#

FR?

#

WHEN

azure shadow
fresh void
#

lemee check it out

fresh void
#
package me.barsam.dragonMainCore

import nl.mtvehicles.core.infrastructure.modules.ConfigModule
import nl.mtvehicles.core.infrastructure.vehicle.VehicleUtils
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.bukkit.plugin.java.JavaPlugin

class DragonMainCore : JavaPlugin() {

    override fun onEnable() {
        // Register commands
        getCommand("spawnit")?.setExecutor(this)
    }

    override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<String>): Boolean {
        if (sender !is Player) {
            sender.sendMessage("Only players can execute this command.")
            return true
        }

        val player = sender

        if (command.name.equals("spawnit", ignoreCase = true)) {
            try {
                // Create a vehicle item using VehicleUtils
                val car = VehicleUtils.createAndGetItemByUUID(player, "C4UQZJ")
                player.inventory.addItem(car)
            } catch (e: Exception) {
                player.sendMessage("Failed to spawn the vehicle: ${e.message}")
                e.printStackTrace()
            }
            return true
        }
        return false
    }

    override fun onDisable() {
        // Plugin shutdown logic
    }
}
#
        <dependency>
            <groupId>nl.mtvehicles.core</groupId>
            <artifactId>MTVehicles</artifactId>
            <version>2.5.5</version>
        </dependency>
#
        <repository>
            <id>gomorrha-repo</id>
            <url>https://repo.repsy.io/mvn/gomorrha/mtvehicles/</url>
        </repository>
#

any ideas? @azure shadow

azure shadow
#

Did you add MTV as a dependency in plugin.yml?

fresh void
#

depend:

  • MTVehicles
#
depend:
  - MTVehicles
azure shadow
#

Weird, i dont know how but you managed to access Mtv before It loads correctly

fresh void
#

WT

#

so what should i do

#

like should do something to like wait 30 seconds then register everything?

azure shadow
#

Can you use the newest file from #1256563966759407626 without any errors (Not the api just normal spawning of the vehicle)

fresh void
#

yes i can

#

i test it earlier

fresh void
#

im using java 17

azure shadow
#

Could you send me your server startup log?

fresh void
#

i did change it and nothing happens

fresh void
azure shadow
#

And could I have your plugin .jar?

fresh void
#

wait

fresh void
azure shadow
#

I should have the problem solved by tomorrow.

fresh void
azure shadow
#

Okey the good thing is, it works now

#

The bad thing is, for whatever reason it doesnt work with Kotlin (and that doesnt make any sense)

#

Java MainClass:

#

package dev.gomorrha.mtvspawncar;

import nl.mtvehicles.core.infrastructure.vehicle.VehicleUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public class Mtvspawncar extends JavaPlugin implements CommandExecutor {

@Override
public void onEnable() {
    // Register commands
    if (getCommand("spawnit") != null) {
        getCommand("spawnit").setExecutor(this);
    }

    // Check if MTVehicles is enabled, otherwise disable this plugin
    if (!getServer().getPluginManager().isPluginEnabled("MTVehicles")) {
        getServer().getPluginManager().disablePlugin(this);
    }
}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage("Only players can execute this command.");
        return true;
    }

    Player player = (Player) sender;

    if (command.getName().equalsIgnoreCase("spawnit")) {
        try {
            // Create a vehicle item using VehicleUtils
            // Replace "C4UQZJ" with your vehicle UUID or ID
            ItemStack car = VehicleUtils.createAndGetItemByUUID(player, "C4UQZJ");
            player.getInventory().addItem(car);
        } catch (Exception e) {
            player.sendMessage("Failed to spawn the vehicle: " + e.getMessage());
            e.printStackTrace();
        }
        return true;
    }
    return false;
}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}

#

Plugin.yml:

#

name: mtvspawncar
version: '1.0-SNAPSHOT'
main: dev.gomorrha.mtvspawncar.Mtvspawncar
api-version: '1.21'
depends: [MTVehicles]
commands:
spawnit:
usage: "/spawnit"
description: Spawn a vehicle

#

@fresh void

fresh void
#

thanks buddy

#

let me try it out

#

again, thanks for the support really fast <3

#

WTF why its giving a error from model engine ? :|

#

@azure shadow

azure shadow
fresh void
#

cause its a raw test server

#

only has the mtv and the garage [you gave me]

azure shadow
#

It calls methods that i deleted

#

Like months ago

#

weird

fresh void
#

omg

#

whats the current version?

#

the repository one

azure shadow
#

2.5.5

fresh void
#

im using that

#

idk why its doing this

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.barsam</groupId>
    <artifactId>DragonGarageCore</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>DragonGarageCore</name>

    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>papermc-repo</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>gomorrha-repo</id>
            <url>https://repo.repsy.io/mvn/gomorrha/mtvehicles/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>nl.mtvehicles.core</groupId>
            <artifactId>MTVehicles</artifactId>
            <version>2.5.5</version>
        </dependency>
    </dependencies>
</project>

#
package me.barsam.dragonGarageCore;

import nl.mtvehicles.core.infrastructure.vehicle.VehicleUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public class DragonGarageCore extends JavaPlugin implements CommandExecutor {

    @Override
    public void onEnable() {
        // Register commands
        if (getCommand("spawnit") != null) {
            getCommand("spawnit").setExecutor(this);
        }

        // Check if MTVehicles is enabled, otherwise disable this plugin
        if (!getServer().getPluginManager().isPluginEnabled("MTVehicles")) {
            getServer().getPluginManager().disablePlugin(this);
        }
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can execute this command.");
            return true;
        }

        Player player = (Player) sender;

        if (command.getName().equalsIgnoreCase("spawnit")) {
            try {
                // Create a vehicle item using VehicleUtils
                // Replace "C4UQZJ" with your vehicle UUID or ID
                ItemStack car = VehicleUtils.createAndGetItemByUUID(player, "C4UQZJ");
                player.getInventory().addItem(car);
            } catch (Exception e) {
                player.sendMessage("Failed to spawn the vehicle: " + e.getMessage());
                e.printStackTrace();
            }
            return true;
        }
        return false;
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
#

@azure shadow

azure shadow
#

Do you have modelEngine intsalled?

fresh void
#

should i?

azure shadow
#

Nope

fresh void
#

k

#

im cursed i guess

azure shadow
fresh void
#

asdasd

#

i fixed it

#

some how

#

idk how

#

but i did

#

thanks allot @azure shadow <3

fresh void
#

hello quick question how could i show the cars as a preview?
like i dont want the car to have a owner i just want to spawn it to show it to other people...
@azure shadow ||sorry for the mention||

azure shadow
fresh void
#

and it takes allot of spaces?

azure shadow
#

How many of these Preview Vehicles do you want to spawn?

#

One vehicle takes 494bytes of space

fresh void
#

players will go into a spec mode

#

then we spawn the car infront of the player

#

likely showing the player a preview which they can do next and etc

#

so it takes allot of spawn per shop

#

roughly 2000 in a day :(

#

if i said roughly right

azure shadow
#

But you delete the vehicles afterwards!?

#

And why not spawn them all once and then teleport the player?

fresh void
#

your right but idk like

#

yeah youre right

#

ohhh i know why

#

cause i delete all the cars every 30 minutes

#

and when server shuts down

#

that was why

fresh void
azure shadow
fresh void
fresh void