#help-development

1 messages · Page 1091 of 1

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

acoustic pendant
#

1s

ivory sleet
#

what if u set Xmx and Xms

slender elbow
#

32 bit java 💀

ivory sleet
#

that as well

acoustic pendant
acoustic pendant
shy zinc
#

https://imgur.com/DJt3uNN as you see it just dont work.

And info:
IntelliJ IDEA 2024.1.5 (Community Edition)
Build #IC-241.18968.26, built on August 4, 2024
Runtime version: 21.0.2+13-b346.3 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.balloon.shadow.size=0
ide.new.editor.tabs.vertical.borders=true
ide.animate.toolwindows=true
ide.editor.tab.selection.animation=true
Non-Bundled Plugins:
com.chrisrm.idea.MaterialThemeUI (9.3.1)
Kotlin: 241.18968.26-IJ

slender elbow
#

care to share the output of mvn dependency:tree ?

shy zinc
#

Im sorry, where to generate that?

slender elbow
#

this is very weird

#

in a command line/console/terminal of your choice

#

standing on the project dir

shy zinc
#

I will!

sacred mountain
#

it doesnt help you forgot a semicolon

slender elbow
#

it should still show up correctly

shy zinc
#

yeah ahah i know

#

but it auto optimizing imports

sacred mountain
#

whats ur pom xml look lke

#

or build gradle

drowsy helm
shy zinc
#

Emily can i send the tree dm it wont here

shy zinc
drowsy helm
#

32 bit only supports like 2gb mem

slender elbow
#

sure

acoustic pendant
slender elbow
#

hmm

#

this is odd, spigot is not resolving its transitive deps

shy zinc
#

Im sorry, that means?

slender elbow
#

does it compile fine when you run the package goal?

shy zinc
#

Yeah perfect, ive been developing on this plugin for months now. Its the fkn java 21 fucking it up

#

btw

#

idk about if its giving more to the solution but

#
] The metadata C:\Users\Mathias S\.m2\repository\org\spigotmc\spigot-api\1.20.6-R0.1-SNAPSHOT\maven-metadata-repo.xml is invalid: unexpected markup <!d (position: START_DOCUMENT seen <!d... @1:4) 

#

i get warnings like these

#

when compiling

slender elbow
#

oh

#

yeah that doesn't look good

shy zinc
#

fuck

#

ahah

#

it also says similar but with 1.17 and thats very wierd. Havent touched that version

slender elbow
#

can you try running uhh

#

personally

#

i'd just go and nuke the C:\Users\Mathias S\.m2\repository\org\spigotmc\spigot-api\1.20.6-R0.1-SNAPSHOT\ directory

#

then refresh maven from within intellij

shy zinc
#

are you crazy

#

that sounds risky

slender elbow
#

nah it's fine

shy zinc
#

ahah what

eternal oxide
#

its safe

slender elbow
#

it'll trip maven to redownload it

shy zinc
#

i really trust you on this one

ivory sleet
#

you can trust her

shy zinc
#

okay okay fine chat

#

ahah

river oracle
#

deleting anything in your .m2/repository is fine and won't cause issues outside of the time it takes to redownload lo

slender elbow
#

maven-metadata-repo.xml, can't say i've seen that file before but i don't use maven so sure

shy zinc
#

its gone for sure now

sacred mountain
#

bro i just got 3 sigsegvs

slender elbow
#

nothing really

#

nice

shy zinc
#

now nothing in my code should work right

#

ive just deleted spigot?

sacred mountain
#

🔥

slender elbow
#

did you refresh maven?

shy zinc
#

what is it about your fire dude ahaha

shy zinc
#

2 sec

slender elbow
#

at worst you need to restart intellij to trip it to refresh maven lol

shy zinc
#

is this like sum manipulating my idea or what

#

btw its still here in here

#

i refreshed maven

slender elbow
#

it looks like some file was incorrectly downloaded or something so, best shot is to go nuclear and get rid of it for maven to redownload it

shy zinc
#

i cDUDE

#

OR MISS

#

ITS FKN WORKING

slender elbow
#

let's goooo

shy zinc
#

MD_5 IS ON

#

LETS GO

slender elbow
shy zinc
#

i fkn love all of you

drowsy helm
#

i love you too matheis

shy zinc
#

thank you so much and for your patient

slender elbow
#

preach

shy zinc
#

like this is actually revolutionary for my development

slender elbow
#

pizza time

shy zinc
#

your lol emily

sacred mountain
#

i have lost several brain cells

#

someone write me an api to convert an item tooltip to an image

#

thanks

#

im gonna do something productive

shy zinc
#

hope youll get same luck as me ;)

acoustic pendant
#

Now when I try to compile with buildtools anything even appears

#

It doesn't make sense for me

drowsy helm
#

have you tried running it fomr cmd line

acoustic pendant
#

yeah

#

I believe

drowsy helm
#

and no output on that either?

acoustic pendant
#

wait no

#

I haven't

drowsy helm
#

give that a try

#

might just be a ui thing

shy zinc
# slender elbow pizza time

okay, actually havent figured it out 100% yet. my buildtools version of spigot-api doesnt have this net.md_5 would you just recommend me to reinstall the buildtools, like build it over again or any tips?

river oracle
#

it won't

#

that's intended its a different dependency that is provided transitively

shy zinc
#

Yeah i figured, my mistakes. all seems to work now

acoustic pendant
river oracle
#

you need to cd into the correct directory my mans

acoustic pendant
#

it is in the correct directory

drowsy helm
#

run dir

#

show the output

acoustic pendant
river oracle
#

you need to downloar the jar to run it from the command line

acoustic pendant
drowsy helm
#

no i mean in cmd

river oracle
#

he has the exe

acoustic pendant
river oracle
#

it won't run from the command line

drowsy helm
#

ah yeah

acoustic pendant
royal heath
#

I think they mean Windows cmd, you need to run the jar

wet breach
#

The exe you are supposed to double click

wet breach
slender elbow
#

yeah and that's what happens

#

i think they mean detecting whether it's being ran on the terminal and doing the regular process without the ui?

hasty prawn
alpine swan
#

is it talking about being spoofed by the client or by the server?

#

im just making sure because onlyproxyjoin uses getAddress() and it would be a bit worrying if it could be spoofed by the client

fossil wigeon
#

I wanted to mess around with packets (viewing/editing incoming/outgoing packets or something along those lines) mostly for the sake of just snooping around and learning a bit, does spigot itself have any "straightforward" way to interact with packets or would I be better off just using something like protocollib?

stoic tapir
#

protocollib dabest

river oracle
#

spigot api will never expose a generic packet API

vast ledge
#

?paste

undone axleBOT
vast ledge
eternal oxide
#

the API has hidePlayer(Entity)

vast ledge
#

That seemed to have "delay", it would take about 20s and moving around, for the player to actually disappear after hiding them with #hidePlayer()

eternal oxide
#

I've seen no complaints using hidePlayer

vast ledge
#

Ah okay, the destruct packet works, when i run it, but Ig i have to delay it so it doesnt get sent at the same time as the player spawn

vast ledge
#

Is there a player "spawn" packet?

eternal oxide
#

yes

vast ledge
#

Would it be NAMED_ENTITY_SPAWN?

eternal oxide
#

I don;t know current

vast ledge
#

What was it?

eternal oxide
#

I couldn;t tell without opening my ide

#

add player or something

ivory sleet
#

there's a respawn packet

#

clientbound if thats what u looking for

vast ledge
#

Its probably Play.Server.NAMED_ENTITY_SPAWN

#

imma just find out :D

#

It seems to get sent twice ._.

torn shuttle
#

