#help-development

1 messages · Page 862 of 1

tender shard
#

getList(path)

wraith dagger
worldly ingot
#

Yes, Location is serializable so you should be able to get a List<Location> (assuming you actually serialized Location objects via the config API)

#

If you serialized them youself into a more compact syntax then you'll have to use #getStringList() and parse it yourself into a List<Location>

winter galleon
#

[ERROR] Failed to execute goal on project mxPlane: Could not resolve dependencies for project org.getkeesh:mxPlane:jar:1.0-SNAPSHOT: Failed to collect dependencies at nl.sbdeveloper:VehiclesPlus-API:jar:2.3.5: Failed to read artifact descriptor for nl.sbdeveloper:VehiclesPlus-API:jar:2.3.5: The following artifacts could not be resolved: nl.sbdeveloper:VehiclesPlus-API:pom:2.3.5 (absent): Could not transfer artifact nl.sbdeveloper:VehiclesPlus-API:pom:2.3.5 from/to sbdevelopment-repo (https://repo.sbdevelopment.tech/{repository}): Illegal character in path at index 32: https://repo.sbdevelopment.tech/{repository}/nl/sbdeveloper/VehiclesPlus-API/2.3.5/VehiclesPlus-API-2.3.5.pom -> [Help 1]
somebody can help?

chrome beacon
#

Guessing that {repository} is the problem

rough drift
#

?

lost matrix
#

What does that mean?

rough drift
# lost matrix What does that mean?

i.e.

assume A is air and B is stone, and that we are raytracing straight north (1, 0, 0) for simplicity, if we have a configuration as follows:

A A A A A B

the raytrace would return B, but I need the last of the As (the one adjacent to B)

lost matrix
rough drift
#

... fair enough I did NOT think about that 😂

eternal oxide
rough drift
#

oml I am blind 😭

eternal oxide
#

result.getBlock().getRelative(result.getHitBlockFace())

tender shard
#
tasks {
    register<Copy>("copyToTestServer") {
        group = "test"
        val testServerDir = File(System.getProperty("TEST_SERVER_PATH","/Users/mfnalex/mctest/"))
        val pluginsDir = File(testServerDir, "plugins")
        val basicsPluginDir = File(pluginsDir, "Basics")
        val basicsModulesDir = File(basicsPluginDir, "modules")

        if(!testServerDir.isDirectory) {
            error("Test server directory does not exist! Specify the correct path as environment variable TEST_SERVER_PATH.")
        }
        if(!basicsModulesDir.isDirectory) {
            basicsModulesDir.mkdirs()
        }

        from(project(":plugin").tasks.getByName("shadowJar", ShadowJar::class).archiveFile)
        into(pluginsDir)

        from(project(":modules:test").tasks.getByName("jar", Jar::class).archiveFile)
        into(basicsModulesDir)

    }
}

This shall copy the plugin into plugins/ folder and the test module into plugins/Basics/modules/.

When I only add one "from(..) into(...)" it works fine, but whenever I use both, then both files (plugin AND module) and up in the the modules folder??

#

do I have to create two tasks? because that'd be annoying

valid burrow
#

if this method is deprecated whats the propper way

shadow night
valid burrow
#

yeah i knowe

#

but

shadow night
#

Just use it if you really need to

valid burrow
#

im getting a player from username

shadow night
#

But otherwise, use UUIDs

valid burrow
#

i cant get a UUID if i dont have it

#

i need the player to even get his uuid xd

shadow night
#

Just use that, it's deprecated so people don't use strings to get offline players or some shit like that I've been told

valid burrow
#

arl

shadow night
#

If you wanna make sure the player already joined the server before I'm pretty sure the server stores a list of all players that ever played

tender shard
# tender shard ```kotlin tasks { register<Copy>("copyToTestServer") { group = "test...

fixed it using 2 copy tasks

val testServerDir = File(System.getProperty("TEST_SERVER_PATH","/Users/mfnalex/mctest/"))
val pluginsDir = File(testServerDir, "plugins")
val basicsPluginDir = File(pluginsDir, "Basics")
val basicsModulesDir = File(basicsPluginDir, "modules")

tasks {
    val copyPluginToTestServer = register<Copy>("copyPluginToTestServer") {
        from(project(":plugin").tasks.getByName("shadowJar", ShadowJar::class).archiveFile)
        into(pluginsDir)
    }

    val copyModulesToTestServer = register<Copy>("copyModulesToTestServer") {
        project(":modules").subprojects.forEach {
            from(it.tasks.getByName("jar", Jar::class).archiveFile)
        }
        into(basicsModulesDir)
    }

    register("copyAllToTestServer") {
        group = "test"

        if(!testServerDir.isDirectory) {
            throw RuntimeException("Test server directory does not exist! Set environment var TEST_SERVER_PATH to the path of your test server.")
        }
        basicsModulesDir.mkdirs()

        dependsOn(copyPluginToTestServer)
        dependsOn(copyModulesToTestServer)
    }
}
snow current
#

is it still possible to make plugin for 1.7.10 i cant find spigot api

shadow night
#

it is, but you should never

snow current
#

And what if I have a private server with a modpack in 1.7.10 and I don't have the choice but to make a 1.7 plugin 😂

shadow night
#

plugins and mods aren't compatible

snow current
#

compatible

shadow night
#

no, mods and plugins should never be combined for a lot of reasons, if you run mods, run mods

snow current
#

ok mister but its not what i asked

eternal night
#

sounds like you are not using spigot kekwhyper

shadow night
#

exactly

snow current
#

i am

eternal night
#

what was that cursed shit that supports forge mods and spigot plugins

#

magma ?

shadow night
#

no, if you are running mods then it can already NOT be spigot

snow current
#

crucible

shadow night
#

whaaa

#

and even more

#

if it's running mods then it's already not spigot, but a fork

eternal night
#

Yea so, if you are running Crucible you are not running spigot

#

which means, go ask them where their API is hosted

shadow night
#

lmfao

eternal night
#

if the spigot repos don#t have 1.7.10 api artefacts then you are pretty out of luck xD

snow current
#

magma is 1.12 and crucible is a dead project i just want the spigot 1.7 api and ye it doesnt

#

there is no artifact anywhere

eternal oxide
#

if you have the jar, depend on it

snow current
#

thats what i ask for x)

#

so no i dont x)

eternal night
#

no like, the server jar

eternal oxide
#

why build for 1.7.10 if you don;t have the server?

snow current
eternal night
#

probably ?

eternal night
#

back then it was not a bundler setup

snow current
#

il try

#

click on the link

#

its not working

#

i tryed

#

it redirect to

eternal night
#

try server jar yea

snow current
#

ye i try rn

#

its gone too

quaint mantle
#

he?

inner mulch
#

Bro this is some clean code

#

wdym cleaner this is good, you'd prob still easily understand it after a few months

#

If you Look at Ur code after a few months?

proud badge
#

Hi idk if I should ask here or some other places but does anyone know if the graddle-wrapper.jar is open source?

grave vale
#

hey, I know this must've been answered many times before but I can't find anything on google
my IDE says HoverEvent is deprecated, what should I use instead?

rotund ravine
#

What does it say?

proud badge
grave vale
#

Just says it's deprecated, not what to use instead or anything

grave vale
inner mulch
#

Are you using paper @grave vale

twilit roost
#

Hey!
I'm having trouble with socket communication.
Specifically with the reading part.
I'm using ObjectOutputStream and DataInputStream.

