#help-development

1 messages · Page 861 of 1

proud badge
#

or maybe hmm, how would I check if the area exists?

shadow night
#

maybe has("password") or something

proud badge
#

is jObject.get("password").getAsString() exists

shadow night
#

idk

proud badge
#

ye its has

#

thx

hazy parrot
#

There is getOrDefault

#

Or smth along those lines

#

Or just get(key, defaultValue)

slate tinsel
#

How can I check if a path belonging to a yml file is a config section or not

glad prawn
#

isConfigurationSection

slate tinsel
#

Thanks 🙂

inner mulch
#

singleton abstract classes aren't possible, right?

minor junco
#

they are*

#

kinda

inner mulch
#

how?

minor junco
#
public abstract class Test {
  
  public static final Test INSTANCE = new Test() {
    //...
  };
  
  private Test(){}
  
}
inner mulch
minor junco
#

I mean yeah, that's a singleton. Having at maximum one instance

hazy parrot
#

There is no point in abstract singleton

minor junco
#

idk what you're trying to achieve

quaint mantle
#

Hi , can others use ( login ) my uuid if they have my uuid ?

hazy parrot
minor junco
#

the point of abstraction is the disconnection between declaration and definition

#

if you're making an abstract singleton it basically is declaration & definition

#

thus it doesn't make much sense

inner mulch
quaint mantle
hazy parrot
#

No?

#

How would that make sense if uuid is public

hazy parrot
shadow night
minor junco
minor junco
#

in fact you can overload any object

hazy parrot
quaint mantle
shadow night
inner mulch
hazy parrot
#

I mean it's not really abstract class object

minor junco
hazy parrot
#

But a anonymous class which extends abstract one

shadow night
#

Damn

minor junco
#

boilerplate and verbose code

shadow night
#

Wait, anonymous classes and functions are just those without a name?

hazy parrot
#

Hence ANONYMOUS xd

minor junco
#

lmao

hazy parrot
#

Lambdas are syntax sugar for making anonymous class

shadow night
#

Lambdas are generally pretty sugary

#

I based everything on top of lambdas lol

minor junco
#

as long as you don't end up in callback hell ig

shadow night
#

Lol

#

I was never in callback hell yet, besides javascript

remote swallow
#

Thats paper api

shadow night
#

It is?

remote swallow
#

Cancellation states like that are

minor junco
#

the legacy code wasn't like this, but the new are since it got into fashion

slender elbow
ivory sleet
inner mulch
#

how do i make sure there are aliases, there is not hasAliases method? (yellow because of NPE)

tender shard
#

well the NPE is possible because getCommand might be null

inner mulch
#

oh

#

i guess

#

thats my problem if i dont register it

tender shard
#

you can safely use Objects.requireNonNull(getCommand(label), "Do not edit plugin.yml manually oyu imbecile!")

inner mulch
#

wait what ?

#

why shouldnt i edit my plugin.yml?

tender shard
#

no, its a message for admins

#

sometimes they think it's a good idea to change command names and aliases by editing the plugin.yml in the .jar

#

this might work fine if they only change the aliases and stuff like permissions, but if they change the actual command name, then ofc getCommand("mycommand") will return null

#

so you can tell them to not do it if getCommand returns null

inner mulch
#

oh

tender shard
#

alternatively just use an empty Objects.requireNonNull but I like to leave this warning for stupid admins lol

river oracle
#

Thats why you register through the command map :P

inner mulch
#

oh yeah thats nice

#

thank you guys

opal juniper
river oracle
opal juniper
#

Tut tut tut

river oracle
#

But like still

inner mulch
#

can you use #getCommand(command) also with one of the main command's aliases to get the command?

tender shard
#

i doubt it

steel swan
#

hey so, i have this scoreboard code that makes certain player able to see life, which works perfectly, but now, i want certain other players to see a certain value on the below name slot. For instance, every player has a value assigned to him (a string value) and what i want is to display the players value on top of his head.

inner mulch
#

or do i understand wrong

steel swan
# inner mulch basically more nametag lines?

there is a below_name slot. here this code displays the health value.
i want to code it so that it doenst display the health value, but a custom String assigned to each player

inner mulch
steel swan
#

im using the Below_name thing with scoreboard, i wanna use that

inner mulch
#

you want a string below the player's name

#

that's a nametag line

steel swan
#

oh mb so yeah

inner mulch
#

yeah, so i might be wrong, but as far as i know you can display stuff there but with the compromise of there always being a score a heart or whatever minecraft display type you use

#

i think if you want to freely create nametag lines with all the stuff that you want to type there, you would need to create fake nametags with armor stands or textdisplay

inner mulch
steel swan
#

ok so

#

what if i want it to be like this for instance :

PlayerName
1 stone

#

1 being the custom int i get from each players assigned value

#

and stone being the custom String value each player has

inner mulch
#

i think that is possible

#

Criteria.DUMMY

#

there is a string i think, and the number 0 next to it as the score

#

i would recommend creating your own nametags, its more customizable and less of a headache than this, but you could try the criteria

steel swan
#

ok so, for instance would this code to show the X coordonate of each player work?

inner mulch
steel swan
#

cuz if i juste do setDisplayName it will change it for everyone

inner mulch
#

tbh just code your own nametags its much less of a headache, if you still want to stay with scoreboards, im not really able to help you as iam not super experienced (with scoreboards)

steel swan
inner mulch
#

no im talking about your own custom nametags, if you would do that and design a proper system you can have as many nametags as you want

#

and code everything as you like

steel swan
#

OK so with ur name tags could i do that ONLY 1 player sees every other player with the name tag PlayerName and a custom string that is different for every player?

inner mulch
steel swan
inner mulch
#

if crashing is no issue and you dont care having millions of armorstands after a crash floating in the air you could use the api too

steel swan
#

what else do i need to import

inner mulch
#

i dont know all the imports it depends on what you are doing with the packets

#

what exactly happens when you are trying to use protocllib

steel swan
#

but i think i saw somewhere i had to import smth like CraftBukkit or smth