has anyone here ever tried to reverse proxy ssl certs

#

kinda lost with apache2, got the redirect to work but it's complaining that my cert hostname doesn't match

#

I'm not even sure it's using the right cert

slender elbow
#

i just let certbot figure it out

torn shuttle
#

oh I kinda figured it out, partly, part of the problem was using wildcard for the ip

wet breach
torn shuttle
#

uh sure

#

?paste

undone axleBOT
torn shuttle
#

I'm sure it's something simple

wet breach
torn shuttle
#

uh

wet breach
#

However you want to use in vhosts name based and not ip based

wet breach
#

Delete the bottom one

torn shuttle
#

do I just pick one and put everything from the 443 in there?

wet breach
#

You need to add for SSLProxyEngine on
ProxyRequests off

wet breach
torn shuttle
#

it was two different certs though I am entirely unsure as to whether that was necessary or ever desirable

wet breach
#

<Proxy *> Order deny, allow Allow from all </Proxy>

wet breach
#

You want to specify cert and full chain

#

Then for the backend use a self signed cert the front will not see backend cert

#

Apache is being the man in the middle

#

So connection terminates at apache and then reencrypts at apache.

torn shuttle
#

so turn off proxy requests

#

where does that proxy thing go

wet breach
#

All those settings are for the 443 vhost put them at top inside that vhost

torn shuttle
#

