#help-development

1 messages · Page 1514 of 1

eternal oxide
#

When you create your Inventory you are returned an Object.

#

simply compare your e.getClickedInventory().equals(object)

quiet hearth
#

How to check what armor a player is wearing?? I want to do an action when the player equips a certain type of armor

true perch
eternal oxide
#

yes, but you are better keeping it private and add a getter

true perch
#

smart, thank you so much!

true perch
wraith rapids
#

there are a few libraries that implement armor change/equip events

true perch
#

asssuming you have a player variable ready to go

wraith rapids
#

and paper has one built in

#

there are also specific methods for each individual armor slot, like getChestplate and so on

quiet hearth
#

Ok

#

Using the PlayerInventory class tho, it wont let me make a player object

wraith rapids
#

you don't make a player object

#

you get a player object

quiet hearth
#

Would it be the InventoryHolder?

wraith rapids
#

most likely yes

#

you'll want to check instanceof and cast the returned HumanEntity to Player if that's the route you're taking

#

however it's pretty strange for you to have a PlayerInventory but not a Player in the scope

eternal oxide
#

If you are referring to the PlayerInventory class it sounds like you may be doing something wrong.

wraith rapids
#

yeah, that question has worms somewhere

eternal oxide
#

Are you trying to create a Player inventory and then trying to figure out how to attach it to a player?

wraith rapids
#

his end goal afaik is to get the armor item worn by a player

eternal oxide
#

yep

quiet hearth
#

Im trying to check to see if a player is wearing certain armor and if true then give the player an effect

eternal oxide
#

ok, is this in some event or just any code?

quiet hearth
#

Event

#

Im using an event

eternal oxide
#

which?

quiet hearth
#

PlayerInventory

wraith rapids
#

that's not an event

eternal oxide
#

ok, you can;t use that event

#

Thats just an Interface

quiet hearth
#

Ah

wraith rapids
#

it's an Inventory

#

that belongs to a Player

quiet hearth
#

Thatd be an issue

#

Is there an event involved with equipment

wraith rapids
#

all of the events have Event in the name

#

there is no armor equip event on spigot

#

you'll have to check every player's every armor slot every tick

#

or import and shade in a library that does that for you

quiet hearth
#

Ok

eternal oxide
#

There are three you need to watch, InventoryClick, Drag, Move.

wraith rapids
#

for inventory actions, yes

eternal oxide
#

There are others too, but start with those

wraith rapids
#

but armor is more complex than that

#

and with the way how bukkit is, it won't be reliable even if you listened to every event there is

#

as other plugins can still modify the slots without emitting any events

true perch
#

https://hastebin.com/pekilifuyu.java
I created a public static variable in the Item.java class, and created a getter.
I then checked if the getClickedInventory() obejct was equal to the Items.getGui() getter, but it's not cancelling the event when I click an item in the inventory. Any help?

wraith rapids
#

if you have a getter, the variable should be private

#

the point of the getter is that you don't need to expose the underlying state (the variable) directly

true perch
#

Right, changed. Thank you

#

Yeah sorry I'm just new to the experience of writing my own code 😅

wraith rapids
#

assuming the code works and is set up correctly and whatnot, that would imply that the Items.getGui() inventory is not == as getClickedInventory()

#

that is, they are not the same inventory object

true perch
#

in my Items class the variable is now private static Inventory gui; which is initialized during the onCommand event. Inside the ClickListener class I made, I'm trying to compare whether a player clicked an item in said opened inventory. I tried if (e.getClickedInventory().equals(Items.getGui())){, but it doesn't cancel it. Not sure what I did wrong

wraith rapids
#

print out the Items.getGui object and the e.getClickedInventory object to system.out and see what they are

true perch
#

okay will do

#

Oh it's because I never added clicklistener to the main method, pretty sure

#

Looks like both references are equal and it is in-fact canceling the event thanks for the help!

young knoll
#

Does anyone happen to know what the class BuiltinRegistries is equal to for spigot

wraith rapids
#

in the mappings?

#

nice link

#

good job

quiet hearth
#

Ah thanks

minor garnet
#

Fuck internet lol

wraith rapids
#

that long string of shit is trash added by cloudflare

#

you can strip it off

young knoll
wraith rapids
#

do you know the mojang name

#

or is that what you're asking for

young knoll
#

Looking for whatever name I need to use on spigot

#

I don't know why I can't seem to find this one

wraith rapids
#

if you know the mojang name you can check the mojang->spigot translation on mini's mappings viewer

young knoll
#

I do not

#

Actually, I think WorldGenRegistries may be the mojang name

true perch
#

Is there a method to check whether or not the player has at least 1 empty slot in their inventory? Or rather, the total filled slots in their inventory?

#

player.getInventory().getSize() wasn't correct

eternal oxide
#

compare size to getContents() ?

true perch
#

player.getInventory().getContents().length?

eternal oxide
#

however the empty slot may be an armor slot (not sure)

true perch
#

Ah, maybe I should write my on method?

eternal oxide
#

try getStorageContents() instead. It should exclude armor

#

you will have to check the returned array for null as those will be empty slots.

true perch
#

Ooo, I'll give it a shot

#
ItemStack[] items = player.getInventory().getStorageContents();
for (ItemStack theItem : items){
    player.sendMessage(theItem.toString());
}```
#

that sent all the items in the inventory

eternal oxide
#

it shoudl be excluding armor slots?

true perch
#

Correct, I can just write a method public int itemsInInventory(Inventory inventory) if it returns the result I want, that'll do the trick

#

I made sure to check for armor slots too, doesn't display them

eternal oxide
#

cool, just be sure to check for any slots that contain null.

#

empty slots shoudl contain null or AIR

true perch
#
for (ItemStack theItem : items){
    player.sendMessage(theItem.toString());
}```this only displays items that exist in the inventory
#

It doesn't seem to be displaaying an empty slot

eternal oxide
#

yes, its just not sending a message for null. It should actually be throwing an error

true perch
#

oh cool! thanaks

#
    public boolean hasFreeSlot(Player player){
        ItemStack[] items = player.getInventory().getStorageContents();
        for (ItemStack theItem : items){
            if (theItem.equals(null)){
                return true;
            }
        }
        return false;
    }```seems to give an error in console, https://hastebin.com/unizenedan.apache
young knoll
#

Blah, everything is working with hooking into the Mojang structure system, other than the structures actually placing blocks

#

I assume it's because I am missing those registry entries, but I'm not sure

true perch
eternal oxide
#

if (theItem == null)

young knoll
#

MiniMappingsView doesn't seem to have anything for WorldGenRegistries

sweet sun
#

anyone knows why this does not work?

quaint mantle
#

what is that object array

#

looks straight out of a decompiler

true perch
#
if (hasFreeSlot(player)){
    player.sendMessage("You've receive an item!");
    player.getInventory().addItem(item);
}else{
    player.sendMessage("Inventory full!");```worked perfectly, thaanks. night ❤️
