#dev-general
1 messages ยท Page 305 of 1
๐ฅฒ
lol
All values are negative, sadge @old wyvern
https://paste.helpch.at/isuwehamiq.md
push current
Add elara
pushed, added a limit so it only generates a single chunk, easier debugging
was gonna say scala but ig thats too much oop
https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Functional_languages add all of these, thanks
lol
https://elaralang.org coming soonโข๏ธ xD
excuse me ?
lmao
@prisma wave I dare you to throw a link to never gonna give you up in there just for kicks
omfg that took a while
that took like 30 seconds
lmao do it
1/30 chance?
Is there another way to do this? @surreal quarry
use 1.14+ to make nbt easier ๐
if they all will have the same name you could technically check the items displayname, but its better to just use nbt
nah not subtle enough
Frost, its just that perlin value is almost always negative I think
noise * 2 - 1
Did you mean this to bring it up to a positive range?
Because it doesnt neccessarily do that
@hot hull
Yea you just need to add the absolute value of the minimum
noise * 2 - 1 is negative if noise is negative
@prisma wave is it just me or can this just be a single assignment: https://i.imgur.com/3VqQrfb.png
for eg:
-0.5 * 2 - 1
= -1 -1 = -2
I see
Seems to have another issue lol
Although 1 value is 1, so that's promising I guess?
did I write that?
Cuz yeah it could be
Although I think I had a specific reason for making HandshakeData mutable
what happened to "immutability only"
also going to change the address to be an InetAddress and the next state to be a PacketState
I made a terrible mistake
Change them from what?
and refactoring this in OTBS
Wdym?
using a custom extension, fun String.toInetAddress() = InetAddress.getByName(this) because Kotlin 
just POJOs
ah right
yeah I'm basically making classes that look like they could fit in the API
pleeeeeeeeeeeeeeeeeeeease
extend String {
let toInetAddress = InetAddress.getByName
}
``` :slight_smile:
K&R bad
no
it's either convert what small amount of allman we got left or convert the much larger amount of K&R OTBS
and can we pleeeeeeeeeeeeeeeeeease stick by official Kotlin conventions as well
or at least, close enough lol
loosely
I will make you a deal
go for it
You can use "Kay and are" if you purge any of the ugly mutability stuff I'm sure you've done
LOL
with pleasure
also, I haven't really done that much mutable stuff in here
except for temporary lists
Ew
This would look meh
extend String
{
let toInetAddress = InetAddress.getByName
}
That's true
๐ฎ
๐ญ
๐ฅฒ
oh yeah, gl making allman work in Elara btw
Yugi have fun with that
ffs my Discord is broken
lol
I swear
parser.CleanNewLines
omfg what is this
Whats wrong with that?
xD
yea
Allman already works
wdym by not reading lines?
lol
Its not reading line by line anyway tho
good
its like a token stream
xD
fun flagsToProtocol(): Int {
var flagsByte = 0x00
if (isInvulnerable) flagsByte += 0x01
if (canFly) flagsByte += 0x02
if (isFlyingAllowed) flagsByte += 0x04
if (isCreativeMode) flagsByte += 0x08
return flagsByte
}
```on the topic of mutability btw, any way I can do this better?
Thats what I ask myself
Since java runs on JVM
does it support memory addresses?
uh
I need to convert 4 booleans (for the 4 abilities that are serialised into the single flags byte) into bytes
0x20323F
well, more asking for your acceptance tbh BM
No
Then why he uses 0x01
what
just a hex*value
That's just hexadecimal numbers lol
lol
Hm
can't you multiply a bool with a number in your almighty Kotlin?
It's something Yugi
this isn't JS you cretin
Kapp
4 * true โ
yea
oh god
what's the answer
4
4?
4
- false is 0
Oh because booleans are just numbers
ye
Stupid
๐
it would save you from those ugly ifs and you could make it in a single statement ;);)
I am more concerned about the mutability
It's not great
you could definitely get around it
you could define a list of functions (based on the booleans), filter all applicable and then sum()
Ez
const int flags = 0x01 * isInvulnerable +
0x02 * canFly +
0x04 * isFlyingAllowed +
0x08 * isCreativeMode;
๐
readability 
piss off
kni when
listOf (
if (isInvulnerable) 0x01 else 0x00,
etc
).sum()
that looks worse than my current solution
var is fine when you moderate it
if I was exposing mutable variables then I'd understand
but using var isn't exactly a crime
there is an entire family of languages where mutability literally does not exist
it is a crime
unless absolutely necessary
Also fun fact, apparently pretty much all types are erased in Haskell, so the runtime is really fast because it doesn't do any type checking at all
wait really
javascript doesn't do type checking either ๐ฅฒ
just throw everything in there
boom
idk how the language works but is it typed by the compiler and then they just remove that later
or whatever the equivalent would be to the compiler
or is it more like python/js with no types
yeah the compiler handles all of the type checking and things
And then it erases all of the types
Because it's already sure that everything will work
thats pretty cool
Yeah quite clever
although the lazy everything has some overheads apparently
Since every value has to be boxed
@old wyvern Do you think mapping the 0 - 1 values to a large range of let's say 60 - 180 would work in terms of approximate scale size when generating it in mc
Since multiplying the value by 100 ofc won't work
@prisma wave what should I do about the different fields for https://wiki.vg/Protocol#Player_Info btw? I was thinking either generics or separate classes for each
perfect
https://paste.helpch.at/afivabuleb.rb best I could come up with so far (if it's terrible, please feel free to rip me apart lol)
u p g r a d e y o u r p c
and yes, I'm aware it's a mess
lol
dear god
flags |= 0x01;
how would that work?
also, Niall you sneaky mother fucker
I saw your ass join the call deafened and then just leave
Same as += but looks nicer
is it nicer though?
it looks cleverer
they also have slightly different semantics
although it doesnt matter in this case
afaik
| is a bitwise OR isn't it
And use constants make it look nicer as well
if (isInvulnerable) {
entityFlags |= FLAG_INVULNERABLE;
}
true
yeah I'm gonna use constants
im gonna steal that emoji

