Connection is an abstraction, in In the network, everything works by packet I think, it's netty that calls it a conexion . Our physical machine receives packets, it's netty that sees it as a conexion, gathers the packets and creates channels that are abstractions.
I'm not sure of everything I'm saying, but this is what seems correct to me.
#help-development
1 messages · Page 1061 of 1
I don't know whether it's netty or nms that creates the channels per client. If it's nms, that means there must be a global channel where all incoming packets pass through, so surely we can inject our handler?
why not ?
netty
netty is networking
nms uses netty
How could I make signs execute commands?
I see an event for signs when clicked PlayerSignCommandPreprocessEvent
Thats a paper event
You can add command in sign nbt I think
I'm in the wrong javadocs xd
you were doing the ingame dialong yeah?
Indeed
oh it seems like you can just have a click event on the sign lines?
on signs
yeah
how it is done?
you should be able to put a "click_event":(" or whatever on the signs line
like each line of a sign is a text component
you should be able to add click events to that
Just unicode textures and a bit of font magic. Im probs gonna open source it soon
/setblock ~ ~1 ~ minecraft:oak_sign{Text1:"{\"text\":\"siema\",\"color\":\"white\",\"bold\":\"true\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/teleport @p -202 118 -8\"}}"} replace is how I did it like 3 years ago
In bed rn so cant send any code examples
Can someone explain to me why creating a ClientboundPlayerInfoUpdatePacket instance results in this error:
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.PlayerConnection.k()" because "var0.c" is null
I wrote this plugin with Mojang Mappings (with Special Source) for the version 1.21
Here is my code:
package me.loadthecode.npcs.commands;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.level.ServerEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.Set;
import java.util.UUID;
public class CreateNPCCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player p) {
CraftPlayer cp = (CraftPlayer) p;
ServerPlayer sp = cp.getHandle();
MinecraftServer minecraftServer = sp.getServer();
ServerLevel serverLevel = sp.serverLevel();
ServerPlayer npc = new ServerPlayer(minecraftServer, serverLevel, new GameProfile(UUID.randomUUID(), "Bob"), ClientInformation.createDefault());
sp.connection.sendPacket(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
sp.connection.sendPacket(new ClientboundAddEntityPacket(npc, new ServerEntity(serverLevel, npc, 0, false, packet -> {}, Set.of())));
}
return true;
}
}
You need to make a fake connection for the npc
The server is trying to send packets to it
And you need to void them
serverConnection is global server connection? You can get channels from it?
How?
Just use Citizens there's no need to reinvent the wheel
Ok
but sometimes the wheel needs to be a square
I like my wheels triangle tho
server connection is the pipeline of channel handlers (the server's Channel handlers) that determines which channel handlers (the player's) initially should a player's channel be assigned
so for example the handshake handler
timeout handler
ping handler
etc
the server's handler assigns the user's Channel some channel handler that are unique to that very player
but the server's channel handlers are shared and they determine what handlers each player should have
Can we make an handler injection from server connection?
yes
you get the pipeline with Channel#pipeline
and place your handler
I placed mine first
cuz it's a wannabe firewall
mhm
ah forgot about that one xD
java.lang.NoSuchMethodError: 'java.lang.Object net.kyori.adventure.platform.facet.FacetAudience.getOrDefault(net.kyori.adventure.pointer.Pointer, java.lang.Object)'
at net.kyori.adventure.platform.facet.FacetAudienceProvider.addViewer(FacetAudienceProvider.java:114) ~[?:?]
at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.<init>(BukkitAudiencesImpl.java:100) ~[?:?]
at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.lambda$build$1(BukkitAudiencesImpl.java:174) ~[?:?]
at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2722) ~[?:?]
at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl$Builder.build(BukkitAudiencesImpl.java:174) ~[?:?]
at net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl.instanceFor(BukkitAudiencesImpl.java:89) ~[?:?]
at net.kyori.adventure.platform.bukkit.BukkitAudiences.create(BukkitAudiences.java:53) ~[?:?]
at com.sumeru.mobwars.MobWars.onEnable(MobWars.kt:35) ~[?:?] ``` plugin.yml: ```libraries:
- 'net.kyori:adventure-platform-bukkit:4.3.3' ``` build.gradle: ``` implementation("net.kyori:adventure-platform-bukkit:4.3.3") ``` MobWars.kt ```var adventure = BukkitAudiences.create(this); ```
why?
what line of code causes this? [org.bukkit.craftbukkit.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
how can you initialize legacy material support?
set your api version to 1.13
set an API version in your plugin.yml of at least 1.13
its not my plugin
but i set it
now works
also this warning from multiversecore is starting to piss me off
and fail with colors &a
as if some 15yo made it
its just spamming the console
what event?
console should be telling you
in that case there should be another error somewher when using MV
Seems like its org.bukkit.event.entity.EntityCreatePortalEvent
can entities create portals? other than players
the new event is CreatePortalEvent. Looks identical to teh Deprecated one. Seems just a name/package change
is better as teh new event gives a reason
if anyone reports this as bug they just ignore it
or if someone just tells them about the warning
Its spamming the console
and uses dumb colors that dont event apply
what is the alternative to Java Consumer in kotlin? contracts?
just T -> Unit ?
^
thanks
or just use Consumer if you really want
how is this called to search in docs
thanks! :D
people doing size == 0 instead of isempty, cringe
thanks mate
to invoke PlayerInteractEvent, which packets does the server use?
What is pipeline exactly?
pipeline is the linear array of channel handlers
so in other words
there's a first channel handler
which is the first to process any data
and the last one
wait no
the first channel handler is the last one to process outgoing data
okay
had to ask friend
last process first outgoing
first process first incoming
you should also know
that there are Inbound and Outbound handlers
Ah pipeline contain handlers who handle incoming ans outgoing packets, all packets pass in the pipeline?
when writing (outgoing) outbound handlers get to process
when reading (incoming) inbound handlers get to process
all of which are in the same pipeline
in the same linear array
gpt the best friend
For example, does spigot add its handler to the pipeline with inbound and oubound, or does it add one to inbound and one to outbound?
it does none
it listens to packets by modifying mojang's code
and they need to add handlers
Ah nms instead?
yeah
In the code you showed me (AlixSystem) you add an handler in the pipeline at the same "level" that NMS?
there are no levels in netty
this might help
there are many more handlers but this is a simplified version
when the server receives a packet, netty handles it
It's a complex fear for me if I summarize, in the pipeline we have 2 parties, the "out" and "in" there are inside handlers and the packet is sent once each handler has finished with this event right?
yes
but inbound handlers don't handle write, and vice verse outbound handlers don't handle channelRead
but both coexist in the same linked queue
(for whatever reason)
What type of data should be the handler ? A consumer ?
it needs to implement ChannelHandler
but for you it'll be best to use ChannelDuplexHandler
Okay okay
Thank you for all these explanations 👍
as this one
handles both
it's both inbound and outbound
So I provid my inBound handler and outBound handler
with this one class yes
Can we set "priority handle"? (For example if I want to handle before nms)
for that you need to place your channel handler before theirs
like this
it's the name of it, ye
Hey, so I just finished coding one ability and it works but it's 733 lines long.
I googled how I can give myself less of a headache when I look at it and what I found is that I should have only one responsibility per class. Which makes sense because I notice most opensource plugins do the same and it's easily understandable (although I have no idea why people make 10 classes with basically nothing it usually interfaces).
But my question is how do figure out the different responsibilities from my class, like is there a general rule to know what is a different responsibility and how niche should you go when sorting a giant class in multiple smaller classes?
Right now I only create different classes for objects used in my ability class. I think I could split my class in a Listener, PacketListener, Runnable and a class that connects everything but then it would still be messy just split in different classes.
Any advice is appreciated (my room, and this message probably are also a mess pls help)
remove nested if statements
seperate different statements
for example add a class for utilities
and group together in the same package classes with something in common
https://www.youtube.com/watch?v=HoA6aZPR5K0 dunno try this
Support us on Patreon: https://www.patreon.com/Geekific
GitHub Repository: https://github.com/geekific-official/geekific-youtube/
Stay updated on our videos by subscribing to the channel and hitting the like button!
Clean and quality code isn’t only a code that works, a code that provides us with the desired output or result. A high-quality c...
I watched a bit and for now agree with everything
just to be sure, in the pipeline, the channel concept already exists?
the channel exists always
it's created the very moment the connection is accepted
the very first thing that is done is the channel being created after the socket is accepted
channel concept is created in netty?
I'm not sure what you mean by "concept"?
but yeah
the Channel object is instantiated by netty
i'm not quite sure but from what i know, in the network itself there are no channels just "tram" or "frames" (i don't know if it's said like that in english but it's the packets that are sent basically) the concept of channel is more or less to group the packets arriving according to the ip of the client that is coming from
but yes, it must be netty
tram?
To gen the jar with mojang maps it's just 'Generate Remapped Jars' right? i never worked with the gui version and I'm not sure haha (buildtools)
eng word is frame
that's a frame
you need to add something in pom.xml
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
yes, here channel concept don't exist I think
wait no
?nms
oh yeah
thats teh thing, it's for the cmd version I'm just dumb xd sorry
Thank you, and I also watched that video but I'm having difficulty deciding how niched down I should order different classes to follow the single responsibility principle, because I would argue my entire class has one responsibility which is to add an ability but that logic is obviously flawed
that ability is made up of multiple parts
one probably being the cooldown
the other one displaying particles
and the other maybe moving some mobs
I guess, my ability is basically making the player invisible and using packets to replay everything the player did a few ticks later. I already have the invisible part somewhere else it just takes a lot of checks and listeners to copy everything the player does
plugging a lot of code when it's just replaying data
xd
oh that's sick you also showed this in packetevents discord haha
yeee
didn't know you were there
not sure how I could make a captcha from this tho
maybe I should just make the armor stands never touch each other?
what do you even use as an imput for it to show ingame? like a png without background?
I generate a some letters on a 2d buffered image object
rotate them randomly
and use some stolen adapated code to show it in 3d space
all while filtering any white pixels
wtf is that bro?
Sounds complicated xd, is it the same for the hand?
basically generate this but without any extra random lines
hand is completly different
I download a 3d object
roughen it up in blender (cuz they're too detailed)
and then use other stolen adapted code to show it in 3d space
cool, to solve the captcha you gotta type 👆
omtfk ig
yeah maybe I can make this work
by just making them more distant to each other
and here I planned to have it point where you click it to point
ah
Ok but what's the captcha word supposed to be because it's kinda open to interpretation
Hand? Finger? Point?
nono xD
the action bar is just from the former code
the new challange will have 12 (or maybe more) different points
and you can click on them and the hand will change rotations
and one of them will be red instead of white
and it'll say click on the red point
and then you confirm
that's how I envisioned it
thanks, I hate it
also you didn't have to roughen it up in blender, there's a way to solve that volumetrically but whatever
same
I really dislike this
uh
uhh
I like your funny words magic man
it's a voxel game
you just need to pick a scale and fill in the volume
it doesn't matter if you hand has 3 vertices or 3 million
3 million sounds like it would be more fun
if you think about it I'd be way more interested in seeing the 3 vertex hand
oh that is true too 🤔
a triangle with a hand texture drawn on it
would have that 90's feel to it
also it's not that rare to get 1mil tri hyperrealistic models, I'm sure there's hands with that level of detail available for download
especially when you're doing it from detailed scans
it beat him
he doesn't know what an 8 is
ima be honest i dont even know what thats supposed to say
JUu8K
unironically this is what amazon does
yeah that was a test
?
it looks fine imo
i guess im just a fuckin robot then but that doesnt look like Uu
I'm 99% sure amazon's capcha is not meant to be solvable on the first one they show
yea I thought it was W
I will remove the letters being in each other
or rather
the first one they show is almost always entirely unreadable, and the second one is always basically just fine
enlarge the distance in-between them to avoid that
how can I update a chat message?
I want to make a progress bar
that doesnt flood the chat
why's that?
make the bots only solve the 2nd one
with OCR
Lol
I don't know
just use a checkbox 😉
if someone just told me what I just said I wouldn't believe them, but I at the same time I refuse to believe that it is a coincidence that amazon has failed to present me a single 1st try solvable capcha in the last 2 years on their first try
https://paste.md-5.net/busafelura.xml
Any specific reason why the compiled jar has the name passengerstrain and not BedwarsEssentials?
any1?
you can't modify an already sent chat message
why not use action bar or titles or bossbar
some plugins pretend to do this by re-sending most of chat in a single go but editing one message in there, but effectively that's just spamming the client with brand new messages
tf is this then
Boop beep
even with nms?
even with server modification?
that's beyond the scope of what we do support for here
ok
That delete chat packet can only be used to delete a signed message
You have to have chat signatures enabled. Which is fine. You should. But not a lot of servers support it because chat management is difficult
We don't expose it in the API either because we don't expose message signatures anywhere
Fast check using bitwise operators
I can see that
but still
If any of those result in a negative number, it's out of capacity
Kind of a neat way to write that
addition is done before bitwise
Yes, and if they overflow into a negative 👀
would need to be pretty bing for that
I severely doubt it's much faster than just a regular if bounds chdck
I mean probably
how are you adding these?
especially after c2, lol
Could be curious to have it benchmarked
I'm sure they didn't write it using bitwise operations just because they could
"it looks smart tho"
for {}
while (1)
C users
loop {}
loop(){loop();}
Unfortunately, neither the basic for statement (JLS § 14.14.1) nor the enhanced for statement (JLS § 14.14.2) allow for for statements without parentheses. Your program is ill-formed, not syntactically correct, and will raise a compilation error
loop {
}
int i = 0;
int max = 10;
for (;;){
i++;
if (i >=10) break;
}
I'm not a part of your system, man
I'm adding this to cum @blazing ocean
Thread.sleep(Long.MAX_VALUE)
yea pls do, it's a rust feature
?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!
It's a personal question
raised eyebrow emoji
I thought choco is already in a relationship
I'm trying to hire him ...
then thats not personal
He's already hired by hypixel
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I am good at hiring people, I did hire him before 😄
Tf
This time its a better server, with a better management and a better pay
So he might be interested
doubt
Hard skill to prove
Anyone else is interested? As long as you are good at java I might have a job for you
.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
actual talented people do not use forum recruitment for some reason
because they alreaxy have an occupation
They do, IF the offer is good
(which they often aren't)
this link doesnt work
need to be logged in
link is fine
it's not
maybe I'm old
well it is recent for a year or so
are you a dev @eternal oxide
Nope, whats a Dev?
Devoted member of the Minecraft Community
definitely not 🙂
Books are overrated
Actually I draw Minecraft Anime porn
Explaining a line in 2000 pages
that should be illegal
If you need 2000 pages to understand a line you shouldn’t be programming
That's what I'm saying
can't draw to save my life in reality
That got proven to me when someone sold a banana taped to the wall
Can you guys help me with my Hiring post & title
I thought you were good at hiring 🙂
Need Dev. No pay but offering "Exposure". Only devs with 10 years experience need apply.
You just enter some lines and wait for a response
The server I'm hiring is actually good, like top 10
So people would work for free
lol
I will not believe a single word
Top 10 sounds quite uh
That used to happen like 10 years ago
what server
fake
Required: 20 years of spigot-api experience
I'm the secret guy so can not reveal it
I mean you learn everything in 3 months anyway
@worthy yarrow is md's brother
and 9 more months for experience
he knows
1 is good enough
Yeah waiting on that book from eglarl or someone
True
Choco was a good dev tho, very nice guy
Choco is no more
rip
Choco is dead???
Did he die in teh past few hours?
He went after clout
md is my email friend
No component pr I guess
He doesn't care much about money
poor Choco
Depressing
in germany we say brieffreund
purple guy are you a dev
Ah sigh hes moving to heaven
your look like a cool guy, potential lead dev
he doesn't know whta a java is
yes
Let's goo XD
Lead dev with no pay kek
lynx is a noob here. He doesn;t know Java
yea
i'm a lead dev (for two servers)
1 year experience enough
kotlin better fr
xcode 💀
Lynx has about 15 minutes of java/kotlin experience, he's just a fun guy to chat too
Idk how much devs get paid tbh, I'm just trying to find a really good guy, money is handled by owners
yea and the paper people like him too because of that
Yea I'm just here to meme, my only answer is "ask chatgpt"
No one here knows how to code dawg
Well this is why AI

Imagine if people asked their "not working" questions to chatgpt
that one guy was so funny tho lmfaooo
cannot stop thinking about him
what was his name again
rad are you really a good dev
what is coding
Like ship... like rocket ship or some shit kek
rad nests if then
you sound like the type of guy who wants to see some shitty code i wrote today
I actually like to only use recursion
then be it
No method I write isn't recursive
God fuck double negatives in english
this shits stoopid
skull
whatever the fuck this is
Rad did I tell you I got a job
public void displayStructureOverlay(Player player, Location targetLocation, int width, int height, int depth) {
Location[] corners = new Location[]{
targetLocation.clone().add(0, 0, 0),
targetLocation.clone().add(width, 0, 0),
targetLocation.clone().add(0, height, 0),
targetLocation.clone().add(0, 0, depth),
targetLocation.clone().add(width, height, 0),
targetLocation.clone().add(width, 0, depth),
targetLocation.clone().add(0, height, depth),
targetLocation.clone().add(width, height, depth)
};
drawLine(player, corners[0], corners[1]);
drawLine(player, corners[0], corners[2]);
drawLine(player, corners[0], corners[3]);
drawLine(player, corners[1], corners[4]);
drawLine(player, corners[1], corners[5]);
drawLine(player, corners[2], corners[4]);
drawLine(player, corners[2], corners[6]);
drawLine(player, corners[3], corners[5]);
drawLine(player, corners[3], corners[6]);
drawLine(player, corners[4], corners[7]);
drawLine(player, corners[5], corners[7]);
drawLine(player, corners[6], corners[7]);
}
private void drawLine(Player player, Location start, Location end) {
double distance = start.distance(end);
Vector vector = end.toVector().subtract(start.toVector()).normalize().multiply(0.1);
Location current = start.clone();
for (double i = 0; i < distance; i += 0.1) {
player.spawnParticle(Particle.HAPPY_VILLAGER, current, 1);
current.add(vector);
}
}
}```
Just be happy you're not doing this absolute fuckery with particles
okay yeah that is kinda cool
i do need something like that for my structure lib too
So it's based off players current view, the issue is that I need to align the display with the actual dimensions of blocks to relay a better placement grid as it were
https://x.com/LukynkaCze/status/1806075722802315451 thought of just doing osmething like this
Right now the offset makes it look like it can be pasted in half way of block
Damn it be looking better than WE
supports ipv6?
I just wanted a way to make the cuboid region like they did in housing on hypixel, which is essentially what I have now apart from the offset being a bit bugged still
how does it look on there
i updated some stuff btw
The same but with redstone particles, and it only works with the //wand region you make. So my plugin is prebuilt structures with item placeholders, schem file names are stored with the items pdc which I then use to grab the correlated schem and determine dimensions for the visual overlay this way
@blazing ocean
epic mention fail
Idk if you were still here or not kek and I forgot to reply
i have this open on my second monitor
Idk why I always forget people have multiple monitors, I've been on my laptop for so long
i want a third one
I have a second monitor though I think the hdmi hardware is busted on the laptop
For some reason it detects the monitor but won't shoot over the display or inputs
windows moment
usually a CTRL+Fn key to switch monitors
It's one sided though
the laptop tells me it knows a monitor is detected but I cannot do jack shit with it kek
does anybody have any spigot plugin/api/library/anything that needs PRs. im tryna do more open source stuff
is there a tool that calculates the amount of chunks that will render with specific view distance?
Not that I've heard of
I mean it's just (radius * 2)^2 isn't it?
The fog is circular in modern versions though so they're not "rendered" but they're loaded
is threre a scoreboard update event
No that looks right and close to what I said, only it +1’s which makes sense
Is it better to have 200 schedulers that each set a block after 15 minutes scheduled at different times or 1 global scheduler that sets the 200 blocks at once every 15 minutes?
but isn't 200 blocks a lot of load?
200 isnt
if was 1000?
idk 200000 maybe
there was some article on the speed of some methods to set blocks
i hope you mean tasks instead of schedulers
why
from what I know it is to reduce the load
yes
set the blocks not all at once but gradually set them
not even that
should i do this for 200 blocks?
no
I'm scared
I need to add 5 custom crops to my server. They will be already existing blocks, but I want them to have a name tag with their custom plant name above. How should I go about doing this?
Would you say that autosave being 11 minutes is too long?
One problem I've encountered with using armor stands is that there is no way to check when the plant block breaks in order to also destroy the armor stand, so it can leave floating armor stands
you mean a name above the crop block itself or the item in the inventory?
above the block
why more safe
can someone send me via dm a example of how i change the full displayname of a Player i dont get it
i forgot if a crop has a persistent data container but if it doesnt you can probably save it in the chunks one; which crops exactly are one of your "custom" ones, depending on that, in the block break event, you can give a custom item or something
wanted to send this initially
should the broken crop drop something custom too, or just the vanilla item?
internals changing or smth, idk tbf
i mean you can detect the breaking in the block break event
you can detect crop trample with the interact event
Reminds me of a thing
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
you can just map those locations to armor stands or something
how can i change players displayname
that question is vague mate
theres Player::setDisplayName or you can change the name above their head
ok
Does that even change the name above the head
no
last time i did that was ages ago so ig it still happens with scoreboards/packets
correct me if im wrong
that functionality is very fucking limited
you can only set a prefix, colour and suffix
for other stuff you need a text display
packets 🤡
you can only do this with them too
any1 got a tutorial for local database?
god I love this little bot I made
this must've been the most time efficient project I've ever made
yeah it can take up to a minute to answer
it does some times hallucinate things but it has been getting better as we chip away at it, plus I'm usually around to correct it when it goes off the rails
I did suggest something like this for spigot
genuinely think for 90% of beginner questions, if it was set up correctly it would do a better job at answering them than any of us could be bothered to do
elgarl would loose his job
mark my words this kind of assistant will be widespread in 10 years
it's more convenient to query it than find the links myself and I both made the bots and wrote the docs it is basing the info off of
and even I just ask it to give me info and links when I'm not sure about something
honestly if I get into game dev I might make a bot like this for whatever game engine I end up really using because it would be a game changer
it probabaly will
feels good to be among the first, I still haven't really seen other people do this
I did a bot for Towny IRC years ago but it eventually went mad
Good evening,
I am in the process of writing an MC plugin and have little experience... now I'm facing a few problems and can't get any further....
In the end I have uploaded my plugin to my server but it is not installed or displayed, maybe someone can find the problem quickly or has suggestions for solutions
Would someone be willing to take a look at this and help me ... ?
I come from Germany, but can also write/speak English.... hit me up
see that's the kind of query bots do really well with
lmao
did you put it in the plugins dir?
if its not displayed. there must be an error on your console. show that to us and we can help you.
ofc, think i missed something out in structure or smthing
gimme a sec
don't forget the plugin.yml info is not optional
unfortunately i can't retrieve the logs from this stupid provider or go that far back in the logs.... do you have any experience or solutions?
cant even access the console?
well, cant you startup your server and see?
yes i can, but the logs are so fast that i can't keep up and unfortunately i can only look back a certain number of lines at a time... what a bummer...
thats... interesting
why not run it locally?
without seeing an error.. it could be a number of different issues
i´ll do that...gonna come back after i´ve set up the exact same
youre damn right
console is just a screen that shows a live feed of what ultimately gets dumped
which he cant access
gimme a sec
aperantly
i can, you got me wrong there
ah alright
wait a asec
you guys have not been doing support for long enough
do another 10,000 support tickets and you'll know these fun tricks
@torn shuttle this you? https://www.reddit.com/r/memes/comments/7akjya/final_boss/
speaking of, I am soooo close to the magic number
I'll be upset if I'm not there for it
The last saved logs are from before the plugin was rolled out... how can I trigger logs manually or something ? are logs logged at every restart ?
they are logged live
got the newest ones... wait a asec
i guess this is the part we need :
[22:59:29] [Server thread/ERROR]: Could not load 'plugins/original-gg_plugin-1.1.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `org.quemix.gg_plugin.Gg_plugin'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
yea so the path to your main class is invalid
underscore in the package name, bad move
Gg_plugin is your class name?
underscore in the class name, also bad move
why is that the case
goes against the recommended code style
package names are all lower case and all letters, class names capitalize the first letter of each word, no space no underscore
where do i need to correct that ?
am I nostradamus
oups, in my plugin.yml there is no path at all xd
can i private chat to someone ?
I guess i need some futher help here bc im very new into coding and especially in MC context...
u can if u want but there's more people here so it should go quicker
yeeaaa u need to verify ur spigot ac for that
wait a sec
its not unfortunately
where do i get the verification at ?
i didnt receive a private message or mail so far
xd
i thought it was a cmd
?img has a link to the channel
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
well it does tell u what to do
"A private message has been sent to your SpigotMC.org account for verification!"
but i dont know where to look at that message xd nvm
probably some kind of ray cast
What does this mean?
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.block.BlockEvent. Static getHandlerList method required!
I'm trying to register a BlockPistonEvent
Seems like for some reason you just cant use this event
I'm confused
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList(){
return HANDLERS;
}
For any custom events you need a static getHandlerList method iirc
Are you just passing an event to an @EventHandler method?
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPistonEvent;
import java.util.Collection;
public class Piston implements Listener {
public Piston(Main plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPiston(BlockPistonEvent event) {
System.out.println("event called");
Block block = event.getBlock().getRelative(event.getDirection());
Collection<Entity> entities = block.getWorld().getNearbyEntities(block.getLocation(), 0.5, 1, 0.5);
for(Entity e: entities) {
System.out.println(e.getType());
if(e.getType().equals(EntityType.ARMOR_STAND)) {
ArmorStand stand = (ArmorStand) e;
if(stand.isSmall()) {
event.setCancelled(true);
break;
}
}
}
}
}
@EventHandler
public void onTemperatureChange(PlayerTemperatureChangeEvent event){
Player player = event.getPlayer();
double newTemperature = event.getTemperature();
handleTemperatureUpdate(player, newTemperature);
}```
The example I gave is from impl of a custom event
I think you're using the wrong event
ok
Anyone know how to get LevelChunk for ClientboundLevelChunkWithLightPacket? For a given bukkit chunk.
do I need to make a getHandlers method?
I feel like you'd have to rewrite the whole BlockPistonEvent and register it as a custom event (which includes adding a handlers method) But tbf would probbaly better off using the retract/extend events instead
Yeah BlockPistonEvent has no handler method by default so you'd have to implement that yourself
nms
im updating someone else's plugin who has since left the dev team so im just trying to update some of these old methods for 1.20.6
are these real events?
declaration: package: org.bukkit.event.block, class: BlockPistonExtendEvent
declaration: package: org.bukkit.event.block, class: BlockPistonRetractEvent
Hold
nice thanks
With some digging you might be able to find 1.20.6 packets here
wub
ClientboundLevelChunkWithLightPacket IS the 1.20.6 packet
it's just
the method to get LevelChunk has changed
it used to be you could getHandle from a craftworld chunk
This is why I recommend just using a lib for packet work haha, you get proper docs rather than hunting through nms code
What is the diff between playerHarvestBlockEvent and BlockBreakEvent
- PlayerHarvestBlockEvent
This event is called whenever a player harvests a block.
A 'harvest' is when a block drops an item (usually some sort of crop) and changes state, but is not broken in order to drop the item.
This event is not called for when a block is broken, to handle that, listen for BlockBreakEvent and BlockDropItemEvent.
...
- BlockBreakEvent
Called when a block is broken by a player.
If you wish to have the block drop experience, you must set the experience value above 0. By default, experience will be set in the event if:
The player is not in creative or adventure mode
The player can loot the block (ie: does not destroy it completely, by using the correct tool)
The player does not have silk touch
The block drops experience in vanilla Minecraft
Note: Plugins wanting to simulate a traditional block drop should set the block to air and utilize their own methods for determining what the default drop for the block being broken is and what to do about it, if anything.
If a Block Break event is cancelled, the block will not break and experience will not drop.```
Ok thx
.
Is the BlockBreakEvent only for player or with creeper and stuff?
BlockBreakEvent is called any time a block is broken by a player
ty
**Random random = new Random();
int randomNumber = random.nextInt(100);
if(randomNumber <= 0.1){
e.getPlayer().getInventory().addItem(new ItemStack(Material.DIAMOND));
}
**
Is this great way for probability?
its the bound
right
so a number between like 0 and 100
and you want it to be below or equal to 0.1?
i.e. when its 0
Less than a 1% chance btw
yes its 1 in 1000 chance
No
its an int
its 0 1 2
It's 1 in 100
not .1 .2
so i just do Random random = new Random();
double randomNumber = random.nextDouble(100);
Why the fuck are you comparing an int to a double
There isn't
A fuckin
Next double
just make the bound 1000
yeah or that
there is
int randomNumber = random.nextInt(1000);
if(randomNumber <= 1){
e.getPlayer().getInventory().addItem(new ItemStack(Material.DIAMOND));
}```
With an int argument?
Or whatever argument
work fine
The fuq is thag
yeha its just implicit cast
What java version
last one
22?
22?
oh 23 came out finally?
21
ah right
No idea, but I already read the source code of some of it's classes
yes, if you are using them for double arguments
That's not the point
Well considering that 100 is defined as a double in random.nextDouble, that implies it's actually 100. ...
Right?
Bruh there'll be Java 25 in 2026
Or so they say
23 in september this year
is this better way? double randomNumber = random.nextDouble();
if (randomNumber <= 0.1) { // 10% chance
e.getPlayer().getInventory().addItem(new ItemStack(Material.DIAMOND));
}
Well it does work
also use codeblocks for code, not bold markdown xD
But I'd do random.nextInt(10) == 0
yeah forgot how to do it
ok thanks
made this function is this better public boolean probabily(int chance, int totalProbability) { Random random = new Random(); int randomNumber = random.nextInt(totalProbability); return randomNumber < chance; }
This looks nice for reusability, also a stateless function so you could make that static
I don't quite understand Im new to java
basically a stateless object is something that doesn't hold/store data
That function you have is stateless because it just returns you a calculated result, theres no storing of data here
i have a question how can i use getConfig here to get the String List "unsafeBlocks"
public class rtp /*extends JavaPlugin*/ implements CommandExecutor, Listener {
private final HashMap<UUID, Long> combatLog = new HashMap<>();
private static final long COMBAT_COOLDOWN = 10 * 1000; // 10 seconds
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
Bukkit.getLogger().info(ChatColor.GREEN + "Hugo rtped");
World world = player.getWorld();
Random random = new Random();
int x = random.nextInt(10000) - 5000;
int z = random.nextInt(10000) - 5000;
int y = world.getHighestBlockYAt(x, z);
Location randomLocation = new Location(world, x + .5, y + 1, z + .5);
player.teleport(randomLocation);
List<String> unsafeMaterials = plugin.getConfig().getStringList("unsafeBlocks");
Block generatedBlock = world.getHighestBlockAt(x, z);
Block higherBlock = world.getBlockAt(x, generatedBlock.getY() + 2, z);
if (unsafeMaterials.contains(generatedBlock.getBlockData().getMaterial().name()) || unsafeMaterials.contains(higherBlock.getBlockData().getMaterial().name()))
;
}
return true;
}
}```
Hello! If anyones here im having trouble with trying to Run a command in my Code if anyone could help me please let me know so i can give more information!!!
I can help if not too hard
here is good
You already have it?
so im writing a Hide and seek plugin
yeah
and im trying to make it so when you are a seeker and when the seeker is tagged a command is ran
and i cant figure out how to run the command ill send what i have
how do i send it in the code format like above?
use triple `
if (players.contains(player)) {
players.remove(player);
if (seeker == null) {
seeker = player;
player.sendMessage(ChatColor.RED + "You've been tagged! You are now a seeker!");
// Run command to morph player into Freddy
Bukkit.dispatchCommand(seeker, "/mpm1");
// Run command to morph player into Freddy
Bukkit.dispatchCommand(seeker, "/mpm1");
// Remove blindness and slowness effects from tagged player
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.removePotionEffect(PotionEffectType.SLOW);
player.setWalkSpeed(0); // Prevent movement
} else {
seekers.add(player);
player.sendMessage(ChatColor.RED + "You've been tagged! You are now a seeker!");
// Remove blindness and slowness effects from tagged player
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.removePotionEffect(PotionEffectType.SLOW);
player.setWalkSpeed(0); // Prevent movement
}
// Spawn red firework explosion
spawnRedFirework(player.getLocation());
// Transform the player into a different skin
transformPlayerSkin(player);
}
if (players.isEmpty()) {
endRound();
}
}
uhh
oops
so what is the problem
send the command code
being this part
// Run command to morph player into Freddy
Bukkit.dispatchCommand(seeker, "/mpm1");
// Run command to morph player into Freddy
Bukkit.dispatchCommand(seeker, "/mpm1");
is this your command code?
Yeah
im trying to get a regular like command to play
like from the minecraft game itself
did u implements CommandExecutor in the class
yes i believe so
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
??
Why are you using dispatchCommand? Is it not your plugin?
no its like public class HideAndSeekCommand implements CommandExecutor {
no it is my plugin
i was looking up how to execute commands in the plugin i only know VERY basics
hmmm let me check
why are you using dispatchCommand? its yoru own plugin so just call the method
No i dont think so
how do i do this???
teh same as calling any method
just use the method onCommand with CommandExecutor
Alright let me try this
Yeah somehow i cant do it with plugin.getConfig i get an error saying java:cant find symbol
show me your folder tree
send me the command code
Its a modded command but i shortened it with a plugin
show me the code of it
modded?
The command is /mpm1
which makes this command run
/morph Skiylix blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}
it used to be like @p & @s
morph is not your command/plugin?
the MORPH command is from the BlockBuster mod, HOWEVER im trying to get the command to run everytime a player is tagged
dispatchCommand will not trrigger a mod
forge
show me where you shorten it
I shortened it with another plugin called MyCommand
so it says this
command: /mpm1
type:
- RUN_COMMAND
runcmd: - /morph Skiylix blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}
but when i run the command ingame it works perfectly fine
I smell cursed hybrid
Im sorry! can i not ask for help if im using mods? (this is a serious question)
you can
but dispatchCommand will nto trigger a mod as it never leaves teh spigot command system
ouuu okay okay
is there another way i can get the command to be used?
when you use the command in game you do only /mpm1 or /mpm1 playername?
just /mpm1
but thats to run the shortcut
so this command
/morph Skiylix blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}```
i need to clarify the player which would be the seeker
when you shorten it does it do /morph @s ?
Yeah i can do
/morph @s blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}
ok breh then simply do Bukkit.dispatchCommand(seeker, "mpm1"); instead of Bukkit.dispatchCommand(seeker, "/mpm1");
kk
remove the /
is there any way to prevent wheat from growing? is there a crop grow event or something?
hmmm it doesnt seem to be working
where do you call your tagPlayer?
This?
public void onPlayerTag(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
Player damager = (Player) event.getDamager();
Player damaged = (Player) event.getEntity();
yes but show the full eventHandler
public class PlayerTagListener implements Listener {
private final HideAndSeek plugin;
private final StartGameCommand startGameCommand;
public PlayerTagListener(HideAndSeek plugin, StartGameCommand startGameCommand) {
this.plugin = plugin;
this.startGameCommand = startGameCommand;
}
@EventHandler
public void onPlayerTag(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
Player damager = (Player) event.getDamager();
Player damaged = (Player) event.getEntity();
if (startGameCommand.isGameRunning() && startGameCommand.isSeeker(damager) && startGameCommand.isHider(damaged)) {
startGameCommand.tagPlayer(damaged);
}
}
}
}
show me the full startGameCommand class
the entire thing?
BlockGrowEvent
Iirc
yup found it, not sure why I couldnt lol
Theres some things in the code that have stopped working that im going to try to figure out after, but my main problem right now is trying to get the skins to change/ the command to run after the seeker tags a hider 🤦♂️
private void transformPlayerSkin(Player player) {
// Example command to morph player into a custom skin using /morph command
String command = "/mpm1";
// Dispatch the command
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
}
same remove the /
kk
and what is your command to start the game?
have you registered it in the main class?
the command?
yes
Yeah
what happens when you do /stratgame then?
it starts
everything works perfect
when i tag them they wont change skins
or the command wont work basically
any console errors?
its been saying only the ./help recently
so i just removed the last / so im gonna try it again now
ok
still doesnt work
but im getting this everytime i tag someone
[20:15:33 INFO]: Unknown command. Type "/help" for help.
what does it says befor that like [02:16:23 INFO]: Player issued server command idk?
Nope
[20:15:21 INFO]: Skiylix issued server command: /startgame
[20:15:21 INFO]: Skiylix is the seeker!
[20:15:31 INFO]: The hiding phase has ended. Seeker is now seeking!
[20:15:33 INFO]: Unknown command. Type "/help" for help.
[20:15:38 INFO]: TestingA is the seeker!
it starts a new round after i tag someone cause its just me and testinga lol
u sure its the right command
i can try the specific one
the longer one and see if it works?
because its going thru the plugin then using the command
maybe if i just try the command now
in here```private void transformPlayerSkin(Player player) {
// Example command to morph player into a custom skin using /morph command
String command = "mpm1";
// Dispatch the command
Bukkit.dispatchCommand(player, command);
}```
try that
Put it there?
replace it
@s doesnt work
[20:21:28 INFO]: The hiding phase has ended. Seeker is now seeking!
[20:21:29 INFO]: Entity '@s' cannot be found
[20:21:34 INFO]: Skiylix is the seeker!
send me back the long command
/morph @s blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}
Am I looking at a command block rn?
try that
Bukkit.dispatchCommand( "morph " + player +" blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:"b.a:fred/skins/AaronBase.png",Scale:0.97f,Settings:{Hands:1b}}");
kk
do i replace the string command? or the dispatch the command
or Bukkit.dispatchCommand( "morph " + sender +" blockbuster.fred_3d {Hitbox:{Eye:0.9f,Sneak:1.65f,Enabled:1b,Height:1.7f},Skin:\"b.a:fred/skins/AaronBase.png\",Scale:0.97f,Settings:{Hands:1b}}");
do both
You’ll want to use getName
kk
yeah so use sender instead
i changed the string command but i cant change hte dispatch the command one
OMG
IT WORKED!!!
nice
congrats. I didn;t expect dispatchCommand to work, the same as it won;t work on a Bungee server
the dispatchCOmmand only runs any command as a player
yeah but it never leaves the server, which is why it won;t trigger Bungee plugin.
bungee server no
its not coming from teh client so Bungee never sees it
but its a forge mod
nice
thank you sooooo much!
btw dont use gpt next time
LMFAOOO ik it messed up some of my stuff i did
Yeah its kinda ass
facts
what’s the best way to do custom items? is it PDC? serializing and storing in a config file? mainly just checking what item is what ya feel me?
pdc
pdc
pdc it is, thanks a lot
Pdc
Yes
Im as sure as you are keeping up with roblox streams
@vagrant stratus question about resource posting rules, I'm making a free plugin that among other things autohosts resource packs on my dedicated server, I assume this doesn't run afoul of any resource rules and I should be fine even if I eventually paywall this specific feature behind a subscription if I run out of server capacity to do this? (I don't want to paywall it, but might not have a choice beyond some point)
why not host of github or smth like it
I wouldn't know how to do it, nor do I particularly think that would be an allowable use case of their servers
no
it's putting potentially thousands of zipped resource packs the then distribute to tens of thousands of people
I don't today but I don't plan for failure
unless the plugin is about hosting resource packs I guess
it is, it's a resource pack manager
okay
it automerges and autohosts
I thought you just had a resource pack for your plugin haha
that kinda changes my answer lol
but then yeah
I think it should be acceptable to do what you said initially
I guess the best answer is gonna come support
?support