#help-development
1 messages · Page 1120 of 1
wsl?
windows subsystem for linux 🤓
?ecosia
Ecosia your question before asking it:
https://www.ecosia.org/
uh-huh
install virtual box or sum
Dual boot
bet you like your own medicine
i did google it. and then i stopped thinking lmao
idek why
But with secure boot and windows it became more difficult
but generally tAsTe yoUr OwN MedIcIne won't get u far in life. just saying
damn lol
hm
oh it did? i never really tried it since i got a couple of laptops just lying around with linux on it
and i got windows on my main pc
i mean there's still VirtualBox. Not the best way of doing it but it is one ig
The only "good" solution I found was to use a shim to launch Linux with secure boot without signing the whole Linux system
hmmm i feel like just having a second mid range machine is the least stressful lmao
Which force me to use the boot selector of my bios
oh and that displays missing stuff? that's so cool!
well you should be able to see what you need
but I just use it for clearing all criteria
so idk how advanced it is
but p sure you can see what progress someone has
alright i'll fiddle around with it (the criteria)
That sounds wrong out of context
I was just wondering what it said before you edited it
XD
remember kids, dont fiddle with your criteria
monkaW
any idea on what this does? im trying to save anything that is not in the current config but is in the default config
declaration: package: org.bukkit.configuration.file, class: FileConfigurationOptions
Defaults are magical values that get used if the value isn’t set in the file
i want to serialize items to a blob column in an sqlite database but persistantdatacontainers dont implement configurationserializable or serializable. is there any other option? im really not sure how to approach this
They are already stored in the item tags
BukkitObjectOutputStream
oh seriously?
Persistent data container use nbt tags to store data
Under the "bukkit domain" to avoid conflicts
You can see it if you use a tool to see nbt files
yeah or when you serialize an item to yaml file it will also show the added pdc stuff
dang interesting
i guess i was just trying to navigate the bukkit classes to find wherei t does that and i got confused haha
whats the difference between the serializable interface and the configruationserializable?
if i wanna get an advancement using Bukkit#getAdvancement, I have to use this, right?
Bukkit.getAdvancement(new NamespacedKey(NamespacedKey.MINECRAFT, <advancement key here>));
bc i get the @Internal warning (and it annoys me)
NamespacedKey.minecraft btw
guys, how usually do you press ctrl + s?
yeah?
i press :w
with... my.. fingers? with IJ you don't have to tbh
what is :w
right
:w = write
:wqa
wait are you telling me intellij instantly saves
So often that i accidentally get a pop-up asking me if i really want to save this website to disk when browsing the internet.
pretty much
the moment you tab out
another one: ggVG"+y
happens
I type :w
i FEEL that
what about that?
tbh yes, realtable af
ah yes ctrl+s in discord opens the stickers tab
what is “+
oh wait
register +, system clipboard
i have yet to learn registers tbh
theres probably a shorter way
oh i get it. lower case minecraft generates a new namespaced key
thanks i was blind
mb
When is an AdvancementDisplay set? I don't quite get that. When the UI is open?
or switch file
probably
hmmm is there another way to get the advancement name then for prettier display?
like when the player opens the menu maybe
except for an ugly ass switch-case 💀
translatable component
whaa?
put the key of the advancement in a translatable component, it will show the name to the client
(in any language)
oh yeah, that might be a thing
works for anything that mojang has translations for
you just need the key in the right format
well yeah, the ns key for the advancement in this case
thanks spigot resource
good hyperlink
so sum like this nether/distract_piglin
asking this much bc in the resource they're using the classic property/yaml . seperator
https://github.com/Steaf23/BingoReloaded/blob/main/PlayerDisplay%2Fsrc%2Fmain%2Fjava%2Fio%2Fgithub%2Fsteaf23%2Fplayerdisplay%2Futil%2FComponentUtils.java This is what I use, its for paper adventure, but its like a 1 to 1 translation (no pun intended) for bungee chat components
Minecraft Bingo 1.18+ Plug-In. Contribute to Steaf23/BingoReloaded development by creating an account on GitHub.
oh i'll take a look
is the Component the BaseComponent in spigot? :thonk:
i want nitro ffs
hmm not really, idk can't make this spigotty, imma skim through the docs a bit
what would happen if I would try to set soemones health to a negative number
my guess would be death
Component is from adventure, but it would be TranslatableComponent in your case
and then it being set to 0
bc i feel like this happens naturally very often.
what if you hit someone with a sword when they're on 0.5 hp
oh also
?tas
OHHHH
if you switch to an older branch of this code you might be able to find the spigot version of it
i only recently converted it to adventure
can you use an ObjectOutputStream or do you need to use a BukkitObjectOutputStream for bukkit objects? also, if i made a class that contained bukkit objects (like locations and itemstacks), how would i serialize it using an output stream - which method?
sorry really overthinking this
back in the good days people wrote out the domain themselves
"back in the good days" how old r u again?
You probably need to go for BukkitObjectOutputStream as bukkit classes does not implement Serializable (iirc, might be wrong)
So you might want to implement BukkitObjectOutputStream in your data class
what about StatisticsKeyConverter what is that? also paper specific?
no thats my beautiful class
why a diff register
you can just :%y
to copy to system clip
because someone messed up with naming them normally
assuming it's configured properly
so a switch is required to get all statistics working
damn wtf
if you don't mind, i might just yoink that
sure
ty :)
i dont think mojang will add any new statistics soon anyways
true
skill issue
oh okay. wait implement bukkitobjectoutputstream or configurationserializable
you use system clipboard by default
why shade spark
i dont
why
to mixin to it
since BukkitObjectOutputStream is a class you cant "implement" it, but only implement it into your code what you "implement" is implements ConfigurationSerializable if i had to guess
disclaimer: did not read context
thats half true
implementing configurationserializable means you need to serialize it to some map of string string and object
idk where the bukkitoutputstream comes in
wait
i'm just gonna shade the spark jar
ezpz
wait can i just modImplementation(fileTree("libs/spark.jar"))
BukkitObjectOutputStream is for serializing Bukkit objects to byte arrays
ConfigurationSerializable
Mb
yesss i can
but what if i have a custom object ive made for storing a combination of bukkit data and primitives?
where is that used?
last time I checked I cant create a config with byte arrays
hehehehehehe
Is there also a way to have the criteria names displayed pretty or do i have to do that manually?
wtf
no clue
i dont think so
no kotlin?
mixins
hmm?
but I guess it depends on the criteria itself
Database
I mean I suppose since they're never displayed ingame, there won't be translations
.dat file 🗿
just throw everything in a byte array and call it a day
oh so its something people use to save their data to databse? that makes sense
right
then cry cuz the reader is broken when it finds an eof in the middle of your file
@young knoll ?
yeah, ig something like biomes might be able to be translated?
thats what im planning to do for most of my data stuff anyways xD
well, i'll just display the keys, that's fine
Then you’d have to handle serializing it yourself
alrighty
biomes dont have a translation I think
but items and stuff do
this is gonna be really fun
fabric is cursed
id just modify the minecraft source myself at this point 🗿
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
limpeex using bot commands again. Unforgivable.
Why dont you do same to other when they do that? I checked it and last message sent 10 mins ago so i thought there is no convo going here and wanted to use the command?
How can I stop the sound of a player's fall?
stopSound doesn't really work
Best it does is cutting into the middle of the sound playing
something about entity landing
Wait, so the fact that the player fell is sent in a Sound packet?
But I block those I think, and the sound's still there
world events usually spawn both particles and sounds or whatever
My current solution is spoofing a ghost cobweb
you use the command like every day xD
However I want to remove it asai
ghobweb
I dont spam
i never said you did?
And when I remove it after he lands (since the land is caused by a teleport) the client usually lags and still displays the sound
So I'd need to delay it by some fixed amount, like of 1 second, which is never a good idea
Maybe I should like wait for like 5 move packets from the player?
After teleport confirm
Also, does the server use TeleportConfirm for anything?
Like the server teleports a player and the player sends a TeleportConfirm
But what for? Does the server use it?
Pretty sure a Respawn or a Spawn packet is used for that
tbf why not just save the URLs as favourites in a folder in ur browser? is handier anyway
dont need to go on discord then
yeah there are definitely different ways of the packet used for different cases. credits, death and world switch i think?
See also: data kept https://wiki.vg/Protocol#Respawn
i suppose the client sends the location back with the teleport confirm so that the server knows that it got executed properly.
My guess would be if the data doesn't match, it will undo the TP or something
granted, i've never had that happen, but my guess would be a... data consistency feature, if you will?
then again, this is completly out of the blue. just guessing
Mmm makes sense
yeah thats the most likely
but probably just either not implemented/needed anymore or never properly used in the first place
Can the ping on layer 4 and layer 7 of the same connection vary a lot?
Does adding a chunk ticket using World#addPluginChunkTicket only make the chunk not unload or does it also automatically load the chunk?
Adds a plugin ticket for the specified chunk, loading the chunk if it is not already loaded.
You can usually just read the documentation.
BRUH
i read the documentation to find out about this in the first place, how tf did i miss that???
¯_(ツ)_/¯
np
it wouldn't be accurate to compare in that way
layer 7, the application layer is where the packet is processed. Yes there could be delay from when layer 4 gets the packet, and layer 7 actually processes the data in said packet
hi iam trying to use mongodb :
mongodb.net but when i connect it tells me No such host is known
what are you inputting to connect and do you have the server running?
can I use mods at the same time as plugins?
Not on Spigot but there are forks which handle mods and plugins
hi, is this name still valid for black stained pane in newer versions : BLACK_STAINED_GLASS_PANE
How to make the plugin file update automatically after updating the plugin jar file
You mean config files ?
yes
is it possible to create your own custom mobs in 1.20?
if you mean the material constant, yes
idk where you're going with this question tho 😅
ok ty
yes
But I need it to update automatically like other plugins
Are there any resources you would recommend I check out?
Well I suppose you could check for entries, and if they don't exist you get all content from the file, append the new content and save it again
MythicMobs and ModelEngine combined
Official MythicCraft Compatible Plugins:
ModelEngine - Combine with our powerful ModelEngine plugin to give your mobs fully custom models that shouldn't exist outside of mods
e.g. compare the resource version of your config.yml to the version in the <plugin name>/config.yml path
compare keys, if there are missing keys in the latter, you add those entries
thnks
Or you can go with Configuration#addDefault iirc
fair enough idk about all that lol
can I decrease the view distance to certain players or generally in certain worlds?
not on spigot
can't write descriptions to the entries then tho :/
I'm coding a Region Manager, for you is useful to save also the world in the config
as well as the coordinates?
I create another file called regions.yml
That's better.
Though: YAML is not really made for data storage. It's a markup language designed to store configuration entries.
You can do it like that but if you want to go with files i recommend either JSON or SQLite
json is no different than yaml for storage
both are just flat file and should only be used to store data which rarely changes
isn't json still better than yaml tho?
i'm pretty sure this has also been stated multiple times.
I want that editable in a file, so SQLite isn't a choice
no
Good thing YAML is a superset of JSON
An well if they don't want to learn SQL then they have to go with one of the two
what about forks then?
so if you want you can parse valid json to be valid yaml
🤓 ?whereami
Going back to the question, do you think it is useful to save the world or not?
well
if you don't store the world name
you have to get it in a different way
otherwise you can't construct a Location object
so either with something like Player#getWorld or by a string/id
Thats just a personal opinion. His statement is somewhat correct in that json has nice object serialization, however spigot has ConfigurationSerializable to Yaml which is the same thing
I'll get region only in listeners, so I can get the world in the listener
oh, is it possible on paper?
personally, I find yaml easier to understand than JSON
I guess yeah, as long as it doesn't matter if the location is loaded for a different world
but you need a way to distinguish to which world a region belongs to
in storage
tbh long story short: i would always store the world name as well.
unless any given x/y/z applies to all worlds
which would only makes sense if you want to mirror worlds or something
(at least that's the only real use case i can think of)
perchance
Storing a World/Location in a config is a bit iffy, as the whole config is parsed and objects deserializes the moment you first touch it. If you do so before worlds are loaded your config will break
so store the world name, problem solved
yep
or id i guess
or even yoru own object which holds a vector, two doubles and the world name
custom location moment
yep
yep too
which one of the two?
both!
I think what she wants to say is: we don't really know bc we're on the spigot server and not papermc
but paper questions belong in the paper discord 😌
I am banned there
Stop using paper then
that's unfortunate
this discord remains as the spigot discord
the place for spigot questions
how do I set the name that shows above player's head
okay
Not so simple. requires profiles and packets
well you could probably avoid packets using hide Player these days
hide Player?
wdym?
a simpler method is to create a TextDisplay and mount it as a passenger on the player
use PacketEvents instead
@grim hound i asked someone who does modding and asked if i can interact a plugin by a mod
he said no.
if this doesnt work
ima be mad bro
ima airstrike your home
packetevents is protocollib but better
I agree
I've never done any client-side modding
but custom payload is a packet literally designed for mod - non modded server integration
I think thats what simple voice chat uses
there is a server plugin but its a client mod
OOOOOOO
so the person you talked to was either lying or didnt know
and whats packetevents?
another plugin?
alr
gotcha
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
Player player1 = (Player) sender;
Player player2 = Bukkit.getOnlinePlayers().iterator().next();
Vector vector = player2.getLocation().toVector().subtract(player1.getLocation().toVector())
.normalize()
.multiply(1.5)
.setY(0.5);
player2.setVelocity(vector);
return true;
}```
its exacly this code that gives me
java.lang.IllegalArgumentException: x not finite
but its just better xD
but why tf does it have a plugin
cant there just be a pom dependency
- you can't cast directly to Player like htat
- its because you are using the location of player1
I can;t see that code giving that error, it would require a divide by zero or somethign similar to cause x toi be infinite
that'll blow up like that if both player objects are the same player
yeah its a dependency
oh it is a dependency?
No, if its teh same player the vector will just be zero
but its to prevent 20 plugins to have 20 versions of packetevents in a single server
-_-
but can I use it just as the dependency?
or nah
i remember running into a similar problem while trying to launch people
and normalize will divide by 0 which results in NaN which will blow up
you use it like a hard depend
and the owner adds packet events to their server as a plugin
yep
thats where its getting NaN
what is hard depend
cant run without it?
Yes
and soft depend is can run but without some features?
Yes
how are you in the cute club
and then its very hard to setup because you need to tell it not to parse something if you dont have the dependency?
i didnt know that there are like clans on discord
yeah
that grants you a badge like that
i am cute
your plugin will fail to load if the server doesnt have the dependency
lovely
thats why you specify it in your plugin.yml
same, but i dont have it right next to my name.. sadly...

nah i'm good
lynx
wait what
lynx i will delete your minecraft base
why is this discord so much trolling
how tf do you do that
nah I'm good
what what
how do you specify it in your plugin.yml
dependencies: [packetevents] from the top of my head
poor guy
Imma put your bed next to the villager farm
not the dirt hut!
that will also make sure that packetevents has been loaded before your plugin
damn, crazy
what?
update intellij
1.21 should have the correct name
Well it was released nearly 9 months ago
(just go 1.21.1)
good thing this error got thrown, I forgot I was making a plugin for a 1.20.6 server
💀
why can't it be 1?
that's just a minecraft limitation
oh... im sooo sooo dumb lol
Guys
was there a cancellable event on connect that would get called before on join or am I tripping?
thx 🙏
is it cancellable?
both are, yes
those are the events you should use to disallow a player from joining the server
how do I check that on docs?
how do you check what?
https://paste.md-5.net/eluvisoxob.cs
java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @17d10166)```
they don't implement Cancellable per se, but they have disallow/allow and get/setResult methods
gotcha
how to check if player shoot an arrow with specific bow? if it would be a crossbow or a snowball you can check with ProjectileLaunchEvent and check if either player's main hand is the special snowball or the offhand is, while main hand is not (becaause if the offhand is the special snowball and mainhand is some normal snowball, then player shoots the normal one), but with the bow... its possible that the player has special bow in for example main hand, and shoots an arrow from a bow in offhand (i hope you get what i mean)
How does “cancelling” the event work? Does it just halt prior to handshake in the protocol or something similar?
it just doesn't handle the packet
Easy enough kek
well, both events are post auth which is way past handshake
Oh
disallowing in APPLE will send a login disconnect packet, disallowing in PLE will send a regular disconnect packet
and return from the rest of the "let player in" logic ofc
hm?
.
I just find this to be a goofy packet but it makes sense lol
🤔
if anything goes wrong during the login phase, the server will send that
it's a separate packet from the common disconnect packet because it's a different phase
oh, the normal login event uses that as well, duh, it's right after login but not quite yet in config phase
I mean I was just laughing at the naming, “login disconnect” just sounds funny to me
how do i make a player glow for one player only? (in protocoollib)
You need to send a metadata packet and add the glow mask
I know, but how
here's how you would do it using NMS https://github.com/PulseBeat02/MurderRun/blob/7550f6cc6c818369159e8fc0490cb6a4db50e7a1/v1_21_1/src/main/java/io/github/pulsebeat02/murderrun/reflect/v1_21_1/PacketTools.java#L95 but i'm sure you can do it similarily in plib
you basically take the first byte (the data value with id 0)
Damn u got hta weird discord "cute" thing too https://i.imgur.com/7J3rQzC.png
[Cute] 💀 cringe!!
Wait
but actually are you making just Player glow and not other entities?
because i just found a spigot api method added in 1.20.4 which only applies to LivingEntity so including Player
in my case i wanted items to also glow but you can use the spigot method if you want just one player to glow
Amazing stuff
Ok
One piece is the best!
Does Player#isGlowing return true if the player has the glow potion effect

