#help-development
1 messages ยท Page 1020 of 1
if (busca.fijado.containsKey(k.getUniqueId()) && busca.fijado.get(p.getUniqueId()) == 1) {
System.out.println("Se ha detectado un jugador en busca y captura.");
main.getEconomy().depositPlayer(k, 100);
new BukkitRunnable() {
@Override
public void run() {
busca.iniciarWanted();
}
}.runTaskLater(main, 160);
busca.quitarHash(p);
}
Hello :D, I im trying to get a simple npc to working but its always sayes Caused by: java.lang.ClassNotFoundException: net.minecraft.server.level.ServerPlayer when i try to spawn it. I use 1.20.2 Spigot
Based on what you've told us, according to my professional opinion I would say that
It is broken.
And that's why it doesn't work.
๐ how can i repair it or get it working
Have you tried reboting your computer?
๐ no i dont restartet my pc yet
The issue is of course that no one can help you with that amount of information.
It's like asking "Why doesn't my car start?"
my server is 1.20.2 the file is called spigot-1.20.2
and i got it from the build tool
ok ill delete my server and make the server again my that works
There's really a difference?
Does nothing happen when config is null when using ::?
I would expect the lambda to consume the error
Does anyone know how to turn these numbers into ticks?
{ "predicate": { "time": 0.0000000 }, "model": "item/clock" },
{ "predicate": { "time": 0.0023330 }, "model": "item/clock_01" },
{ "predicate": { "time": 0.0046660 }, "model": "item/clock_02" },
{ "predicate": { "time": 0.0070420 }, "model": "item/clock_03" },
other way around
public class Test {
static class Config {
boolean isValid() {
return true;
}
}
public static void main(String[] args) {
Config config = null;
try {
Runnable lambda = () -> config.isValid();
System.out.println("Lambda 1");
lambda.run();
System.out.println("Lambda 2");
} catch (NullPointerException ignored) {
}
try {
Runnable methodReference = config::isValid;
System.out.println("Method Reference 1");
methodReference.run();
System.out.println("Method Reference 2");
} catch (NullPointerException ignored) {
}
}
}
This will only print "Lambda 1"
yep, lambda blows up with an NPE on teh class instance where a method reference blows up on method access
i tried to update node, but it looks like something is not letting the updated file in /etc/profile.d to be executed
when i do source /etc/profile.d/nodejs.sh the path is added, but then i get 2 versions of node in the $PATH
where can I find paper's source code?
the changes they made to craftbukkit
cuz my unholy magic
breaks paper
but not spigot
paper issues brah
?wherami
wher
missed an e
?whereami
show us ur code
well it's complicated
ok
and spread out a lot
maybe re-organize it
to then show us
ive dealt with a lot of the craftbukkit changes
paper did
it's well-structured
ok
Generally things to look out for is when you are attempting to find fields by name and find subclasses by name.
and prevents players from being added into any of them if they're unverified (not logged in, unregistered, captcha not completed)
this works
the thing that doesn't is when the player joins
@alpine urchin getting ready eh? haha
yes
Let me know when you are ready, I'm free whenever
cuz I change internals
We agreed in 40 minutes. ๐
I know haha
wait are you actually getting lessons from him
XD
Real
thought it was just a joke smh
like java lessons?
idk
python lessons
๐
Actually asm
brah
More OOP concepts than anything
But yeah it's over java haha
And some packet lessons as well
so retroop
no idea here
?
If only there was a hottub ๐ฆ
Help me understand the significance of the tick values on the right side in this data:
https://pastebin.com/LbBYP45h
They are weird.
could someone help me with coding this lockout plugin
i got the plugin from https://www.spigotmc.org/resources/lockout.112607/ and ive added a bunch of objectives already
but im new to coding this stuff and im trying to add an objective that is obtained when someone gets an advancement
Are you new to java?
So you're just needing to learn spigot api for the most part?
yeah
ive probably put 5 hours into just trial and error on this if u could help me thatd be great
this is kind of what ive been messing with
Reason I'm asking is because you're not going to get like "help" with the plugin, rather just on particular problems, so my suggestion is to take to the jdocs and come back if it's a particular issue
yeah
this is a particular problem
What's the issue then?
You could ask Google Gemini for help.
im trying to get it to detect when an advancemtent is completed
and give the player a point
this
?paste more code
i think somethings wrong with the return, the method isDone might not be right?
And any errors
.
this is with the advancement code taken away
just the running code for lockouts that i play with
Gpt said its lua
oh ok
mmm
thanks lemme look into lua stuff ill come back if im still having issues
unless someone knows lua
I only know java haha
same
Well I know lua as a language
is there like lua wiki or something
Ru trying to learn lua, or whatever library uโre using w lua?
I'd just write that plugin yourself then kek
.
its so much work to rewrite it all in another language
but maybe ur right
yeahhhh but idk
idk who wrote it originally or anything
Write it in java
why
the hell
does paper have a 7z file
in it's source code
AND IT'S TITLED SERVER-1.20.4.JAR
Do you know anything about the spigot api btw?
not much
Do you know how to handle events
just went through the wiki for a while trying a bunch of stuff
yeah the plugin already had some playermoveevents and stuff so i just replaced those with playeradvancementdoneevent
and the other one
public class SomeClass implements Listener{
@EventHandler
public void onAdvancement(PlayerAdvancementDoneEvent event) {
// Do some stuff
}
}```
just to be sure you do this yea?
That's amazing
@ivory sleet
Except for the name convention
do you know where I can find the paper implementation of the PlayerList class?
well, I assume you use paperclip or like yk, either fork paper, or use paperweight gradle plugin to get the dependency in ur project
another problem i had was getting the advancement id
like would it just be for example, Advancement.SNIPER_DUEL
?
event.getAdvancement() gives you and Advancement object
That thing is Keyed so you can call getKey() on it which yields a NamespacedKey
I assume you wanna check which advancement was just done?
well thats step one ig
well I think a simple if statement should do the trick
We like to do guard clauses here :p
Yea well if the event callback grows then its appropriate to consider keeping indentation levels low
i tried returning the boolean isDone
fair enough
but idk where to implement the actual advancement
sorry btw im super new to lua and bukkit
snap now I forgot
What's the name of the advancement? Can't you get it by string (name)
one i was trying to do was sniper duel
in 1.18 its like snipe_skeleton or something but 1.20 its sniper_duel i believe
There's #getType() but I'm not sure if that'll get you the actual advancement
I haven't done really anything with vanilla advancements, just my own quests system
?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
is it possible to rotate display entity around some axis?
yes
Wait whaa show me some code
Wait I thought u switched over to a java plugin
cuz I have no clue how that plugin handles java to lua interoperability
Does the plugin dev have any discord or something such that you can contact em?
good idea i could look
Ask paper
can't
They have forums too
?whereami
they banned me
lmao average paper
Shouldnt have gotten banned then
then your on your own
If you are not careful you may end up banned here too
switch to Spigot for a better experience trust
nobody asked you
@grim hound ^^
damn hostile
I mean usually people aren't banned for no reason
I'm nowhere near hostile with that statement
and more crash exploits then i can count okay to be fair i can only count to 3 but still
The Minecraft community has legendary level of toxicity.
We accept PRs
you acting like paper doesn't have them as well
lost some fingers and toes in the war? ๐
I'll check it out, thanks
paper on it's way to break half of the vanilla mechanics for "performance":
isnt that on spigot too also a bit? ๐ฅฒ
well I mean
paper outright breaks things
spigot doesn't do that as much
I presume thats true
Yeah not very much I dislike how spigot deviated from vanilla in some places but that was decided by the OG bukkit team
They chose to deviate on stuff long ago
yea true
I've not played vanilla enough to tell the difference
basically
technical & redstone related changes (usually you don't see as much of an impact if you're not using automation)
they do but not as many as spigot does and they usually get fixed rather quickly
Mfw
I can't use half of the technical redstone builds
Mfw
Paper applies insane defaults
Mfw
Paper feels like releasing untested builds
I can go on
want me to go on?
for redstone ppl id would go with something like fabric anyways
they fix exploits?
eh I feel like we get ur point ike
hol up I'm still googleing Mfw
Fabric is a good alternative
well that's interesting
"My face when"
then why do incorrect packets still throw errors?
player just sends a fucked up packet
the server panicks
and you can easily crash it with that
it's paper, they "fix" "issues" that nobody cares for
why can every 11 year old just packet spam your spigot server to death?
maybe we could at least move this paper debate to general? :^)
I'm asking why paper has that exact same issue
xD
Yes. And I hate Java!
awie
I love it tbh
didn't see your message sorry^^
I was just trying to join the conversation.
allg ๐
fair
man what did Java do to you?
now help me rewrite the JVM
i swear to god if now some kotlin maniac comes around and says "no, we don't have these issues here kotlin is way more better you just can't read that shit"
lol
real
hello

I would jump at the chance to use C# with Minecraft.
look at this function signature ๐
private suspend inline fun <reified T> downloadAndParse(
crossinline downloadCallback: suspend BackendAPI.() -> Response<ResponseBody>,
crossinline inputCallback: suspend (InputStream, String) -> File
): Pair<T, File>? = coroutineScope {
i have been summoned
It looks fun.
it's actually even more fun, this is an old snippet
ngl java would look way worse
Suspend fun
actually!!!
chatgpt
public class MyClass {
public interface DownloadCallback {
Response<ResponseBody> download(BackendAPI backendAPI) throws Exception;
}
public interface InputCallback {
File process(InputStream inputStream, String string) throws Exception;
}
public static class Pair<K, V> {
private final K key;
private final V value;
public Pair(K key, V value) {
this.key = key;
this.value = value;
}
public K getKey() {
return key;
}
public V getValue() {
return value;
}
}
public <T> CompletableFuture<Pair<T, File>> downloadAndParse(
BackendAPI backendAPI,
DownloadCallback downloadCallback,
InputCallback inputCallback
) {
return CompletableFuture.supplyAsync(() -> {
try {
Response<ResponseBody> response = downloadCallback.download(backendAPI);
InputStream inputStream = response.body().byteStream();
String contentType = response.headers().get("Content-Type");
File file = inputCallback.process(inputStream, contentType);
// Assuming some method parseResponse to convert InputStream to T
T parsedObject = parseResponse(inputStream);
return new Pair<>(parsedObject, file);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
private <T> T parseResponse(InputStream inputStream) {
// Implement the logic to parse InputStream to T
return null;
}
// Define BackendAPI class or interface as needed
}
exactly thats what im talkin about
oh god
Holy cow
I'm on my phone so I don't have access to the actual code rn but it defo looks simpler lol
gradle ez
here
"paperweight" is supposed to be a var but it ain't defined anywhere
the hell
hi nerds
paperweight is an extension from the userdev function
if you use groovy gradle it wont have intellisense if you use gradle kotlin it will
uhhhhhh
hi serverbooster
I think I chose groovy on project creation
do I remake it?
it exists and only contains the name info
thats correct just make sure its file name is correct
gradle sure takes its time on reloads
its downloading paper and patching the server
or well downloading the dev bundle, extracting it and patching the mc server to give you nms
oh nice
normally a reload wouldnt take more than like 10-15 seconds
yooo it even deobfuscated the file
damn, now that's a hassle
this number can't be negative
it relies on the fact that at least one player must exist (since they just added him)
and I prevent that from happening
damn
and I absolutely need to do that
XD
troooop
@alpine urchin your favorite person is back
@wet breach u were one of my favorites too dont forget that
no lmao, he doesn't like me at all
@celest wadi what possessed you to come back
lost my life again
you could have lived a happy life, yet you came back anyways ๐ฅฒ thank you for your sacrifice
yup yup ofc! my duty
u any good at csgo?
uhm no
oh then let us play together sometime
this is how you know they are not from russia
lol fr. I was playing wingman with my friend the other day we played against someone with a russian name. It was over before it started :(
lol
however as much as I want to say a good lot of them have skills unfortunately most turn to cheating just like the chinese players do XD
my current project is an injector for cheats
wow that's great!
not to plug (it dont even work yet) https://github.com/imajindevon/zofia
don't these cheat injectors gotta work at like ring 0 kerenel level
pretty sure that's when most ACs start nowadays
yea well for bigger games this wont work unless i detect AC threads and bypass their methods of detection
the man module works for some bigger games
i will write a kernel driver in the future, its supposed to be really easy with rust
unless it installs a driver or something similar in the system it can't start there
the one I think of off the top of my head, well 2. Is genshins anticheat and vanguard
though I believe vanguard is more infamous
yea i thought i heard vanguard was kinda shit
well yeah anti cheats are just a horse race pretty much
the only way an anti-cheat could be good is if it literally hijacks your system and essentially becomes malware
oh my god i thought I'd never see this name again
bio real
no shit lol
almost! 3 times
yeah see, didn't die
i was aware that imajin was present (i think someone sent a roblox profile screenie) but i thought they'd never return to the discord server
Okay, who's disappearing next?
This sounded threatening
dll injector or what?
yup
cool
good to have you back soldier
I am sure villagers ask themselves this too
nothing in particular just a feeling that you would like to know they were back
sounds like a miracle
https://paste.md-5.net/ruzejinopi.rust
not sure why this is failing, i definitely have enough memory allocated
console output, will reduce to .paste ^: ```
[] Image base: 180000000
[] Image size: 21000
[] No. of sections: 5
[] Allocating memory in the target process..
[] Requires base relocation: true
[] Rebasing..
[+] Allocated 20480 bytes of memory at 230A0FA0000
[*] Copying payload sections..
[-] Section .text @ virtual address 1000
Current rebase addr: 230A0FA1000
Max address: 230A0FA5000
Error: Failed to write to target process memory! Address: 230A0FA1000, last error: 299
win32 scary
gotta love microsoft shitting on naming conventions
@wet breach any ideas? sorry to bother ya
i think windows just says fuck conventions but for all the rust code im using lower_snake_case
gotta love pascalcase in rust
i love it
yup
jesus christ
do you know what 299 is?
error for reading protected memory?
no
something like that
dear fucking god
its erroring on partial write because you failed to give a pointer to a buffer of the data you intend to write
what partial write
thats weird because the buffer is being constructed just fine
i gotta be passing it wrong somehow
299 (0x12B)
Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
that is what I said
some advise....
for a thing like
public enum TypeCat {
NONE(-1),
BLACK(1),
WHITE(2);
// THE METHODS AND ETC...
public static TypeCat ofA(int value) {
return switch(value) {
case 1: BLACK;
case 2: WHITE;
default: NONE;
}
}
public static TypeCat ofB(int value) {
for (TypeCat tc : values()) {
if (tc.getValue() == value()) {
return tc;
}
}
return NONE;
}
}
what "of" is "better"?
for extensibilty, id use b
I did forget it could throw 299 on a read lmao
but rarely that ever happens
2nd is better imo
do you know those codes out of your head?
Are you gonna add more constants to that enum?
actually no, I encountered 299 not that long ago
like maybe last year it was
forget what it was I was doing ๐
suffering from win32
but sometimes I do have this stuff memorized XD
where i get the mention (for efficient way) was for a enum like 3 constants... but i see thing like 20 enums with the ofA
ofB is nice if u consider future enum constants
hello, can someone help me with a bug I found in the lootcrate plugin
if only we had TryFrom in java
Well Doc and the option of having a static array or int map that runs in a static initializer caching all the values for later lookup?
Or is that too much
hmm i dont consider that... for context is for comment for things like that https://github.com/Discord4J/Discord4J/blob/master/core/src/main/java/discord4j/core/object/entity/channel/Channel.java#L160
or well a little more expensive thing https://github.com/Discord4J/Discord4J/blob/master/core/src/main/java/discord4j/core/object/audit/ActionType.java#L93
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API. - D...
real man calls valueOf and suffer
Ah alright, but presumably api consumers never have to call the โstatic factoryโ method themselves?
no lol
in that cases if they make a getType or any using that enum call the of passing the data provided by discord
hmm, I mean if thatโs strictly gonna be the policy by intention, I think ofA is nicer, as long as its leaning more towards existing back in the implementation layer, riight??
yeah all the cases are things like that... a enum for types based in the int value or in a minor cases a string value
Yea well thats my opinion on it, ofA is nicer and well somewhat faster, if its not gonna be touched by api consumers, else ofB. :)
thanks, i prefer B for this i wanna more opinions for maybe check if im wrong in just try to put use a less code thing xd
:^)
Can someone tell me why this throws a NullPointerException?:
ItemMeta meta = item.getItemMeta();
meta.setUnbreakable(true);```
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
Well it says that meta is null fsr
Then the item is air
1 Power material is null
2 Power material is Air
Bruh
I'm looking for devs for my MC server, anyone interested? (Coding plugins and scripts) DM me
?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/
What is this
paid services for development
I've finally finished backing up my stuff after like 2 hours
It's 2:30 am and I'm about to install fedora
:o
its going to break
How correctly manage database connection with Jooq and HikariCP?
For example i have this code:
@SneakyThrows
@Override
public int execute(@NonNull String sql) {
return dslContext.execute(sql);
}
@Override
public void createConnection() {
this.dataSource = new HikariDataSource();
this.dataSource.setJdbcUrl(url);
this.dataSource.setUsername(settings.username);
this.dataSource.setPassword(settings.password);
if (settings.properties != null) {
settings.properties.forEach(this.dataSource::addDataSourceProperty);
}
this.dslContext = DSL.using(this.dataSource, getSQLDialect());
if (StringUtil.isNotEmpty(tableSQL)) {
execute(tableSQL);
}
}
Will DSLContext auto close?
Or i need to close connection on plugin disabling?
what dep does it need?
have you tried ultramarine? im wondering if its smth useless or not
cache the data source
i do
you always set it
and you always set the data for it
unless create connection is only called once then its fine
not always man
protected AbstractDatabase(@NonNull Plugin plugin, @NonNull String url, String tableSQL, @NonNull DatabaseSettings settings) {
this.plugin = plugin;
this.url = url;
this.tableSQL = tableSQL;
this.settings = settings;
createConnection();
}
?paste
How to close connection correctly to reload connection?
or i can just create new connection if i need to reload it?
Damn bro you got same time as me
wya?
Exactly 2:50 for me
tried it , but it didn't work ..
Kazakhstan
i'm in central russia
soi they is no maven version that support 1.16.5 < and backwards ?
Hi can anyone help me with my plugin I am coding this is my first kinda big plugin so pls don't judge and don't say How i could tidy it up or put some thing in different classes. So anyway I feel like my test server is getting bad performance with this plugin enabled can anyone see anything obvious that is causing performance issues I think it might have something to do wtih the task scheduling but idk. Thanks
WardenRelics(Mail File): https://paste.md-5.net/rovuxokegi.java
RelicManager: https://paste.md-5.net/qogipeheli.java
Relic Of Travel(An example of one of the relics): https://paste.md-5.net/erayepefac.cs
package me.buster.namethatitem;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class NameThatItemPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
getLogger().info("NameThatItem has been enabled");
}
@Override
public void onDisable() {
getLogger().info("NameThatItem has been disabled");
}
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
String message = event.getMessage();
Player player = event.getPlayer();
if (message.contains("[item]")) {
ItemStack item = player.getInventory().getItemInMainHand();
String itemName = item.getItemMeta().getDisplayName();
if (itemName == null || itemName.isEmpty()) {
itemName = item.getType().name();
}
message = message.replace("[item]", itemName);
event.setMessage(message);
}
}
}
I am trying to make the replaced message have a hovering part to show an items lore
Could I get some help please
I've gotten lost in a lot of areas
what works?
What do you mean?
gonna give you a hint, just sending the item name wont do anything, loop over the recipients and do Player::Spigot::sendMessage with a Component of some sort (see ComponentBuilder)
dunno if theres a newer approach already
Im not try to sound naggy just cus someone pasted a big block of code so just making sure ppl can still see my problem, thanks
oeh no, never extend ItemStack
the server will not give you the same ItemStack instance back (CraftItemStack and stuff), just write a wrapper for it
id say paste that again in #1100941063058894868 if you want some real feedback
is this for 1.20.6? if so, you can't use bungee-chat components
1.20.4
they don't support the new 1.20.6 item format
then you should be able to use the bungee-chat components
should be an example of use on the spigot wiki
I sure have one of the communities of all time
Damn smart and hot?
looks like it was opposite day yesterday
haters gonna hate
in your start script
and #help-server
Xms and Xmx in the start script
Xms = min, Xmx = max
click on the java 1.20.6 ion
i remember use a script in the 1.20.4 version
o mean for the ram
does that mean it uses 0gb ram
java -Xms1G -Xmx2G -XX:+UseG1GC -jar server.jar -nogui pause
programming is so complicated
at least it's not like how it used to be...
programming
^^
make this a .bat file if ur on windows
idk whats the linux one
i did it some times now i remember
y was opnening my server with the java file
1.20.6
XD
to make it linux just remove the pause
.sh for linux
idk if ur being sarcastic
i am
.
i meant the start script
actually why even use an operating system for a server
wait how are you gonna start da server then
@wet breach so the issue was i was writing too much at once, had to write it as a buffer but now im getting an error towards the end of the buffer (998)
https://paste.md-5.net/uyizecafec.cs
[*] Image base: 180000000
[*] Image size: 21000
[+] Allocated 65531 bytes of memory at 1F4337E0000
...
[*] Wrote 4096 bytes.
[*] Wrote 4096 bytes..
Error: Failed to write to target process memory! Address: 1F4337E1000, last error: 998
permissions issue
need to run program as admin
also
you need to wrap WriteProcessMemory() with a call to VirtualProtectEx().
its not always needed, but helps ensures you don't encounter more issues with it
dude everything is working so good except the executor shellcode
nice, I suspect its something simple
yup me too
gonna push this to the repo so i dont lose my progress in the future, you can take a look at the shellcode function if u want
Get the BoundingBox
then?
ok
I also just yesterday completed q particle packet sending optimization
Sending time of 600 particle packets
(Requires PacketEvents)
:)
what does that do tho
You mean PE?
i mean alixsystem
what the flip is that
This is the old look but it looks fine
it's antibot but bots can solve most captchas
For spigot/paper servers
Yeah, so am thinking of making another type
But nothing I found online bypasses this yet
is this a 0 or an 8
Cuz bots don't use graphicals
9
dead srs?
Txw96
i couldn't eveen solve that...
Like I said
ah
Since I have no recent screenshots on my phone
the mc ones maybe, however I doubt anyone would want to make and maintain a bot that could read it visually
Yeah I meant those
not that it would be hard
all that needs to be done is to take a screenshot and then look at the pixels
I don't exactly know how to make an unbypassible captcha
Ye
But that's expensive
just make them solve a puzzle that requires moving
And bot attacks are possible because you send a lot of non-expensive bots
as long as you have enough puzzles and routinely change them out or alter them
I thought of like
you can't really make a bot to automate it
So 16 maps
Or maybe I could add more
I thought of making the same captcha as github
Like "point these two in the same direction"
But how am I supposed to generate high-quality, random 3d objects?
Not to mention that bypasses for that are probably already present
Hi guys, coding another plugin. This is my first time using packets. It is not working at all, I just need a push in the right direction. I've been googling and watching tutorials all day and sadly many are outdated. Does anyone have example code I could look at? I am trying to make chests open silently and without animation if the player is vanished. I can show what I have if anyone's interested, but at this point I could really just use an example snippet. Thanks!
You could just cancel event and get the inventory from block
No need for packets i guess
Yes, I just want the vanished player to be able to edit the chest and at the same time as other players.
I heard that doing that without packets dupes items.
Yeah the inventory isn't updated
What have you tried so far and at what point isnt it working?
So, I literally copy-pasted a tutorial code into my plugin and even that doesn't work. Absolutely nothing happens when I open/close the chest and nothing shows in console.
Would you like to see my code?
I double checked that protocol lib and my plugin are indeed enabled and up to date :/ so I think I'm missing something at the beginning of handling protocol lib such as creating the manager incorrectly or something
here we go
https://pastebin.com/BxJeUiTp
Use PacketEvents
There's no reason to be using PL with PE around
show your main class
Does someone have any resource on making npcs in 1.20.4 the most easiest way
since the protocol changed in 1.20.2 the old method doesnt work
Just use Citizens
does anyone know what the fuck these letters mean
surely its not the obfuscated packet names
the logger wouldnt do that to us would it ๐ญ
Probably
(๏พเฒฅ็เฒฅ๏ผ๏พๅฝกโปโโป
even though its obfuscated packets, the fact that wiki.vg has this stuff documented makes it easy to know what is what
i mean im just using the obfuscation mappings
in fact I believe they even have a bot that helps with updated versions
they also have a discord
but im not following the mc login sequence im trying to implement it
So, I need some help with something. I have to create an enum class like EntityType, but the values change based on the files in the folders. How can I do that? Actually, I don't even think it's possible. I'll give you an example: in a folder, there's a file called try.yml and another one called join.yml. The player can create a file in-game, which will then be added to the list. Each enum is the name of the file.
enum is immutable
discord helper registry when
OK, but how do I implement it? Let me explain. I am creating a gui with pages using Foundation, but it requires a T parameter, because pagination is automatic based on how many items make up the gui.
In simpler terms, you can use a List :p
Well yeah
Or a Map<String, YourObject>
thats not a list
Whichever you need
Or a set if thereโs no duplicates!!!!111
Have you considered a Queue?!?!?
Best I can do is Dequeue

someone chuck People.get("ebic_dev").kill in a q pls
Real Deque users would know it's a Deque
its not a deck is a de-queue
dont care
Which you would know if you're a true Deque user
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Deque.html
The name deque is short for "double ended queue" and is usually pronounced "deck".
Get it right noob
i said javadocs wrong
For a long time I though queue was pronounced q-wen
...
wrong channel
Your message is in #help-server you're fine :p
no one ever answers
Maybe nobody knows the answer
you asked 1 minute ago
Or that lol
I had asked yesterday already
it's not a hard question. People are just too lazy
no one here is paid to answer the questions
Too lazy to do what, google it?
You could also google it
Idk why you assume we have the answer but just donโt want to share it
are you telling me we dont know every spigot plugin in existance
If it's not a hard question... why can't you figure out the answer yourself? 
I was thinking a server made for help like this has people that know stuff
I was not able to find anything. The question itself was able
We mostly know programming stuff
choco is a hypixel dev
I dont
the thing is I want to learn
Im literally working on that right now...
I can give you some hints depending on if you want multi-version support, use NMS or ProtocolLib.
i wanted to ask why i get a difernet color then the color i gave
button.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tptoggle"));
TextComponent text = new TextComponent(" ยง7or type " + ChatColor.of("#2F6EFB") + "/tpaccept " + p.getName());
ptp.spigot().sendMessage(button, text);```
at the normal .sendMessage() it works
NPC's are annoying as Mojang keep changing the constructor for ServerPlayer
Yeah true. But what really bothered me was that i had to spoof the connection for the player info packet -.-
in current version yeah
i get this color but the color code is different
also all the damage stuff seems to have moved. Not bothered looking for it
like DamageSource.isBypassArmor() no longer exists
sure, I tried it many times and just gave up but now I actually want to make it work
pls help ๐
If you are going to be using legacy color codes like that
You should use TextComponent.fromLegacyText
okay ty
Or just use components properly :p
It bothers me that PotionEffect has no static deserialize method -.-
Sending an NPC that does nothing should be quite simple. All you need to do is send 2 packets.
- The
ClientboundPlayerInfoUpdatePacket - The
ClientboundAddEntityPacket
After that you have an NPC standing around.
yea when I started working with 1.20.4 i was like why do i have to create a dummy connection now -_-
be the change you want to see in the world โจ
so in the picture u can see that the 2 chat bubbles with 1 line of text have the same amount of spacing between them, but when a player types something longer the chat bubbles spacing isnt the same, i want the spacing to be the same between all chat bubbles no matter how long it is and idk how to really fix that ive been stuck for like an hr now
you are probably not counting lines corretly so your multiplier is wrong
the lines are correct i have smthn broadcasting it and its right
Hey, I'm trying to cancel the ServerboundContainerClickPacket, the issue is whilst the packet is theoretically being cancelled, it doesn't quite act the way I want it to act. My goal is to make sure that when I click on an item, instead of picking it up, it will go back to the original spot same way as when cancelling the InventoryClickEvent
This is what actually happens when I cancel the ServerboundContainerClickPacket:
https://imgur.com/GO36rGs
If anyone has any suggestions please let me know
I think you need to update the client manually
I would check to see what CraftBukkit does when the event is cancelled
As in sending the client a different packet for that?
The packet youโre canceling is only sent to update the server
Because I am using the chest just as an example, the real inventories I am working on are made from packets, so event listeners aren't applicable here
Itll stay the same clientside
So youd need to send a packet to the player to set the inventory contents again
I know, but I get a NPE that says the connection is null
You have to create a dummy connection receiver ( I forget the class name)
Hmm alright that makes sense.
I was trying to fix by opening the inventory again which had the same effect, just kinda felt like a bandaid fix to me
Like coll said, checkout how craft bukkit implements the cancel
I assume they send a packet back
bump
and how would I do that
I'll look into it thanks
not sure how well made this is, but it works for my purposes
public class DummyConnectionHandler extends ServerGamePacketListenerImpl {
public DummyConnectionHandler(MinecraftServer minecraftserver, PacketFlow networkmanager, ServerPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
super(minecraftserver, new DummyConnection(networkmanager), entityplayer, commonlistenercookie);
}
@Override
public void send(Packet<?> packet) {
// empty because we don't want to send packets as this is a fake connection
}
}
DummyConnection just extends Connection from NMS (seems redundant now that i think of it)
public class DummyConnection extends Connection {
public DummyConnection(PacketFlow enumprotocoldirection) {
super(enumprotocoldirection);
}
}
Looks like the spacing is jsut the size of a regular line
Check if the characters are past the overflow threshold then add .5 vertical if they are
Sorry was meant to reply to hanalaz
np
and how would I use this?
setting the field with reflection?
Are you using a ServerPlayer instance to send your packet?
yes
DummyConnectionHandler dummyConnection =
new DummyConnectionHandler(
server,
PacketFlow.CLIENTBOUND,
guard,
CommonListenerCookie.createInitial(npcProfile));
(guard was my npc)
ServerPlayer guard =
new ServerPlayer(server, level, guardProfile, ClientInformation.createDefault());
Then just set the connection of it to a new instance of DummyConnection. Its a public field in ServerPlayer.
my bad looking in the wrong code I am using ((CraftPlayer) player).getHandle().connection;
You can also just set the connection to an existing players connection
yea... thats to send the packet of the npc once everything has been done with it, heres an example from mine. mind you this is right as I was learning spigot so it might be dodgy
serverPlayer.connection.send(
new ClientboundPlayerInfoUpdatePacket(
ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, guard));
serverPlayer.connection.send(new ClientboundAddEntityPacket(guard));

