#development
1 messages · Page 101 of 1
Coroutines already have an await function
not await for a coroutine, but make the coroutine suspend until I want to resume it later, if you get what I'm saying
You can use a completabledefer
val defer = CompletableDeferred<Unit>()
CoroutineScope(Dispatchers.IO).launch {
println("a")
defer.await(); // waits till defer#complete is called
println("b");
}
println("c");
defer.complete(Unit)
@robust flower
hmm, I'll try this if my experiment using suspendCancellableCoroutine doesn't work as I expect
Does that make any sense? To me, zip wasn't meant for that, but I know practically nothing about the matter, so...
Kinda makes sense
Zip is traditionally for lists but I suppose you could extend the definition
How can i send a player to a server from the lobby? (in a plugin)
PluginMessaging
do i need anything on the bungee for that?
make a for loop of all the json objects and store in a list all the playerName key of the json object
Yes if you don't want to be restrain by this you can you use software such as redis or rabbitmq
I tried this but it just doesnt work:
out.writeUTF("Connect");
out.writeUTF("minetopia");
p.sendPluginMessage(MelonNetworkCore.get(), "BungeeCord", out.toByteArray());```
no errors etc
oh it does work
sorry about that
Get the char.length of the “Heyyy” in this case and take it away from a set value
hey, how can i effectively create mysql table(s) on first onEnable?
What is the best way of tagging a mob for future identification pre-1.14 (yes I know, I also miss PDC a lot)?
??? nice barry
You can use create table if not exists
yes, but if i have like 30 tables i need to do it 30 times and it would take a lot of space so 😄
30 is not a real number 😄
there's no other way mate, accept your fate and embrace the power of IF NOT EXISTS
😄 thanks ❤️
ok so I'm going crazy, any docs, guides, links for making multiplayer using a fabric mod? like essential one, you are on a singleplayer world and u invite your friends, then badabing badabum they are in, or custom servers?
Emily, any chance you've worked on updating that old system for splitting components to use newer stuff in Adventure yet?
useless

No worries, but yeah, would be nice.
Have you tried checking their own page?
no no, like custom servers
forget so
time to google even more
????
tf you mean
"custom server"? what does that even mean?
I could help tho, I know the fabric ecosystem quite well
Guess I won't ¯_(ツ)_/¯
How many spaces it would be if your third option was just nothing so “”
wait a fricking sec
ok so what I was saying with custom server is like that the mod makes the client join a server or so, get it?
what
just
the mod makes the client join a server
I don't understand what you're trying to say with this lmao
I want to make player join other player world
dont know why I went with that explanation
lol
No way (I'm so sorry I didn't mean to reply to this)
lmao
yelp?
either store the UUID yourself, or dive into nms to use NBT if you want to actually tag the entity yourself to just "look it up" on itself
UUID:
Playerdata:
currentInv
Box:
CurrentPage
Arraylist<Itemstacks> #Stored in the yml
Im currently trying to do this and i keep confusing myself trying to do this
also im not sure where to put the hashmap that has this data
forget that, imma go more calm lol
currently just storing the hashmap in my main class but not sure if i should keep it in another class
Its really funky, you basically need to know the pixels of each letter and calculate the distance from there
Sadly idk how to do it but thats the general idea
No idea if this will work but heres an idea:
Have a distance set from the far left to the word on the right. (int)
Check how many characters are on the word on the left (int)
take away the amount of characters from the distance and that maybe the amount of spaces you need.
Again in my head this will look janky but it might work?
I also might be completely wrong with this lmao
https://www.spigotmc.org/threads/free-code-sending-perfectly-centered-chat-message.95872/
This thread might help with the pixel idea (if it is the solution)
That is centered chat messages, but it does go into pixels
that enum class is fucking awful holy shit
note that if you have a custom resource pack with a custom font it might/will mess things up
Or if the client adjusts their chat size lol
perfectly aligning something in the centre is almost never a possibility
People said it works but honestly never tried lol
Yeah i thought of that lmao
sadly ;-;
Yeah thats what I feared, you'll just have to figure out pixels if you want it perfectly
np 😓
You can go off that enum provided in the thread (don't have to really use THAT enum but yk go off it) and do it that way
set an amount of pixels you want in a lore, then go off the enum and do the looping through characters again
Hi! I am sending a message to my bungeecord plugin on the proxy, and it only responds the second time the message is sent. Here is my code: https://paste.helpch.at/nuverekegi.cs. The functions are split between spigot and bungeecord, and the messages are received, just on the second time being sent.
bukkit in a nutshell
Would it be possible to add pathfinder goals to an entity after spawn?
@stoic lance , @finite terrace sent this handy .yml file for getting the number of pixels for each character. @finite terrace, if you want this removed, drop me a dm, and sorry for posting. Jush thought that this is really neat.
Wait, no perms to attach files :/
: )
y'all are welcome to use it
Note that a space is 4 pixels and a bold space is 5 pixels. With that knowledge, you can create pixel perfect formatting.
watch that break with a resource pack 👀
it will 100%
True
if someone uses a custom font, it will not function
well it will function, it just wont look pixel perfect.
If only it could be requested to the client 
PS C:\Users\USER\Desktop\ced\CrashClaim-master> mvn clean build
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< net.crashcraft:CrashClaim >----------------------
[INFO] Building CrashClaim 1.0.18-dev
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.205 s
[INFO] Finished at: 2021-11-16T10:11:13+06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
PS C:\Users\USER\Desktop\ced\CrashClaim-master>
anyone knows whats the issue here
@reef star maven clean install
Anyone know what packet I need to use to make a player invis using potions?
If you know please @ me!!!
give them a potion .. ?
I need it for some players only.
I tried giving a potion and sending a PacketPlayOutRemoveEntityEffect
but it does nothing
I have this feeling that EntityEffect doesn't actually give the effect
since sending that packet only gives me the stupid icon
not actual invis
PS C:\Users\USER\Desktop\ced\CrashClaim-master> mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< net.crashcraft:CrashClaim >----------------------
[INFO] Building CrashClaim 1.0.18-dev
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for net.crashcraft:CrashPayment:jar:1.0.1 is missing, no dependency information available
[WARNING] The POM for dev.whip:CrashUtils:jar:1.6.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.847 s
[INFO] Finished at: 2021-11-16T13:05:42+06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project CrashClaim: Could not resolve dependencies for project net.crashcraft:CrashClaim:jar:1.0.18-dev: The following artifacts could not be resolved: net.crashcraft:CrashPayment:jar:1.0.1, dev.whip:CrashUtils:jar:1.6.1: net.crashcraft:CrashPayment:jar:1.0.1 was not found in https://repo.codemc.io/repository/maven-snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of codemc-snapshots has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
PS C:\Users\USER\Desktop\ced\CrashClaim-master>
Hey guys, Its possible to connect github to a project right? So when you update or save a file the repo on the github page does the same?
Or is that not how it works?
thats were commit and push in git comes in
player.addEffect or whatever
I used PacketPlayOutEntityMetadata
Why are you using packets for invisibility tho?
When you can just do player.addEffext
Ah oke Thanks
now i know where i need to be
👍
Any ideas on how to get the PacketPlayOutEntityMetadata packet with the sender being a Client?
As you can see it isn't listed under play client
But it says it is bound to client here: https://wiki.vg/Protocol#Display_Scoreboard
Which makes sense.
Is it a bug in ProtocolLib or am I missing something?
Please @ me if you have a solution
What's the most efficient way to reduce damage certain players take?
Listen to the EntityDamageEvent and then what? Check if the damaged player has certain metadata or certain data in their PDC? Or is it better to always have a cached map ready that contains player uuid + damage modifier?
daily online time?
as in server uptime? or player play-time per day?
on logout store (date -> playtime) or (date -> login & logout timestamp) as required
Then when you need the playtime for a day, fetch all playtimes from that date for that player and sum it up
or you could store it summed up if you dont have any use for the individual time periods
rdb with following columns => player_uuid, date, playtime
You're tracking the date
You can simply fetch the one for the day you need
There is no reseting
Hello, I'm trying to make a custom work bench but like most of the events dont work, like InventoryInteractEvent or InventoryMoveItemEvent, it just does nothin, debug messages dont work, like nothing works, I went from paper 1.12.2 to spigot 1.12.2 and that did nothing aswell.
I want to make something like /command subcommand args1 args2
How would i get the correct space between args1 and args2
since args in public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { is splitted using \s+ i guess
i know i can simply String.join(" ",args) but t hat simply adds a space between, but the real command has more than 1 space
Listening to player command pre process event is not an option
inventoryclickevent
also inventorydragevent
Could someone help me with this error please
looking at it now it seems like its cus the player isn't even loaded in yet
woops
yeah you might want to use PlayerJoinEvent instead
yw :)
to think i was stuck on that for a few hours lol
And i didn't even see that the player wasn't loaded in
So you want someone to fix your problems rather than actually just compiling?
From what I read it, he wants somebody to compile the plugin them as they couldn't it themselves due to receiving a error whilst compiling said plugin
But someone else would probably get the same result
most likely but if they what they're doing, as in a developer; they could most likely fix it as rather a regular person that most likely never worked/experienced with a build management tool (such as maven/gradle or even possibly ant/artifact (yuck))
Hey all,
Currently in the mist of slowly transitioning my java plugins and libs from maven to gradle, i use jitpack for dependency stuff, rather than self-hosting. I'm facing an issue and not sure how to fix, but Jitpack won't compile.
Error: https://jitpack.io/com/github/heychazza/spigot-plugin-lib/c51cbbf606/build.log
Repo: https://github.com/heychazza/spigot-plugin-lib
jitpack sucks
any good alternatives?
self hosting
apart from self hosting
maven central
Is it easy set-up?
once you have approval I imagine the process of deploying is identical to any other repo
approval is gotten by applying on their jira or something
don't believe it's overly hard
pretty sure users in here have gone through the process
I just wanna be able to easily let people compile my plugins aha
yeah central is the way to go for that
Matt has done it for example
With gradle, can i reference another lib
wym
like with maven you can install and use the same lib in another place
ye
maven local is very anti os
I don't recommend using it in any public projects
but gradle can use maven local too
it doesn't save downloaded dependencies to the local maven repo like maven does though, gradle has its own caches
Oh is it, then will have to try use maven local, just want it to be easy to compile for people
is this for nms?
yeah deploy them to a public repo
don't depend on them through maven local
honestly recommend just self hosting
it's not hard
But I fear the burden of maintaining
there's nothing to maintain
you don't have any obligation to maintain your project regardless of where it's uploaded
reposilite
Why is that so?
If I self host on my machine, do I have to keep my machine on at all times?
Yes?
is there any list of all 1.17 bukkit events?
spigot javadocs
does Spigot/Paper/Bukkit have some type of Global Listener? aka an Event that gets triggered no matter what Event gets triggered?
no
hm okay, another question when having a public abstract class Trigger<T extends Event> { how would I access the value that was passed to T
Lol this brings me back to when JDA had a generic event listener api
well
Types are erased unless you make them not being erased
But if you want the type, maybe use a TypeToken or Class or smtng
Easiest is to just require Class<T> in the constructor tbh
is it possible to prevent git from trying to push gradle checksum and md5 files
add **/*.md5 to .gitignore ?
yeah that just sounds like you have a misconfigured .gitignore lol
How can i check if the egg(a chicken egg) used to spawn the chicken has a customname?
doesn't the entity take the item's name?
it doesnt apperantly
it.. does?
anybody can help me please?
Im stuck on creating custom commands using playercommandpreprocessor event
I wanna do command can change in config.yml file
Probably means an actual thrown egg item
oh right
is anybody familiar with Sponge's Configurate? I am having an issue and they are not responding for the past 2 days
I mean they did say it's a bug
they said likely, but I am sure that if its a real bug someone would've noticed it :/ so I am thinking there might be a different solution
Can't you just use the boxed type? Boolean.class instead of the primitive type class
Boolean.class does nothing, it never adds anything to the Config
Hm
let me try again tho
if it doesn't work looks like i have to use 0 and 1 xD
I have questions... It suddenly works :/
🥲
lol
for?
playing with authentication stuff
I'm working on some cloud system for some of my projects, and I need to authenticate the players that join and so
happy? 
why are you hitting reply to my messages when there's absolutely no one else in the conversation?
sorry I'm used to do so lel

now will stop
please
so?
what do you need to authenticate against what? I still have no clue what is it you're trying to achieve really, and how does authlib fit in this
because authlib is kinda very minecraft specific, not just some abstract authentication library
then what should I use for?
its for making sure cracked accs cant join network
and no minecraft cant do that work in the way I want

when user join network, stats will be provided
and I dont want to have cracked accs on
so using auth, I check if cracked acc or not
and if not, I give back stats
I mean online-mode: true will prevent cracked accounts already
is not for a fucking server arghhh
just main menu stats
gotcha?
But the proxy will be true and you can deny access to not coming from the proxy
also sorry for being rude, I'm tired and I want to have the base of this done asap
so anyone knows what I shoud use?
Any self-respectable "auth login" plugin will make it so Player::getUniqueId() returns the ""true"" UUID; so if they're logged into an account it'll be the actual UUID, and if not it'll be the offline mode UUID
I still don't understand if you're trying to tie this to Minecraft's authentication and/or the player's auth status or is something completely irrelevant to both
I do get it
but
I only have the username, not the Player Instance
yes?
just the username
there's literally no way in hell you can do anything with just the username
the client side mod will send data to cloud for auth and get his stats
thats not what I really meant to say lel
...
you can disguise your username
okay
lol
go answer someone else's questions vaguely
._.
ohhh now I get it
pretty much tired and stupid
stupid as fuck
thx for making me realize thats not I want to use
Oh yeah? If you really get it explain it backwards and in Australian
jesus
H
ok so forget that
Imma just use players UUID for checking if offline mode and also getting data
but is it posible to check if a player's UUID is offline mode and if it is posible how?
I could be wrong but iirc online UUID are v4 while offline are v3
that's true
but it's not a reliable method
or so I've heard
I don't actually know why it's not reliable, but everytime v4/v3 comes up someone says it isn't reliable
afaik people can't generate their own uuids
the server generates the uuid for them based on their username
so I have no clue why that's not a reliable way of determining offline/online
Probably cause legacy versions still use v3. So if you check for a uuid, and get a v3 on a legacy server, you won't be able to tell the difference.
That being said, the easiest solution is to not support legacy versionsn.
Sorry for the ping
1.12 and back iirc
i see
I’m not 100% convinced that’s right
I swear this trick has been around longer than 1.12
not doubting that it wasn’t always the case, just not sure it was 1.12
Maybe. I don't know if v4 was implemented before 1.13 to the best of my knowledge
thing is it’s not like our uuids have changed
That's not true at all yeah
uuids have been around longer than 1.12 and yet my uuid was still v4 prior to 1.12
That's true
I mean UUIDs assigned by Mojang are guaranteed to be v4, they are random generated, also known as: v4
And "offline mode" UUIDs are guaranteed to be v3, because they are "named", they're based on the name, not random, not time-based generated
And "offline mode" UUIDs are guaranteed to be v3, because they are "named", they're based on the name, not random, not time-based generated
no, they're not guaranteed
there's no guarantee when the generation is done server side
There is no generation
..?
there's nothing stopping the server from basing the offline user's uuid on something completely different
or making it completely random
but ultimately it's still server side, so still a viable way of checking offline/online users
the (lack of) guarantee would only effect the client
What you're saying is that it's implementation detail
Which is true, but for ages upon ages on end It's been literally this method https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/UUID.html#nameUUIDFromBytes(byte[]) for "OfflinePlayer:" + playerName as UTF-8 bytes
It's not some internal magic that the server decides how to do it, if at random, if timestamp based or just that
can you what?
nvm that first one
basically if you're running the server people are connecting to, then checking the uuid is a reliable way to see if they're premium or cracked
the check you need to perform is super simple
so for the UUID, how can I differentiate from v4 and v3?
Unless it's a legacy server
I'm not doing the check in the server
is directly pure java
Java can never be pure
that's not got anything todo with what I said
is the server yours?
do you run it?
can you guarantee that uuids are done like this #development message
because if not, then this isn't a reliable method
but basically
you get the 15th character in a uuid (with hyphens), if it's 4, it's uuid v4, if it's 3, it's uuid v3
ok so first I do need to transform the UUID string to a real UUID
then get its version right?
and if it is v3 is offline
and if it is v4 is real player?
In 99.99%+ of the cases yes
Not considering Bob in his mom's basement running a server with a custom authentication server
the only case it isn't reliable is if you don't run the server and can't guarantee that online is v4 and offline is v3

we disproved that
That's not true either
is not server
??
O?
its a mod that connects to cloud, then using some UUID magic I get players data back
and for checking offline mode guys I do so
gotcha?
and yes the mod is 1.12+
wait so you just need to check if the currently logged in player on the minecraft client is online or offline?
yes?
why didn't you just say that???
bruh
that was literally not made clear in the slightest

please, please, be clear next time
where does the uuid come from
and where does the mod get the uuid from
from cloud
…
mod -> cloud
cloud -> mod
so the uuid doesn't even exist
in fact nothing exists in this system
because nothing can get in
apart from hard coded information
And how do you distinguishing between the real Notch account and Bob using a cracked launcher with the username "Notch"?
If all you have is the username
thats what I'm asking
if it is posible to distinguish a offline UUID from a real one
And I told you already you can't do shit with just the username
I'm just making a system for player data using the UUID
Where does the UUID come from?
mod sends username to cloud, cloud gets UUID from api, then checks if offline, if offline does some other shit and if real one get data and send to mod
gotcha?
Deluxechat is support for redis ?
deluxechat doesn't use redis
Cloud gets UUID from where?
Mojang HTTP API?
Or what?
from username sent by mod using the mojang api
I'll repeat it because you won't listen to Emily
You can't do that
How does the cloud get the UUID
Magic
is there any way to help deluxechat use multiple proxies?
from the fricking packet containing the username that the mod sends aaaaaaa
I don't believe deluxechat can work on multiple proxies
Then, again, with just the username you can't do anything
So the mod sends the UUID?
ok so letme explain
the mod will get the client username ok?
then using some packet shit the mod sends the username to the cloud
Sad, i need find another plugin
It sends the username
What is the process the cloud program does to transform username -> UUID?
yes
I'm asking you what is it
Notch logs into his account as usual, mod sends "Notch", Mojang API returns the good UUID because the username exists
I use a cracked launcher and use "Notch" as username, mod sends "Notch", Mojang API returns the good UUID because the username exists
See the issue?
You can't distinguish with just that
yes
thats why I was asking if it was posible to distinguish a offline UUID from a real one
You aren't sending the UUID though?
nope
Re-read my now edited message
Now are the questions?
what can I use for auth?
I dont care if I need to rewrite my fucking packet system, just want to know what I need to do
Is it possible to do something with token? May be speaking nonsense rn, just throwing ideas out there
Send the uuid
sending the uuid isn't an option either
Or you can, like, y'know, make the mod check if the client is logged in and send true/false "it's logged in"
That's too simple
it depends how much you trust the client star 2
if there's no trust then you need to do auth completely manually
good point tho
like get access token and whatever and verify it yourself
yeah
and before u ask I already tried using mojang auth server, I need password
and read the wiki.vg thingy on it
well
figure out how a server figures out if a player is online or not
you just need to do the same thing
I'll try to but I'm pretty sure my brain will fail before I find out how it does that
,
welp, and how?
yeah but doesn't this still rely on trust with the client
How?
I'm fine with it atm
what's to stop a client from modifying the specific method you call to check if it's online, to simply always return true
to check if client logged lol, havent really touched that part of modding
ik ik, but atm I'm fine
I mean then in that case you'll have to do some asymmetric cryptography bullcrap all over the place
But even then you can never be too sure
¯\_(ツ)_/¯
This XD
Or go to sleep
you just knocked out of service my brain's logic part
🛏️
time to sleep
😴
Good choice
⏰
I'll see you tomorrow fuckers
fu
time to replace da brain
school isnt open yet

Is it possible to make a array list of Shaped recipes and then Register that array in Bukkit.addRecipe()?
sure
wait should I give the code of what I did
as long as you add the recipe on plugin enable it's fine
Yes I am doing it
Let me give the code
core.recipe.add(recipe);
This is the code in the class where the item is and recipe variable is the ShapedRecipe
public List<ShapedRecipe> recipe;
public Core() {
this.recipe = new ArrayList<ShapedRecipe>();
}
@Override
public void onEnable() {
Bukkit.addRecipe((Recipe) recipe);
}
@prisma briar
I have just finished java basic course from w3schools... and I have some questions and problems
I started learning more about bukkit api by decompiling other plugins and reading how they work
same for learning java
In this code, this.recipe is added in the constructor for Instance constructor calling right? I just wanted to confirm...
public List<ShapedRecipe> recipe;
public Core() {
this.recipe = new ArrayList<ShapedRecipe>();
}
You need to loop the array list first, and then register it using Bukkit#addRecipe
yes
soo I made this code for "for" Loop
for (int x = 0; x < recipe.size(); x++) {
Bukkit.addRecipe((Recipe) recipe.get(x));
}
no need for fori loop
While My IDE Intelliji Idea suggested me to make it
for (ShapedRecipe shapedRecipe : recipe) {
Bukkit.addRecipe((Recipe) shapedRecipe);
}
yes like that
^ I dont get how does this work? Is it like for Every recipe from array list it will add the current loop
's recipe?
Hm Okay
It will loop the recipe
it's pretty simple actually
for (ShapedRecipe shapedRecipe : recipe) Bukkit.addRecipe(shapedRecipe);
That will make it smaller
also aglerr
In making custom items and gear
How much would u prefer to make seperate class for each item
or a categorized single class with every item falling in that category
Like a Armor class for all of the armor and gear
A weapon class for all kinds of custom weapons
and a Tools class for all kinds of custom tools
Oh you mean like the api's?
and then you want to create 1 class for every custom armor extending the CustomArmor class
No need I am using another library 😛
RedLib
It was more comfortable to use these libraries than make my own
I am first gonna test these after that I will Make my own class for this
you still need to learn inheritance too, so u know what to do
i know little about Interfaces and Abstracts
I know basic but I have not done experiements and learnt them in advanced
@prisma briar Sry for disturbing But My friend who just came on and now is again offline told me after taking a look at the code I wrote that I should instead of Making multiple instances of main class, I should Transfer a pre existing Instance
I don't Get it but does that mean I make instance of a class already using instance of the mainclass to get the instance of the main class?
Are you trying to use your main class on other class?
Yes I have made a ArrayList called key which has to store all of the namespace keys of the Custom items and armor
I have use for it later
so I need a instance of mainclass in the otherclass to Get this key
You need to pass the reference of your main class.
? which message are you referring to right now?
this one
How can I pass the reference, Isnt the only way instances? or static
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
read that
So basically
The client
the Class
which is making the instance of mainclass
I need to pass the instance in it to the other class I need the instance in?
Is this what it means?
wait wait.
basically you'll pass the MainClass reference thru constructor on the OtherClass, with this you can access methods from MainClass on the OtherClass.
Oh I think u misunderstood what I meant
I am already doing that
Its just that my friend said that Instead of Making more instances of main class
In other classes Like OtherClass
I should transfer the already existing Instance of mainclass
show me how you pass your MainClass.
Yes as econd
public List<NamespacedKey> key;
public List<ShapedRecipe> recipe;
public Core() {
this.key = new ArrayList<NamespacedKey>();
this.recipe = new ArrayList<ShapedRecipe>();
}
This is the constructor right now.
In main class [Named Core]
The MainClass shouldn't have a constructor.
This is the constructor of the client / Other class
private final Core core;
public Armor(Core core) {
this.core = core;
}
This is the instance of the other class
by the way you can initialize it directly on the field.
I read this way in another decompiled code?
public List<NamespacedKey> key = new ArrayList<>();
public List<ShapedRecipe> recipe = new ArrayList<>();
```No need in constructor.
That is correct, nothing wrong with that.
Okay
But my friend was saying Make one of these instances and then trasnfer the instance of mainclass u made into other classes which require this instance
he said it half way through and then went offline so maybe I have misunderstood him
i dont understand what your friend means
yep I guess I have to wait for him to come back online 🙂
Ahh And btw is this okay
public class PlayerJoin implements Listener {
private final Core core;
public PlayerJoin(Core core) {
this.core = core;
}
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
player.discoverRecipes(core.key);
}
}
Its a event Listener
For player join event
With a instance of main class as well
Its to discover the custom recipes
I was planning to improve this later By checking for achievements like getting a diamond and then on getting that achievement they will unlock the custom recipes 🙂
What is core.key
NamespacedKey right?
And yeah that's fine, nothing wrong with that
Okayyy
Yep! 😄
The array list from main class
Uhm!
@prisma briar
How can I also make this... Array list for registering listeners
Just asking if that is Possible 🙂
getServer().getPluginManager().registerEvents(new MyListener(), this);
Like making a for loop for this
And a array list to get each class name
Each listener
As whether I do this or not I still require a instance of main class in my listener class so If I add another Array list in which I give the class name in specific listener class
Wont that work ?
List<Listener> listeners = new ArrayList<>();
Okay
@Override
public void onEnable() {
Armor armor = new Armor(this);
PlayerJoin joinlistener = new PlayerJoin(this);
for (ShapedRecipe shapedRecipe : recipe) Bukkit.addRecipe(shapedRecipe);
getServer().getPluginManager().registerEvents(joinlistener, this);
}
To register the listener it could be a one liner
Bukkit.getPluginManager().registerEvents(new PlayerJoin(this), this);
It actually wont matter
Because I need that object anyway
Its giving the constructor in PlayerJoin listener class the "this" Instance
wdym?
Whether I do this
Or whaat i DID
Or what I did*
It wont matter
As the object I can't remove it
so if I can use object at another code line then whywould I not
:what:
from your code, it doesn't look like that you used the object anywhere beside in registering the listener/events
public List<Listener> listeners = new ArrayList<Listener>();
Bukkit.getPluginManager().registerEvents((Listener) listeners, this);
That should be good right?
wait wtf wrong line 1
Okay
use for loop
No I am using it to make instance of Main class in Listener
Oh yes I almost forgot that
you can still reference the MainClass even tho it's still one liner
for (Listener listener : listeners) Bukkit.getPluginManager().registerEvents((Listener) listeners, this);
Hehe Yea thats what I meant by it wont matter
Okay But still Imma do what U said Next time when I have to use it, I will use the way u said
Error if I dont 😗
okay first of all, you don't want to cast everything if u got an error, try to fix it instead casting it.
you're using listeners which is a List of Listener, not the listener
change the listeners to listener
dont cast everything if u got an error, it will not solved anything
Okay
wont this not work then
for this
for (Listener listener : listener) Bukkit.getPluginManager().registerEvents(listener, this);
I have changed the Array list reference name to listener" as you said
Heh
Hmm
I dont get it Uhm
wait
public class Core extends JavaPlugin{
public List<Listener> listeners = new ArrayList<Listener>();
public List<NamespacedKey> key = new ArrayList<NamespacedKey>();
public List<ShapedRecipe> recipe = new ArrayList<ShapedRecipe>();
@Override
public void onEnable() {
Armor armor = new Armor(this);
PlayerJoin joinlistener = new PlayerJoin(this);
for (ShapedRecipe shapedRecipe : recipe) Bukkit.addRecipe(shapedRecipe);
for (Listener listener : listeners) Bukkit.getPluginManager().registerEvents(listeners, this);
}
@Override
public void onDisable() {
}
}
This is the code
Its telling me to cast the listeners with (Listener) at the loop for registering the listeners Array
figure out why
also consider adding open/close bracket, it makes the code more readable.
Bukkit.getPluginManager().registerEvents(listener, this);
exactly, u got it
It makes code more compact 🙄
But kay
Andd...
In the listener class
How can I add this class to the array list?
core.listeners.add(new PlayerJoin(core)); ?
^ is that correct?
yes
Oh and if u ask why I am adding core" In the brackets its because the constructor in this lstener class needs the mainclass "this"
I will now test the frame of the Plugin to see if There may be any problems
yea i know that 😅
Oh ok 😗
and ... I am afk for about 3 days in this mc server
and the admin just found that out
Lmaooo
Uhm I wanted to upload a class file of the plugin that I decompiled
But now that I look at it... the plugin dev is highly inexperienced
The code is quite like
Using an sql database how might I do a check for matching words in a varchar? For example I search for “Hello how are you today”, I want the database to return rows where at least 3 of those words exist in the varchar otherwise don’t return them.
CONTINUING my sentence , It was quite like as if he was barely experienced, Soo many registers and all code was in the main class instead of making seperate classes for each custom item or category of custom items
Uhm
how much would anyone rate this code...
https://www.toptal.com/developers/hastebin/oqepulozir.csharp
Not mine*
Its decompiled code of another plugin, I was curious so just decompiled it to check how it worked 😛
-420
10 spear fish out of 20 tennis balls
why? u dont like my name?? :((
I would rate it like 40/100 because He put all of stuff in just one code
He could have made like 20 classes out of it
while not changing anything in it but actually improving it :0
5k lines 
xD
Not great, they don’t really understand how configs work.
final String ee = this.getConfig().getString("Emerald");
if (ee == "true") {
They seem to only understand getString
Caused by: java.lang.ClassNotFoundException: de.codercreep.blockcreator.data.Data
It can’t find you class that is referenced there
Recompile?
Wait in both?
I’d suggest recompiling this sometimes happens due to compile issues
If that doesn’t fix it we can find a solution then
Can you show me the path within your IDE?
Expand the left side menu with that reference
Yeah so your file structure on the left side most commonly
The way you navigate
=imgur
Have you checked within the jars to ensure they are there aswell?
Very strange unfortunately don’t know what’s wrong there if you find out I’d like to know your solution if I get any ideas in the mean time I’ll lyk
Sorry might be the wrong channel but what was the command for barry to show the explanation to why lombok is bad. (might be the wrong server tho)
plsnolombok. you can see the available FAQs using ?list btw. and please do it in #bot-commands xD
got it thanks 😄
also what is the difference between dropItem and dropItemNaturally in world
d;spigot world#dropItem
@NotNull
Item dropItem(@NotNull Location location, @NotNull ItemStack item)```
Drops an item at the specified Location
ItemDrop entity created as a result of this method
location - Location to drop the item
item - ItemStack to drop
D;spigot world#dropitemnaturally
@NotNull
Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item)```
Drops an item at the specified Location with a random offset
ItemDrop entity created as a result of this method
location - Location to drop the item
item - ItemStack to drop
so basically it drops it at the location but with some offset and not exactly at that location
yeah
thats how it happens when you die for example. thats why not all items are in the exact location you died
but they're a bit scattered
got it thanks, btw nice name 😄
thank you
Hey so i have 6 dependencies in my Plugin, each of them have like a billion others, is it possible to relocate the dependencies and their dependencies at once? (gradle)
Is there anyone that could help with client packets for an npc plugin pls 😄
Allow me to introduce citizens to you
Where making it custom for more possibilities but thx
But I would really appreciate help for the coding haha
He’ll never learn 🙃
What’s the problem?
A developper from my server doesn’t know how to code client packets and can’t find anything that fits the plugin on the internet
Code client packets?
So this isn’t for you?
Just create the entityplayer, send an addInfoPacket then a spawnNamedEntity packet
You need to tap into netty pipeline if you wanna read for entity to entityplayer interaction
It’s an interaction npc plugin
Well tbh we have both look for help since monday and we found no one so far
I just told you exactly how to do it
Ye I saw thx
If you’ve never injected into netty pipeline you might have to do a little research or even go look at spigot yourself
Then just check for useEntity take the id of the entity interacted with from that packet and check if it was one of your npcs. Then perform whatever cause you now know they clicked on the npc
Use Edity*?
Or
useEntity?
What is use edity tf
Guys I am getting this error
Craftsmoker cannot be cast to block.smoker
this is the code
what should I do ?
@icy shadow
?
so now I'm more awake than ever
so how I sould auth users on the cloud?
I asked LeScooter, the Lead Developer of BlockFront on how he does auth and this is how he does it
he uses authlib for it
so what shoud I do? any wiki.vg page or so?
Someone experienced with compile errors / issues pls message me
@brittle thunder, Help menu!
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
🥲
🥲
@brittle thunder, Help menu!
Hey, im trying to read from my config.yml file and when I do it returns a java.lang.Object. I cant find a way to view the object except for .toString though.
public void reloadCheckpoints() {
List checkpoints = plugin.getConfig().getList("checkpoints");
plugin.getLogger().info(checkpoints.get(0).toString());
// Logs {box={x1=1, y1=2, z1=3, x2=4, y2=5, z2=6}, message=Test 1}
}```
Config.yml:
```yml
checkpoints:
- box:
x1: 1
y1: 2
z1: 3
x2: 4
y2: 5
z2: 6
message: "Test 1"
- box:
x1: 1
y1: 2
z1: 3
x2: 4
y2: 5
z2: 6
message: "Test 2"```
Well it’s not a list, there are more keys after checkpoints, you can do ConfigurationSection#get(“checkpoints.x”);
Unless you can have a value in a list have keys like you have there, I haven’t seen that before though, I’m not sure if that’s valid yml.
What does ItemMeta#hasCustomModelData returns exactly?
If setCustomModelData was used on this item? or if customModelData returns other than 0?
what if I don't set a custom model data (not even 0)
what does getCustomModelData returns? 0?
pretty sure default value is 0
So what does hasCustomModelData returns?
probably if it is more than 0
hi I'm having an issue with my code, I want to get a variable into another class. I'm making a /report gui and I want to import the target into the gui. To make it clearer:
someone types:
/report <player>
then a gui opens and the command executor can select a few reasons to report for
I want the name of the target aka <player> in this case to show up in the title of the gui, I also need the targets name in my GUI class to send staff a message that the player got reported for something.
Now the issue is, I can't get the reported player's name from my Report command class to my Report Gui class. Does anyone know how to do that or can help me? I have been struggling with this for a while now
can't seem to get that to work
tried a few things to store it but didnt go well
it returns null
public static String reportedplayer;
public static String GetReportedPlayer() {
return reportedplayer;
}
else {
p.openInventory(ReportGui.GUI(p));
reportedplayer = target.getName();
p.sendMessage("target: " + reportedplayer);
}
aight
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
sec
this is my GUI class atm
tried to get it from my Command class with this ReportCommand.GetReportedPlayer() but it returns null
p.sendMessage("target: " + reportedplayer);
but here in the command itself it does actually return the reportplayer
in chat
It’s because you are defining the reportedplayer after opening the gui
tried that, but still returns null
Could you send what you’ve tried
Are you sure it still return as null
yes
checked 2 times
inventory_name = CC.chat("&8Reporting " + ReportCommand.GetReportedPlayer());
thats the line in my report gui
to get the title
yup thought about that too but then I failed to get it into my gui class
alr
aight ty
getting an error now
Well I found the answer
java.lang.IllegalStateException: We don't have CustomModelData! Check hasCustomModelData first!

now I get "null" in console 💀
nullpointer
Inventory toReturn = Bukkit.createInventory(null, inv_rows, CC.chat("Reporting ")+ reportedPlayer.getName());
GuiUtil.createItem(inv, 276,1,0,"&6Combat Hacks");
GuiUtil.createItem(inv, 353,1,1,"&6Movement Hacks");
GuiUtil.createItem(inv, 386,1,2,"&6Other Hacks");
GuiUtil.createItem(inv, 46,1,3,"&6Kingdom Grief");
GuiUtil.createItem(inv, 369,1,4,"&6Aanval zonder War");
toReturn.setContents(inv.getContents());
reporter.openInventory(inv);
}```
so this is the report gui now
ReportGui.openGUI(p, target);
and added this to the command
removed the other thing I tried
im a new minecraft server dev and the drill is:
I gotta use a script like that: :start
java -jar forge-1.16.5-36.1.32-f645ac2-DEV.jar nogui
timeout /t 20
goto start
To start my server but the host doesnt allow me to use it
I gotTa UsE thE Jar
Do you have any hosting you shouldnt be restricted to use a script and if not is there any way to put the script in the jar -.-?
u can host on ur own pc if you just wanna test things
pebble for now
the host has its own starting flags
i can change it
ReportCommand: https://paste.helpch.at/furorotasi.java
ReportGUI: https://paste.helpch.at/lexocaguki.java
Error: https://paste.helpch.at/zotelasiko.bash
then whats the problem?
inv.setItem(invSlot, item);
you cant use your own script to start a server on any host
i cant ;-;
why you want to use a script idk
oh
bc i cant use it other way
like its magma 16.5
the only way you can start is with start.bat or script
and it doesnt lemme both ways
idk am i the dumb one , are they?
proly me but thats not the point
do the install script oj your own pc and then upload the files
the script is like not in a file but i write it in the console
rename the forge.jar to whatever the hosts startup script jar name it wants, most use like server.jar and then just run that
you mean i should write it in some file , upload it in the server as a .jar file and put it as a start file?
my previous code used
inventory_name = CC.chat("&8Reporting " + ReportCommand.GetReportedPlayer());
inv = Bukkit.createInventory(null, inv_rows);
}```
But I removed that when implementing ur method
no
and then I initialized it in the main class
you run the installer on your own pc
there aint an installer
make sure it starts and you can connect
like you gotta open powershell , type some script in it and it downloads
i already have a server ready
then upload the server to the host
and change the name of the forge jar to something like server.jar
im talkin ab magma 16.5 btw
i have no clue what your host calls the server jar
alright will try
even if i name the jar of the magma server.jar
i cant possibly turn it on
ty for ur help already
yeah you can
you dont rename the magma server jar
you rename the fucking forge jar
This will generate another jar forge-[version].jar run this as normal java -jar forge-[version].jar
you sure its gonna work?
try it and see
I have to make this one static tho otherwise I can't initialize in the main class
what does it say
did you change the java version to java 8?
yes
well what does it say then
inventory_name = CC.chat("&8Reporting " + ReportCommand.GetReportedPlayer());
inv = Bukkit.createInventory(null, inv_rows);
}```
nothin suspended
their definition of suspended bc its on my language im just gonna translate it
you cant use scripts and other than the oficial jar files
now i use other host not pebble
sorry for my extra dumbness
so your server got suspended
ye imma try it on pebble host
did you even tell them you wanna run magma 1.16.5?
static abuse when
first time running a server from a host?
you have to run the forge jar, not the magma one
ye ye i understood
scripts and hats arent allowed unless you get bare metal or vps
Hello guys
i have a doubt
i hired a guy to make me a plugin that basically execute command when players wear a full set of a certain armor
and execute command when they remove it
so i can make perks for full set of armor weared
the thing is
If server crashes
what happens?
Um... what?
i mean
we're worried that if server crashes
and PlayerQuitEvent is not registered
when player join back they get again the perks
even if they didn't lost it since the PlayerQuitEvent is not registered
And the plugin remove the perks if player quit checking it trought PlayerQuitEvent
you got what i mean?
@dense drift
Ask them?
to the dev?
Yes
he can't find the solution too
You*
so do you think is there a way to fix this?
would making a database that save player data and checks it everytime affect server performance a lot?
Maybe, although saving it asynchronously might help
bsynchronously better
aye James!
aye!
hello james
helo
Hey, I'm trying to modify the old kotlin lexer from Elara (https://github.com/ElaraLang/Elara-Old/tree/lexer/src/main/kotlin/io/github/elaralang/elara/lexer) for a small project, but for whatever reason when building the final regex match-y string thing it fails miserably, but works fine in regex101. I'm assuming it's something to do with not escaping properly but I can't see any issues, can anyone else?
That regex thing is so cursed
Yes it is
anyone used ktor websockets before? idk how to detect (server side) when a client disconnects 😩
in the docs it says that it handles close and ping/pong stuff unless its a raw web socket session
but atm it just throws errors when a client disconnects and i attempt to send data to it