Proxy - https://paste.md-5.net/nixabulosi.java
Bukkit - https://paste.md-5.net/zesutasuhu.java

I've tried lots of different stuff
Currently I'm stuck at only one message being able to be sent.
After the initial message, my proxy sends at the beginning of the communication, it no longer seems to accept any data, as the DataInputStream is blocking the thread by reading the UTF.

Any ideas of why it may be wrong?

For faster search in the code:

  • if you want to see the code for listening to the incoming traffic: listen void
  • if you want to see the code responsible for sending the messages: sendData method

Thanks in advance,
TomKo

grave vale
#

hmm lemme try

delicate lynx
# grave vale

it says on the javadocs that only on of the constructor is deprecated, there are other ones that are not

twilit roost
grave vale
#

how do I use these?

grave vale
#

ty

tender shard
#

can I somehow get rid of this unchecked cast? If no, how can I suppress it in kotlin?

dry hazel
#

@Suppress("UNCHECKED_CAST") on the statement iirc

tender shard
#

thx. there isnt a better way I supposed than to suppress it? I mean I already checked isSUperclassOf

dry hazel
#

or alternatively right click -> suppress for statement

dry hazel
#

I mean, can't it be just a wildcard?

tender shard
#

wdym?

dry hazel
#

KClass<*>

tender shard
#

but I need a Class<? extends BasicsModule>

dry hazel
#

show how you use it

rotund ravine
dry hazel
#

I would just let it be a wildcard and cast it upon instantiation or wherever else you need the type

dry hazel
rotund ravine
#

He’s checking it above so it’s just kotlin being a derp and not smart casting enough

dry hazel
#

it's because generics are erased, you'll have an unchecked warning in java as well

tender shard
#

i know that generics are erased, but I a mliterally checking isSuperclassOf one line above

#

one could assume that the compiler would then know that the cast is not unchecked

dry hazel
#

it's just like reflection but with kotlin specific stuff

slender elbow
#

doesn't kclass have an equivalent of asSubclass or w/e?

dry hazel
#

don't think so

quiet ice
tender shard
#

it's just a regular URLClassLoader

valid burrow
#

yall

#

can i like

tender shard
#

maybe

valid burrow
#

quadrouble boot different versions of linux

#

is that possible

tender shard
#

why would that not be possible

valid burrow
#

idk

#

never did anything like it

quiet ice
valid burrow
#

never event tried dual boot

quiet ice
#

As long as you have enough boot partitions

tender shard
#

no try-with-resources

quiet ice
tender shard
#

should have just used SPigotUpdateChecker 🥲

quiet ice
#

try-with-resources is not a performance thing but rather a sanity one

#

The URL input stream probably closes after a while but not closing it properly in case of an error can cause issues regardless

tidal kettle
#

can you make spell particule not white like make them red?

valid burrow
#

im having a debate with myself

#

what linux distro do yall use

tender shard
valid burrow
#

and dont give me some beginner shit

#

ive used linux before

tender shard
valid burrow
#

yh im talking about desktop

#

not server

tender shard
#

yeah well if I had to use linux on desktop, I'd also use debian there

valid burrow
#

im scared of using arch

#

right away

#

like

#

i used ubuntu and mint before

#

but i feel like thats a huge leap

#

leep

#

leap?

#

idk

slender elbow
#

eh

chrome beacon
#

Debian uwu

tender shard
#

i'd just stick with debian, it's a no-bullshit distro and the updates are flawless

slender elbow
#

it's no different than any other distro that i've used tbh

tender shard
#

ubuntu sometimes breaks on major updates, this never happened to me on debian

quiet ice
valid burrow
#

surely this guy knows what hes talking about

#

im just gonna trust him

#

he looks believable

quiet ice
#

Debian I am personally not a fan of, having outdated stuff is not great

sullen marlin
quiet ice
#

Firefox is annoying as hell even outside snaps lately

#