young knoll
wraith rapids
#

if (!player.getInventory().addItem(item).isEmpty()) player.sendMessage("Inventory full")

#

idr if it was addItem, but one of the methods that adds item(s) to an inventory returns a Map of the items that didn't fit

eternal oxide
#

yep it is

wraith rapids
#

more efficient and usually more accurate to check that after attempting to insert the given items

ripe flint
#

Hey! I’m new to coding plugins. Anyone know a good place to start?

eternal oxide
#

new to java or new to plugins?

waxen plinth
#

Has anyone had issues with SQLite taking forever to close the connection?

#

I've had some issues where it takes as much as 5-10 minutes to close the connection

#

Stack trace says it's doing a commit

#

Which makes sense, but it shouldn't be taking that long

#

Even without the io sync it doesn't make a difference

wicked vigil
waxen plinth
#

I've turned off auto-commit but I also commit every 5 minutes automatically and none of those take an unreasonable amount of time

#

I'm really baffled as to why SQLite is acting this way

eternal oxide
#

I'm going to assume you are not using some connection pool thats keeping it active

waxen plinth
#

I am not

#

It's a single connection from a single plugin

eternal oxide
#

then I can;t help I'm afraid

waxen plinth
#

That's not it

#

The close() call is freezing the server up

#

It doesn't have to do with gc, otherwise it wouldn't appear in the stack trace

eternal oxide
#

further down that thread they talk about objects not being released

waxen plinth
#

I mean, this is for C#

#

And I'm fairly sure it's unrelated to my problem

eternal oxide
#

its still applicable, probably.

waxen plinth
#

If that's the problem then it's freezing within the call

#

Here they're talking about cleanup after calling close

eternal oxide
#

Not saying it is related to yoru issue, but its somethign to consider if you are holding objects

waxen plinth
#

Ideally, applications should finalize all prepared statements, close all BLOB handles, and finish all sqlite3_backup objects associated with the sqlite3 object prior to attempting to close the object. If the database connection is associated with unfinalized prepared statements, BLOB handlers, and/or unfinished sqlite3_backup objects then sqlite3_close() will leave the database connection open and return SQLITE_BUSY. If sqlite3_close_v2() is called with unfinalized prepared statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups, it returns SQLITE_OK regardless, but instead of deallocating the database connection immediately, it marks the database connection as an unusable "zombie" and makes arrangements to automatically deallocate the database connection after all prepared statements are finalized, all BLOB handles are closed, and all backups have finished. The sqlite3_close_v2() interface is intended for use with host languages that are garbage collected, and where the order in which destructors are called is arbitrary.

#

This seems like it might be related

#

It's possible there are prepared statements or other objects I'm not closing

#

In that thread they mentioned a call to essentially clear/close all of the related objects

#

I wonder if something similar exists for java

hot hatch
#

is there a way to check if an argument is a player?

quiet hearth
#

    @EventHandler
    public static void onHackerManClick(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Action action = event.getAction();

        if (player.getInventory().getItemInMainHand().isSimilar(CustomItems.hackerMan)) {
            if (action == Action.RIGHT_CLICK_BLOCK || action == Action.RIGHT_CLICK_AIR) {
                CustomItems.hackerMan.getItemMeta().addEnchant(Enchantment.LUCK, 1, true);
                CustomItems.hackerMan.addEnchantment(Enchantment.LUCK, 1);
                Location location = player.getLocation().subtract(0,1,0);

            }

        }
    }
}```

I have a custom item that i want to add the shiny effect (Enchantment.Luck) outside of the class where it was initialized. Is there a way to do this.
#
                CustomItems.hackerMan.addEnchantment(Enchantment.LUCK, 1);``` These were two ways i tried, but did not work
#

The custom item is a Totem of undying

maiden thicket
maiden thicket
quiet hearth
#

yes

hybrid spoke
maiden thicket
#

lmao didnt even notice that

quiet hearth
#

its not supposed to be a static method..?

maiden thicket
#

no

hybrid spoke
#

this is a bad practice you did there

maiden thicket
#

you're supposed to reference the player's item in hand

#

ur modifying a static variable that you created not a player's item

quaint mantle
#

Hello! I'm trying to kill armorstand in every world. However, if the player is not in the same world or near it, the armorstand will not disappear. Here's my code.

        for (World world : Bukkit.getWorlds()) {
            for (Entity entity : world.getEntities()) {
                if (!entity.getMetadata("hologram").isEmpty() && entity.getMetadata("hologram").get(0).asString().equals(name)) {
                    Bukkit.broadcastMessage(entity.getLocation().toString());
                    entity.remove();
                }
            }
        }
    }```
quaint mantle
#

I should do static cuz my constructor registers event

maiden thicket
#

wat

#

anyways

#

uh

quaint mantle
#

like

#
registerevent...
}```
hybrid spoke
hybrid spoke
#

you could cache the entities which are being unloaded in the ChunkUnloadEvent and remove them too if they are the entity you want to remove

quaint mantle
#

ahh thanks you

hybrid spoke
#

or if you don't want to remove them in an interval, you can just remove them directly

quaint mantle
#

Yes I want just remove them directly

#

so should I load all chunk right?

hot hatch
#

is there a way to turn a string into a player?

waxen plinth
waxen plinth
#

Bukkit.getPlayer(String)

hot hatch
#

omg tyvm

waxen plinth
#

And if that returns null

#

You can tell it's not a player

#

At least, not an online one

hexed hatch
#

Does anyone know a way to set an ItemStack's name property as a BaseComponent?

ivory sleet
#

I mean the name is stored as a string

hexed hatch
#

Not in Vanilla

ivory sleet
#

well the display name then

#

I think at least?

#

might be a Component else wise

hexed hatch
#

In Vanilla Minecraft, you can use commands to generate items with component names

#

Data like this: {"text":"Ornate Diamond Sword","font":"blah","color":"#BBFF45","italic":false}

ivory sleet
#

yeah

#

in SpigotAPI you would use strings tho

#

or create a component and turn it into a string

