#help-development

1 messages · Page 887 of 1

lament maple
#

Tried spawning a Pig for example and it said in console "[23:06:00 INFO]: Placed (Outside if statements): Pig"

quiet ice
#

And nothing else?

lament maple
#

nope

quiet ice
#

Because I fully expect Placed: Pig

lament maple
#

Nope, it doesnt get logged thats the weird thing

#

Nvm it does sorry

#

Im stupid

quiet ice
#

Okay, and what happens if you spawn in an item frame/amor stand/whatever?

lament maple
#

But the thing with the itemframes etc doesnt get logged and it automaticly despawns (event.setCanceled(true))

tender shard
#

As i said, try HangingPlaceEvent for item frames and paintings

lament maple
#

Sorry im new to coding too btw.

tender shard
#

If it doesnt print anything about itemframes when you cancel it, then its not that part of code that cancels it

lament maple
#

I mean i have something else for creatures but im pretty sure a item frame isnt a creature..

#

@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
event.setCancelled(true);
}

tender shard
#
@EventHandler
public void onSpawn(EntitySpawnEvent event) {
  System.out.println(event.getEntityType());
}

what does this print when you place an itemframe?

lament maple
#

Doesnt print anything wtf

#

But theres no where else that checks the entityspawnevent

#

Do you want me to screenshare real quick?

tender shard
#

placing itemframes etc will only call a HangingPlaceEvent from what I see. You must be cancelling placing them somewhere else, e.g. playerinteractevent or sth

lament maple
#

Can i screenshare real quick think it would be much easier

#

@tender shard

orchid brook
lament maple
#

Every 2 seconds all entities are being removed automaticly by my plugin, i dont know why i did that but it was stupid. Thanks for your help though!

tender shard
echo basalt
#

update: I wrote a load balancing service in like 5 hours

#

I can just be like "hey I need at least 5 games up" and it'll pick servers and do it

#

I think I can get this done in like a third of the deadline if I really try to

dry forum
#

whats the best away to go about saving data to a chunk? im making a plugin where you can claim chunks and i want to have the owner and other stuff attatched to the chunk, should i create a file for each chunk?

echo basalt
#

PDC?

#

Either that or get the chunk key and use it as an index in a database or sumn

dry forum
#

how would i get the key? i kinda wanna make a file for each chunk since im gonna be storing quite a lot of data

echo basalt
#

Check the code

#
public static long getChunkKey(int x, int z) {
    return ((long) x << 32) | (z & 0xffffffffL);
}
dry forum
#

so i assume id just do the x and z for a location within the chunk and itll give me a unique key for that chunk?

echo basalt
#

That's chunkX and chunkZ

#

For a key within the chunk there's the other method

#
public static int getBlockKey(int x, int y, int z) {
    // x and z are 4 bits
    // y is 8 bits

    return ((x & 0xf) << 12) | ((y & 0xff) << 4) | (z & 0xf);
}
#

If you're storing A LOT of data it might be better to order them in XZY instead of XYZ

dry forum
#

im kinda confused, im just trying to get a unique key for each chunk so i can create a file with that and get a file with that so if i had 1, 1, 1, get a unique id for the chunk that location is in, then if i did like get(2, 2, 2), id get that file as well since its in the same chunk, just a different location

echo basalt
#

Yeah so

#

Each chunk has a coordinate

#

Which you can get by doing locationX / 16, locationZ / 16

#

So that can be your file

ornate heart
#

Anyone know how ItemsAdder crops work? Like, it's planted do they have custom models? I'm making a custom crops plugin that's going to support ItemsAdder crops.

spare mason
#

why setting the base value of generic max health can produce nullpointerexception

dry forum
#

alright thanks

quaint mantle
#

@echo basalt how do you guys manage configs at work

#

is it just the hard coded string .get

echo basalt
quaint mantle
#

Idk why but I just don't trust that lmao

remote swallow
#

how do you not trust code

#

tf

echo basalt
#

Or here if you don't care about reloading

#

this abstractconfig stuff is multi-platform

rare rover
#

🤔
here's my code:

fun registerSerializers(packageName: String) =
        Reflections(
                ConfigurationBuilder()
                    .forPackage(packageName)
                    .setScanners(Scanners.SubTypes)
            )
            .getSubTypesOf(Serializer::class.java)
            .forEach {
                val serializer = it.getDeclaredConstructor().newInstance() as Serializer<*>
                registerSerializer(serializer)
            }``` and da error:
```java.lang.NoSuchMethodError: 'org.reflections.util.FilterBuilder org.reflections.util.FilterBuilder.excludePattern(java.lang.String)'``` i dont use reflections that much so i have no clue
echo basalt
#

I use it like everywhere

rare rover
#

rightttt

#

i'm so smart

young knoll
#

Yay reflection based configs

rare rover
quaint mantle
#

Ima guess it also does the io operations

rare rover
#

kinda ugly but whatever

#

sqlite annotation api

#

generates everything for ya

remote swallow
#

sus

rare rover
#

actually so true

#

i was wanting to use reflections api for serializers

#

but its whatever

#

i have another method just more bulky for the user

slender elbow
#

jfc

#

have you heard of kotlinx-serialization?

#

or jetbrains compose

rare rover
#

i actually totally forgot about that library

#

could always use that

quaint mantle
#

If you wanna change the name of a field

heavy zephyr
young knoll
#

This is why I keep my field names and config names separate

#

So changing the field name doesn’t break old configs

quaint mantle
#

ok but what if you want to change the config field name

young knoll
#

Well then you’d need to update old configs

#

Same as if you were reading it manually

rare rover
#

sqlite sucks for updating a table

#

use mongodb for that

quaint mantle
#

damn

#

So you just going to deal with it like that

remote swallow
#

couldnt you just ALTER TABLE name RENAME COLUMN name to newname

rare rover
#

i mean you rename yeah

quaint mantle
#

what I think you can do

rare rover
#

but changing a value is different

quaint mantle
#

is like

#

Use version control

rare rover
#

i could make a migration system but honestly, too lazy

quaint mantle
#

so in each config have a "version"

remote swallow
#

that doesnt really work for sql

quaint mantle
#

why

#

I've never really used sql

#

lol

remote swallow
#

well, it could but its not funnest

#

you would end up 1 table per version and have a wrapper table which is more data and then you have to handle converting an updating all that data and its just not fun

#

especially when theres tons of it

young knoll
#

You could also just

#

Decide on good names from the start

remote swallow
#

or just never change them

quaint mantle
#

lol

quaint mantle
#

how would i turn a bukkit color to a normal java color

tribal zephyr
quaint mantle
#

java.awt.Color

young knoll
#

Generally via the rgb value

#

There are various to and from rgb methods

quaint mantle
#

huh

#

ok i foudn it thx

worthy star
#

whats better, gradle or maven

agile anvil
#

Totally depends on what you need and your preferences. In most case maven is enough

quaint mantle
ivory sleet
quaint mantle
#

Gradle users prob dont care

#

About speed

#

||5min build time vacation dont hurt||

icy beacon
#

It takes me 100 seconds to buildFatJar with Gradle 🥲

#

Not a plugin , a rest API, but like still

ivory sleet
#

I mean gradle has auto incremental builds and can use the daemon, but like it all comes down to what you need, as said there are many times when gradle beats maven, at leaat there used to be solid metrics saying that, unsure whether newer versions of maven addressed the competition correspondingly

ocean hollow
#

how can I write
start a plugin if I don't have Minecraft Development? Do I just need to create that structure and add dependencies on spigot?

#

I just updated idea, but it doesn’t support Minecraft Development

jagged bobcat
wet breach
# quaint mantle Maven: Very fast Gradle: More configuration and easier to modify build process

both maven and gradle are fast if you know how to use both of them. Thing is, Maven is designed to be conservative with resources by default out of the box. This increases the odds of successful builds without much worry in way of configuring. Gradle is the opposite and will attempt to consume larger amount of resources however has the side effect of failing out of the box if on a low spec system

#

for the most part in terms of plugin development there it is really down to preference which is used. There is limited plugins that are large enough to even remotely see the effects of either of them

wet breach
#

you don't necessarily need the MC dev plugin for IntelliJ to actually do plugin development

#

some of us here don't even use IJ at all such as myself. I use Netbeans which does not have such plugins like MC Development 😉

#

The advantage of using MC Development is that it takes care of setting up the structure for you, like adding the plugin.yml etc

#

creating the main class file with the onEnable and related methods etc. However you can actually accomplish this youself by creating a project template

#

and then using your template anytime you want a structure for plugin project

#

I am pretty sure IJ is capable of this, I know Netbeans is

quaint mantle
#

Bros wrote essays💀☠️

primal goblet
#

Hey i added this in my pom.xml

<dependency>
  <groupId>anything</groupId>
  <artifactId>anything</artifactId>
  <version>1</version>
  <scope>system</scope>
  <systemPath>${HOME}/what/ever/the/path</systemPath>
</dependency>
``` so the issue is when i build it with `mvn clean package`. i got `NoClassDefFound` errors in the console.
so how can i make this file compiles with other deps? thank you
drowsy helm
#