Well if you can call the occasional soft-crash (i.e. you can only use FF with your mouse - don't ask how) annoying

tender shard
#

I'm still having issues with JarFileSystems - I can walk through the paths using walk() but whenever I call toFile() on a Path, it throws UnsupportedOperationException - I thought I would be able to access files as File object from within jars when using a JarFileSystem?

slender elbow
quiet ice
#

File is ALWAYS a file:// URL. JarFileSystem produce jar:// URLs tho

tender shard
#

so can I acquire a file object of a file inside a .jar somehow without actually extracting it, or not?

quiet ice
#

Hence why you should not use java.io.File in your APIs

quiet ice
slender elbow
#

i mean, you have the Path, what else do you need?

#

why do you need a File?

quiet ice
#

Plus Path-based APIs are apparently a bit faster on some system than the old java.io File API

tender shard
#

if I could just create a JarFile from an InputStrea mor whatever, that would be nice

#

performacne wouldn't even matter, I just need the inner jar as JarFile object lol

quiet ice
#

Why exactly JarFile?

slender elbow
#

what is your goal

quiet ice
#

Can't it be ZipInputStream or similar?

tender shard
#

a ZipInputStream doesnt have getEntry etc for the contents

#

I want to access the contents of the inner jar file without extracting it

quiet ice
#

You can use a for loop

simple bone
#

i need help

quiet ice
#

If performance is the concern (or if the files are plain massive) a library such as LL-Java-Zip also works (LL-Java-Zip decompresses on demand for example)

tender shard
quiet ice
#

There are also jar file systems

simple bone
#

i want to use a spiggot plugin called Gsit in my online minecraft server 1.20.1. I did the java file in the files. didnt work. did it in the plugin file. didnt work. i did the same on filezilla but it also didnt work. how can i get the plugin in the server.

quiet ice
#

JarInputStream might verify the integrity, but you'd probably need to check manually

#

Yeah, JarInputStream does do some checking via JarVerifier

#

At least on Java 17

simple bone
#

:o

#

sorry

tender shard
quiet ice
#

However it does a few assumptions:

  1. The manifest should be the first entry in the META-INF directory.
  2. The .SF/.DSA/.EC files follow the manifest, before any normal entries
  3. Any of the following will throw a SecurityException:
    a. digest mismatch between a manifest section and
    the SF section.
    b. digest mismatch between the actual jar entry and the manifest
#

However JarInputStream isn't actually JVM-compliant - or rather said it doesn't behave like the JVM would read a jar file.

slender elbow
#

afaik JIS is only really useful for signature verification and checking manifest stuffs if you want to use the manifest api

#

JarFile can still be useful as it can work with multi-release jars for example

#

but, that's due to the ability of random access, JIS is an InputStream in the end

#

did you know that gta vice city has 4 different taxi models?

dry hazel
#

no

#

thank you for the info, nerd

slender elbow
#

Taxi, Kaufman Cab, Zebra Cab and the rarest Cabbie

quiet ice
#

Mojo? Like maven lifecycle goals or what?

unkempt burrow
#

how can I remove an specific suspicious stew recipe? I tried using the Recipe Iterator but I don't see any recipe matching with the suspicious stew material

quiet ice
#

You mean mojmap? MOJOs are maven lifecycle goals (well technically they are more like maven plugins, but it is complicated)

orchid gazelle
#

does anybody know how I can work on my Spigot-Repo fork to contribute? Whenever I clone and try to run ./applyPatches, I am getting ```Applying: Spigot Configuration
Using index info to reconstruct a base tree...
A src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
A src/main/java/net/minecraft/world/level/World.java
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): src/main/java/net/minecraft/world/level/World.java deleted in HEAD and modified in Spigot Configuration. Version Spigot Configuration of src/main/java/net/minecraft/world/level/World.java left in tree.
CONFLICT (modify/delete): src/main/java/net/minecraft/server/dedicated/DedicatedServer.java deleted in HEAD and modified in Spigot Configuration. Version Spigot Configuration of src/main/java/net/minecraft/server/dedicated/DedicatedServer.java left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Spigot Configuration
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Something did not apply cleanly to Spigot-Server.
Please review above details and finish the apply then
save the changes with rebuildPatches.sh

quiet ice
#

that isn't a thing, is it? You really need to get your terminology right

tender shard
#

what

quiet ice
#

Though obviously I would do a backup beforehand

orchid gazelle
#

it's my first time working on the repo

#

idk how I would resolev the merge conflicts as it is a freshly forked and cloned repo

valid burrow
#

i want laptops to have a little "hole" with a cover that lets you store 1-2 usbs sticks

#

like a little usb slot

orchid gazelle
#

I have literally forked it on stash half an hour ago

quiet ice
#

ah uh. yes

#

hides inside the bushes

orchid gazelle
#

yes what? xD

quiet ice
#

I think it is fairly safe to assume that that wasn't the right answer

slender elbow
#

lol

quaint mantle
#

22:34:46 [SEVERE] Error authenticating xxx with minecraft.net
java.lang.IllegalStateException: Expected HTTP response 200 OK, got 429 Too Many Requests

I have this error when entering bungeecord does anyone know how to fix it?

tender shard
#

anyone knows why gradle refuses to search for a dependency in sonatype snapshots even though it's obviously declared?

quiet ice
quiet ice
quaint mantle
#

Only problem is that currently there are no people on the server and no connections....

quiet ice
tender shard
#

yes it is

quiet ice
#

Does a task of a parent or sibling module consume the configurations of the child project?

tender shard
#

i dont know

#

no clue what that means lol

dry hazel
#

you're declaring the repo only for the core module

#

it's failing in plugin

quiet ice
#

Ah yeah

tender shard
#

core is the only place where I'm using it as dependency though

#

this is the build file for plugin

quiet ice
#

Yes, but your plugin module also packages the dependencies of your core module

dry hazel
#

you need it for plugin as well, since it has to resolve it as a transitive yes

quiet ice
#

via the shadow plugin

tender shard
#

hm and how do I do that? I do not want to just copy paste the repository into the other module

#

if it gets the dependencies of other dependencies, shouldnt it also use the repositories that those other dependencies use?

quiet ice
#

I guess you could define a shade task in your core plugin and shade the shaded core jar? But that is a little bit hacky imo

dry hazel
#

you seem to already have a build logic composite module, so you can just define your repos in a base convention script

quiet ice
tidal kettle
#

can you place block with 1 sec daly, i try with Thread.sleep, Bukkit.getScheduler but it doesn't work

chrome beacon
#

?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.

chrome beacon
#

?nocode

undone axleBOT
#

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

quiet ice
#

Thread.sleep ought to be avoided at all costs - use a task

tender shard
tidal kettle
#

?paste

undone axleBOT
tidal kettle
dry hazel
#

you can include only specific groups from a repository if you're concerned about security

tender shard
#

sad. I'm not concerned about security, I just find it do be "dirty" to add random repositories lol

#

can't I tell gradle sth like "for each project that depends on another project within my project, add all repositories to the depending project too"?

dry hazel
#

not that I'm aware of

elder harness
#

I can't find any information on registering custom enchantments in 1.20+. I wonder, is it still necessary to register? Do you need to handle your own registration? If so, why?

tender shard
#

You shouldnt register any custom enchants but use PDC instead

elder harness
#

Alright. Seems like you need your own registry implementation using PDC then

tender shard
#

The Enchantment class isnt meant to be extended by plugins unfortunately:')

elder harness
#

Oh well...

#

So you basically have to create a custom enchantment implementation from scratch?

tender shard
#

yeah well you can still extend Enchantment and it will somewhat work

#

what won't work though is e.g. removing your custom enchantment again using API, that's because CraftBukkit casts Enchantments in the removeEnchantment method to CratEnchantment

#

so if you want to indeed extend Enchantment, you would have to extend CraftEnchantment

#

that change was introduced in 1.20.3

elder harness
#

Ahh right. Then I'll be making it from scratch. Gives me better control over it anyways. Thx

tender shard
#

np

#

i decided to still register exactly one custom enchantment anyway, to add the glow effect

near barn
#

Anybody that can tell me the failure in here

eternal night
#

check line 103 in Main

quaint mantle
#

Hey guys im using velocity as my proxy and using Redis(Jedis) Lib to communicate between
proxy->backend servers. And i am wondering how the hell its possible to teleport the player to another players location on another server.

Would i make my command on my proxy plugin or in my spigot plugin? I am just so confused and i dont understand how it would work.

#

Ive looked at every link on spigot and bungee forums but all of them have same feedback and most of it is just copied and pasted from other threads. To no help

eternal oxide
#

?pmc

near barn
#

Why does my config doesnt work? When I type "/crate givecrate username cratename 1" and then place is, it just opens the enderchest like a normal enderchest...

eternal oxide
#

The config you posted does not match the error

near barn
#

I just found out, that the errors was from a older version of the plugin that i deleted. The new plugin doesnt show any errors, but still dosent work with my config. The default config works just fine...

#

😦

near barn
#

I figured it out. Was bcs off the material was record_strad but that dosent work anymore, you need to use IDs

peak moth
#

hi

ornate mortar
#

I have a question on the spigot page can you publish resources not plugins? i.e. any configuration of x plugin?

quaint mantle
#

I have no internet only phone data and this is my only resource right now.

vapid grove
#

Is there any good guides on how to properly organize files? Im not sure how to exactly, and right now im only seperating things by either them being a resource or a core part of the plugin

ivory sleet
#

Its very possible

#

I’d start by defining a protocol, one from server to proxy and one from proxy to server

#

Then use that through redis

quaint mantle
regal scaffold
#

Hey everyone! Long time no see!

Does anyone have any experience with Java spring boot websockets inside Docker containers?

silent tendon
#

Hey, how do I register a command in 1.20?

torn shuttle
#

well this is fun

#

I now have AI autocommenting my code

#

now when the documentation is bad I can blame AI!

quaint mantle
#

How do developers maintain a data class thats saved in a format like json

Like for example if I change a variable name due to bad naming, how would previous versions update to the new name

torn shuttle
#

you people pepepuke

#

you can't realistically retroactively add features to previous versions of your software

quaint mantle
#

what if it's like a database

torn shuttle
#

but if you're talking about updating previous files and not previous software then I just use data converters that look for specific keys and change them on boot

quaint mantle
#

Damn that's a lot of work

torn shuttle
#

if it was easy it would be called your-

#

gotta say having AI in the programming workflow is actually a game changer

wet breach
ivory sleet
#

^

torn shuttle
#

it doesn't really matter much if you're already proficient at what you're currently but if you're tinkering with a language you know relatively little about or working with a specific lib it can be pretty amazing the difference it makes

ivory sleet
#

You can start defining version formats

quaint mantle
#

hm

ivory sleet
#

and define ways to convert between versions

torn shuttle
#

version formats are for people who plan to fail with their data, I never plan to fail and thus I never fail

ivory sleet
#

DataFixerUpper can partly be used for that

quaint mantle
#

I'm thinking of a class like this

public interface DataFactory<T> {
    
    T createDefault();
    
    T deserialize(Map<String, TreeElement> serializedData);
    
    Map<String, TreeElement> serialize(T data);             
    
}
#

idk what TreeElement will be named

#

But it's the only name I got in mind rn

ivory sleet
#

Serializer

#

It looks like more lol

quaint mantle
#

you think I can add the updater in the deserialize method?

ivory sleet
#

depends, I mean maybe

quaint mantle
#

Cause essentially

#

yml, json, is just a map

ivory sleet
#

Yml is far more than just a map at times

#

but json yeah

torn shuttle
#

I wish things with yml were that simple

remote swallow
#

i mean

quaint mantle
#

rly?

remote swallow
#

technically yml is a map<string, obj>

quaint mantle
#

Idk I don't really use yml that much lol

ivory sleet
#

Yml has anchors, comments etc

quaint mantle
#

oh

ivory sleet
#

The semantic specification of yml is far more than a map epic

remote swallow
#

if were talking about just values yml is just a map, but if we talk abotu the rest yml is wild

quaint mantle
#

oh I also wanted to know

ivory sleet
#

myea well yesnt

quaint mantle
#

How much is my servers performance gonna hurt for constant hashmap look ups

ivory sleet
#

wdym by that

torn shuttle
#

you better not be doing io operations on the main thread

ivory sleet
#

HashMap::get ?

quaint mantle
#

yes

torn shuttle
#

that's very fast

ivory sleet
#

Not too much

quaint mantle
#

do you think I can get away with 1000 a tick

ivory sleet
#

Try and see

torn shuttle
#

easily but do you really need it

quaint mantle
#

Extreme example

#

idk I might lol

#

Depends on players

#

And the custom enchants, quests, etc the amount of that

torn shuttle
#

I'd be shocked if you can even see that have any kind of impact in the timings

quaint mantle
#

alr maybe ima test it

torn shuttle
#

what you do with what you got from the map is likely to be heavier than getting the contents in the first place

#

but again do you really need it

quaint mantle
#

nah

#

It's probably just working with primitives

torn shuttle
#

there are caching strategies you surely can use if it's that volume of data

quaint mantle
#

well

#

It is a cache

torn shuttle
#

cache your cache

quaint mantle
#

idk if this is a good system

torn shuttle
#

or in other worlds aglomerate the data, if you need 100 data points per player don't put 100 primitives in 100 maps, make one object with 100 fields

quaint mantle
#

what

#

oh I see what u mean

#

nah I'm doing that

#

but with classes

quaint mantle
#

PitPlayer
DataContainer persistentDataContainer
DataContainer sessionDataContainer

sessionDataContainer might be stuff like combat timers

persistentDataContainer might be stuff like gold, xp, stats

This is 1.8 so I don't have the PDC api

torn shuttle
#

so are you planning for 1000 players logging in per tick or something

quaint mantle
#

?

#

wdym

torn shuttle
#

how are you estimating you might access a map like that 1000 times in a tick

quaint mantle
#

well let's say I store cooldowns in the sessionData

#

And I got

#

idk it's just a question alr

wet breach
#

Main issue isnt going to be so much hashmaps in memory being accessed rather how is the data obtained and updated in the hashmap. Also concurrenthashmap exists

quaint mantle
#

.get

#

And when the player joins, it's .put

#

One word: Implement it yourself

wet breach
#

I am aware. Also just be aware that hashmap isnt always good with small data sets

#

Sometimes its better to use an array in such instances. When your data set is small the hashmap ends up with too many buckets being underutilized

spare mason
#

How could I know where the client wants to go. My goal is to know if the player is pressing any movement key to create a vector and impulse It there to create a dash, I have already tried with playerMoveEvent but It isnt acurrate because when a player jumps Its motion is awkward

lunar shuttle
remote swallow
#

like sort them into packages?

floral drum
#

I mean deffo possible

#

just... seeing if there's any inbuilt ways

wet breach
#

Morphia?

floral drum
#

Morphia, for mongodb, a framework for java for entities

vapid grove
#

But now im unsure why my YAML config isnt working with hashmaps

floral drum
#

One way I could do it is have annotations and a version id assigned to each object, storing what version the object is from, and when the object gets deserialized from MongoDB, check that field and if it's lower than the current version, scan the fields and update them accordingly. I could annotate the seperate fields with a version id of when they were added/updated, and if the entities version is lower than that, set that field to the new version. The same goes for fields that don't exist. Any other ways?

wet breach
#

You can store such files in the db. For mysql this is a blob not sure for mongo

#

So you could use dash to signify its a removal line and plus that something needs added. And then put after those symbols the thing being removed or added.

floral drum
#

Alright man, thank you for the idea 💜

lost matrix
# floral drum Alright man, thank you for the idea 💜

I dont get this... If you have an object with default values then the entity should just merge existing properties and discard fields which arent present in the class. What would be the purpose of a Version field/annotation?

echo basalt
#

not nuking data but rather converting it?

upper hazel
#

how check if player puts on/takes off armor

#

what the event

#

i was not find something similar

echo basalt
#

There's no event

#

mfnalex has an updated ArmorEquipEvent lib

upper hazel
#

i see

warm mica
tender shard
tender shard
tender shard
#

is there any way I can declare a function in my parent build.gradle.kts and call them in subproject's build.gradle.kts files?

dry hazel
#

not really

tender shard
#

wow that sucks

dry hazel
#

declare them in the build logic composite project

tender shard
#

I need this in several subprojects:

    fun getTestServerDir(): File {
        val testServerPath = providers.gradleProperty("testserver.path").orNull
            ?: error("Path to test server not set! Set gradle property testserver.path to the path of your test server (e.g. -Ptestserver.path=/Users/mfnalex/mctest or using gradle.properties in your home directory: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties)")
        val testServerDir = File(testServerPath)
        if (!testServerDir.isDirectory) {
            error("Path to test server does not exist or is not a directory: $testServerPath")
        }
        return testServerDir
    }

So how would I be able to use this in different places?

rotund ravine
#

Time to create ur own gradle plugin? @tender shard

#

Like run-paper, but run-spigot

tender shard
#

nah I just want to copy the files

#

I refuse to believe that it's not possible to simply declare a method and reuse it elsewhere

rotund ravine
#

Well it’s an interesting dilemma

tender shard
#

idk, how else would I share common things in build files if I cannot just declare a public property or function

sullen marlin
#

Is there not a global gradle config or something

tender shard
#

sure, one can set properties, but I want to be able to run some tiny arbitrary code instead of just getting the property

sullen marlin
#

Oh per project

#

And yeah but I thought maybe you could define code in the config

#

Since gradle loves everything being code

#

Totally reproducible

tender shard
#

I was able to make it work like this:

  1. buildSrc/src/main/kotlin/TestServerDirectory.kt
import org.gradle.api.Plugin
import org.gradle.api.Project


open class TestServerDirectoryExtension {
    fun printTestServerDirectory() {
        println("Hello from myCustomFunction!")
    }
}

class TestServerDirectory : Plugin<Project> {

    companion object {
        const val PLUGIN_ID = "test-server-directory"
    }
    override fun apply(project: Project) {
        project.extensions.create("testServerDirectory", TestServerDirectoryExtension::class.java)
    }
}
  1. build.gradle.kts
apply<TestServerDirectory>()

project.extensions.getByType(TestServerDirectoryExtension::class.java).printTestServerDirectory()
#

that doesn't seem like it's the proper solution though...

tender shard
eternal night
tender shard
#

I need to access the project object to get gradleProperties

eternal night
#

exTenSion fUnCtioNs

tender shard
#
open class TestServerDirectoryExtension(val project: Project) {
    fun getTestServerDirectory(): File {
        val testServerPath = project.providers.gradleProperty("testserver.path").orNull
            ?: error("Path to test server not set! Set gradle property testserver.path to the path of your test server (e.g. -Ptestserver.path=/Users/mfnalex/mctest or using gradle.properties in your home directory: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties)")
        val testServerDir = File(testServerPath)
        if (!testServerDir.isDirectory) {
            error("Path to test server does not exist or is not a directory: $testServerPath")
        }
        return testServerDir
    }
}

class TestServerDirectory : Plugin<Project> {

    companion object {
        const val PLUGIN_ID = "test-server-directory"
    }
    override fun apply(project: Project) {
        project.extensions.create("testServerDirectory", TestServerDirectoryExtension::class.java)
    }
}

this is my method, getTestServerDirectory()

#

no clue how else I would use it besides this weird extensions way

eternal night
#

literally just like
buildSrc/src/main/kotlin/TestServerConfig.kt

fun Project.getTestServerDirectory() {
  providers.gradlePropert.......
}
#

Weren't you talking about them like, yesterday kekwhyper

tender shard
#

that doesn't work in gradle

#

that always gives me unresolved dependency

eternal night
#

what

#

what is giving unresolved dependency

tender shard
eternal night
#

wtf

#

its an extension function

#

define them top level

#

you don't need the entire class garbage around it

#
cat buildSrc/src/main/kotlin/TestServerConfig.kt
File: buildSrc/src/main/kotlin/TestServerConfig.kt
import org.gradle.api.Project
import java.io.File

fun Project.testServerDirectory(): File {
    val testServerPath = providers.gradleProperty("testserver.path").orNull
            ?: error("Path to test server not set! Set gradle property testserver.path to the path of your test server (e.g. -Ptestserver.path=/Users/mfnalex/mctest or using gradle.properties in your home directory: https://docs.gradle.org/current/userguide/build_environmen
t.html#sec:gradle_configuration_properties)")
    val testServerDir = File(testServerPath)
    if (!testServerDir.isDirectory) {
        error("Path to test server does not exist or is not a directory: $testServerPath")
    }
    return testServerDir
}
umbral ridge
#

xDD

tender shard
eternal night
#

reload gradle I guess ?

tender shard
valid burrow
#

alex

eternal night
#

interesting, works for me ™️

valid burrow
#

what happend to you

#

since when do you ask questions

tender shard
#

it's wednesday

valid burrow
#

you usually answer them

tender shard
#

not on wednesdays

valid burrow
#

damn

eternal night
#

whats your buildSrc build.gradle.kts

tender shard
#

if you check my history, you'll see that I always have questions on wednesdays

tender shard
# eternal night whats your buildSrc build.gradle.kts
plugins {
    `kotlin-dsl`
}

repositories {
    mavenCentral()
    gradlePluginPortal()
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
    implementation("com.github.johnrengelman:shadow:8.1.1")
}
eternal night
#

Interesting, smack implementation(gradleApi()) I guess ?

#

at least das how I learned it

#

is this on github somewhere

valid burrow
#

pro tip

#

start using maven.

umbral ridge
#

yes

#

gradle is poorly documented

valid burrow
#

i always hear people complaining about gradle

#

every single time

tender shard
#

lmao deleted the gradle cache, now it does find the extension function :X

eternal night
#

welp

tender shard
#

I was trying this for like half an hour

eternal night
#

there ya go

#

the fact that your .gitignore does not include all of .idea

#

is fun

tender shard
#

that's the IJ default gitignore

eternal night
tender shard
#

probably it wants to upload itself lol

#

it does add some subfolders though

#

like .idea/libraries

tender shard
#

thx @eternal night , now I got this thing working without those stupid extensions.

I wonder though if what I'm doing here is a good idea. My goal are 4 tasks:

  1. in plugin: copyPluginToTestServer -> copies the plugin . jar to the test server
  2. in each module: copy{name}ModuleToTestServer -> copies this one module to the test server
  3. in modules: copyAllModulesToTestServer -> depends on all #2 tasks
  4. in parent: copyAllToTestServer -> depends on #1 and #3 task

Instead of a Copy task for #2, I have extended the Copy task class, so I can just identify them by that class for #3

Is that a good idea or is there a better way? Here's the full project with the current build scripts https://github.com/SpigotBasics/basics

eternal night
#

ehh

#

I'd say usually you'd want to just hardcode the dependency

#

there is typesafe project accessors out there anyway. I think still in preview but

#

tho I guess yea, you can "use" the type system like that

tender shard
#

well I need to collect all modules, I don't really want to hardcode them tbh

#

I thought I found a smart solution by extending Copy lol

eternal night
#

Yea idk, at that point you'd usually just be back to extensions xD

tender shard
#

fancy!

#

IJ adds run buttons if there are gradle commands in a markdown file

eternal night
#

does the same for bash too

#

been there for a while

tender shard
#

weird, I never saw it

tender shard
#

can I read console input in a gradle task or is that a bad idea for whatever reason?

quiet ice
#

it's not recommended at the very least

#

But I have heard of at least one plugin that does that

tender shard
#

basically I wanna do sth like gradle init or mvn archetype:generate where it asks for module name and stuff

#

unfortunately System.console() is always null :/

quiet ice
#

I mean at the worst you could do it via system props but that is not great

tender shard
eternal night
#

ehhh, gradle daemon and console input are not great friends

tender shard
#

but how does gradle init do it then

#

I also tried using --no-daemon, still no console

eternal night
#

you can probably try using System.in directly ?

tender shard
#

really?

dry hazel
tender shard
#

let me try

eternal night
#

Smack it in a Scanner and off you go

quiet ice
#

gradle init is a method in the wrapper

eternal night
#

and that ^

tender shard
#

lol this was easier as expected, thanks

fun readInput(text: String): String? {
    print("$text: ")
    return readlnOrNull()
}
slate tinsel
#

If I'm going to send a Title and a SubTitle to the player, does it have to be done together in "player.sendTitle" if it's to be at the same time?

chrome beacon
#

I don't think it has to

slate tinsel
chrome beacon
#

just set the argument you don't want to null

chrome beacon
slate tinsel
slate tinsel
#

okey 🙂

grim hound
#

Does anyone know in which class the server netty pipeline is located at?

grim hound
#

The variable

dry hazel
#

ServerConnectionListener#channels iirc

dry hazel
#

that's for a client, I think they meant the global one by "server pipeline"

river oracle
#

how can I get gradle to recognize system environment variables

#

currently it just won't recognize stuff set in my bash rc even though the echo command yeilds the desired result

remote swallow
#

clear caches mayb

river oracle
#

I tried didn't work

versed jackal
#

Recursive Timber Plugin leads much to be desired performance wise

slender elbow
remote swallow
#

read the question again emily

slender elbow
#

System.getenv works just fine

#

but the daemon's env vars set will be only set when the daemon starts, like any and every other program, it isn't something that is read dynamically

plucky skiff
#

I have an error in my code from protocollib, and at the bottom of the error, it gives these paramaters:

[17:55:31] [Server thread/ERROR]: Parameters:
  net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment@452d894f[
    b=99
    c=[(MAINHAND, 1 netherite_pickaxe)]
  ]
quiet ice
#

Does anyone know if System.arraycopy allows to copy from and to the same array in overlapping regions?

#

I basically want to shift all values of an array by 1, hence my query

shadow night
#

Are you making a list

slender elbow
#

If the src and dest arguments refer to the same array object, then the copying is performed as if the components at positions srcPos through srcPos+length-1 were first copied to a temporary array with length components and then the contents of the temporary array were copied into positions destPos through destPos+length-1 of the destination array.

quiet ice
#

Okay yeah, I guess I should've looked into the javadocs first lol

quiet ice
#

However I probably cannot use stuff like fastutil because it's my Java 6 project again

shadow night
#

Java... 6???

quiet ice
#

Yeah

river oracle
#

it was using System#getProperty and I didn't notice somehow

#

just switched to the correct System#getenv

slender elbow
#

pepelaugh

young knoll
river oracle
#

EnumMap<EquipmentThingy, Runnable> ftw

young knoll
#

i'll EnumMap you

river oracle
#

I'm going to enum map you!

#

EnumMap<Jishuna, Function<LivingHuman, EnumMapHuman>>

remote swallow
#

what is jishuna an enum of

river oracle
remote swallow
#

but theres only 1

#

has you forgot

grim hound
#

Does anybody know the difference between the two?

quiet ice
#

nio is probably the fallback of epoll

#

since epoll might not exist everywhere iirc

dry hazel
#

yes

grim hound
#

so epoll is superior but not available everywhere?

eternal night
#

given epoll is a linux kernel call

quaint mantle
#

How to load the texturepack only when entering the lobby server and then on other modes not to load it anymore?

proud badge
#

I cant find it anywhere, where is the "dependancy" for Votifier?

#

like what do I type, what is it called

grim hound
#

Yo what did I just find?

#

Who did this

quaint mantle
#

where is that

grim hound
quiet ice
grim hound
quiet ice
#

It allocates garbage on the heap that provides a buffer in case an OOM occurs

#

At least that is the intention

grim hound
#

ah, OutOfMemory, got you

#

btw

quiet ice
#

realistically those 10 MiB won't do much though

grim hound
#

where can I get the MinecraftServer variable instance from?

quiet ice
#

doesn't it have a static accessor

grim hound
#

nope

quiet ice
#

Otherwise I think you can cast Bukkit's server to MinecraftServer but do not quote me on that

eternal night
#

on craftbukkit it does

#

there is MinecraftServer#getServer

grim hound
#

oh wait it kinda does

#

why wouldn't the server be a CraftServer?

grim hound
eternal night
#

during testing it isn't

grim hound
#

Java

#

Pretty important to learn it

quiet ice
grim hound
#

Double is one of the ways to save a number

quiet ice
#

Yes, I did that once. No, it did not work thanks to this method

grim hound
#

or rather, allocate it in memory

unkempt burrow
#

What value do I have to pass to a GameProfile in the ClientBoundPlayerInfoPacket for changing a player's skin? Should it be the link or what?

quiet ice
#

double is a double-precision floating point number

grim hound
#

show code

quiet ice
#

integer is a fixed point number

#

So while double can represent 2.4, integer can not. You either cast (round) your double to an int, or you do it some other way

quiet ice
grim hound
#

uhhh

quiet ice
#

I am extremely sure you should not be using Beans with your knowledge

grim hound
#

I think you have a little bit more than one error

#

like

#

everywhere

quiet ice
#

Okay yeah, I'd just drop whatever you are doing and go about it some other way

quiet ice
grim hound
#

and why ist the comment in polish?

grim hound
#

it's decently crucial

quiet ice
grim hound
#

POLSKA GUROM

#

a k

quiet ice
#

Don't. Easy as that. Fixing that issue will cause another issue to crop up

#

This entire method is unusable code

#

So you are saying this code doesn't come from chatGPT?

#

in this case, uh - WHAT

#

You probably can just do build = (int) version

#

Where do you have that code from?

#

Is this a plugin that already exists?

#

Or is this exclusively chatGPT?

#

Because whoever wrote this took ?di too seriously

#

?di this command

undone axleBOT
quiet ice
#

I'd assert that this is not how most plugins are written. With most I mean like all except a handful

#

?learnjava And also learn dependency management. BeanFactory looks to be a spring-specific thing. I'd say you messed up the prompt which is why ChatGPT is writing a Spring plugin rather than a bukkit plugin

undone axleBOT
quiet ice
#

Though even in the context of spring it does not make any sense given that BeanFactory is an interface

#

Because I googled it?

chrome beacon
#

It's an interface

dry hazel
#

wat

quiet ice
#

I really wish ignoring on discord would work like ignoring on IRC

dry hazel
#

what are you talking about

#

it's safe to presume anything to do with beans is spring

#

your code is all underlined red, so instantiating that type is probably wrong too

quiet ice
#

They are probably trolling at this point

#

sighs deeply.

dry hazel
#

I just love to entertain random individuals on the internet

quiet ice
#

You are lucky this isn't papermc, you'd be gone pretty soon over there

#

Go back there. People there at least appreciate your work. Anyways, time to code some more Java 6 code

#

Your mom

hushed spindle
#

PrepareItemCraftEvent#isRepair() seems to always return false, can anyone else confirm

quiet ice
shadow night
#

Who was there

#

Is it the lgbtq guy

quiet ice
#

Yeah. regardless, good riddance

shadow night
#

geol, what is it about java 6

quiet ice
#

At this point it is just a meme

#

Tbh the entire project is a meme - who in the right mind would reimplement Mixins if they could just fork it?

slender elbow
#

you

#

oh i missed "in the right mind"

#

my bad

quiet ice
#

The funny thing is, I still use sponge alongside micromixins - in fact the micromixins impl is just in an experimental branch

sullen marlin
shadow night
#

When will we have a java 2 coding experience

hushed spindle
#

checking if the grid contains two identical tools is the workaround im using

sullen marlin
#

open a bug report

#

?jira

undone axleBOT
quiet ice
young knoll
#

Are people trying to mixin minecraft alpha

shadow night
#

Lmao

quiet ice
shadow night
#

Damn

quiet ice
#

But I think that project got a little bit forgotten since people only use a fabric variant or other more appropriate modloaders

quaint mantle
#

How to check resource loaded status?

quiet ice
#

what exactly do you mean with that? Do you refer to resource packs or?

fleet yarrow
#

I'm currently developing a plugin with multi-version support that is capable of handling fake player entities. I just noticed that in the newest version (1.20.4, NMS 1_20_R3) the "connection" field in the "connection" field of a ServerPlayer object has been made protected.
Or in code:

((CraftPlayer) player).getHandle().connection.connection instanceof FakePlayerChannel

This worked fine on all 1.20.x versions but just got broken in 1.20.4, Is there any workaround to this?

#

protected final Connection connection;
The field has been made protected only in 1_20_R3

quaint mantle
#

Just one question why are you doing .connection two times?

quaint mantle
fleet yarrow
#

I then need to get the Connection class from that as that's the class I'm injecting in the fake players.

chrome beacon
quaint mantle
fleet yarrow
chrome beacon
#

also sigh not another npc plugin

#

How are there so many people struggling with it

slender elbow
#

YANPCP

sullen marlin
#

because everyone wants to DIY rather than use an API

fleet yarrow
chrome beacon
#

you're making npcs

quaint mantle
#

Do you really need this to manage NPCs? .connection.connection

chrome beacon
#

yes

quaint mantle
#

I've never used this thing and still created them successfully

worldly ingot
#

Seems like a weird thing to promose, Emily

#

But if it's what you recommend

slender elbow
#

absolutely

worldly ingot
#

That's actually how you get through each day. It makes sense

sullen marlin
quaint mantle
#

I can't really see why you are using this. Maybe I don't know enough, but I can't imagine any functionalities that wouldn't work in the way I used them.

fleet yarrow
quaint mantle
#

What?

#

undetectable spoofer what is that

fleet yarrow
sullen marlin
#

not shady at all

quaint mantle
#

undetectable?

fleet yarrow
# sullen marlin not shady at all

I mean it's not really shady, it's just adding fake players to a server to make it seem like there are more players online then there are. My question still remains though, is there any specific reason why the field was made protected in 1_20_R3 and is there a workaround?

quiet ice
quiet ice
quaint mantle
slender elbow
#

you sound just like cleverbot

quaint mantle
fleet yarrow
quaint mantle
#

Or do you display other players on the server too?

fleet yarrow
#

I'd really just need to know why the field has been made protected and if there's any workaround to it

quiet ice
#

workaround would be reflection

quaint mantle
quiet ice
#

Though I do wonder how this would look like in the not-so-far-future

#

I'd not be surprised if reflection and stuff got disabled thanks to JPMS

slender elbow
#

i mean

quaint mantle
#

Broo I just imagined how it would look like a server full of bots with chatGPT api. That would be the perfect prison server.

slender elbow
#

anything in the unnamed module will behave as it always has before jpms

fleet yarrow
fleet yarrow
#

😛

quaint mantle
quiet ice
#

Some would say that would never happen - others say that is the best thing ever

#

In the greater java community the latter opinion seems to be the most popular one

young belfry
#
22:07:41.781: [Kore-Recoded] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/main:main
error: dst refspec main matches more than one
error: failed to push some refs to 'https://github.com/GhostAndry/Kore-Recoded.git'

when i try to push from intellij it gave me this. some can help me to fix it?

grim hound
#

Does anyone know why this is a list?

#

It's just 1 in size

slender elbow
#

singleplayer shenanigans

grim hound
slender elbow
#

which also exists in the client

grim hound
#

so why is this a list?

#

It 100% could've been a single object

slender elbow
#

when you open a singleplayer world it'll spin an integrated server that also uses netty, but it's an in-memory channel, a queue of packets, rather than consuming actual networking resources

#

said channel is put in that list, and then if you want to click that "open to lan", it'll use an actual network channel, bind to a port etc, and also put it in that list

#

that mechanism obviously does not exist in the dedicated server, so the list will always contain one element

#

but in the client it can contain 1 until you open the level to the LAN, then it'll have 2 serverchannels

#

or, futures

grim hound
#

why not just

#

make a different code for the server?

slender elbow
#

because having shared common logic is good

#

there are no non-trivial downsides to that approach and it works well

grim hound
#

I guess makes sense

soft geode
#

where are the docs?

thin wind
#

Hello i try to open a lvl 30 enchanting inventory , i made this it is working the enchants are the same as the lvl 30 , but one problem i am just changing the level cost so the text is still "Sharpness 1" (the lowest for each enchantment). How can i reproduce a lvl 30 enchanting table ? I know that there is offer#setEnchantmentLevel() but it will not reproduce the real lvl 30 one ``` for(EnchantmentOffer offer : e.getOffers()){
if(offer == null) continue;

        offer.setCost(30);
    }```
young knoll
#

I don’t think we really have api for that

#

Paging @river oracle inventory guy

river oracle
sullen marlin
#

OP enchantments be like

#

Silliest concept

young knoll
#

Wait why is level 30 enchanting suddenly = op enchantments

sullen marlin
#

Cause it's like 6x the normal?

#

Pretty sure a sharpness 30 would kill everything instantly without other scaling

young knoll
#

Nono

#

An enchantment table with level 30

#

(Max bookshelves)

worldly ingot
#

Enchanting cost, not enchantment level :p

young knoll
#

Well technically the cost is only 3

thin wind
worldly ingot
#

Buddy. Maybe have less to drink

young knoll
#

He’s trying

sullen marlin
#

I see

#

Fkn phone keyboards

young knoll
#

POV: the slime is wasted

worldly ingot
sullen marlin
#

It's 10am :<

young knoll
#

It’s 5pm somewhere

worldly ingot
#

Good ole CST is getting hammered rn

river oracle
#

hey

#

the CST is great

#

I can assure you we are not getting hammered

young knoll
#

What is the CST

quaint mantle
river oracle
young knoll
#

How many are there

river oracle
#

1

young knoll
#

Not much competition

#

I’m wouldn’t call myself the best @young knoll on this discord

rare rover
#

🤔

signal kettle
#

how could I get some data from one of my class in to another one, more of I want to create custom placeholder that will show int from one of my class

young knoll
#

?di

undone axleBOT
signal kettle
#

thanks

quaint mantle
#

Guys should I make my own event handler system or listener system if the bukkit event system doesn't have enough priorities

minor junco
#

Create a PR

#

¯_(ツ)_/¯

young knoll
#

I mean

#

How many does one need

rare rover
#

wait wtf

#

when did this exist

minor junco
#

Since forever?

rare rover
#

huh weird

#

never seen it

minor junco
#

I mean it's basically the last priority

young knoll
#

Don’t modify the event in it

#

Or else

minor junco
#

?jd-s

undone axleBOT
quaint mantle
#

there's a lot of ordering that I need

#

and whatever 6 is probably not enough

#

so I might just make one that goes by numbers

young knoll
#

If you need ordering within your plugin then just handle it yourself

#

With a single listener method and then a list

#

If you need ordering among plugins that’s another story

quaint mantle
#

I think I have an idea of what ima do

inner mulch
#

if i send 4 messages after another, can there be another message sent in between(from another kind of event) or are these messages always one after another?

rotund ravine
inner mulch
#

but non async this cannot happen, right?

quaint mantle
#

It shouldnt

#

by how I imagine it, if one event listener does something heavy, the rest of the listeners must wait

#

in a non async environment

young knoll
#

Message sending can be done fully async

#

So there’s no guarantee

#

Unless you used a bundle packet

slender elbow
#

i mean

#

even if you use a bundle packet

#

if someone sends a message async while the bundle window is open, it'll sneak in

young knoll
#

I thought the bundle packet was constructed with a list of packets

#

And then the start and end is handled by netty

slender elbow
#

the bundle isn't handled by netty, but that's besides the point, but if someone else is queuing a packet asynchronously while you have a packet bundle open, it will sneak into the bundle

#

it isn't bound to any thread or caller in particular, it's just a queue in the end

young knoll
#

Mmm

#

I see

rare rover
#

intresting...

tender shard
#

oh no... did github change their UI? Now one has to scroll back up to see the regular menu bar at the top... (e.g. with the github logo to go the start page)

hoary light
#
if (location.getBlock().getType() == Material.AIR){
    Material blockType = Material.BARRIER;
    event.getPlayer().sendBlockChange(location, blockType, (byte) 0);
}

My character should be lying down but for some reason the character is standing for everyone and the server and just for me to lie down.
Does anyone know how to make the character lie down so that there are no blocks (or for one player only)?
minecraft version 1.19.4

sullen marlin
echo basalt
#

Still looks the same to me

#

I do have a tampermonkey script for the old feed

grim hound
#

Since it only makes sense that only the player with spoofed block packets is the only one experiencing the spoofed block packets

hoary light
#

oh

wintry lynx
#

Anyone know a good way to stop a projectile from breaking on hit? Like a snowball, ender pearl, egg, etc?

valid burrow
#

just let it fly in the air?

wintry lynx
valid burrow
#

why

#

well

wintry lynx
#

So i can teleport it, use it for other stuffs

valid burrow
#

ahh

#

well

wintry lynx
#

I plan to use it for several things

#

And creating a second projectile doesnt really work

valid burrow
#

you can detect when its about to hit something and then teleport it away before it does

valid burrow
#

would definitely be the preferred way

wintry lynx
valid burrow
#

then link them to the new projetile

wintry lynx
#

So creating a new one does nothing

wintry lynx
#

Its a timed event

valid burrow
#

just tell me what exactly you are trying to achive

wintry lynx
#

so I cant change objects like that

valid burrow
#

cause what i have from you so far doesnt leave me much room to help you

wintry lynx
#

Projectile hit object, bounce off object based on the config

valid burrow
#

okay

#

check onentitymovevent

#

when its about to hit

#

then

#

turn around

#

by

#

reverting velocity

wintry lynx
#

There is an on entity movement listener?

#

What exactly does it check for?

#

There is no such Event

#

Just looked at the docs

echo basalt
#

bkcommonlib has it

#

paper does too iirc

shadow night
#

How can I make a fake player that will like redirect all chat messages it gets into a file or something

manic crown
shadow night
ocean hollow
#

I think I’ve seen inventory with 36 slots before, isn’t there such a thing?

shadow night
#

A 4 row inventory?

ocean hollow
#

9, 27, 54, and what else? or all that are divisible by 9 in this range

shadow night
#

It goes up to 6 rows iirc

remote swallow
#

there should be an inv for every multiple of 9 up to 54

manic crown
#

does someone know why this animates only sometimes

        TextDisplay t = (TextDisplay) damager.getWorld().spawn(interaction.getLocation().add(0, 1, 0), TextDisplay.class);
        t.setText(AdventureUtil.serialize(Component.text("-" + damage).color(TextColor.color(0xff0000))));
        t.setBillboard(Display.Billboard.CENTER);
        t.setAlignment(TextDisplay.TextAlignment.CENTER);
        t.setBackgroundColor(Color.fromARGB(0, 0, 0, 0));
        t.setInterpolationDuration(20);
        Bukkit.getScheduler().runTaskLater(SillySMP.getInstance(), () -> {
            Transformation transformation = t.getTransformation();
            transformation.getTranslation().add(0, 1, 0);
            t.setInterpolationDelay(0);
        }, 20);```
smoky anchor
manic crown
#

so I have to set it?

smoky anchor
#

Yup, just like ItemMeta

manic crown
#

okay

#

I'll try

#

works now, thank you

pliant umbra
#

Hi I'm new to plugin development.

This is being called twice:

`public void onPlayerInteract(PlayerInteractEvent event) {

// Check if the action is a right-click                 
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)){`

Is there any reason for this that is related to this code bit here. I'm basically just clicking in the air. It calls twice that it clicks the same grass block I'm pointed at.

Any help would be appreciated.

smoky anchor
undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
smoky anchor
pliant umbra
tender shard
#

Next time just read the javadocs :p

valid burrow
#

alex thats mean

#

dont tell people to read docs

#

thats torture

#

especially for new devs

pliant umbra
#

Even with this page of the docs, its not exactly bold and obvious. Although maybe it should be as it probably causes a lot of problems.

But the CafeBabe bot does a nice job of laying it out.

valid burrow
#

its literally on the top of the page

#

lol

upper hazel
#

how can I create a "bone meal effect" programmatically? I haven't found the information I need

#

real grow

upper hazel
#

it's too bulky and it's hardly suitable for other plants.

valid burrow
#

scroll down.

upper hazel
#

naah not NMS

#

I have a limited budget

wooden frost
#

Begginer level eror, but dont get it. How do you make a list that can extend? it generates an exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0

List<Integer> list = new ArrayList<>(40);
                            plugin.getLogger().info(Integer.toString(slot));
                            if(fusePerItem.get(player.getUniqueId())==null){
                            list.get(slot).equals(0);

                            }
#

like i am pretty sure i define the size for the list as 40

#

so why does it say its out of bounds?

remote swallow
#

looking at that you never populate the list

elder harness
#

In 1.20, is it still possible to add a fake glow effect to an item without actually adding a new enchantment? No, I don't want to add a random enchantment and hide the enchantments using a flag. I tried using NMS to change the ench compound, but that doesn't show me any working result. Here is my code: https://paste.md-5.net/iquhuseqev.cs

sullen marlin
shadow night
wooden frost
smoky anchor
elder harness
remote swallow
wooden frost
remote swallow
#

ah it doesnt exist on list

wooden frost
remote swallow
#

easier to just null check first

sullen marlin
wooden frost
smoky anchor
# sullen marlin I don’t think it does

Hmmm, someone could just try to give themselves the item and see
(I can't, at work rn)
/give @s iron_sword{Enchantments:[{}]} 1
(I think they changed the enchantment tag in newer versions, hm)

wooden frost
#

OH WAIT

#

HOLY MOLY

#

1000 IQ

remote swallow
#

just null check the result of get

wooden frost
#

wait no

#

not 0 iq

shadow night
#

Would 1 == new Integer(1) be true

wooden frost
#

thought it could work

remote swallow
#

that wont fill the list

wooden frost
#

yeahh

remote swallow
#

just because you set the size doesnt mean it has content

#

just null check the result of get or use autoboxing

wooden frost
#

what

remote swallow
#

get(index) == nullor int xyz = get

wooden frost
#

mean dis?

remote swallow
#

whats the point of the list if you define it right there

#

im getting the sense of xy and you should learn java

#

?learnjava

undone axleBOT
remote swallow
#

?xy

undone axleBOT
wooden frost
#

uhhhhhhhh

rotund ravine
undone axleBOT
shadow night
smoky anchor
shadow night
#

Hnmm

sullen marlin
#

Only cause of intcache

shadow night
#

Cause of what

eternal night
quaint mantle
sullen marlin
eternal night
#

this has nothing to do with int caching cat_what

#

the integer gets unboxed

sullen marlin
#

Shrug

wet breach
#

here is an example where the cache can screw you

#
   public static void main(String[] args) {

        Integer a = new Integer(1);
        Integer b = new Integer(1);

        System.out.println("a==b? " + (a==b));

        Integer c = Integer.valueOf(1);
        Integer d = Integer.valueOf(1);

        System.out.println("c==d? " + (c==d));

the following output is this

a==b? false
c==d? true
eternal night
#

oh

#

frost was faster

shadow night
#

🤯

#

Java doing crazy shit

eternal night
#

May valhalla save us all

minor junco
wet breach
# shadow night Java doing crazy shit

yes but no, how you can understand the example in why it works out that is because the first two new integer calls is really in fact this

Integer a = new Integer.valueOf(1);
#

reason it turns into valueOf is because we are mixing types. Primitives and objects

#

since we already have a valueOf explicitly stated in the code

#

Java will take what was cached for those and see well these look the same

#

and thus, now the cache starts screwing you without realizing it 😛

#

but now, you have been educated in this and hopefully you will be more aware of your code in mixing types 😄