#help-development
1 messages ยท Page 843 of 1
Right now it is only registered, but it could be that you are missing the @EventHandler annotation
(Does anyone know whether you can use local or anonymous classes for event listeners?)
you can
Good.
that looks right
the only thing that could cause issues if EssX does not actually export it's economy, which would be odd but I do not know it too well. Try it with another provider for the time being
?paste your whole main class
essentials works fine. also it should at least print "it's a creeper"
ah yeah. I did go off the assumption that they do not know where it should be printing that message
does it print NOTHING, or does it at least print that it's a creeper?
wait, I not have a last version of essentialsX, can it play?
it print nothing
and just FYI by "printing" we mean in the console, not in chat
send your whole latest.log then pls
essentials fails to enable properly
yes I send you
I try with the last version of essentials
also you have your plugin twice in your plugins folder
you're using an older version of your plugin
that's why it doesnt print anything
no
[22:01:54] [Server thread/ERROR]: Ambiguous plugin name EthernaPl' for files plugins\EthernaPl.jar' and plugins\EthernaPl-1.0.jar' in plugins'
yes

So I added a structure using a datapack and make a new world with spigot. I am trying to prevent the structures from generating in overworld and I'm pretty sure it can only be done w/ plugin. Canceling AsyncStructureSpawnEvent does nothing(prob cuz it's async). Any idea how else could it be done?
np
you solved 2 of my problems, thank you very much without you I would have alt F4 for a long time
Note: not ALL structures just datapack ones
does the structure event even get called for that custom structure?
Yes and I verified that I set it to cancel
add Vault as softdepend or depend in plugin.yml
how ?
does it only happen near spawn chunks or everywhere?
depend: [Vault]
in my plugin.yml
es
yes
use depend if your plugin requires vault, or softdepend if it also works without vault
Everywhere, I checked
hmm weird. can you show your listener code?
@EventHandler
public void onStructureSpawn(AsyncStructureSpawnEvent event)
{
if(event.getWorld().getName().equals(Main.DIM_NAME))
{
System.out.println("a " + event.getStructure().getKey() + " " + event.getStructure().getKey().getNamespace());
if(!event.getStructure().getKey().getNamespace().equals(Main.DIM_NAME))
{
System.out.println("b");
event.setCancelled(true);
}
}
else
{
System.out.println("c " + event.getStructure().getKey() + " " + event.getStructure().getKey().getNamespace());
if(event.getStructure().getKey().getNamespace().equals(Main.DIM_NAME))
{
System.out.println("d");
event.setCancelled(true);
}
}
event.setCancelled(true);
}
The last line was added out of desperation to check if setting it to cancel even works(it deosn't)
System.out was me verifying that events fire and i didn't mess up if statements
I think it doesn't work cuz It's async
Or it's a purpur bug
Cuz I run it on purpur
well try it on spigot first
Good idea, not sure why I haven't thought of that
Same result
hm weird, ill look into the spigot code and see if i find anything
Are the namespaces even the same
Hey, does anybody here have a Code for a unique Scoreboard for each player?
Yes, based on console output, not the point, last line sets event to canceled regardless and it still generates all structures
Just make a separate scoreboard per player
With Bukkit.getScoreboardManager.createNewScoreboard
net.minecraft.world.level.levelgen.structure.StructureStart creates an instance of CraftStructureTransformer that fires AsyncStructureGenerateEvent but that's not the event I use but it's all I found for now
I have done that. But only 1 Player can have the scoreboard. When a 2nd Player gets the scoreboard, the first scoreboard disappears
hey guys. how do i detect a player item and get the name of it
?
First Player joins: everythings works fine, gets the scoreboard
Second Player joins: 2nd player gets the scoreboard, player 1 will no longer have his scoreboard
and my scoreboard turns upside down if you know what i mean
the scores switch
could anybody here look over my code and help me?
Send the code
wdym
In the join event i do: new LobbyScoreboard(player);
note that new scoreboards are not persistent through server restarts ๐ค
so, if you were to do /reload, it could break some stuff
but I create them on every join?
and have you got any idea why only 1 Player can have see the scoreboard?
Anyone has any idea how to do that w/out using the event?
Did you try the other event
I don't know right now, sorry. I'm even a noob myself with scoreboards but I always use the main scoreboard and then set up teams. put players with the same group in same teams, so you get a prefix/suffix per team thing. If it's a sidebar I think that should be per 1 player. So what I would do, create a team for each player. That way you can ensure other players in the team wont conflict with other players since each player will have different values, the sidebar text
Coll1234567 knows more than me im sure
XD
With?

Ah hmm the other one isnโt cancellable
Looks like itโs just for adding transformers
Yeah if cancelling that one doesnโt work itโs likely a bug
it's also weird that ChunkGenerator#tryGenerateStructure returns true if the event is cancelled - shouldnt it return false?
cant see shit
XD
@young knoll Could you please answer my dms? I have no idea why my code doesn't work
better? lol
yea but i have no idea 
should return false since its in isValid block
i dont know
hello guys, does anybody know what the safest way is to teleport a player back to like in front of the end portal frame after they try to enter it and I deny it?
I assume the event worked at some point?
If you can find the issue Iโm sure a pr could be made :p
nvm found a solution
can you send your datapack for testing?
im just tping 3 blocks in x direction lmao
It prob should return false. Also could it be not working since it returns after the sturcutre#generate with a valid result is run?
I don't think it's relevant cuz canceling vanilla structures doesn't work either
works for me
I see
this is my code
What does /version say
1.20.2, gonna update really quick
I don't think that's what it says
i tested on 1.20.4 built 20 minutes ago btw
Didn't wanna start the server, give me a sec
This server is running CraftBukkit version 3950-Spigot-2888990-d485cde
maybe try this. it'd create a new world called jefflib-test-world (you can tp into it with /jefflibtest) and it should print to console all structures it prevented to spawn
ahh
it only generated numbers here lol
lucky
china numbah #1
Is that javascript
Migrating NMS unmapped code from v1_20_R2 to v1_20_R3 is gonna finally force me to use maven
be sure to use mojang maps this time lol
But I like my entityHusk.dL().ae()
there's literally no reason not to use mojang remapping
getLevel().getProfilerSupplier() ?
Yes
Reasons:
- Lazy
- See 1
It shall now be entityHusk.dM().ag()

but if you have to change all methods anyway, why not switch to mojang maps, then you never have to change them again
I am too lazy to setup maven in my project. I will just have to wait until my friend joins the project and does that himself anyway cuz he can't stand the obfuscated code. I always do that thing where at the start I am sure i wouldn't use NMS so I don't bother with maven but it ends up being like 70% of the project
you're doing something wrong if 70% of your project is NMS
I use 0% nms
I managed to rid all my NMS use a long time ago (just when mojmap came to be a thing). Good decision
slay
if only there'd be an api way to make items glow ๐ฅฒ
I just always start wanting to do smth simple but then I decide to add custom mobs or smth with extremely specific w/ packets so it kinda ends up being the only way
I don't ever dare touch that part of EnchantmentsPlus
i got all my NMS stuff in jefflib so I only have to update one library instead of 20 plugins
It used to work, somewhat - I think. So I ought not break it as I don't understand it.
But well I think I already did. Doesn't matter too much anyways though.
unless you're deep in world gen or custom entities
then you're probably fine
My last nms thing was for force spawn dragon with custom crystals... And get rid of that with a PR xd
all of my NMS revolves around components and Inventories basically
PR pending on that one
Components? Then you mean the Choco PR xd
Inventories is mine though :P swhat I meant
Choco ofc got components
Ohhh that.
also if u are doing smth that needs a lot of packet control
if Components gets merged before inventories which it likely will
i will add components to the stuff that gets nuked by my PR :P
de_nuke
Can be a great race what is the prox PR in being merged... But i think a better race its what PR need first a rebase
๐จ
rebasing is painful with patches
I pray every day that there are no patch conflicts
Well rebase a PR in CB/Bukkit its not than bad rather rebase a Spigot PR
I will never PR spigot it seems painful
My damage PR has many conflicts in patchs for the lasta changes in entities 
I saw I am looking forward to that
their are things I need from it to make a plugin
that aren't possible even with NMS
wtf is this
Yeah, currently exists many things where the damage info can help rather than the current
A decompiled class.
what's the purpose of that enum
I need lots of the damage info as well as current DamageSource
which you can't get currently
but with your PR all is possible
I look forward to it ๐
Where is called?
Thanks.
I still avoid rebase that again xd
for example in CraftEventFactory
private static final Optional<Object> STOP_ITERATION = Optional.of(Unit.INSTANCE); lol what
Strange
yeah every usage of that class is cursed lol
looks like it's supposed to be used similar to Void
why not just use void then ๐
yeah that's the question
look like its been around since atleast java 8 too
NMS has very cursed or strange things like entities where use new memory things but still exists legacy stuff in others
my guess is they very slowly change stuff over since they have no real incentive to change everything over cuz it works ig
I forgot there was Fluids in NMS
xD
bukkit also got fluids
declaration: package: org.bukkit, enum: Fluid
enum ๐
I feel kinda dumb
Recently I had to reinstall windows onto a new ssd, and as such ive had to reinstall intellij and setup my development environment again
All of my projects are on github, so I didnt lose anything, but the javadocs that normally appear when you hover over a class are just not appearing?
Normally, I feel like there would be text thats like "This event would be sent when a player moves or something blablabla", but instead it just shows me what the class extends and implements: https://senpai.plz-choke.me/๐ซ๐๐พ๐๐
Is there some setting somewhere that im just missing?
I forgot I was making this xD
Kotlin....
With show source you can also get the button for get docs too i think
show horse
If there isnt, loop over recipe iterator
public Optional<RecipeHolder<?>> byKey(ResourceLocation recipeId) {
return Optional.ofNullable(this.byName.get(recipeId));
}``` :P might beable to hack together something with this given recipes are appropriately named
This seemingly has no effect
i'd use the recipe iterator so that you could also get datapack recipes etc
try invalidate caches after it downloaded them. also did you add the spigot repo?
this is just some fun thing I'm making :P
its pure NMS
this is technically raw server code I was gonna see if bukkit did anything I could look at
if that still doesnt work, you can just use buildtools and then mvn install:install-file the javadocs manually
run buildtools with --generate-javadoc (or however that's called) and then mvn install:install-file -DartifactId=spigot-api -DgroupId=org.spigotmc -Dversion=1.20.4-R0.1-SNAPSHOT -Dclassifier=javadoc -Dfile=<path-to-buildtools-javadoc-jar> -Dpackaging=jar
I feel like generate-javadoc should install it also?
last time I checked, it didnt
Yea, it doesn't do that currently. Choco confirmed that functionality for us.
#!/usr/bin/env bash
BUILDTOOLS_DIR=/Users/mfnalex/buildtools
VERSION=1.20.4
set -e
cd $BUILDTOOLS_DIR
java -jar BuildTools.jar --rev ${VERSION} --remapped --generate-docs
mvn install:install-file \
-DartifactId=spigot-api \
-DgroupId=org.spigotmc \
-Dversion=${VERSION}-R0.1-SNAPSHOT \
-Dclassifier=javadoc \
-Dfile=./Spigot/Spigot-API/target/spigot-api-${VERSION}-R0.1-SNAPSHOT-javadoc.jar \
-Dpackaging=jar
this should do, just adjust the bt path
I am just going to give up i add the custom_model_daya and it just gives me a map with out the texture in the gui
then your resource pack is broken or you didnt set back the item meta
didn't you say before you weren't a dev
I probably wouldn't try to do things you don't understand
especially as something as complex as development
it takes quite a while to learn
ya but i trying to get this done so i can release this weekend for jan
but with this code the texture works
wait i fixed it
ok so i add the 36515 to this
how can i find spigot docs
what if I did thread.sleep on the main thread
Hey, so I have this problem, where the inventoryCloseEvent is being fired 2 times.
I have a "combat" plugin, so when the player leaves in combat it kills them. But when they have a menu open, and are in combat, the menu they had open, is being closed 2 times if they leave.
I have no idea why this is happening, and don't know how to fix it.
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
Bukkit.broadcastMessage("Inventory closed"); //sends 2 times
Bukkit.broadcastMessage(event.getInventory().getName()); //sends 2 times
}
are you responding to my message above
I am giving Bedrock health so after 5 TNT hits it will break, what is the best way to save this and run it
Persistent data
I was just going to save to a hashmap Location::Int (hits) and save / write to config but didnt know how that would last over time as more blocks in the wilderness take 1 tnt hit to never be touched again
customblockdata is the way then
it is being saved in the chunks data
no database
no files
The issue is for this project it is in 1.8, will that still work?
CustomBlockData is compatible with all Bukkit versions from 1.16.3 onwards, including all forks. Older versions are not supported because Chunk only implements PersistentDataHolder since 1.16.3.
rip
Pdc didnโt exist back then
i guess you either write your own customblockdata (if you can even save data in a chunk in 1.8) or use some kind of database
So I just its just gonna be a hashmap
any way i should optimize it
You could pack the xyz into a single long I guess
Eh
I kinda wanna map them by chunk so its easy to check blockhealth per chunk
would <Chunk,<Location,Health>> be good
that won't work
ints are 32 bits and can go negative
you make the worrying assumption you'll never utilize more than 21 of those bits per integer
Actually don't Chunk objects delete after they unload and create a new object when loaded
Dang it
just do Map<ChunkCoord,Map<Coord,Health>>
on chunk unload dispose of the maps properly
For the block Coord would it be bad to use Location in that case?
Omg I forgot worlds too
and a myriad of other things that it probablly shouldn't be
what are you trying to do?
ahhh use PDC ๐
Unfortunately this project is 1.8 ๐ฆ
mfnalex's block pdc library would be helpful here
use NBT then
It works for Blocks?
no only Chunks have PDC
Sure it will
you make a strong assumption
that a coordinate will not exceed the 21 bit integer limit
Might just end up with; HashMap<World, HashMap<Chunk, HashMap<Location, Integer>>> blockHealth;
please use NBT-API
its definitely applicable here
26
26 bits is enough for +- 30 million
still limiting
And 12 bits is enough for +-2048
you make an assumption no one will ever exceed those coordinates
mm I do love my world hard references
Dang it forgot that too
it's only prone to hardcore memory leaks
hardocre references for hardcore memory leaks
1.8 tax
I wonder if I can make a PDC compatibility layer with 1.8
by doing fucked up bytebuddy stuff
?1.8
Too old! (Click the link to get the exact time)
you seriously think I'm gonna let that opportunity pass
imma be considered a hackerman
I did asm on pistons to increase the push limit and make tile entities moveable
Does that count
I've extended every nms entity and made them all collidable with client-sided blocks
solid 700 lines for each one of them
public class ChunkCoord {
private int x, z;
public ChunkCoord(int x, int z) {
this.x = x;
this.z = z;
}
}
private final Map<String, Map<ChunkCoord, Map<Location, Integer>>> blockHealth;
public BlockHealthManager() {
blockHealth = new HashMap<>();
}
public void setBlockHealth(World world, Chunk chunk, Location location, int health) {
blockHealth
.computeIfAbsent(world.getName(), w -> new HashMap<>())
.computeIfAbsent(new ChunkCoord(chunk.getX(), chunk.getZ()), c -> new HashMap<>())
.put(location, health);
}
public int getBlockHealth(World world, Chunk chunk, Location location) {
return blockHealth
.getOrDefault(world.getName(), new HashMap<>())
.getOrDefault(new ChunkCoord(chunk.getX(), chunk.getZ()), new HashMap<>())
.getOrDefault(location, 0);
}
}```
For night I might have to settle for something like this
ofc with better chunkcoord handling
location is still leak prone
omg
You can pack the location of a block within a chunk into like
16 bits :p
Well in 1.8 anyway
public class BlockHealthManager {
private final Map<String, BlockHealthContainer> worldContainers = new ConcurrentHashMap<>();
}
public class BlockHealthContainer {
private final Map<ChunkCoord, ChunkHealthData> data = new ConcurrentHashMap<>();
}
public class ChunkHealthData {
private final Map<Integer, Integer> health = new ConcurrentHashMap<>(); // The key could be a short if you had chunk sections
}
You can do some clever BS to store chunk health data in like 8 longs or sumn stupid if you use your brain
clearly I don't have one
Someone likes concurrent maps
micro optimization looking ass
the same way you could've spend this time coding instead of arguing
reminds me of this
and I had a hard ref to location fml
So mine is bad?
nah it's similar
easier than you think
Should I do a for loop and just loop inside out and map it into sections
I vote for janky reflection mapping
no we're not making a shitty orm
Itโs not shitty
mostly
Anyway it should be fairly simple
One world has multiple chunks, one chunk has multiple blocks
Anyone know how to control the colors of a biome? From my understanding, the only effective way was to send a packet when the player joins that specifies the biome colors for each chunk. Is it the ClientboundLoginPacket?
You can do it whenever a chunk is sent
I'm trying to reassign an interface when I use my reload command. This is so that I can swap databases on the fly. Here is the method I'm using to do so.
https://paste.md-5.net/irizexefup.cs
For some reason, the interface does not seem to update correctly as my data isn't being updated. I think the reference isn't being updated correctly, but I'm using the standard getter/setter methods. Am I missing something here?
So in that case, would it be ClientboundChunkBiomesPacket? It seems to take a ChunkBiomeData argument.
Itโs in the chunk data packet
Alright, if itโs a chunk data packet (ClientboundLevelChunkWithLightPacket), how might I go about editing parameters such as tree color, grass color, etc? Sorry Iโve been trying to find some info on the web, but havenโt found much
You need to use the getPlayerDataManager method in call instead of passing the variable directly
Only other alternative is make a ProxyPlayerDataManager that just proxies to whatever is set right now
Still an icky approach
On a side note I'd change to a more modular system as that DatabaseType enum can be pretty restrictive
And use a Map<DatabaseType, Supplier<PlayerDataManager>> providers instead of that huge switch
But that's more of a personal opinion
Sorry, I'm a little confused by this. You mean everywhere else where I'm accessing the interface methods or in that specific method?
Show me a method that uses the playerDataManager
alright you call the getter on your method call
Anywhere else where you store the manager as a field?
A couple places
Yeah if you store it as a field that's where your problem comes
wat
So I should always be using the getter instead of making a field for convinence?
?
Cause if so, I'll update and let you know if I still have the same issue.
Biome data is part of the ClientboundLevelChunkWithLight packet
yeah, what biomes, not the definitions
Yeah
If you want to define them you can do it with the sync packets
Or just registry inject them
which is what they were asking. changing colors
They mentioned the specified colors for each chunk
So I figured they had custom biomes they wanted to use
hey custom biomes!
my favorite
If you want to change the vanilla ones you can probably do that? Idk if the client respects changes to those
ew dont change vanilla ones
make your own
one sec
i gotta make this method look better but: https://github.com/Outspending/BiomesAPI/blob/main/src/main/java/me/outspending/biomesapi/registry/CustomBiomeRegistry.java#L37
that creates a new biome with a custom resource key
Gotta love unfreezing registries
yeah ๐ฆ
but i freeze it again
so
i had to do something to register biomes at runtime
plugin developers will do everything unholy to avoid using data packs when the time is right ๐
My goal here is to add seasons. I made a plugin adding custom crops, and Iโd like to create another plugin to add on to it. Would it be possible to change the colors on existing biomes by replacing their registry?
i have no clue, i haven't tried to make a biome edit system yet . My guess is you would have to change the registry
Canโt add a datapack with a plugin
Well, you can but not well
making custom biomes ain't even a hard task just gotta do some research
then just use one regularly lol
you're missing out
Stupid? Yes usually
and that's why you don't make public things, kachow
Welp, that did indeed solve the problem. Thank you!
Do you know why it causes issues if it's assigned to a field? Is it because those fields haven't been gc'd or?
Paper becomes private fork when
pass-by-reference and not pass-by-value
It's kinda weird
But basically when you assign a field you're saying "that field points to XYZ's current memory address" instead of "that field points to whatever XYZ points to"
Itโs not my fault Mojang doesnโt let us have fun
lol
I mean I guess itโs more spigot lacking proper api
But writing such api is basically impossible ๐
A stupid solution to this is to just make them both point to a constant "proxy object" which points to the real mutable object
@ owen runs
I mean maybe if we yeet runtime plugin loading and unloading
And then redo the loading systemโฆ
And then cry a bit
Did some digging and found this: https://www.spigotmc.org/threads/how-to-create-custom-biomes.512105/#post-4195590 problem is โBiomeBaseโ doesnโt exist
Compare different mappings with this website: https://mappings.cephx.dev
is replaced with Biome
in mojang mappings
Question for y'all. What's the best way of storing locations inside an sqlite database?
Thanks! May I ask where you found that? Iโm trying to figure out what some things are
I would just store them as an x y and z column
And a varchar world name I guess
Or uuid
well i need to store locations per uuid ofc
Multiple rows
don't try to make data structures inside your database. that is generally a sign you are using one incorrectly
you want to store a location with a UUID? have a db with columns for UUID and x, y, z, world uuid.
just keep inserting new rows and use queries effectively to get all the locations for one uuid
ah okay
you could just store an int of xyz together
so you are not wasting space on 3 columns
you'd have to do something like this
i really only need 1.20 and up
i'm not that familar with maven anymore
i use paperweight in gradle so
i'd wait for someone else
Guys what is Collections class called
Like the design pattern
In Effective java it was mentioned in the static factory method (not related to the factory design pattern)
Probably just a static factory
is there a way to copy the resource config.yml to the ConfigurationFile
Bukkit has a goofy ah config system
never used it before
It doesn't really matter what it's called though if you wanna use it go for it. Only case in which I think it's important to know the name of your design is when you're both trying to convey your idea and plan out before you actually create a project.
Expound
huh?
The design pattern right
Expound means to explain more
Yeah
ah
sorry I'm not Up with what the kids bbe speaking like now adays
Aren't u like 19
18*
lol
but also I don't use social media I'm fairly secluded from the online sphere outside of here
well i have the config.yml resource and i'm wanting to copy whatever that file contains in the FileConfiguration
you just want to put it into your plugin's data folder?
ye
saveResource
Do you guys think if I applied all of Effective java's contents into a library it would be a good api
Maybe
might be dif for configs
it isn't
https://paste.md-5.net/ihocurebow.cpp <- this allows you to copy every resource and its contents to the plugin folder
when do I make my class final
https://paste.md-5.net/iyovihezey.java <- you extend this class for config files
I think it might be more beneficial to focus on writing code and making mistakes rather than trying to take one crack at a perfect result.
While yes applying the concepts yoh learned will probably result in better design
Go with the flow where applicable stress about the details later
When you expressly don't want it to be extended
This can be useful on util classes
Otherwise not expressly useful unless for some reason you need to stop extension
well the static factory pattern basically makes your class not very extendable
Static factories are basically glorified utility classes
i mean yeah you aren't going to make a Util interface and DI some mockable implementation lol
example
like String.valueOf
Ah
They still allow for inheritance
The idea of them is to allow for developers to change the impl based on parameters in the future without breaking stuff
It's extendable
Usually the constructor is private tho right
https://www.spigotmc.org/threads/how-to-create-custom-biomes.512105/#post-4195590
Ah, here I am asking more questions. I was looking at this tutorial listed above, and I was able to translate the mappings to the Mojang remappings so far, but I canโt figure out the equivalent of IRegistry.aO. Iโve found itโs remapped to net.minecraft.core.Registry but I canโt find an equivalent of Registry.aO Any ideas? This is the full line of code:
ResourceKey<BiomeBase> newKey = ResourceKey.a(IRegistry.aO, new MinecraftKey("test", "fancybiome"))
What about something like
ConfigDao
FileJsonConfigDao impl ConfigDao
Should I make the FileJsonConfigDao final
?mappings might help you
Compare different mappings with this website: https://mappings.cephx.dev
find aO in the old version and find its equivalent in the new version
I gotta go but my personal advice here max. Would be to write code and revise it don't overly worry about code architecture.
Iโve been searching there for two hours to no avail
Ima feel guilty tho
its clearly gonna be Registry.BIOME or something
prob yeah
Don't feel guilty feel empowered to learn and make mistakes
why does it map to RECIPE_SERIALIZER in 1.16.1
Making mistakes is great
I'm prob in the wrong version
Tried that, but InteliJ doesnโt like it
Prob Registries.BIOME in remapped or something
this is what it maps to in 1.16.5
just find the IRegistry of the type BiomeBase and move on
Click the history button and ctrl f it
Nah it's like
what if I gotta do some huge refactor
at least you learned what went wrong
That's where you learn
I've done dozens of massive refactors over the years
I just started programming theory this year lol
sometimes rewriting a project like 5 times
All I've done is code
p much
I've been coding for a while
over the years I've started knowing more and more at a "formal" level
knowing what things are named as
I'm taking notes on Effective java so I can reference back to them
Iโm trying to update / convert the code to work on 1.20
I started my formal education this year
learning all the technical terms
Well
You find what it meant in the old version
you find its equivalent in the new version
I've finished my course, it barely taught theory
tbh it was ab ad course
My college goes heavy into theory atleast thus far
I got some of these notes
Well our course work only just taught us to code and I just took data structures
Exceptions are designed for exceptional circumstances.
JVMโs code optimizations are more limited for code inside try-catch blocks.
Never use exceptions to control ordinary code flow.
Never force other developers to use exceptions to control ordinary code flow.
If a โstate-dependentโ method is unpredictable, a โstate-testingโ method should be available to inform if it is appropriate to invoke the โstate-dependentโ method. For example: boolean Iterator#hasNext()
Alternative (to 5): Have the โstate-dependentโ method return a distinguishable value such as an empty Optional or null.
Condition (to 5): If a โstate-testingโ method essentially does the same work as a โstate-dependentโ method, a distinguishable value should be returned due to performance concerns.
you're doing better than most by reading effective java
it's a book I read sometimes
I'm only ~30% in
bro why was item 1 so long ๐
He started providing so many advantages
of why the static factory was good
Never picked up a programming book they always seemed boring
I used to read programming books for fun when I was a kid
Effective java is kinda nice I can't lie
I like to read manga and novels for fun I rather read something else
I can't lie tho these books are kinda boring
Someone should make a TL;DR super well produced video of it
Fucking up is part of the process
it probably exists already
I'm just taking notes on every item and chapters
bro turned a 5 minute read into a 50 minute video
I found it meant BIOME_REGISTRY in 1.17, but the equivalent to IRegistry in 1.20 seems to be net.minecraft.core.Registry and only has two methods, none of which being in any way related to biome_registry
In the first item
It talked about some really weird service provider pattern I've never heard of
With like 4 layers
This is what I mean
probably BuiltinRegistries in 1.20
ResourceKey#create() does seem to take a minecraft.core.Registry though
What do you mean? Sorry Iโm really stupid
Especially this late
Ah, now I got it haha. I think I need to go to bed LOL
Thanks @echo basalt @sullen marlin
There we go
What is so special about nms? What can you do with it
NMS is basically working with the server's internals rather than the entire bukkit abstraction layer
So anything that is achievable within minecraft, but not with bukkit
Proper client-sided blocks and entities, custom entities, custom biomes
Tile entities and all
I really want to figure out how to use it, but it seems like itโs highly frowned upon
And Iโve never been able to get access to the non-obfuscated version
It has never worked for me
Could it be that if I retrieve the location of my projectile in the Hit Event, it is not correct as the projectile has gone too fast?
So the location I get is two to three blocks too far back compared to where the arrow ended up
The main usecases: changing mob behaviors and packet monipulation
does this look right? I dont use configs in my plugins often
if your config looks like this:
database-host: localhost
then yes.
epic
btw what happens if I for example do getBoolean but it isnt a boolean?
Does it throw a stacktrace?
it'd be false
also should I not inicialise it or should I just set it to null?
If the boolean does not exist but a default value has been specified, this will return the default value. If the boolean does not exist and no default value was specified, this will return false.
ok I see
same for all the other methods, like getInt will be 0, etc
ok I see
null is the default value, it makes no difference
ok
is it possible to save a java Date object in a MySQL table?
just save millis ?
average coding youtube video
they're always yapping
Should be because MySQL has date types
[12:48:23 ERROR]: Error occurred while enabling Core v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot read the array length because "<local2>" is null
at dev.vedcodee.it.BetterHologram.onEnable(BetterHologram.java:35) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:833) [?:?]
``` ???
Don't
Avoid NMS if you can
If spigot allows you to do it, don't use NMS
what is BetterHologram.java line 35
if(directory.listFiles() != null) {
if you just want to look at the nms code you can use https://github.com/PaperMC/mache
that will never be null mb it will
if it isn't directory
how do you declare directory
I think there was a #isRegularFile
Or smth like that
Alternatively you could use Path and Files API
what other things affect a player's BoudingBox more than its position?
if they're sneaking or not
I need to save information about which block the player has open in their inventory. (a custom block opens a gui and you need to find out from your inventory what kind of block it is).
what's better?
- store in Map<Player, Block>?
- or add it to some itemStack PDC with coordinates to get a block
is it nothing more than that?
Probably more things like riding entities
Why do you ask?
I hope you're not hardcoding the hitbox
I check if a player Bounding Box overlaps the blocks around the player
To check if the player takes damage from suffocation in the block when i teleport the player
public boolean isLocationValid(Location location) {
Location tempLocation = location.clone();
double locationX = tempLocation.getX();
double locationY = tempLocation.getY();
double locationZ = tempLocation.getZ();
BoundingBox playerBox = new BoundingBox(-0.30000001191 + locationX, 0.0 + locationY, -0.30000001191 + locationZ, 0.30000001192092896 + locationX, 1.7999999523162842 + locationY, 0.30000001192092896 + locationZ);
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
Block block = tempLocation.getBlock().getRelative(x, y, z);
Log.info("PlayerBox: " + playerBox);
Log.info("BlockBox: " + block.getBoundingBox());
if (playerBox.overlaps(block.getBoundingBox())) {
return false;
}
}
}
}
return true;
}```
Why are you hardcoding the bounding box ๐
How else should I do it?
Get the bounding box of the player
declaration: package: org.bukkit.entity, interface: Entity
"location and size"
So then it will be the wrong location
Because I want a specific position that is not where the player is
double widthX = playerBox.getWidthX();
double widthZ = playerBox.getWidthZ();
double height = playerBox.getHeight();
BoundingBox newBox = BoundingBox.of(centerLocation, widthX/2, height/2, widthZ/2);
might wanna adjust the height if it should be on the ground or whatever
alternatively get the playerBox and shift it twice, once to -playerLocation, then to target location
But don't you also need to specify a position to create the boudingBox?
Therefore when I fetch the player's BoudingBox it changes depending on where the player is
yes?
that's why I created it at centerLocation or told you to shift the player's box
So this is correct?
BoundingBox boundingBox = player.getBoundingBox();
boundingBox.shift(targetLocation);
boundingBox.shift(player.getLocation() * -1);
After migrating the plugin to 1.20.4 it works. I guess no better time to update the server
no, you gotta use playerlocation * -1
to move it to 0,0,0
how do you mean? boundingBox.shift(player.getLocation() * -1);
declaration: package: org.bukkit.util, class: Vector
turn the player location into a vector and multiply it by -1
Like this?
BoundingBox boundingBox = player.getBoundingBox();
boundingBox.shift(targetLocation);
Vector vector = player.getLocation().toVector();
vector.multiply(-1);
boundingBox.shift(vector);
yes that should do i guess
Altho structures do still spawn next around spawn area. Maybe I could package datapack inside the plugin so it only adds structures after the listener is setup?
are you using load: startup or load: postworld?
Whatever the default is. Where can I change it?
plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
set it to startup
I see, thanks a lot
does anyone know a way how to make the crops to grow in a chunk when there is no player nearby but a special block is placed that must do this function
on chunk unload, save the time of the unload in the chunk's pdc. when it's loaded again, check how long it was unloaded, and then manually grow the crops
is there an event for when a player stomps farmland and it turns into dirt, or when a block is placed an a grass block and the block changes into dirt afterwards
trampling crops is PlayerInteractEvent
grass turning into dirt should be BlockPhysicsEvent i guess
okay, thank you
Again lol, I'm trying several ScoreBoard plugins, none of them are working correctly, I'm running spigot 1.20.4
Is there a specific event being called when a player harvests honey or is it just the playerinteractevent?
PlayerInteractEvent sounds good
okay, so for milking cows it's interact too?
Hi, I was thinking of using trajectory to create a list of all locations than the arrow will pass how do I create this?
PlayerHarvestBlockEvent
I've tried this one and this isn't called when a player harvests honey, sadly
thanks tho
huh weird
this event is called for sweetberry bushes i think
yeah but it should be called for all blocks that aren't broken on "harvest"
yeah, it should but i guess not
Probably could make a jira issue
what does jira mean?
How do y'all provide 1.8 and 1.20 support in your plugins? Talking about chat component differences.
Assuming the plugin doesn't have translations implemented.
would using MyPlugin.getInstance() be fine in an async environment? (To use the plugin logger)
Nms
Since you use it for obtaining logger instance, it's fine
And separate modules per version
Since your on 1.8 you'll have a lot of work for you
Yeah, this is what I'm doing. It's a bit of a hassle
If you wanna be smart cut out everything under 1.20 ๐
Utility plugin for 1.8 and 1.20 games
Not really, as running pvp related minigames on 1.8 (custom fork of course) is the perfect choice for my network.
yeah I think, but idk if the logger is thread safe
hey
so im running a 1.19 plugin and i want to update it to update it to 1.20, so the issue i currently have is that the method player.sendSignChange(); is deprecated. Whats the updated method?
check the method javadocs
i did, in the official docs its not shown as deprecated
Hmm, are you pulling in paper-api by chance
i actually am, i just realized im currently doing further research gimme a moment
found it, thanks for pointing that out
Is there any reason why namespacedkey class is final?
because you should not be implementing types from the API
Implementing interfaces. The Bukkit API is designed to only be implemented by server software. Unless a class/interface is obviously designed for extension (eg BukkitRunnable), or explicitly marked as such, it should not be implemented by plugins. Although this can sometimes work, it is not guaranteed to do so and resulting bugs will be disregarded.
no fun :/
???
nope
look the pom
and the class
and the package
@eternal night
are you talking about the fact it hasnt took it as a java package
most likely ur getting an error
yes, not load the module
I don't know why
there isnt error on pakage of the module
it would most likely be on the build tab at the bottom
or just reload maven and it might show an error
i try
no error
right click the java package then mark as sources directory
Does anyone know where the server netty pipeline is located at?
@remote swallow now the pakage go but the pom no
Does anyone know what the equivalent to DedicatedServer#getCustomRegistry() is for the mojang remappings? I canโt find any documentation on this method.
Following an example, and this is the code Iโm trying to figure out: ```
ResourceKey<BiomeBase> oldKey = ResourceKey.a(IRegistry.aO, new MinecraftKey("minecraft", "forest"));
IRegistryWritable<BiomeBase> registrywritable = dedicatedserver.getCustomRegistry().b(IRegistry.aO);
BiomeBase forestbiome = registrywritable.a(oldKey);
https://mappings.cephx.dev/1.17/net/minecraft/server/dedicated/DedicatedServer.html
version: 1.17, hash: f88fa60161
MinecraftServer#registryAccess()
Hello, I'm facing a problem. I need to put a custom font on text_display, but I can't find a method for this. help me please
you're being very broad right now
Nvm Iโm stupid
Thanks
Youโll need to use a resource pack for that
I already have a font in the resource pack, but I donโt understand how to put it on text_display
Ugh, I used to know this. Iโll try and do a little research
how do I set the biome type to 16chunks correctly so that the rain turns into snow java player.setPlayerWeather(WeatherType.DOWNFALL); location.getWorld().setBiome((int) location.getX()*16, (int) location.getZ()*16, Biome.SNOWY_TAIGA); ?
Well, I saw on one server a text_display with a custom font, so itโs possible
do a for loop
with loc.getWorld().getChunkAt
or wait
?
In paper you can do display.text( component )
Then thereโs this BaseComponent#setFont("minecraft:uniform");
try like
wait
what 16 chunks
do you want to modify?
just around the x and z you've been given?
I have a ready-made working code for loading chunks in a certain radius around the position is it possible to use it?
answer
what chunks do you want to modify
also, don't multiply them by 16
around the player's position
this my code
BaseComponent baseComponent = new TextComponent(message);
baseComponent.setFont("graffiti_small_one");
TextDisplay text = p.getWorld().spawn(spawnLocation, TextDisplay.class);
text.setRotation(90,0);
text.setText(baseComponent);
but there`s error in text.setText(baseComponent)
Required type:
String
Provided:
BaseComponent
then it'll be 25 chunks
for (int i = -2; i <= 2; i++) {
for (int j = -2; j <= 2; j++) {
loc.getWorld().setBiome((int) x + (i << 4), (int) z + (j << 4), Biome.BADLANDS);
}
}
try this
this modifies 25 chunks tho
since a 16 chunk array doesn't have a middle one
I now need to use the setBiome method on chunk
you don't
just do Chunk#getWorld if really necessary
so i can't set a biome for a chunk?
you can
how?
Also, remember that biomes are not exact. They are saved in 4x4x4 blocks, but the borders will be fuzzy (aka not a straight line)
but I dunno whether this accepts the chunk's x and z
or the actual x and z
}``` I have a method that gets all chunks within a position radius
how do I set a biome for a chunkั
for (int i = -2; i <= 2; i++) {
for (int j = -2; j <= 2; j++) {
loc.getWorld().setBiome((int) (x >> 4) + i, (int) (z >> 4) + j, Biome.BADLANDS);
}
}
Use this in case it requires the chunk's x and z
Biome data is now 3 Dimensional btw.
I told you already
Chunk#getWorld
so is there like y somewhere?
Yes, it has x, y and z coordinates now
so now i have for (Chunk chunk : ChunkLoader.getChunks(player.getLocation(), 8)) { for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { chunk.getWorld().setBiome((chunk.getX() >> 4) + i,(chunk.getZ() >> 4) + j, Biome.SNOWY_TUNDRA); } } }
also, smile, do you know whether setBiome requires the chunk's x and z or the actual world x and z?
wait no
Maybe ```TextComponent component = Component.text("text");
component.font(Key.key("font"));
display.text(component);```
this uses the chunk x and z
also
It requires the x, y and z of a block because you can have multiple biomes in a single chunk
you already have the chunk array you want to use, right?
yes
aah got it
wait
do you then have to set the biome to all of the blocks?
Biomes are now stored in 4x4x4 areas. You dont need to set it for each block.
for (Chunk chunk : ChunkLoader.getChunks(player.getLocation(), 8)) {
chunk.getWorld().setBiome(chunk.getX(), chunk.getZ(), Biome.SNOWY_TUNDRA);
}
``` This shuld work fine
uuuuuuuuuh
this won't work then?
final HashSet<Chunk> addedChunks = new HashSet<>();
final World world = location.getWorld();
final int chunkX = location.getBlockX() >> 4;
final int chunkZ = location.getBlockZ() >> 4;
for (int x = chunkX - radius; x <= chunkX + radius; ++x)
for (int z = chunkZ - radius; z <= chunkZ + radius; ++z)
addedChunks.add(world.getChunkAt(x, z));
return new ArrayList<>(addedChunks);
}``` by the way, this is what my method looks like
should work fine
Why do you copy your set into a list?
You could just use a list to begin with.
?paste
pretty odd way of doing it tho
didn't even notice that, nice
uhhh
I'm pretty sure you gotta set it block by block
It didn't work. Snow is somewhere up in the sky not around the player
This doesnt look optimized
it's the CraftWorld class
https://paste.md-5.net/axuwuyoqik.xml beause dont go the dependency?
oh wait, it does store in 4x4x4
Too old! (Click the link to get the exact time)
so why doesn't it work?
yes
Run BuildTools
will I see snow for the new year in minecraft that's the question
i use NMS for 1 year
Whats the problem?
???
How do I do it right?
@lost matrix so?
Did you run BuildTools
for (Chunk c : chunks) {
int chunkXStart = c.getX() << 4;
int chunkZStart = c.getZ() << 4;
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
c.getWorld().setBiome(chunkXStart + x, chunkZStart + z, Biome.BEACH);
}
this should suffice for now
@chrome beacon
???
@sterile flicker
you can also probably run this async
dont load the pom
What does that even mean
but I don't have the head to think of the 4x4x4 way rn
The pom doesn't work, the dependencies I put in are as if they aren't there
@Override
public void run() {
for (Chunk c : ChunkLoader.getChunks(player.getLocation(), 8)) {
int chunkXStart = c.getX() << 4;
int chunkZStart = c.getZ() << 4;
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
c.getWorld().setBiome(chunkXStart + x, chunkZStart + z, Biome.SNOWY_TUNDRA);
}
}
}.runTaskAsynchronously(Main.plugin);```?
?
What exactly do you mean by that
and how do you know that's the case
dont load the dependency
ForkJoinPool.commonPool().execute(() -> {
for (Chunk c : ChunkLoader.getChunks(player.getLocation(), 8)) {
int chunkXStart = c.getX() << 4;
int chunkZStart = c.getZ() << 4;
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
c.getWorld().setBiome(chunkXStart + x, chunkZStart + z, Biome.SNOWY_TUNDRA);
}
});
this would be better
reload
your maven
show your pom
Try invalidating caches and restarting
if that doesn't help send your maven log
This problem only exists with that module, I have removed and inserted it at least 20 times
not work๐ข ๐ญ
File > Invalidate Caches
Spigot doesn't have good component support. The code that Cyrei provided to you is Paper only
You can either depend on Paper instead of Spigot or use NMS
@grim hound Did it take you long to resolve?
nope
bruh
like 2 days
i 3d
have you actually ran buildtools
but I was using the IntelliJ artifact builder
I've told you 3 times that it has nothing to do with it because it doesn't get the pom
there is snow, but it only appears on the ground, but in fact it is raining