have you debugged system path and made sure its correct

primal goblet
tender shard
#

that's correct

#

why do you use system scope?

#

you are supposed to use compile if you want to shade it

primal goblet
#

how can i attach a file to a compile scope?

tender shard
#

yeah, you shouldnt use systempath

#

isnt it deprecated anyway?

primal goblet
tender shard
#

just include the dependency normally

primal goblet
#

but how can i fix it rly quick?

tender shard
primal goblet
tender shard
#
  1. install your dependency to your local maven repo (mvn install:install-file ...)
  2. add it to the pom with scope compile, and without systempath
primal goblet
#

got it, i'll follow the blog. thank you

tender shard
#

np

wet breach
#

it would be dumb if it was, because how else are you supposed to declare a dependency that is on the system but no where else? lol

jagged bobcat
primal goblet
#

@tender shard i have around 30m trying and from ur blog it works perfectly thank you again 🫡

tender shard
tender shard
wet breach
#

obviously not if its a system dependency

#

Anyways, its deprecated but nothing replaces it

#

so yeah you are right as it does say deprecated

quiet ice
upper hazel
#

hey protocoLib 1.20.1 exists now? were i can find it?

quiet ice
#

System scope makes little sense. But for 90% of cases you can use file:// repositories. For the rest you can generate potemkin jars

quiet ice
upper hazel
#

idk

#

i just want find protocolLib support 1.20.1

quiet ice
#

Yeah, so Jenkins

#

Though 1.20.1 might have been a version that was too short-lived to have received an update

upper hazel
#

i was find this in forum but the link is not working

quiet ice
#

But I have 0 knowledge about MC versions beyond 1.16

upper hazel
#

hm....

#

so NMS i gess

#

pain moment

upper hazel
#

were you find

#

this

quiet ice
#

Common sense?

upper hazel
#

i mean what the version

#

this for 1.20.1?

#

in spigotMC protocolLib 1.20.1 not exists....

#

were you find this

#

give link bro

quiet ice
#

As I said, I googled their Jenkins, got the latest build and well here we are

upper hazel
#

this link not work

tender shard
upper hazel
#

site have 2 links "1.8 -> 1.20.2" link not work

tender shard
#

if build #679 doesnt work, there is no version for 1.20.2

upper hazel
tender shard
#

?

flint coyote
#

No he's saying update your server

tender shard
#

I told you, I don't know. And I said that if the linked version of PLib doesnt work, no version will work. Update spigot

#

your version is rusty

flint coyote
#

old spigot versions are based on rust? /s

tender shard
#

someone call the plumbers - we need a newer spigot

upper hazel
#

it's kind of strange don't you think? There is a version for 1.20.4 but not for 1.20.1

flint coyote
#

why would your server run on 1.20.1 instead of 1.20.4?

upper hazel
#

my server is on 1.16.5

flint coyote
#

Question still stands - for whatever server

upper hazel
#

I answered your question. I don't know, maybe people don't like 1.20.4

#

because the farther you go, the lower the fps

flint coyote
#

Maybe you shouldn't run the game or servers on 10 year old hardware

upper hazel
#

after 1.16.5 it really gets worse
everyone already knows

#

and technology has nothing to do with it

#

my pc is not cheap

upper hazel
flint coyote
#

Then tell them to update. There won't be any gameplay difference between 1.20.1 and 1.20.4 anyway

grim hound
#

is there a way to directly download a jar from a maven repository?

rotund ravine
#

Sure

#

Why

grim hound
flint coyote
#

it's literally any lib page on maven

grim hound
#

but

#

the maven page

#

which

flint coyote
warm mica
#

I had a cool website that'd download all of it's dependencies as well and compress it all in a single jar

clear elm
#

whats the item name for colored leather armor

dire marsh
#

leather armor

#

ColorableArmorMeta/LeatherArmorMeta

tender shard
#

huh, which armor is Colorable but not Leather?

clear condor
#

Hello guys

#

im looking for someone who can write me 1 plugin

#

for 15$

#

its simple plugin

smoky anchor
#

?services

undone axleBOT
pliant topaz
#

How would I go about having a KeybindComponent shown in an items lore? As lore only accepts strings :/

inner mulch
#

which is impossible as no packets are sent when a player changes keybinds.

smoky anchor
inner mulch
#

?

smoky anchor
smoky anchor
tender shard
#

you can set the itemstack's name to components using UnsafeValues#modifyItemStack(...)

#

not very nice though

obsidian plinth
#

whats a good way to make it so every enchant table always act like it is at max power without bookshelves around it.

grim hound
#

help

#

herp

pliant topaz
#

ig I#ll just say 'right click' and not get the keybind

grim hound
#

I have this module, and it's jar file is found, but the class is not

grim hound
#

