#help-development

1 messages · Page 804 of 1

rough drift
#

np

#

Though next time just google Get a list of all running threads java

rotund ravine
shadow zinc
#

yeah

rough drift
#

it doesn't matter

#

Spigot is still Java

shadow zinc
#

thats what i was saying

rough drift
#

so why would you need to add for spigot

shadow zinc
#

¯_(ツ)_/¯

rough drift
#

you can, if you want the compiler can keep the actual names

twin venture
#

hi , uhhh for some rason the Win Dance is running the wrong one

#

not the one that in the user data

glossy venture
#

do i have to do anything to update the bukkit inventory?

#

its not setting the updated items

lost matrix
glossy venture
#

weird

eternal oxide
#

hard to tell as no code

glossy venture
#
public interface InventoryWindow {

    static InventoryWindow wrap(Inventory inventory) {
        return new InventoryWindow() {
            // ...

            @Override
            public InventoryWindow setItem(int slotIndex, ItemStack stack) {
                System.out.println("set slot(" + slotIndex + "): " + stack + " in inventory: " + inventory);
                inventory.setItem(slotIndex, stack);
                return this;
            }
        };
    }
    // In InventoryButton

    @Override
    protected void render(InventoryWindow window) {
        if (constantStack != null) {
            window.fill(constantStack);
#

the rest is just calculating slots and propagating calls

#

but it eventually reaches the method above

#

in the wrapped inventory

#

with the correct slot

eternal oxide
#

then no, it looks fine so long as your stacks/meta are good

glossy venture
#

weird

lost matrix
# glossy venture weird

Are you sure you ware calling this wrap method on the same inventory?
PS: What you are doing is very, very weird.

glossy venture
#

that field is reused by everything

lost matrix
#

What are you mapping the InventoryGUI to?

glossy venture
#

wdym?

lost matrix
#

@glossy venture

#

How do you store instances of InventoryGUI

glossy venture
#

each player has a PlayerGUIState which contains info about the current GUI and properties of the online player which also holds the current open GUI which is in this case the InventoryGUI

#

thsoe objects are just in a weak hash map by player instance

#

its calling setItem on the same inventory

#

looking at the identity hash code in the debug statements

#

so idk why it doesnt work

lost matrix
#

Force an inventory update

glossy venture
#

yeah thats what im trying to do now but idk how

#

theres no update() method on the view or the inventory itself

eternal oxide
#

Player#updateInventory()

glossy venture
#

oh k

lost matrix
#

I never needed this for guis...
What version are you on?

glossy venture
#

1.8.8

#

lol

lost matrix
#

-.-

glossy venture
#

but its just using api so idk

lost matrix
#

Yeah but 1.8 has a ton of weird behaviors and bugs which will never be resolved.
Regardless of the API.

glossy venture
#

true ig

#

i wouldve used nms and done the updates all in one if nms wasnt complete aids in 1.8

#

i might just do it with protocollib at this point

#

updateInventory() doesnt do shit either

#

pretty easy to swap out the inventory impl

lost matrix
eternal oxide
#

and compare inventory hash of your inventory and the open inventory

glossy venture
#

i did

#

i confirmed it was setting the items in the same inventory at least

#

and the first page shows fine but it doesnt update

lost matrix
#

Is the second page a new inventory?

glossy venture
#

nah it replaces the existing items

#

at least thats what it should do

#
public static void printContentsCompact(Inventory inventory) {
    System.out.print("Inventory(" + inventory.getSize() + ")");
    System.out.println(Stream.of(inventory.getContents())
            .map(stack -> stack == null ? "none" : stack.getType().toString())
            .collect(Collectors.toList()));
}
[11:50:31 INFO]: inventory before click event call:
[11:50:31 INFO]: Inventory(27)
[11:50:31 INFO]: [WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, none, none, none, none, BARRIER, none, none, none, ARROW]
[11:50:31 INFO]: inventory after click event call:
[11:50:31 INFO]: Inventory(27)
[11:50:31 INFO]: [WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, WOOL, ARROW, none, none, none, BARRIER, none, none, none, ARROW]
lost matrix
#

And you checked, after updating your inventory. Not just when opening.

glossy venture
#

it set the arrow

#

as you can see

#
System.out.println("inventory before click event call:");
InventoryUtil.printContentsCompact(inventory);
onEvent(new ClickEvent(
        this,
        slot,
        slotX,
        slotY,

        event
));

player.updateInventory();
System.out.println("inventory after click event call:");
InventoryUtil.printContentsCompact(inventory);
twin venture
#

its being called ..

glossy venture
#

also the elements are registered n shit bc when i click the slot where the arrow should be it goes to the last page

#

still doesnt update but in code it does

eternal oxide
#

1.8 bug then

twin venture
#

i fixed the loading , my problem now its Running the wrong cosmetic !

glossy venture
lost matrix
glossy venture
#

k

twin venture
#

so this is how i have it in the database :

eternal oxide
#

call an openInventory after updating contents

glossy venture
#

ill try maybe reopening it

#

1 tick fater

#

after

twin venture
#

it send the correct cosmetic name that i selected but it run the wrong one :

glossy venture
#

resets the cursor tho

#

kinda sucks

#

ill try updateInventory a tick later

lost matrix
lost matrix
#

Or you mapped it wrong

twin venture
#

can this be the problem?

lost matrix
twin venture
twin venture
#

This is how iam getting it from mysql .

lost matrix
twin venture
#

and this is how iam loading it :

glossy venture
#

ill try with packets lol

twin venture
#

i checked the name of the field , its correct :

lost matrix
glossy venture
#

oh wait

lost matrix
twin venture
glossy venture
#

yeah i changed something and that broke it
i didnt record the first time i tested tho it didnt work either

#

some weird bug

twin venture
lost matrix
proud badge
#

does removing a plugin jar whilst the server is loaded cause any issues

#

I want to replace my jar with the updated build rn, so it automatically updates during the daily automatic restart

eternal oxide
#

always stop start

wet breach
eternal oxide
#

spigot/bukkit has an update feature

twin venture
#

i finally found the bug 🙂

eternal oxide
#

create an update folder and put your jar in there. It will be copied into plugins upon a restart

wet breach
#

Yeah if you create an updates directory any jars placed in there should cause the server to update the corresponding plugins automatically

young knoll
#

Jar name has to match iirc

#

I don’t think we have it done by plugin.yml name yet

quaint mantle
eternal oxide
#

Would need NMS then getEntityClass and get teh NMS version from there

#

EntityType#getEntity.Class().getHandle or something

#

after casting of course

lost matrix
#

There is probably a namespaced key in EntityType which can be used in some registry or sth

eternal oxide
#

it is keyed but thats probably only Bukkit names

lost matrix
#

🤷 would have to dig

eternal oxide
#

getting the CB class shoudl then have a Handle you can then get the MC type

young knoll
#

They should be the correct keys

rotund ravine
#

Almost a learnjava moment

#

How does ur plugin.yml look?

lost matrix
#

How do you ensure that the classes of Floodgate are on the server when it starts?

#

Did you try to build an artifact?

tribal quarry
#

Hey there, is it possible to listen for bungeecord handshakes in older versions without use of protocollib?

lost matrix
#

Because i dont understand your question.
But i interpolated the problem. (Probably)
You cant just build artifacts when using maven. You need to run maven
goals, which build the jar for your. Which IDE are you using?

lost matrix
#

Im just gonna guess that you mean IntelliJ. Also you are a suppliant (asking for help) and i find this condescending line of conversation out of place.
Anyways, go to your top right side. There should be a maven symbol. Click on it, and run the package lifecycle of maven.

molten hearth
#

did you follow this

lost matrix
molten hearth
#

oh lmao i thought he just added the jar to intellij without actually including it in maven

#

scroll to the bottom section

#
<repository>
    <id>opencollab-snapshot</id>
    <url>https://repo.opencollab.dev/main/</url>
</repository>```
#

well to be fair you might not want to use maven but still want your ide to know your dependency

#

bro speaks in ks

lost matrix
#

You should never manually add any dependency to your project if you want to use maven.
Only through your pom.xml

inner mulch
#

is there a way to fill a hashmap when creating it as a field?

lost matrix
#

Or with a builder

inner mulch
#

I've tried Map.of but i did it either wrong or it doesnt work because it was all red

lost matrix
inner mulch
#

i dont really know what mutable does

lost matrix
#

If a map is immutable, then you cant add/remove elements to/from it.

inner mulch
#

so immutable = unchangeable?

slender elbow
#

checkmate, atheists

lost matrix
#

-.-

lost matrix
lost matrix
lost matrix
# inner mulch so immutable = unchangeable?

In which case you could

  private final Map<String, UUID> someMap = ImmutableMap.<String, UUID>builder()
      .put("A", UUID.randomUUID())
      .put("B", UUID.randomUUID())
      .put("C", UUID.randomUUID())
      .build();
inner mulch
#

thanks

#

i will try it

rough drift
quaint mantle
minor junco
# inner mulch thanks

You can also just use
Map.of(...) to create an immutable map out of key and value pairs when you know your entries on map allocation

inner mulch
#

thank you :)

young knoll
quaint mantle
#

eh

#

🥴

#

i don't understand

solemn willow
#

how can i add a entity limit for an specifc entity in an specific dimension?

#

?paste

undone axleBOT
solemn willow
lost matrix
solemn willow
lost matrix
twin venture
#

hi question , should i regenerate the whole world?
for a minigame ?

#

or only regenerate (breaked blocks) , (placed blocks)?

solemn willow
lost matrix
lost matrix
solemn willow
lost matrix
quaint mantle
#

bro

lost matrix
# twin venture interesting

But keep in mind that you need to keep all chunks loaded while the game is running, or else the chunks might unload and load again, removing all changes.

solemn willow
#

bro, in my code if i place a nether brick they spawn a whiter skeleton but if i destroy the block they keep spawning, however with BukkitTask i can stop them from spawning on air

lost matrix
eternal oxide
solemn willow
eternal oxide
#

create the task in Place event and store teh block in a Map with the running task.

quaint mantle
lost matrix
eternal oxide
#

when the block is broken, fetch the task from the Map, cancel it and remove from map

quaint mantle
#

it would cancel spawning but the game then keeps looking for a new location to spawn

twin venture
#

thats how i think it shouls be used :p

lost matrix
# solemn willow but can i use it while im using BukkitTaskTimer?

First of all: Delete your BukkitTask variable.

            org.bukkit.scheduler.BukkitTask task = new org.bukkit.scheduler.BukkitRunnable() {

                @Override
                public void run() {
                    if (block.getType() == Material.NETHER_BRICKS) {
                        world.spawnEntity(block.getLocation().add(0, 1, 0), EntityType.WITHER_SKELETON);
                    } else {
                        this.cancel();
                        return;
                    }
                }
            }.runTaskTimer(this, 200l, 1600l);

->

            new BukkitRunnable() {
                @Override
                public void run() {
                    if (block.getType() == Material.NETHER_BRICKS) {
                        world.spawnEntity(block.getLocation().add(0, 1, 0), EntityType.WITHER_SKELETON);
                    } else {
                        this.cancel();
                        return;
                    }
                }
            }.runTaskTimer(this, 200l, 1600l);
lost matrix
solemn willow
lost matrix
solemn willow
#

but how tf

#

so i should count them?

lost matrix
#

Which part confuses you?

eternal oxide
solemn willow
eternal oxide
#

so if he breaks it and places again, he's got two tasks running

lost matrix
solemn willow
#

uhh

lost matrix
solemn willow
#

thats excatly i dont want

eternal oxide
#

a Map of tasks would be best canceling/removing on block break

lost matrix
#

Or in short

long witherSkeletons = block.getWorld().getLivingEntities().stream().filter(WitherSkeleton.class::isInstance).count();
twin venture
#

this does not work :L

lost matrix
#

Or use a different name for the loaded world.

twin venture
#

iam getting the name of the world from the arena instance

young knoll
#

We should make a CompleteableFuture for unloading

twin venture
#

ME?

young knoll
#

Noo

rotund ravine
young knoll
#

The spigot team™️

#

Depends how hard it is to make :p

rotund ravine
#

Lots of things happening sync in the world

lost matrix
young knoll
#

Yay deep

rotund ravine
#

That’s what she said

remote swallow
twin venture
#

hi , uhhh iam trying to unload the map -> load the backup -> but iget this error

#

its not the same world in server-proprties , i changed it to Lobby

solemn willow
#

how can i add an command to my code?
this is my code, if i try to add an command to my code it just wont work!

me.uwunugget.uwunugget_plugin;


import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.block.Block;

public class Uwunugget_plugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {

        getServer().getPluginManager().registerEvents(this, this);
    }


    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {
        Block block = event.getBlock();
        World world = block.getWorld();

        if (block.getType() == Material.NETHER_BRICKS && world.getEnvironment() == World.Environment.NETHER) {
            org.bukkit.scheduler.BukkitTask task = new org.bukkit.scheduler.BukkitRunnable() {

                @Override
                public void run() {
                    if (block.getType() == Material.NETHER_BRICKS) {
                        world.spawnEntity(block.getLocation().add(0, 1, 0), EntityType.WITHER_SKELETON);
                    } else {
                        this.cancel();
                        return;
                    }
                }
            }.runTaskTimer(this, 200l, 1600l);

        }
    }
}
twilit roost
#

provide your code with the command

upper hazel
#

how i can replace @s in command block command

#

when player write it

#

plugin

hazy parrot
#

Iirc there is some bukkit utility for it

twilit roost
#

are you making custom command with @s ?
or changing the cmd block

#

I think Bukkit#getPlayerTarget or sumthing like that works for the first one

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

upper hazel
#

replace @s to nick name

#

this all

hazy parrot
upper hazel
#

in command block

#

ok but how detect

hazy parrot
#

?

fluid river
#

it's kinda overingeneered

upper hazel
#

when command activated in coomand block

twilit roost
#

get nearest player to that block
and replace the @s in the command block with the retrieved player

solemn willow
solemn willow
fluid river
#

yeah?

twilit roost
upper hazel
#

what the event use

twilit roost
#

¯_(ツ)_/¯

upper hazel
#

how detect when player activate cm block

fluid river
#

ig playerinteractevent

slate tinsel
#

I have a player as a passenger on a slime and then I have to spawn in a new slime every tick with it looks like the slime kind of shakes then it can be solved so it runs more smoothly

upper hazel
#

serverCommandEvent just return interact

fluid river
#

might be wrong

#

?jd-s

undone axleBOT
fluid river
#

here you go

twilit roost
#
@EventHandler
    public void CommandBlock(ServerCommandEvent e) {
        if(e.getSender() instanceof BlockCommandSender) {
            // do whatever
        }
    }

maybe something like this?

twilit roost
slate tinsel
fluid river
#

i don't get it then

twilit roost
# fluid river i don't get it then

I think hes spawning lots of slimes and moving them every tick
and he wants to smoother the movement
its choppy rn and he wants to smooth it?

slate tinsel
# fluid river i don't get it then

I spawn in a slime that a player is a passenger on. Every tick I spawn a new slime and remove the old one, when you look at this slime that is now "moving forward" it looks like it is shaking

fluid river
#

well, you can try disabling ai/gravity and so on before spawning

#

maybe it will help a bit

twilit roost
fluid river
#

also idk if it's possible to also set direction for spawned mob

slate tinsel
twilit roost
#

oh aight

fluid river
#

well, detach the player, tp the entity and reattach

#

tho in player's perspective camera would shake

#

for other players it would look fine

twilit roost
#

never tried something like this
but it could be due to the player falling before setting him as pasenger again

#

"falling"
just some small amount

#

thats my thought

fluid river
#

i mean i coded Pen-Is-Ban

#

which basically set player as passenger to invisible armor stand on top of giant wool pen-is

#

and well, armor stand had to teleport upwards with the player each tick

#

for second player everything looked fine

#

but for the one on armorstand camera was like:

slate tinsel
#

So you mean I should use armor stands instead?

fluid river
#

nah

#

can you show an example of your shaking problem tho

slate tinsel
#

Tried a gif but it doesn't show

fluid river
#

record with windows recording tool?

slate tinsel
#

Can record with obs one sec

fluid river
#

what i can suggest is using invisible armorstand + display entity

#

and well, working around velocity of armorstand

#

and teleport display to armorstand position

slate tinsel
fluid river
#

well ig this can also be because your moving interval is too high or your moving distance is too big

#

so you can notice every small move as separate long frame

#

not sure tho

river oracle
slate tinsel
#

can turn it into an mp4.

eternal oxide
#

mkv is mostly popular in piracy

river oracle
#

its fine I downloaded it

fluid river
river oracle
slate tinsel
fluid river
#

skip to 0:26

kindred sentinel
#

how to change player's name only for one player?

fluid river
kindred sentinel
#

i need packet tutorial..

fluid river
#

@tender shard @echo basalt

twilit roost
#

or ?google

fluid river
#

i bet on you guys

#

?bing

undone axleBOT
river oracle
#

Documents the packets

fluid river
#

^

storm crystal
#

is it possible to manage through several world files?

quaint mantle
#

teleportWithPassenger or somethigng

storm crystal
#

like can I have several folders for each world and manage through them

#

like teleport player to another world

rotund ravine
#

Worlds are their own folders already

quaint mantle
#

am i dumb?
i don't crash but get kicked out

[16:26:04 INFO]: LividX lost connection:
[16:26:04 INFO]: LividX left the game
error: No matching static constructor: ClientboundPlayerInfoUpdatePacket.<init> called with (net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$a$a (JavaType), EntityPlayer['LividX'/265, uuid='b32bbf5d-a9f0-4d77-b8f1-258c20fd396c', l='ServerLevel[world]', x=9154.74, y=79.00, z=10402.82, cpos=[572, 650], tl=2501203, v=false, removed=UNLOADED_WITH_PLAYER](LividX at 9154.735701495267,79.0,10402.823517153784) (EntityPlayer))
proud badge
#

If I want to get an item from an item frame, should I use Item or ItemStack?

minor junco
#

?mappings

undone axleBOT
proud badge
#

also how come getRightClicked exists but getLeftClicked doesnt?

glossy venture
proud badge
#

yes

raw epoch
#

hey ! how can i increase the item view distance ? in spigot.yml noting of entity-tracking-range or entity-activation-range works (or i may not know what's the good field to change)

glossy venture
#

so thats prob a different event

worn tundra
#

Hmm, any clue why there's a discrepancy in how 1.19.4 -> 1.20.1 processes § color codes specifically in titles?
In both screenshots, these commands are used: (plus /title @a times 0 1d 0 so the title stays)

title @a title { "text":"§x§f§f§1§1§0§0TEST" }
title @a subtitle { "text":"§x§f§f§1§1§0§0TEST" }
title @a actionbar { "text":"§x§f§f§1§1§0§0TEST" }

On 1.19.4 it works fine (first screenshot)
On 1.20.1 (maybe 1.20 too, didn't test), it apparently only takes the last color code (in the above case, §0 which makes it black)

storm crystal
worn tundra
pseudo hazel
#

how are you displaying the titles then

#

I mean you dont have to use the commands right

worn tundra
#

Sending a packet with the same exact json that goes into the command

worldly ingot
#

You really shouldn't be using legacy text in components at all

#

These types of discrepancies are inevitable

#

Especially if you're using RGB because there's ways to do that better, {"text":"TEST","color":"#FF1100"}

proud badge
#

how could I make an item stack air? i tried both AIR and Material.AIR and ItemStack.AIR

#

nothing seems to work

chrome beacon
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

proud badge
#

AlertObject alertInfo = new AlertObject();
alertInfo.griefer = player;
alertInfo.block = block;
alertInfo.material = material;
alertInfo.frameItem = ;
alertInfo.type = 0;
alerts.put(blockNumber, alertInfo);
doAlert = true;

#

what do I put in the frameItem

#

its an ItemStack

#

and I want it to be AIR in this case

serene sigil
#

hey guys, i need help. I want to override the Minecart logics for collision and some other things. so i need to use nms for that, can anyone show me how to do such a thing cuz i have never touched nms before...

proud badge
#

@rotund ravine why are you crying?

worldly ingot
#

We don't know what AlertObject is

proud badge
#

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

public class AlertObject {
    Player griefer;
    Material material;
    Block block;
    Byte type;
    ItemStack frameItem;

    public AlertObject(Player griefer, Material tool, Material material, Block block, Byte type, ItemStack frameItem) {
        this.material = material;
        this.block = block;
        this.griefer = griefer;
        // Fyi, 0 = break, 1 = item frame, 2 = block place
        this.type = type;
        this.frameItem = frameItem;
    }

    public AlertObject() {

    }
}






worldly ingot
#

I mean if this is your plugin and you just want air, you can either opt to use null or new ItemStack(Material.AIR)

proud badge
#

ok thanks

serene sigil
#

or is there any good tutorial on yt for nms overriding

proud badge
#

Whenever I use null in my object it keeps throwing stacktraces

proud badge
#

na not rn but just in general

#

when I do code

chrome beacon
#

What you'd do is extend the nms Minecart class and override the method that handles collision

serene sigil
#

yea thats what i want to do

chrome beacon
#

and then use nms to spawn it

serene sigil
#

and how do i do that?

rotund ravine
#

?nms

rotund ravine
#

Is a start

serene sigil
#

okay

worldly ingot
proud badge
#

ItemStack itemInFrame = itemFrame.getItem();, currently this gives ItemStack{GOLDENSWORD, 1x}, how could I make it just be GOLDEN_SWORD? getMaterial seems to not exist

#

nvm

#

getType

#

nvm that didnt work

#

nvm I just had to make it a string

kindred sentinel
#

...WHAT'S WRONNG

worldly ingot
#

Missing a . in your second key

#

languages. vs languages

kindred sentinel
#

oh...

#

really...

#

I'm sorry

#

I'm so sorry... I was trying to solve problem about 30 minutes..

vital sandal
#

this is kinda weird

#

this use the same location but function weirdly

kindred sentinel
#

It's ok but nothing has changed..

serene sigil
kindred sentinel
#
        FileConfiguration config = plugin.getConfig();
        config.getConfigurationSection("languages").getKeys(false).forEach(el -> {
            if(el.equals(chatName)){
                System.out.println(config.get("languages."+chatName));
                System.out.println(config.get("languages."+chatName+".suffix"));
            }
        });
chrome beacon
serene sigil
#

kk

chrome beacon
#

then find the method responsible for collision

#

and override it

serene sigil
#

ok

undone axleBOT
twin venture
#

Anyone have experince with world loading , unloading for a minigame plugin?

serene sigil
#

it told me to implement some super methods

serene sigil
#

@chrome beacon isnt it AbstractMinecart?

#

cuz that has some methods

eternal oxide
kindred sentinel
eternal oxide
#

ah

kindred sentinel
#

but the reason is not in that

#

if i reload server

#

it works fine

#

idk why

eternal oxide
#

then you are modifying and not saving

kindred sentinel
eternal oxide
#

must save after making changes to config

#

it works if you are loading a clean config on startup

eternal oxide
#

My guess you are breaking the config while running

kindred sentinel
#

maybe

eternal oxide
#

and not saving changes

kindred sentinel
serene sigil
eternal oxide
kindred sentinel
eternal oxide
#

somewhere you are removing the suffix entry

kindred sentinel
#

I see changes using VS code or note

eternal oxide
#

if it works with a fresh start

kindred sentinel
#

after saving

#

before reload

#

but for some reason it doesn't see changes

serene sigil
chrome beacon
#

They're all final??

#

I doubt that

serene sigil
#

nvm i got it

hushed spindle
#

software users have a special kind of lead poisoning at times man i swear
me: are you using <this command>
them: yes im using <this command>
me: can you type out the command you're using
them: ok its <not that command>
me: ok please use <this command>
them: but the plugin documentation said <not that command>
me: please try it anyway
them: ok it worked it was <this command>

serene sigil
hushed spindle
#

and now that over the course of 20 minutes

kindred sentinel
serene sigil
#

do i need to implement all?

chrome beacon
#

Yes you need it

serene sigil
#

okay

eternal oxide
#

its a Bug in the Bukkit SnakeYaml wrapper

serene sigil
#

ok so I made everything that i could find containing 'collide' to false... what should i do next @chrome beacon

eternal oxide
chrome beacon
serene sigil
#

how

chrome beacon
kindred sentinel
#

i know root like a.b.c.d...

serene sigil
#

theres no documentation @chrome beacon

eternal oxide
# kindred sentinel I think i can do it without map... Soo... What other ways are there?

This is what I use when working with Maps```java
/**
* If loading from file the Maps in the data
* will be stored as a MemorySection not Maps.
*
* @param entry MemorySection or Map to check.
* @return Map containing the serialised data.
*/
@SuppressWarnings("unchecked")
protected Map<String, Object> castToMap(Object entry) {

    if (entry instanceof MemorySection) {
        return ((MemorySection) entry).getValues(true);
    } else {
        return (Map<String, Object>) entry;
    }
}```
kindred sentinel
twin venture
#

unloading world -> remove world -> replace or add the world template -> load the world
Couldn't save chunk; already in use by another instance of Minecraft?
net.minecraft.server.v1_8_R3.ExceptionWorldConflict: Failed to check session lock for world located at ./Lobby, aborting. Stop the server and delete the session.lock in this world to prevent further issues.

storm crystal
#

"select count(name) from enemyStats" <- how can I retrieve list of names from this query in SQLite?

eternal oxide
#

you can;t from that query. You'd need a seperate query

serene sigil
#

@chrome beacon can u help?

chrome beacon
#

Why would there be documentation

serene sigil
#

well u said it

storm crystal
eternal oxide
#

yes

storm crystal
#

oh okay that can work too

chrome beacon
serene sigil
#

oh

#

alright

#

anyways... i want to know what i should do next

chrome beacon
#

Most of the code is in AbstractMinecart so open that

serene sigil
#

ok

remote swallow
serene sigil
#

I have the class

sterile token
#

This is done via client side armor stands right?

chrome beacon
#

now time to read code

storm crystal
serene sigil
#

so i guess its good

storm crystal
remote swallow
#

so do select *

storm crystal
#

wouldnt it select everything everything?

remote swallow
#

it would select everything from the collumn you specify

eternal oxide
#

or just select name from table

chrome beacon
#

so?

worldly ingot
serene sigil
#

yea so i have that class

remote swallow
#

choco did you see the poutine rasputin remix

serene sigil
#

that overrides the nms minecart

storm crystal
#

select * from enemyStats

serene sigil
#

i have never used nms. sorry

remote swallow
worldly ingot
remote swallow
#

opinions?

worldly ingot
#

Fire

remote swallow
#

have you ever had these

worldly ingot
#

I haven't but they're probably great

storm crystal
remote swallow
#

what do you want more programming socks or 1 bag of poutine crisps

storm crystal
#

well fetchall() method just doesnt work for me

serene sigil
#

guys can somepone help me please, olivo told me to make a class and extend nms Minecart and override some methods. idk what to do next...

remote swallow
serene sigil
#

i already overrided some of the methopds

storm crystal
#

it works

remote swallow
#

use executeQuery and use the result set

storm crystal
#

im doing that

remote swallow
#

so what doesnt work

storm crystal
#

theres no fetchall

remote swallow
#

a method fetchall?

storm crystal
remote swallow
#

you loop the data

tough mica
#

Hello Guys,
i have programmed a player object (UPlayer) in which I load all the data from the player asyncronously from a mysql database (loadDatas). Creating a new account and saving works without any problems. However, this unfortunately gives an error in which all strings and integers are null. Unfortunately I can't explain what the problem is, please help me.

https://paste.md-5.net/zalecelehe.java- playerManager
https://paste.md-5.net/filofiwasu.cs - UPlayer
https://paste.md-5.net/cozucesede.java - registerAccounts
https://paste.md-5.net/bunolasabu.cs - Output from Loader

remote swallow
storm crystal
#

like that?

remote swallow
#

correct

storm crystal
serene sigil
minor junco
#

create a list and populate it with data that you fetch instead

#

instead of fetching the list that is nullable and operating onto it (causing the nullptr)

remote swallow
storm crystal
#

its there

minor junco
#

its not instatiated

#

meaning it is null

#

leading to a null pointer exception when trying to operate on it

hazy parrot
#

That variable is just declared, you have to assign something to it

minor junco
#

do

List<String> enemyList = new ArrayList<>();

and when fetching data add it into the list instead of reassigning it to avoid null as a value to be set

remote swallow
#

you dont set it tonew ArrayList

storm crystal
#

thats so fucking confusing

minor junco
#

it is not tho if you know how java works

#

btw. depending for what this list stands for I'd recommend going with a Set instead (if the values should be unique), HashSet is the one you may initialize with

storm crystal
#

setting it to new array produces 2 exceptions

#

:]

minor junco
#

what exceptions are produced

storm crystal
minor junco
#

that has nothing to do with assigning it to a new arraylist

#

you assign null to the list at some point

#

that's what I meant

#

instead of directly reassigning the list to a fetched value, add to the list instead

chrome beacon
minor junco
#

and ConcurrentModificationException is because the list was modified while it was iterated over

chrome beacon
#

brb

minor junco
#

@storm crystal

eternal oxide
#

or just don't remove/add to a list you are iterating

remote swallow
#

wait

#

no ur modifying while looping

minor junco
eternal oxide
#

yep, or removeIf

minor junco
#

but easiest fix is a synchronized list

eternal oxide
#

still can;t remove while iterating

minor junco
#

use copyonwritearraylist then

#

that should do the trick

storm crystal
eternal oxide
#

that will only add one entry

storm crystal
#

then how the fuck do I loop through that god forsaken result set

quaint mantle
#

should I put this in a seperate class?

#

all it does is loads a Config, and checks if there are null values

remote swallow
eternal oxide
#
while(resultSet.next())```
remote swallow
#

wait

#

i keep doing it

quaint mantle
#

and if a config doesn't exist already it makes a new one

remote swallow
minor junco
storm crystal
#

it works

minor junco
quaint mantle
#

or abstract it

#

not optimize it

minor junco
#

yes I can show you how I would refactor it

quaint mantle
#
        try {
            if (!configManager.isSavedInDatabase(StartUpConfig.class)) {
                StartUpConfig freshNewNiceConfig = new StartUpConfig();
                configManager.registerToCache(freshNewNiceConfig);
                configManager.saveFromCache(StartUpConfig.class);
                printNullFieldsError(freshNewNiceConfig);
                return;
            }

            StartUpConfig startUpConfig = configManager.loadFromDatabase(StartUpConfig.class);
            if (hasNullFields(startUpConfig)) {
                configManager.saveToDatabase(startUpConfig);
                printNullFieldsError(startUpConfig);
                return;
            }
            configManager.registerToCache(startUpConfig);
        } catch (Exception e) {
            e.printStackTrace();
        }```
minor junco
#

just without making new classes, too much abstraction isn't needed

quaint mantle
#

I want abstract rn cause this is gonna be a big project

serene sigil
#

@chrome beacon

quaint mantle
#

i think ill just put this method in the configManager class

minor junco
chrome beacon
#

then use level.addFreshEntity to spawn it

#

oh and run setPos before spawning it

upper hazel
#

how work EntityChangeBlockEvent&

#

what this event do

#

and how player can be in this event?

minor junco
# quaint mantle ```java try { if (!configManager.isSavedInDatabase(StartUpCo...
  static <T> T getOrCreateConfig(Class<T> type) {
    try {
      if (!configManager.isSavedInDatabase(type)) {
        T freshNewNiceConfig = new T(); // invoke default constructor of `type`
        configManager.registerToCache(freshNewNiceConfig);
        configManager.saveFromCache(type);
        printNullFieldsError(freshNewNiceConfig);
        return config;
      }
      T config = configManager.loadFromDatabase(type);
      if (hasNullFields(config)) {
        configManager.saveToDatabase(config);
        printNullFieldsError(config);
        return config;
      }
      configManager.registerToCache(config);
      return config;
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
quaint mantle
#

ima put them in my manager class

sacred mountain
#

i've gone from severe warning to fatal error

#

downgrade :(

minor junco
#

oh seg fault

#

thats sick

sacred mountain
#

i've got like 16 log files of this shit

serene sigil
#

so also minecarts that players place

minor junco
sacred mountain
#

:(

minor junco
#

yo may want to reinstall java

sacred mountain
#

why does it only happen like

#

3/10 times

#

then

minor junco
#

it's a hard to debug thing, can have many root causes

sacred mountain
#

i'm just going to stare at it till it works

#

then sleep

minor junco
#
  1. try reinstalling
  2. try a different version
  3. check your administrative permissions
chrome beacon
#

or make a Spigot fork uwu

upper hazel
#

how i can replace block place sound?

#

or this will be hard?

minor junco
#

i mean the "easiest" solution is to cancel a block event and break/place it manually and play the sound to the player

#

but im sure there are more elegant ways of replacing sounds

upper hazel
#

but i think

#

maybe someone have better idea?

minor junco
#

honestly I think this is your best solution

#

unless there's a sound event that you can interact with

#

@upper hazel

short pilot
#
        int taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
            for (Player player : Bukkit.getOnlinePlayers()) {
                PlayerEffects.applyEffects(player);
            }
        }, 0L, 2L);
#

is this a valid way to setup a scheduler ticking per each player in my plugin enable

short pilot
#

question, what can we do with the ID of the task

#

i dont think we use it to close the task on shutdown

grim hound
#

You can

grim hound
#

So do

#

runTaskTimer

#

Instead

#

It's the exact same thing

#

But returns a BukkitTask

quiet ice
#

?jd-s

undone axleBOT
short pilot
#

Is there any efficient way to check if a player has been hit in the past 20 seconds (in combat)

glossy venture
#

is there any way to get the SlotType of a slot using only the inventory type and the slot index

#

i only have access to the type of the inventory its not an actual bukkit inventory instance

dull mango
quaint mantle
remote swallow
#

fuckin mint

sterile token
#

A colleague has the following sql error when performing a java insert query:

Cannot add or update a child row: a foreign key constraint fails (project.loan, CONSTRAINT loan_ibfk_1 FOREIGN KEY (UserID) REFERENCES users (id)).

But when doing the manual query through mysql terminal it works perfectly well

INSERT INTO loans (user_id, book_id) VALUES (1. 11);
ancient plank
#

asking for a friend

glossy venture
#

are the input slots in an anvil, enchantment table and other such inventories classified as crafting or container?

#

and are the workbench slots crafting slots or also container

storm crystal
#

how should I proceed when trying to make additional AI to an enemy, as in make it lets say stop and spawn something at player's location as a simple example?

glossy venture
#

https://paste.md-5.net/xiwobuneba.java
utility to get the slot type for most 1.8 inventory types if anybody needs it
i probably have some shit wrong and im too lazy to implement beacon and brewing but yeah
i think this is based on the raw slot index you get from a click packet idk the official terminology

valid burrow
#

I want to make this class work for each animal. the problem: it extends Squid and id need to pass the animal type in in the constructor

#

any idea how i can resolve this

#

i dont want a class for each creature type

glossy venture
#

dude

#

thats such a good troll

#

set fake like diamonds in someones invneotry

#

and when they click it it disappears

quaint mantle
#

should I rely on the jetbrains @NotNull annotation to handle null params for me

river oracle
#

ultimately it means nothing

quaint mantle
#

r u sure

river oracle
#

I also use Google's Preconditions API

quaint mantle
river oracle
#

if somethijng needs to not be null

quaint mantle
#

I did not make that error

river oracle
#

because it matters in testing

wet breach
river oracle
quaint mantle
#

im just running it as an application lol

#

i have 0 tests

wet breach
river oracle
#

if your running it inside of intellij I presume that intellij also handles it in that scenario too

river oracle
river oracle
quaint mantle
#

yeah it's prob intellij

#

ur right

#

I looked at the source coed

#

code

river oracle
#

if you were to compile the jar I don't think anything would happen

quaint mantle
#

I thought I did all those preconditions for nothing lol

river oracle
#

and then you also have lomboks @NonNull

dry hazel
#

I think it can enforce the checks on 3rd party annotations even

wet breach
#

doubt it, annotations are only as good as the processor that uses them

river oracle
#

but only specific types of 3rd party annotations

#

for example it only really handle third party annotations that jetbrains already provides you can't add some custom annotations that aren't related

storm crystal
#

How do I implement several nametags on an enemy?

river oracle
#

TextDisplays* that follow around the player would probably be the best method

wet breach
#

or go with Y2K's method 🙂

storm crystal
#

Okay

#

If I want an armor piece to give potion effects on equip should I make like 10s periodical scheduler to loop through players?

#

Or is there a more efficient method?

river oracle
#

give the effect when they put it on, remove the effect when they take it off

#

keep track of the armor piece with PDC

paper viper
#

make sure to add the effect on join tho too

#

i dont think effects save on logout

river oracle
#

pretty sure they do though you'd have to check

#

I think that's something saved in NBT

#

otherwise you could log off and rejoin to remove poison

remote swallow
paper viper
#

u would have to check for death too actually

#

and you would have to check if the player drank milk

storm crystal
#

I just saw it being refreshed on one server like that and wanted to replicate it

#

Lol

paper viper
#

so there are still a decent amount of events u have to listen to

storm crystal
#

I guess im supposed to know the most efficient way out of the blue

glossy venture
#

(with packets)

paper viper
#

cursor, inventory, whatever

glossy venture
#

at least this is 1.8 so i think all i have to do now is send the contents of the player inventory (?)

#

again

#

very inefficient but ill optimize later ig

river oracle
glossy venture
#

nah bc the bukkit inventory didnt work

river oracle
#

If Bukkit Inventories aren't working it should probably be a jira report

glossy venture
#

this issue

#

so now im doing my own wrapper with packets

#

for osme reason

#

its prob a client issue tbh

river oracle
#

setting an item doesn't update it?

glossy venture
#

yeah

river oracle
#

try Player#updateInventory

glossy venture
#

already tried

paper viper
#

It's likely because it's 1.8 api and it's whack

glossy venture
#

also tried doing that 1 tick later

paper viper
#

just use a library

valid burrow
#

how do i get a nms entity type from bukkit entity type

river oracle
#

packets fun then ig

glossy venture
#

yep

#

its not too aids with protocollib and my PacketBuilder utility

#

but still

paper viper
#

how bukkit handles inventories is a mess

#

like with the null, Material.AIR, whatever

river oracle
#

I can only fix so much of this stuff in One PR :P

glossy venture
#

it did not fix it

paper viper
#

its why i switched to fabric :p mixins

glossy venture
#

this is so fucking weird

#

why does every packet use a different slot indexing

river oracle
glossy venture
#

well

#

that already worked

#

watch the end

river oracle
#

LMFAO

glossy venture
#

ohhh wait getContents() doesnt account for the goofy arrangement of the crafting and armor slots

#

the bukkit one

#

this screenshot goes so hard

molten hearth
#

argh at this point im gonna ask here, so i have this right, im trying to implement a damage system on top of this that breaks the block when it reaches 10, i have no idea what math i should return from the function to do this

#

for example I have damage: 8.0 ticks: 188 seconds: 9.4 but im not sure how i would return the damage in the form of a damage increment from 0-10

quaint mantle
#

is it just me or are records kinda ugly

#

like the only time I like records are for primitive data classes only

river oracle
quaint mantle
#

idk why

#

i just dont like that

#

when I use @NotNull and then check it in my own constructor

median bronze
#

whats the best way of adding mutli-version support? If i used 1.20 spigot for a pl, how can i add support for 1.18-1.19?

quaint mantle
#

I've seen people use modules

#

but idrk how people combine the modules to add support

wet breach
#

another use is to use them create different jars

candid galleon
#

use viaver / viarewind @median bronze

slender elbow
worldly ingot
#

Look at Emily keeping up with the right channels

candid galleon
#

that is a very big wheel to recreate

#

:)

river oracle
# quaint mantle

you can use NotNull on the default record constructor and instead of using preconditions just assume failure at some arbitrary point

bitter rune
#

what does asserts != null do?

#

pretty much tells the code to assume everything is good? i've learned in my youth never assume things

river oracle
worldly ingot
#

Well I wouldn't say "you shouldn't use it"

#

It definitely has its use cases

grand flint
#

What event fires when a person presses numbers to change their equipped item?

worldly ingot
#

They're disabled by default but it helps clear up some very obvious warnings from IDEs. I use it a lot for item meta from a fresh item stack

ItemStack itemStack = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta itemMeta = itemStack.getItemMeta();
assert itemMeta != null;
itemMeta.setDisplayName("Hello world!"); // If not for the assertion, my IDE would say "potential null access" despite it being impossible
grand flint
#

If I cancel this, would the gui update for the client? Like would it still highlight the item they pressed even though it's cancelled

worldly ingot
#

iirc it would show on the client then immediately flick back to the previous slot

grand flint
#

Hmm alright thx choco

#

can i get if they scrolled or pressed a number w packets?

worldly ingot
#

I don't think the server cares. As far as it's concerned, it went from slot a to slot b, doesn't care how it managed to do that

grand flint
#

i mean w packets

worldly ingot
#

Where do you think the event is fired from? :p

#

We expose all that we can there. Client doesn't tell us how it changed slots

grand flint
#

hmmm

#

this guys rpg testing server

#

has abilities binded to 1 2 3 4

#

which i can see flickers when i press the number back to the original slot i was at

#

but if i use the scroll function i can still scroll thru my hotbar

worldly ingot
grand flint
#

hmm or maybe he doesnt

#

oo simple solution chrck if the person is shifting to use abilities 😎

river oracle
worldly ingot
#

Think of an assertion less of an error thrower and more of a "I promise, this is actually impossible. If this happened somehow, something else is seriously broken"

#

In an ideal world you write assertions that will always be true

#

You don't want assertion errors

river oracle
#

Idk especially in plugin development I guess I can't see a reason you'd want everything to crash and burn once your assertion fails I feel like most things can be handled by exceptions and safe fall backs or reattempts

#

Unless I'm wrong with my assumption assertions just kill your session basically correct? Ig a better way to say it is it'd terminate your program

worldly ingot
#

It doesn't terminate the application, no. It's just an exception that happens to extend Error

river oracle
#

💀 why that makes it seem scary

worldly ingot
#

Because in theory it should be impossible

river oracle
#

Ahhh

#

That case would just seem redundant though ig if you want to ensure absolute memory security it could be useful

#

Since your program would fail assuming memory was tampered with

worldly ingot
#

Not redundant, makes your IDE happy :p

river oracle
#

I just tell me ide to stfu lol

worldly ingot
#

ItemMeta is nullable but only when the type is air, but we very obviously did not pass air to the constructor

#

IDE doesn't know that though

tough fiber
#

Question abt something with datapacks. Would it be possible to make it so that datapacks actually register things when enabled? Like when a datapack is enabled, mc doesn't register things in the pack, meaning new things in there like damage sources aren't registered. How would someone go about making the datapacks registered? I tried cmds and that doesn't work. Is there an api or a devBundle or fork way of going about this?

river oracle
#

Interesting I thought mojang would allow this but maybe not idk when along data packs are loaded but if it's after when a plugin could theoretically be loaded you could manually unfreeze registries with your plugin

#

But given mojang probably doesn't support adding damage sources with data packs I assume you'd need to do this with a plugin

tough fiber
#

Damage sources can be added with datapacks. After looking at the code the datapacks seem to be loaded A LOT earlier than CraftBukkit, or even plugins. Meaning any datapack provided by a plugin would be useless until the server restarts and mc loads the pack

#

It seems that the datapacks are coded into the world on generation, so it would be unmodifiable during runtime

#

I may try and modify the source a bit to try and see if you can load packs on the startup, right once plugins are loaded, inside the gray area of "plugin repository start and figure out stuff" and "ok you can join and RIP u can't add datapack now"

drowsy helm
#

Datapacka and plugins dont work well together

glossy venture
#

idk

sullen marlin
#

They're before

hybrid turret
#

I'm trying to get a map from a yaml file and i'm getting an "unchecked cast" warning, can i fix that somehow?

Map<String, Location> playerWarps = (Map<String, Location>) WarpUtils.getInstance().getConfig().get(sender.getName());
#

or is casting ust wrong? lol

quaint mantle
#

can i make a block that only the player can see?

#

i mean a player will have a diamond block in front of him and only he will be able to see that block.

drowsy helm
#

Yeah packets

#

Pretty sure theres a sendBlockChange method in spigot thi

twin venture
#

Hi , uhh iam trying to get the block that is under the player?

#

i tried this but the code is not being exetued , its must a chest

drowsy helm
#

Use block.getType

twin venture
#

and i do == Material.CHEST ?

drowsy helm
#

Yeah

twin venture
#

that worked :p

storm crystal
#

Any way to make client sidr things for player

drowsy helm
storm crystal
storm crystal
#

Okay great i know how to spawn a particle

#

It was just an example

#

How to do things for a certain player client side

#

So that only they can see it

chrome beacon
#

Depends on what the thing is

glossy venture
#

packets

#

or spigot API methods like sendBlockChange

twin venture
#

Hi anyone used FAWE API ?

#

this is not being imported?

#

it imported this

twin venture
#

yes its from diffrent or package

#

its this one

shadow zinc
#

how can I get the memory usage of each thread trace elements?

ivory sleet
#

the memory each thread stack uses?

shadow zinc
ivory sleet
#

hmm im unsure, since java also introduced virtual threads

#

it could be hard to track it properly

candid galleon
#

according to AI the JVM doesn't segregate memory usage per thread

ivory sleet
#

there are some jvm flags iirc that allow u to do some interesting stuff regarding this

#

but i think its mostly for testing and debugging

sullen marlin
#

?xy

undone axleBOT
shadow zinc
#

the forbidden jusu

odd adder
#

is it possible to set rename text on AnvilInventory?
it has a getRenameText method , but no setRenameText.
should I convert it to nms first?

hybrid turret
shadow zinc
#

supress warning

hybrid turret
#

huh okay then

glossy venture
# hybrid turret anyone got something on that?

you could check the type before casting it and throw another exception if you want to get rid of the warning entirely but to supress it just add @SupressWarnings("unchecked") to your method/class

hybrid turret
#

i mean yeah i've added the @SuppressWarnings but I just thought that's bad practice

dry hazel
#

there's no other way really

glossy venture
#

wait let me see how much i use it in my code

#

not that big of a codebase

hybrid turret
#

alright then i'll do that ig lol

ivory sleet
#

intellij looks at //noinspection <inspectiontype>

#

(as well)

#

but yeah dumb type erasure

rotund ravine
#

Global suppress warnings when

quaint mantle
#

how do i get what the server is running

#

like paper or spigot

chrome beacon
#

Try one of these

#

might need a regex to isolate it

serene sigil
#

hi @chrome beacon I cant figure out how to spawn the minecart. Can you help me?

chrome beacon
#

Sure what part are you having problems with?

serene sigil
#

So i have the class, now I need to spawn it whenever a player places a normal Minecart

#

Do I need to create this CustomMinecart object?

chrome beacon
#

yes

serene sigil
#

okay

chrome beacon
#

I believe I told you this yesterday

chrome beacon
serene sigil
#

and what is the Level param?

chrome beacon
#

The level

#

(aka world)

serene sigil
#

so do I cast it to a level?

#

the bukkit world

chrome beacon
#

I believe you'd get handle

serene sigil
#

OceanMinecart oceanMinecart = new OceanMinecart((Level) Bukkit.getWorld("world"), event.getBlock().getX(), event.getBlock().getY(), event.getBlock().getZ());

#

like this?

chrome beacon
#

No

#

you need to get handle

#

on CraftWorld

serene sigil
chrome beacon
#

There's a method called getHandle

serene sigil
#

in CraftWorld?

chrome beacon
#

yes

#

or at least I think so 🤷‍♂️

serene sigil
#

static?

#

cuz i cant find any

eternal oxide
#

no

#

((CraftWorld) Bukkit.getWorld("world")).getHandle()

serene sigil
#

if i create a new craftworld then there is a gethandle

serene sigil
eternal oxide
#

then cast that

#

thats your ServerLevel

serene sigil
#

oka

serene sigil
#

or what are they?

chrome beacon
#

Check the nms code

serene sigil
#

there are 2 constructors

chrome beacon
#

yeah now check what they're used for

#

You don't need the top one

eternal oxide
#

the top one is only if you are doing shit before spawning it

serene sigil
#

i see

serene sigil
eternal oxide
#

in teh NMS class

#

you are workign with NMS now so look at teh decompiled class in BuildTools work folder

chrome beacon
#

Read the code

eternal oxide
#
    protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world, double d0, double d1, double d2) {
        this(entitytypes, world);
        this.setPos(d0, d1, d2);
        this.xo = d0;
        this.yo = d1;
        this.zo = d2;
    }```
chrome beacon
#

Ctrl clicking in Intellij will decompile the class for you

serene sigil
#

and which class do i need to read?

chrome beacon
#

ElgarL already gave you the code you need

serene sigil
#

that means i dont need to call setPos, right?

eternal oxide
#

not unless you are setting a direction

serene sigil
#

oh so setPos is a vector??

eternal oxide
#

no its a location

#

well x,y,z

serene sigil
#

well its the same as Vector in bukkit

eternal oxide
#

just spawn it and see

serene sigil
#

ok but how do i spawn it?

eternal oxide
#

vector is used for both

#

somethign like addToWorld

serene sigil
#

i see these

eternal oxide
#

or addEntityToWorld, Its NMS so I can;t remember

serene sigil
#

ok

#

no there is nothing with Add

eternal oxide
#

then spoawn

serene sigil
#

which one tho?

eternal oxide
#

there shoudl be a method on teh NMS entity

#

try the basic one giving a itemStack

serene sigil
#

this maybe??

#

and then do World#smawnEntity()?

eternal oxide
#

there is no Bukkit entity yet

serene sigil
#

okay

serene sigil
#

what should i do for the itemstack?

eternal oxide
#

create one

#

NMS ItemStack

#

not Bukkit

serene sigil
#

ok

#

maybe try this?

eternal oxide
#

have you added your Minecart to the world yet?

serene sigil
#

ItemStack itemStack = ItemStack.EMPTY;

serene sigil
#

i just createdthe class

eternal oxide
#

nmsWorld.add...

serene sigil
#

((CraftWorld) Bukkit.getWorld("world")).addEntity(oceanMinecart, CreatureSpawnEvent.SpawnReason.CUSTOM);
?

eternal oxide
#

try it and see

serene sigil
#

ok