aah that
lmao
๐ฅฒ
ffs
lol
@obtuse gale
you speak Spanish ๐
learning
o
un poco
tbh that's a pro move, changing the language of the products you use
i had discord in french for ages

people complained
lmao
no u?
u donkey
what is it with you and impersonation blitz
\๐
ew get outta here with your XML trash
we hate XML
donkey
anyways
is that a spongebob deepfake?
{ :message { :content { :emoji wink }}}
Yeah they didn't have trump, if someone ever finds a trump voice generator I Need it
Just go ahead and use Voice Cloning

python is master language
โค๏ธ Check out Lambda here and sign up for their GPU Cloud: https://lambdalabs.com/papers
๐ The paper "Flow-edge Guided Video Completion" is available here:
http://chengao.vision/FGVC/
๐ We would like to thank our generous Patreon supporters who make Two Minute Papers possible:
Aleksandr Mashrabov, Alex Haro, Alex Paden, Andrew Melnychuk, Angelo...
^ watch it
masturbating quality.
๐

]]
It's no science fiction
God
NO
Yes
Im voting trump. Sorry
IO America
And where should he build the world?
xD
A wall between all planets
@prisma wave Can I have the text for haskel?
that's rough
You know, I've been hearing a lot about this language they call Haskell. I've heard its type system is very good, the best in the world, a lot of people say. And so of course the democrats are trying to discredit haskell, they're telling people lies, they're saying it's not practical, and they're claiming imperative languages are better. The American people need the truth!
๐ฆ
Hey so I created an nbt for my item and everything now I want to check if the player clicked that specific item and if he did it should open up a gui the code I used is:
@EventHandler
public void onRightClick(PlayerInteractEvent e)
{
Player player = e.getPlayer();
// We need to convert the item to an nms ItemStack.
net.minecraft.server.v1_8_R3.ItemStack hopperNbt = CraftItemStack.asNMSCopy(player.getItemInHand());
// Here we are checking if the item has an NBT tag.
NBTTagCompound hopperNbtCompound = (hopperNbt.hasTag()) ? hopperNbt.getTag() : new NBTTagCompound();
// Here we are checking if the player clicked the Custom item.
if(hopperNbtCompound.hasKey("chunk-collector"))
{
HopperGui gui = new HopperGui();
gui.applyHopperUI(player);
System.out.println("It has the NBT Tag");
}
else
{
System.out.println("It doesn't have the NBT Tag");
}
}
it doesnt seem to work though
I think it is something to do with the if statement
the people need the truff
lmao
wait why the fuck did I put this here?
discord why do you like torturing me ๐ฆ
@prisma wave this is such a pain lol
I'm trying to figure out a way to not use hacks.exe with session and player objects
passing these objects around is already getting a bit messy
e.g. ```kotlin
session.player.uuid = uuid
session.player.name = packet.name
which is what I currently do inside of beginPlayState, to assign the user's UUID and name
yo anyone using gitbooks? How do I escape _? because if I put 2 it just makes the text inbetween italic.
\_ probably
try _
hmm doesn't seem to work
oh they have an entire wiki for this. found it.
Occasionally you'll want to use Markdown formatting characters as-is, without them initiating formatting. The simplest way to do this is to put a \ (backslash) in front of them. ๐ฆ
fuck
it should be \ as expected but for me its special case I guess. will just give up for now
Hi, can someone answer my question?
anyone wanna see some whacky movement glitches with MineKraft btw?
sure
you shooting off into the distance?
actually I fuckin' know why that is
actually im chillin now
oh lmao
it's moving you relative to me
probably me sending some whack packets
lol
i still didnt figure it out @unkempt tangle
even looking at your code, i dont see why mine doesnt work
can someone test my anticheat plugin
no way lmao
Can someone please join me in a VC
I just can't explain what I'm doing wrong
its driving me insane
not even java devs in other discords has any idea
why is it so fucking hard so save data for coordinates
I do have a question, why use locations as keys? You'll have to come up with a serialization/deserialization process into a single string yourself to be able to use them as keys in a format like YAML or JSON
No It don't and how else would I structure it?
Can I please explain you what I'm trying to do in VC
"No I don't" what??
You can use it as keys
I know what you're trying to do, you want to use locations as keys
My question is why
I didn't ask if you can or can't
You'll have to come up with a serialization/deserialization process into a single string yourself to be able to use them as keys in a format like YAML or JSON
it serializes for you, and it doesnt even have to be a string
why cant i send images nor screenshare..
?imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
this is a dev discord
to use as keys?
yes i already tested
Okay, then you'll have to deserialize whatever Bukkit gives you into a Map manually
First you are in the wrong channel for support, the support channel is #development, second, chill out lol
getKeys and getValues or whatever
thats the thing, it wont deserialize
how can I visually show you
ah 2 sec
ive been stuck with this problem since thursday, and it makes no sense
Well maybe if you had asked in the right channel
This channel is for chilling and talking about dev stuff
Okay, let's see, when used as a key, what does a Location serialize into?
also yeah #development
@eager fern are you good with bungeecord?
I got a magiclly switch
Can some one help me I am really IN A RUSH
'what you mean
Whats wrong with it?
I dont know
This is not a support channel, and ask your question instead of asking if anyone is good with bungeecord, people will help if they know what the issue is
How do i get a pic sent
errors?
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
#development ...
Its neither of #development
Don't think that's a development question either
^
what would it be then
ok thanks
How do I
A) Make the JList on the left smaller (width wise)
B) Make the TextField on the right taller(Height wise)
I all readey got it thanks Tho
you're welcome ๐
๐
I am a genius 
I guess optionals are kind of okay
I donโt understand optional
I am wondering if I should use Math.pow(n,2) or n*n for lazyhead
^
basically a safe wrapper for null objects
Ok thx
it has some nice methods like map(Function), get, orElse(T), orElseGet(Supplier), etc
Let me improve the formula
Ah I see
ifPresent(Consumer), isPresent, and others
IllegalStateException
quantum mechanics be like: I l l e g a l S t a t e E x c e p t i o n
huh, you can make a stream out of an optional
tbh Streams and Optional kind of go hand in hand, findFirst, findAny, and they have methods to work with each other, it's nice
hello i need help
hello why do you need help
this
No idea what you're even trying to show there
https://paste.helpch.at/ahububanon.md
When the server decides to crash after 55 seconds of starting up ๐ซ
oh no
#development Also explain your stuff a bit better, that question is very hard to know what you need
๐คฃ
@ocean quartz do you have an code examples on how you did pagination in guis, you usually save me with stuff im too smol brain to do
im not gay but NOBODY should be lonely on valentines day amiright
indeed
look for something called undo size
or it might be undo count
idk
it's got the word "undo" in it though
@obtuse gale
yeah it was something on clipboard.history.size or something
that doesn't sound like it
undo.documentUndoLimit
I think ij lowered it recently
because I swear I used to be able to do huge undos
but then recently, like you, I also had to put the limit up
when u undo file creations and shit
ugh
I kinda need those often xD
yea just put both to 1000
are they that much of a memory hog?
idk
lmao
i don't worry about memory usage ๐
32gb gang
Hey, I was wondering if someone had a moment to explain when I should use DAO and when to use DTO
DTO is the object that actually holds the data itself (you encapsulate and transfer data with it) and DAO is the object that takes care of and handles operations like saving, updating, deleting, etc. of DTOs
Hey can I have help with something please I am trying to click the hopper with the nbt and it will open up a gui how do I do that thats my code:
public class RightClickListener implements Listener
{
@EventHandler
public void onRightClick(PlayerInteractEvent e)
{
Player player = e.getPlayer();
// We need to convert the item to an nms ItemStack.
net.minecraft.server.v1_8_R3.ItemStack hopperNbt = CraftItemStack.asNMSCopy(player.getItemInHand());
// Here we are checking if the item has an NBT tag.
NBTTagCompound hopperNbtCompound = (hopperNbt.hasTag()) ? hopperNbt.getTag() : new NBTTagCompound();
// Here we are checking if the player clicked the Custom item.
if(hopperNbtCompound.hasKey("chunk-collector"))
{
HopperGui gui = new HopperGui();
gui.applyHopperUI(player);
System.out.println("It has the NBT Tag");
}
else
{
System.out.println("It doesn't have the NBT Tag");
}
}
}
morning all
just out of curiosity, what version you on?
because if it's pre-1.14, that NBT data will not save, just a word of warning
oh btw, did anyone know that command block minecarts are actually a thing that exist?
I just found this out when looking through the list of entities lol
/summon minecraft:commandblock_minecart 1 ~ ~ ~?
Yea
net.minecraft.server.v1_8_R3.ItemStack
f
https://paste.helpch.at/icocayoxav.cs damn that's a big enum (commented out = special)
might reorganise those, since some of them are marked in yellow, meaning they should only be spawned from spawn object
and the commented out ones have to be spawned in their own special ways (experience orb, for example, has it's own packet, spawn experience orb)
also, Minecraft's yaw and pitch axes are really weird
sometimes they use absolute or relative float angles in degrees, sometimes they use angles in 256ths of a full turn
oh well that's easy to convert between
to convert from 360ths to 256ths we just divide the fraction by 256/360
but that's not what we want actually
Fr
Kotlin minecraft jar?
168.119.171.28:25565
Also, send the link to the repo
https smh
smh BM
mobile
Also, how do you know how to do this
Copy paste it into chrome
me too smh
99% of the work is already done for you
pretty much fully documented, really nice guys on IRC that'll help you when you get stuck
bm
Mobile
?
Would an objectdecoder be able to decode the packets?
uh
we use Netty's ByteToMessageDecoder
Which is pretty much the same thing
I've a "chat" based project coming up, trying to get a better grasp of netty before I start. Had a look through minekraft
1.8 man
yeah gl working with NBT on 1.8
So any serializable object can be sent and received with just object decoders and encoders right?
any byte stream
Yeah I think so
I've never actually read the netty docs
packets get sent as raw bytes
Just copied notchian and used a bit of common sense
Bard I mean the provided ObjectDecoder
docs?
hmm
It's pretty simple
I guess I dont need to go too deep into this anyway
Yea
Probably not too much work for just chat
Probably not
you wanna send and receive chat packets?
I can already send messages through but there are more things to be dealt with, also
Not really allowed go into specifics ๐ค
Yes!
yeah that's because it has fuck all in it xD
Nonsense
No, its the only thing that can force information transfer faster than light!!
Quantum Elara
An entangled internet!
Information is sent and received instantaneously
So modern!
Guess where Elon Musk's parents got the El for his name?
๐ณ

Goddammit clyde

What's the most used version for plugins?
how do I save the NBT?
Use latest unless you have a specific reason to use an older version
lol
idk
I read that as him asking for the latest version of some plugin at first
yea idk
paper got 1.7.10 still available?
pls no
craft bukkit 1.7.10
Hey is there any way to get a clicked blocked display name?
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
I have tried but is there a way to get the hoppers name for example I want to open a gui whenever I open this specific hopper with this specific name I have tried NBT but getting the custom name seems easier
whenever I right click it
1.8 btw
been trying NBT for 5 hours now and working yesterday non stop
well when u place the hopper, u can store the location of that hopper in a list or map and when u click it u check if its in the list or map and do ur stuff
and if u need it to save after reboots, then store the locations in a file
and load them on enable
I see
There might also be something u can do with block metadata
Make sure to remove the location if it gets broken
but im not too sure with that
ok wow thanks a lot guys
Hey I cant get the location directly from the itemstack can I?
I mean I cant write something like this right?
public class EventListener implements Listener
{
GiveHopper chopper = new GiveHopper();
ItemStack hopper = chopper.hopper;
@EventHandler
public void onPlaceBlock(BlockPlaceEvent event)
{
Block blockPlaced = event.getBlockPlaced();
if(blockPlaced.equals(hopper))
{
event.getBlock().getLocation();
}
}
d;spigot BlockPlaceEvent#getBlockPlaced()
@NotNull
public Block getBlockPlaced()```
Clarity method for getting the placed block. Not really needed except for reasons of clarity.
The Block that was placed
wouldnt it just return a regular hopper?
d;spigot BlockPlaceEvent
public class BlockPlaceEvent
extends BlockEvent
implements Cancellable```
BlockPlaceEvent has 1 sub classes, 7 fields, 1 all implementations, 13 methods, 1 implementations, and 1 extensions.
Called when a block is placed by a player.
If a Block Place event is cancelled, the block will not be placed.
I am using BlockPlaceEvent
getItemInHand()
so I did some print debugging and it cant tell the difference between my custom hopper and the regular hopper
@oak coyote
anyone else?
Hello pro dev has joined the server. Let's talk about dev stuff
html is a programming language
so is css
Hi, I'm trying to learn how to use Nbt tags on 1.8.8.
My question is,
If I applied an nbt tag to an ItemStack and I want to check it afterwards,
Do I need to use the same compound that I used to apply the nbt tag?
xml is good
Can you help me with that?
What kind of data do I need to store inside of the xml file?
He's not talking about your problem lol
Also, might want to go to #development for this
Ok thanks
@regal gale Can you help me with my problem though?
Ok I figured it out, I don't need to use the same compound
But it's still doesn't work for some reason I'll try to send code
net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(player.getItemInHand());
NBTTagCompound compound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound();
if(chopper.compound.hasKey("chunk-collector"))
{
System.out.println("It has the NBT Tag");
System.out.println("Item placed on ground = " + blockPlaced);
}
The if statement is always false and I don't know why.
guys i dont see the free request plugin i think i have been muted but the guy that muted me over a month or 2 ego says you have bean muted for a month but i have not been unmuted yet
can someone unmute me?
@trim niche use a library for it, makes no sense to use nbt raw
Plus wtf is that chopper.compound
I don't think he specified any date though
Or at least, idk of private message
I swear that defeats the entire point in encryption
since that shared secret is sent in the clear, anyone who's sniffing can just intercept that and now they can man in the middle you
I assume it is all encrypted with a private key you don't have access to
nvm, encrypted with pub key
the shared secret is encrypted with the server's public key
yeah I didn't read that properly
u have the private key
securitee
so we send them the server's pub key, they gen a shared secret, encrypt it with the pub key, send that back, the priv key then decrypts the shared secret and uses that as the AES symmetric key
imo the relationship between client and server should be transparent
They shouldn't be keeping secrets from each other
If the server doesn't tell you their private* key that means you are in a TOXIC relationship**
GET OUT
Hello
hi
So girl having cc info = happy relationship ye?
Yes
Someone please shoot me in the head, I have to wake up at 5:30 tommorrow
7pm so no
Which one is more supported by java?
xml or json?
Thanks
funny Videos
please subscribe , like and comment. . .
Lol
YouTrack ad
@jovial warren do I have to use hikari for that kotlin database lib?
no
NIKE
but you definitely should
idk how to use it ๐ฆ
it's easy
https://github.com/Jaimss/terrible-plugin/blob/cde6c52ffc71ad8b494eb6ac4c19c9957e68e54a/src/main/java/dev/jaims/terribleplugin/Main.java#L48-L52 can anyone think of a better way to do this? seems good to me just wanna confirm
just initialise a pool config (HikariPoolConfig), create a data source from that config (HikariDataSource), and then feed it into Database.connect(dataSource)
https://github.com/JetBrains/Exposed/wiki/DataBase-and-DataSource there's an example that uses Hikari here
will see what I can do
I remember seeing someone say this about netflix or something
Someones partner would only type the password in for his girlfriend or something and not let her see it
Aparrently that made it a "Toxic relationship, something isn't right about that"
lol
The concept of relationships is fucked these days
Except database relationships ๐ซ
as my mentor/SENCO/the only staff member at school I go to for help says, if anyone knew the answer and wrote a book on it, they'd be a billionaire (at least)
lol
back then there were no nukes tho 
how do u want me to detonate them if they dont exist in that time period
return to monke
I'm so tempted to set the netty name for the packet encrypter and decrypter to encrypt0r and decrypt0r lol
please someone get that reference lol
Hey so I want to override a hopper's gui with my own whenever I rightclick it how am I suppose to do it this is my code
@EventHandler
public void onClick(PlayerInteractEvent event)
{
Player player = event.getPlayer();
Block clickedBlock = event.getClickedBlock();
Location location = null;
int i = 0;
if(clickedBlock == Material.HOPPER)
{
location = clickedBlock.getLocation();
for(i = 0; i < locations.size(); i += 1)
{
if(locations.get(i).equals(location))
{
gui.applyHopperUI(player);
System.out.println("Inside the if");
}
}
}
}
Lmao
what's hackerrank?
Competitive Coding
is it any good to try it?
Yea its fun
Basically CoC, but harder and longer
There are also practice challenges you can try
is it "multiplayer"?
Yes many thousands of people will compete
cant wait to have thousands compete in the pinnacle of programming to say hello world
I mean thats probably one of the practice ones
How do I fix this? It started to happen recently
Restart 
but
https://www.codechef.com/FEB21C
This is currently going on
you could give it a shot
Restart 
then theres no point in running debug mode
๐ฆ
New barry feature?
wat?
swap :: String -> String
swap [] = []
swap [a] = [a]
swap (a:b:s) = [b, a] ++ swap s
``` that is unbelievably hot
ew what is that new pfp
gtfo
๐คฃ
this one is better
is this a valentine's day thing or something?
lol
also, encryption still doesn't work
it broke
I can tell it's broke because the client doesn't log any received packets after encryption response
Whats the superior language now!