and override the offers with maximum power

obsidian plinth
#

i didnt eve nknow that was a event

#

XD

grim hound
#

wait, the classes just didn't build

tender shard
#

Are you not using maven or gradle?

grim hound
#

but now I have another issue

grim hound
#

I'm that guy

inner mulch
tender shard
#

No gradle/maven = RIP

grim hound
#

bruh it just started working

#

I don't get java class loading

tender shard
#

did you properly restart the server?

grim hound
grim hound
grim hound
#

oh, then I have another problem

#

I'm saving user information into a file

#

but if I shutdown the server by closing the terminal, there's a non-zero chance that not only the current information won't save, but also it'll all be erased

#

I'm saving all users into one file

tender shard
#

yeah well if you just Ctrl+C it, ofc it doesn't have time to save anything

#

either save your data directly when it changes, or every X minutes

#

and saving all users into one file probably isn't such a good idea

grim hound
tender shard
#

depends. it's extremely fast or extremely slow

grim hound
#

uh

tender shard
#

but you shouldnt worry because you should do it async anyway

#

(except in onDisable, there you should do it synced)

grim hound
#

I do it on WorldSaveEvent and onDisable

tender shard
#

i usually keep a list of completableFutures for "saving tasks" and in onDisable I just join() them

grim hound
#

async

tender shard
#

I got a storageManager that keeps track of storages (a storage is usually one mysql table or one json file, etc)

It has a method shutdown() that returns a CompletableFuture.allOf(...) all tasks that need to be saved. And in onDisable I call that shutdown() method and get() it (to force it do be done right now) https://github.com/SpigotBasics/basics/blob/main/plugin/src/main/kotlin/com/github/spigotbasics/plugin/BasicsPluginImpl.kt#L132
https://github.com/SpigotBasics/basics/blob/main/core/src/main/kotlin/com/github/spigotbasics/core/storage/NamespacedStorage.kt#L58

grim hound
#

Kotlin

#

seems pretty similar

#

what if I were to just save it every 10 seconds?

#

but I still don't get how my file information can be all erased on a sudden crash

#

is it possible that if the immediate crash occurs just at the moment the file's writer opens and resets the file's lines?

tender shard
#

No idea

grim hound
#

hmm

#

is that really how you can load a class?

dry hazel
#

well yea

grim hound
#

never knew

#

why doesn't it work with just like LockSupport.class.getClassLoader()?

dry hazel
#

huh?

grim hound
#

well

#

it won't the class then

grim hound
#

why?

grim hound
dry hazel
#

it should load it either way

grim hound
#

didn't work

#

(on my own class ofc)

dry hazel
#

first of all why do you need to load it

grim hound
#

I'm just curious

#

cuz for now I just create a static void init() and call it

young knoll
#

Yeah just assigning the class to something should work

#

You can always double check the compiler code to make sure the compiler didn’t yeet it

halcyon hemlock
#

what packet for elytra animation?

grim hound
halcyon hemlock
grim hound
#

it was some player command stuff

halcyon hemlock
#

client bound

grim hound
#

then try spoofing window items

#

replace chestplate with elytra

#

and set player.setGliding(true)

young knoll
#

I mean you don’t even need the elytra

#

You can just set them as gliding

sand spire
#

Is it better to save a bunch of stats that are 0 in a configfile but create them all at once, or only save stats that are greater than 0 but add new stats to the configfile everytime someone changes a stat from 0-1

Example 1:
UUID:
playtime: 0.1
kills: 0
deaths: 0

Example 2:
UUID:
playtime: 0.1

Example 2 after player gets first kill:
UUID:
playtime: 0.1
kills: 1

young knoll
#

Cache them in memory and just save on occasion

#

Skipping any 0s

sand spire
#

Alright thanks

ivory sleet
#

It depends

#

I mean given a specific stat, if you can define a policy that absence implies 0 then sure

#

But it can become a bit complicated if you for some stats want another default/fallback value

#

Or if per say, you want to change the default/fallback value, or change the format of how the data is structured

sand spire
#

👍 the stats i'm working with should all be default 0/false so for now i'm good thanks both

inner mulch
#

is there something that is like a hashmap, but the key has multiple values, depending on a second parameter?

#

example:
myMap.get(key, parameter1); returns hello
myMap.get(key, parameter2); retuns goodbye

chrome beacon
#

You can make your own class for that

inner mulch
#

i can, but im not sure if im smart enough for this kind of stuff

slender elbow
#

sounds like you want a Table or a MultiMap?

inner mulch
#

multimap?

chrome beacon
#

You could also just concat the key and param and then use that as the key in the hashmap

slender elbow
#

a Table<C, R, V> is a Map<C, Map<R, V>>
a Multimap is a Map<K, Collection<V>>

#

guava has both of those

chrome beacon
#

neat didn't know Guava had those

#

Guava is provided by Spigot right?

slender elbow
#

yeah

#

well, minecraft

#

pretty useful stuff

worldly ingot
#

Bukkit provides Guava too

#

Or at least exposes it to the API :p

river oracle
#

Bukkit exposes FastUtil when????

eternal night
#

😏

#

I have a fork for ya

#

that does so

river oracle
river oracle
#

sigh well maybe I'll throw out a pr tonight if I have time

worldly ingot
#

tbf, Bukkit really should expose FastUtil. It's so useful lol

halcyon hemlock
#

expose??

#

anyways

quaint mantle
#

guys

river oracle
icy beacon
quaint mantle
#

i can't send ss

#

sad

river oracle
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

icy beacon
quaint mantle
#

where is spigot

fringe spruce
#

Can you guys tell me how can I create a custom written book

quaint mantle
fringe spruce
#

I've tried some methods but they didn't work

icy beacon
#

Create a Maven project and just add the repo, dependencies and plugin.yml yourselves ig

icy beacon
#

And what exactly didn't work

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.

#

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

fringe spruce
#

Gimme the time to answer

quaint mantle
#

i want to learn spigot uhh

fringe spruce
#

When I open the book it says "invalid book tag"

chrome beacon
icy beacon
quaint mantle
#

i can improve myself if i can learn basic things about spigot

quaint mantle
#

thanks

fringe spruce
icy beacon
#

Do not ping me please

fringe spruce
#

Oh sorry man

icy beacon
#

I've read your message and I do not know what to tell you

#

You provided basically no information

#

No code you've written

#

Nothing you've used

#

So how exactly can I help you

chrome beacon
#

Time to bring the mind reader

fringe spruce
#

Lemme screenshot

river oracle
icy beacon
chrome beacon
fringe spruce
#

Okok

icy beacon
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
inner mulch
#

I have a GenericObject<K> in a HashMap, is it possible to know what K is when i get the object?

ivory sleet
#

yesnt

