#help-development

1 messages · Page 1126 of 1

carmine mica
#

yeah, I think that would be appropriate

#

AnvilInventory and really all the non block entities should only be obtainable from the correct subinterface of InventoryView, AnvilView#getTopInventory() returns an AnvilInventory, BeaconView#getTopInventory() returns BeaconInventory, etc.

river oracle
#

after my initial MenuType PR is merged I'm going to work on moving forward with introducing a more advanced MenuType API and what you proposed. I really don't see an issue with it tbh

#

A little bit of education and proper documentation with the replaced methods will go a long way here

carmine mica
#

To handle custom names, there really should be a paramter added to the openInventory method that takes a custom name. The name is only part of the open packet

river oracle
carmine mica
#

I think the name of a chest inventory comes from the name of the block, so could set it that way, but its really unintuitive to do like Chest#setCustomName("name")

sly topaz
#

if it comes to this, it would be nice to have an utility method like ItemType#createInventory if applicable (that is, the ItemMeta is BlockStateMeta and it is a TileState/InventoryHolder?)

river oracle
#

it applies to too few blocks for a shorthand to make sense imho

#

I was going to say the same thing but really how often would it be used

sly topaz
#

it would be more common for the people moving over this new way of doing it though

#

though that would also mean they would try to create shareable inventories by accident, given most people actually want inventory views anyway

river oracle
#

also some blocks that have an "inventory" wouldn't "work"

#

I think it'd cause confusion

#

e.g. someone might try BlockType.Anvil.createInventory

#

and complain oh that doesn't work, when in reality they just don't understand ItemType.Anvil has no inventory

sly topaz
#

yeah, I can see people thinking it would work the same as the current Bukkit#createInventory when it really wouldn't

river oracle
#

I have so many big PRs on my plates honestly the thought of not really having to do much but write some extra docs makes me happy.

carmine mica
#

incidentally, this is now a GREAT way for people to identify inventories. Add some PDC to the tile state, check the inventory holder's PDC

#

cause the inventory's holder will be a Chest or a Barrel or smth, and those can have PDC

#

all this should already be possible, its just about telling people to use it instead of InventoryType

sly topaz
#

would be nice if BlockInventoryHolder had direct access to the PDC

carmine mica
#

no, its not gonna be that

#

oh nvm thats in the inheritance tree, but you want TileState, not that

sly topaz
#

I mean, is there a difference

carmine mica
#

yes

sly topaz
#

are there any block inventory holders that aren't tile states?

carmine mica
#

composters (in spigot)

sly topaz
#

oh forgot that was even a thing

carmine mica
#

lots more in paper cause spigot doesn't use them correctly

river oracle
#

yet another thing on my checklist 🥲 getHolder without the snapshot

#

can't decide in which order to do stuff

sly topaz
river oracle
#

we'll see if it ever happens kekw

sly topaz
#

or do you mean because it is still experimental

river oracle
#

its like we like half did it

#

and decided nahhh

#

I have no clue why or what the reasoning was

#

Commodore rewrites can always be improved as far as performance goes later, they're slow as fuck right now but like if you wanna maintain compatibiliy 🤷‍♂️

sly topaz
#

oh it is marked as @Internal

river oracle
#