#

but at the end its just a string

hexed hatch
#

That'll work?

ivory sleet
#

Idk haven't done that but 99% sure it should work

hexed hatch
#

So create the component, store it as a string, then set it as the display name?

#

Sick, I'll try that

ivory sleet
#

yeah basically

#

altho if u rly want to use components I believe PaperAPI offers it

#

or like yeah just PaperMC

hexed hatch
#

If that doesn't work I'll probably go with that yeah

#

But if this works it really isn't much of a hassle

ivory sleet
#

Yeah

formal dome
#

ok so i've started with some simple javascript stuff for modding, but does anyone know how i build a .jar file for a mod? and are there any nice libraries i can import do my project?

#

im trying to use vscode as my IDE... intelij and eclipse are rather confusnig xD

hot hatch
#

um

#

javascript?

proud basin
#

you mean java?

#

javascript and java are 2 different languages craftinc

formal dome
#

gotcha

#

i just need some guidance to some good api and documentation so i can compile a simple .jar file... any "hello world" examples?

hot hatch
#

tbh

#

i'd watch a tutorial video

#

just like 2-3 eps

#

to get the basics

#

this is the api

proud basin
#

?learnjava

undone axleBOT
proud basin
#

maybe this too^

pale hazel
#

Do i need to watch tutorials in order to learn spigot fully or can i rely on the stuff ive learned studying java for the past 4 months?

formal dome
#

sweet thanks, i need help mostly with syntax and a few language specific things. I've done some practicing with c++

#

will def check out some youtube vids to get me started

proud basin
wispy fossil
proud basin
#

There is different ways people learn

hexed hatch
#

YouTube taught me horrible practices that took me a while to unlearn lol

wispy fossil
#

naw
watching someone code, pausing every 3 seconds to see what they wrote
Most spigot/bukkit tutorials dont explain what is happening either
maybe for the absolute basics
but it's not a good way to learn, just a good way to do

formal dome
#

it depends on the person tbh, i usually like using documentation

#

and following examples

proud basin
#

That's correct craftinc

vivid lion
#

youtube is eh just stay close to wikis and tutorialpoints docs

proud basin
#

It does depend on the person

outer sorrel
#

is there a way to download the spigot api file instead of using a dependency in maven or gradle? internet issues :/

ivory sleet
# pale hazel Do i need to watch tutorials in order to learn spigot fully or can i rely on the...

knowing the very fundamental basics of Java as well as OOP will be enough to get you started with Spigot API without problems. As a matter of fact if you are already knowledgeable in Java you are probably already better than the average Spigot developer. Anyways in my experience YouTube tutorials are a hard field as some of them are good while others are less good leaving big confusion in which one to pick. The best way to find how to do something is to use the Javadocs but the Spigot Wiki page has some decent tutorials and both Bukkit and Spigot forums can offer great help in how you would tackle stuff but keep in mind both wikis and threads can be outdated. sry for the bible lol

wispy fossil
#

if you are already knowledgeable in Java you are probably already better than the average Spigot developer
haha true

vivid lion
#

lmfao

pale hazel
outer sorrel
pale hazel
#

This my first time working with an API so its a bit overwhelming

hexed hatch
#

I was an unfortunate soul who learned Java through Spigot at the beginning. Fortunately I had people to bully me into actually learning the language instead of monkeying my way through it

vivid lion
formal dome
#

isn't an api jsut a new library to learn? u import it and u use the functions as if it was a standard java library

sonic dirge
#

I literally made my first plugin by doing copy-paste-tweak until it worked lol.

craggy steeple
#

U guys know a discord just for Plugins of Spigot?

ivory sleet
#

yeah craftinc that is correct

pale hazel
#

how does the shape method work for shapedRecipes

wispy fossil
#

i think it's left to right
cant recall

craggy steeple
# proud basin here

Trying to find a animated scoreboard plugin working for 1.17 but Spigot search bar sucks 😦

wispy fossil
#

i just type roughly what im trying to do and have the ide autofill do the work

pale hazel
#

See i would do that

#

but i want to learn every single little things and thats what catches me

vivid lion
#
    shape​(java.lang.String... shape)

So like for example shapedRecipe.shape("xxx","xxx","yxy");

pale hazel
#

i believe i will waste alot of my time trying to learn everything on my own

#

i got plenty of time just want to be efficient

vivid lion
#

and then all you do is

#

ShapedRecipe.setIngredient('x',Material.DIAMOND);

formal dome
#

so heres the question for me, if im using vscode where do i need to put the api files

#

anyone familiar with vscode?

vivid lion
#

nope dont use a text editor lol

outer sorrel
hexed hatch
#

I would use Eclipse or IntelliJ

vivid lion
#

Intellij

#

is better

hexed hatch
#

I agree

formal dome
#

okay, i have it, just felt more used to vscode

craggy steeple
vivid lion
#

.org

#

if you want

outer sorrel
quaint mantle
#

Write in whatever you’re comfortable with

#

And know how to use 🙂

pale hazel
#

Okay the shape method is pretty simple lol

#

you just specify a letter at the index basically

#

"T "

vivid lion
#

ye so like "xxx","xxx","yyy"

pale hazel
#

this represents the ingredient on the top left corner

#

dopppeeeeee

#

this is so fucking cool

proud basin
#

yea

formal dome
#

question, can't i download the api?

sullen dome
#

what are you actually trying to do? you get spigot either by using the maven-dependency, or decompiling it with BuildTools if you need nms and stuff

wet breach
formal dome
sullen dome
#

nvm i was on the whole wrong way lol

wet breach
quaint mantle
sullen dome
#

probably your hashmap is empty? :o

summer scroll
#

How can I prevent passengers from being ejected if the vehicle is in water or teleporting?

sullen dome
summer scroll
#

The vehicle is a player.

sullen dome
#

so... a player riding a player? :o

summer scroll
#

armor stand riding player

sullen dome
#

uhmmm the VehicleExitEvent gets called only when a LivingEntity leaves it

#

sooo

summer scroll
#

i want to prevent the armor stand to get ejected

sullen dome
#

yea i know

hexed hatch
#

Don't think Player extends Vehicle

sullen dome
#

yea thats it

summer scroll
#

alright imma try that

sullen dome
#

well, try it out i guess. player extends Entity/Livingentity tho

summer scroll
#

last time i used that event, we can't really cancel the event.

#

we need to mount the entity back

hexed hatch
#

What happens when you attempt to cancel it?

sullen dome
#