fringe spruce
#
            BookMeta libromultam = (BookMeta) libromulta.getItemMeta();
            libromultam.setAuthor("Polizia");
            List<String> multa = List.of();
            
            multa.add("§7------§9§lMULTA§7------");
            libromultam.setPages(multa);
            libromulta.setItemMeta(libromultam);

            target.getInventory().addItem(libromulta); ```
inner mulch
fringe spruce
#

i don't have the keys to format the codeblock

inner mulch
fringe spruce
#

you know

#

``

#

these

icy beacon
#

Yeah you did it though?

tribal zephyr
#

brain not braining

fringe spruce
#

btw I cant figure out what's the problem in that code

icy beacon
fringe spruce
#

ok lemme try

ivory sleet
#

At some point you may need to make a well-educated guess based on the runtime what type it is

fringe spruce
#

this is so strange because if i set the title it says that an error occured while if i remove that line that sets the title it work but when i opejn thge book it says "invalid book tag"

eternal oxide
#

Books require title and author

fringe spruce
#

yes but when i set the title everything goes wrong

#

if i delete the title line it says 'invalid book tag'

eternal oxide
#

what title are you setting?

#

Max 16 characters and can't be empty

fringe spruce
#

it satisfies this requiremetns

icy beacon
#

Can you send the code once again?

icy beacon
fringe spruce
#

ItemStack libromulta = new ItemStack(Material.WRITTEN_BOOK,1);
            BookMeta libromultam = (BookMeta) libromulta.getItemMeta();
            libromultam.setTitle("§9§lMULTA");
            libromultam.setAuthor("Polizia");
            List<String> multa = List.of();

            multa.add("§7------§9§lMULTA§7------");
            libromultam.setPages(multa);
            libromulta.setItemMeta(libromultam);
#

org.bukkit.command.CommandException: Unhandled exception executing command 'multa' in plugin Lavori v1.0

icy beacon
#

Nothing else?

fringe spruce
#

this is the part that gives errors

#

and from the 2 line its not indented

icy beacon
#

Yeah is there anything else below that which is an error?

tribal zephyr
#

executing command 'multa'

fringe spruce
# icy beacon Yeah is there anything else below that which is an error?

there is a the part that says
net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4] at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1147) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4018-Spigot-864e4ac-95bc1c4]

#

o cant paste it all

#

its too long

icy beacon
#

?paste

undone axleBOT
icy beacon
#

We need the entire thing please

fringe spruce
#

ill send it as a file

eternal oxide
#

List.of() is immutable

icy beacon
#

Will help you a LOT in the future

icy beacon
#

Create it as new ArrayList<>() instead

fringe spruce
#

it worked,thank you guys

grave vigil
#

I am trying to make a plugin to set bounties on players. When a player sets a bounty, it should go to some type of database with the player's UUID and the amount of the bounty. What database should I use? I was thinking SQLite. I want the plugin to be plug and play.

fringe spruce
#

if you use sqlite the plugin will be plug and play

#

in my case it worked

grave vigil
#

just wanted to make sure that there wasn't a better way of doing it

tender shard
#

sqlite, h2, flatfiles, ...

grave vigil
eternal oxide
#

If you are looking to later expand it to support cross server then start with SQLite, if it's only ever going to be a single server use built in yaml

#

?configs

undone axleBOT
tender shard
grave vigil
tender shard
#

it'll hardly make any difference

grave vigil
#

fair

tender shard
#

both have advantages and disadvantages. e.g.

json files: can be easily edited, only have to save files that changed -> daily incremental backup doesnt have to copy a 50mb database everytime
sqlite: only one file, you don't end up backing up 81729 files every day

I'd always let the admin choose whether they want mysql, sqlite or flatfile

grave vigil
coral parcel
#

Hello Team,
im searching for the challenges.jar on the Spigot website but i cant find it any1 know where i can download this
thanks for helping

icy beacon
#

Challenges.jar can be sooo many plugins

#

Ok not that many but if you're looking for a plugin you gotta at least know its name or author lol

river oracle
# icy beacon Challenges.jar can be sooo many plugins

or so you think I actually know of 1 plugin who specifically downloads the Challenge.jar file. Unfortuantely such information can't be given out for free the plugin is too powerful. It could accidentally create the next Hypixel and destroy the balance in the server eco system

icy beacon
#

Y2K_ asserting his dominance as always. I am defeated and leaving

#

I hope I can be as strong and powerful as you one day...

river oracle
icy beacon
#

*anime music starts playing*

river oracle
#

and that's not the vibe I'm going for

icy beacon
#

More like Tomodachi Game's opening

echo basalt
#

yo y2k

#

I got bored

coral parcel
#

when im buying a server which one i schould get to play the plugin the spigot one or vanilla?

icy beacon
#

Spigot

#

Vanilla does not support plugins

river oracle
echo basalt
#

and I wrote some funky code

#

last night

icy beacon
echo basalt
#

(I don't remember doing most of this)

echo basalt
#

and ended up with a whole game management service skullWazowski

icy beacon
icy beacon
#

I guess you can get around with 2GB in the very beginning but as you'll be expanding and/or your playerbase will be expanding, you'll need more ram

river oracle
#

anyways this is def #help-server we humble developers can't help you constructor the next hypixel

coral parcel
#

ok tyvm

icy beacon
#

I remember a dude asked me to help administrate his server, I sshed into his vps to see how things were going and saw him OOMing with 12GB on a 3 server bungee proxy

#

Turns out he allocated like 8GB for bungee and then like 1gb for each server

echo basalt
#

I think I had an OOM yesterday

icy beacon
#

I am not sure what the thought process was behind that

icy beacon
echo basalt
#

I gave my game service like 128mb

icy beacon
#

My net died

#

Nvm

echo basalt
#

uh

#

but I tried making a string with Integer.MAX_LIMIT size because I was reading packets wrong

#

easy fix

icy beacon
#

Holy cow, that's a large string

echo basalt
#

I'm surprised this uses 75mb ram with like 5mb of disk space

river oracle
#

@echo basalt I'll have you know thouhg at minimum I am not bored

#

I have been creating a custom Menu API to wrap NMS

#

it has been amazing no issues

#

besides when IntelliJ crashed lsat night and I lost all of my implementaiton progress

#

I smashed my keyboard and started crying

echo basalt
#

lmfao

slender elbow
#

don't you have auto save turned on

river oracle
#

but it seems to not autosave when crashes occur

slender elbow
#

it saves whenever I change windows or files lol

river oracle
#

maybe this is a lindux moment

#

see I accidently decompiled CraftItemStack wihch fo rsome reasons always crashed my intellij

#

and by the time I realized my mistake I couldn't exit out and had already crashed

#

^ Note I can somehow decompile Material enum fine

worthy yarrow
river oracle
worthy yarrow
#

Other than that, there's absolutely nothing coming / logging from IJ

river oracle
#

linux doesn't have that beautiful "application not responding" screen

#

atleast gnome doesn't

#

idk about KDE or XFCE

worthy yarrow
#

Wouldn't know, I've only ever used windows haha

#

However, it is quite odd how a single crash can sometimes wipe upwards of like 200 lines...

tame wolf
#

Its an easy solution, just be like the cool kids (me) and use google docs 😎

modern badger
#

please, I need skulls like youtube, tiktok etc. for my menu how can i do that. I saw somewhere that it is synced with player so when someone changes that skin will it change also my skull in game?

worthy yarrow
#

When google releases an ide, they will go bankrupt... or get sued for stealing everyone's code

river oracle
#

It should theoretically save ever few seconds for me

#

how I manage to lose 400 lines of code even though auto save should run every 3 seconds is wild

worthy yarrow
#

^ same here but never does when it crashed

river oracle
#

my guess is they have a buffer or something

young knoll
#

Growing up trained me to press CTRL S every 10 seconds without even thinking

river oracle
#

I might manually revert back to manual save because I do press ctrl+s even though I have auto save

worthy yarrow
#

The issue that even then, intelliJ still sometimes doesnt save...

river oracle
#

plus I konw ith ctrl+s its being saved to the file

#

and not some buffer

worthy yarrow
#

so if you forget to do it for a solid 3 minutes that could be an easy 6 methods gone D:

river oracle
worthy yarrow
worthy yarrow
river oracle
#

i wrote 500 lines of NMS implementation

#

I'm still pissed as you can imagine

worthy yarrow
#

oh dear god...

#

Welp time to give up and never code again

river oracle
#

that was my Slot Listening API

worthy yarrow
#

Was it like finished?

river oracle
#

yeah

worthy yarrow
#

That's so awful

river oracle
#

I was a couple line away from finishing before I pressed f3 on accident

#

and decompiled CraftItemStack

ivory sleet
#

💀

worthy yarrow
#

That's like witnessing a murder

river oracle
#

I usually actually have stash open on CraftItemStack for this reason

#

so that I can reflect and commit cirmes in peace

modern badger
river oracle
#

I still think I want to make my own ItemStack implementation I hate how much copying CraftBukkit does

#

especially with the ItemMeta its kinda evil

#

need to switch that over to NBT probably

worthy yarrow
modern badger
#

Yes. and it has like discord icon

#

I will probably find someone with discord head skin online but will it change when that player changes skin?

worthy yarrow
#

Uh I think you'd have to make a custom head with new models that represent the discord logo or wtv

worthy yarrow
#

It might just replace their head with a generic minecraft skull ie: alex, steve, etc

modern badger
#

ah ok thanks

#

I will try to find other way

worthy yarrow
#

I think the best way is to probably bite the bullet and just model your own skull

#

Or perhaps be patient for help here, there are a lot more people who know quite a bit more than I do

hushed spindle
#

1.21 is honestly shaping up to be a great update not even for the actual gameplay changes lmao

#

the technical changes are great

worthy yarrow
#

Imagine keeping up to date

hushed spindle
#

we basically also now have gravity and block break speed attributes

#

in addition to scale, block reach, entity reach, step height

#

all these attributes that should have been implemented from the start are now being implemented

worthy yarrow
#

That's pretty cool

tribal zephyr
#

Any good tutorials from where I can learn Reflections?

hushed spindle
#

yeah

#

hacky custom mining using mining fatigue and running tasks are no longer really necessary

#

unless you want to change the hardness of a block

worthy yarrow
hushed spindle
#

p much

worthy yarrow
#

At the same time, there are a lot of things I could play around with to make perhaps more vanilla mechanics better to actually grind out

#

Obviously it's not just limited to prison servers, but still I think that'll be the main implementation of those new methods

orchid gazelle
#

Sorry but this isn't the right location to look for devs

dry hazel
#

?services

undone axleBOT
vocal cloud
#

post-launch comp usually implies no money KEKW

chrome beacon
#

true

sage patio
#

more ram needed

#

lol

chrome beacon
#

Yeah loading hprof files take a LOT of ram

#

I also ran out while trying to read mine

sage patio
#

rn ram is on a heart attack

chrome beacon
#

How large is your dump?

sage patio
#

23gb D:

chrome beacon
#

Mine was only 8

sage patio
#

wish this was 8 too

chrome beacon
#

and I ran out of 32GB ram while loading it

#

So the program crashed with out of memory error

sage patio
#

VisualVM?

chrome beacon
#

ye

sage patio
#

this is YourKit

#

hope loads it

#

sadge

tender shard
#

does windows not have a working swap file?

#

otherwise spin up a debian VM with 24 gb ram and 32 gb swap :p

sage patio
#

somehow VisualVM did it

#

and YourKit didn't

#

now the main problem is, what is the cause of the memory leak

chrome beacon
sage patio
#

to increase it for this task

#

now, how can i feagure out what is the cause of memory leak?

#

using VisualVM

#

this things are the largest stuff in the memory

tender shard
#

take one of those locations, right click -> show nearest GC root

sage patio
#

3gb location

#

shit

#

i don't have any memory left

#

don't do it

sage patio
#

this is the only options

tender shard
#

fun fact: I only got 1 location in my heap even though I'm running a 3mb plugin lol

chrome beacon
# sage patio

uhhh why are there 30 mil PlayerMoveEvent objects 💀

sage patio
tender shard
#

I think

#

wait lemme check

#

select one specific location (not its references or anything) and then GC root in the menu bar

sage patio
#

i can't see that GC root

tender shard
#

show a screenshot of your whole window

sage patio
tender shard
#

well I see the GC root in your screenshot

sage patio
#

while selecting a location ^

#

ow i saw it

tender shard
upper hazel
#

1.17 and 1.17.x - have equals NMS?

sage patio
#

uh shit another computing

sage patio
upper hazel
sage patio
#

if there is something new in 1.17.1 compared to 1.17

#

how can the NMS be the same

upper hazel
#

Well, for example, don’t change the old by adding a new one

hushed spindle
#

any way i can raytrace a line and get all the entities hit by that line? regular raytrace stops at the first entity hit

tender shard
tender shard
#

anyway there's lots of changes

upper hazel
#

demmm

tender shard
#

you should just use mojang maps, then you don't have any issues

upper hazel
#

that is, for each version you need to add support?

tender shard
#

if you don't use mojang maps, then yes

upper hazel
#

what if i will?

sage patio
tender shard
tender shard
# upper hazel what if i will?

then your code will stay 99 % the same between versions, and you only have to compile it again against the new mappings

#

which basically means, updating to a newer version is as easy as adjusting one line in your pom.xml or build.gradle file

sage patio
#

bad one is that computing was for refrences

#

good news is it didn't crashed

upper hazel
#

I need to create support for a plugin from 1.17.x to 1.20.1 at what stages do I need to change the plugin logic

sage patio
#

GC is still computing

upper hazel
#

in all?

tender shard
sage patio
tender shard
#

nobody uses 1.17 anymore

sage patio
#

and you said click on gc root

tender shard
sage patio
#

wait, 5% use 1.8?

#

how

tender shard
upper hazel
tender shard
#

can you see the "references" before you click on GC root? or does that also take long to load?

hushed spindle
tender shard
hushed spindle
#

but uhh ill ask again, is there any way to raytrace for entities without having it stop on the first entity hit

tender shard
#

well couldnt you have taken a smaller heapdump?

hushed spindle
#

i need all entities in a line

tender shard
#

couldnt you have started the server with e.g. 4gb ram, then play for 2 minutes, then take a heapdump?

sage patio
#

it was set to 20GB memory

#

(not by me)

upper hazel
sage patio
sage patio
# upper hazel mojang moment

its like comparing new games to the old ones like comparing Warzone 3 to 1
the graphics are better, a lot of new things are there and more

#

but its not optimized too yea i agree

upper hazel
#

soo who was use NMS Version support only needs to be created for 1.17 -> 1.18 -> 1.19 -> 1.20 if using Maping ?

sage patio
#

something makes it to happen

#

so i didn't wanted to miss it

chrome beacon
#

It really isn't that 1.20 is worse optimized than 1.8

#

1.8 just has a lot fewer features

upper hazel
hushed spindle
#

1.20 is probably way better optimized than 1.8 but yea it just has much less

sage patio
#

at all, no

upper hazel
#

I saw a video somewhere with fps tests.

chrome beacon
hushed spindle
#

something being better optimized doesnt necessarily mean it will perform better 1:1

#

like

hushed spindle
#

its like comparing a console calculator program to something more advanced like terraria or something

#

bit of an extreme example obviously but you dont go around saying that this shitty calculator program is better than terraria in terms of performance

chrome beacon
hushed spindle
#

its kind of an unfair comparison

upper hazel
hushed spindle
#

if you stripped 1.20 of its features to be equivalent to 1.8 then 1.20 would perform better

#

is kinda what we getting at

#

thats an equal comparison

upper hazel
#

in 2nd place 1.16.5

#

1.20.1 in 10

hushed spindle
#

is it purely comparing fps

upper hazel
#

how did you want to compare performance?

#

FPS is mostly maintained

hushed spindle
#

because its not a fair comparison lol

#

you're comparing something with fewer features to many

#

like of course the one with many more features is gonna perform worse

upper hazel
#

well, let’s say 1.14 is not suitable for comparison; 1.16 is closer to 1.20.1 and still in 2nd place, and 1.20.1 is 10

hushed spindle
#

its not something that can be definitively judged based off of an fps example

#

something can perform better but that doesnt mean you can say its better optimized if it has less features

#

you cant tell without making the actual features equivalent first

upper hazel
#

Do you think the difference of 200 fps can be justified by their functions?

hushed spindle
#

fuckin maybe how can i know that

sage patio
#

@tender shard isn't it better to compute the gc root of all Locations? clicking on the 60mil location, comute GC root and wait instead of doing just one of it? i'm scared i can't find the cause by just computing the gc root of one location

upper hazel
#

you can check by adding generation from 1.20.1 to 1.16 👍

tender shard
#

try it I guess

sage patio
#

if i just see the gc root of 1 location, can i find the cause?

tender shard
#

as soon as you find a plugin or sth, you can go to object and check which other references it holds

sage patio
#

because it caches in files after it loads it

sage patio
#

i'll try the forever option then

#

its computing a percent per 30 seconds, nice

kind hatch
#

If I have a git branch that was merged and then I use that branch to make more changes and want to PR the new changes, will all of the previous commits to the branch interfere with merging? Should I just make a new branch instead?

tender shard
vocal cloud
#

Usually though you'll want to just make a new branch

sage patio
#

@chrome beacon btw did you tried to set the maximum ram for VisualVM?

#

i loaded the 23gb heap on 32gb memory, you should be able to do 8gb for sure

sage patio
#

i hope 8GB doesn't take forever too

chrome beacon
#

It used all my 32GB

#

I saw it in task manager

sage patio
chrome beacon
#

Can't give it more than my system has

sage patio
#

its located in VisualVM\etc

#

visualvm.conf

#

i set it to 20480m

tender shard
#

is there an easier way to multicatch in kotlin?

package com.github.spigotbasics.core.extensions

import kotlin.reflect.KClass

inline fun <R> (() -> R).multiCatch(vararg classes: KClass<out Throwable>, thenDo: () -> R): R {
    return try {
        this()
    } catch (ex: Throwable) {
        if(ex::class in classes) thenDo() else throw ex
    }
}

inline fun <R> Throwable.multiCatch(vararg classes: KClass<out Throwable>, thenDo: () -> R): R {
    if (classes.any { this::class.java.isAssignableFrom(it.java) }) {
        return thenDo()
    } else throw this
}
#

except ofc catching Throwable and then checking when(e) { is FirstException, is SecondException -> { ... } }

tardy delta
#

maybe runCatching

tender shard
#

hm how would that look like?

#

e.g. here, I want to catch three exceptions instead of one for the UnsupportedServerSoftware thingy:

        try {
            returned = executor!!.execute(context)

            try {
                returned?.process(context)
            } catch (e: Exception) {
                logger.log(Level.SEVERE, "Error processing returned command result for ${info.name}", e)
            }

            return true

        } catch (e: BasicsCommandException) {
            try {
                e.commandResult.process(context)
            } catch (e: Exception) {
                logger.log(Level.SEVERE, "Error processing thrown command result for ${info.name}", e)
            }
            return true
        } catch (e: UnsupportedServerSoftwareException) { // <------------------- Also want to catch NoSuchMethod and NoSuchField exception here
            coreMessages.unsupportedServerSoftware(e.feature).sendToSender(sender)
            return true
        } catch (e: Throwable) {
            coreMessages.errorExecutingCommand(sender, e).sendToSender(sender)
            logger.log(Level.SEVERE, "Error executing command ${info.name}", e)
            return true

        }
    }
tardy delta
#

looks like you got that from baeldung lol

tender shard
#

the multicatch thing?

#

that's from chatgpt

#

chatgpt only suggested to do stm like this but then I have to rethrow the exception and I dont like that because it makes no sense

} catch (e: Throwable) {
            when(e) {
                is UnsupportedServerSoftwareException,
                is NoSuchMethodException,
                is NoSuchFieldError-> {
                    coreMessages.unsupportedServerSoftware(e).sendToSender(sender)
                    return true
                }
                else -> {
                   throw e
                }
            }
        } catch (e: Throwable) {
            coreMessages.errorExecutingCommand(sender, e).sendToSender(sender)
            logger.log(Level.SEVERE, "Error executing command ${info.name}", e)
            return true

        }
tardy delta
#

i forgot kotlin doesnt have | for exception params

clear condor
#

how can i check how mutch files is in my package?

tender shard
tender shard
clear condor
#

how can i show my code

#

i cant paste screenshots

tender shard
#

?paste

undone axleBOT
tender shard
#

or get verified

#

!verify

undone axleBOT
#

Usage: !verify <forums username>

clear condor
#

bcs dont works

tender shard
#

because you don't increment

#

for(int i = 0; i < something; i++)

tardy delta
#

could write your multiCatch a bit shorter as return runCatching(this).map { then() }.getOrThrow() though

clear condor
#

i get error on eu.podkladson.commands.size()

tender shard
#

are you trying to call size() on a random package?

#

that obviously doesnt work lol

clear condor
#

yes on my package

#

with commands

tender shard
#

why do you even need to check it at runtime?

clear condor
#

i want to print all my commands

#

to console

tardy delta
#

and you think that works lol

#

what kind of logic is that

clear condor
#

so how can i do that

tender shard
clear condor
#

dont talk to me femboy

tender shard
#

you were the one who asked me questions

#

don't ask if you don#t want answers?

clear condor
#

okey sory

#

thanks @tender shard that actually help me

lunar wigeon
tender shard
#

why not?

lunar wigeon
#

what about he uses custom class for commands, or he needs to iterate through entire package, not only commands?

#

are you najlex? @tender shard

tender shard
#

then one has to use reflection and either check the classloader or the .jar file itself

tender shard
tender shard
#

then you can limit it to certain packages by just filtering the result by startsWith("my.package")

tardy delta
#

next thing to do is to rewrite it in kotlin

tender shard
#
    fun listAllClasses(clazz: Class<*>): List<String> {
        val source = clazz.protectionDomain.codeSource ?: return emptyList()
        val url: URL = source.location
        try {
            ZipInputStream(url.openStream()).use { zip ->
                val classes: MutableList<String> = ArrayList()
                while (true) {
                    val entry = zip.nextEntry ?: break
                    if (entry.isDirectory) continue
                    val name = entry.name
                    if (name.endsWith(".class")) {
                        classes.add(name.replace('/', '.').substring(0, name.length - 6))
                    }
                }
                return classes
            }
        } catch (exception: IOException) {
            return emptyList()
        }
    }
lunar wigeon
tender shard
#

and how?

lunar wigeon
#

also, youi can use library for that

lunar wigeon
tender shard
#

using the system classloader won't work obviously

lunar wigeon
#

thats odd, it worked on my machine

clear condor
#

works on my machine

tender shard
#

plugins are loaded by a separate URLClassLoader

lunar wigeon
#

well it worked on my machine

jagged bobcat
#

Is your plugin going to be used only in your machine?

tardy delta
quiet ice
#

I believe all URL Classloaders support this feature by default

scarlet cypress
#

Hey I was wondering if it was possible to have a plugin active again as I want to continue its development but was unable for a year

quiet ice
#

But I have never used it myself as I am the guy to prefer massive amounts of mass ASM

quiet ice
scarlet cypress
#

Yes !

quiet ice
#

Then I have no experience with that

scarlet cypress
#

Okay 🙂

quiet ice
#

It probably is possible though I just cannot say anything on the how

tender shard
lunar wigeon
#

prove me

tender shard
#
[21:25:50] [Server thread/INFO]: [Basics/Core/BasicsPluginImpl] Showing all classes in pacakge com.github.spigotbasics:
[21:25:50] [Server thread/ERROR]: Error occurred while enabling Basics v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: getResourceAsStream(...) must not be null
        at com.github.spigotbasics.plugin.BasicsPluginImpl.findAllClassesUsingClassLoader(BasicsPluginImpl.kt:155) ~[?:?]
        at com.github.spigotbasics.plugin.BasicsPluginImpl.onEnable(BasicsPluginImpl.kt:96) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugin(CraftServer.java:541) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugins(CraftServer.java:455) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:623) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:409) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:250) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1000) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4039-Spigot-c198da2-4c687f2]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]


    override fun onEnable() {

        logger.info("Showing all classes in pacakge com.github.spigotbasics:")
        findAllClassesUsingClassLoader("com.github.spigotbasics").forEach(System.out::println)

    }

    fun findAllClassesUsingClassLoader(packageName: String): Set<Class<*>?> {
        val stream: InputStream = ClassLoader.getSystemClassLoader()
            .getResourceAsStream(packageName.replace("[.]".toRegex(), "/"))
        val reader = BufferedReader(InputStreamReader(stream))
        return reader.lines()
            .filter({ line: String -> line.endsWith(".class") })
            .map({ line: String ->
                getClass(
                    line,
                    packageName
                )
            })
            .collect(Collectors.toSet())
    }

    private fun getClass(className: String, packageName: String): Class<*>? {
        try {
            return Class.forName(
                packageName + "."
                        + className.substring(0, className.lastIndexOf('.'))
            )
        } catch (e: ClassNotFoundException) {
            // handle the exception
        }
        return null
    }

here

quiet ice
tender shard
#

it might work fine with the actual plugin classloader, i dont know

quiet ice
#

Yeah, but once you use the plugin classloader is works fine

tender shard
#

nah now it's an empty list

quiet ice
#

Hm, lemme check for myself

tender shard
#

why no openCartographyTable in spigot 🥲

#

didnt someone here rewrite some inventory API or sth?

quiet ice
#

Okay I can affirm that URLClassloader will only check the classpath, but not it's URL classpath.
Intriguingly, attempting to list the files of a non-existing folder will not work, so it obviously does some checking

#

That being said I only tested it with SLL's classloading system (which in turn is based on minestom's classloading) so bukkit might handle it differently, but I'd be surprised

#

But now that begs the question why I have seen this approach in the wild in earlier days...

tender shard
#

maybe it works on a JarClassLoader

#

yeah anyway, their above mentioned "works on my machine" is bullshit lol

shadow night
#

What are ya guys talking about

tender shard
quiet ice
#

JarClassLoader is not a thing, no?

shadow night
#

Can we please get less kotlin, my brain isn't a kotlin compiler (yet)

chrome beacon
#

yet 🔫

shadow night
#

Well, you see, learning another jvm lang is probably easier than learning another anythingelse lang

peak moth
#

all the sendConfigMsg, etc (not super uniform, but basically any message is always calling getString eventually)

worldly ingot
#

Which part of the command specifically is causing issues? Because the only part specifically that I can see that would be problematic is your sendClickableCommand() method which creates a new ChannelFile object each time it's invoked, which then calls a YamlConfiguration#loadConfiguration() in the constructor. You're re-reading that file synchronously 8 times

#

Any other place you're using sendConfigMsg() shouldn't be a problem because you're creating a single ChannelFile object and referencing that one

#

I'm unsure why you're making a new instance of ChannelFile on line 298 anyways. You can re-use your messages field like you're doing everywhere else

peak moth
# worldly ingot Which part of the command specifically is causing issues? Because the only part ...

The thing is I'm not sure really what the issue is, I just figured doing all the reads could be a reason but the command is continuous meaning it then opens a lot of menus etc so it could be something later on if that is included in the command timings? Not too familiar with what the command timings means under the hood. And yeah I'll take your suggestion, Here is my timings report with just the plugin on https://imgur.com/a/cWlqDj5

#

Also just added plugin messages for bungeecord, which can send a fair amount of data

#

But I feel like a leak somewhere is more probable

worldly ingot
#

A more thorough profiling tool would be Spark

#

Gives you more precise method calls

#

I say make the adjustment in your sendClickableCommand() method and that will probably at least tackle one issue, but once you've done that, install Spark and run a profiler with /spark profiler start, run the command a few times, do whatever is causing performance issues, /spark profiler stop and paste the link here

#

(or /spark profiler start --timeout 60 to timeout after 60 seconds automatically)

tender shard
#

hmm why don't my .jars show up in stacktraces?

Second line should be my plugins .jar, and first line is a .jar I'm loading with a custom URLClassLoader

quiet ice
#

I don't actually know what actually causes that line to show up

#

Ah, it's moduleName and moduleVersion I assume

#

actually no, the module would be prefixed, not suffixed

orchid gazelle
#

Hello party people. So, with my raycasting algorithm, I have been using this cute line of code: java if((int) current.getX() == current.getX() || (int) current.getY() == current.getY() || (int) current.getZ() == current.getZ()) { .... }
Now, the issue is, that I just noticed that this does not give me any RayCast-Results as it skips over the blocks. How may I detect if it hits a block? Current is just the current location of the ray. Check: java Material material = location.getWorld().getBlockAt(current).getType(); if(material != Material.AIR && material != Material.WATER && material != Material.LAVA) { return new RayCastResult(RCType.block, current, null, null); } }

tender shard
quiet ice
#

I'm looking into it given that my own classloader doesn't suppor this feature either from the looks of it

worldly ingot
orchid gazelle
#

idk if it was that it does not work with how I need the raycasting or the performance, maybe both

worldly ingot
#

Well, if nothing else, you should probably just use a BlockIterator instead because it seems you're wanting to accomplish the same goal

orchid gazelle
echo basalt
#

Well different blocks have different shapes

orchid gazelle
#
          for (Entity entity : nearbyEntities) {
              if(entity instanceof Player && !entity.getUniqueId().equals(this.shooter.getUniqueId())) {
                  SegmentedHitbox.hitboxes.get((Player)entity).update();
                  EHitboxSegment isInside = SegmentedHitbox.hitboxes.get((Player)entity).isInside(current.getX(), current.getY(), current.getZ());
                  if(isInside != null) {
                      return new RayCastResult(RCType.entity, current, (Player)entity, isInside);
                  }
              }
          }``` see this for example