yeah.... :(

#

Once ItemType gets added, I'm going to try to remove Bukkit ItemStacks

#

Another big PR I have planned is removing Recipe classes

sly topaz
#

what's wrong with them

river oracle
#

the API shouldn't have classes like that

#

it should delegate to builders

sly topaz
#

it's been forever since I looked at the recipe stuff, I did always know it was kind of a mess though

river oracle
#

it makes adding API for recipes a pain in the ass

#

vs adding a builder method you need to add constructor legacy support and so on

carmine mica
#

don't need ItemType to do that

sly topaz
river oracle
#

if its already legacy less I have to worry abo ut

river oracle
oak orchid
#

I'm curious to see if spigot or paper dies first with the exclusivity changes. i cant wait for my 20th year of plugin development when im building for WoodenSpout, the 3rd fork of paper finally fusing with the 2th fork of spigot

river oracle
#

I'm just writing all my janky inexperienced code upstream from you 😂

carmine mica
river oracle
#

I'm trying not to have too many PRs open at once

#

its annoying to rebase like 10 big PRs when they take ages to get merged anyways

sly topaz
#

I don't think either platform is going to die just yet, though it depends on the rate Spigot gets more contributors, Paper struggles on this part too

#

not in the getting more but rather, managing all of them would be better to say lol

oak orchid
#

Also the popularity contest. One major plugin getting popular could make one be favored over another

sly topaz
#

then again, if they ever hard-fork I do wonder how many people will stick with Spigot or Paper will suffer the same fate as Sponge

oak orchid
#

It won't die soon or fast, I'm not that worried

sly topaz
river oracle
sly topaz
#

more so with a software like Minecraft server platforms where people seem to be scared to even touch the codebase with all the patching shenanigans

river oracle
#

which I can't really critisize anyone for if its already fixed why spend the time?

#

but idk I just find it more enjoyable to use this software and change what I don't like

river oracle
sly topaz
#

if anything it helps one to git gud

river oracle
#

I'm still not a great dev I've simply graced the top of the coding iceberg

#

I think if I could allocate all the hours in my day to coding and getting better at it I would

#

I have a love so deep for learning that doing monotinous plugin development is boring

#

I rather be learning networking or something kekw

#

or atleast work on my java weak spots like ASM or heavy multi threading

umbral flint
river oracle
#

I wanna learn more about packets sending etc

umbral flint
#

We basically just learned about all the OSI layers

#

Kind of in depth

#

The course had cyber security in it, but it was just setting up passwords for Cisco switches and routers

umbral flint
river oracle
#

isn't a proto buffer just send stuff locally over a port

#

that's a fairly simple project no?

umbral flint
#

Not necessarily

#

Maybe

#

Hm

#

I'm pretty sure they're not restricted to the local network

river oracle
#

then that's more complex because you need proper encryption

#

since you can't just load it out to be middle manned

umbral flint
#

I think it can be used for back end to back end communications

river oracle
#

if you handroll your own encryption I can think that'd be a decent project

#

when it comes to the base of byte communication tho its not that hard

umbral flint
#

What did you mean networking then

river oracle
#

Kinda mean higher level stuff vs the low level sockets

#

I probably couldn't handroll my own sockets though

#

so I could try that out

umbral flint
#

I met these developers who hand made their own protobuffer

#

They made a backend in Go to interact with the database

#

and would use a protobuffer to receive and build the data on the Java backend side

#

Yeah I still don't understand why they did all that

#

Team died in 5 days

#

They did all that because it was "more scalable"

wet breach
river oracle
#

those functions are insane

wet breach
#

well other then optimizations or thinking how slow or fast it will be the most difficult part is making it so that it can't just be cracked within a short period of time

eternal skiff
sullen marlin
#

Replied

eternal skiff
stoic tapir
#

hey, how can i check if a player is right clicking an item in their inventory?

dapper flower
mellow edge
#

is it legal to copy paste original functions from ender dragon code in spigot 1.8 where the code is obfuscated and uses SPIGOT mappings because I can just paste the whole code and modify it to my likings

sullen marlin
#

though thats more the other way

dapper flower
#

so better straight up have a class that handles that no?

sullen marlin
#

yeah your runTaskAsync method seems fine

dapper flower
#

alright ty

hybrid turret
#

How do I specify the Audience for MiniMessages (Adventure)?

#

i can't find anything for spigot :(

tall dragon
hybrid turret
#

yea

tall dragon
hybrid turret
#

oh yea

#

Spigot is basically bukkit

#

right

#

thanks

tall dragon
#

yeaa

#

it is

hybrid turret
# tall dragon it is

Do I shade adventure in my plugin or do i have to add the plugin to my dependencies and download a release?

eternal night
#

shade

tall dragon
#

its kind of a dilemma for me. cuz paper servers don't require it

slate siren
#

heyy

#

Connection Lost
Internal Exception: io.netty.handler.codec.DecoderException: com.google.gson.JsonParseException: Don't know how to turn
{"extra":[{"color":"yellow","clickEvent":"action":"run_command","value":"/friend list 2","text":"Next Page >"}]} into a Component
Back to server list

#

wth is that

drowsy helm
#

That click event doesnt look right

slate siren
#

yea

#

1m

#

?paste

undone axleBOT
slate siren
#

all

#

code

#

@drowsy helmhere

drowsy helm
#

Try and comment out the setClickEvent for a sec and see if it still happens

#

It’s giving invalid JSON

slate siren
#

okay ill testing

#

its same error

halcyon hemlock
#

guys

#

no way?

#

how

#

is this possible

#

im legit like

#

this gotta be like

#

naww

tardy delta
#

...

tender shard
#

lol

halcyon hemlock
#

he lost 250 pounds

#

apparently

#

its fucking crazy

sleek dune
#

Hey is there any better way to get nearby players?

public List<Entity> getNearbyPlayers(Player player, int range) {
        return player.getNearbyEntities(range,range,range).stream().filter(player1 -> !player1.hasMetadata("NPC")).toList();
    }```
quaint mantle
tardy delta
#

?

sleek dune
#

It does not take supplier as a parameter

tardy delta
#

huh

sleek dune
#

*Prediate I mean

sleek dune
#

I'm using spigot 1.17

#

but thanks

tardy delta
#

dunno what was added when

young knoll
#

Pretty sure it was in 1.17

#

Maybe not the predicate tho

halcyon hemlock
#

does anyone need of the helping

sleek dune
tardy delta
#

vulnerabilities, amazing innit

sleek dune
#

Anyways, I think this will do

public List<Player> getNearbyPlayers(Player player, int range) {
        return player.getNearbyEntities(range, range, range).stream()
                .filter(entity -> entity instanceof Player &&
                        !entity.hasMetadata("NPC"))
                .map(entity -> (Player) entity)
                .toList();
    }```
tardy delta
#

.map(Player.class::cast)

#

if you want it fancy

sleek dune
#

Didn't know that

#

thanks

halcyon hemlock
hasty hamlet
tardy delta
#

idk probably tries to optimize it to as chunk local

hasty hamlet
tardy delta
#

would have to look at nms

halcyon hemlock
#

YIKES!

#

or wait

#

its using some bounding box stuff

#

so it is optimized?

tardy delta
#

does not imply any of that

blazing ocean
tardy delta
#

idk look at nms

halcyon hemlock
#

could you hyphothetically load 3d models with block entities?

blazing ocean
#

yes

young knoll
#

It does do some chunk stuff iirc

#

Entities are stored per chunk anyway

halcyon hemlock
#

when they move their chunk status is changed then?

young knoll
#

Afaik yeah

halcyon hemlock
#

is that good or bad? i mean its prolly good

#

better than looping through every alive entity right?

young knoll
#

Yeah

halcyon hemlock
#

i should implement that

#

in my server

tardy delta
#

implement what

sleek dune
#

is it possible to get nearby players in AsyncPlayerChatEvent ?

young knoll
#

Not async afaik

sleek dune
#

I've tried it but I get this exception:
java.lang.IllegalStateException: Asynchronous getNearbyEntities!

young knoll
#

Yeah

#

You’d need to do it sync in a runTask

#

But that would be after the event

slender elbow
#

i mean if you need to mutate the event from the sync task, you'd use the sync PlayerChatEvent instead

slate siren
#
                TextComponent nextPage = new TextComponent(ChatColor.translateAlternateColorCodes('&', "                                                                    &8[&d&m─>&8]"));
                nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/friend list " + (page + 1)));
                nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{new TextComponent(ChatColor.YELLOW + "Go to next page")}));
                navigation.addExtra(nextPage);```
#

Here is a code and a new page appears on each click on the friends list.

#

Is it possible to disable the clicking action on the previous page when a new page appears?

#

There was a method but I forgot it

drowsy helm
#

That would be in your command logic

#

Just use a session id

slate siren
drowsy helm
#

Just make the command use a session id as argument, keep track of the session id and invalidate it once it’s used

stuck oar
#

anyone know why my intellij is saying it doesnt know what JavaPlugin is

drowsy helm
#

Are you using maven?

#

And have you run bt

sleek dune
slate siren
#

?paste

undone axleBOT
wraith dragon
#

Guys what would be good usecases for redis?

hazy parrot
#

cache

#

messaging

#

database

wraith dragon
#

Hmm, would it be a good idea to put minigame data on it?

#

Heard it's pretty dang fast since it uses memory for storing of data

chrome beacon
#

What minigame data do you want to store on it?

timid spear
#

I want to detect, if a player jumped / pressed space bar. But PlayerJumpEvent does not exist anymore 😦

How can I overcome that

chrome beacon
#

You can use the statistic event

#

with the jump statistic

#

Do note that it can be spoofed by the client

timid spear
#

Any other way?

late sonnet
slender elbow
#

and how do you access that through the api

young knoll
#

We could do a PlayerInputKeyPressedEvent and PlayerInputKeyReleasedEvent

#

And of course Player#isInputKeyPressed

young knoll
#

What?

#

You got a problem sir

slender elbow
#

what if I'm using a controller and I am not pressing keys?

eternal night
#

What if I am on a trackpad

#

and just drawing shit

#

HM

young knoll
#

Okay?

#

Then you aren't pressing movement keys

pure dagger
#

how to check if player is hooked on fishing rod?

halcyon hemlock
young knoll
#

Still nothing

eternal night
#

what if I press some random key on my keyboard that maps to a mod

#

HMM

young knoll
#

It doesn't matter

#

Those aren't detectable

brazen badge
#
public static Map<String, Object> yamlKeyToMap(ConfigurationSection section) {
        Map<String, Object> map = new HashMap<>();

        section.getKeys(false).forEach(key -> {
            map.put(key, section.get("key." + key));
        });

        assert !map.isEmpty();
        return map;
    }

i've crated this method to put in map the key and value of the configuration section "key", but the keys are ok, but the values are null. How can i solve this?

#

{amount=null, material=null, lore=null}

eternal oxide
#

"key."+key is nto going to be the key

#

just key

#

map.put(key, section.get(key))

#

however you could just return section.getValues(true)

river oracle
lost matrix
river oracle
#

Just ship those over too

#

Just incase the server needs it

dapper flower
#

PotionData is deprecated and marked for removal however PotionType doesn' allow me to give a player streght 2+, work arounds?

dapper flower
#

2+ meaning strength like 3 4 5 100

#

strong stregth is strength 2

#

come on there is gotta be a way around this, i doubt someone woke up and said "why have potionData when we can hardcode everything into PotionType"

lost matrix
#

You can set as many custom effects on your potion as you want

young knoll
#

Those have to be custom yeah

lost matrix
#

You can even set any RGB color you can think of

#

setBasePotionType is really just a method to get exactly the basic potions

dapper flower
#

iirc potionMeta is for potion items only

lost matrix
#

Yes AreaEffectCloud also has a addCustomEffect method

dapper flower
#

better if i share some code for more clarity also

#

so for AreaEffectCloud i can use addCustomEffect, SpawnPotion looks deprecated

#

both Splash and LingeringPotion interfaces are deprecated

lost matrix
#

I would highly recommend you splitting that switch, case statement up into several methods...

dapper flower
#

and i see no method to add custom effect there

dapper flower
#

i didn't write most of that code lol

#

before it was worse

dapper flower
#

not for that

#

for thrown potions

#

splash ones

#

and lingering ones

lost matrix
#

Do you mean the actual thrown potion bottle entity, or the ItemStack in an Inventory?

dapper flower
#

the actual entity

#

oh wait

lost matrix
#

You can set their effects by passing in a modified potion via setItem(ItemStack)

dapper flower
#

ok yeah

#

ty

#

i would still have to check if it is a spash or lingering potion using instance of, still a better way to do it, unless there is way around that too

lost matrix
dark sail
#

Hello, does anyone know, how i make a chest look like a playerhead to make a "mini chest"?

lost matrix
dark sail
#

thank you

vagrant spear
#

I have a plugin that works on 1.20.4 (Java 17) but stops working once I update the server to 1.20.5 (Java 21). Is there a way I can change this to function on newer versions?

Here Is The Basic Console Output:
Enabling Plugin
Your Server Version Is Incompatible
Disabling Plugin

The plugin developer stopped supporting it a while ago and released the source code as well.

river oracle
#

you know what'd be sweet

#

an actual stack trace

#

@young knoll MenuType time 😈

#

twas merged now I can really start cooking

eternal night
#

✨ twas ✨

river oracle
#

did the forgotten ' trigger your grammar brain

eternal night
#

indeed I am hurt

river oracle
#

I figured as much

eternal night
#

time to upstream update it I guesss

dark sail
# lost matrix You would do it the other way around. Create custom behavior for your mini-chest...

mmhh, how do i store things in the skull?
i started like following:

class MiniChest(private val plugin: CraftedHorizonCBSystem) {
  
    private val communityChestInventory = plugin.server.createInventory(null, 54, "Community-Kiste")
    
    fun getMiniChest(player: Player) {
        val head = headDatabaseAPI.getItemHead("71810")
        val itemmeta = head.itemMeta
        itemmeta.setDisplayName("§6Community-Kiste")
        head.itemMeta = itemmeta
    }
}

is this the right starting? and how do i use the PDC? never did that before

river oracle
echo basalt
#

Make sure to do it every tick to see if they're installing cheating tools mid game

tardy delta
#

what do you even need the plugin for

#

to access the server?

halcyon hemlock
vagrant spear
river oracle
#

paper moment

#

and aternos

halcyon hemlock
#

and tcp

#

and java

#

and jvm

#

and binary

#

and cpu

#

and alu

#

and semiconductor

#

and transistor

river oracle
#

?whereami

river oracle
#

no transistors here

halcyon hemlock
#

:<

#

imagine using transistors in 2024 frfr

river oracle
#

frr

halcyon hemlock
#

outdated technology

vagrant spear
river oracle
#

ahh yess BerryByte

#

very common host

#

wtf is berry byte 😨

vagrant spear
#

Just another host, Basically Another Bloom

halcyon hemlock
#

flowberry juice

#

I thought he was talking about a byte array for some reason

vagrant spear
#

Is there a way to edit the source code to allow it to function on newer paper versions?

blazing ocean
#

wha-

#

?whereami

vagrant spear
#

oops

#

Lmao

kind hatch
#

And actually know how to update it.

#

Alternatively, you could commission someone to update it if you don’t know how to do it yourself.

tall dragon
#

does any1 here have a public example of a plugin util framework thats built as seperate modules? so like a gui framework, command framework

vagrant spear
#

Source Code Is Available and Ive been looking at it trying to understand what to update for a while, But thank you for the info

kind hatch
#

Is it on GitHub?

stuck oar
#

GrindingLevelManager glm = PL.getHashMap().get(player.getUniqueId()); anyone know why the return value of getHashMap() is null?

        return levelManagerHashMap;
    }```
