#dev-general
1 messages ยท Page 98 of 1
@ocean quartz I need that editor, what is it? I use np++ and its great and all but that is in my dreams
Lite text editor
ok thats cool, but whats the name of the text editor so I can download it?
๐
Is it literally called Lite or are you just messing with my one braincell?
I'm on my phone ok, that's blurry af on here. Y u buuuly me :(
๐
its called lite
@ocean quartz is this it? https://github.com/rxi/lite
No ik, your screenshot is fine. Its Matt's one that I couldn't read
That's the screenshot Matt sent in the read me isnt it?
Yeah that one
Found it because of this cool tweet
https://twitter.com/i/status/1266071700288016384
Playing around with motion trails https://t.co/0jWmQgeCiY
140
959
O.O
@prisma wave ive converted it in to when expression (much better), but how would i go about adding this if statement to check for a leap year?
https://paste.helpch.at/pupimudidi.java
You can do even better, if the month % 2 == 0 you have a 31 days month, else it's 30
You don't even need the when ;p
but february ๐ฆ
but yeah thats what yugi was saying
i guess i will do it that way as im not sure how to nest an if into when
๐ code ๐ review
https://paste.helpch.at/yeqaneyana.java
You could return on the ifs, so you don't need elses
@jovial warren its my second function
ah okay
can format() not be called from LocalDateTime.now()?
or do you definitely need a new instance of that
hmm let me see
the if statements look like arrow code to me
gotta be a better way
also your braces are all over the place
wat
val year = LocalDateTime.now().format(formatter).toInt()
i removed one of the vals, so ty bardy
np
@ocean quartz could u give me an example? ๐
there has to be a better way to do that big himalayas setup you got going on
i mean ye there is a better way, but i prefer everything being braced
if (month == 2 && year % 4 == 0) {
println("This month has 29 days")
return
} else {
println("This month has 28 days")
return
}
if (month % 2 == 0) {
println("This month has 31 days")
return
}
println("This mont has 30 days")
That doesn't work perfectly
still looks a bit funny
You guys wanna review my first plugin in kotlin
couldn't you use a when there @ocean quartz ?
when {
month == 2 -> {
if (year % 4 == 0) {
println("This month has 29 days")
} else {
println("This month has 28 days")
}
}
month % 2 == 0 -> println("This month has 31 days")
else -> println("This mont has 30 days")
}
Yeah
Also you could turn
if (month % 2 == 0) {
println("This month has 31 days")
return
}
println("This mont has 30 days")
into
println("This month has 3" + (1 - (month % 2)) + " days");
Readability gone

also, use ${} instead of + +
Not a C expert
C? xD
:cmonBruh:
for me, readability isn't key
or whatever the lang may be
let me know if I did anything completely wrong lol
Because I argued a feature was possible and I got banned on the server
Config.java ๐
println("This month has 3${1 - (month % 2)} days")
println("This month has 3${1 - (month % 2)} days")
I'd be surprised if that was valid
went with matts when expression because readability :p
You'd need an object with @JvmField
went with matts when expression because readability :p
that's what documentation is for
so ty matt and everyone else ๐
If you want to look "professional" on your homework go with mine
less readability = better grade
trust me
๐
the teachers wont know what uve wrote, so they give u instant A*
yeHA
readability is what documentation is for
As long as it works under 1 line
fuck people being able to read the code, they can read the docs
What docs
That means I have to write docs
javadocs
Just look at the method name
or kdocs for kotlin
yes @rotund egret well said
@versed ridge Let me blow your mind with Kotlin
if the method is named getDaysInMonth(int month)
Then wtf is it gonna do
Yep, get the current weather
fun PlayerMoveEvent.onPlayerMove() {
}
Boom
lmao
oo
Readability is more for future work, or other devs looking at your code.
@ocean quartz good use of JVM magic
That way you don't even need event
It's more of a good practice thing
Specially important if you want to collaborate
but I do want people to be able to somewhat read my code
@versed ridge Another small thing that could help you out ;p
private fun User.teleportTo(location: Location)
user.teleportTo(location)
Ikr, function extensions are great
magic
it's JVM magic
JVM magic
that's what it's doing
๐ฎ
my code be like https://twitter.com/Zorchenhimer/status/1134178911628267520
that is barely magic
it actually adds that method to the class at runtime afaik
coroutines are jvm magic
it's not really magic
extension functions compile to static helpers
That takes the receiver as the first param
The kotlin bois ran it at the same time
I also need a drink after that tweet wtf
what about stopping other methods from executing without stopping what's executing them? now that's JVM magic
Tweet?
my code be like https://twitter.com/Zorchenhimer/status/1134178911628267520
go up a bit
huh??
yay for matt because I can't send imges
@ocean quartz So what is @JvmField
Basically makes the compiler not create setters and getters for the field and make it public
Which is what you need for ConfigMe fields
also, mockk, that's JVM magic
basically makes you able to mock specific classes, objects, or methods, and change what they return
for example, if WhateverClass.whateverMethod() returns x and you want it to return y for testing, you could do:
declareMock<WhateverClass> {
every { whateverMethod(any()) } returns y
}
Wait what?
basically, every time that method is called, with any values for parameters whatsoever, you can change what it returns
I know, was just telling him what annotating the field with @JvmField does
Which is what you need for ConfigMe fields
Yeah, you need to annotate fields with @JvmField for them to work with ConfigMe
no you dont
@field:Comment for example iirc
I'm confused, how do you not need?
properties are the combination of a field, getter and setter
Don't you need to do this?
@JvmField
val NAME: Property<String> = newProperty("name", "")
You really shouldnt?
The only difference is that it wont make a getter for it
The field would still exist
also, what's ConfigMe?
yes
what's so bad about it?
never used it before so I'm not defending it
just curious
Nothing really
Sx, it does not work without it
wait
On the example
it says newProperty(...)
But that isn't defined on the SettingsHolder interface
wtff
Yeah but tf does it call
??
newProperty seems to not be defined anywhere
I don't see any class
public static final Property<String> TITLE_TEXT =
newProperty("title.text", "-Default-");
what class contains the static method
@topaz bay It doesn't, Exception in thread "main" ch.jalu.configme.exception.ConfigMeException: Could not fetch field 'TOKEN' from class 'Setting'. Is it maybe not public?
You even were the one that told me I needed to use @JvmField, you even use it on VoteParty
Glare did that actually, I was very much against using it
But wow, thats extremely stupid
It is yeah, it requires you to use a public static field
@JvmField is only really used for testing though
What would be easier would be configme simply using setAccessible(true)
Its not even a matter of it not resolving the field, they literally use getDeclaredFields
ยฏ_(ใ)_/ยฏ
Why not make a PR if it's 1 line lol
You think I'm gonna fork this entire thing, and pollute my repo list
To change 1 fucking line.
Absolutely not.
It also makes no difference to me whether they do it or not, as I don't use this.
Fair enough
Has anyone used multicraft? I cant seem to connect to the panel remotely
I can connect to it localy but not remotly
I forwarded to
21, 80, 25465
I tried externalip:81 and ipv4:81
Hello
Hi :)
Do you guys know why untouched odino left?
Uh, long story
Verrrry long story
Theres chat logs in off topic if you wanna read for yourself
Just search from untouched odin
Np
Hope he will reply me :((
I don't like to stalk people on the internet
But I will have to do it
Does deluxetags work with luckperms?
Yes, and this isn't the right channel
I just joined what channel is it for asking questions like that?
๐
@old wyvern First one right?
Yes
https://twitter.com/iamdevloper/status/1268828830220812290?s=19 this hits close to home
slaps top of freshly bough side-project domain name
you can fit a lot of hopes and dream in this bad boy
158
1405
lol
Lol
What is a good free server panel? I have multicraft but it's only 1 server.
Or how can I share my console
Okay can that support multiple servers
Kotlin man strikes again
Thanks School
what u want frosty 
does rcon show errors?
Can node canvas do shadows?
I'd imagine so
funny would know ๐
aha that makes more sense then what I was doing
https://www.html5canvastutorials.com/tutorials/html5-canvas-shadow-text-tutorial/ that's probs a better example
Add shadows to your canvas text using these 4 shadow properties.
is java awt canvas ok for discord bots?
Putting it in embed is more trickier than
u are ceo of everything ๐
Idk how Barry gets canvas drawn and uploaded to embed message immediately
magik
Sure ๐
search from: Niall#4640 ceo
ceo of Search tool
u are ceo of everything ๐
ceo of ceos
CEO of making everything ceos
๐
๐
.
boost ๐
I want to speak to the ceo of help chat
u are the ceo of help chat
2nd
bottom
Cause 1st is harder to track
I make it an option I like first
I dont understand the dashed line
nor do i
No animation is better
Isnt that supposed to represent the next/prev viewbox
Why does it never actually align
lol
Show the math@heady birch
graphics2D.drawRect(cursorPoint.x - 50, cursorPoint.y - 50, 100, 100);
O damn
@topaz bay No it represents the scale
If you look at the solid one, the dashed one represents what the solid viewport scales to
I dont understand
das crazy
is there where I can ask for development/java programming help?
Cheers
#development
@onyx loom ^
cheers
๐
I still dont get it
@topaz bay ??
@prisma wave ๐ฎ
GG
๐
Nice
I need to upgrade my custom enchants system
But currently custom enchants are stored on a user
Im changing it to multiple pickaxes and shareable
How would i do dis
just store it on the pickaxe object?
How
just do it 
Just apply the enchant?
Does remote console display warns / erros
How u apply
you have to display them as lore anyhow
finishingItem.addEnchantment(enchantment, level);
Well yea, but if you have an actual enchant on the item, it's 100 times easier to manage it
Why tho
How are you creating the custom enchant rn?
No
Why not lmao
Because
Because what?
Just because
i believe thats how TE does it too frosty
Nah i wanna allow creation of enchants ingame
it used to @onyx loom
And TE is trash
โน๏ธ
I use nbt for custom enchants
I wanna add enchant creation to my admin gui
Well the anvil adition made it a tad less bad
Same deatb
I mean you could still make a class which would register any enchant you want
Nah
"Nah"
Y'all legit taking a ew way of doing this
Who cares
I do ;c
Its only me who will ever see it
Still
Its a private plugin
still
utilize the api to it's full potential
Doing it with nbt is super easy
Are nbt stringlists a thing
What if you want to add a thing in the future?, you're gonna have to rework the entire system of getting enchants
This man is against extendibility
This way you can just add a method and you're set
You can't tho
What if you change the enchantment name
Wym I canโt
Not an issue
I literally have
Like I can add as many things as I want
and remove as well https://paste.helpch.at/eculelinim.java
Without having to change the system at all
I have a customenchant class
So can I
I already do
You're storing it in nbt, how are you gonna add lets say an enchant tier, without changing how you parse things?
Frosty make the class final ;p
smh
Wym an enchant tier
And that
Add a secret thing in the lore
I have no tiers
Dude..
^
Lmao
What if you had
It would require you to change the entirety of the system you currently have
I could make the initial nbt tsg a list of enchsnt ids
Then add more nbt tags
Like <id>_level
This hurts my head
Well how do the tiers work
You do you, icba to continue
add a secret thing in the lore
Like a unique line
no?
secret thing
force op
Then you cant programmatically add enchants
You can
your lore line would have an invisible token
By making a manager for those enchants, which adds whatever enchant you want lol
store the token alongside everything
Niall, can you stop with lore
๐
legit the worst way of handling them..
Send example code
I don't create my enchants on the go, so I've no code to show.
...
niall ur gonna make frosty yeet himself
intercept the packets and hide it to user
Lol

F
Ill use ur idea niall
gooba
gooba gooba
Should be perfect
Like yes you need to still manage the lore to display them, but using the lore to actually store them is just simply said dumb
Like yes you need to still manage the lore to display them, but using the lore to actually store them is just simply said dumb
is there a better way
Same goes for nbt
lore is best
I'm done
I wanna know the other way
How else without nbt
I showed it above Niall

frosty rn
x10
Show example code of how the fuck else lol
Opening the window as we speak
Of how to store them
this might take a while
Thats what i need code example for
oh god disgusting
@hot hull nice nice
โน๏ธ
(Ignore that dive event registration at the bottom, forgot to remove it)
Thats hacks
I donโt see a reason to do it that way instead of nbt lol
Because it's 100 times cleaner and more expandable?
I'm actually interested in seeing that ^
lies
fine then
Was recommended a video on youtube called "Object-Oriented Programming is bad" and this comment is pretty good
"There are only two kinds of languages: the ones people complain about and the ones nobody uses." - Bjarne Stroustrup
next time ill shit all over ur work
well first id need an actual physical form of this code, maybe printed out onto a piece of paper
then ill record it and send to ur dms ๐
Maffie, can you show the way you're handling it
both 
does .. only work when using a positive step? (e.g 1..5)? as it seems i can only use downTo to create a negative step
Store enchants on the item
DR, can I see your way? :p
@solemn monolith was it you I made that enchantment plugin for?
Nope, not me ๐
Sure it was..
erm feel free to send it over yea
Enchantment being my own class btw
but not me lol
@heady birch this is what i have atm https://paste.helpch.at/ocuvabifin.cs and it works, but if i were to change my for loop to for (input in input..1) then it dont work ๐ฆ
Oh I made paypal set
yea
?
its not a big deal anyway, i would just prefer to have it being .. as it looks a little nicer
idk ask sxtanna or bm lol
the paypal thing was me
DR, I use this to display the enchantment (still gotta tweek some stuff, but it's mainly finished)
https://paste.helpch.at/nokeciluxo.php
@chilly zenith You still use that plugin i made for you?
Also, if you wanted to display the enchantment as
lore:
- 'enchant 1, enchant 2, enchant 3'
- 'etc'
Your way would probably break
why the heck would u ever do that
yeah lol
That's how hypickle does it :p
????????
?
theyre fukin weirdos then
And idk, it looks good in some cases
@heady birch minebombs?
yeah CK bombs wasnt it
sum like that
A feat of human engineering
and I have, I might use it for my next Season
Nice
Wow leads can be used as a swing
Best usage of leads is a pinata party
AOT swing?
Oh yea I gotta send you that reddit post
Advanced widget toolkit
what was that a reply for?
Shush
xD
Make a lasso
I meant the swing part
lol
Sure xD
How far can you bend a lead
dont think it can loop
spawn multiple
hmm
The leash is a packet, so you could just use that to make the ring
@ocean quartz
commandManager.getCompletionHandler().register("#enchantments"
, (input) -> Arrays.asList(<values>))
;
``` This is correct right?
Cause it's telling me it's not registered
nvm I'm stupid, was registering it after the command
Yeah that's what i was going to ask xD
yo matt
Heyo
How goes the tab completion xd
And we got sorting :))
Will do it will do it xD
Hm, kinda want to make that for sponge now.
Seems fun
The downside is I'd have to use the data API
Make what ๐
The custom enchants
dewit
I mean isnt it easier with forge?
Well sponge also supports vanilla, so itd support both technically
damn
ah
I like how java allows any object to be created with the default object constructor with reflectionfactory xD
access-modifiers ded
ReflectionFactory#newConstructorForSerialization
@topaz bay apis
?
go lang server
How would you describe/name each one?
It will be selectable by user and I have NO idea what to name each method
canada
:rolling eyes:
@topaz bay
First can you see my question above
Then wondering how I can put this into a single equation:
if (wheelRotation > 0) {
newScale = currentScale / (1.0 + wheelRotation * 0.05);
} else {
newScale = currentScale * (1.0 - wheelRotation * 0.05);
}
The math somehow must cancel out or something. Im talking about / and + in first equation and * and - in second
no but.. could you?
same
I always approach math with pure logic, I would 100% do it that exact same way
I like how java allows any object to be created with the default object constructor with reflectionfactory xD
@old wyvern
Wait until you find out about Unsafe
my MapLayer class, should they have a render method...
Or should I make an LayerRenderer e.g
although I also need to detect clicks and hovering
maybe LayerHandler
Idk how to structure this
Then wondering how I can put this into a single equation:
@heady birch
Curscale * (e^(log((1.0 + |wheelRotation| * 0.05)^-signum(rot))))
as in
curscale * Math.exp(Math.log(Math.pow(1.0 + Math.abs(wheelRotation) * 0.05, - Math.signum(rot)) )
gross
... I will try this... but performance is really key so I will most likely use the if else
Basically we are using (log|A| + log|B| = log|A*B| ) property ,(log|A| - log|B| = log|A/B|) property and (log|B|^x = xlog|B|) property
sure
That's very gross
Yugi check DMs
@prisma wave wanna review some kotlin code sir
Hi
Absolutely
Nice pfp
ty :P
perfect lol
Whats throwables?
it was in showcase a while ago iirc
sec, and no
u throw shit
not too hard pls
that RTPCommand seems a little like arrow code to me
val timeout = System.currentTimeMillis() + Utils.toMillis(settings.getProperty(Config.TIMEOUT))
while (!isSafe) {
if (System.currentTimeMillis() > timeout) {
failed = true
break
}
if (user.data.hasCooldown("rtp") or delays.contains(user.uuid)) break
location = getRandomLocation(user.location)
if (isSafeBlock(location)) isSafe = true
}
This is not ok
I tried my best to not make it an arrow lol
if (settings.getProperty(Config.COOLDOWN_ENABLED)) {
if (!user.isAuthorized("rtp.bypass.cooldown")) {
if (!user.data.hasCooldown("rtp")) {
user.data.giveCooldown("rtp", settings.getProperty(Config.COOLDOWN_TIME))
} else {
user.sendMessage(
settings.getProperty(Config.PREFIX) + settings.getProperty(Config.TELEPORT_COOLDOWN)
.replace("%time%", user.data.getCooldown("rtp"))
)
return
}
}
}
that's an arrow alright
ignore the bad formatting lol
@topaz bay What would you suggest I do instead
ignoring the fact that its a while loop with a user configurable exit condition on the main thread
yeah that's gonna break some stuff
while (!isSafeLocation(location))
{
location = getRandomLocation(user.location)
}
Way simpler than playing around with that boolean
Not to mention
if (isSafeBlock(location)) isSafe = true
should just be
isSafe = isSafeBlock(location)
Is that a Utils class in kotlin
also, that failed = true could just be a user.sendMessage followed by a return if I'm not mistaken
afaik you can return in a while loop
You can
while (!isSafeLocation(location))
{
if (timeoutConditionMet)
{
return user.sendMessage(failedMessage)
}
location = getRandomLocation(user.location)
}
// location is safe here
Like the build.gradle?
yes
Didn't put that on github
you're supposed to push that
build.gradle, settings.gradle, gradlew and gradlew.bat are all supposed to be pushed
afaik
Also, you start with isSafe being false, and you replace the original location
Even if that original random location was safe, you enter that while loop
xD
tru
if I were you I'd rewrite a lot of it, and include the build files in the commit
without build files, someone coming along trying to fork this repository can't build the project on their machine
because they don't know what you depend on
first step I say is to push those build files
ASAP
lol
and if you don't intend on having people fork your project and make changes you shouldn't have it open-source
good point
I just put it on github so I could get opinions on it
well, I strongly recommend you push those build files as soon as possible to the repository
easiest way to do this?
i want to do it in one input
There's no reason not to open source something
@prisma wave people seeing my poor code ๐ฆ
and if possible theres no need for them to enter how many numbers they need to input
@onyx loom make them enter numbers with spaces in between, or some sort of separator in between, then split them by whatever splitter you asked them to use, then do whatever you want to do
was thinking that, ty
@prisma wave Why is my Utils class bad
because you don't tend to need utility classes when using Kotlin
like fixing that arrow code
I'm thinking of how I can fix that rn lol
if-not-return instead of if-so-continue
Because the entire concept of a Utils class isn't very kotlin idiomatic
exit early
But I don't want to return if those conditions aren't met
You should favour either objects, or top level functions (ideally extension functions)
I want it to continue
It doesn't apply to every possible situation ofc
But look at this
Your logic should not be in this if statement
This if should return
also
if (from.block == to?.block)
Also, some of these ifs can be combined
this also brings into question your cooldown api
The cooldown is stored in a file
also, having your config be a class of constants is a questionable way of getting config values imo
I'm using this for my config https://github.com/AuthMe/ConfigMe
considering the fact that Spigot already caches config values, I find libraries like that to be quite pointless
Its not about caching
they do make your code a bit more readable I guess
yeah fair point
Technically slightly faster
just don't think a class of constants is quite the right method
it's a bit messy imo
Like this? @topaz bay
https://paste.helpch.at/erayekejut.cpp
No, I meant on the side of the cooldown api
ah
me too
I dont understand why theres a permission node in that method
Also, please dont mix braced and non braces statements
Always use braces
wym?
And I included a check for a perm in the giveCooldown method to remove 1 less if lol
if (user.data.hasCooldown("rtp") or delays.contains(user.uuid)) return
That is...
No...
Dont use or
you can do one-line if statements if you please
Why no or?
if you want to do one-line if statements you can do one-line if statements, the only thing I say is: don't have a non-braced if statement followed by a braced else statement
or is a function youre calling, and it does not short circuit in the same way || does
that's a bad mix of braces
if he wants to use a one-line if statement that's up to him
he means you should never use an if without {}
which you can do if you want to
doesn't make all that difference
just personal preference
No, I mean don't use any control flow without braces
Because its messy
And you can do literally anything if you want to
there's nothing objectively or fundamentally wrong with control flow without braces
You could write the entire class on 1 line if you so wished
I think it looks better without them for 1 line
And so I should replace or with ||?
is it not?
the fact of you not needing braces for control flow statements was put there for the express purpose of allowing you to write control flow statements without needing braces
anyway, let's move on
Nvm, it is
ez
oi you geeks, is it possible to create a custom effect, and have it display where the night vision is?
@jovial warren ?????
Or is that another thing mc fucks us with?
That argument doesnt even make sense
what about it doesn't make sense?
Like I said, you could write the entire class on 1 line
Is that allowed specifically so that you can do it?
lol ponged urself, what a noob
Frosty pretty sure it isnt
if they didn't want to allow you to write control flow statements without braces they wouldn't've allowed you to write control statements without braces would they @topaz bay
Anyhow, shame
Well besides the arrow code anything else that I should change?
anyway, whether you write control flow statements with or without braces when it's a single condition is up to you
it does
if they didn't want to allow you to do it they wouldn't've allowed you to do it
There are plenty of things you can do that are convention breaks
yeah and I don't believe not bracing control flow statements is one of them
although that depends on the style you use
convention isn't an opinion
it's a set of defined standards
you can't jsut say "i don't think this is conventional"
I guess that holds up
still doesn't mean you should be acting like it's against the law
You really should though
If you dont make a big deal about the little things, you end up with the thousands of shitty programmers who make bukkit spigot tutorials on youtube
People not caring about the details is literally how you breed shittyness
@versed ridge push the changes to gh
kk
and push the build files as well
very important
push the build files
there should be a gradle/wrapper directory, build.gradle, gradlew, gradlew.bat, and settings.gradle I believe
actually idk whether settings.gradle is necessary
someone verify that
it holds properties and some pre setup logic
๐คฆโโ๏ธ
what about spacing
also, try to improve your commit naming
yeah that'll break some shit
if that is null it'll throw a NullPointer
I believe
!! is the equivalent of Objects.requireNonNull I believe
I think it's more equivalent to assert != null
its literally just if (thing == null) throw NPE
Like literally, the code is if null throw npe
pretty much
that's kinda what I mean when I say pretty much
"pretty much" means "nearly"
spigot has a method in location for this
What method?
Like literally, the code is if null throw npeIsnt that exactly what requirenonnull does tho?
toCenterLocation
Like literally, the code is if null throw npeIsnt that exactly what requirenonnull does tho?
yes but!!avoids a method call iirc
public static <T> T requireNonNull(T obj) {
if (obj == null)
throw new NullPointerException();
return obj;
}```
it's inlined
it gets done by the compiler
oh
@versed ridge it might be paper
Just use paper?
The problem with paper is that, well if the users are using spigot it won't work
Well there are people that still uses spigot lol
tuinity
Theres never a reason to use spigot over paper
Tell that to the people downloading the plugin
alright I have switched it to paper
@versed ridge good
pushed more changes
Your random location method is kinda questionable
why not get the highest block at x and z
And get the location from that?
Does it make a difference?
don't think it'll make any major, major differences, just maybe a bit cleaner and better of a method
Sx, added the set accessible on my fork of config me and no longer need the JvmField, it really was just one line there
lol
did anyone say anything on my issue?
Oh how nice
comments? @ocean quartz @versed ridge @frail glade
You are the nerds who apparently use this thing
I mean as long as I don't need to put @JvmField every where them it's fine imo
Yeah i think that's basically it
I think there was also a thing were we needed to use * because of varargs but I'm pretty sure i was just doing it wrong
The annotations would get rid of the kotlin warning for platform nullability ambiguity
wow.. say that 5 times fast
yes?
oh right
Mobs spawn there do they not?