echo basalt
#

you know bukkit has a raycast method that works for both blocks and entities right

orchid gazelle
#

I know

orchid gazelle
#

I am 100% sure that I had a valid reason to not use it

echo basalt
#

you're just not sure what the reason is

orchid gazelle
#

yeah because I wrote that stuff a year ago

echo basalt
#

meanwhile at work I'm responsible for coming up with a minigame network (single game for now) that can handle 400 people

#

development time: 9 days

worldly ingot
#

Could be perhaps you were missing the ray size parameter? I think that was only a somewhat recent addition

orchid gazelle
worldly ingot
#

That's what version control is for

orchid gazelle
#

for now, I'd just prefer to somehow manage a solution for the thing I was asking

worldly ingot
#

I'm not convinced this condition will ever be true

(int) current.getX() == current.getX() || (int) current.getY() == current.getY() || (int) current.getZ() == current.getZ()

#

I honestly don't even know what you're trying to do

echo basalt
#

lmfao no

#

that'll never work

orchid gazelle
#

yeah that's exactly the issue

#

idk why I did this, but yeah

#

the raycast fully works when removing it, but then it takes 45873753275737757 hours to process

worldly ingot
orchid gazelle
#

bc it checks.... a lot more

quiet ice
#

@tender shard At least in the case of logback this issue is caused by logback computing the packaging data by classloading the class via the wrong classloader. Bukkit probably has it's own classloader as the Thread's context classloader and as such for bukkit things it still works.