(to be clear the stuff after # reposilite is listening on magmaguy.com:50001 is its own conf

#

well damn it I just realized that the repo redirect was causing the other website on this machine to redirect to the repo

#

it goes to the default

wet breach
#

SSLProxyEngine On ProxyPreserveHost On ProxyRequests Off <Proxy *> Order deny, allow Allow from all </Proxy> ProxyPass / <url of backend web server> ProxyPassReverse / <url of backend web server>

torn shuttle
#

do I even need more than one conf file?

wet breach
#

Technically no just as long in the master apache conf file vhosts file is specified

#

But using more then one conf file can help keep things organized as well as not duplicating settings

#

If more then one thing requires same settings

#

You can also technically run back end without cert too and just leave the encryption terminating at apache

#

Just make sure you configure backend to not have https

torn shuttle
#

well

#

now nothing works

wet breach
#

What do you have for your config now?

torn shuttle
#

also if I try to add that proxy xml thing apache just errors

wet breach
#

The settings i specified need to be inside the vhost bracket for 443

torn shuttle
#

is that not what I did?

wet breach
#

The left one shows it being above and the right doesnt show it inside the brackets lol

torn shuttle
#

uh

#

proxypass is at the bottom of the right one

#

I guess maybe I'm passing the wrong one though

wet breach
#

I see that but the proxy tags need to be in there too

torn shuttle
#
<Proxy *>
  Order deny, allow
  Allow from all
</Proxy>

that?

wet breach
#

Yes

torn shuttle
#

it wasn't happy

#

seems like the stuff in proxy isn't correct

wet breach
torn shuttle
wet breach
# torn shuttle

Hmm. Not sure why its freaking out about this setting lol. Uh try creating a new line for allow all? It really shouldnt be complaining about this

torn shuttle
#

oh ok got it

#

cool now nothing works but at least apache boots

wet breach
#

Lmao

torn shuttle
wet breach
#

Are you trying to accesss repo?

torn shuttle
#

and repo.magmaguy.com goes to my mc server's page which is the machine's default since it's all hosted from the same machine

wet breach
#

And your url in that error is missing a slash

torn shuttle
wet breach
#

Oh ok

torn shuttle
#

I think it's circular now

wet breach
#

Lmao. So why are we trying to go from repo to main domain?

torn shuttle
#

we aren't

wet breach
#

Ok. Does it have an internal ip that the host can reach it from?

torn shuttle
#

I mean it seemed to be working earlier so I assume yes

wet breach
#

So when we redirect dont specify the domain. Just use the internal ip instead for the reverse

#

We dont want the proxy doing any lookups on the hostname

torn shuttle
#

would that be the proxypass?

wet breach
#

Yes reverse and pass

#

Set those to the ip address instead

#

So http://ipaddress

#

The docker should not try to serve an ssl cert if connection comes from the host

#

Apache is going to handle the ssl cert to the client

torn shuttle
#

I don't think I'm even doing this in the right place

wet breach
#

Well you didnt tell apache to respond to repo domain

torn shuttle
#

I did in the current settings

wet breach
torn shuttle
#

well I think I did

#

do I need it elsewhere as well?

wet breach
#

In the vhost bracket where you specify the domain

#

Add your subdomain to that

#

And then apache will start responding to repo

torn shuttle
#

ok well then shouldn't that go on the repo.magmaguy.com.conf instead of the magmaguy.com.conf file then?

#

I thought we were merging them but it sounds like they maybe should be separate after all

wet breach
torn shuttle
#

yes

#

it's handling all of my domains

wet breach
#

Ok....so we need to specify all the domains in their respective vhost brackets then lol

#

I will probably need to get at my computer to create an appropriate conf file

#

I have some saved

torn shuttle
#

I got it

#

same file, two different vhosts for 443

#

all seems to be working now thanks

wet breach
#

Yes, but for repo we are not going to use magmaguy.com for where we are proxying too

#

Unless you got it working in which case i guess leave it be lol

torn shuttle
#

yeah I got it working, let's not mess up a winning formula

#

all domains are correctly certified and directing to the right places

wet breach
#

Yep. Glad i am super familiar with apache that i can provide help using my phone lmao

torn shuttle
#

thanks for helping I absolutely loathe this kind of work

#

it takes a few hours to understand how things work every time and then the next time I touch it again is 5 years from now and I'll not remember anything I've learned

wet breach
#

Lol odds are i will probably still be here

torn shuttle
#

at least this time around I pruned a lot of dead code

wet breach
torn shuttle
#

aight bet ping you in 5 years then

wet breach
#

Is it because of the docker?

torn shuttle
#

also it was doing an ugly ip for the page where a subdomain would be much nicer

#

also also it's what they recommend on their docs so

#

who am I to contest that

#

oh boy now I get to look at the hundred or so support tickets I got in the time I spent sleeping and setting this up

pale hazel
#

I have never worked the Spigot API before. Do I need tutorials in order to get started?

torn shuttle
#

oh yeah @wet breach since you like websites any clue why a server in taiwan is hitting me with a no route error when trying to get a resource pack from my server in canada

floral drum
pale hazel
#

Yes I have programmed in Java before.

torn shuttle
#

honestly if it wasn't for the fact that it seems to be an intermittent error I would almost think it's due to some ip blacklist at a national level or something

floral drum
#

Okay, I would recommend googling some tutorials to get into the spigot api. Unless you want to experiment

torn shuttle
#

don't do that

floral drum
#

hi magma

torn shuttle
#

well guess the latter page also has a link to the resources

#

whoever capitalized this one is a troll

floral drum
#

real

#

honestly never knew that page existed

pale hazel
torn shuttle
#

that's because people with brainrot go straight to watching 5 year old tutorials on youtube where you just copy along with your brain off

floral drum
#

well I learnt from tutorials around 7 years ago

torn shuttle
#

case in point

floral drum
#

not tutorials from 7 years ago... well right now they are around that

#

but yknow what I mean

wet breach
torn shuttle
#

just a guy trying to use my service

wet breach
#

Oh. Then its most likely their isp

#

The probably have border gateway that is dead or has bad routes in its list

#

Best they can do is use a proxy to try and get connection to route around the bad gateway

blazing robin
#

hey guys can I make a new custom enchant? (like, super pickaxe 3x3 breakable enchant) ,, etc (Im using 1.20.1)

worthy yarrow
blazing robin
#
public abstract class TestCustomEnchant extends Enchantment {

    private final String name;
    private final int maxLevel;
    private final EnchantmentTarget target;

    public TestCustomEnchant(String name, int maxLevel, EnchantmentTarget target) {
        super(NamespacedKey.minecraft(""));
        this.name = name;
        this.maxLevel = maxLevel;
        this.target = target;
    }

    @NotNull
    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getMaxLevel() {
        return maxLevel;
    }

    @NotNull
    @Override
    public EnchantmentTarget getItemTarget() {
        return target;
    }

    @Override
    public boolean canEnchantItem(@NotNull ItemStack itemStack) {
        return true;
    }
}
#

like this?

worthy yarrow
#

uh idk if you have to override all the methods but it looks fine to me

blazing robin
#

hmm but idk how to registry my custom enchantment

paper viper
#

You should use a proper namespaced key instead of just an empty one

worthy yarrow
#

I don't remember if we still have to unfreeze the registries

blazing robin
ancient forge
#

how can i remove the ai from a mob causing it to not attack and not move around

#

is it possible to do without nms

torn shuttle
#

:0aste

#

?paste

undone axleBOT
torn shuttle
#

it's been a hot minute since I've tried something like this

#

at least I thought it was "d"

#

it still tries to run from ItemDisplay instead of Display

eternal oxide
#

why reflection when the API has the method?

torn shuttle
#

uuuh

#

does it

hybrid turret
#

I want to have async background saving to a db.

Could I just register one ChachedThreadPool singleton and keep submitting stuff to it throughout my plugin?

torn shuttle
#

it's not appearing on this project, remind me wasn't there a trick dumb to this for 1.21

worthy yarrow
torn shuttle
#

ok wait I think I'm being dumb on multiple levels with this

eternal oxide
#

I've not heard of any tricks for methods not showing up, other than really recent and not using latest

#

updates IJ to

torn shuttle
#

right because this entire entity is nms is why

#

which is because this entity is packet only, which

#

hm

eternal oxide
#

ah

torn shuttle
#

I'm honstly kind of lost but iirc either spigot doesn't let us do packet only entities or something about what i was doing here couldn't be done via spigot

#

is it possible to do packet only entities via spigot at this stage?

eternal oxide
#

no

torn shuttle
#

ok well i guess that's why

#

any idea how I'm doing the access there incorrectly?

eternal oxide
#

Should you not get teh method of Display not the instance?

torn shuttle
#

that's kind of what I was trying to do with casting but clearly not correctly

#
            Display display = itemDisplay;
            Class<?> entityClass = display.getClass();

            // Get the private method
            Method setPosRotInterpolationDuration = entityClass.getDeclaredMethod("d", int.class);

            // Make the method accessible
            setPosRotInterpolationDuration.setAccessible(true);

            // Invoke the method with an argument of 1
            setPosRotInterpolationDuration.invoke(display, 1);

            System.out.println("Method invoked successfully");
pseudo hazel
worthy yarrow
#

Concrete design

eternal oxide
#

Display.class.getDeclaredMethod probably

pseudo hazel
#

nothing concrete about an interface

#

idk what you mean by that

worthy yarrow
#

I read it wrong

#

dude i am so tired

blazing robin
#

Hey guys, I'm trying to create new enchant but

public class TouchOftheFurance extends TestCustomEnchant {

    public TouchOftheFurance() {
        super("test", 3, EnchantmentTarget.TOOL);
    }

    @Override
    public int getStartLevel() {
        return 1;
    }

    @Override
    public boolean isTreasure() {
        return false;
    }

    @Override
    public boolean isCursed() {
        return false;
    }

    @Override
    public boolean canEnchantItem(@NotNull ItemStack itemStack) {
        return super.canEnchantItem(itemStack);
    }

    @Override
    public boolean conflictsWith(@NotNull Enchantment enchantment) {
        return false;
    }
}
public class ShibaCustomEnchant extends ShibaJavaPlugin {

    public final static Enchantment enchantment = new TouchOftheFurance();

    @Getter
    private static ShibaCustomEnchant instance;

    @Override
    protected void onRegister() {
        instance = this;
        register();

        new TestCommand(this);
    }

    private void register() {
        boolean registered = Arrays.stream(Enchantment.values()).toList().contains(enchantment);

        if (!registered) {
            registerEnchantment(enchantment);
        }
    }

    @SneakyThrows
    private void registerEnchantment(Enchantment enchantment) {
        Enchantment.registerEnchantment(enchantment);
    }
}

but why the enchant name not appear?

#
public abstract class TestCustomEnchant extends Enchantment {

    private final String name;
    private final int maxLevel;
    private final EnchantmentTarget target;

    public TestCustomEnchant(String name, int maxLevel, EnchantmentTarget target) {
        super(NamespacedKey.minecraft("test"));
        this.name = name;
        this.maxLevel = maxLevel;
        this.target = target;
    }

    @NotNull
    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getMaxLevel() {
        return maxLevel;
    }

    @NotNull
    @Override
    public EnchantmentTarget getItemTarget() {
        return target;
    }

    @Override
    public boolean canEnchantItem(@NotNull ItemStack itemStack) {
        return true;
    }
}
torn shuttle
# eternal oxide Should you not get teh method of Display not the instance?

I mean

            Display display = itemDisplay;

            // Get the private method
            Method setPosRotInterpolationDuration = display.getClass().getDeclaredMethod("d", int.class);

            // Make the method accessible
            setPosRotInterpolationDuration.setAccessible(true);

            // Invoke the method with an argument of 1
            setPosRotInterpolationDuration.invoke(display, 1);

basically the same as before, still the same error

#

am I not getting the display class from that?

#

well, I am not, the real question is why am I not

#

Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: net.minecraft.world.entity.Display$ItemDisplay.d(int) still seems to access ItemDisplay

eternal oxide
#

which is why you shoudl just use Display.class

worthy yarrow
# pseudo hazel idk what you mean by that

I'm using the interface for the base methods, then using the abstract to define standard implantations, also at this point I don't even need to do anything with the implementing classes except define the generics, so I just feel it's kinda nice lol

pseudo hazel
#

right but do to this you need an abstract class and interface, as just a class would be sufficient

#

or abstract class I guess

worthy yarrow
#

You're missing the point

pseudo hazel
#

and then create your inv registry from that

#

yeah

#

i probably am

worthy yarrow
#

I don't have to do anything with the actual implentations is basically what I was going for

#

just define the generics for each registry

torn shuttle
pseudo hazel
#

I know why you used generics

torn shuttle
#

I thought that was the first thing I tried

smoky anchor
torn shuttle
#

but I guess I got lost in the shuffle of debugging maven

pseudo hazel
#

but like there is no difference between IRegistry and ARegistry

torn shuttle
#

my poor wolf what did I do to it

pseudo hazel
#

when would you use something that implements IRegistry that isn't ARegistry?

blazing robin
smoky anchor
#

Tell them to update then smh

blazing robin
#

'cause it's not enough time to open day

pseudo hazel
worthy yarrow
#

The interface says this is what all registries have, the abstraction provides partial implementation but also allows you to modify what you want (if you wanted to anyway)

#

I have to sleep

pseudo hazel
#

yes

worthy yarrow
#

I am almost gonna fall on my computer

pseudo hazel
#

then you should have gone multiple hours ago xD

smoky anchor
# blazing robin I think they would not update

Check how vanilla registers new enchantments
Find the registry
Unfreeze it, I'll try to find something that will help you with this step
Register your enchantment and the freeze it again

blazing robin
worthy yarrow
#

til I literally cannot think anymore

#

I wanna try to explain one last time

pseudo hazel
#

yeah I guess that's how you end up with over engineered code.. xD

#

I get why you did it because most people think its the best way

#

but in this case especially I dont see a reason to implement IRegistry instead of extending ARegistry

#

like realistically

#

so I guess unless you wanna release this as some API the interface doesnt really have a good use

worthy yarrow
#

I have the interface to define the concrete methods right? The abstraction is there to provide partial implementation if you want it, you don't need to but it's there for the benefit of reusable code, it depends on the use case but I feel having a partial implementation is nice when a lot of logic is common

smoky anchor
worthy yarrow
pseudo hazel
#

right, im just saying that the partial implementation in this case looks like the ideal final implementation for how you would wanna interact with the interface

#

I mean maybe thats because you are planning to add more stuff to ARegistry but on its own looks complete

worthy yarrow
#

It just depends if you'd want to do something different from the implementation of aregistry

pseudo hazel
#

like use a different backing map?

#

i guess but I would be hardpressed to find anything that would work better than what aregistry provides

smoky anchor
pseudo hazel
#

but like this is a small thing anyways

blazing robin
pseudo hazel
#

the code itself looks fine

worthy yarrow
#

I just think it's nice to at least provide the option

#

You never know what crazy stuff someone might do

pseudo hazel
#

thats why youd not wanna give them the option

worthy yarrow
#

My use case probably wouldn't differ from aregistry

worthy yarrow
pseudo hazel
#

when I program I dont wanna accidentally write poor code because my interfaces just allowed me to

worthy yarrow
#

Again I just feel the option is nice to provide

smoky anchor
worthy yarrow
pseudo hazel
#

lmao

blazing robin
pseudo hazel
#

for what you were asking at the start it would be a good fit there anyways

worthy yarrow
#

yeah fair

#

itll just get backlogged here

pseudo hazel
#

anyways I also have to go now

worthy yarrow
#

alright take care man

smoky anchor
#

I think the first argument is the class you want to get the field from
Second is its type
Third is its order number (idk how to explain that)

torn shuttle
#

I seem to recall it was possible in intellij to add custom buttons here no? Kinda want to add a button for installing and one for deploying

rough drift
#

Chat, opinion:

Do I move away from things like NamespacedKey and make my own? I am slowly moving my framework to be cross-platform, most of it already should work on Fabric too however there are some bukkit things still, such as the aforementioned

rough ibex
#

but you can't add buttons; only change the options in the dropdown

pseudo hazel
rough drift
#

and MC takes in it's own key

#

granted I can just convert it in the impl

#

so that wouldn't be an issue

#

nvm

torn shuttle
#

I swear I added a button once

#

hmmm

#

am I losing it

rough ibex
#

menus and toolbars?

#

it's not very obvious

blazing robin
#

public static Enchantment enchantment = new TouchOftheFurance();

    private void register() {
        boolean registered = Arrays.stream(Enchantment.values()).toList().contains(enchantment);

        System.out.println(registered);
        if (!registered) {
            registerEnchantment(enchantment);
        }
    }

    @SneakyThrows
    private void registerEnchantment(Enchantment enchantment) {
        Enchantment.registerEnchantment(enchantment);
    }

when I logged it it returned true but the name doesn't appear

smoky anchor
#

What is Enchantment.registerEnchantment
Show me the method

#

And where do you expect the name to be

blazing robin
smoky anchor
#

Do not do that

#

Did you use any resource or tutorial while doing this ?

blazing robin
#

I followed this tutorial

wraith delta
smoky anchor
wraith delta
smoky anchor
#

I do not believe they care about that, they use only 1.20.1

smoky anchor
#

Or at least half outdated.
The lore part is probably still in place, you gotta do that.
But if you want to make a custom vanilla like enchant, probably do what NMS does.

blazing robin
smoky anchor
#

'cause mojank changed how enchantments are registered probably

blazing robin
smoky anchor
#

One user stated that this method no longer works on 1.20.3

smoky anchor
blazing robin
smoky anchor
#

Again, updating would make this infinitely much easier but.
As I said before, unfreeze registry, register enchantment as vanilla does, freeze registry.
On spigot side you will have to add the lore when items get enchanted with your enchant.
Not sure how to handle enchanting table, that one is a bit special I believe.

#

Try to find more guides for this, not ones 4 years old tho.

blazing robin
#

So, I have to use freeze registry but again,

public static void unfreezeRegistry(Registry<?> registry) {
        try {
            Field intrusiveHolderCache = getField(MappedRegistry.class, Map.class, 5);
            intrusiveHolderCache.set(registry, new HashMap<>());

            Field frozen = getField(MappedRegistry.class, boolean.class, 0);
            frozen.set(registry, false);
        } catch (ReflectiveOperationException e) {
            e.printStackTrace();
        }
    }

in this code, I don't what is MappedRegistry class, and getField

smoky anchor
#

MappedRegistry is NMS class
getField is a custom method, I already described it, scroll up

blazing robin
#

or what if this? it's only works 1.20.2+ literally?

smoky anchor
#

That is probably just their tested version
I do believe it will work for 1.20.1 as well

torn shuttle
#

anyone remember off the top of their heads what mc version 1.20 R2 maps to?

#

1.20.2 right?

karmic falcon
#

hi, is there a way to work with worlds without having them saved in the server folder, maybe inside my plugins data folder

eternal oxide
#

you can move the location of a world by extending its name with path.

#

like \..\myWorld

karmic falcon
#

i still dont get it, i have to move myWorld from the plugins folder to the main server folder?

pseudo hazel
#

my plugin just creates new worlds

#

they are stored in the plugin folder

karmic falcon
#

how do u load them?

pseudo hazel
#

PluginFolder/worlds/world for example

#

well using the path as the name

karmic falcon
#

WorldCreate worldCreator = new WorldCreator(path of the world?);

karmic falcon
#

i tried it tho

pseudo hazel
#

a world name is just the path it takes to get there

karmic falcon
#

but it doesnt work

#

if i palce it in the main server folder i just write its name yeah?

pseudo hazel
#

specifically createWorld

royal heath
#

Weird question, but what are the cons of uploading a library to github packages and having users use the maven.pkg.github.com repo rather than using jitpack? Are there any?

blazing ocean
blazing ocean
#

it's fine for internal stuff just sucks for public libs

royal heath
#

Oh wow really? Okay sounds good. I'll look into using jitpack then

onyx fjord
#

I'm using the conversation API for the first time, is there any way to prevent showing the players string input in chat?

#

Every time player inputs something the input value is sent raw in chat

#

Fixed 🙂 it's called local echo

astral pilot
#

how do u run task on main thread from an asynchronous task

rough drift
quaint mantle
#

cancel the event if the player is in a conversation

quaint mantle
acoustic pendant
#

Hey, I was trying to use multiple nms versions and made some modules...
But I had a question to use libs such as adventure in spigot, do I have to relocate it in the dist pom.xml or in the core pom.xml??

acoustic pendant
slender elbow
#

you relocate the final jar

#

so, whichever maven module you get the final jar from

onyx fjord
acoustic pendant
#

Thanks

slender elbow
#

kacper just use the echo thing, that's the intended way

smoky anchor
silent ridge
#

Oi

#

Ok*

grim ice
#

is it possible to let a crafting recipe include many choices?

#

e.g you can use spruce logs instead of oak logs

smoky anchor
#

Use tags instead of singular item type

grim ice
#

I'd need to listen to the crafting event

remote swallow
#

use MaterialChoice

#

with a tag

vague topaz
#

I'm trying to change the direction of a chest using this code in Spigot 1.8.8

Block centerBlock = location.getBlock();
centerBlock.setType(Material.TRAPPED_CHEST);
centerBlock.getState().setData(new Chest(BlockFace.WEST));
centerBlock.getState().update();

But it always spawns in north direction

vague topaz
#

but there is no setState

chrome beacon
#

you use the update method

vague topaz
#

I do?

chrome beacon
#

getState -> copy
update -> set said copy back without changes

#

see the issue?

vague topaz
chrome beacon
#

You're never setting the facing before updating

#

since you have two different block states

#

you're setting direction on the first one

vague topaz
#

alright I understand now

#

So it should be?

Block centerBlock = location.getBlock();
centerBlock.setType(Material.TRAPPED_CHEST);
BlockState state = centerBlock.getState();
state.setData(new Chest(BlockFace.WEST));
state.update();
chrome beacon
#

yes

vague topaz
#

yeah, it works now, thanks

chrome beacon
#

though I've never used the chest class like that 🤷‍♂️

#

since it's been deprecated for so long

knotty swan
#

Hey I have an question how could I implement the canplaceon/canbreakblcok tags in 1.21 since those got changed

chrome beacon
#

I don't think there's API for that atm

blazing ocean
#

PDC no?

chrome beacon
#

Might have to use NMS

chrome beacon
#

PDC won't help here

blazing ocean
#

I thought PDC was able to change those

chrome beacon
#

It's not

slender elbow
#

pdc isn't raw nbt access

chrome beacon
#

All PDC values are stored in the BukkitValues nbt tag

slender elbow
#

it's scoped

hasty prawn
karmic falcon
#

hi, i was wondering what is the best way to make a temporary world, currently i copy it and place it somewhere else and load that copy then delete it, and another thing is how do you load a world specifically for this case, do u delete all the folders containing data

lethal dune
#

Can somebody help me made some commands but if i execute them nothing happens even if they should do smth

tender shard
lethal dune
#

public class TestInterfaceCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("duel")) {
if (sender instanceof Player player) {
Inventory inventory = Bukkit.createInventory(player, 1, "Test Interface");
ItemStack wool = new ItemStack(Material.BROWN_WOOL);
}
else{
sender.sendMessage("Only Player Commands do not use");
}
}
return true;
}
}