kind hatch
#

levelManagerHashMap is probably null

#

Where does it get initialized?

stuck oar
#

private static HashMap<UUID, GrindingLevelManager> levelManagerHashMap;

hazy parrot
#

That is declaration

kind hatch
#

^

stuck oar
#

wheres the initialization part

hazy parrot
#

How could we know

river oracle
#

shouldn't you know that

stuck oar
#

probably

kind hatch
stuck oar
#

what would the initialization part look like

#

would it be in the GrindingLevelManager class or just in onEnable(0

river oracle
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

worthy yarrow
#

this.levelManagerHashMap = new HashMap<>; kek

stuck oar
#

ok so added that now lol

vagrant spear
kind hatch
#

You got a link to it?

vagrant spear
onyx fjord
#

can i somehow catch multiple entities with a raycast?

lost matrix
#

I dont think directly

kind hatch
slender elbow
#

you can start a new ray casting from where the previous one ended and filter out the entity that was previously hit

onyx fjord
#

im doing that except im duplicating the raycast with filter

#

but im getting a stackoverflow idk why

lost matrix
#

You can also check the angle of your ray and calculate the exit position to start a new cast from there. Thats how i created piercing arrows.
PS: Just realized that this might miss if two entites stand insitde each other and one entity has a hitbox which is completely engulfed in the
original entity. So starting a new one right from the hit pos and aggregating the Predicate makes the most sense.

lost matrix
onyx fjord
#

actually i messed up somewhere else

#

because i removed the loop and its still happening

lost matrix
#

The loop? ...

#

Ah right you could do it with a while loop

onyx fjord
#

yae and im breaking as soon as either cast or entity is null

#

im also adding the entity to a list and filtering based on that

kind hatch
stuck oar
#
        return levelManagerHashMap;
    }```

i got this to work and it worked fine but then i edited a different area of code and it decided to return null again anyone know why
#

private static HashMap<UUID, GrindingLevelManager> levelManagerHashMap;

#

this.levelManagerHashMap = new HashMap<>();

echo basalt
#

why is it all static

#

and poorly named

#

why isn't this just a dedicated class

strange falcon
#

atleast yall aint dumb like me

stuck oar
#

this is just in my on enable

#

the main class

lost matrix
#
  1. Dont make mutable objects static (especially not Maps, Lists, Sets etc)
  2. Never directly create getters for your collections. (Rather write code which mutates your collections instead of exposing them)
echo basalt
#

If you are making getters for collections make sure to return an immutable copy

#

And the only valid scenario for this, in my opinion, is either in debug code or encoding data

lost matrix
#

Yes, read-only views is the only thing you should hand out

stuck oar
#

nvm fixed it thanks

#

i was being dumb

#

it wasnt the hashmap that was null

#

it was the key

lost matrix
#

Nu uh, you better go back there and remove those static keywords.

stuck oar
#

but if i remove static on the getter it wont work tho?

#

i think

lost matrix
#

Ill let it slip for now, but the next project you create better utilizes dependency injection instead of making everything static.
Ill remember your name.

stuck oar
#

should i be worried to post here again

#

because i know full well its gonna be static

blazing ocean
#

yes

echo basalt
#

We are anonymous

#

we do not forgive

#

we do not forget

#

expect us

echo basalt
worthy yarrow
#

We’re tracking your location as we speak

kind hatch
#

@vagrant spear The code responsible for it not starting isn't even needed. :kek:
So it is an easy fix.

halcyon hemlock
#

good 2am everyone

kind hatch
sleek dune
#

Hey how can I detect armor stand break event? somehow BlockBreakEvent does not work

eternal oxide
#

AS is an Entity

sleek dune
kind hatch
vagrant spear
#

Ill try that to the best of my ability 👍

cedar saffron
#

say on skibidi

slate siren
#

?paste

undone axleBOT
safe furnace
#

Anyone knows why EVERY freaking NIGHT at exactly EXACTLY at 7:30 (19:30) PM when i play in minecraft servers It start lagging ping.. 2000 + sometimes and 12000 ms... I have good pc and i don't think thats problem..

#

by the way. my internet is good. i don't have any problem with that. also in other games is perfectly fine.. only freaking minecraft

lost matrix
#

Same server?

safe furnace
#

every servers.

#

I'll say that i tried to deinstall minecraft and installed feather client. that was the first night that i got like 20-60ms . sometimes 200ms. and then the next night same problem...

eternal oxide
#

likely your ISP altering routes to use cheap data at specific times

safe furnace
#

idk, it happens like the last 2 weeks??

eternal oxide
#

if its alway at teh same time its most likely your ISP

#

run a tracert at a good time and bad time

safe furnace
#

yep, it comes 7:30 th esame second 1k+ ping

safe furnace
#

ohh well wait a damn minute

#

I play 1.8.9 version now ( before 1.20.1)

#

Now my ping is good ?!?!

#

so i think is version problem??

vast ledge
#

Maybe the packet size changed?

eternal oxide
#

For it to happen at exactly the same time every day it has to be somethign thats triggering on your PC, IF launching a different version can fix it

safe furnace
#

yeah but what

#

i'll try now 1.18.3

vast ledge
#

You might be able to use wireshark

safe furnace
#

i'll need to download it and to test it? i have never been used that before

sage drum
#

Hi, i develop a plugin to create custom items. And i want to know, ToolComponent override Enchantements ? Because i have a item with efficiency 20 and it's work. But when i change de default mining speed in ToolComponent efficiency enchant doesn't work. I using 1.21

clear elm
#

how can i get a zombie spawner as a itemstacK
ItemStack spawner = new ItemStack(Material.SPAWNER); ItemMeta meta = spawner.getItemMeta();

pure dagger
#

how to check if player has fishing rod hook in them?

sage drum
upper hazel
#

AddItem not work

#

item not air

#

method work but in inventory item not exists

blazing ocean
#

?notworking

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.

dapper flower
dapper flower
upper hazel
#

method work but after adding item in player inventory item is not added (no errors just not added)

#

empty inventory

#

item just disappears

round finch
#

anyone who knows trick to where i can make a menu bar with text in an inventory

rough depot
#

Can someone of you guys please develope a plugin for me? A plugin that would make me unable to pick up items except mobdrops. I think it wouldnt be to much effort but i have no idea. If someone has a bit of time that would make me grateful

round finch
#

?service

blazing ocean
undone axleBOT
upper hazel
#

16 mb this big for simple plugin?

#

interact with gui and database

rough depot
blazing ocean
#

check pins in general then

nova notch
#

Sounds pretty simple

glossy laurel
#

org.bukkit.configuration.InvalidConfigurationException: Global tag is not allowed: tag:yaml.org,2002:org.bukkit.GameMode so uhm, spigot saves it and then cant read what it saved?

eternal oxide
#

what are you pushing to the config?

glossy laurel
#

one of them is a gamemode field

#

then I retrieve that config

#

change one value (not the gamemode one)

#

try to save it again

remote swallow
#

do you save to string or the enum value

glossy laurel
remote swallow
#

to string it

glossy laurel
#

when

remote swallow
#

before you save it

glossy laurel
#

I save it as a string?

#

alr

remote swallow
#

when you call set() set it as a string then load it with valueOf

glossy laurel
#

yeah ik how to

#

not sure whats the point of allat tho lol

#

ohh, is it because im saving null?

#

wait no

#

I aint even saving null

slender elbow
#

you can't save an Enum

glossy laurel
#

💀

remote swallow
#

none of the enum are config serializable

slender elbow
#

so you save the String of the enum

glossy laurel
grand scroll
#

why r like all enum classes missing on 1.21 spigot server

eternal oxide
#

update IJ and use java 21

grand scroll
#

updated ij so ig it’s a java issue

#

but i seem to remember trying that and it not working

gusty veldt
#

I have a task that absolutely 100% has to be done async, since it's fully blocking and will immediately crash the server if done on the main thread (if it matters it is a MongoDB change stream listener). Basically I'd like to somehow have the async thread say "hey something happened!" and the main thread say "okay!" and do stuff on the main thread in response.

My only idea for this is having a flag that is checked every tick by the main thread, so the async thread can set it and then the sync thread would know something happened. Is there a better way?

slender elbow
#

BukkitScheduler runTask

#

?scheduling

undone axleBOT
eternal oxide
#

callSyncMethod

#

or somethign like that

glossy laurel
#

but you cant access the main thread that way, no?

gusty veldt
#

nice thank you that looks like it'll work

#

unless it doesn't haha

slender elbow
onyx fjord
#

how would i either create or update a sqlite record based on data already existing or not

slender elbow
round finch
blazing ocean
grand scroll
#

sooo none the enums r there on latest spigot jar

#

and nothin seems to change that

eternal oxide
#

spigot jar?

grand scroll
#

server jar

eternal oxide
#

what build system are you using?

#

maven?

#

Gradle?

#

Artifacts?

grand scroll
#

maven w intellij if that’s what ur asking

eternal oxide
#

?paste your pom

undone axleBOT
young knoll
#

Make sure IntelliJ is updated

grand scroll
#

yh i did

#

unless I did it wrong or smt 💀

slender elbow
#

what version?

#

Help/About/Version etc

grand scroll
#

version of what

slender elbow
#

intellij

grand scroll
#

2022.2.5 ?

#

build #ic 222.4554.10

#

if that’s all the right numbers

gusty veldt
remote swallow
#

2022

#

you are 2 years out of date

blazing ocean
#

make sure to update ij
i have
2 years out of date

small hawk
#

💀

slender elbow
#

yeah current version is, like, 2024.2.1 or something

round finch
young knoll
#

What

blazing ocean
#

yeah just what

rough drift
#

vollx absolutely stoned rn /hj

round finch
#

when brain stopping braining

blazing ocean
#

what

#

how is that related to getSlotsClicked

grim hound
#

If you make a variable, that's non-volatile and update it from one thread, what defines when other threads will see that change?

rough drift
grim hound
#

Of course it will

#

That's why I'm asking

rough drift
grim hound
#

I've observed it many times

rough drift
#

or well, better: It is not guaranteed for the update to be able to be seen by other threads

grim hound
#

Yes, this part

#

"Guaranteed"

#

Where does this probability come from?

rough drift
#

the JIT may optimize it away or optimize things because it knows it shouldn't be altered by other threads, the JVM itself may just not allow for other threads to change it or may even make different copies per thread, it's up to the JVM if you don't define volatile

grim hound
#

Well I'm asking, because I've forgotten to define volatile from time to time in an environment where, for example, two threads read/write on a single var

#

And only noticed it after some time

#

Thus my question of why it worked

young knoll
#

I believe it’s CPU dependent

#

Here’s a read on it

blazing ocean
#

baeldungs thumbnails are so silly

#

the cat is cute

young knoll
#

He looks very scared

blazing ocean
#

yea

#

understandable

young knoll
#

What does he see out his window

blazing ocean
#

.net

remote swallow
eternal oxide
grim hound
#

while (something) Thread.yield();

#

Like I get it, you signal a hint to the cpu that you're willing to yield the usage of the current thread

#

But when exactly should this be used?

#

And is timed waiting more efficient or is it just for different situations?

paper viper
#

But I’d understand it’s not always possible

grim hound
paper viper
#

But ig many people still don’t choose to try to make their stuff not as mutable

grim hound
paper viper
#

You can’t always have immutability as said above (or you can but it will be too inefficient), but the better option in this case is AtomicInteger which would help maintain the state across different threads

grim hound
#

It has a mutable, volatile int

paper viper
#

Yes it’s just a mutable integer volatile

grim hound
#

So

#

You can't have everything be final

paper viper
#

Never said you must use immutability

#

I just said use it when possible

grim hound
#

I do

tardy delta
grim hound
#

I'm actually upset by how many people don't do it

tardy delta
#

i remember there was a comment on it

grim hound
#

In their src for reflections

#

Everything is mutable xd

tardy delta
#

i mean Thread.yield has more scheduling overhead than Thread.onSpinWait

#

so prefer the latter if youre doing a spin loop

grim hound
#

Worse for performance and more potent to bugs

grim hound
#

"Spin loop"

tardy delta
#

literally a loop that eats your whole cpu core if you dont insert a pause instruction in there or yield the thread

grim hound
#

Uh

#

So like, when creating a platform Thread

#

?

#

And doing like timed waiting

tardy delta
#
// modified by another thread
volatile int flag = 0


while flag != 1 {
  // loop
}
#

will eat your core

young knoll
#

The heck is onSpinWait

tardy delta
#

so you can insert a Thread.yield or Thread.onSpinWait in there

#

the latter got recently introduced

grim hound
young knoll
#

I normally do while (!condition) { sleep(x) }

grim hound
#

I think it was outside any loops

tardy delta
#

as a better alternative for yield, which induces more os scheduling overhead

grim hound
#

Like sleep(0)?

#

Also, how do you wake up a sleeping thread?

tardy delta
#

onSpinWait explicitly hints the cpu that a spin loop is occuring

#

and that it should not eat the core

blazing ocean
young knoll
tardy delta
grim hound
young knoll
blazing ocean
#

man hasn't heard of coroutines

grim hound
blazing ocean
#

kls moment 🗿

young knoll
#

Co routine?

tardy delta
#

Object::wait and Object::notify

grim hound
#

Like Object#wait and Object#notify

young knoll
#

More like no routine

remote swallow
#

we are not those people but they exist

blazing ocean
grim hound
tardy delta
#

i might be wrong on this one

young knoll
paper viper
tardy delta
#

well lets say it the simple way, wait blocks the execution of some code and then notify is supposed to be invoked from another thread on that object to resume execution again

blazing ocean
#

i feel like by having received that comment i should not be saying whose it is

rough ibex
blazing ocean
#

sometimes you gotta do what you gotta do

#

i can share the entirity of this class if anybody wants to see some shitty cursed code

grim hound
#

That's pretty simple

#

Why does Object implement it tho?

grim hound
tardy delta
#

but a thread may sporadeously (dunno if this word exists) awake from a wait call

young knoll
#

Why does a builder look so bad in Kotlin

tardy delta
#

so gotta loop on the wait condition

#

cuz systems

blazing ocean
young knoll
#

Or is that just trash formatting

blazing ocean
#

trash formatting

tardy delta
#

LockSupport.park also has that problem

blazing ocean
#

fucking ktlint shit

tardy delta
#

os scheduling related or smth, idk

blazing ocean
#

it hates lines longer than like 2 characters

tardy delta
young knoll
#

My builders look like

ItemBuilder.of(material)
    .name(name)
    .lore(lore)
    .etc()
    .build();
remote swallow
#

item(Material.BARRIER) {
name = "egg"
}

blazing ocean
#
buildItem {
  type(material)
  name(name)
  lore(lore)
  ...
}
young knoll
#

wtf is this C#

blazing ocean
#

what

young knoll
#

Smh

remote swallow
#

no this is kotlin

tardy delta
#

builder thing

blazing ocean
#

pyramid of doom

tardy delta
#
fun buildItem(block: ItemStack.() -> Unit)
young knoll
blazing ocean
#

it's legacy code tho so i'm never touching this again

tardy delta
#

new Mesh() with { attrib0 = 2 }
this in c#?

#

i believe it was with

young knoll
#

Never seen with before

tardy delta
blazing ocean
#

wtf

#

is

#

$"{nameof(p1)}"

tardy delta
#

f string?

blazing ocean
#

least cursed c#

#

mhh yes very helpful

tardy delta
#

?

blazing ocean
#

the comment

blazing ocean
tardy delta
#

ive dealt with more awful stuff

young knoll
#

configMenu.AddTextOption(
                mod: this.ModManifest,
                name: I18n.Config_AmPmPosition_Name,
                tooltip: I18n.Config_AmPmPosition_Tooltip,
                allowedValues: Enum.GetNames(typeof(AmPmPosition)),
                formatAllowedValue: this.TranslateAmPmPosition,
                getValue: Config.AmPmPosition.ToString,
                setValue: value => Config.AmPmPosition = (AmPmPosition)Enum.Parse(typeof(AmPmPosition), value),
                fieldId: "am_pm_position"
            );
#

You can also do named params

blazing ocean
#

kotlin can too

young knoll
#

The ones you don’t specify need to have a default value tho

blazing ocean
#

kotlin can do that too

tardy delta
#

make it lua and do

configMenu.AddTextOption {
                mod: this.ModManifest,
                name: I18n.Config_AmPmPosition_Name,
                tooltip: I18n.Config_AmPmPosition_Tooltip,
                allowedValues: Enum.GetNames(typeof(AmPmPosition)),
                formatAllowedValue: this.TranslateAmPmPosition,
                getValue: Config.AmPmPosition.ToString,
                setValue: value => Config.AmPmPosition = (AmPmPosition)Enum.Parse(typeof(AmPmPosition), value),
                fieldId: "am_pm_position"
            }
blazing ocean
#

wha

#

oh its an object

tardy delta
#

looks a bit more like kotlin already

#

well it isnt but lets just assume it is

sonic briar
#

Hello, I have a plugin, it is a chest plugin, I arranged the contents of the chests and it is renewed every 10 minutes. The problem is that this plugin has to be personal, just like the ender chest. Is there anyone who can help me with this?

polar topaz
#

for anyone searching this discord for information -- yes, the cookie-based kicking issue is fixed now, using the same workaround I ended up patching into papermc manually (not ignoring kicks triggered during login phase) https://hub.spigotmc.org/jira/browse/SPIGOT-7876

polar topaz
azure zealot
polar topaz
#

aha

#

are you making a transfer plugin?

azure zealot
#

yes

polar topaz
#

I'm making a ridiculously generic transfer plugin, one that uses JWTs and has an API to register transfer handlers (to handle transfer initiation commands triggered via command or API, and to accept the transfer at the other end), and middleware (functions that generate and tack on additional JWT-signed cookies pre-transfer, and handle extra cookies at the destination)

#

so I'm curious what others are doing

azure zealot
#

its not finished or something i just did it for fun

#

i encrypted all cookies with a private key

#

that every backend server knows

young knoll
#

What are you sending via cookie

azure zealot
#

whatever data you want

young knoll
#

Yeah but nothing important

#

Since the client can modify it

azure zealot
#

no it cant

young knoll
#

Encrypting it is an interesting idea, but it’s still not perfect

azure zealot
#

it is

#

try to bypass it

#

its not possible

young knoll
#

You just gotta break the encryption

polar topaz
#

as long as it's authenticated encryption it's probably fine

azure zealot
#

because of invalid cookie data

young knoll
#

What makes it valid

azure zealot
#

that it cant be decrypted right

polar topaz
#

JWT isn't perfect but I plan to use java-jwt to simplify this aspect of it -- each server will have a private and public key, public key is used to verify transfers

azure zealot
#

the cookie expires also after 10 seconds

#

its secure

young knoll
#

Still, if you manage to break it then you can put whatever you want in as long as it meets the validity checks

#

Easier just to send the data directly to the other server

azure zealot
#

you cant

#

its encrypted lol

#

what do you mean by break it?

#

do you have any idea of how crypto stuff works?

remote swallow
#

client has cookie, client figures out how to decrypt cookie data, client waits for next cookie client changes cookie data and server doesnt notice cookie data is wrong

remote swallow
#

yes you can

young knoll
#

Not saying it’s easy to break of course

#

But it is technically doable

azure zealot
#

Bro

#

wtf

remote swallow
#

if the server can decrypt it so can anyone

azure zealot
#

i also can say i can crack the mojang private key and verify sessions i generate

polar topaz
azure zealot
#

its the same with my encryption

young knoll
#

Sure but my point is

#

Even if it’s an extremely small risk

azure zealot
#

your point is invalid

raven pulsar
#

and thinks encryption is pattern

#

bro has a nasa pc

polar topaz
young knoll
#

There’s no point since you can skip the middleman and send the data directly to the other server

raven pulsar
#

and can break encryption

azure zealot
#

but you can also use the cookies

#

its equaly secure

young knoll
#

2 transfers is technically still less secure than one

azure zealot
#

just dont shit talk me with invalid points like "no dont do that with a quantum computer you can crack the encryption"

polar topaz
#

is that implementation using authenticated encryption though? if not, it's vulnerable to getting corrupted and opening up the door for rare attacks (that will probably not be feasible anyways)

#

can't tell if it's authenticated because I'm not familiar with java crypto functions

azure zealot
raven pulsar
#

spigotmc discord live comedy

polar topaz
#

yes but the bytes could be modified to produce attacks based on corrupted data

#

if it isn't authenticated

raven pulsar
#

bro knows the base concepts of encryption

#

security, authenticity, integirty

polar topaz
#

that's the only attack I can think of, though... so it's really fine

azure zealot
#

server crypts data -> sends to client (client stores it) -> client sends to server -> server decrypt data -> server verifies the cookie header for player uuid expiration time and server the cookies was created for

raven pulsar
#

if you corrupt the data it will fail, if u remove blocks it would fail

polar topaz
#

in encryption without authentication it's definitely possible. Like, modify one byte and the rest is garbage data

azure zealot
azure zealot
#

if the server is not able too

#

you get kicked

raven pulsar
#

then add a hash

#

idc

polar topaz
#

hammer it with many attempts and it could stumble upon valid data

raven pulsar
#

if u want to be sure then add a hash

polar topaz
#

authenticated encryption :D

raven pulsar
#

ye

azure zealot
polar topaz
#

it should be fairly easy to add this

deft geode
#

Hello, quick question, are chest boats unable to be spawned via Bukkit/Spigot?

azure zealot
sullen marlin
#

they can be, what specific issue are you facing

deft geode
#

I'm "revamping" some code on Skript, and for some reason chest boats are not able to be spawned. Someone told me to come here and ask to make sure,

raven pulsar
polar topaz
# azure zealot should not be needed

I mean... it's fairly standard to protect against this attack whenever possible. Old SSL/TLS is considered utterly broken due to implementing this wrong

sullen marlin
#

what happens when you try to spawn them?

deft geode
#

Nothing happens, they just dont spawn and nothing in console

azure zealot
sullen marlin
#

they're using Skript

blazing ocean
#

oh

deft geode
#

Well, I'm redoing code for the Skript plugin

#

I have a PR

tender shard
#

skript is so much harder than java

polar topaz
sullen marlin
azure zealot
#

ah

#

okay

sullen marlin
#

yeah above gist is aes-gcm

azure zealot
#

ah

raven pulsar
#

dont even know why it's not a standard for every encryption-kind

sullen marlin
#

any new use of symettric encryption should most likely be aes-gcm these days

raven pulsar
#

so if you use java's AES impl is it AES gcm?

sullen marlin
#

no, java has lots of aes types

raven pulsar
#

oh i see, thanks

polar topaz
#

I think the original code is just plain AES

wet breach
#

you just only need to store a large enough data AKA rainbow table

raven pulsar
wet breach
#

the reason AES-256 or most encryptions are secure is first not knowing the key but the second is that you don't know what the data is before hand

raven pulsar
#

i dont know the exact internals of AES, but for me it seems that it's chain based and that the bytes are dependant of the previous ones

#

so I think you cannot craft payloads yourself that easily

wet breach
#

but if you know the data before hand or even most of it, you can determine how to decrypt, this is why in the military changing keys is a frequent thing. Depending what is being encrypted and its purpose keys change pretty much daily or weekly

azure zealot
#

you can also change the key in the plugin daily if you want to

wet breach
#

which should be recommended if your goal is to be top notch secured

polar topaz
#

proper nonce usage avoids these issues, doesn't it?

azure zealot
raven pulsar
#

there is a nonce usage tbh

#

it's implicit

#

but it's a nonce

azure zealot
#

i dont need to be above military standards

wet breach
#

right you don't need to be it just all depends on what the data is and its purpose

#

and why someone would even bother with it

raven pulsar
azure zealot
#

its minecraft plugin data lmao

raven pulsar
#

isnt it like that?

#

u are just saying:

#

encryption is insecure

#

because

wet breach
azure zealot
#

i am not sending my brith certificate via minecraft cookie packets

raven pulsar
#

it can be cracked

azure zealot
#

so its alright

raven pulsar
wet breach
#

two way authentication is different from one way

raven pulsar
#

so would you say if you put the timestamp & uuid which are known data into plain text and sign it with the key, would it be more secure?

wet breach
#

two way authentication isn't meant to keep the client out of the loop instead its to keep other devices/clients out of the loop between the client and server

polar topaz
#

JWT + JWE really is the way to circumvent all these complicated decisions... well, as long as your library disables all the cursed algorithms, such as null digest and null cipher

wet breach
#

lol

azure zealot
#

!?!?

raven pulsar
#

if you could just encrypt + sign it

wet breach
polar topaz
raven pulsar
#

how would he be able to arbitrarily sign it

#

the private key is not leaked

#

and reuse isnt possible too

wet breach
#

well you are talking in a broad sense

wet breach
#

not all algo's or methods are ideal. Hence I said as long as copying the signature to something else isn't possible

#

then yes

polar topaz
raven pulsar
#

idc

wet breach
#

but, I don't see why you need the data in a cookie to be secure though

#

if security is what you need you would store that somewhere else not on the client

polar topaz
#

my implementation will also have "open ended" transfer handlers that either only handle accepting transfers, or only handle initiating transfers, with the idea that it could be interoperable with something else

azure zealot
#

but you can store it in the client

raven pulsar
#

it's not that we are putting it in a cookie to be secure

#

we are putting it in a cookie to put it in a cookie

#

and

#

encrypt + validate it to be secure even tho it's in a cookie

azure zealot
#

we just want the data to be in the COOKIE!

wet breach
#

then what is the usefulness of encrypting it?

azure zealot
#

thats why!

raven pulsar
azure zealot
#

the client should not see the data

wet breach
#

and what harm would come if it does?

azure zealot
#

how knows what data is tsored inside

#

could be anything

#

so it should not be readable

raven pulsar
#

it's just for the server to ensure data is just stored over one session

#

and it should still be secure

polar topaz
#

most transfer cookies will be rather mundane, like just specifying the coordinates and world you end up in, so a signing-only scheme would probably be fine

wet breach
#

if I am not mistaken the cookies don't persist

polar topaz
#

but in theory it could contain something sensitive

young knoll
#

They persist through transfer

#

But that’s all

raven pulsar
#

yeah that's what we want

azure zealot
raven pulsar
#

we want the cookies just to be on a session

#

and cookies are there for a storage over a client session

#

so we can ensure the data is only available as long as the client is in a session with the server

wet breach
raven pulsar
#

if you would want to store any persistent data you would need something like a db

wet breach
azure zealot
raven pulsar
#

and thats why we use it

#

we want to prevent spoofing / clients accessing the data

wet breach
#

so far neither have made really good arguments for the encryption

young knoll
#

If they disconnect or get kicked though

#

The cookies are lost

azure zealot
#

yes

raven pulsar
#

why would a client need intel to server intern data

#

that's just a security flaw

#

and you would leak internal operation procedures

wet breach
raven pulsar
#

nah

azure zealot
wet breach
#

well neither of you I would accept as experts in security or encryption

#

so I will disagree with you

raven pulsar
#

tell me a way to spoof ur cookies without bruteforcing for 200 years or having a nasa pc on our current systems

polar topaz
azure zealot
polar topaz
#

so why not treat it as a secure domain at that point, for the rare things that do need a stateless transfer of some sensitive state

wet breach
young knoll
#

You could just have the client send nothing back when asked for the cookies

#

That would be interesting

azure zealot
#

and will be kicked

raven pulsar
#

so we go for AES-GCM just to make sure that noone tries to do some bruteforcing and achieving almost nothing with it

young knoll
#

Then how do you connect the first time

wet breach
#

^

polar topaz
#

(the reason this seems useless... is that it's really hard to think of something that is both sensitive and benefits from statelessness / no centralized database to manage things)

young knoll
#

Since when first logging in you’ll have no stored cookies

raven pulsar
azure zealot
wet breach
#

unless we talking about transfers

azure zealot
#

please look at my implementation

#

there you can see how its verfied

#

so you dont need to question everything anymore

young knoll
#

I guess at that point it’s basically just a proxy without the proxy server itself