Also, was installing a stack package but not sure what is even going on anymore ๐
This has been going on for a while now
BM
Which package is that function from?
would you have a clue what "Note that the AES cipher is updated continuously, not finished and restarted every packet" means?
orElse would be something like fromMaybe
uh
takes a default value and the maybe monad, returns the value if its a Just and the default if its Nothing
i see
i need like "cascading" maybes
if the first maybe is Nothing, try the next, if that's nothing, use the last value
so its a list of maybe ?
yeah effectively
Like Java's or?
yup
not orElse
getType s = head $ catMaybes [
mapMaybe (\x -> Just "integer") $ readMaybe s :: Integer,
mapMaybe (\x -> Just "float") $ readMaybe s :: Float,
Just "string"]
``` i've got this rn, it's not working ๐ฅฒ
there's probably a lot wrong with it
i think because mapMaybe requires a Maybe a of the same a
i take no responsibility
i fixed this in the rewrite
rewrite?
it doesnt work
but it's slightly better
getType s = head $ catMaybes [
mapMaybe (\x -> Just "integer") $ readMaybe s :: Integer,
mapMaybe (\x -> Just "float") $ readMaybe s :: Float,
Just "string"]
``` ran out of time but I got to this
ok
if the first maybe is Nothing, try the next, if that's nothing, use the last value
Are there only 2 elements?
https://github.com/knightzmc/MineKraft-New/blob/master/src/main/kotlin/me/bristermitten/minekraft/packet/processor/EncryptionProcessor.kt#L30 fixed in the rewrite my ass
ยฏ_(ใ)_/ยฏ
it was working at some point
i think
i distinctly remember changing it from doFinal, because that's wrong
i just might have reverted it in my desperate attempt at debugging lol
you should go in a different direction perhaps, I know you want to make it as dynamic as possible but I don't think that works out for you here
any suggestions? This is a coc problem that's already expired lol
getType s = head $ concat [
mapMaybe id $ readMaybe s :: Integer,
mapMaybe id $ readMaybe s :: Float,
[s]]
o
That should work I think
ain't doing anything wrong there, am I BM?
shouldn't you be writing to out?
concat returns a list
hmm
wait no I do mean mapMaybe
takes a list of lists
It takes a list
what's the point of mapMaybe with id
mapMaybe takes a function that returns a Maybe and a list
idk man, that one's your fault lol
return a another list with mapped value with only the ones tht returned Just
I mean the second arg
yea second is a list
ยฏ_(ใ)_/ยฏ
hold on a sec
your snippet could be simplified yugi but currently it doesn't to exactly what bm did
yeah i need to map to stuff like "integer", "float" etc
and I think mapMaybe needs 2 maybes of the same type
it needs a list of maybes
Are you sure
so the function is id, but readMaybe s :: Integer isn't a list?
yeah idk im just guessing based on the error
but mapMaybe takes a list
not a single Maybe
wait lemme actually try running that
that's what I was trying to suggest earlier
Is there total conversation of code
I didnt notice that
from java -> c
Yes
Why not just write c?
in that case no there is not
C is a very different language
cuz I am lazy