but that would be weird in water tho

#

and laggy probably

summer scroll
#

oh it works now

hexed hatch
#

Wow, I'm surprised it looks as good as it does

maiden thicket
#

is that a backpack plugin or smthn

summer scroll
#

yeah, for cosmetics

maiden thicket
#

u prolly jus have to rotate the armor stands body

#

by like

#

90 degrees? i think

#

so pi/2 since i think eular is in radians

summer scroll
#

Yeah on EntityToggleSwimEvent right?

maiden thicket
#

if thats a thing then probably

summer scroll
#

the thing is, the backpack is in the armor stand head

#

can you set the pitch?

hardy swan
#

pitch could be based on sight and not body angle

summer scroll
#

what method should i use?

hardy swan
#

i did a quick search online and it seems like body direction is client side

sullen dome
#

i dont think there's one. the body yaw/pitch is based on client-mode

summer scroll
#

for the head rotation i use nms

hardy swan
#

i doubt you need nms for that

#

instead you could nms for body rotation

summer scroll
hardy swan
#

then it would be visual only to you, unless you try and send these to every player in vacanity

summer scroll
#

i'm gonna test with the second player

hardy swan
#

just craftbukkit's api

summer scroll
#

oh yeah, just noticed

#

there is also setHeadPose

hardy swan
#

also test if passenger teleports with you

#

through commands and portals

summer scroll
#

for some reason i didn't got teleported

#

because of the dismount event

hexed hatch
#

That'll be a fun one to fix lol

summer scroll
#

fuck

#

one way i can think of is

hexed hatch
#

what condition are cancelling the dismount event?

summer scroll
#

removing backpack -> teleport -> equip again

#

if the player is wearing a backpack

hexed hatch
#

Yeah that's what you're going to have to do for sure

#

Can I see the class that controls the dismount event, if it isn't too much trouble?

summer scroll
hardy swan
#

I think by cancelling the dismount event he also cancelled the tp event

hexed hatch
#

Yeah

#

Does it still call a teleport event?

#

You could check if teleporting players are wearing a backpack, remove it, go through with the teleportation, then remount it

summer scroll
#

in the PlayerTeleportEvent right?

hexed hatch
#

I've never touched the teleportation events but that sounds about right yeah lol

#

Make a lil debug class and see if it spits

summer scroll
#

oh god, it's harder than i thought

#

wish there is something like DismountCause

#

the PlayerTeleportEvent isn't being called

hexed hatch
#

Yikes

#

I’d offer to help you work through that but I’m not at my PC right now. Good luck

#

Lmk if you get it working, I’d like to hear how you did it

summer scroll
#

alright, thanks!

hardy swan
summer scroll
formal dome
#

so excited, ima try to develop a mod for water that allows it to be pushed. i was trying to make a wave pool 👀

summer scroll
#

Anyone know why cancelling EntityDismountEvent cancel teleportation too? and the PlayerTeleportEvent isn't being called.

hexed hatch
#

Teleporting with entities stacked is always a challenge

#

When is the dismount event being called?

#

Like, what circumstances cause the armor stand to dismount from the player?

summer scroll
#

Teleporting.

hexed hatch
#

Just teleporting?

summer scroll
#

Because when the "vehicle" or player teleports, the entity got dismounted.

hexed hatch
#

Then why cancel the event at all?

summer scroll
#

And when the player goes swimming or in water.

#

Entity got dismounted.

hexed hatch
#

Perhaps only cancel it when the player is swimming and remount the entity after teleportation?

#

Is there like a player.isSwimming() method or something?

dusk scroll
#

Hey guys, I'm having some troubles adding some values to my string list in my config.yml. I have a list of cosmetics to add to a players profile, but whenever I add something, it replaces what's already there.

dusk scroll
#

I've looked it up on the spigot forums and I've tried everything, but none work

summer scroll
hexed hatch
#

^

dusk scroll
hexed hatch
#

Code pls

dusk scroll
#

I also tried making a new arraylist and copying everything over by looping through the values in getStringList, adding them to the new arraylist, and setting that--still didn't work

#

it replaces it every time

#

wait

hexed hatch
#

Print the contents of both the unmodified list and after it’s modified

dusk scroll
#

omg.... i just found the problem LMAO

#

I forgot to put a .

hexed hatch
#

lol

dusk scroll
#

in the list i get

#

lmao

hexed hatch
#

It’s always the little things

summer scroll
hexed hatch
#

Let me think

formal dome
#

which one of these is the org.bukkit repo

hexed hatch
#

At what point does the entity try to dismount?

#

When in the water*

summer scroll
#

when half of the player's body is in water

hexed hatch
#

Is it when the player goes in to the swimming animation or is it when they go a certain amount of blocks underwater

summer scroll
#

the entity got dismounted

hexed hatch
#

Ah

#

Yeah something like dismount cause would definitely be helpful here

summer scroll
#

yeah very helpful

hexed hatch
#

Is the isInWater method working properly?

summer scroll
#

yes

#

there could be any others cause other than passengers dismounted because in water and teleportation

hexed hatch
#

I’m trying to think of a hacky solution for this

dusk scroll
#

so glad it finally works now 👀

summer scroll
hexed hatch
#

I can’t see why this wouldn’t work if it worked before. Are you sure Player#isInWater works?

summer scroll
#

yeah it works perfectly

woven epoch
#

anyone know why persistentdatacontainer for an item might not be persistent?

hexed hatch
#

isHalfInWater(player) moment

summer scroll
#

here, let me show you when the entity dismounted

hexed hatch
#

Wait is it not working as intended?

#

I might be confused as to what the issue is lol

summer scroll
#

Here's the issue.

#

When you stand right there, it's count as the player is in water

hexed hatch
#

Ah

summer scroll
#

and you can't teleport, because the entity tries to dismount

hexed hatch
#

Maybe just make a boolean method that gets the block at the player’s head and if it’s water, they’re underwater

summer scroll
#

when you teleport

hexed hatch
#

Ah

hexed hatch
#

Though I’m not too sure how efficient that method is, especially if it spams it whenever the user is underwater

summer scroll
#

that's the only way ig

hexed hatch
#

I’m struggling to think of alternative solutions lol

summer scroll
#

it may affect the performance too

hexed hatch
#

Yeah that’s what I meant

#

Perhaps you can just package this nifty little issue as a ✨feature✨

summer scroll
#

or just fuck it

#

you can't teleport while in water

hexed hatch
#

Exactly

summer scroll
#