thats the only think im not sure of
you might need to store the data somewhere
like a multimap of watchers or smthing
anyone know... ;c?
if you need the bow later just set its data in the projectiles PDC in the launch event
PotionEffect glowing = new PotionEffect(
PotionEffectType.GLOWING,
1,
0,
true,
false
);
nearby.forEach(p -> player.sendPotionEffectChange(p, glowing));
this doesn't work
yeah but.. i said that the problem is with detecting if player used the bow
thats what i do, add pdc key, and when it hits a player it checks for the key
so what is the issue? In teh launch event the player will have the bow in their hand
which? They will only have one bow in their hand
umm there are 2 hands
as i said, its possible that player shoots an arrow with mainhand bow or offhand bow while having 2 bows in 2 hands
you understand?
only one hand shoots
?
😭... im asking how to check if player actually used special bow or some normal bow
one at a time, but it does not change anything
Pretty sure only the main hand shoots
?
Then use the EntityShootBowEvent
?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.
uh you have the duration set to 1 tick
is that intentional
Yeah
I changed it to 100 to test, still doesn't work
but 1 tick basically means the glow wont show
.
can you show full code
what does runLoop do
Runs the code x amount of times with a delay
oh... so i could use ProjectileLaunchEvent for snowballs, crossbows, but for bow use EntityShootBowEvent
but why did they make separate event for that?
i mean yeah its usefull
async?
Sync
hm
the javadoc says
Note: Sending an effect change to a player for themselves may cause unexpected behavior on the client. Effects sent this way will also not be removed when their timer reaches 0, they can be removed with sendPotionEffectChangeRemove(LivingEntity, PotionEffectType)
are you sending the effect to itself
does your own getNearbyEntities method get the player itself
No
"Man, I wonder why my files aren't saving!"
ai moment
not ai
could you try printing out the entities and see if they exist
my brain
I did
is just cooked
They exist
does your nearbyPlayers list have any entries?
provide full info and context, i dont want to have to ask you everything
I tried just doing Entity#addPotionEffect, and it worked, but using sendPotionEffectChange doesn't work
not entirely sure then, have you tried just doing it outside of any of your code
and just itself
do you have to necessarily use sendPotionEffectChange? addPotionEffect and setGlowing sounds like a good alternative
he wants it to send it to specific recievers
not all players
setGlowing would make it glow for everyone
ah gotcha
@Override
public void onEnable() {
PotionEffect glowing = new PotionEffect(
PotionEffectType.GLOWING,
100,
1,
true,
false
);
Bukkit.getPlayer("MissingReports").sendPotionEffectChange(Bukkit.getPlayer("MrBot"), glowing);
}```
Still doesn't work
um
well that wouldnt work anyways cause you guys arent on the server
when the plugin enables on server load
unless you use plugman or smthing
^
o
im not really sure then
maybe it doesnt work
when i look into the nms it uses ClientboundUpdateMobEffectPacket
which is different from the ClientboundSetEntityDataPacket packet which would be used to make players glow usually
so maybe thats the reason why the glow effect isn't working?
Choco do you know why maybe
what if you tried using a different potion effect like regeneration
and allow particle effects
do you see the particles?
are you using optifine?
optifine and soime shaders break glow effects
k
it's prolly cause its not the metadata packet
i think you might have to use nms or plib
for ex, the setGlowing method uses the metadata packet flags to mark the player as glowing
i mean that still causes the client to render the outline
Yeah, I'm not sure tbh
public void setGlowing(Entity entity, boolean glowing) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
Player player = getPlayer();
if (player == null) return;
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, entity.getEntityId());
byte bitmask = (byte) (glowing ? 0x40 : 0x0);
List<WrappedDataValue> dataValues = new ArrayList<>();
dataValues.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), bitmask));
packet.getDataValueCollectionModifier().write(0, dataValues);
protocolManager.sendServerPacket(player, packet);
}```
I got it to work with this, but now it overrides all other metadata
For example if the entity was on fire, it overrides that
Yeah i know
How do i get the current metadata
Not sure in plib but in nms you'd get SynchedEntityData from the nms entity
how to change this
should change it to None fr
can u make it animated
it gets sent during handshake so prob not
How do i get the current metadata in ProtocolLib?
PLib is not for fetching in memory data
my bad i mistakenly opened lunar client
why do you need the actual metadata object
i mean just sending a packet like that shouldn't override i believe
Updates one or more metadata properties for an existing entity. Any properties not included in the Metadata field are left unchanged.
it will because its a Bit mask
oh right
byte bitmask = 0;
bitmask |= (byte) (entity.getFireTicks() == 0 ? 0x01 : 0x0);
bitmask |= (byte) (entity.isSneaking() ? 0x02 : 0x0);
bitmask |= (byte) (entity.isSprinting() ? 0x08 : 0x0);
bitmask |= (byte) (entity.isSwimming() ? 0x10 : 0x0);
bitmask |= (byte) (entity.isInvisible() ? 0x20 : 0x0);
bitmask |= (byte) (glowing || entity.isGlowing() ? 0x40 : 0x0);
bitmask |= (byte) (entity.isGliding() ? 0x80 : 0x0);```?
i wouldnt rlly recommend doing that, but if it works, then sure
yea i mean
there's more than just those
nms.Entity#getEntityData ig
ig this is what you're looking for?
I don't want to use NMS
what happens when I use YamlConfiguration conf = YamlConfiguration.loadConfiguration(file); on a file that is empty? Does it create an empty configuration file?
It creates an empty YamlConfiguration
So doing this is the best way?
yea
File file = new File(filePath);
file.getParentFile().mkdirs();
if(!file.exists()){
file.createNewFile();
}
YamlConfiguration conf = YamlConfiguration.loadConfiguration(file);
OfflinePlayer p = sorcerer.getPlayer();
UUID uuid = null;
if(p != null){
uuid = p.getUniqueId();
}
conf.set("map." + sorcerer.getName(), uuid);
conf.save(filePath);
}catch (Exception e){
throw new RuntimeException(e);``` it's weird cuz I have this code
but if mc updates or smthing its prolly gonna break
Dear lord
but for whatever it doesn't wanna save the configuration
don't bully 🙈
I won't
ight nice
But please use saveResource
what's that
Do you know the resources folder in your project?
Where plugin.yml is
This folder
Yeah, then you can do saveResource("myFile.yml", false)
False means it won't replace it if it already exists
hm?
lemme check out docs
Ok
It's easier
It saves the file in your resources into the data folder
Which is plugins/pluginName/..
So I create all my files in my resource folder?
How many files do you have
Then yeah
also in play apparently
different packet
actually.. after thinking.. it also wont work... i dont know if i said that but i also need to detect if player threw a snowball, or an egg, or a crossbow, so... i dont know how to check if player did not use a bow... in the ProjectileLaunchEvent 🤦♂️
and its almost working XD
there, better
If the projectile does not already have bow data in its PDC then it was thrown.
what? bow data? what is bow data
the bow data you apply in the shoot bow event
yes
but shoot bow event and projectile launch event... is it called in the same time or like what
XD
dancing crab
wait wait wait wait wait
YOU COULD MAKE A FUCKING CUTSCENE WITH THAT
why tf are there crabs walking in your f3?
WAIT
show your code pls
i wonder how it works in spigot
@halcyon hemlock!!!
Hol up mb
I got off my pc
where's the ferris dance
.expect("tf") relatable
For testing purposes frfr
that's what they all say
file.getParentFile().mkdirs();
if(!file.exists()){
file.createNewFile();
}
YamlConfiguration conf = YamlConfiguration.loadConfiguration(file);
OfflinePlayer p = sorcerer.getPlayer();
UUID uuid = null;
if(p != null){
uuid = p.getUniqueId();
}
conf.set("map." + sorcerer.getName(), uuid);
conf.save(file);```
So everything works just fine but when I save it into the config file it gets this:
```map:
'null': !!java.util.UUID '9d14ab37-0c6b-4967-ac56-51586d60473d'```
and I do not understand why whatsover. Anyone wanna help?
The getname is returning null then innit
Maybe name isn't cached
Everything might work but what is..
what
this is pointless, just do UUID uuid = p.getUniqueId();
and your getName is returning null.
Also, maybe you might want to do uuid.toString to not save the java class
npe, no?
ignore that, I read it wrong completely actually
💀
my bad, sorry
#[encode(default = VarInt::from(0x17))]
🤔
1.20.1
oh
Check old protocol
👨❤️👨
uhhh where was that on wiki vg again
oh it's just a plugin message
It's the brand thing
U can do crazy shit with the packets
I'm sending 100 chunks per second rn 💀
damn
What were u gonna do though
make font magic there
legacy color codes?
Try it idk I got off
i will later
How to show player specific Scoreboard Objective board? I created scoreboard with many objectives and set display slot to SIDEBAR. I need to display objective named "test" from scoreboard to player. I see only one method player.setScoreboard(Scoreboard); but it's not objective.
a player is assigned a scoreboard to see
if the objective is on display sidebar it will be shown to all players who have that scoreboard set
So I should create scoreboards instead of objectives to display different variations of sidebar boards for every player?
if every player has a sidebar with different content, all players need their own scoreboard yes
protocollib or custom packet handler to make a simple 1.21 anticheat?
which is more convenient / benefits
ProtocolLib or PacketEvents is probably the better decision to make tbh
custom packet handler is always gonna be less convienent
the only benefit is independence
which hardly matters
since its pretty easy to make changes if the protocol changes
ProtocolLib:
- Lots of existing documentation
- Only parse what you need
- Most servers already have it installed
- Huge community
PacketEvents: - Packets are parsed for you
- Discord server available
- Requires explicit version support for the mc version
- Light documentation and community
Custom Packet Handler: - You're on your own, enjoy your independence.
(I'm not sure if an official discord exists for protocollib)
(it doesn't)
(write your own server from scratch)
yeah there's like three or so big ones
Guys
Does Spigot happen to have some code that prevents YamlConfiguration from saving the values for a key if the vlaue is null?
if the value for a key is null it will be removed
dont you mean the value being null?
what key would you remove if it is null?
wait
cant read english
3 hours of my life 👉 🚽
Is using DI worth it for the Plugin initializer(JavaPlugin child) class?
idk if im stupid or stupid but why so many errors
``package me.echo145642.rank;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
public final class Rank extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
public enum Rank {
Player(ChatColor.GRAY + "PLAYER"),
Owner(ChatColor.GOLD + "OWNER"),
Admin(ChatColor.RED + "ADMIN"),
Dev(ChatColor.DARK_PURPLE + "DEVELOPER"),
Helper(ChatColor.GREEN + "HELPER"), prefix(;);
Private Final
String Prefix;
Rank(String Prefix) {
this.prefix = prefix;
}
}
Map<Player, Rank> =new HashMap<>();
public void setRank (Player player, Rank rank){
ranks.put(player, rank);
}
public Rank getRank (Player player){
return ranks.get(player);
}
public void loadRank (Player player){
String rankString = getConfig().get(player.getUniqueId() + ".rank");
Rank rank = (rankString == null) ? Rank.NONE : Rank.valueOf(rankString);
player.setDisplayName(prefix.get(rank) + player.getName());
player.setPlayerListName(prefix.get(rank) + player.getName());
ranks.put(player, rank);
}
public void saveRank (Player player){
getConfig().set(player.getUniqueId() + ".rank", ranks.get(rank));
ranks.remove(player);
}
}
}
if (getRank(player) == Rank.Owner) {
player.
}``
pls do it in three of `
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
public final class Rank extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
public enum Rank {
Player(ChatColor.GRAY + "PLAYER"),
Owner(ChatColor.GOLD + "OWNER"),
Admin(ChatColor.RED + "ADMIN"),
Dev(ChatColor.DARK_PURPLE + "DEVELOPER"),
Helper(ChatColor.GREEN + "HELPER"), prefix(;);
Private Final
String Prefix;
Rank(String Prefix) {
this.prefix = prefix;
}
}
Map<Player, Rank> =new HashMap<>();
public void setRank (Player player, Rank rank){
ranks.put(player, rank);
}
public Rank getRank (Player player){
return ranks.get(player);
}
public void loadRank (Player player){
String rankString = getConfig().get(player.getUniqueId() + ".rank");
Rank rank = (rankString == null) ? Rank.NONE : Rank.valueOf(rankString);
player.setDisplayName(prefix.get(rank) + player.getName());
player.setPlayerListName(prefix.get(rank) + player.getName());
ranks.put(player, rank);
}
public void saveRank (Player player){
getConfig().set(player.getUniqueId() + ".rank", ranks.get(rank));
ranks.remove(player);
}
}
}
if (getRank(player) == Rank.Owner) {
player.
}```
now add java after the ```
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
public final class Rank extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
public enum Rank {
Player(ChatColor.GRAY + "PLAYER"),
Owner(ChatColor.GOLD + "OWNER"),
Admin(ChatColor.RED + "ADMIN"),
Dev(ChatColor.DARK_PURPLE + "DEVELOPER"),
Helper(ChatColor.GREEN + "HELPER"), prefix(;);
Private Final
String Prefix;
Rank(String Prefix) {
this.prefix = prefix;
}
}
Map<Player, Rank> =new HashMap<>();
public void setRank (Player player, Rank rank){
ranks.put(player, rank);
}
public Rank getRank (Player player){
return ranks.get(player);
}
public void loadRank (Player player){
String rankString = getConfig().get(player.getUniqueId() + ".rank");
Rank rank = (rankString == null) ? Rank.NONE : Rank.valueOf(rankString);
player.setDisplayName(prefix.get(rank) + player.getName());
player.setPlayerListName(prefix.get(rank) + player.getName());
ranks.put(player, rank);
}
public void saveRank (Player player){
getConfig().set(player.getUniqueId() + ".rank", ranks.get(rank));
ranks.remove(player);
}
}
}
if (getRank(player) == Rank.Owner) {
player.
}```
dont just post it again...
and what on earth is
Map<Player, Rank> =new HashMap<>();
you cannot define an enum in a function...
dont just paste in your main method bruh
you unlocked a new quest: go learn java
exactly
"once you are done with this quest, come back to claim your reward"
What the hell?
youre slow
No u
is it to early to drop a ?learnjava
bump after few minutes
yes to what?
yes to your question
alr ty
World.spawn() a consumer of what class do I need to pass? I cannot figure it out whatsoever
@Override
public void accept(Entity object) {
}
});``` that's what I have so far
what do I replace the consumer with?
alr, I figured it out :D
Use lambda ffs
yeah I did
Good
can i make BlockDisplay entities with a custom player skull?
block displays bad?
Yes
why
idk coll said so
dont be a sheep
She’s a cat
meow
According to the ears anyway
What about the hips
how do I get the closest entity to X, that meets a certain criteria I get by passing it into a function?
am I being confusing
You could get nearby entities and then further filter it
get entities in distance X?
wait that actually makes sense, I wouldn't even need entities that are further than X
lmfao
thx
in EntityTargetEvent, after cancelling it, how do I check if the target entities target is null (if it had a target before)
meow‼️
no way!
Bump 👀
Btw, when setting someones target you can make anyone attack anyone right?
Yes
Well, not players or entities that don’t attack
Players have free will and entities that never attack don’t have the goals or attributes to do so
?img
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
!verify
Usage: !verify <forums username>
Fair enough
So like the description of the "setCancelled" says that if I setTarget to null it looses its target but if it cancel the event it regains the previous target
So how do I check if the precious target was null
Does noone actually know 😭
Also, I just realised my code didnt retarget anyone cuz I cancelled the event bruh
It’s current target should be the previous target
The sentence has a slight grammatical issue. The word "current" should be preceded by a possessive pronoun, so the correct version would be:
"It’s its current target should be the previous target."
- "It’s" is a contraction of "it is" or "it has," which is incorrect in this context.
- "Its" is the correct possessive form, indicating that something belongs to "it."
Ay dios mio!
Emily wants a cookie
I've taken somebody's advice to make a Scheduler class where all runTaskLaters are handled. But my only issue is that I don't know how to add a runTaskLater to a List.
Right now I have:
ArrayList<BukkitTask> tasks = new ArrayList<BukkitTask>();
but idk how to add something like Java Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() { @Override public void run() { //anything } }, 1800);
Any1 able to help me?
you can't really add the task to the list inside the task, take the BukkitTask you get from running that and add that to the List
So the getTarget() just changes when you cancel the event??
getTarget should stay the same if you cancel the event
Right
So wdym by that
To check if the previous target is null you should just be able to do event#getEntity#getTarget
I can getTarget on getEntity
No method
I couldn't find any methods for finding the target outside the target event
You may need to check and cast to LivingEntity or something
Are there some tutorials or something like that how to use gradle?
Hm
Not sure
Alr
And one more, if I don't cancel the event, mob#getTarget would still be the previous target right?
Ight
Anyone happens to know if World#getNearbyEntities returns the entities in ascending order?
Ascending order of what?
Id?
Distance
I beleive so
spent a few hours on my brand new never before seen super easy serialization
only to find out its actually just NBT like almost exactly 💀
Wait @young knoll is the code you used to serve resourcepacks without a server port public?
Making a plugin using a pack and I don’t wanna write a whole http server implementation for it
I just put the pack on my github 😂
you don't need an entire http implementation
Yes he is serving it over the game servers connection (I believe)
I generate the resourcepack at runtime
well apache already has libs that has like the majority of the stuff done
Actually I already had a sever using a lib which did it for me
sever
But I was interested in how he managed to do it without needing to port forward
Like an actual port
port 80 is generally not blocked
that is the default port for http related things. Unless you specifically use something else like curl etc, java defaults to using port 80 for url connections
Do you think it won’t be used?
yes, but depending on the language, url connections are not inherently port specific
If I host like a mini daemon using it
it is just that Java implemented 80 as the default if none is specified
Not yet
It’s using the server port
Which should already be forwarded cuz yknow, kinda need that to make the server work
Ohhhh i see
big brain
how
if (state instanceof Banner) {
BlockData data = block.getLocation().getBlock().getBlockData();
((Banner) data).setBaseColor(faction.getBannerColor());
((Banner) state).setPatterns(faction.getBannerPattern());
state.update();
}```
why doesnt this change the basecolor ?
you never use teh data
Injecting into netty pipeline
what a nerd
mb, data doesnt work because it can not be casted.
((Banner) state).setBaseColor(faction.getBannerColor());
((Banner) state).setPatterns(faction.getBannerPattern());
state.update();
}```
this also doesnt work
that looks fine
yeah but it doesnt change the baseColor
u able to show me how to do that? I have no clue tbh :/
are you sure you are passing a valid color?
as in DyeColor.BLUE ?
so it must be valid
yes
looks like it should work to me
Any errors?
Sets the base color for this banner. Only valid for shield pseudo banners, otherwise base depends on block type
ah thats shit
You need to change the block itself
cause there are 2 types of banner
So I'm guessing you did something like this? https://github.com/PulseBeat02/MurderRun/blob/main/src/main/java/io/github/pulsebeat02/murderrun/resourcepack/provider/netty/ResourcePackHandler.java
made your own ChannelInboundHandlerAdapter and then inject into all the connections of MinecraftServer