inner mulch
#

i wouldnt recommend using nms

steel swan
#

why?

inner mulch
#

you should use protocollib

tender shard
#

?nms

inner mulch
#

it will make you insane

tender shard
#

what do you even need that packet for?

steel swan
inner mulch
#

i didnt tell you to

tender shard
inner mulch
#

i told you what happens if you dont

steel swan
#

i want just 1 player to see everyone name tag like :

PLayerName and next to it a String that is specific to each player ( that i get from a hashmap )

tender shard
#

i'd use a displayentity that has a custom PDC tag so you can delete them if they're accidentally leftover

steel swan
#

i want to alter the display name, not just show smth next to it

tender shard
#

yes, just spawn a TextDisplay

tender shard
steel swan
#

wait

tender shard
#

i only saw that you were talking about "leftover entities" or sth so I thought you wanted to use packets instead of creating normal entities for holograms

steel swan
#

Player#setdisplayName() is a thing would it work?

tender shard
#

it only changes the name in chat and tablist iirc

#

but not over the player model

steel swan
#

OK

#

so i d need to use Packets for that correct?

shadow night
steel swan
#

cuz i want just 1 player to see those custom names

#

so were back to my old question, what do i need to import to use

tender shard
tender shard
#

And then use the proper name

#

?switchmappings

steel swan
tender shard
#

or are you using gradle?

steel swan
#

nah maven

tender shard
steel swan
#

but usually i just modify repistory and dependency and thats all

quaint mantle
#

yeah

steel swan
quaint mantle
#

that's what you do

#

Im pretty sure you first install the NMS code locally

tender shard
#

which part exactly don't you understand? I mean it tells you to run buildtools, then it tells you what to add to your pom, and that's it basically

steel swan
tender shard
#
  1. Run BuildTools with --remapped flag
  2. Add the specialsource plugin (the <plugin> thing) into your <build><plugins> including that config
  3. Add the dependency for remapped-mojang
quaint mantle
#

im kinda confused tho how does buildtools register the nms into your local repository

tender shard
#

btw: latest buildtools has a GUI now

steel swan
tender shard
#
  1. download latest buildtools
  2. run it with double click
  3. select version, and select remapped in the settings
  4. click compile, wait until it's done
  5. now you can move to the stuff where you change your pom
#

be sure to check this

steel swan
#

like ok when i click it, i have this? no download or anything

tender shard
#

yeah tbh the download link is quite hidden in the text

steel swan
#

found it

tender shard
#

I said thousand times that the whole article needs to get yeeted and replaced with a simple
"Download BuildTools here: <link>"

steel swan
#

ok so its compiling

tender shard
tender shard
steel swan
#

yes

tender shard
#

ok good

steel swan
#

i enabled it in the potions

#

options*

river oracle
tender shard
#

then you can now wait 3 minutes

steel swan
#

ok while its doing that should i start modifying my pom?

#

?paste

undone axleBOT
steel swan
tender shard
#

well you can't use it until buildtools is done but ofc you can already start changing your pom

steel swan
#

what do i need to add

tender shard
#

read the blog post pls

#

you need to add the specialsource-maven-plugin into your <build><plugins> section

#

and then you have to change your spigot dependency to use artifactId "spigot" with classifier "remapped-mojang"

steel swan
#

the whole
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmcspigot1.18.2-R0.1-SNAPSHOT🫙remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmcspigot1.18.2-R0.1-SNAPSHOT🫙remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>

thing?

tender shard
#

yes

steel swan
#

i get this error : org.spigotmc:spigot-api🫙remapped-mojang:1.20.2-R0.1-SNAPSHOT was not found in https://repo.dmulloy2.net/repository/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of dmulloy2-repo has elapsed or updates are forced

tender shard
#

as I said, the artifactId is spigot and not spigot-api

steel swan
tender shard
#

has buildtools finished?

steel swan
#

no, is that why?

tender shard
#

yes

steel swan
#

ok ill get to u when its over

quaint mantle
#

wtf

tender shard
#

the purpose of buildtools is to create that dependency and install it on your computer

quaint mantle
#

i dont remember having to do all that

#

for nms lol

tender shard
#

then you probably used one of those "illegal repos" that host the spigot dependency

steel swan
tender shard
tender shard
#

and then you're done

#

although I see that you still haven't properly read the blog post because your pom is still incorrect

steel swan
#

oh mb the version

tender shard
#

yep 😛

#

now if you reload the pom, it should find the dependency

steel swan
tender shard
#

I see. you have added the whole remapping part into the maven-shade-plugin

#

that's wrong

steel swan
#

i copied what was on the site

#

i dont get what i did wrong here..

tender shard
#

this is one <plugin> section

#

you have only copied the executions part and pasted it into another plugin

quaint mantle
#

thats all i remember

#

then included it in dependneis

tender shard
#

yeah well installing locally = running buildtools

steel swan
#

oh i see

tender shard
quaint mantle
#

oh wait

#

ur re obfuscating

#

thats why

tender shard
#

yes sure, mojang maps

steel swan
#

ok it ran

tender shard
#

aint nobody wanna deal with a() b() c()

quaint mantle
#

thats what i worked with 💀

tender shard
#

RIP

#

mojang maps give you proper method names, and they will be consistent over updates

steel swan
#

Ok now its installed

quaint mantle
#

but I wasn't that knowledgably prepared anyway

#

like

#

the most I did was send an action bar

#

since 1.8 doesn't have that

tender shard
#

yeah 1.8 api lacks many things

#

and mojang maps are only available in spigot 1.17 and newer

steel swan
tender shard
#

no clue

#

well i can tell you how to send packets

steel swan
#

cuz what i see online tells me to use PacketPlayOutPlayerInfo

#

do u know how to send PacketPlayOutPlayerInfo ?

tender shard
#

Okay so PacketPlayOutPlayerInfo is the old name

#

check out this tutorial, it will explain how you can find out the correct name:

#

?switchmappings

tender shard
#

dw it's short and easy lol

steel swan
#

dont see anything tho

tender shard
#

