#development
1 messages · Page 16 of 1
If it’s over 15 seconds, then the time ran out and you should remove the player from the map
That should be a pretty good base to work with, so gl
in the horn sound event
UUID playerUUID = e.getPlayer.getUniqueId();
if (!isActive(playerUUID)) { //add the buff only if the player doesnt have it
addBuff(e.getPlayer.getUniqueId(),15000); //15000 = 15s
}
in the onhit event
UUID playerUUID = e.getPlayer.getUniqueId();
if (isActive(playerUUID)) { // only activate if they have the buff active
strikelightning; //whatever method is used for striking lightning on a entity cus idk waht it is on the top of my head
}
nooo thats spoon feeding
don’t give him the code
@lyric gyro doesnt even work, gives me two errors dont worry
Well yeah ofc it won’t work
That's not entirely true, uuid vs player uses the same amount of memory in a hashmap. The reason to use uuid is to prevent memory leaks so the player object can be fully unloaded when they disconnect (also possibly prevents weird behaviour with old player objects)
i wonder what the errors are
i forgot the brackets
the isActive one was because of captalization
Does anyone know if it's possible to set the fadeIn, stay and fadeOut of a actionbar through protocol packets?
For example, Title has more fields, but for some reason actionbar doesn't
actionbar has a set time
you resend it to set its time approximately but its minimum amount of time is limited
So to make a constant actionbar, I just have to send it multiple times a second basically?
not really a second
not sure how long exactly it lasts but yes
Ah okay, I get the idea
but depends how often you need to update the data
check how long it is and resend
Thanks!
Do I get help from the general-plugins-2 channel, or this one
And is this plugin anyone here seen
are you there?
holy what is that even
yo
💀
if
if
if
if
yandere dev of minecraft
cant say im much better but damn bro
Its not super bad. Personally I'd just invert the conditions and do early returns instead to keep it neat
And split the common code into methods instead
wait I just saw the screenshots 
gah damn
that looks like copilot
this one is what i reacted to as well
goddamn
Does anyone know a replacement to spigot's conversation api?
@somber gale did you figure it out with the code I sent?
Didn't test it and honestly won't test it
lol
One thing I REALLY dislike is that it requires a message for each prompt and I can't pass null or an empty string to make it skip the message
And id like a more up to date version xD
is probably a part of another class?
its cause it belongs in another class
but i cant make it work it in other class
because im stupid and probably forgot how
is it a static or instance method?
👍
you need an instance of the other class
ik ik
but
i cant make it static
i didn't say to make it static
💀
if i had to guess you're missing @EventHandler
the adBuffObj is not active
or the world is null
or that
maybe its all of the above
maybe you should just quit
what
what
quit what
idk im vibing
ill need someone to help me review this whole code
i dont recommend literally anyone here unless you want ego shattered 
what the fuck are you talking about
💀
this person clearly hasn't had a code review from the members of helpchat before
how can i get the non-decimal digits in a double without any rounding? (im trying to teleport a player to the center of the block they're standing on)
the center is .5
not .0
uh usually id do Player#getBlockLocation() + 0.5
double newNum = ((int) oldValue) + 0.5
hopefully thats what you were asking for
Or this
ik, i was gonna get their X (ex: 10.59268), and then only get the non-decimal digits (10), and then add .5
but what about negatives?
casting it to an int is different from floor
they do different things
I'd recommend using the spigot's built-in method
and then +0.5 on that
yea ill do that
is player.getLocation().getBlock().getLocation() correct?
cause Player#getBlockLocation() doesnt exist
player.getBlockLocation
oh
then Location#toBlockLocation
or something like that
unless theres just getBlockX
d;spigot getBlockLocation()
public class EntityDamageByBlockEvent
extends EntityDamageEvent```
EntityDamageByBlockEvent has 1 extensions, 1 all implementations, and 2 methods.
Called when an entity is damaged by a block
hmmmmmm
u have to put Player
long getPlayerTime()```
Returns the player's current timestamp.
The player's time
i could be psycho and my kotlin brain go brrr
yes sir
okay then just new Location(world, Location#getBlockX() + 0.5, Location#getBlockY(), Location#getBlockZ() + 0.5)
its either my kotlin brain or paper spigot brain
d;paper Player#getBlockLocation()
@NotNull
@NotNull Block getTargetBlock(@Nullable @Nullable Set transparent, int maxDistance)```
Gets the block that the living entity has targeted.
This method considers all blocks as 1x1x1 in size. To take exact block collision shapes into account, see getTargetBlockExact(int, FluidCollisionMode).
block that the living entity has targeted
transparent - Set containing all transparent block Materials (set to null for only air)
maxDistance - this is the maximum distance to scan (may be limited by server by at least 100 blocks, no less)
nope
why wouldnt this work?
player.getLocation().getBlock().getLocation().add(0.5, 0, 0.5)
that too
yes but that would load the block each time
it just looks kinda wank 
i mean it doesn't really matter i guess since it's always going to be loaded so unless you're doing it a lot of times it doesn't matter much
im only using it once
player.teleport(player.getLocation().getBlock().getLocation().add(0.5, 0, 0.5));
👍
oh my
oh zooeymama
Don't forget to clone, cuz stupid mutability

use entitydamagebyenetityevent
and check if damager instance of player, cast as player and then get uniqueid
ok
check if active then strike lightning on damagee
you know how entity poorSoul is = to event.getentity() ?
does the ide know that poorsoul is the one that was hit?
looking at the docs, yes e.getentity is the damagee
how do i use this here tho
what the
you would use that in the playerinteractevent
why are you using nms player
cause it gives me an error if i try to use bukkit player
what is this "error"
let me see
yeah, i wanted to do when player interact event happened that thing would happen
nvm
god idk what to do
why do I forget how to do simple things
that's coding literally summed up
i unironically forgot how to do for loops sometimes
lol
i dont feel so bad now
when you start learning other languages your brain ends up just merging shit together into one clusterfuck of a language
yeah
i think i should just take the weekends as a break
i spend the whole week coding
i do the gigachad move of code a months work of work in a day
then don't code again for the next 3 months
and on weekends my brain is busy not being smart
ok, i see what you wanna do, on interact you want it to call the action method inside of your horn's class
is this supposed to happen for any horn that has the right horn sound or is it a specific custom horn item
its not a custom item
and its just for the yearn goat horn
everything about the horn is basically set up already
i just need to add code to the class
what i want to do is
when you sound the yearn goat horn
it would struck a lightning at every entity you hit for 15 seconds
right, so every yearn goat horn
here
in the playerinteractevent, check if the item is a goat horn, check that the goat horn sound is yearn, and then make a new instance of yearngoathorn and passthrough the player to the action method
tho i dont think you would have to implement horn
give your friend a keyboard with a working enter key
@lyric gyro is this same with my friends one
Object result = getPrivateField(Bukkit.getServer().getPluginManager(), "commandMap");
SimpleCommandMap commandMap = (SimpleCommandMap) result;
Object map = getPrivateField(commandMap, "knownCommands");
@SuppressWarnings("unchecked")
HashMap<String, Command> knownCommands = (HashMap<String, Command>) map;
Set<String> commandsRemoved = new HashSet<>();
for (String command : knownCommands.keySet()) {
if (command.contains(":")) {
commandsRemoved.add(command);
}
}
Bukkit.getLogger().info("[NoCommandPrefixes] Removing Command Prefixes...");
knownCommands.entrySet().removeAll(commandsRemoved);
Why wont that work?
Im trying to unregister a command
but it just wont unregister it
its giving no error
so I have some sort of cache system which uses a hashmap to store the things, I'm currently trying to add things to it and try to log them, so I can look for any problems, but this is where I found one 
As far as I can guess, it is due to the way the methods are coded, but I do not know what is the exact problem.
this is the class: https://paste.helpch.at/geladusupa.cs
the design I ended up doing was meant to do this:
when the addEntry method is called, it will call an update method, which checks if the key that is to be added already exists, if so, it is completely removed to allow a new value to be added
what I think is happening is that it is sorta removing itself
because when I log everything, only one thing is logged
which is the exact message which was sent
not every single message that was logged
and I have checked and it should log certain messages
i mean that's what your code is doing
you are only saving the most recent message
assuming all messages are being sent by the same sender
also this is so incredibly janky
public Map.Entry<UUID, String> getEntry(UUID key) {
this.updateKeys(key);
//check if the key exists
if(this.checkIfKeyExists(key)) {
//Loop every entry in the map and check if it is the desired one, then return that key entry
for(Map.Entry<UUID, String> entry : this.getMessageCache().entrySet()) {
if(entry.getKey().equals(key)) {
return entry;
}
}
}
return null;
}
and also you don't really need to ever explicitly remove an entry if it's a cache
// useless ->
private void updateKeys(UUID key) {
//check if a UUID already has a messages related to it
if(this.checkIfKeyExists(key)) {
this.removeEntry(key);
}
}
for your usecase you can just overwrite the entry whenever you get a more recent one (at least going off what you said + current code)
public String getEntry(UUID key) {
this.updateKeys(key);
//get or return null if key not exist
return this.getMessageCache().getOrDefault(key, null);
}
looking at this i just realized getEntry() will delete the key it is looking for every time
so it will never find the key you want
at this point just
public String getEntry(UUID key) {
return null;
}
i don't understand you code 😅
do you see this line
this.updateKeys(key);
what is you goal ?
i'm just implementing the same code that @wintry grove has but less convoluted
case in point
oh i see
which event is it?
GuildRemoveEvent
something like that
GuildMemberRemoveEvent
when a member leaves a server
I think I know why actually
since the member left the server
the code cant get the member
cause there is no member to get
so its null
but idk
then do a null check
aight
whai
wait
why
i know its null
no need to check if its null
does it say that its always null?
do you know whats the method to get the member's id?
ill do an arraylist with all the members that join
to use it when they leave
I mean yeah
but that would mean to make the updateKeys method have a key and value param
which I do not really want to do
it isnt meant to do so ig
it checks if the key already exists
which I dont know why it deletes it
because its just when its ran when that happens
why
oh nvm
to allow it to change the value
it cant change it if it doesnt have the value and key lmao
right but why do you need to delete the old value
you have an addEntry method for this
there is no alternative to this
there is no way to store more than one message for the same person if you are using a Map<UUID, String>
deleting the entry might make sense IF you had a map of UUID to Lists of strings which you were sometimes appending to and sometimes deleting
thats what I mean lol
wait
you dont need to delete the old value
storing only one message is the default behavior
and the only behavior
so what I should do instead is to make that method be an update value method?
alright
whenever you put a new entry into your map you will override any old entries of the same key
so if i do
map.put("bob", "i like apples")
map.put("bob", "i like oranges")
the "i like apples" entry will be overriden and erased
i didnt have to call any extra code for that to happen
map.get("bob") -> "i like oranges"
seems fine
probably
also your for loops are all weird
like i guess entry sets might be a bit faster
but you like them a lil too much i think lol
for example
public void removeAll() {
for(Map.Entry<UUID, String> set : messageCacheList.entrySet()) {
this.getMessageCache().remove(set.getKey(), set.getValue());
}
}
im pretty sure Map has a clear() method you can call
yeah
I'm pretty much not going to be like in the commit message:
"fly me to the moon, let me be an idiot"
thanks man
made my week
now time to see if it works
👍
what did you expect the output to be
all of the entries that have been added
there is nothing that is removing the entries
but like
what are all of the entries that were added
and did more than one of them get sent by the same player
every single message sent
yeah
thats why
but there were more unique senders that repeated one
no mather the what it should have been more messages
can you post code again
a sec
fuck
did not mean to do that
https://paste.helpch.at/ihovafazuy.cs there we go
I add the entries and then after that I call logAllEntries
show code
how come you are logging all entries every time an entry is added
just to help debug?
yeah
that method itself is just for debug
wont be in the final build
or after that
i cant really tell whats goin wrong tbh
but i suspect it's not happening in the cache code
or at least not only* in the cache code
neither can I
and wdym with this
like the issue might be somwhere else
but it might be because you made a nad assumption back then about how your cache code runs
idk tho
ive never used it, id assume Member would have a getID method or something
how do I do a toggle command in jda?
can someone explain to me how the fuck i keep forgetting how to use objects from other classes in fucking java
and can someone also explain how you do it
i cant make the object i want to acess public or static
These are kind of the basic principles of oop/java
you cant blame someone for forgetting
There is no one clean cut answer as it depends on the context
doesnt mean im bad
just because i sometimes forget how to do a simple equation doesnt mean i need to be sent back to eight grade...
I never said anything like that
sorry
im just getting really defensive when people say "oh but thats the basics"
i know the basics
i just forget
but anyways
heres what im trying to do
basically channelOpt is getting the option of a command I made for a bot im developing
its a text channel
the option
and I wanted to use it where the red square is
(which is the id of a discord server channel)
Sounds to me like you need a shared instance of an object that tracks that detail
Yeah, as in you create an instance of a class, and then pass it to both classes that handle those two things
Or if they are both in the same class, then a field
i dont like the word pass in java
it means that most of the time idk what to do
when i see it
yo what the fuck did i just do
It just means you give it as a parameter to a function (in this case a constructor most likely)
k
so
I just create a new instance
of the class
which i already did
dont spoon feed btw if u doing that
I'll just show you an example```java
public class Details {
private String someDetail;
// constructor
public Details(String detail) {
this.someDetail = detail;
}
// getter/setter
}
public class SomeClass {
private Details details;
public SomeClass(Details details) {
this.details = details;
}
}
``````java
public class OtherClass {
private Details details;
public OtherClass(Details details) {
this.details = details;
}
}
Details details = new Details("Something");
SomeClass someClass = new SomeClass(details);
OtherClass otherClass = new OtherClass(details);
Then the instance of someClass and otherClass will share the same instance of Details
So they will both look at the same info
ok
So if one of the objects change something in the details class, then it will still be the same for both
heres the thing im trying to get
can I just
move it to outside this method
i dont think i can
Does the same class handle those two events?
no
Then no not really
then how will i put this in my constructor
if im declaring the object here
inside the method
The constructor is just to get the instance of the class to inside of the class
After that you can interact with it
So at that point in time, you can use the methods on the object to pass in information
so like
In SomeClass
public void setDetail(String detail) {
this.details.setSomeDetail(detail)
}
In OtherClass
public void onSomeEvent(SomeEvent event) {
String detail = this.details.getSomeDetail();
if (detail.equals("Whatever") {
event.whatever()
}
}
So the Details object in this example is the one responsible for holding the shared data
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
help me please
https://paste.helpch.at/renedawara.sql
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event me.glaremasters.guilds.api.events.challenges.GuildWarEndEvent. Static getHandlerList method required!
@mental cypress looks like you forgot to annotation the handlerList with @JvmStatic in GuildWar events that don't extend GuildEvent
Ooof 💀
Cheers. I'll fix it soon.
np
how do I make the value of a variable persistent
like lets say I have a boolean that initially equals to false
I run a method to make it equal true
then I stop the program
and check if this boolean equals true or false
how do I make it store the value?
and read it
for later uses
im sure there are guides on storing data
cant find any on booleans
which is what i need to store
Config?
Do you have a config file yet?
no
i tried saving it into a string
and then parsing it into a boolean
cant really tell if thats parsing
but i tried
Do you plan on having other values like this?
not for this specific command im making
this one toggles a function that welcomes members
and says bye to them when they leave the server
fixed it
string cant have else lol
this whole class is a mess
can barely understand it
So I would read into setting up a proper configuration file
recepRead returns a single integer byte
the FileReader is still a FileReader, so equals will never be true
then how do I store a boolean
well I thought that FileReader would read the line
and check if its true or false
idk what is a config file tbh
It might, but the object is still a FileReader, that'll never change
The simplest way to read a whole string from a file is with nio, Files.readString
The reader stuff is usually outdated and bad
whats nio
The standard format for spigot/bukkit is yaml or .yml
There are many formats available
Json, hocon, etc..
I don't know the standard setup for bukkit, I usually use configurate and let the object mapper handle it.
im not developing for minecraft rn tho
im developing for discord with jda
"new io", a package. Google the specifics but that readString method and the Files class is really all you need
Oh,then I'd reccomend configurate then as a lib, but there's others floating around.
Unless you're wanting to parse it yourself.
Or gson is easy for json
True
ok
so i only need readString?
cool. sounds doable
I'm sure you can guess what the method to write is called
system.outprintln?!? (jk)
@icy shadow how do I specify the path I want a file to be written in?
or better
File#toPath or Paths.get
how do I get the path of my file so I can use read string?
i need the path of my file to use readstring correct?
Any method similar to ChatColor.getLastColors(String)? Don't think it works with hex.
Could make your own implementation of it
Component#color 🙂
Hi, if any of staff is watching this channel, could you please verify my expansion?
https://github.com/ShimadaJP/Groopi
https://api.extendedclip.com/expansions/groopi/
I updated the version to 1.1.0 but I can't update it because re-verification is required
Will do later tonight
Thank you so much 🙂
By the way It would be great if you could add "Shield" sign to my expansion.
That sign just means it's verified. So whenever I verify it, the sign will be added
Wait. I just realised. You haven't updated the expansion on the ecloud
Was the problem that you can't update it? I might've misunderstood you
I can't because I need re-verification?
"To combat spam uploads, all expansion updates currently require to go through re-verification, please ask a staff member in the Discord for assistance."
oh no.
that's unrelated.
you can upload expansions just fine. But to get the blue shield (verified) then we need to verify it
I updated it 🙂
alright. will verify it later then
Thanks!
Hello, could ask how would I be able to create a placeholder with the code run Async? The data I get for the placeholder are from a MySQL database, so I don't want the server to lag. Thanks! (Please ping me)
Cache
if your wanting to use json then gson does exist
and afaik gson is built into spigot so you dont have to include it in your plugin as a library
you also have FileConfiguration which handles yml files
and jdbc for using something like mysql or sqlite
Jda, not spigot
Not seeing that... What version and import?
I see ComponentBuilder but doesn't have a .color method. Also nothing to get the strings last color.
i thought that they had moved back to spigot. for storage still gson can be used to make it easier.
Wym moved back.
Jda and spigot aren't like swappable
what i wrote and what i was thinking was different. i ment that i thought they were talking about spigot rather then jda
Oh makes sense
@light jungle, talked with the admins and given the recent (few months old) problems we've had with scripting expansions, we've decided to not verify it. People can still manually download the expansion but they won't be able to download it from ingame using the /papi ecloud download command.
Cry react
Trying to learn about Dockerfiles/how to make them. How would you suggest adding a step to clone a private git repository into this? https://github.com/pterodactyl/yolks/blob/master/java/17/Dockerfile
looks like the command would be git clone https://<access token>@github.com/org/repo.git
is this on spigot ?
no
why the fuck is it so hard
to store a boolean in this goddamn programming language
why dont they have a way to do it without having to use a library
why would they?
that is so ridiculous and its really starting to get on my nerves
why would a language support a file format by default
good question, maybe because they already allow you to store strings, integers, chars and all that shit
except booleans
im not talking about yaml
what no they dont
its a text file format basically
the only mechanism java (and most languages) have for file IO is strings and bytes
ugh ok
^
you can use "true" "false"
or even better
just 1 - 0
or, stop crying and use a proper yaml library
it would be cool if i could just write true or false into a file and just parse it into a boolean
like snakeyaml
you literally can
if that's really all you want
no one is helping me to do it and i dont know how
I LITERALLY
SHOWED THIS to someone
and they said you cant use value of with reader or whatever
feel like its better for them to learn how to use other libraries honestly, doubt it will be just one bool
thats all I wanetd to do from the start
yeah that was me, because you were doing it wrong
maybe, but if the only thing you need to store is a single boolean then there's no reason to overcomplicate it
thats what I wanted to do from the start and no one understood
I just want to store a single boolean
and how do I make it overwrite this old value with a new one?
also you really need to learn how to read documentation
change from false to true
literally look at this
- change value
- update value in file
how the hell am I supposed to understand this
if they dont even explain what is going on
i would actually say that documentation is pretty clear if you have a decent understanding of java
do I look like i have a decent understanding of java
evidently not
exactly
but anyway
.
ill try to do what you said
it was pseudocode obviously lol
but if you know how to read a file the rest should be easy
of course
I need to create a file reader right?
i would recommend the Files api rather than reader stuff
readers will still work, but theyre outdated and so Files is recommended instead
you explain me the difference later
just tell me
do I need a file reader
im pretty sure i already answered that question
readers will still work, but theyre outdated and so Files is recommended instead
too many words
nice adventure time pfp. i like it
i like it too
yeah yeah
i dont
you want me to use files
just say it
Me neither
ok soldier tf2.
wdym "just say it" thats literally what i said
it's not that deep bro
exactly
and?
well thats why im here ig
you dont know how to use either, so it doesnt matter
to ask for help
if you know how to use a FileReader then use a FileReader
no one is stopping you from using a FileReader
i dont even know the difference
.
thank goodness i already said
the reader class
is it important?
god
?
both of us have
.
my personal recommendation is to use the Files api instead
it's really not that deep lmao
I think ur confusing him what he should use
there is nothing confusing about what we're saying dkim
so google it lol
i wont
ok
OK
problem solved
ez
that really didnt need a 7 minute discussion
Just what is this chat
its cause i still need brister's help
then just say that rather than arguing about what api to use lmao
lmao
In this tutorial, we will learn about Java FileReader and its methods with the help of examples. The FileReader class of the java.io package can be used to read data (in characters) from files.
👍
- brister
Ofc
so here... (in the string) I use my reader class?
Um
no you should make a method to read from the file
well that
Properties file is also ez
that actually makes sense
wanna do it for me then?
thats what I thought
Google can do it tho
Useful if u want to store more than a boolean in the futute
Future
me drowning you in sulphuric acid is also ez
Sorry
yeah

what
13 total in this class
Sorry Ive never used file reader vefore
it's like any InputStream / Reader where it's 1 byte at a time
clash of clans?!
no dkim scanners do not read 1 byte at a time, thats the point
Oh
lol
that is also more than 1 byte at a time
Yes
@lyric gyro would it be easier if i just gave an example
will that method work brister mitten soldier team fortress 2
Tf2
team for trees
it wont throw an error but it probably wont do what you're expecting
oracle did a great job on overcomplicating this
the Files api is actually a lot simpler which is part of the reason why i was recommending it
also avoids leaks
because you're correct, the old api is too low-level for practical use
if only I knew how to use it
just
Well
just tell me what i got to do in the method
if only you knew how to google
excuse you
Mister @fast yokeWarnings("all")
L

i like how two different servers have the exact same emoji
kotlin is universally hated
nice
got anything to say dkim?
i do
@icy shadow how do I make that method do what I want it to do
mr kotlin = best
you should really consider googling how to actually use the FileReader class
i would wrap it in a BufferedReader and then you get access to nextString() or whatever it's called
i would wrap it in a tortilla and eat it
And yet all of them have the outdated logo, I guess that's usual for Java lovers to be outdated 
looks at java official website
id do what you would do
if I knew how to do it
how do you wrap
like that
you mean the.. one that got updated? lol
after years
How come?
The entire point around the module system is to distribute self-contained applications, fully executable from the start without depending on an installed runtime; picture this, I develop an application for Java 8 update 41, but update 56, the one you have installed, introduces some change my application relied on and is now broken, my application stops working on your system because you have a different runtime version than my targeted version
Isn't that what graalvm is for
jlink/jpackage are for that, to package the runtime of your choice with all your dependencies into a single application
no, it is not a native image
Oh
But how do modules have to do with that?
Oh is it so that u don't include the entire jdk
the point of the module system was to modularise the jdk itself into smaller pieces with well-defined dependencies between them, as opposed to having a single rt.jar that is almost 70 MB alone without your application
That way you choose with what modules you want your application to ship with with as little as ~15 MB
I see
Interesting
Now I know the purpose of this module system
Wait so does jlink and jpackage package the jdk? And if so, does it look in the module info files?
Basically yes, they traverse the module dependency tree to know what modules to include and which ones to exclude
You can also manually add or remove modules, case for service loader bindings
non-modularised applications cannot be used by jlink/jpackage
because there is no information about module dependencies they can read
jmod command which can be used for many things can create, or help with creating, a module-info.java for a specific jar that isn't modularised
I mean you can do that but then what if some library you're using depends on some other jar that isn't in your modulepath during jlink? it'll fail at runtime far into it when it tries to use it, another reason of the module system is that all dependencies are known at compile time and runtime, and if a module isn't present the runtime will fail to load, it ensures every module to be is there
Is there a plugin for gradle or smth to automate it? Never written one myself but I remember seeing some long ones
Automates making module info file
i mean it takes no effort to write it
Oh
granted you're using IntelliJ it'll suggest dependency module name completions, and module descriptors are a bit more than just dependencies between modules
something that is a tad unfortunate is that, given this ^ (second), to fully advantage of the module system, every dependency needs to be a fully described module (have a module-info class), though it's quite easy to run 3 commands and a quick check to have the class in the other jar
Hey guys i need some help
anyone online?
SO I basically want to usee this "ROUND" thing to round to 2 decimal places like 10.25%
This is what they say it is: Returns an integer that follows rounding rules. If the value of the passed parameter is greater than or equal to x.5, the returned value is x+1; otherwise the returned value is x. ROUND(number)
The ROUND operation accepts a second parameter for rounding the number to the nearest multiple of this second parameter. ROUND(X,Y)
Either look at the methods that that method returns, look at the javadocs, look at https://jda.wiki, or ask in Jda discord
Although if ur going to Google the javadocs, Google it with "v5" or else Google will show you v4
im just asking how to use an object declared in a method n another class
not really related to jda, much more of a general java question
Ah I misunderstood
Well you would have to make it a field since a method one would be recreated each time the method was called
How do I create and use a field
and what is it useful for
you want to pass its reference
cool. uhh how you do it
we gotta somehow teach you how to work with objects
okay first you need to understand a concept, otherwise you will keep running into this issue
when you assign a variable, instead of thinking that variable becomes what you assign it
think of it as it tells you where to look (aka a pointer) and the value is at the end of where its pointing
an example:
Apple apple1 = new Apple();
Apple apple2 = apple1;
^ what do you think this does?
is there 2 apples or just 1?
you dont
you are just using terms that i dont know
good luck then 
you were using terms you didn't know
wait
If you don't know how to work with objects, OOP language is not ideal
explain to me how do you pass the reference or whatever
thats not the issue
not really
the issue is if we give you how to do that, next time you will come back with something else that involves oop
you need to understand how OOP works
we will be writing your program
this tells me that you got no idea how to work with objects
I'd say take the free lesson if Aki is gonna teach you somethin 
i just dont know how to do a certain thing
which is what im asking you to teach me
you just pass it as you pass everything else
either though a method or a constructor
one apple?
welcome from #general-plugins 
its 1
= operator assigns a ference
reference*
first one is also "looking" at the apple
it being the first one to look does not change how the operator works
"new" is the one creating it
oh right
one equals is to assign a value
so the 2nd apple is the first apple
there is no 2nd apple
they are just the same object
heres how i see it in my head rn
A = something
B = A
there is no B because its just A
well, the issue is
i cant take these objects out of the method they are
thats the problem
how these work is this:
extremely rough and simplified explanation but it should make it easier to understand
when you create an object using the new keyword it gets placed on memory (aka loaded) at a certain zone
and that certain zone has an address.
by saying A = x,y,z
they are both pointing to the address that the new Apple() was saved in (let's say 00005 just for example)
yes
therefore pointer
yeah this is pretty much correct
it points to the objects address
oh my god it points
only problem is when you then re-assign A
then B is no longer A
so, yes, mostly correct
?
because java is pass by value
A = something
B = A
A = something else
B = A (still)
Apple A = new Apple()
Apple B = A
A = new Apple()
now there are 2 different apples
this is what i was trying to explain,
you need to use == or = to explain a bit more
pointer does not point to the variable
it directly goes to the address
when you do B=A
I believe what you wanted to type was this
A = something
B = A
A = something else
B == A //?
which is false 
nah, they meant B is still A
yeah
ya I know, but it's hard to show with B = A if you're going between code and not code
even if i change A, B will still be A
here is the messy part though
lets say apples can have colors
class Apple {
Color color;
}
basically
what happens when i do
A = new Apple()
B = A
then i change the color of A
let me ponder this one
learning OOP is quite binary honestly
you either get it or you dont
once you do get it though its hella easy
im afraid im on the dont side but hold on
if you change the color of A then B will change to that color as well
?
ergo ```java
Apple A = new Apple()
Apple B = A // copy the pointer of A. so B holds a different pointer that points to the same location
A = new Apple() // changes the pointer of A, but B is a different pointer so it still points to the old object
Apple A = new Apple() //A points to address 00005 - where the new apple is stored
Apple B = A //B points to address 00005
A = new Apple() //A now points to address 00006 - where the new apple is stored
//B still points to address 00005 where the first apple was made
because B has the same value as A
1 equals is assigning value
2 equals is checking/comparing value
lmao
^ is great
think of variables as addresses
rather than values
because when you change a variable inside an object, that has nothing to do with the addresses of A or B
both still point to the same apple, by changing a property of the apple that they point to
you change it on both of them
if the addresses are the same for A and B any change done to the object under the address
will be reflected on both
Nik rn ⬇️
For complex objects, aye? Primitives are by value right? 
everything is by value
so
you first make a variable and make it an apple, giving it an address, then you assign another variable to the first one, essentially giving it the same address, meaning there is only one apple
i must be right because my color just turned green
thats how it works
yes
new is the keyword here (ignoring primitives)
and when you change something about the apple/address but not changing the address itself, then both variables will have that change done to them since they are both still pointing at the same apple/address
addresses are in the backend, hidden away. correct 
editing the properties of apple just edits whats stored at the address
i feel like i just unlocked the third hemisphere of my brain
thank you so much
❤️
now you can join rest of us at getting annoyed with how spaghetti OOP languages can get once the projects grow a bit
then you dive into patterns etc gl

Better terminology (well in this case more accurate) would be apple is your object
TRUE
i love how i came here to get help with implementing soundcloud and direct mp3 file links and instead ive learned the basics of oop
cant complain
lol
i mean you gotta use oop for it anyway
even better
λx . λy . x
!!!!
😌 😌 😌 😌 😌
there are some libraries made for soundcloud api btw
might want to google around and check those out to make your life easier
not sure if there is one in java though
What has half life to do with programming??
Simon would like to have a word with you!
also since when did helpchat have simon emoji xD
yeah its down
lol
from reading the actual api docs