orchid gazelle
#

I somehow just need to snap it to the BoundingBox of a Block

tender shard
quiet ice
#

Yep, setting the context classloader fix the issue in the case of SLL so it is almost defo caused by that. At least for me; spigot is using Log4J so stuff may differ, but I'd not be surprised

quiet ice
tender shard
#

oh yeah I'm stupid

#

lol

quiet ice
#

Yeah I got caught offguard too at first heh

quiet ice
light venture
echo basalt
paper rain
#

Im creating water rising command beetwen two locations but it does the task 3 times fast and then normally, can some1 look at my code?

#

?paste

undone axleBOT
paper rain
#

Please

flint coyote
paper rain
#

but when i start it, it rise 3 blocks and then 1 block every sec

flint coyote
#

is it doing 1 block 3 times in a fast manner or is it 3 blocks instant?

paper rain
#

instant

#

and than normally 1 block

tender shard
#

which type did it have?

#

I don't find anything about ChannelPipeline in older mappings (went back to 1.16.5)

#

if you tell me in which version entityPlayer.playerConnection.networkManager.channel.pipeline() worked, I can probably find out what the today-version is

flint coyote
paper rain
#

sure

#
pos1:
  ==: org.bukkit.Location
  world: world
  x: 12.699999988079071
  y: -61.0
  z: 5.699999988079071
  pitch: 41.28115
  yaw: -35.72702
