#help-development
1 messages · Page 820 of 1
And I mean, those methosd do make your life easier when you decide to use anything but simply colouring in your text
e.g. translatable content, clickable text, score based values
Sonar was like, "Yeah, not gonna compile your code with problems in it. Fix 1k lines of code plox"

I kind of like tolerate it now. Has its place.
21 has incubation for them, right?
yeaa
but we haven't bumped yet
I guess you could make a separate MM module
but the days where everything can just be
itemMeta.displayName(MM."<red>Dangerous sword of \{player.displayName()}");
beautiful
Paper is allergic to the words get and set
what is MM.?? and you can't use "{player.displayName()}" in java
new string template syntax incubating in java 21
i am not aggiornated at 21
¯_(ツ)_/¯
itemmeta.paper().setDisplayName
a custom one
STR is implemented in the std library
MM would be an implementation that takes the string template and arguments and converts them into a Component via mini message
so you can easily create a component with placeholders etc
Finally a nice Java update
only if we define those types on the paper repo, create a new repo that forks paper and implement those methods there
yea str templates are pretty damn powerful
given it can return anything
i have successfully added a dependency to my plugin, minimessage. it is the first time i added one, now i just need to fix about 300 instances when i used ChatColor
you can also get a
YamlConfiguration yaml = YAML."""
key: "value"
bla:
bla: 1
"""
or really, whatever the fuck you can dream up being a string
hahahah YAML. exists
I should update a lot
Thanks!!
Java should just allow methods with the same name and args but different return types
smh
might be hard if it is assigned to a var
var is cancelled
Yea, maybe there is some bytecode magic ? Like, given those generics are erased 
but ehh
Doesnt matter. Imagine
Object result = someMethod();
Then it just picks the first one I guess
first one ?
The problem is that it has the same param types
just like
not exactly the same
Ah wait I know
Oh yeah. I like having the order my methods where declared in, have an effect on the runtime execution.
XDD
Yeah idk there isn't really a good solution
both spigot and papers versions aren't ideal
is there a way to get title without InventoryView?
i want to update open inventory every second
Dont use the title of your inventory for identification. Just store your Inventory instance in code.
unreachable code
👏
its exactly what it says
I know how to read too, I don't know how to fix it
you cut off way too much code for anyone to figure it out
you have shown us nothing to comment on, other than to answer your first question
?paste
this is the completed code
resolved
the } is plus
you return before that line
.
?paste
https://paste.md-5.net/urupozulef.java - I'm making a mini utility for reading a css file, everything seems to be going well, but for some reason the last class and its contents are always not readable in the file, what should I do?
For example
class 1
{
}
class2
{
}
class 3
{
}
class 3 unreadable
Doesn't look like the inner class
wdym
this is inner class
Class B {
}
}```
oh i see
if(!allowedBlocks.contains(e.getBlock().getType())) return;
is this a heavy task on the server?
for loop, as far as I know
Shouldn't be.
Depends how many blocks you are querying
It's literally 1ms
Also, big O notation
also depends on what the allowedBlocks is
its O(N)
If it's a hashset it can be pretty fast because yay hashcode
Why?
If it's a hashset or smth, wouldn't it be O(1)?
2 Material
Yes but what type is the collection
List
Ah
private static List<Material> allowedBlocks = Arrays.stream(new Material[]{Material.WHEAT, Material.MELON}).toList();
Yeah a set would be better here objectively performance wise
I think for larger collections yes
I wish I would comepletely comprehend that getNode function XD
It is very nested.
But in this case an array backed list w 2 elements is prob faster
Bro what is that font
Jeez
It’s hurting my eyes
I hear this every day
You should think about it
Guy’s playing too much minecraft icl
that's the font that everyone at Mojang is forced to use
O(N) is worse then O(1), so performance wise yes, but if you take into account memory then yeah I'd agree with you for the most part.
Time complexity says nothing about how fast it takes speed wise or at times space wise (practical wise)
It just defines general scaling behavior of algorithms
For instance why we often end up in a merge sort using other algorithms when the sublists are small enough
how do i disable hover text (player list) in serverlistpingevent?
✅
i tried this but it shows someone "Anonymous player"
when i disable server listing on the client side it works perfectly. empty player list is showed
is this a bug or something?
Hey
Some one now what is this import in 1.20.2?
import net.minecraft.server.v1_16_R3.PacketPlayOutWorldParticles;
import net.minecraft.server.v1_16_R3.ParticleParamBlock;
import net.minecraft.server.v1_16_R3.Particles;```
I didn't find documation
just remove the version
why are you using NMS for particles?
Fr
Particles are client side and only generated by packets from the server. There is no server component
I'm trying to update a plugin. I haven't looked at the code yet.
first look at the code, then do the things
cant seem to get this to turn true using the paper method
Sir, this is spigot
?whereami
This is used for a custom texture pack. This is why it does it on the server side.
Usually, when updating unupdated plugins, you rather rewrite everything instead of trying to get ancient shitcode running
is it possible to replace the scoreboard score numbers using team statuses?
in the new 1.20.3 update
I could also actually, but it saves me a lot of time.
Then if there are public projects on Github, they are to collect and use them, so that they remain on display.
I've found, import net.minecraft.world.level.block.state.IBlockData; thanks anyway
How to summon entity in the center of the block location?
Like.. Block.getLocation is the corner of the block
- 0.5 ig
ty
xz*
why doesnt this work?
Wait
well center of a block is by definition x +.5 y +.5 z +.5
Shouldn't it be not abstract?
or rather minX + (maxX - minX) / 2.0; minY + (maxY - minY) / 2.0; minZ + (maxZ - minZ) / 2.0
a Block location is bottom corner
is it bungee's component builder?
so +0.5 to all for center
yup
Probably, idk, but it's weird for a builder class to be abstract
yeah
Actually, doesn't paper make it abstract or something
Or is it just modern versions
can anyone give me an example how to use this method e.motd().hoverEvent().asHoverEvent();
i dont care. how do i make it in spigot
No, no, are you using paper?
ill change lib to spigot wait
not anymore
now will you help me?
so im trying to protect my server from some scanners. im trying to hide player list it is showing on the server list (motd).
it kinda works but when i check the hover text
it says "anonymous player" if player has server listing turned off (client side)
how do i hide that
I guess it doesn;t expect a player list to be empty
So how do i fix that sir?
what if you add a space to it
well i have been trying to add space in hover text but
you didnt help me
.
how do i do that
getHandle().playerConnection.sendPacket(packet); dosen't work ?
have you tried setMaxPlayers(0) ?
it sets max players sent. as you want none
no, if i do that it will display 0/0
but ill try
it will also hover no players
3000 iq
yeah but 0/0 is kinda strange for server scanners this is what i mean
just trying to display default server settings
the only other way would be to reflect Bukkit and turn on HideOnlinePlayers
THAT METHOD EXISTS?
what specifically to reflect I can;t tell you as I'm not in stash
you mean this?
wdym
is there like .setHideOnlinePlayers?
how do i track that
to be honest, i dont know how
looks like you have to dig deeper return console.hidesOnlinePlayers();
console is DedicatedServer
which is NMS
Would you like me to investigate
find it 🙂
yes please
ezpz
no
yes wtf
You can do hacky shit and set the field with reflections
might need to use unsafe in later versions
as the server is running you'd probably have to reflect into nms and change it's vcalue
Path path = Paths.get(getDataFolder().getParentFile().getAbsolutePath()).getParent().resolve("server.properties");
try {
List<String> lines = Files.readAllLines(path);
lines.add("test:test");
Files.write(path, lines, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
wouldnt something like this work
No because you'd need to restart it
you have to reflect so you change it in memory
messing with server settings file from a plugin woudl be naughty
its not a plugins job. Security and all
wanna know something funny
yeah?
while the fields in the properties thing are final
bruh
the assignment of the properties object is not
wha
you can change this
so i can change it right?
lol so you could just replace the whole instance
yeah how
it looks easy when you say it
create a new serversettings instance
Ah shit you gotta pass an optionset
OR
you don't
aha
you need nms
Yeah you are not going to see any of what we are talking about without NMS
so Spigot not Spigot-api
why cant we use nms
you can, but it's version specific
although, it's only settings so you would probably get away with it
So can i do it or not on multi-version?
yes you could do it
so if i change the setting in the nms in onenable it will always be the value i set it in the code right?
yes
DedicatedServerSettings settings = dedicatedServer.settings;
DedicatedServerProperties currentProperties = getField(settings, "properties", DedicatedServerProperties.class);
Properties javaProperties = (Properties) currentProperties.properties.clone();
javaProperties.setProperty("hide-online-players", true);
OptionSet options = getField(currentProperties, "options", OptionSet.class); // found in DedicatedServerProperties' parent class
DedicatedServerProperties hackedProperties = new DedicatedServerProperties(javaProperties, options);
setField(settings, "properties", hackedProperties);
hacky :)
and easy
You can pass null as the option set
But we want to maintain functionality
hackedproperties xd
@eternal night I like it personally. However, one gripe here
public ItemStack createItemStack(final int amount, @Nullable final Consumer<M> metaConfigurator) {
final ItemStack itemStack = new ItemStack(this.asMaterial(), amount);
... and so on
}
Why are you creating a bukkit ItemStack vs a CraftBukkit ItemStack? Is there any specific reason imho should leverage the CraftItemStack where possible.
Otherwise I like the methods and think this method definitely leverages the Generics where they can be and kinda leaves them out to die otherwise. Very nice
wheres the getField method?
what?
I said it
Once you get the class you want you call getField on that
if(this.players == null || this.players.length == 0)
return;
final Random r = ThreadLocalRandom.current();
for(LeafSpot s : this.spots) {
if(r.nextInt(100) > plantChance)
continue;
final PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(
new ParticleParamBlock(Particles.FALLING_DUST, s.getData()), false, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 1, 0);
for(int i = 0; i < this.players.length; i++)
if(this.players[i] != null)
if(this.players[i].getWorld().getName().contentEquals(this.worldName))
this.players[i].getHandle().b.a(packet); <- Here
else
this.players[i] = null;
}
}```
I have an error on the b.a(packet). For what?
so why are you sending particles with packets
lol
sure, but using NMS makes them look cooler
We already told him to use the API but he seems to be against it
well its cuz the API sucks guy which is why I just fucking go raw on the server I don't even use spigot anymore
I try to add realism to the trees.
yeah so that doesn't change the fact you can send particles* with API
The particles are not from Minecraft, they are added via a texture package.
doesn;t matter
And I'm trying to make this compatible with a custom block engine.
Still doesn't matter
still doesn;t matter
why isnt this working
But why not use NMS even if the API already offers it?
lol
@west prairie why are you using the API at all just patch the server if you don't want to use it so much
I'm trying to learn lol
you'll learn a shit ton by patching the server
NMS changes so you have to update your code for whichever version you are running on. API is teh same on all versions.
trust me its very fuin
Okay, but if let's imagine I want to continue with my "stupidity", what is the error in my loop?
ha?
And like a few people can help with a specific nms problem, but sometimes they or we are too far away ot help with nms
with this one API call you can do everything you are doing, but not need NMS https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#spawnParticle(org.bukkit.Particle,double,double,double,int,double,double,double,double,T,boolean)
hello
shhh he's trying to do particles with NMS
oh shit
I did that
I'll go back to writing this reflection util thing
woop woop https://puu.sh/JWg1U/65b34cd07d.png
can you kindly continue helping please
reflection yucky methinks
:)
- what is reflections
- how do i make all those missing variables
- how do i import joptsimple library
💀
how to detect when a player hitten by an egg was protected by a shield? since the damage of the egg is 0 I can't apply the damage modifier
I want to exclude "the direction check" way
clean
ReflectedClass<MyObject> reflectedClass = Reflect.aClass(MyObject.class);
String toString = reflectedClass.invoke(myObject, "toString");
also works
It parses parents and stuff
i think my most fun reflection project i did was changing blast resistance of diff blocks
what do you think
Reminds me of apache commons reflect
But how do I send the procedure to spawn the particles if the player connects instead of sending him a packet?
maybe it is?
int number = Reflect.aField(MyObject.class, "myNumber").getValue(myObject);
what
Cool now i dont understand what can i use that for
What if the method doesn’t exist?
think it just returns null
it works on private fields
Reflect.aField(MyObject.class, "value").setValue(myObject, 123);
if(this.players[i] != null)
if(this.players[i].getWorld().getName().contentEquals(this.worldName))
this.players[i].getHandle().
else
this.players[i] = null;
}
```
I mean it doesn't solve my problem of how to spawn the particle when the player logs in.
I understood not to use a package. So I define another procedure, and how I connect it to my loop
is there any tutorials for reflections explaining what that is?
getWorld().spawnParticle(...
https://gist.github.com/IllusionTheDev/e7b00a7dc8f4007e56f426bb0c2cf22a here it is if anyone cares
Okay, I think I'm starting to understand. It's true that it's suddenly much simpler.
much
But, why he have Bool in PacketPlayOutWorldParticles?
I had set false without knowing much to test. I don't see it in the docs of the API
there are various spawnParticle methods. Depending on what you need
look at teh API I linked and see which bool it is and its effect
force - whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
Ok, thanks
I'm trying to run a for loop in an on disable but it only detects the first person in a list, how can I do so it detects everyone?
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
public void onDisable() {
for (int i = 0 ; i < names.size(); i++) {
killArmorStand(armorStands.get(names.get(i)));
barmorStands.remove(names.get(i));
names.remove(names.get(i));
}
}
nothing much to explain
if the list contains 2 names it only gets the first one
because you remove the name at the first iteration you have one less on the next
Lists are iterable, you don’t need to count i
just clear names after teh for loop is finished
so delete names.remove(names.get(i));
But then I used IblockData for the position, what should I use instead for the position?
Yes but I was doing a s.getData() to get the positions, can I use it in the API function?
in your code you have s.getX() etc
those would be your x,y,z for the particle
just plug in the data to teh API call the same as you created the packet before
I directly put it in the loop. But there's something I don't understand.
(The Old) new ParticleParamBlock(Particles.FALLING_DUST, s.getData()), false, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 1, 0);
for(int i = 0; i < this.players.length; i++)
if(this.players[i] != null)
this.players[i].getWorld().spawnParticle(Particles.FALLING_DUST,s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false);```
looks good
Do I even want to know why we are using packets
youy only need to send the packet once
you only need to spawn teh particle once, not per player
as it was a packet before you sent it to each player
now you are using API it decides who to send it to
so no more for loop for player count
Oh yes, okay, that changes a lot. just need the spawn function then
if(this.players == null || this.players.length == 0)
return;
final Random r = ThreadLocalRandom.current();
for(LeafSpot s : this.spots) {
if(r.nextInt(100) > plantChance)
continue;
this.players.getWorld().spawnParticle(Particles.FALLING_DUST,s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false);
But now there is an error on the getWorld()
omg
reflections is so cool thing
yep, if you can;t get it from your LeafSpot (which would be cleanest) just do this.players[0].getWorld()
it may be players.get[0].getWorld()
not sure what your players field is
How could I add it to my LeafSpot?
?paste your LeafSpot class
If it's better I'd like to change that ahah
yeah but which class is the propery im looking for stored in?
MyObject.class
well myobject class doesnt exist?
whats the maven name for 1.20.2?
its saying 'cant find artifact org.spigotmc:spigot-api:jar:javadoc:1.20.2-R0.1-SNAPSHOT'
1.20.2-R0.1-SNAPSHOT
refresh your maven
make sure you have the repositor too
replace it with whatever class you are using?
i ran --generate-docs
i thought about a way to switch item state and had an idea that clicking an item with shift would do that, is it possible?
In an inventory? yeah you can detect that
yeah
i only have 2 class and none of them is that?
what
they were given an example on how reflection works and can't apply it
package net.minecraft.server.dedicated;
import java.nio.file.Path;
import java.util.function.UnaryOperator;
public class DedicatedServerSettings {
private final Path source;
private DedicatedServerProperties properties;
public DedicatedServerSettings(Path path) {
this.source = path;
this.properties = DedicatedServerProperties.fromFile(path);
}
public DedicatedServerProperties getProperties() {
return this.properties;
}
public void forceSave() {
this.properties.store(this.source);
}
public DedicatedServerSettings update(UnaryOperator<DedicatedServerProperties> unaryoperator) {
(this.properties = (DedicatedServerProperties) unaryoperator.apply(this.properties)).store(this.source);
return this;
}
}```
ok ill try
What are we reflecting
look under s. and see what options you have. possibly a level
so it was DedicatedServerSettings.class?
yes, you want the properties field
I didn't understand 😦
why is reflect not resolving. i thought it came with java
like you did s.getX() see if there is an s.getLevel() or s.level()
it's literally the gist I sent you
bleh it is in the .m2 folder, and the -U thing doesnt work
how do i force intelliJ to reread .m2
it may be in your IBlockData
But why i need s.getLevel?
are u talking to me
invalidate caches
wheres that again?
idk its like File > Invalidate Caches
is reflect supported in java 8?
Yes
Reflect is that class I made because the reflection API is a pain
what is gist
nope still not here