okay it is working right now

hexed hatch
#

Bonus feature: water disables your ✨teleportation aura✨ or some bullshit

summer scroll
#

nvm

#

yea i think imma do that instead

#

thanks for the help

formal dome
#

anyone familiar with vscode here at all?

hexed hatch
#

For.. Java development?

stable ice
#

I looove the new rest api of spigot <3

ornate heart
#

how would i detect whether a player fills a glass bottle with water?

clear galleon
#

use getclickedblock() and hasitem()

ornate heart
#

getClickedBlock returns null if you right click water

clear galleon
#

well then i guess just get the item in their hand to see if is a bottled water

ornate heart
#

What if they have like multiple glass bottles. If I check their hand, it’ll still be a glass bottle.

tired ferry
#

if you click water with a bottle full of water, it empties. So it is safe to assume that a person holding a bottle of water that just clicked a water block, got the water from the block.

wet breach
#

@tired ferry don't bottles stack?

#

think their problem is when there is a stack of bottles

tired ferry
#

hmm good point. Because if you click with a stack of empty bottles, then it will just dump the full bottle in your inventory or on the floor.

wet breach
#

interesting we have bukkitfillevent

#

but no event for bottles unless it relates to the cauldron

tired ferry
#

odd

clear galleon
#

are you sure the block returns null? maybe getclickedblock().isliquid()

wet breach
#

the block shouldn't return null

#

could be a bug though

clear galleon
#

can i cast an offlineplayer to player without it saying there was an internal error

tired ferry
#

nope

clear galleon
#

no workaround?

tired ferry
#

what are you trying to do?

clear galleon
#

change scoreboard data of all players who joined

tired ferry
#

can you do it on login?

#

have some sort of persistent query?

clear galleon
#

mayb

wet breach
tired ferry
#

It may be better to just use Bukkit.getPlayerExact("name"); instead

wet breach
#

or just use the method in OfflinePlayer to see if they are online first before making the cast 😉

tired ferry
#

I believe Bukkit.getOfflinePlayer is more resource intensive

wet breach
#

Player extends OfflinePlayer

#

not sure how its more resource intensive o.O

tired ferry
wet breach
#

Ah right, well I didn't suggest getting a player by their name 😛

tired ferry
#

Just as a habit, I stay away from that method ¯_(ツ)_/¯

clear galleon
#

oh wait does .getplayer() work only if they are online

wet breach
#

Yes, because its only when the player is online is there a Player object for them

#

otherwise you have to do .getOfflinePlayer();

#

there is a method from OfflinePlayer to check if they are online

formal dome
#

hey which one of these is the proper .jar file

maiden thicket
#

for what

#

a server?

#

if you want to use the latest spigot for your server you have to compile buildtools yourself

formal dome
#

oh i think im confusing myself, i want to use the api to call org.bukkit libraries. is that all containted in the spigot.jar file?

hardy swan
#

yes

#

the spigot.jar that you build with buildtools

wet breach
#

bukkit-1.11.2-R0.1-20170514.012224-124.jar Sun May 14 01:22:24 UTC 2017 930834
this one @formal dome if you are using maven, maven will pick the appropriate version automatically

sage depot
#

OH BRUH

opal juniper
#

My man got the red string of death

quaint mantle
#

There is PersistenseDataContainer for blocks?

#

i wont use metadata

#

because it resets with /reload/restart

tame coral
#

If the library is separated in a lot of files, just add to your project the classes you need

#

Is the library open-source ?

quaint mantle
#

add in pom.xml

tame coral
#

Then just go on the git repository and download the files you need

#

and paste them in your project

#

Which library it is ?

sage depot
#

why no work what should i do to get player name

lone sandal
#

Hi im having an issue with my GUI and I cant seem to find a solution to it. Is there an inventory event that i can cancel when the player moves an item to the inventory from their hotbar by pressing 1

sage depot
#

gib me a munite

#

10s google search

tame coral
sage depot
#

disable_inventory_movement: true

tame coral
#

?

sage depot
#

scroll up

tame coral
#

Oh this

tame coral
#

I have no idea sorry

sage depot
#

ok

tame coral
#

Is this a yml file ?

sage depot
#

yes

lone sandal
#

ok thanks

tame coral
#

How are you using it to make the thing appear in the inventory ?

sage depot
#

no

#

am remaking hypixel for cracked players

tame coral
#

This doesn't answer to my question

tame coral
#

I see

sage depot
#

ok

daring sierra
#

That's dumb.

#

and piracy

lone sandal
#

@tame coral, somehow the event isnt being triggered?

#

Another possible issue that I can't seem to solve for some time now is, if the player has an item in their slot (0 for example, first slot) and they were to move their mouse on the inventory above and click the number 1 on their keyboard to move the item, no event would be fired (not sure if I remember correctly, perhaps InventoryClickEvent is fired but no information is given or no valid information so as to what click it was and what items were moved etc). So I solved this issue by checking the event#getInventory() and then canceling the event.

#

this is the event im trying to capture

tame coral
#

Hmmmm

#

So InventoryMoveItemEvent isn't being triggered ?

#

That's weird

sage depot
daring sierra
#

Piracy = Illegal

sage depot
tame coral
#

Still is illegal

daring sierra
tame coral
#

And hypixel can sue you for this i guess

daring sierra
#

no it isn't free trial

lone sandal
sage depot
#

for people who have potato pcs and who donthave money for premuim minecraft

lone sandal
#

do you mean set cancelled true?

sage depot
daring sierra
#

Just get a gift card at the store

#

Like goddamn buy the game

#

ffs

sage depot
#

do you want players to move thier inventory or no

#

could you explain

tame coral
#

So the event you're using is InventoryMoveItemEvent ? @lone sandal

lone sandal
#

no, cancel event where players move item from their inv to the chest inv

tame coral
#

(just making sure)

lone sandal
#

but still no

tame coral
#

yeah i see