dude you really need to learn to properly read

#

you always just read 30% and then wonder why you missed certain steps

steel swan
#

bro i just did what i saw here

tender shard
tender shard
slender elbow
#

cap

steel swan
#

ok mb i didnt see it

tender shard
#

if you would just read my tutorials (read EVERY sentence in the correct order), then there will be no questions left lol

#

if however you just take quick glances at the code snippets or the screenshots, then ofc you'll miss all the important information

steel swan
#

ok what am i dont wrong then..

tender shard
#

hm seems like PacketPlayOutPlayerInfo isnt the correct spigot-mapped name

#

where did you get that packet name from?

steel swan
#

from a spigot forum

dry hazel
#

it's for <1.19.3

steel swan
#

Ohh yeah ok i found the packet i need to use

steel swan
tender shard
#

you can try to use ClientboundPlayerInfoUpdatePacket, maybe that's the correct one

#

(that's already the mojang mapped name)

steel swan
#

figured*

#

Like for instance, if i wanna try smth simple, like putting everyones name to red

tender shard
#

as I said, i dont know which packet you need for that, I haven't messed with changing player's names. I can only tell you how to setup mojang maps (which we did now) and how you can use that website to translate the PacketPlayOut... names into the proper names

manic delta
#

Java or spigot has some limitation in the JAR? I am making a POST request in my plugin and testing the jar in a Test class everything works fine but inside the server (localhost) no, I don't have a cloud server at the moment so I can't test it there.

tender shard
#

probably windows firewall?

#

spigot doesnt mess with outgoing http requests or anything

steel swan
#

ok.

#

i might

#

have done a lot for nothing

#

@tender shard if i wanted to add a prefix to a player name (or suffix) would that require packets?

tender shard
#

i think you can do that with scoreboard teams

steel swan
#

so i put all players in teams and create a prefix for each team?

kind hatch
#

Yea

steel swan
#

wont that have any repercution on the game?

tender shard
#

no

steel swan
#

ok and that will change it also on top of the players head? or just in tab

tender shard
steel swan
#

oh wait

tender shard
steel swan
#

but then i have a problem

#

i want only 1 player to be able to see this prefix

#

or suffix

tender shard
#

then add these 2 players to one team and set the visibility to "only same team"

steel swan
tender shard
#

players can be in multiple teams

steel swan
tender shard
#

you would create one team per player and set all their visibility to "same team", then you take the special player and add them to all teams you created

steel swan
elder harness
#

Quick question: Adding to a location does NOT give you a copy, right? It gives the original one?

sterile token
#

How do You get a player instance, if the one using the name is deprecated. And since that, you can't get the uuid

rotund ravine
#

Yes

rotund ravine
#

Not because you shouldn’t use it if you absolutely need to

sterile token
elder harness
#

You have to get it by UUID. If anything you can't, and the player has been on the server before, you can loop over the offline players on the server and filter by name. Then grab the first from the filter. Note that this is unsafe, since (as mentioned before) names can change

#

What are you trying to do? It seems like your design has a flaw or your approach is bad practice

tender shard
steel swan
rotund ravine
#

If you do not have the uuid

#

Use the name

sterile token
tender shard
sterile token
#

Most of time i ask why spigot does weird things on their api

elder harness
chrome beacon
rotund ravine
#

It was deprecated cause names can be changed now

#

Not because you shouldn’t use it

sterile token
steel swan
rotund ravine
#

But you should prefer uuid when possible

elder harness
sterile token
#

i'm lost Jan sorry

rotund ravine
sterile token
#

So i use get player vía name without any issue. Thanks

steel swan
sterile token
#

thanks to spigot i have yo disable the shity deprecated warning uwu uwu

rotund ravine
elder harness
rotund ravine
rotund ravine
#

getOfflinePlayer or smth

sterile token
#

SO for getting player what do i use md_5

rotund ravine
#

Use PlayerProfiles though, there you can control it a bit more

sterile token
#

Offline or Player

rotund ravine
#

What makes sense in your application

sterile token
#

For example a banning plugin, they use Offlineaplayer right?

rotund ravine
#

Well, it could do

elder harness
#

Damn, I have been making http requests to that endpoint on the Mojang API my whole life and there is a method for it? Damn...

sterile token
rotund ravine
sterile token
#

So i can just vía name get offline player and ban it. Isnt that ok?

rotund ravine
#

In most cases that is just fine

sterile token
#

Right thanks i was asking about that.

manic delta
kind hatch
#

What does that last line say?

remote swallow
#

windows by default makes you use ondrive

young knoll
#

Move it outside of onedrive

#

Like the C folder or somethin

rotund ravine
#

Desktop is onedrive by default

young knoll
#

Or do what I do and yeet onedrive

grim hound
#

Can I somehow create a Proxy class that'd have it's methods invoked without using an actual class instance? For example I just input "Map.class" and every method invocation of that class of any instance is delegated there

grim hound
#

So that I don't need to input an actual instance to the Proxy

grim hound
#

Have the Proxy class have it's methods invoked

#

On any instance of the given class

rotund ravine
#

Why

grim hound
#

Without passing in the class' instance

grim hound
young knoll
#

Probably?

rotund ravine
#

A lot of things are possible

young knoll
#

With a lot of dark magic

kind hatch
#

Next on the todo list. More obvious error messages.

grim hound
#

Then how?

rotund ravine
#

Give us a good reason

grim hound
#

No

#

I just need it

#

I have no idea how I'll use it yet

orchid gazelle
#

and put a fat ERROR!!!!!!!!!!!!!!!!!!!:

grim hound
#

Because I haven't tested how it works

#

But for now it's absolutely necessary

kind hatch
grim hound
#

Without giving any map instances to the proxy's creation

young knoll
#

So it has to find all map instances

rotund ravine
#

Seems like ur trying to do something useless

young knoll
#

That’s probably a lot

grim hound
grim hound
rotund ravine
young knoll
#

I mean I’m sure you could find all instances of a given object at runtime

#

But like

hazy parrot
#

Why not just... Extend HashMap

young knoll
#

😩

hazy parrot
#

If you want to do some nasty things

#

And override methods

grim hound
grim hound
hazy parrot
#

¿

grim hound
#

What do you not understand?

#

Okay, does any of you know how to do this?

hazy parrot
#

I'm unfamiliar with term dynamic class

rotund ravine
#

Give us an example on how it would work with some pseudocode it seems weird

hazy parrot
#

Thing you explained earlier is basically done by extending HashMap

grim hound
#

I literally explained exactly what I wanna do

hazy parrot
grim hound
rotund ravine
#

Shadow you gotta remember not everyone lives inside your brain

grim hound
young knoll
#

Are we like

hazy parrot
#

Why ask me that kappa

young knoll
#

Generating classes at runtime via asm

#

Am confusion

quaint mantle
#

How can I get offline players from all servers with bungeecord?

hazy parrot
grim hound
#

Different names

young knoll
#

But that requires a player on each server

#

Otherwise something like redis

quaint mantle
young knoll
#

?pmc

quaint mantle
#

I have connected the pl to a mongodb

#

to ban him also if is offline

#

in bungee

grim hound
#

You could send a list of player nicknames

grim hound
#

Seperate them with like ";"

young knoll
#

Can’t you just handle the bans on the proxy

grim hound
#

And then find the one you wanna ban

young knoll
#

^

#

You can even handle the ban checking on the proxy

quaint mantle
#

yeah

#

Thats the idea

young knoll
#

Idk

#

But you can just connect to a database

#

Don’t really need messaging

proper cosmos
quiet ice
#

You people really have no idea how this dark magic works

young knoll
#

Google probably does!

quiet ice
#

Yes, it's completely possible - what the hell even is the point of using a Proxy class then? Just beware that if you wrap an HashMap, it will be proxied as a Map - not as a HashMap

#

If you are really unsure chances are you can easily generate the needed code via ASM (or comparable) - the code can then be dynamically loaded via MethodHandles.Lookup#defineClass

#

Did you forget to reobfuscate your jar file?

#

If so, you are out of luck - this is spigot, not paper. In paper world you need to use paperweight and as such the procedures differ.

#

how can that even compile?

#

Please don't say you are using reflection in this day and age

slender elbow
#

eclipse compiler will give you the option in a silver platter to compile even if there are errors

quiet ice
#

Well you're wasting your own time and that is basically all

#

Making use of Mojmap will allow you to develop like everything else without risking any typos and having to wrangle with obfuscated names

#

?mojmap I don't know if there is a command for that though, but does not hurt to try

river oracle
#

?nms

quiet ice
#

Yeah

#

oh god, don't tell me you are using your IDE to build your stuff

#

Sadly we do not have AW/AT/whatever access in runtime.
Would be cursed anyways

#

mojang's official deobfuscation mappings

#

it breaks with every update

undone axleBOT
young knoll
#

Technically you can get away with not updating sometimes

#

But I guess that also applies to reflection

unkempt burrow
#

how to change player skin using packets?

#

ty

grim hound
young knoll
#

So it’s not every object in memory

grim hound
#

Well it is

grim hound
vapid grove
#

?paste

undone axleBOT
vapid grove
#

Notes: There is no error, but it just doesnt account for durability when breaking a tree.
I thought that breakNaturally would break it naturally, and account for the tool used, but It doesnt seem to be.

kind hatch
#

The tool parameter is used for calculations with enchantments. It won't change the durability as the parent method #breakNaturally() just breaks the block and spawns the item.

vapid grove
kind hatch
#

You could try using Player#breakBlock()

vapid grove
#

Ill try that right now

vapid grove
remote swallow
#

wrong dependency

#

?nms

remote swallow
#

you dont need the minecraft-server dep

#

you need a spigot dep

#

read the blog page again

#

you dont need it

#

all you need is the spigot dep and the special source plugin

#

have you ran buildtools

#

with --remapped?

#

?paste your pom

undone axleBOT
remote swallow
#

no

#

craft server is the craft bukkit impl

#

for the actual entity EntitiyPlayer is the spigot mapping, ServerPlayer is the mojmap

vapid grove
#

And now im even more confused.
After doing the change, I then made slight improvements to my code.
https://paste.md-5.net/afeziracej.cs

Now, sometimes only 3 pieces of wood get broken, sometimes it only goes up to where the leaves come, its not breaking all the wood.
Any idea why?

Notes: EnchantmentManager is just the handler ive created for custom enchants in the plugin, that code works and the main issue is in veinMineWood.

young knoll
#

Keep in mind Player.breakBlock will fire another block break event

minor junco
young knoll
#

Depends on how you get it

minor junco
#

I swear 95% of all location related issues stem from location being mutable

vapid grove
#

Then add onto it

minor junco
#

Try if that fixes your issue

young knoll
#

Block.getLocation.add should be fine

#

Since getLocation returns a clone

minor junco
#

Player.getLocation doesn't or didn't in legacy versions at least

#

Idk why the code would be inconsistent

young knoll
#

Hmm

minor junco
#

But I'd say just give it a try

vapid grove
#

That worked I think, imma try it a couple more times.

minor junco
#

Alright

vapid grove
#

Yeah it seems to randomly not work, it stops randomly thru it.

#

Ill send my updated code.

minor junco
#

That's seems like a separate issue then

vapid grove
minor junco
#

If there's a change in behaviour the block location is definitely backed

#

So what's the issue now

vapid grove
#

Its doing the same thing.

#

I cant send screenshots however

young knoll
#

?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

inner mulch
#

if two objects are exactly the same (same class and same data in them) will the hashcode be the same?

vapid grove
#

It said my accounts already verified

#

But I never verified it

minor junco
#

By default, no

#

Unless it's a record

vapid grove
#

Ohhh thats why, I verified on an older account that ended up being thrown away.

inner mulch
vapid grove
#

@young knoll Is there any way I can reverify for this new discord account?

#

My old one was deleted and that one was the one I verified one back in march 2020

young knoll
#

You’ll have to contact higher up staff

#

Or

#

?support

undone axleBOT
vapid grove
#

Ah okay

minor junco
#

The hashcode is just the object's VM memory address by default I think

#

Used for referential equality

vapid grove
#

It seems to end randomly.

#

And now for some reason its not dropping blocks for #breakBlock() either

minor junco
#

What does that mean end randomly?

#

What's your goal here?

#

To break an entire tree?

vapid grove
#

My goal is to vein mine any blocks that are wood

#

Its a vein mine for logs

#

I realize why its doing that now and I feel very stupid.

#

order of operations.

#

Nope that didnt fix it either

young knoll
#

Remind me to yoink Chocos vein mining code at some point

vapid grove
#

Thought maybe it was because i was breaking the block first but now tis not working at all

minor junco
#

So it just stops working?

vapid grove
#

Yeah.

minor junco
#

Try to debug your startBlock and is wood function

remote swallow
#

@young knoll reminder to yoink chocos vein miner code

young knoll
#

Lol

#

Cheers

minor junco
#

Might be that the types differentiate without you realizing

placid quartz
young knoll
#

What’s the default hashcode impl now then

minor junco
remote swallow
#

Objects.hashCode

placid quartz
minor junco
#

That was using the memory address as a baseline no?

placid quartz
#

No it was a seed

#

If you started a new VM it was always the same

minor junco
#

Ah alright

#

Then I've been mistaught

young knoll
#

I like to use the current system time in my hashcode

minor junco
#

Or misunderstood

young knoll
#

Make it nice and unpredictable

#

Kek

placid quartz
#

But yes it was memory based

minor junco
#

Used to be, alright

#

I understand

ivory sleet
placid quartz
#

Also you could make your own VM and change the implementation if you wanted to

#

So I wouldn’t rely on it

vapid grove
#

@minor junco Print statements are only returning grass blocks and such, no logs whatsoever.

#

Which is odd.

#

Note to self: Become a script kiddie and steal someone elses vein mine code lmao

heavy void
#

Someone knows why BoostedYAML removes String?

Ex: Transforms "stringexample" into stringexample

ivory sleet
river oracle
young knoll
#

Usually*

ivory sleet
#

If a vm impl changes general api behavior then thats a bad vm

young knoll
#

Sometimes SnakeYaml adds quotes

#

I think it does when the string has a :

heavy void
river oracle
#

Yes

#

Exactly what I said

heavy void
#

Theres any way to disable this change?

river oracle
#

Ask the author

minor junco
heavy void
vapid grove
#

Whats even odder:

#

While the drops arent being made, durability is still affected.

#

I pissed off the api 💀

#

thats my conclusion

young knoll
#

Sounds like you are breaking air or something weird

minor junco
#

Erm

vapid grove
#

So how would I get the ability to break air

#
 public static boolean isWood(Material material) {
        return switch (material) {
            case OAK_LOG, SPRUCE_LOG, BIRCH_LOG, JUNGLE_LOG, ACACIA_LOG, DARK_OAK_LOG, STRIPPED_OAK_LOG,
                    STRIPPED_SPRUCE_LOG, STRIPPED_BIRCH_LOG, STRIPPED_JUNGLE_LOG, STRIPPED_ACACIA_LOG, STRIPPED_DARK_OAK_LOG ->
                    true;
            default -> false;
        };
    }
minor junco
#

A wild solution: break the block after interating over your range

vapid grove
#

didnt work at all

minor junco
#

What?

vapid grove
#

Yeah

#

ill try again but

#

it broke it when i did

minor junco
#

Have you tried to debug the outcome of isFuncs.isWood? Maybe the types are different

#

For some reason

#

Try printing the type and the result of that invocation

vapid grove
#

Ill reword:

  • Its able to find blocks to mine
  • It does invoke the function to attempt to mine
minor junco
#

So it finds all the blocks but it doesn't break them all?

vapid grove
#

Hold on

#

Imma try something

minor junco
#

@vapid grove imma sleep now but please feel free to keep me updated, quite interesting

vapid grove
#

So.. I realized it might be going into an infinite back and forth loop.

minor junco
#

Oh erm

vapid grove
#

Of finding the same wood

#

And I tried making a table of wood that has been located already

minor junco
#

yeah but it is getting broken

vapid grove
#

And not letting it attempt to vein mine it.

#

And my server crashed...

minor junco
#

So it shouldn't

vapid grove
# minor junco So it shouldn't
private void veinMineWood(Block startBlock, Player player, HashMap<Location, Boolean> veinMines) {
        Material woodType = startBlock.getType();
        veinMines.put(startBlock.getLocation(), true);

        if (isFuncs.isWood(woodType)) {
            for (int x = -1; x <= 1; x++) {
                for (int y = -1; y <= 1; y++) {
                    for (int z = -1; z <= 1; z++) {
                        Block currentBlock = startBlock.getLocation().clone().add(x, y, z).getBlock();

                        if((x + y + z != 0) && veinMines.get(currentBlock.getLocation()) == null && currentBlock.getType() != Material.AIR && isFuncs.isWood(currentBlock.getType())){
                            veinMineWood(currentBlock, player, veinMines);
                        }
                    }
                }
            }
        }
minor junco
#

If you break it before iterating

vapid grove
#

Ah

#

Ill give you updates as I figure out why its doing this lol

minor junco
#

Yeah please

young knoll
#

Wait why is it a map instead of a set

vapid grove
#

i do not know

#

just decided to use a map idk lol

#

Im going to try recoding this from scratch

spare mason
#

how can i freeze the player?

young knoll
#

Like stop them from moving?

young knoll
#

Set walk speed to 0 and give jump boost > 128

vapid grove
young knoll
#

Or jump boost -1, don’t remember which of those work

quaint mantle
#

if (!isFuncs.isWood(woodType)) {
return;
}

called gaurd clauses im pretty sure

remote swallow
#

thats early returns

vapid grove
#

Thank you, ill try doing that instead

quaint mantle
#

@vapid grove

vapid grove
#

Ohhh

vapid grove
#

@minor junco My last update on this:
Coll called it, the reason it wasnt working was because player.breakblock calls the blockbreak event, and caused an infinite loop breaking the code.
After switching back to breakNaturally and instead just manally lowering durability for the item, it works fine.

https://paste.md-5.net/avegeqexoc.cs

young knoll
#

You could also just use a Boolean to ignore the break event

young knoll
#

set Boolean
Player.breakBlock
un set Boolean

#

And then ignore event while Boolean is set

vapid grove
quaint mantle
#
public final class PitPlayerFactory { 
  
     private final DataContainerProvider<PersistentData> 
             persistentDataContainerProvider = new DataContainerProvider<>(); 
     private final DataContainerProvider<SessionData> 
             sessionDataContainerProvider = new DataContainerProvider<>(); 
  
     public <D extends PersistentData> void 
     registerPersistentDataFactory(Class<D> persistentDataClass, 
                                   DataFactory<D> persistentDataFactory) { 
         this.persistentDataContainerProvider.registerFactory(persistentDataClass, persistentDataFactory); 
     } 
  
     public <D extends SessionData> void 
     registerSessionDataFactory(Class<D> sessionDataClass, 
                                   DataFactory<D> sessionDataFactory) { 
         this.sessionDataContainerProvider.registerFactory(sessionDataClass, sessionDataFactory); 
     } 
  
     public PitPlayer create(UUID uuid) { 
         DataContainer<PersistentData> pitPlayerPersistentData = 
                 this.persistentDataContainerProvider.createDataContainer(); 
         DataContainer<SessionData> pitPlayerSessionData = 
                 this.sessionDataContainerProvider.createDataContainer(); 
  
         return new PitPlayer(uuid, pitPlayerPersistentData, pitPlayerSessionData); 
     } 
  
 }

Few questions:

Should I work with shorter names or keep these long names

Is this a factory method? I'm asking this because you can register your own session/persistent data factories before initialization

is this a good system or nah

quaint mantle
rare rover
#

Hi

quaint mantle
#

Hi

rare rover
#

See you in minehut discord every once and a while

#

I would help but I'm on my phone and cant see anything

quaint mantle
#

lmao

#

I can explain you the system

#

PitPlayer:
DataContainer persistentData
DataContainer sessionData

#

yeah then you can add your own data to the player's data containers, but you should register them to their factories

#

So when the player joins all the data loads

rare rover
#

Ah

#

Let me hop on my laptop rq

#

I'll be more useful

quaint mantle
#

The data container api follow these 3 classes

DataFactory
DataContainer
DataContainerProvider (might rename to factory who knows)

#

So it might look like this

interface PersistentData
class PlayerStats impl PersistentData
class PlayerStatsFactory impl DataFactory<PlayerStats>

DataContainer<PersistentData>
DataContainerProvider<PersistentData>
dataContainerProvider.registerFactory(PlayerStats.class, new PlayerStatsFactory())

And so on

inner mulch
#
Set<Object> randomSet = randomSetHashMap.containsKey(uuid) ? randomSetHashMap.get(uuid) : new HashSet<>();```

Is there a cleaner way to do this?
inner mulch
#

i need to get a the set from the hashmap, but i dont know if there is one

#

i want to know if this is the cleanest approach

river oracle
#

randomSetHashMap.getOrDefault(uuid, new HashSet<>());

inner mulch
#

oh

#

thanks

#

didnt know that existed

river oracle
#

depending on what you want to you could probably use Map#putIfAbsent and then Map#get after

inner mulch
river oracle
#

if the sets are mutable and you plan to mutate their state I'd reccomend the second approach

inner mulch
#

oh

river oracle
#

otherwise getOrDefault is perfect since it prevents non null values

inner mulch
#

i was going to mutate them actually

astral scroll
#

final ubuntu setup

#

what yall think abt it

astral scroll
#

tbh i like ubuntu cuz is user friendly

river oracle
#

I'm not used to default gnome xD it looks so polarizing

astral scroll
#

i don't really need something so hacker or idk

remote swallow
#

Ew ubuntu desktop

astral scroll
#

:(

river oracle
#

I mean for reference this is the same display environment

#

like we are both using gnome

#

I just customized mine a bit

astral scroll
#

well idk

#

i'll just stay with what i have until i get tired

river oracle
#

are you fully on linux?

astral scroll
#

ig i could get a windows-ish look with some apps? don't really know about customizing ubuntu

astral scroll
river oracle
astral scroll
#

lol

#

that's only thing good abt windows

river oracle
#

I acutally got genshin impact working on linux at one point

astral scroll
#

its compatibility

astral scroll
#

but well

#

it runs on phones

river oracle
#

but it's not supposed to beable to run on linux

astral scroll
#

put genshin on a freezer lol

astral scroll
#

you got it

#

HAHAHA

river oracle
#

I stopped playing though since It got boring after 300-400 hours

river oracle
astral scroll
#

THAT'S A SHITLOAD OF HOURS

astral scroll
#

but yeah

#

dualbooting is really good

#

but now i gotta reinstall epic games and rockstar

#

on windows

#

cuz i formated from win10

river oracle
#

do you do it on separate drives? because otherwise it can get fucky

astral scroll
#

same 500gb drive

#

and it works pretty well

river oracle
#

I'd actually reccomend going to get a new drive if possible eventually

#

beacuse windows likes to override grub sometimes

astral scroll
#

yeah i want to get an 1tb nvme

#

other than the 500gb nvme i have

#

but they're expensive

#

im saving for it

river oracle
#

you can get a pretty nice one from Western Digital for like $60

#

which isn 't bad tbh

astral scroll
#

yeah that's the same price i have here on colombia

#

but i'll check it out

#

but im on laptop

#

don't really now if i can add one

#

never opened it before

river oracle
#

might be saudered

#

I'd reccomend just saving for a desktop

#

it'll take longer but def be worth

astral scroll
#

im entering college 2025

river oracle
#

or buy a Thinkpad

astral scroll
#

damn a thinkpad

#

never thought of it

river oracle
#

they are good because you can replace parts

#

most laptops sauder parts

remote swallow
#

Framework

river oracle
#

thinkpoads generally don't

astral scroll
#

bro ive seen

#

that laptop

#

of modules

#

don't know the name

#

but they got a pretty good idea

#

imagine being in class

river oracle
#

Thinkpads are used in business so you can guarentee the parts won't dissapear either

remote swallow
#

Thats framework

astral scroll
#

and just start disassembling your laptop mid class

astral scroll
#

i'd like to have one of them

river oracle
remote swallow
#

Probably

river oracle
#

yeah see ThinkPad is better in that sense because I could just buy parts from elsewhere. Though I'd prob just buy from lenovo till they stop selling the parts

remote swallow
#

If you move a lot framework is good because it will last and when stiff breaks you can just replace it and upgrade

astral scroll
#

its

#

$9000 usd

#

but yk

#

you can dissasemble it on starbucks

#

lol

river oracle
#

@remote swallow actually doesn't seem bad tbh

#

looks like you can use whatever parts you get your hands on

remote swallow
#

Id hope so bc ltt invested like 100k or smth in it

river oracle
#

I think I'll buy one of these next. Maybe I'll save up and get one for my GF

remote swallow
#

Is this a pineapple dev promotion

#

I ought to try and get kubuntu or fedora on my chromebook again

young knoll
#

Im sorry why are we disassembling a laptop on top of Starbucks

remote swallow
#

Why not

astral scroll
#

cuz we can

vapid grove
#

Not related to coding but I was curious if there was a way to make a quest book look better?
ItemStack is an enchanted book named "Quest Book" with green text.

Lore is:

Quest Difficulty: (easy medium or hard recolored to be fitting)
Quest Info: Mine Iron Ore
Progress: 50% complete. (5/10) (recolored based on the percentage of completion)
#

I cant send images cause I gotta get my verification fixed lol

wet breach
echo basalt
#

ew anime icky

#

yuck

round finch
#

what's the way to get the entity the player is looking at?

orchid trout
#

there are like hundreds of threads about this

round finch
#

Thank you!

#

i totally forgor
about searching it up before asking
lol that what happens after long time of non coding

peak moth
#

Hello, looking for some guidance here so bear with me. I have a chat channels plugin that I am looking to add Bungeecord support to, previously, I had used the plugin messaging channel which worked relatively ok but not sure if it scales well. Essentially, any time an update occurs to a global channel, I simply want to propogate that update to all servers (such as new member joining channel etc.). I've seen some people have a project that is able to load into Spigot and Bungeecord servers with seperate build paths for both. However, I am not sure if I really would need a proxy plugin to achieve this or if it would be better performance since I am just unfamilar with proxy plugins. Any advice is appreciated

proper cosmos
wet breach
#

the proxy is only there to do one job, and you shouldn't add to it if its not needed

#

to accomplish your goal you just need a DB server

grim hound
#

You don't know what an interceptor is?

dry hazel
#

no

#

no idea what it means in this context

quiet ice
#

It's what is on the tin: It intercepts the call of a method

#

Although that one achieves it via subclassing, not by proxying or wrapping

dry hazel
#

knowing the use case would probably help

#

a proxy with an invocationhandler that calls the original methods would be the most straightforward if you control the instantiation, otherwise read the class file and pop your code where you want it and redefine - bytebuddy can do it easily if you're not familiar with bytecode

fluid cypress
#

i made a plugin bc i needed to change the biome of large areas based on an image. i used Block#setBiome, but for some reason, even after reconnecting or restarting the server, the biomes dont change unless i make a change to the chunk (i assume), like placing a block (or something like that, i didnt test it too much tbh, i just set min Y to bedrock just to try stuff out). any idea why does that happen? any idea how to apply the biomes without placing blocks? placing blocks makes like 2 or 3 times slower, not a problem but idk, id like to know why that happens

#

Uhh with the spigot api you mean? How is it different to restarting the server?

chrome beacon
#

thinking_blob Reconnecting or restarting should fix it

#

Make sure you're running Spigot and that you're up to date

#

also you can always share your code so we can try to recreate the issue

fluid cypress
#

Well, actually its not spigot

#

It is a purpur server

chrome beacon
#

try recreating the issue on Spigot

fluid cypress
#

But its just a simple for loop with block.setBiome depending on some conditions and thats it

fluid cypress
rough drift
#

I keep forgetting, but how do you rotate a vector around itself? Imagine this is a top-down view, and the black line is where the vector is currently pointing towards, how could I rotate it such that it goes in the direction of the red line?

chrome beacon
#

Add the vector between the two points

rough drift
#

I don't have the 2nd point, I only have the black line and an angle

#

I should've explained better lmao

chrome beacon
#

point refering to the tip of the arrows

eternal oxide
#

Spigot has helper methods for this

#

RotateAroundY

rough drift
#

oh

#

Thanks lmao

rare rover
#

Is this new???

#

I've literally never seen this

eternal oxide
#

not new

eternal night
#

feb 2019 kekwhyper

#

that is after 1.8 release so, thats new, basically an infant of a method

river oracle
halcyon hemlock
#

hello humans*

sage dragon
#

How would I go about changing a tool's speed and breakable materials?

(For example, a wooden pickaxe that acts like an Iron Shovel)

umbral ridge
#

Modify the item attributes

astral scroll
#

hello :)

smoky anchor
chrome beacon
#

It works quite well

smoky anchor
#

(has noone made a library/api (dunno correct term) for this ?)

chrome beacon
#

I would rather have delay for break start than block desync

chrome beacon
sage dragon
sage dragon
proud badge
#

what do yall think would be better, if I need 33% chance on something should I get a random number between 1-100 and check if its below 33, or just get a number between 1 and 3 and check if its 1?

echo basalt
#

just make 1 in 100

#

and move on

#

that's how percentages work

proud badge
#

Ok

young knoll
#

Or use nextDouble and .33 :p

quiet ice
#

That is if you want to be really precise

solid cargo
#

Or just gen 1 to 3

#

If its any of those numbers (choose one) then boom

minor junco
glossy venture
#

simplest

young knoll
#

Gotta go all out

#

0.33333333333333333

glossy venture
#

oh true

proud badge
glossy venture
#

yeah

#

its compares it

proud badge
#

ok so true if the 33% chance happens?

glossy venture
#

yes

#

<= always returns a boolean

glossy venture
young knoll
#

oh yeah

minor junco
#

IEEE hates this trick

quaint mantle
#

0.1 + 0.2 = 0.3000000004

minor junco
#

Gotta love floating point issues

quaint mantle
#

I tried this trick on banks

#

/j

minor junco
#

well banks usually use two integers to define a decimal value

rough drift
#

How can I get the block before a raytrace hits?

raven jolt
#

How do you register custom enchantments in spigot 1.20.4?
I used to do it like this:

public static void registerEnchantment(Enchantment enchantment) {
        
        boolean registerd = true;
        
        try {
            
            Field f = Enchantment.class.getDeclaredField("acceptingNew");
            f.setAccessible(true);
            f.set(null, true);
            Enchantment.registerEnchantment(enchantment);
            
        } catch(Exception e) {
            registerd = false;
            e.printStackTrace();
        }
        
        if(registerd) {
            // send message to console
        }
    }

However Enchantment.registerEnchantment doesn't exist anymore

eternal night
#

you don't

#

you can try to hack your way there via NMS

young knoll
#

Or use PDC

tender shard
#

i think i got too many projects open

tender shard
shadow night
#

Doesn't using nms for enchants break every version

#

Because of relocation

tender shard
#

you were able to register enchantments just fine using spigot-api and one line of reflection, until 1.20.3 came

#

NMS is not relocated btw

#

only craftbukkit is

shadow night
tender shard
#

i think it was until 1.17

tender shard
#

create, whatever

eternal night
#

I mean yea, API "registration" was scuffed af anyway

tender shard
#

is there a better way to check if a file is a jarfile, except by creating a JarFile and checking for exceptions?

eternal night
#

not really

#

the logic to read the zip header is not exposed elsewhere I think

minor junco
minor junco
#

Oh that's cool

#

Similar to Rust

tender shard
#

for example, here I declared String.placeholders(...)

#

and here's how one can use it:

minor junco
#

But I unfortunately hate the rest of Kotlin so not gonna program in that unless im forced to by my workplace

tender shard
#

iirc the compiled code is just a static function that takes in "this" as first parameter, e.g. String.doSth() would become public static void doSomething(String $$this)

minor junco
#

Ah okay, makes sense

#

If you'd use Kotlin and java interchangeably it might be a mess no?

#

Since the Kotlin compiler is doing so much bytecode magic

chrome beacon
#

Yeah using Kotlin stuff from java is pain

minor junco
#

Yeah no thank you, I'm staying with my old java 😂

tender shard
#

Using java classes in kotlin is fine, other way around is probably not so great lol

wet breach
dry hazel
eternal night
#

Extension methods surely are a great concept kekwhyper

dry hazel
eternal night
#

I find the concept of object methods outside of the scope of the object concerning given nothing guarantees you the score of the extensionmethods is imported

#

You end up with nice syntax sugar sure

#

but they just become messy as fuck imo when overused

tender shard
#

there isn't really a difference between these two:

class FileUtils {
  public static boolean isJar(File file) { ... }

and this

fun File.isJar(): Boolean { ... }

You'd either import FileUtils and use FileUtils.isJar, or you import your extensions class and use myFile.isJar()

#

and ofc the IDE will tell you it's a method declared in another file

eternal night
#

Yea but the name of say extension class is completely unknown

#

like, from my end as a consumer

tender shard
#

how is it unknown? You import it like you'd import any other class

eternal night
#

if a documentation references new File().isJar() i have 0 idea that I have to import FileUtils so I can use said extension function

#

that problem does not exist if I use a proper static method

#

I always know exactly what type that function is part of

tender shard
#

then you'd have to blame the documentation that advises you to use random extension function sthough. Kotlin's builtin extension functions don't need to be imported, and your own ones also don't need importing if they're declared in the same package

eternal night
#

I mean sure ?

#

its just more hassle for little to no gain imo

tender shard
#

idk i never had issues with not knowing where my own extension functions come from

eternal night
#

Yea because its your own codebase lol

#

I also don't have issues knowing where my stuff is

river oracle
#

I mean its fine if you organize them in utility classes still

#

you probably shouldn't just throw them around in random classes

#

than you can direct to Utility classes you can use as both Extension functions and used normally as regular functions

eternal night
#

guess so. ¯_(ツ)_/¯

#

in the end it just hijacks the syntax of object methods for a static method

eternal night
#

as great as inventory PR NODDERS

river oracle
#

speaking of Inventory PR

#

the only place I really wish I had this was actually with NMS

#

cuz then you can just slap extension functions on the related classes

river oracle
eternal night
tender shard
eternal night
#

fastes merge of a lifetime

river oracle
#

well I figured goat horn API was a given

#

that API was very important its the foundation of modern spigot

tender shard
#

all those stupid 1.8 players cant use goat horns lol

#

they dont even know what theyre missing

river oracle
#

lol idiots and their goat hornless version

tender shard
#

yeah stupid plebs kek

eternal night
#

pfft, 1.8 players don't even have PDC or sendTitle kekwhyper

river oracle
#

yeah but like who tf cares about that s hit

eternal night
#

Well, you could also have ItemStack#removeEnchantments

tender shard
#

i wonder if this works - can I really just turn a file from resources into a file object?

dry hazel
#

resources can be turned into a File only if they are an actual file

river oracle
#

I wanna know how a resource can't be a file wtf are you people storing in the resources directory!!

dry hazel
#

well you can have resources in JARs or outside

#

you can't reference it as a file if it's in a JAR

tender shard
#

sad, that would be very handy

#

can't i do it with a JarFileSystem or however its called

dry hazel
#

yea

wraith dagger
#

Hi

#

how to get location list in config.yml

#

?