however you can use the jni if you want to write to some C library
jni?
Nevertheless someone have to teach me pointers or when do use malloc or free
^
pepeP
so about all this scary Maybe stuff
okay
No. dont come with other things
i am just confused
i dont understand this
I learn C how I learned Java
CLion is good
straight forward and no reading
that's the issue with the code yugi sent, yeah
Its trail
if you wrapped it in [] it should work
use fromMaybe instead of mapMaybe
but I think you could simplify it using catMaybes
make it free ;c
yeah i was using catMaybes i think
are you a student?
but still doesn't solve your initial problem lol
Yes
yeah lol
you can get all jetbrains IDEs for free with the github student developer pack then
or just via jetbrains themselves
How
but github makes it easier
doesn't matter. you won't be writing any complex C code soon so a normal text editor will do
makes you learn how to work with the cli as well
I had C and C++ in my uni
But it was extremely basic
I forgot half of it
especially with struct
and pointers
that's half of what C is
For C++ You had to use iostream
not yet
this is what i was getting last time i tried
also, @prisma wave, decoding doesn't seem to be working (the client's sending packets but I ain't gettin' em')
leading me to believe it's because of the conversions
hmm
@prisma wave What should the function essentially return?
ah
applyMaybe :: (a -> b) -> Maybe a -> Maybe b
applyMaybe f x = case x of
Just a -> (Just . f) x
Nothing -> Nothing
getType s = (head . catMaybes) [
applyMaybe (const (Just "integer")) (readMaybe s :: Integer)
applyMaybe (const (Just "float")) (readMaybe s :: Float)
Just "string"]
```haven't tested, but something like this maybe? @prisma wave
oh boy
bit rusty with Haskell but it's basically your idea with an additional function
might be a few mistakes in there
o
or this might be AdoptOpenJDK, not sure lol
doubt
have you tried it?
yeah this is AdoptOpenJDK