sage depot
lone sandal
#
    @EventHandler
    public void move(InventoryMoveItemEvent event) {
        System.out.println("asdf");
        InventoryHolder holder = event.getDestination().getHolder();
        if (holder instanceof HelpGUI || holder instanceof LotteryGUI || holder instanceof ConfirmGUI) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void test(InventoryCloseEvent event) {
        System.out.println("close");
    }
}```
#

inventory close is triggering properly (was used as test)

sage depot
#

im out

tame coral
#

I see

#

Wait

#

Are you in creative mode ?

#

The fired event might be InventoryCreativeEvent in this case

lone sandal
#

nope still not triggering

tame coral
#

Hmmm

#

Try with a more global event such as InventoryInteractEvent

#

Or even InventoryEvent and you print the event type in the console

sage depot
#

anyone help-server is inactive

tame coral
#

Dude just be patient

lone sandal
#

Ok to my surprise both InventoryInteract or InventoryEvent are not triggered at all

tame coral
#

Hmmm

#

That's really weird

chrome beacon
lone sandal
lone sandal
#

havent tried inventory drag

tame coral
chrome beacon
#

InventoryClickEvent does work just fine

tame coral
#

Yeah it should work

#

InventoryAction
getAction()
Gets the InventoryAction that triggered this event.

chrome beacon
tame coral
lone sandal
#

currently im getting the invview, check topinventory if it has a custom holder

tame coral
#

What do you mean by correct inventory ?

lone sandal
#

i only want the event to be cancelled if the player is opening a gui from the plugin

tame coral
#

Hmmm

#

From your plugin ?

#

Like did you do the GUI yourself or are you using a plug-in such as deluxehub ?

lone sandal
#

my plugin

chrome beacon
#

Just getView and then getTopInventory should work just fine

tacit drift
#

does loadbefore still work in plugin.yml?

tame coral
chrome beacon
tacit drift
#

thx

tame coral
keen kelp
#

I can't use ProtocolLib's javadoc

tame coral
#

yeah it's buggy

keen kelp
#

its search function is disabled

#

it says some shit about javascript being disabled

tame coral
#

the javascript doesn't work properly

chrome beacon
#

You generally don't need their Javadoc

keen kelp
#

despite other javadocs' working

chrome beacon
#

What are you trying to do

keen kelp
#

Im trying to Modify Players' data before it get to the player

chrome beacon
keen kelp
#

It's just to learn how to work with ProtocolLib

tame coral
#

I see

keen kelp
#

since I will need it in the future

tame coral
#

Can you be more precise please ?

chrome beacon
tame coral
#

like a clear example on what you want to do

keen kelp
#

Currently what Im trying to do is:
Make every player's name random

keen kelp
#

like just random numbers

#

I mean I would prefer to make them all Josh but

tame coral
#

Do you want every player to have the same name or nah ?

keen kelp
#

I dont think minecraft likes players with the same name?

chrome beacon
#

It can

keen kelp
#

but if it can, I would prefer that

tame coral
#

Yeah you can

chrome beacon
#

There are rare cases of multiple vanilla accounts with the same name

keen kelp
#
protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.addPacketListener(new PacketAdapter(this,
                ListenerPriority.NORMAL,
                PacketType.Play.Server.PLAYER_INFO) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
                    PacketContainer packet = event.getPacket();
                }
            }
        });
#

here's what I have so far

tame coral
chrome beacon
#

Cool now open the PacketWrapper github page

#

That I sent above

keen kelp
#

man frick kio

#

it's making me unable to open discord links

chrome beacon
#

rip

keen kelp
#

have to drag and drop it

chrome beacon
#

Anyway once you get that open copy WrapperPlayServerPlayerInfo in to your plugin

keen kelp
#

wat

chrome beacon
#

Any now you can use that to easily modify data

keen kelp
#

I feel like I took a nap in math class

#

so do I like import this into my project or

chrome beacon
#

Actually let's make this easier for you

#

Are you using Maven

keen kelp
#

Gradle

chrome beacon
#

Do you have the Gradle shade plugin

tame coral
keen kelp
#

If it's not there by default, no

tame coral
#

This file in particular

chrome beacon
tame coral
#

You can add it with maven ?

#

I didn't know that

keen kelp
#

do i like add it in the same way I add ProtocolLib and Spigot?

tame coral
#

But still, wouldn't maven add every wrapper ?

sage depot
#

what is local opened = true in javascript the first one is lua

keen kelp
#

whats its maven link

chrome beacon
keen kelp
#

thanks

#

cool, no error so far

chrome beacon
keen kelp
#

for if I like want to include it in my plugin?

chrome beacon
#

Yes

keen kelp
#

actually I would want that

#

since most people has ProtocolLib but not whatever this is

tame coral
#

So after this you can just do

WrapperPlayServerPlayerInfo wrapper = WrapperPlayServerPlayerInfo(event.getPacket());
List<PlayerInfoData> data = wrapper.getData();
// do thing with data here
wrapper.setData(data);
event.setPacket(wrapper);
keen kelp
#

wait so do I just drop the plugin line in?

chrome beacon
#

Paloys one step at a time

#

I'll help here

tame coral
#

Yeah sorry

keen kelp
#

thanks

#

so if im understanding correctly

#

I replace compileOnly or whatever with shadow

chrome beacon
#

Yes

keen kelp
#

do I need to run shadowJar then

chrome beacon
#

You also want to use the relocation guide and minimize guide

#

Since you don't need a bunch of useless classes

keen kelp
#

bruh why do I have gradle 5.6.1

#

what's the newest rn?

chrome beacon
#

7

keen kelp
#

7.0.1?

chrome beacon
#

Yeah

#

oof It's 7.1

keen kelp
#

7.1.0?

chrome beacon
#

Just 7.1 if you look at their release page ;/

keen kelp
#

lmao the file name is 7.1

chrome beacon
#

Yeah

keen kelp
#

Could not find com.github.dmulloy2:PacketWrapper:master-SNAPSHOT.
why is snapshot included in the first place

#

shouldn't it juse be :master?

#

well at least it works now

#

now how does one modify packets

chrome beacon
#

Alright now open your packet listener

keen kelp
#

which is just main :P

#

anyway now what do I do within the event

keen kelp
#

k

chrome beacon
#

Copy this in to your event

#

Now you want to modify the player data

tame coral
#

(and do what you cant to do with the data)

keen kelp
#

did you forget new?

chrome beacon
#

Yeah

keen kelp
#

WrapperPlayServerPlayerInfo wrapper = new WrapperPlayServerPlayerInfo(event.getPacket());

chrome beacon
#

Yes it's supposed to be new there

keen kelp
#

also do I like cast it in the end?

#

cause setpacket expects a PacketContainer

#

and you gave it that long thing

tame coral
keen kelp
#

Required type:
PacketContainer
Provided:
WrapperPlayServerPlayerInfo

tame coral
#

(Mostly coded in python recently)

keen kelp
#

the auto thing suggests me to use PacketContainer.fromPacket

tame coral
#

No

keen kelp
#

so what do

tame coral
#

Do wrapper.sendPacket(player);

#

wait

#

wait

#

wait

keen kelp
#

but we dont have a variable named player?

tame coral
#

wait a sec please

keen kelp
#

ok

chrome beacon
#

To get PacketContainer

tame coral
#

sendPacket just send a new packet, my bad

keen kelp
#

yeah it's setPacket

#

ok Imma try now

chrome beacon
#

so event.setPacket(wrapper.getHandle())

tame coral
#

event.setPacket(wrapper.getHandle());

#

Yeah

keen kelp
#

the task is called build right

#

I forgot

#

:P

tame coral
#

?

chrome beacon
keen kelp
#

oh ok

#

looks like some more fucky wacky

chrome beacon
#

Yeah you need to filter that out

#

Don't forget to relocate

#

and minimize

keen kelp
#

wat

#

how does one do all of that

keen kelp
#

ok thx

keen kelp
#

so what do I do here, I get the premise of it but what do I actually do

#

and where in build.gradle do I put shadowJar or does it not matter

chrome beacon
#

It needs to be in the shadowJar

#

You want to move PacketWrapper somewhere else and then minimize that

#

This will stop conflicts with other plugins shading it and it will lower file size

keen kelp
#

so from what I am understanding

#

the plugin.yml inside PacketWrapper is conflicting with mine?

chrome beacon
#

Yeah

keen kelp
#

ok so this is my build.gradle rn

#

I need to move the shadow ' ' thing away

#

and minimize it?

chrome beacon
#

?paste

undone axleBOT
keen kelp
chrome beacon
#

So what you want to do first is create a shadowJar section

keen kelp
#

where

#

if it matters

chrome beacon
#

Just in the root part

#

Not inside anything

keen kelp
#

like does the order matter

chrome beacon
#

No

keen kelp
#

oh ok

#

now?

chrome beacon
#

So inside that add use exlude to remove file that you don't want

#

Like the plugin.yml

#

exclude 'plugin.yml'

#

I really hope this doesn't remove your plugin.yml too

keen kelp
#

so now whenever a jar is shadowed, no plugin.yml is included

#

is what Im getting from this

#

and what about the minimize thing

#

do I just throw that in

chrome beacon
#

Anyway use exlude to remove the other plugin.yml not your own

keen kelp
#

shadowJar {
exclude('plugin.yml')
minimize()
}

chrome beacon
#

Yes

#

If you have any API or unsed classes inside of you own plugin that you need to keep

keen kelp
#

same error

chrome beacon
#

What error?

keen kelp
chrome beacon
#

That will be removed when we relocate

#

Don't worry

keen kelp
#

but it doesn't let me run shadowJar

#

bc of this error

chrome beacon
#

Yeah wait until we add the relocation

keen kelp
#

oh ok

chrome beacon
#

relocate 'com.comphenix.packetwrapper', '<Your cool package>.packetwrapper'

#

Add that

#

And replace it with your package

keen kelp
#

oof strings

#

no autocomplete for me

chrome beacon
#

Well just copy your package shouldn't be hard

keen kelp
#

relocate('com.comphenix.packetwrapper', 'hk.eric.hidename')

#

so like this

chrome beacon
#

Don't forget .packetwrapper

keen kelp
#

shadowJar {
relocate('com.comphenix.packetwrapper', 'hk.eric.hidename')
exclude('plugin.yml')
minimize()
}

#

oh right

chrome beacon
#

Yeah that looks good but we might have to do something about that exclude

keen kelp
#

yep youre right

#

still the thing

chrome beacon
#

Do you have a github page with the project that I can test with because this is the first time I'm doing this too

#

;/

tame coral
#

You're having trouble with adding dependencies in gradle ?

keen kelp
#

ehh

#

no?

#

I just created this b* like an hour ago

chrome beacon
chrome beacon
#

?

keen kelp
#

how does one zip something on linux XD

#

wait nvm got it

#

dmed

#

wait a minute

#

discord finally fixed it

#

poggers

chrome beacon
#

Cool

tame coral
keen kelp
tame coral
#

Oh ok my bad

dry beacon
#

I've got a pretty basic question, for some reason my package dev.stan.mc in my main class shows up underlined and the fix is to configure the build path, does anyone know what specifically should I configure to fix this? Some imports aren't working as well which is happening to me for the first time

weary geyser
dry beacon
#

?

tame coral
#

You should rather use Intellij than eclipse

weary geyser
#

^

tame coral
#

it has plug-ins for minecraft plugin devs

weary geyser
#

It will be way better

tame coral
#

It'll configure you the project without errors

dry beacon
#

I've been using eclipse since the beginning, I might switch, though for now I really need to fix this eclipse problem :/

weary geyser
#

Almost no-one uses eclipse, so almost no-one knows

tame coral
#

Yeah

#

You should look up on eclipse forums or in stackoverflow

weary geyser
#

He shows you how to set it up

fading lake
#

or invalidating your caches

#

but yeah if you're using java for plugin development, especially if maven/gradle is making an appearance, you should use IntelliJ

quaint mantle
#

maybe try naming your package: com.whateveryouwant.yourprojectname

tame coral
#

I never heard anything about maven or gradle, i installed intellij and Minecraft dev plugin, and here i am coding a plug-in

#

i just click the build button and it works perfectly

quaint mantle
#

yeah, Maven and gradle are just confusing to me

wet breach
quaint mantle
#

i prefer just using a regular java project

fading lake
#

maven and gradle are just build managers that stop you manually installing dependent jars into the plugin, if you go to big servers etc they'll probably force one of them, its a good skill to learn @quaint mantle @tame coral

quaint mantle
#

I have an issue that I cant fix no matter what

fading lake
#

?

quaint mantle
#

it includes onPlayerJoinEvent and .setGameMode

fading lake
fading lake
tame coral
#

Yeah i have time to learn anyway

tame coral
#

like

#
  1. what do you want to do
  2. what have you tired
quaint mantle
#

@EventHandler
public void onJoin(PlayerJoinEvent event) {
if (started == true) {

        event.getPlayer().setGameMode(GameMode.SPECTATOR);
        
    }
    else if (started == false) {
        
        
        
    }
fading lake
#

he's one if the 'ask to ask' coders, he'll get there lol

fading lake
#

dont do started == true/false

quaint mantle
#

the problem is that when a player joins, there not set to spectator

wraith rapids
#

started == false will always be false if started == true is true

tame coral
#

@EventHandler
public void onJoin(PlayerJoinEvent event) {
if (started) {

        event.getPlayer().setGameMode(GameMode.SPECTATOR);

    }
    else {



    }
quaint mantle
#

even if started == true

wraith rapids
#

if (started) {

} else [

}

fading lake
#

can you print the value of started to see if its actually started

#

or the event is actually running

#

cause it may not have registered

tame coral
#

Did you register the event ?

quaint mantle
#

ok ill try that

#

wait, how do you register an event?

tame coral
quaint mantle
#

ok

fading lake
#

Bukkit.getPluginManager(listener, plugin)

#

no it isnt

#

Bukkit.getPluginManager().registerEvents(listener, plugin)

#

listen i haven't slept yet please

tame coral
#

Lol don't worry

#

what time is it in your timezone ?

fading lake
#

BST

#

10:58

tame coral
#

You did a all-nighter ?

#

Damn

fading lake
#

yeah, UI stuff is too tedious and addictive

tame coral
#

I see

#

You should get some rest

summer scroll
#

It seems like teleportation got cancelled if the EntityDismountEvent got cancelled, how can I make the player got teleported even tho there's a passenger.

fading lake
#

I'm in college until 17:00 so that's gonna be a difficult task

wraith rapids
#

you can't teleport entities with passengers

opal juniper
#
private Map<String, String> sendAllTranslations(Map<String, Set<UUID>> languageCodes, String message) {
    Map<String, String> messagesPerLocale = new HashMap<>();
    for (String language : languageCodes.keySet()) {
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            String translation = this.getTranslationForText(message, language);
            messagesPerLocale.put(language, translation);
        });
    }
    return messagesPerLocale;
}

I have a method that looks a little bit like this. how can i wait until all the async tasks are completed before returning the map?

(Im probs being stupid 🙃 )

fading lake
#

eject the passengers, teleport the passengers too and remount them?

summer scroll
#

because passenger will keep trying to dismount on water

wraith rapids
#

iirc you need to wait 1 tick in between teleporting and remounting

summer scroll
#

and i cancel the event

wraith rapids
#

or otherwise the client gets pissed

fading lake
opal juniper
#

Yeah but that is gonna get a bit messy afaik

fading lake
#

Its the best way afaik :( Future#get forces the thread to lock until the other bit is done

wraith rapids
#

don't use the bukkit scheduler for that

#

asynchronous tasks too are only started at the beginning of a tick

opal juniper
#

Aww but it was such an easy solution that mostly worked 😦

summer scroll
wraith rapids
#

which means that your execution could be delayed by up to 50ms

#

which is undesirable

#

use CompletableFuture.supplyAsync or something

opal juniper
#

i mean - before i used async the whole thing was 12 seconds so 50ms wasn't an issue

#

ill have a look at java async

fading lake
#

It really depends on if you're happy to wait the possible 50ms

wraith rapids
#

there is no need to wait the possible 50ms

#

there is no advantage to using the bukkit scheduler

#

and if you're waiting for the futures in like the async chat event, that will deadlock the server when a plugin compels a player to chat

#

as the next tick will not be reached until the future is complete

#

and the future will not be complete until the scheduler fires the task

#

and the scheduler won't fire the task until the next tick starts

#

as when a plugin compels a player to chat, the async chat event is actually fired on the main thread

#

which means your .get is going to block the main thread, and consequently halt the scheduler

fading lake
#

oh woops didn't spot the event, @opal juniper ignore me

wraith rapids
#

idk if he's using the event but based on what he's doing, he probably is

fading lake
#

prob, either that or its a plugin response message translator

opal juniper
#

Sorry - I just got back

#

It is on the asyncChatEvent

fading lake
#

ah, ignore me then

wraith rapids
#

yeah, you don't want to block that while waiting for the bukkit scheduler

opal juniper
#

So there can be up to 24 languages to translate to

#

Fair enough

summer scroll
#

I'm trying to teleport player, but I can't because the EntityDismountEvent is being cancelled.

wraith rapids
#

make the entity dismount event not get cancelled

opal juniper
#

Do I have to keep track of all the potentially 24 completable futures?

summer scroll
#

If the passengers enter the water, they will got dismounted and I don't want that.

wraith rapids
#

then make it only get not cancelled when you're teleporting

summer scroll
#

So I cancel the event, and because of that I cannot teleport the player that is in water.

fading lake
#

dont use futures @opal juniper ignore what I said

summer scroll
#

How can I check that?

wraith rapids
#

futures should be fine

fading lake
#

right so I'm going to shut up

summer scroll
#

I wish there is dismount cause.

wraith rapids
#

just don't want to supply them via bukkit scheduler

#

cause that's going to explode

fading lake
#

you can apply futures from the scheduler?

wraith rapids
#

well i mean he basically was

fading lake
#

ah

wraith rapids
#

not like directly, but scheduling an async task that explicitly completes a future

fading lake
#

oh I see

summer scroll
wraith rapids
#

check which event fires first

summer scroll
#

The PlayerTeleportEvent doesn't even got called.

wraith rapids
#

do you need to support other, unknown teleport causes

#

or only teleports fired from your plugin

summer scroll
#

I'm using essentials /tp command.

wraith rapids
#

so other, unknown teleport causes

#

that will be difficult

summer scroll
#

The teleport event doesn't got called at all.

wraith rapids
#

you'd have to like grab the stack trace and figure out whether it's caused by teleporting by looking at the stack

#

on newer java versions you'd want to use like a stack walker or something as getting the entire stack trace is kind of expensive

summer scroll
#

oh god

wraith rapids
#

alternatively you could use a custom entity type and implement it so that it doesn't try to dismount in water

#

i don't remember whether the dismount logic is in the passenger or the vehicle, so I'm not sure if that's doable

#

you could, uh, not cancel the dismount event, then drop the packets that are sent when the entity is dismounted, and remount it later

summer scroll
#

i've been stuck for 6 hours trying to solved this problem

wraith rapids
#

or, if the player got teleported, not remount it, and send those packets

#

alternatively alternatively, just spoof the whole entity via protocol and don't have it exist on the server to begin with

#

that way it won't try to dismount

#

you might need to manually unmount and remount it in the teleport event though as iirc the client gets pissed if you try to teleport it while mounted

summer scroll
#

but i can't do that if the player/vehicle is in water

wraith rapids
#

sure you can

summer scroll
#

on teleport, i dismount and then remount the entity

wraith rapids
#

the issue is that the entity exists

#

which means the entity is going to try and dismount in water