pos2:
  ==: org.bukkit.Location
  world: world
  x: 10.300000011920929
  y: -61.0
  z: 3.300000011920929
  pitch: 41.28115
  yaw: -35.72702```
flint coyote
#
pos1.setY(pos1.getY() + 1);
pos2.setY(pos2.getY() + 1);

I don't get these lines - why do you do +1 and then +1 again later? That's probably the issue

#

You are not changing the location in your config so you have the same result on each call

tender shard
paper rain
#

but after 3 blocks it starts working

tender shard
#

are you not using the mappings website?

#

well I just Ctrl+F through it and if I don't find something, I check the super classes and repeat there

paper rain
#

Can i send u video?

tender shard
#

depends - it's protected in ServerCommonPacketListenerImpl

#

yeah it's protected, you'd have to extend ServerGamePacketListenerImpl if you don't want to use reflection

flint coyote
tender shard
#

This will not work

#

you're getting the field by name, but the actrual name is obfuscated

#

you're better off getting the field by its return type

#

sth like

for(Field field : ServerGamePacketListenerImpl.class.getDeclaredFields()) {
  if(field.getType() == Connection.class) // This is the correct field
young knoll
#

That’s what I do

#

I also pass a index incase there are multiple

tender shard
#

that could work but then you have to update it for each new version

tender shard
#

it's automatic dude

#

give me a .jar, I run allatori twice - will be the same .jar but everytrhing has different names

#

I think that mojang also doesn't actually change the settings or make it random, but whatever a field is called depends on the "how manyth" field it is.

stupidly said: first field is a, second is b, etc.

Now if they add a field between a and b, then b will ofc be c now

#

that's why it's more reliable to check by return type if you can't directly access a field (because of private, protected, whatever)