That might be a decent way to leak memory 
does removing recipients from asyncmessageevent prevent them from receiving the message?
yes
Indeed
wait
The set returned is not guaranteed to be mutable and may auto-populate on access
The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
Listeners should be aware that modifying the list may throw UnsupportedOperationException if the event caller provides an unmodifiable set.
The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
Yeah probs the best bet
that's only the case for whenever a plugin calls the event anyway, but plugins creating and calling server events is not supported api
ok cuz #removeIf didnt rly work
every time the server fires that event, it's mutable
Player#sendMessage triggers an event right
no
[17:22:36] [Server thread/INFO]: java.lang.IllegalStateException: Trying to set listener for wrong side: connection is CLIENTBOUND, but listener is SERVERBOUND
Should I set it to SERVERBOUND?
yes
can i see full stack trace? more than likely yes
is it bad practice to save an entity reference in another object, even tho i make sure to delete that object once the netity is gone?
If youโre properly discarding it, should be fine
do you mind showing me your code as well? curious what your npc.connection is set to (once you create dummyConnection you need to set npc.connection = dummyConnection
Is it a key in a map?
public static void create(Player player) {
MinecraftServer server = ((CraftPlayer) player).getHandle().getServer();
ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
GameProfile profile = new GameProfileCreator("NPC");
ServerPlayer npc = new ServerPlayer(server, serverLevel, profile, ClientInformation.createDefault());
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
npc.connection = dummyConnection;
ServerGamePacketListenerImpl connection = npc.connection;
connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
connection.send(new ClientboundAddEntityPacket(npc));
}
no it inside the val
Yeah thats fine gc wise
how do you set long values in config.yml
in here it looks like you're sending the npc the packet instead of the serverplayer, you need to establish the player you want to send the packet to, so
ServerPlayer serverPlayer = craftPlayer.getHandle();
and then instead of connection.send do serverPlayer.connection.send
so like this?
public static void create(Player player) {
MinecraftServer server = ((CraftPlayer) player).getHandle().getServer();
ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
GameProfile profile = new GameProfileCreator("NPC");
ServerPlayer npc = new ServerPlayer(server, serverLevel, profile, ClientInformation.createDefault());
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
npc.connection = dummyConnection;
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
serverPlayer.connection.send(new ClientboundAddEntityPacket(npc));
}
looks correct to me, see if it works!
anyone?
ServerPlayer serverPlayer = craftPlayer.getHandle();
ServerPlayer guard =
new ServerPlayer(
server,
level,
new GameProfile(UUID.randomUUID(), "Guard"),
ClientInformation.createDefault());
DummyConnectionHandler dummyConnection =
new DummyConnectionHandler(
server,
PacketFlow.CLIENTBOUND,
guard,
CommonListenerCookie.createInitial(guardProfile));
guard.connection = dummyConnection;
guard.setPos(
craftPlayer.getLocation().getX(),
craftPlayer.getLocation().getY(),
craftPlayer.getLocation().getZ());
// player info packet
serverPlayer.connection.send(
new ClientboundPlayerInfoUpdatePacket(
ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, guard));
serverPlayer.connection.send(new ClientboundAddEntityPacket(guard));
feel free to refer to this if you need to again, but I've gotta get back to what I was workin on. if you need me just ping me and ill respond when i can
Thanks for the help, but I get the same error.
.
I can't actually find where bukkit implements the cancel, I am probably not looking properly. Could you send me in the right direction please?
I tried looking in the Event class, InventoryEvent class, InventoryInteractEvent class and InventoryClickEvent class
my bad, i missed this part.. when setting the server/level try doing this
// Creating the NPC
CraftPlayer entityPlayer =
new CraftPlayer((CraftServer) Bukkit.getServer(), craftPlayer.getHandle());
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel level = ((CraftWorld) entityPlayer.getWorld()).getHandle();
let me know what that gives you
which one of you did I help with the dummy connection stuff
prob me was like a month ago right?
maybe
why did it seem familiar or somethin ๐
is ConfigurationSection#getLong() broken or something?
no
how do u set long values in yml?
yes this is what im trying to do
but how do u type in long values in yml
you cn set any value and get it as a long
YamlConfiguration#set(String, Object)
Or any number above 2^32 bytes
I think it was actually less becuse of signs
But whatever
Hey, I've got a question there
How do I prevent a zombie (or any monster) from getting sun burn damage?
There's not DamageCause#SUN_BURN
no i mean like in yml I have this
severity-level-value: 604800000
however ConfigurationSection#isLong() returns false
whys that
tehy are not damage by sunlight. That just sets them on fire
ConfigurationSection is for a section in the config not for a value
if you have
section:
severity-level-value: 604800000
you use ConfigurationSection
isLong checks a value
yes?
ConfigurationSection is section in this example
to get a value use YamlConfiguration#getLong()
so what I did is ConfigurationSection#isLong("severity-level-value")
this is an int for two reasons. First it doesn't have the number of digits to exceed an int, second it doesn't have the L or l designation in it to indicate it is a long
but it returns false
^
Just check Integer.MAX_VALUE and you'll notice
As forstalf said
That's an int
wait what so it needs to be large enough for it to be a long?
Or you specify it as "L"
severity-level-value: !!java.lang.Long 604800000
or have L at the end
You can, however, cast the integer to long
^
So you can retrieve any int, as a long value
but that is only useful if what you need it for needs it to be a long
otherwise just fetch it as a int
the best thing I do is fetch everything as string, and then cast to the necessary type ๐
well you can't cast strings to numbers
You can't cast string to int ๐
Use javascript
Integer.Valuof(String)
that's not casting
same error connection is CLIENTBOUND, but listener is SERVERBOUND https://pastes.dev/JSMUwEsE12
public static void create(Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
CraftPlayer entityPlayer =
new CraftPlayer((CraftServer) Bukkit.getServer(), craftPlayer.getHandle());
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel level = ((CraftWorld) entityPlayer.getWorld()).getHandle();
GameProfile profile = new GameProfileCreator("NPC");
ServerPlayer npc = new ServerPlayer(server, level, profile, ClientInformation.createDefault());
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
npc.connection = dummyConnection;
ServerPlayer serverPlayer = craftPlayer.getHandle();
serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
serverPlayer.connection.send(new ClientboundAddEntityPacket(npc));
}
I will have this screenshot to say "frostalf does not know java"
if you want
just check if its a Number and then use Number#longValue
but I didn't mean literally casting
I will have this screenshot in case frostalf pays ZBLL to delete the screenshot
I just meant you can transform the string to whatever type you want without needing to know the type specifically
since everything in yaml is a string
I will have this screenshot in case karmadev suddenly disappears
section.getObject("whatever", Number.class) probably will return a number, and then you can get it as whatever type to want with the various methods on it. Assuming yaml handles boxing correctly
@shadow night save this
right there is other methods, but the main reason I said I fetch everything as a string is because it will never fail as a string
this didn't work
yeah, I don't think thats valid yaml
idk where that is in the yaml spec
that's what you do in java number literals to denote a long, but ive never seen that in yaml
Even if you store a single 1, in the yaml, you can still get it as a long value
it retuns 0
Just it won't be very efficient
yea it gets it as 0
then your path is wrong
^
it depends on the method being used from the api. The yaml spec doesn't say how something must be fetched or how it must be stored
it leaves it to implementation
what method checks that
i logged the path its the same path
your path is wrong
can't you just get it as a string from that and parse it to a long?
about showing some code or debugging
if there is no value at teh specified path it returns 0 as its a primitive
instead of just saying its correct
That's just java developers wet dream
certainly
Anyway, why parsing to long when you can simply obtain it as long?
where in the API does it handle L suffix for yaml? The values are parsed well before anything calls "get" on a MemorySection
which api are you talking about?
Pretty sure snakeyaml stores the Number instance in the yaml data map
You do know there is two right?
the one this discord uses, and that the original question was about
There is Bukkit/Spigot API which adds some methods of its own
yea
and then you have SnakeYaml
severity-level-value: 604800000
String severityString = YourConfig.getString("severity-level-value");
Long severity = Long.parseLong(severityString);
can't you just do this?
The YAML spec says nothing about how how longs are to be stored
or that you can't append an L to the end
as I said the spec leaves it to the implementation
where is that implementation that handles that L suffix then?
you can just type it in teh config (as I showed earlier) or just use getLong
thing is, it makes it complicated. but ill try that one to see if its getLong issue or path issue
show your code and your actual config, we will show you your error
you can type whatever you want into yaml. You said earlier you could just put an L at the end of a number to make it a long. Which of these implementations actually handle that correctly where that isn't just a string
You then have to add a NumberFormatException catch
I was pretty sure the spigot api handled this or interpreted it properly however I could have been mistaken. I haven't looked at SnakeYaml implementation in a while to see if it cares about the L or not
in theory the getLong() method should underneath do a valueOf()
I expected it too as well, I was wrong.
you could add it and ignore it, but either way it makes the code bigger for just a config value
no, it does not. The values are already parsed
it just checks if the object is an instance of Number and calls longValue on it if it is
Just as I said
yeah
parsing isn't the same as changing the type
SnakeYAML stores a map of <string, object> where object is the instance of the value already parsed
as I said everything in yaml is a string
you can call it Object if you want
but its a string
unless its a key, then 1: breaks it ๐
In the yaml file, it is
In the SnakeYAML impl, it isn't
its not reading bytes
so it has to be a string first
that is just how file reading works
key can be a number
you either read as binary or you read as string
so Map<Object, Object>