#

--
getCommand("tic").setExecutor(new TestInterfaceCommand());

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() {

    }
}```
smoky anchor
#

And for completeness sake, don't forget to register your commands in the plugin.yml

smoky anchor
lethal dune
#

yes i understand and i changed it but its still the same and yes i have it in the plugin.yml

tender shard
#

remove the part where you're checking the command's name

lethal dune
#

do you mean like this

public class TestInterfaceCommand implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player player) {
            Inventory inventory = Bukkit.createInventory(player, 1, "Test Interface");
            ItemStack wool = new ItemStack(Material.BROWN_WOOL);
        }
        else{
            sender.sendMessage("Only Player Commands do not use");
        }
        return true;
    }
}```
tender shard
#

yes

#

however your command still won't do anything

#

you only create an empty inventory and then don't do anything with it

lethal dune
#

or for example this command
it doesnt work too

public class duelCommand implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player)
        {
            Player p = (Player) sender;
            if(args.length == 0)
            {
                p.sendMessage("Not enough arguments");
                p.sendMessage("Format: /duel <player>");
            }
            else{
                String DuelPlayer = args[0];
                Player target = Bukkit.getServer().getPlayerExact(DuelPlayer);
                if (target != null)
                {
                    p.sendRawMessage("well... it looks like you wanted to duel " + target + " But i was too lazy to code this so yea. yea");
                    target.sendRawMessage("well... it looks like" + target + " wanted to duel you but i was too lazy to code this so yea. yea");
                }
                else
                {
                    p.sendMessage("Player is not online!");
                }
            }
        }
        return true;
    }
}
lethal dune
#