so have you sent the reflect class?
Yes
what is gist
scroll up
Check the link
Read stuff
can i tell this thing somehow 'the file youre looking at is here'?
gist?
how do i use gist?
It's literally like a pastebin but for multiple files
Pretty much
but how can i detect that? i thought about playerToggleSneakEvent but you cant sneak the inventory is opened
InventoryClickEvent
You're going to take me for an idiot but I don't see how to implement it
it shoudl be available in there somewhere
it may be getLevel or just level
or something close
ty
But would it be to replace getWorld()?
else you'd be spwning yoru particles in every world
level is the NMS version
you'd get teh Bukkit world from it
why isnt this working again?
this.players.getData().getLevel().spawnParticle(Particles.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false); ?
Yes
also no, you shoudl be doing this on s not players
Am i making some progress?
String toString = reflectedClass.invoke(myObject, "toString");
DedicatedServerSettings settings = dedicatedServer.settings;
DedicatedServerProperties currentProperties = getField(settings, "properties", DedicatedServerProperties.class);
Properties javaProperties = (Properties) currentProperties.properties.clone();
javaProperties.setProperty("hide-online-players", true);
OptionSet options = getField(currentProperties, "options", OptionSet.class); // found in DedicatedServerProperties' parent class
DedicatedServerProperties hackedProperties = new DedicatedServerProperties(javaProperties, options);
setField(settings, "properties", hackedProperties);```
imma restart and see if that fixes it
Same error with s.getLevel()
s.getData().getL...
Same
error
s.getData().getLevel().spawnParticle(Particles.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false);
what is available after getData(). ?
???
is, equal, hashcode, block, tick.. lot of things x)
use block and see if you find level
No level
look for one, its in there somewhere
that toString is just me messing around with the reflectedclass thing
ffs maven
i invalidated caches, restarted the system, and verified that the files is in .m2, nothing is working
ik
is javadock just fucked in general
how did you import joptsimple because i cant somehow
Hmm, I'm starting to doubt x)
there has to be a world element somewhere in the original code, else you would be spawning the particle in teh same place in any world the player was in
it has to be in the IBlockData somewwhere
ReflectedClass<DedicatedServerSetting> settingsClass = Reflect.aClass(DedicatedServerSettings.class);
ReflectedClass<DedicatedServerProperties> propertiesClass = Reflect.aClass(DedicatedServerProperties.class);
DedicatedServerSettings settings = dedicatedServer.settings;
DedicatedServerProperties currentProperties = settingsClass.getField(settings, "properties");
Properties javaProperties = currentProperties.properties.clone();
OptionSet options = propertiesClass.getField(currentProperties, "options");
DedicatedServerProperties hackedProperties = new DedicatedServerProperties(javaProperties, options);
settingsClass.setField(settings, "properties", hackedProperties);
type beat
@river oracle this is the correct maven right? or am i going insane?
https://paste.md-5.net/bovozadite.xml
the first part works, it only fails on the jd
@sullen marlin idk if you remember my issue where RED_DYE wasn't shown in API version 1.13. Well I get an exception on the server too, which uses 1.13, that XXX_DYE isn't a valid enumeration field. Is that normal behaviour, am I missing something?
How did you import joptsimple
After using IBlockData it's MNS so maybe it's not the best?
its not, you shoudl move away from it too
how are you sourcing these Leaf things?
LeafSpot
where do they come from?
okay i'm fucking idiot
world = chunk.getWorld();
worldName = world.getName();
x = chunk.getX();
z = chunk.getZ();
rx = x * 16;
rz = z * 16;
setPlayers(chunk.getPlayers());
spots = new ArrayList<LeafSpot>();
}
ok, so the spots belong to a LeafChunk
Actually no, I can't use chuck.getWorld()?
@echo basalt
how do i import joptsimple
it just doesnt work
can you show me your gradle file
no
I gotta go soon
if(this.players == null || this.players.length == 0)
return;
final Random r = ThreadLocalRandom.current();
for(LeafSpot s : this.spots) {
if(r.nextInt(100) > plantChance)
continue;
chunk.getWorld().spawnParticle(Particles.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false);```
So i can do that
But i need to define the chunk for each function call
Yes no I don't think it's a good idea
I don't even know how to define each chunk for function calls
is this an existing plugin?
Yes basic, I retrieved the source and I want to use the base
um, what is the class this is in?
But he is old
as it refers to this.spots, it looks like it's already in a chunk class
the Spots is on the same class of void plant
spots
so you should be able to this.getWorld()
Nop, error
this.world
then all you need is this.world.spawnParticle(...
But then I no longer need to target this.player?
no
Okay perfect so
But i have one error on the particle now
this.world.spawnParticle(Particles.FALLING_DUST, s.getX() + r.nextFloat(), s.getY(), s.getZ() + r.nextFloat(), 0, 0, 0, 0, 1,false);
yes
What the different with Particle and Particles ?
Two different classes
Particles is an Enum
The Particles class is nms I assume
you shoudl be using Particle not Particles
be sure to clean up your imports so you get rid of the unused ones
but i didn't try in game for the moment lol
Can anyone PLEASE help me importing joptsimple in gradle
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
^
^
the import shoudl be net.sf.jopt...
oh..
I have last question @eternal oxide
return CraftMagicNumbers.getBlock(material).getBlockData();
}```
Possible to do this without NMS?
I can;t help you on Gradle. If it was Maven you didn;t update/refresh
Is there an asynchronous event that is called after a player has been authenticated?
yes
How x)
so who can
don;t bother with IBlockData and just store teh material
unless you need something from IBlockData
does the plugin use IBlockData anywhere?
just two times
to do what?
just that
types.clear();
types.put(Material.OAK_LEAVES, getIBlockData(Material.OAK_LEAVES));
types.put(Material.BIRCH_LEAVES, getIBlockData(Material.BIRCH_LEAVES));
types.put(Material.SPRUCE_LEAVES, getIBlockData(Material.SPRUCE_LEAVES));
types.put(Material.JUNGLE_LEAVES, getIBlockData(Material.JUNGLE_LEAVES));
types.put(Material.ACACIA_LEAVES, getIBlockData(Material.ACACIA_LEAVES));
types.put(Material.DARK_OAK_LEAVES, getIBlockData(Material.DARK_OAK_LEAVES));
val section = Leaves.getInstance().getConfiguration().getSource().getConfigurationSection("colors");
if(section != null) {
for(String key : section.getKeys(false)) {
Material leaf = Material.valueOf(key);
Material color = section.isString(key) ? Material.valueOf(section.getString(key)) : null;
if(leaf == null || !types.containsKey(leaf)) {
Leaves.getInstance().getLogger().warning("Leaf type \"" + key + "\" does not exist");
continue;
}
if(color == null) {
Leaves.getInstance().getLogger().warning("Material color for leaf type " + leaf.name() + " does not exist");
continue;
}
types.replace(leaf, getIBlockData(color));
}
}
}
public IBlockData data(Material material) {
for(Map.Entry<Material, IBlockData> e : types.entrySet())
if(e.getKey().equals(material))
return e.getValue();
return null;
}
public IBlock create(Material material) {
return CraftMagicNumbers.getBlock(material).getBlockData();
}
}```
Afterwards there is only an error on the getBlockData(), maybe it would be easier to fix
I don;t see why it's using IBlockData at all
all the plugin does is spawn particles under the leaves?
in that case there is no need for IBlockData at all
just store teh color mapped to the leaf
so Material, Material by the looks
Hmm, I don't see how
instead of Material, IBlockData
what is ellooks?
what is in yoru colors section of your config?
# by default all colors are set to the leaf block they originated from
# example usage:
# BIRCH_LEAVES: YELLOW_WOOL````
I don;t see anywhere you set teh color of the Particle
val section = Leaves.getInstance().getConfiguration().getSource().getConfigurationSection("colors"); ?
which means you need to create a DustOption to set to the T value in spawnParticle
why are you usin getters in kotlin
not kotlin
dafuq val?
Lombok
yeah tell me about it
has val
Oh
Yea LOOL
It could 100% yield a CB stack
It's possible to try just without the configuration?
start by adjusting the plugin and maybe then use the configuration haha
yes
So I change all IblockData to Material?
for now, yes
for(Map.Entry<Material, IBlockData> e : types.entrySet())
if(e.getKey().equals(material))
return e.getValue(); <--- Here
return null;```
Okay so, for the return, what can we put since we no longer use IblockData
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
i already did that earlier but i can repeat myself if that helps
i ran buildtools for 1.20.2 and am trying to get the .m2 stuff to get recognized by maven
it works for the spigot-api, but not the javadoc
If I am using BungeeCord, could I assume on my Spigot instance that every call to AsyncPlayerPreLoginEvent is about a user that is definetely authenticated?
i have invalidated the caches and restarted my system
Did you build the javadoc

because it doesn't exist
did buildtools mess up again?
no i ran --generate-docs
and it said build success
dafuq
wondering if it was possible to create a plugin that turns the mc moon red once a real life day. we can assume all players use a specific texture pack that includes the red moon texture. i mean apparently its not possible to change textures but what if we somehow could create two alternating sky textures
You can do that
Assuming you're on a modern version where core shaders are supported
thats great, ty
oh olivio is there a way to only build the jd?
yep looks good
If you already built it once you can install jar the javadoc jar
how? do i have to open the generated files and install it from there?
also this is weird, i def ran this in this directory before
but its saying 'no previous run found, generating jd'
alright now its just messing with me
logs say 'javadoc generated successfully' but the .m2 folder aint got that file
ah yes i see
it copies the spigot file to m2 but not the javadoc
wtf
does anyone use gradle here
probably
@eternal oxide Can i create topic for helping with IBlockData ?
give me a few, coking dinner
Okay
?nms
how was it working in gradle then?
cool stuff
@worldly ingot No one did a PR for this?
For?
@eternal oxide Ping me when you finish eating, enjoy your meal
forgot the link 🙂
Not that I'm aware of
What perfect for me ?
It was a method to obtain a blocks color from the BlockData
but it never got written/added
howd u define block color? do you mean the values it has on a map?
public static Color getColor(Material material) {
net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material);
net.minecraft.world.level.material.MaterialColor mc = block.defaultMaterialColor();
return new Color(mc.col);
}```
huh
Humm it's for my getIBlockData?
its the internal map color for a block
yes, but you'll no longer use IBlockData
I can use and Bungee import on a Spigot plugin?
yes
i have a ExplosionPrimeEvent and some Blocks coordinates
With the import he didn't find Color
obviously this blocks will not explode
oh fuck
and i want to make those specific blocks not explodable
i need to import bungeecord so?
but the other ones yeah
yes it's ChatColor not Color we need
and i cant cancel event cause some blocks are not this special blocks
how can i explode some blocks and another ones not?
oh nvm
think i solved it
There are several errors
net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material);
net.minecraft.world.level.material."MaterialColor" mc = block."defaultMaterialColor"(); "Error"
return new ChatColor(mc."col"); "Error"
}````
correct method is java public static Color getColor(Material material) { net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material); net.minecraft.world.level.material.MaterialColor mc = block.defaultMaterialColor(); return Color.fromRGB(mc.col); }
or should be
Color is Bukkit.Color
1.20.2
I'm on 1.19.4 so shoudl be close enough
you shoudl have no error in that with the correct imports
oh I bet you are not setup properly for nms
import java.util.Map;
import net.minecraft.world.item.Item;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftLegacy;
import org.bukkit.craftbukkit.v1_20_R2.util.CraftMagicNumbers;
import net.md_5.bungee.api.ChatColor;```
gj
I'm missing an import for minecraft.server I guess
?nms follow this to setup correctly to use NMS
No it's correct setup
I already did all the buildtools
Afterwards I didn't do it in this project specifically
I've done it in other projects
But my .m2 is all Mapped
I don't use Meaven on this project either, I imported it manually with the .jar
On several yes
that make it difficult
I have the mapped
the spigot snapshot
the minecraft_server
I should go through Meaven do you think?
it would be better
Afterwards it will not change anything in the code normally
There will always be this error
All my imports are correct, if you have an import that I didn't send it to me but I don't think the problem comes from that
show the full method you have
there shoudl be no error on your getColor method
you will have errors elsewhere due to your Map type
He cannot resolve MaterialColor
its possibly changed since 1.19 then
do . after material and see what choices. It's likely changed name
🤔 I can look into this
seems like not a very hard addition
that would be cool
try using this one
and for defaultMaterialColor i use defaultMapColor?
probably
just realized this might have to go in BukkitUnsafe atm theirs no realistic way to do this with material enum atm
is Color can put into IBlockData
So we should use IBlockData?
Because with the IBlockData there was only one error
Yeah, but with Color it doesn't seem to work
I'll have to run BT to test on 1.20
that would be super nice, then I can lend you my computer remotely if you wish
running it now
okay big thanks
This works for 1.20.2java public static Color getColor(Material material) { net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material); MapColor mc = block.defaultMapColor(); return Color.fromRGB(mc.col); }
@eternal oxide 👍 made a PR wasn't that bad surprisingly
nice
just a one liner :P
😵
i have a question
i have an explosion like this
i got a List of blocks that can be broken, how can i modify the explosion to make the blocks of the list not to dissapear without modifying the explosion form itself?
today is a great day. Did you know? the 8th of december is an important day? Its the day of the Inventory PR (just like every other day), but that is what makes it so special
every day of inventory PR is a great day
if you don't want the blocks to disappear don't remove them from the list?
did you know Inventory PR now fully supported multiple viewers in many different inventories without glitches or desync issues?

check out EntityExplodeEvent iirc the returned list is mutable, not sure tho
yes and the best part is it fully works with minimal breaking changes. Now isn't that great. We are truly in the golden age of spigot PRs
No
i refer like
List<Blocks> block;
then iterate in that list, and in the affected blocks
if the affected block is in the list, dont make it dissapear in game
what u mean by iirc?
all affected blocks will be in the list
if i remember correctly
that's how the event works
I went to get something to eat, I'll test it as soon as I arrive
No, its a custom list
like made by myself
then use EntityExplodeEvent
what I said should work then
yes
thanks
yes its mutable
thankss
ig my codes wrong
cause if all the coords and the world is the same, block should remain equal
if not
air
and cancel the event, right?
just remove protected blocks from the BlockList
Location loc = new Location(Bukkit.getWorld(UUID.fromString(info.getWorldUUID())), info.getX(), info.getY(), info.getZ());
event.blockList().remove(loc.getBlock());
?
dude remove blocks from your list
event.blockList().removeIf(b -> list.contains(b.getLocation()))
idk if it would work just wrote it through discord
it worked
BlockIgniteEvent is when blocks fired literally no?
like
with flint and steel?
why not just check the javadocs?
instead of asking everything here and waiting for a response
trust me, your life would be a lot easier
?jd-s
declaration: package: org.bukkit.event.block, class: BlockIgniteEvent
idk sometimes i cant find the info i need
yk
can't execute this from console '/execute @p[r=5] ~ ~ ~ playsound random.orb @p'
error: The entity UUID provided is in an invalid format
the console has no position in the world so @p ofc won't work
there are no near players to nowhere
how do i tell them the player?
can you please type full im dumb
/execute @e[r=5] ~ ~ ~ playsound random.orb type= param ?
not workin btw
what is ~ ~ ~ supposed to be when executed from the console
console isn't a world entity, it does not know about ~
What version are you on
i dont know much about console commands but /execute @e[type=player,r=5] could work
1.8.8
._.
:(
what ? 😂
1.8.8 is legacy!
ok...
?1.8.8
?1.8
execute @e[type=player,r=5] ~ ~ ~ playsound random.orb type= param ?
Too old! (Click the link to get the exact time)
i dont know ive never used execute, try it
try
/execute @a[r=5] ~ ~ ~ /playsound random.orb master @a[r=5]
but i dont know how ~ works via console
nop i even added coordinates
can i change a block blastResistance()?
not really
hmm
can i tell you what i want to do and maybe get an idea?
I have server in offline mode. My proxy retrieves mojang uuid from every player that has premium account simulteniously allowing non-premium join the game. But in that case i have 2 diffrent uuid's of premium player on proxy and server. Any option to change this?
no, other than using an auth plugin that allows premium accounts
ive no idea how offline uuids work
they are based on name
thats interesting, how do these auth plugins check if player is a premium one?
so to support both online and offline you need a bungee auth plugin to replace teh ids
sounds terrible
it is
and like youre in brazil
I have coded my own proxy but the case is that while sending from Proxy to Server "ClientLoginRequestPacket" i pass the right UUID but the server still create it's own based on the player name not the uuid i pass
you need to forward your id to the server
And then then set it into gameprofile using reflection?
no, so long as your proxy correctly replaces teh ID it should be the same on proxy and server
Wdym correctly?
MapColor dosen't work :/
How i can do that correctly? I just get the UUID from encryption if exist, if not i create one based on the nickname and send it to the server with LoginRequest
doesn't work?
Cannot resolve symbole "MapColor"
you will only have two id's if you fail to auth one time asd get logged in as offline
net.minecraft.world.level.material.MapColor
Do you mean UUID by id?
It's good
Thanks @eternal oxide
I go try ingame x)
@eternal oxide ```public class LeafTypes {
private final HashMap<Material, IBlockData> types;
{
types = new HashMap<Material, IBlockData>();
}
public void reload() {
types.clear();
types.put(Material.OAK_LEAVES, getColor(Material.OAK_LEAVES));
types.put(Material.BIRCH_LEAVES, getColor(Material.BIRCH_LEAVES));
types.put(Material.SPRUCE_LEAVES, getColor(Material.SPRUCE_LEAVES));
types.put(Material.JUNGLE_LEAVES, getColor(Material.JUNGLE_LEAVES));
types.put(Material.ACACIA_LEAVES, getColor(Material.ACACIA_LEAVES));
types.put(Material.DARK_OAK_LEAVES, getColor(Material.DARK_OAK_LEAVES));```
Last problem, how to make this compatible with getColor?
hm, is there a way to scan your source code for possibly problematic areas? Like loops that will run unreasonably often?
run a profiler
Use XMaterial bro
not useful in this instance
i know stuff like that exists, forgot the exact name, i was wondering specifically about the code
Dosen't work
Line red
change the definition of it above too
Okay no sorry
I m fuking idiot
Oh but he create an another error
for(Map.Entry<Material, Color> e : types.entrySet())
if(e.getKey().equals(material))
return e.getValue();
return null;``` With this
change return type from IBlockData to Color
XMaterial is always good for future compatibility
Not in this instance
this is to take different material Map colors to apply to particles
Is there some event called when player equip arrmor or its only interact event (on righclick with item in main hand)/inventory click event?
its also an existing plugin he's updating.
Yeah but literally put it in this way doesnt affect nothing and prevents compatibility problems between versions...
ImmutableMap.<XMaterial, Color>builder()
.put(XMaterial.OAK_LEAVES, Color.RED)
.build();
yes, but at this point it's no use adding complexity
what lengths can inventory have?
54, 9 what next
multiples of 9
18 for example can be?
(1-6)*9
@eternal oxide https://paste.md-5.net/cijatexojo.xml I have this error on Minecraft
Leaves.java:29
Does anyone know what IBlockAccess is in NMS/ what it does
public void onEnable() {
configuration = new Configuration("config.yml", this, true); <- 29 This
configuration.load();
map = new LeafMap();
getCommand("leavesreload").setExecutor(new CommandExecutor());
}```
which is line 29?
This sorry
does your jar have a config.yml in it?