.

pseudo hazel
#

does it get suggested in mc?

#

did you put the commands in plugin.yml?

lethal dune
#

yes it does get suggested

eternal oxide
#

then you didn;t register an executor

#

By default commands in teh plugin.yml fire an onCommand in the JavaPlugin

#

unless you register an executor

lethal dune
#

i did

getCommand("duel").setExecutor(new duelCommand());
eternal oxide
#

is that in your onEnable?

lethal dune
#

yes

#
package me.Antares.uHCraftPlugin;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class UHCraftPlugin extends JavaPlugin {


    @Override
    public void onEnable() {
        boolean IsGod = false;
        getServer().getPluginManager().registerEvents(new JoinLeaveListener(), this);
        getCommand("god").setExecutor(new GodCommand());
        getCommand("duel").setExecutor(new duelCommand());
        getCommand("tic").setExecutor(new TestInterfaceCommand());
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

}
eternal oxide
#

also add an @Override to your onCommand method

lethal dune
#

i did now still nothin

eternal oxide
#

Check yoru server latest.log for any startup errors

#

and DO NOT replace the plugin jar on a running server. Stop the server, replace jar, start server.

lethal dune
#

Oh well thanks it think that fixes it

rough hinge
hard socket
#

what happens?

rough hinge
#

it was supposed to be -1 and not -3

rough hinge
hard socket
eternal oxide
#

then you are settign to AIR so once teh inventory updates there is no stack

hard socket
rough hinge
#

i setted -1 after

eternal oxide
#

you can't set -1 to AIR

rough hinge
eternal oxide
#

you set to AIR and update

rough hinge
hard socket
#

PlayerInventory#removeItem

rough hinge
hard socket
#

use that

eternal oxide
# hard socket https://paste.md-5.net/xelacurute.cs this is duplicating the chestplate

Modifications to slots that are modified by the results of this InventoryClickEvent can be overwritten. To change these slots, this event should be cancelled and all desired changes to the inventory applied. Alternatively, scheduling a task using BukkitScheduler.runTask(Plugin, Runnable), which would execute the task on the next tick, would work as well.

safe furnace
#

Hi, so. I was trying to make a command that shows statistic of other player, ex: /check @safe furnace and then the stats..
How can I make this with DispatchCommand?

eternal oxide
#

why would you DispatchCommand?

rough hinge
hard socket
#

bro just use yours

rough hinge
#

if have many itens with same lore and amnount, will remove the first

#

and i dont want this

#

i want remove the clicked item

safe furnace
pliant topaz
safe furnace
#

What should be problem?

blazing ocean
#

papi not being there

#

idk what else people are supposed to tell you as you have provided zero information

lost matrix
safe furnace
#

Second, the placeholderapi it stays red at pom.xml

blazing ocean
#

add their repo

#

and show the whole pom and not just a small snippet

safe furnace
#
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>idontknowyet</groupId>
  <artifactId>test</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Erbex</name>

  <properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

  <repositories>
      <repository>
          <id>spigotmc-repo</id>
          <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
      </repository>
      <repository>
          <id>placeholderapi</id>
          <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
      </repository>
      <repository>
          <id>sonatype</id>
          <url>https://oss.sonatype.org/content/groups/public/</url>
      </repository>
  </repositories>

  <dependencies>
      <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.21-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>me.clip</groupId>
          <artifactId>placeholderapi</artifactId>
          <version>2.11.6</version>
          <scope>provided</scope>
      </dependency>
  </dependencies>
</project>
lost matrix
#

And java version 1.8 for minecraft 1.21 is wild

safe furnace
#

but this doesn't

#

Ignore bukkit.dispatchcommand

#

Oh, i forgot to import the class.. i fixed it.

earnest girder
#
    public TextDisplay getDisplay(Location location) {
        World world = location.getWorld();

        double radius = 5;

        Collection<Entity> nearbyEntities = world.getNearbyEntities(location, radius, radius, radius);
        System.out.println(nearbyEntities);

        for(Entity entity: nearbyEntities) {
            if(entity instanceof TextDisplay) {
                return (TextDisplay) entity;
            }
        }

        return null;
    }

This method keeps returning null and printing an empty list no matter the radius. The location I'm inputting is the exact location of a TextDisplay.

#

It is being called in onEnable

chrome beacon
#

If you're storing the location why not store the uuid

#

and get the entity by that

rough hinge
#

if i set type with burning_furnace, the furnace if not have ores, will be disabled?

chrome beacon
#

try it and see

lost matrix
rough hinge
uncut grove
#

Hey, I am trying to spawn a player like npc with nms 1.21 but I only got this error. Does anybody know a solution?

https://paste.md-5.net/jofirejaho.java (Code + Error on the bottom)

~ @uncut grove

rough hinge
#

then disable

chrome beacon
uncut grove
chrome beacon
#

Try the discord search

rough hinge
#

org.bukkit.block.Furnace block = (org.bukkit.block.Furnace) furnace.getLocation().getBlock().getState();

        block.setBurnTime(); have infinite burn time?
chrome beacon
#

This is being asked at a minimum once a week

rough hinge
#

setburntime is on ticks?

chrome beacon
#

yes

echo basalt
#

.

#

and here's elgar's spoonfeed

hard socket
rough hinge
#

for (Furnace furnace : furnaceService.getAll()) {

        org.bukkit.block.Furnace block = (org.bukkit.block.Furnace) furnace.getLocation().getBlock().getState();
        
        if (!FurnaceController.hasCoal(furnace) || FurnaceController.getSmeltTime(furnace) == 0) {
            block.setBurnTime((short) 0);
            continue;
        }

        block.setBurnTime((short) 1000);

    }

setburntime update block type?

safe furnace
#

Anyways. Can I make them together. Args[0] and papi to one string?

tardy delta
#

what

safe furnace
#

Are u talking to me?

tardy delta
#

yes

safe furnace
#

I was trying to make a command that shows statistic of other player, ex: /check @safe furnace and then the stats..

tardy delta
#

hmm

safe furnace
#

So, If i type /check ...

chrome beacon
#

if you want to get placeholders for the targetPlayer than provide that as the first argument in the setPlaceholders method

safe furnace
#

it says .... and then @safe furnace

#

so the %player_name% is using that who using the command

echo basalt
#

fairly simple workflow

tardy delta
#

i cant understand anything

echo basalt
#

our boy wants a hardcoded placeholder + parsing stuff for a target player

#
public void check(Player sender, Player target) {

}
#

start with this

#

sender can be the target, up to you

#

On your command executor, see if a target is specified, if it is, validate it

#

If it's not, assume it's the sender

earnest girder
echo basalt
#

I'd store location + uuid and maybe name

#

In case the text display is gone and you need to respawn it

hard socket
#

why cancelling InventoryClickEvent doesn't work when players are in creative??

eternal oxide
#

creative is boss

hard socket
#

bruh makes no sense

slender elbow
#

creative mode is a disaster

eternal oxide
#

If you have access to creative the server accepts whatever the client tells it

slender elbow
#

it has basically complete authority over the inventory

#

although it isn't quite like that, it makes it very awkward to write server code for

hard socket
#

well there is a reason no one made a plugin for creative use

#

but that just sucks

slender elbow
#

the solution is to just not give real creative mode to players

#

a great example i've seen to that case is hypixel housing

#

you don't have real creative mode but you have all the thingies you would normally expect from creative mode

hard socket
#

yeah that's true

#

they have a whole menu just to not use creative

slender elbow
#

uwu

#

wrong chat

tardy delta
#

wtf

ornate mantle
#

im trying to make a custom nms iron golem that uses the zombie pathfinders, but it still uses the iron golem pathfinder goals

#

is there a way to clear all pathfinder goals?

chrome beacon
#

You can use the removeGoal method or stop the goals from registering in the first place

ornate mantle
#

the method registerGoals() in the IronGolem class registers them

#

but i can't find any place where it is called

#

and somehow it still follows each goal in the method

#

like being passive and attacking zombies

chrome beacon
#

You can just override registerGoals

#

and put your own goals

ornate mantle
#

legit just did that

#

thanks man

eternal night
#

?services

undone axleBOT
past kiln
#

Wow 🤦

rough hinge
#

@Override
public void run() {

    for (Furnace furnace : furnaceService.getAll()) {

}}

if the runnable is scheduled with runtask , nothing in the bukkit thread can be executed between the start and end of the for, correct?

eternal oxide
#

you can call methods, but the server will not tick until the task ends

rough hinge
#

ok thx

#

int firstOresIndex = FurnaceController.getFirstOresIndex(furnace);
int firstSmeltedOresIndex = FurnaceController.getFirstSmeltedOresIndex(furnace);

        if (firstOresIndex == -1 || firstSmeltedOresIndex == -1) {
            furnace.setCounter(0);
            continue;
        } Does Java only create the 2nd variable if the 1st condition is false?
ivory sleet
#

both are created

#

but ofc only the first one may get evaluated yk

#

like if firstOresIndex == -1 then there's no point in checking the second one

#

anyway, had u just passed some mere ints to the variables like
int a = 1
int b = 2
or so then it may actually optimize it further, but those method calls getFirstOresIndex and getFirstSmeltedOresIndex cannot be ignored

tardy delta
#

both functions get called

ivory sleet
#

yep

tardy delta
#

sounded like you were saying the opposite

ivory sleet
#

i mean for the if statement itself, the compound boolean logic may not have to be fully evaluated if the first formula is true

rough hinge
ivory sleet
#

myea sure

rough hinge
#

I don't just do a boolean because the index is useful later to avoid going through more lists

ivory sleet
#

mye

tardy delta
#

dont bother doing that kind of optimizations

quiet ice
#

use < 0 over == -1 if you want to optimize stuff \s

sleek island
#

if a command block runs a command how can i get the command block position?

quiet ice
#

CommandBlockSender probs

sleek island
#

oh ty

valid basin
#

what's the best particle library that supports cross version(from 1.8.8 to latest)

sterile breach
#
        ArrayList<Am> r = records.get(player.getUniqueId());
        plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {

            for (Am am: r) {//some code}

[20:25:55 WARN]: [Replay] Plugin Replay v1.0-SNAPSHOT generated an exception while executing task 3
java.util.ConcurrentModificationException: null
        at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1095) ~[?:?]
        at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1049) ~[?:?]

because its runned async I copy the list to prevent concurence problems but I am getting this error whats the problem?

tardy delta
#

dont remove from it when iterating

sterile flicker
#

if the primedtnt explode the boat will it trigger entitydamagebyentityevent?

torn badge
ivory sleet
torn badge
ivory sleet
#

he is running some stuff async, perhaps read-modify-write on multiple threads, in which case yk... thread safety is needed

eternal night
#

Iterator won't save ya from race conditions

eternal night
#

?tryandsee

undone axleBOT
eternal night
#

but generally I'd expect it too yea, iirc there is a vehicle damage one?

sterile flicker
# eternal night ?tryandsee

I've already tried it, so I'm asking, I can undo the tnt damage received by the sheep in entitydamagebyentityevent, but tnt still destroys the boat. how can I fix this?

sterile breach
torn badge
#

And are you also accessing that list from another place than that task?

sterile breach
#

I am also casting action

torn badge
#

The code inside the loop is the interesting one

#

Also please don‘t call a variable just a letter

tidal kettle
#

?paste

undone axleBOT
sterile breach
# torn badge The code inside the loop is the interesting one

not finished (packet dont seem have any sens)

            for (Action action : r) {
                try {
                    Thread.sleep(50);
                } catch (InterruptedException ex) {
                    throw new RuntimeException(ex);
                }

                PacketWrapper packet = null;


                if (action instanceof Move a) {
                    double X = a.getX();
                    double Y = a.getY();
                    double Z = a.getZ();

                    packet = new WrapperPlayServerEntityRelativeMove(e, X, Y, Z, a.isOnGround());
}

sterile flicker
#
val passenger = ClientboundSetPassengersPacket(npc.handle)
            connection.send(passenger)``` should this packet display permanently over my npc's head while moving the textdisplay that was added to the npc earlier using addpassenger?
tidal kettle
#

if not it's okay too

torn badge
sterile breach
#

all loop should be espaced by 1 tick

tardy delta
#

😳

torn badge
#

Well yeah then you have all of these tasks accessing the list from different threads

sterile breach
#

because I call thread.sleep you mean?

torn badge
#

No, because you have a for loop

sterile breach
#

loop is inside the thread so all looping are in the same thread no?

torn badge
#

Yeah, then you run a new task, while the old one is still running

#

And you are probably modifying the list somewhere

#

That's what‘s throwing the exception then

sterile breach
#

sure but I copy it here so if my list at records.get... is modifed r is not no?

ArrayList<Action> r = records.get(player.getUniqueId());

torn badge
#

That's not a copy

sterile breach
#

oups

#

same instance?

torn badge
#

new ArrayList<>(r) would be a copy

sterile breach
#

Il try it

#

it work

#

beginner error 🥲

#

thanks 👍

zenith bobcat
#

Hey guys i am coding in nms right now and i get an Exeption "Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.PlayerConnection.k()" because "var0.c" is null" But so far i know is there no more PlayerConnection class in 1.20.6 / 1.20.4

#

does anyone know which could cause this Exeption?

mellow edge
#

I need help. I made a minigame and I want it to support bungee-like servers, and I don't know what I should do when the game ends. Maybe redirect the players to another server on the network?

#

Because I want the servers owners to be able to manage that, because the plugin will be public.

zenith bobcat
zenith bobcat
tardy delta
#

remapped ig

pseudo hazel
#

why does IJ ask if I wanna make a resorc instead when I have a final List?

#

like isnt it kinda icky

#

cuz you can still just mangle around in the list

#

even though its a record..

rough hinge
pseudo hazel
#

I guess that goes for any non primitive object...

tardy delta
#

cuz java records are stupid

pseudo hazel
#

yeah fair I guess

peak depot
#

any one got that chars?

#

like the small minecraft font

pseudo hazel
# tardy delta switch

seem to be some base value and each following value adds 16, that sounds like it can easily be a simple if statement

#

probably using modulo or somthing

pseudo hazel
tardy delta
#

uh sure

rough hinge
tardy delta
#

what steaf said probably, check bounds and do a modulo

rough hinge
#

isnt possible

#

i tried

tardy delta
#

counter % 16 == 0 && counter in 16..=144

dense falcon
#

Redis is the best one as "database" for mc plugin? 🤔

rough hinge
#

depend lol

pseudo hazel
#

yeah the first check is just if (furnace.getCounter() <= 144 && furnace.getCounter() % 16 == 0)

tardy delta
#

redis isnt a db

#

but whats your arch

pseudo hazel
rough hinge
#

thanks

pseudo hazel
echo basalt
#

no it's just uh

#

magic numbr

pseudo hazel
#

well yeah

#

the source is even more magical

tardy delta
#

just use a switch and the compiler will make it a jump table

#

dont try to be smarter than the compiler

pseudo hazel
#

yeah true

#

a switch is good too

#

but this is just faster to write out too

onyx fjord
#

how do we parse the minecraft version starting from spigot 1.21?

pseudo hazel
#

i;d like to know as well haha

#

rn I just have expirimental warnings

#

or wait thats for plugin version

#

and im on the wrong server...

#

on paper its just Bukkit.getMinecraftversion()

pseudo hazel
#

and I think for spigot it didnt change from before

onyx fjord
# eternal night hm?

im tryna understand how to deal with Bukkit.getServer().getClass().getPackage().getName() working differently on paper

pseudo hazel
#

oh

#

on paper use Bukkit.getMinecraftVersion() xD

eternal night
#

Basically, don't.

#

not that you even need to just for reflection access

onyx fjord
#

how else am i getting the mc version string

eternal night
#

if you want to load different modules based on the version, then yea, there is ehh

onyx fjord
#

^ thats what i want yeah

eternal night
#

So just Bukkit.getServer().getBukkitVersion();

#

but for reflective lookup of like CraftEntity you'd just store the Bukkit.getServer().getClass().getPackage().getName() and append to that. Maybe that has the relocation, maybe it doesnt, either way its fine

pseudo hazel
#

I know this code is only slightly cursed, but how would I check the cast in this case?

#

or suggest a better way to make this method I guess xD

eternal night
#

you can't

pseudo hazel
#

hmm okay

#

so I guess I gotta trust my code that its correct?

#

or is it an intellij thing

eternal night
#

Yea, generics are erased at java runtime

pseudo hazel
#

ah

#

so it would spontaneously combust if I messed it up on testing?

#

thats good

eternal night
#

Welcome to generics at runtime KEKW the usual goal is to just not leak this kind of insecurity out of the owning code

#

e.g. don't make anything else do these checks

pseudo hazel
#

yeah I will only have a static amount of these data types and they are all made by this part of the codebase

#

but good to know 👍

tardy delta
#

no

#

would require asking the type of T at the runtime

#

getParameterizedTypes()

#

sec

#

might be Class::getTypeParameters but i see no point in knowing the type of T at runtime

quiet ice
#

I mean by providing a Class<T> you can do that

tardy delta
#

i mean if that ListNode<T> is always storing values of type T and that class is internal, why bother knowing the runtime type, the cast will always succeed

ivory sleet
#

there is a way

#

but its hella cursed

#

u can do sth like (Class<SomeClass<T>>) (Type) SomeClass.class

#

Type meaning the java.lang.reflect.Type one

echo basalt
#

kotlin reified T be like

ivory sleet
#

mye

tardy delta
#

reified works only on inline functions

eternal night
blazing ocean
ivory sleet
#

got the type token hackery as well :P

slender elbow
#

varargs my beloved

river oracle
#

Varargs

slender elbow
#

varargs

#

yes

river oracle
#

Yes

peak zealot
#

Hello everyone. Im currently trying to implement an API i created into one of my plugins but keep getting errors and right now im stuck on this one and wondered if anyone with more knowledge then me could help.

This is the Main class where i try to get the api and make a getter for it.


    private static Main instance;
    private final API rankAPI = (API) Bukkit.getServer().getPluginManager().getPlugin("rank-core"); <- The API plugin "rank-core"

    @Override
    public void onEnable() {
        instance = this;

        // listeners
        PluginManager pm = Bukkit.getPluginManager();
        pm.registerEvents(new OnChatEvent(), this);

        // commands
        getCommand("getrank").setExecutor(new GetRankCommand());
        getCommand("setrank").setExecutor(new SetRankCommand());
        getCommand("setcolor").setExecutor(new SetColorCommand());
    }

    @Override
    public void onDisable() {}

    public static Main getInstance() {
        return instance;
    }

    public API getRankAPI() {
        return rankAPI;
    }
}```

and when i try to load the plugin i get this error(Anyone knows how to make that shit not null?)
```java.lang.NullPointerException: Cannot read field "getSQL" because the return value of "net.snakkze.rankutils.Main.getRankAPI()" is null
        at net.snakkze.rankutils.listeners.OnChatEvent.<init>(OnChatEvent.java:15) ~[?:?]```

This is the class that causes the error
```public class OnChatEvent implements Listener {

    private final GetSQL sql = Main.getInstance().getRankAPI().getSQL;

    @EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        Player p = e.getPlayer();
        UUID uuid = p.getUniqueId();
        Rank rank = sql.getRank(uuid);
        
        String format = Main.getInstance().getRankAPI().getCosmeticRankName(rank, uuid) + " " + p.getDisplayName() + rank.getChatColor() + ": " + e.getMessage();
        e.setFormat(format);
    }
}```
runic kraken
#

hey, I have a question: how can I write a tablist with many columns on version 1.18.2?

lost matrix
lost matrix
peak zealot
# lost matrix initialize your rankAPI field in your onEnable. And make sure you have defined y...

Sorry for bothering but i did what you said and now i get this error because i have both the api plugin and the plugin that uses the api inside of my plugins folder?
java.lang.ClassCastException: class net.snakkze.rankcore.API cannot be cast to class net.snakkze.rankcore.API (net.snakkze.rankcore.API is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @3fd30f2f; net.snakkze.rankcore.API is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @31cbe119)

lost matrix
#

Also show your pom

peak zealot
lost matrix
# peak zealot yes

Did you read the warning in the reload command? Its not supported and will inevitably cause horrific problems.

lost matrix
# peak zealot https://pastebin.com/j4uGbMJ3

The system scope results in your API being shaded into your plugin. This will result in classloader problems because the same classes are
present multiple times. Im quite sure that this is your problem here.

peak zealot
lost matrix
#

Is rank-core your own plugin?

peak zealot
lost matrix
#

Alright then here is how to properly handle this:

lost matrix
# peak zealot yes
  1. Go into your rank-core project
  2. Run mvn clean and then mvn install
    install will result in your project being installed into your local maven repository, so that it can be found by all your other projects
  3. Go into your rank-utils project
  4. Open the pom and change your rank-core dependency to
        <dependency>
            <groupId>net.snakkze</groupId>
            <artifactId>rank-core</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

Or whatever you defined at the top of your rank-core pom
5) Now mvn clean and mvn package or mvn install your rank-utils project

The scope is either
provided -> This means the classes are provided by someone else on runtime
compile -> This means the classes are not provided on runtime, and will be copied into your project
You always want to use provided when the dependency is another plugin, because other plugins already
exist on the server. The same goes for the spigot-api. Its score is provided because the spigot classes
obviously exist on the server already.

peak zealot
lost matrix
#

What do you mean by export?

#

I mean

peak zealot
lost matrix
#

No, you never build artifacts when using maven or gradle

#

And you never add any artifacts to your project either

peak zealot
#

Ok, so how do i get my jars?

lost matrix
#

You run the proper maven goals

#

install will run package first, meaning you will end up with your compiled jars

peak zealot
#

Ah ok

lost matrix
#

So after this you have everything you need.
And for the future: When using maven, dont add any dependencies or compile any other way than via your pom.

peak zealot
lavish scarab
#

Pre-1.21, using this code I could hide the attributes on an item, but using the same code on 1.21 has no effect, did something change that means I have to do it a different way now?

ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
item.setItemMeta(meta);
drowsy helm
#

You can just change them to the default, they just have to be changed

lavish scarab
drowsy helm
#
    meta.setAttributeModifiers(this.item.getType().getDefaultAttributeModifiers());
lavish scarab
#

Thanks

dawn flower
#

this might seem weird, but how would i extend snakeyaml's parsing to prefix all sections that are inside a section called "actions" with (ignored=random text)

i don't mean if the parent section is called "actions", i mean if it's in any section called "actions", like this

actions:
  idk:
    idk2:
      "test"```
would be
```yaml
actions:
  (ignored=random text) idk:
    (ignored=random text) idk2:
      "test"

if that makes sense

#

(during the parsing process, not after)

ivory sleet
#

u wna look into snakeyamls basecontructor and representer class iirc

#

override those and ye

muted otter
#

I am trying to save a file called "lobby.schem" file in a directory called lobby that is inside of a directory called schematics. However, I am running into an issue. The directory for my schematic is src/main/resources/schematics/lobby/lobby.schem, and this is my code to save it:

File lobbySchematicFile = new File(getDataFolder(), separator + "schematics" + separator + "lobby" + separator + "lobby.schem");

saveResource(lobbySchematicFile.getPath(), false);

However, I get this exception:

[20:03:04 ERROR]: Error occurred while enabling Minigame v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'plugins/Minigame/schematics/lobby/lobby.schem' cannot be found in WorkingDirectory\build\libs\Minigame-1.0-dev-all.jar
quiet ice
#

Use the path of separator + "schematics" + separator + "lobby" + separator + "lobby.schem" instead

#

that is, omit the data folder

muted otter
#

ah, ok\

#

does it automatically look in the data folder?

quiet ice
#

well - only for the saveResource call that is

muted otter
#

yea i know

quiet ice
#

It won't automatically look into the data folder in that case - that would be silly

#

saveResource copies to the data folder - provided the file does not already exist

muted otter
#

oh ok

red onyx
#

Moin, ich suche derzeit einen Hauptprogrammierer für einen Minecraft server falls ihr darauf lust habt meldet euch, natürlich springt dabei was rum.

muted otter
#
String separator = File.separator;

saveResource(separator + "schematics" + separator + "lobby" + separator + "lobby.schem", false);

This is what I have now, is this correct?

#

I am still getting the exception

quiet ice
#

?services Jokes aside, this is the wrong place

undone axleBOT
quiet ice
#

Also, I'm not entirely sure whether File.separator is appropriate here - I'd rather use / unconditionally in this case due to how zip files work

blazing ocean
#

imagine sleeping

muted otter
quiet ice
#

try it without the leading slash I suppose

muted otter
#

that was it...

#

it has been so long

#

all because of one /

slender elbow
#

that's kinda funny

#

i wonder why that happens

pine crest
slender elbow
#

hello, lewd narcissistic feet devourer

pine crest
#

what if the first link had the top domain rawr instead of ar

grim hound
#

where do you guys usually upload your spigot plugins when they become too big to upload on spigotmc?

slender elbow
#

github release, external link on spigot

viscid carbon
#

is it bad if i made a java public static String color(String s) { return ChatColor.translateAlternateColorCodes('&', s); }?

pine crest
#

no

viscid carbon
#

didnt think so.

pine crest
#

its one static method call more

#

and u save urself a headache

viscid carbon
#

Yeah i had a sendChat(p, "Message");
But i was told that was dumb

pine crest
#

who told u that

#

i will shank them personally

viscid carbon
#

@river oracle

#

xD

lost matrix
pine crest
#

yep @river oracle ill throw u out the window

viscid carbon
#

Why's that?

lost matrix
#

I have a

public static void send(CommandSender sender, String message, MessageFormat format, Object... elements)
...
public static void sendInfo(CommandSender sender, String message, Object... elements) {
  send(sender, message, infoFormat, elements);
}

method for default decorations.
All i do is call

Msg.sendInfo(player, "You have {} coins.", 200);

And im done. Automatic object insertion and decoration via MiniMessage.

blazing robin
#

hey guys is there any way to detect long press left click in inventory?

pine crest
#

holy fuck u need kotlin smile

#

inline function is the only thing that will save u

lost matrix
#

Stay away with that scripting language

pine crest
#

ok if u behave like that stick to lombok extension annotation methods

#

u goofy

lost matrix
#

infix extension

blazing robin
pine crest
#

a lot of ui shit tend to react on key press up

pine crest