#dev-general
1 messages ยท Page 317 of 1
Oh god
tell him he can't code for shit
Where do people learn to code
๐
That actually forms an arrow
Like bruh all my plugins from the start were all copied from a fucking 5$ udemy course, and were still 100 times better than this
Shut yo ass up
If you're not having fun then why do it?
because the outcome will be rewarding lol
internal dread
Meh, coding is more fun than the outcome
agreed matt
working with Anvil is gonna be a pain in the ass, but when it works, it'll be amazing
I mean if you code like the dude that made GPTeleport, then I can see why it's not fun yea
That's why i never finish any plugin
same lol
@obtuse gale

Agree yeah
C++ is in an ew category of it's own
std::cout << "Hello World!"
like wtf is that
have u tried cpp before
it's no putStrLn "hello world"
lol
Have you tried a rope before?
lol
also, anyone here know about how mineshafts work? because I thought I knew, but after reading the wiki, apparently I don't
since when did mineshafts have starting rooms lol
You should integrate Scholtes' procedural dungeons into it
procedural dungeons?
mineshafts, but 400 times awesomer
I'm not interested in world generation yet lol
I just need to know how they can work so I can read them
I mean you've no choice even if you were, mine will be done in a couple of months, if you squint on one eye
I'll probably have made my own world gen system by then lol
Don't you fucking dare

I could tell you how to deobfuscate and decompile it yourself lol
also, which mappings do you want? client or server?
- That's not the only way to write to an output stream so joke's on you lol
- It's not about the syntax but about what the language lets you do and what you are able to achieve with it
- It's also about learning how things work and why
if I wanted to learn about how things work and why, I'd learn assembly, not C++
or C
because C++ and C are wildly different
assembly isn't gonna teach you much more than C would
once you know the instructions it's just unnecessarily verbose
true
operator overloading?
ยฏ_(ใ)_/ยฏ
imagine if c++ had >>=
Sort of, not quite, but yes
hmm seems google says no
You can define new operators with strings (like how you can use us and ms for microseconds and milliseconds with std::chrono)
But not operators with symbols
ah, so would those be usable similar to keywords then?
what
As in would those require any additional quotes or something at use site?
Or just those?
I don't remember tbh lol
ah
ill try googling
๐ฎ seems 1000ms would be valid
https://en.cppreference.com/w/cpp/chrono/operator""ms
%22%22
Amazing www
operator "" suffix-identifier
That's the name I guess lol
Aah here it is
I'm using brave(chrome) for awhile now. But I frankly say firefox is running better.
objectively wrong
My opinion is based on subjective expieriences.
Many times the browser acts like you enabled motion blur
Even moving tabs are laggy shit
In compare of speed. There are no difference.
I am better off with ff with performance.
?learn-java
Oracle Docs:
You should start with this, breeze through this(skipping stuff that doesn't seem relevant like bitwise operators), then hit this.
They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff
Online Courses:
If you want some free online courses, you can find them on Coursera. Yes they are paid but you can chose to take them for free with the only disadvantage being the fact that you don't get a certificate at the end. Some of the best courses can be found Here.
You can also take a look at Udemy but from what I've seen most of those courses are paid.
Other services:
Some other cool services that will help you learn java are SoloLearn and JetBrains Academy.
As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!
okay, I don't know whether I'm being stupid, but in terms of village farms, would anyone have a clue what "ViDF" could be short for?
Village Dumb Farmer
lol
Villager in da farm
also, wanna see something btw?
perhaps
that as well lol
latest build somehow succeeded
so now you can download and run the jar for yourself
pog
That's no good ๐ฐ
wdym?
I can run this in prod ๐
indeed you can
it does pretty much fuck all atm though so gl
currently working on structures (for Anvil r/w, world gen is a long way off)
https://minecraft.gamepedia.com/Chunk_format take a look at this joke
docker?
it will support Docker
I'll make a docker file later lol
unless you wanna make one for me ๐
it's only gotta download OpenJDK 11 and run a JAR
give it a working dir though, so you can inject worlds and shit
I mean shove stuff in a folder and have it be available to a container
what's it called
volumes
volumes? mounts?
that's the one
oh also, still looking for world donations btw if anyone has one
preferably a massive one with a lot of different structures generated
just not ones that take up half my drive please ๐
is adventure in paper?
Was merged into master yesteday
yeah is now
And everything related to md5's components is deprecated :kekw:
about time
yeah
And relocate ๐
never got those issues somehow
maybe because I don't really make public Spigot plugins that often
yeah.
I know what the issue is though
I haven't worked on a Spigot plugin in days now lol
been working on Krypton too much
formally known as MineKraft
actually works btw
developer api?
not yet, bloody hell we ain't that far yet xD
not viable
there will be one though
there's only villager and player entity
ur gonna have to update every version that's gonna suck
currently, you can join a world with a cube of stone, move around and see other players
chat?
yeah
you can download and test it out for yourself at the new CI https://ci.kryptonmc.org/job/Krypton if you want
id rather compile
fair
also, only works from JAR btw for the moment, due to limitations with reading the tag files that I haven't solved yet
is there adventure chat
not yet
uses my own stupidly lightweight, most likely useless chat component library called Komponent (I know, so original)
we will use Adventure in the future though
natively
god damn you Frosty xD
currently working on support for Anvil yako (not the inventory, the other one)
I mean, can't relate ngl
i thought it was smth else on her face at first ๐
I wonder how much 1.17 is going to change the protocol lol
because that's gonna be fun

Your sanity go brrrr when that happens
as I'll likely be the one having to do all the work for it, yes, yes it will
who knows, maybe we'll have a proper team by then
or maybe BM will start actually doing shit xD
type Player =
{ Name: string
Location: Location }
if it was that easy, everyone would do it
just to make sure in kotlin I have a forEach. to add a continue I'd use return@forEach ?
yes
you are just using the wrong language
it is easy in actually modern languages
stfu before I actually find where you live
๐๏ธ
Kotlin is a modern language
Kotlin is so 2016, all my homies use Elara
^
shut it
Kotlin bad, Haskell good, Elara good, F# good
that's not helpful
maybe, but that is not helpful
get with the times bardy
V good
we are not rewriting Krypton in a different language and that is final**.**
time to move into the 21st century ๐
Is that a challenge I see
Do it in web assembly
Time for Krypkell
it's a fact
rust compiles to wasm ๐
o
Maybe, maybe not
ok who wants to help me make a minecraft server in f# or haskell
In in
lol
Im in*
great
how about you pull the finger out and actually start contributing to your project?
F#pton
LMAO
i am busy
fair enough
Haspryton
however im sure i could take time out of my schedule to using an actually modern language ๐
busy with these already-late commissions? ๐ฅฒ
xD
maybe
as I said, Kotlin is a modern language
If only you'd put that enthusiasm in PDM ๐
define "modern"
the unloved child ๐
it's not written in a "modern" language you see, so BM doesn't care about it 
Sadly ๐ฆ
Does it have a bind operator? Is it built around Monads? Does it have a kleisli composition?
^^^
@prisma wave Rewrite PDM in haskell
would that even work?
Etalang
also, I swear Haskell isn't designed for the JVM
Eta is a simple, compact and powerful programming language to build scalable systems on the JVM. It is a dialect of Haskell on the JVM.
๐ฎ
There are jvm "ports"
o haskell is faster than java
Also seems haskell can have impure code if needed ๐ฅฒ
not on the JVM though
on a real note I think its pretty close bm
Haskell GHC Java - Which programs are fastest?
Let's make our own JVM in rust
Java's greatest strength is also it's greatest weakness
not sure this is 100% accurate but
yes!!!
With blackjack and hookers
yes
Yea it if look overall its pretty balanced around bm
I was just about to say that you finally produced an idea that isn't stupid, but you ruined it Matt
๐ฎ
Lets make java with pointers ๐ฅฒ
Creating a JVM in Java, that runs on an existing JVM 
sounds like a great idea wdym
That liftIO tho ๐ฅฒ
JVM in Kotlin/Native
sadly side effects are necessary
great idea, when we starting?
converting IO to Maybe Monads
Monads?
wot
๐ซ
It converts an IO monad to a Maybe Monad
Let me actually confirm this
Yes its kinda required to be used in the discord-haskell package it seems
It uses that to send messages without having to deal with a IO result type
hmm
Already did
shouldnt it be IO ()
o
o
Joking btw
wdym?
Though i think it'd be fun to write a jvm in rust
also from the definition it seem it doesnt neccesarily have to be Maybe
JustVM
๐ฅด
RVM
liftIO :: IO a -> m aSource
yes, but I mean, it seems to work
Let me show you an example
Excuse me sir, that was a lot of giberish you just said
readMaybe:: Maybe String
readMaybe = do
res <- liftIO getLine
res
unironically i dont think there's a huge amount of benefit of building a JVM in rust
It isnt tho xD
i dont know much about this but i think most of the data is too dynamic that the lifetime checking and stuff would actually get in the way
And I get shit on for using fancy words...
lmao
๐ค
(ฮปx.ฮปy.(ฮปz.(ฮปx.z x) (ฮปy.z y)) (x y))
++++++++
[
>++++
[
>++
>+++
>+++
>+
<<<<-
]
>+
>+
>-
>>+
[<]
<-
]
>>.
>---.
+++++++..+++.
>>.
<-.
<.
+++.------.--------.
>>+.
>++.
now that is a modern language
looks vaguely similar to haskell
don't ask how long it took me to remove the comments xD

seems legit
that's brainfuck btw, for those of you who don't know
ยฏ_(ใ)_/ยฏ
love how that code could be compressed into just ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
bardy I think you're lost
yea?
wat
what does <- do on a Maybe?
you think I'm ever not completely insane when I'm in this chat for extended periods of time? 
Just remove [^+\-\<\>\[\]\.,]
Ez
Wdym just comments?
that will literally remove all the commands
Lol
on a completely random note, I can't tell whether me having so much to do that I don't sit there and wait for a response to messages anymore is a good thing or a bad thing lol
is this supposed to mean something
care to elucidate
stop using big words that I then have to Google ffs
https://i.imgur.com/wHxy2KH.png the amount of times I've seen this now ffs
higher kinded types
ffs
referential transparency
Same as on IO
you know what? if you can't beat 'em, join 'em I suppose
shorthand for handing with a bind in a do
so it's binding to the identity function?
Kotlin good Java bad Haskell bad Clojure bad Elara bad OCaml bad F# bad
false
false
true
new rule: if you've never used a language you're not allowed to call it good or bad

runs
excuse me
lol

not my fault u cant keep up with the times and these GREAT languages ๐
afaik that's equivalent to ```hs
(liftIO getLine) >>= \res -> res
Right?
keeping up with the times... haskell...
What is a smithing table do?
yes
Isn't Haskell older than java
older yet still modern
yes!!
AHEAD of its TIMES
TRULY
stable release was 2010 dumbass
older than Java my ass
Java was around in the 90's
if i wanted to start a server, what all would i need?
first appeared lol
haskell's first stable release was in 2010 and other jokes to tell your colleagues
also, it's mx + c not mx + b
The TALENTED people really spent 20 years making sure their language was PERFECT before releasing it
more like they spent years trying to make a language and failed several times over
i'd like to keep my budget within 2k-ish
kotlin ๐คฃ releasing it before it was ready in like 5 years ๐คฃ ๐คก
๐คก RUSHED and UNSTABLE language
not now it isn't
I guess that's true
most of the experimental API works completely fine though so I don't get why it's experimental
Because they're in testing
I think they kinda just use it as an excuse to be able to change anything they want
it's like "if we change it and we break your shit, we told you it could break at any time ๐"
y'all really have no life
no u
Yeah, that's the point?
Imagine saying that in a block game discord
R3kt
Never said I had 
Who needs a life anyways
lol
says the engaged man
shhhh
lol
this is where developers with no life come to hang out, circlejerk, do other shit, and most of the time have fun lol
it's not circlejerk if it's true
why is that of interest to you dkim
๐คจ
o my
o my
o my indeed
i dont get the point in this dkim
wow!!

๐
You're clearly a clever chap @stuck harbor
yep very 100%
This one is better
lol

lol
lmao
oh jeez
Character development
You're not the guy I used to know.
https://static.macmillan.com/static/holt/famous-people/
My book, Famous People, is out now!
In a perfect world, men like me would not exist
dont say that matt ๐ฆ
Variations on a theme.
https://static.macmillan.com/static/holt/famous-people/
My book, Famous People, is out now!
wtf ๐
This guy is awesome
you gotta love him
First video i saw from him was the potion seller one
that is so cursed
that's a classic
although I actually hadn't seen that one when I discovered him
Yes
yes
Actually
theres a slight difference
it would be
liftIO getLine >>= Just . id
or liftIO getLine >>= \res -> Just res
Aah right
Which is why the just
Yeah I see
if it was without liftIO it could be
getLine >>= return . id

oh yeah, that reminds me, there's another plugin to add to the list of plugins that will have support for Krypton when it's finished xD
which is
o
just spent two hours trying to figure out why my nexus docker container isn't accessible, and i tried making a new volume and it worked, which means i have another few hours of figuring out whats wrong with my old data ๐ฅฒ
or i could just say fuck it lose everything and start over
my name is James
I came up with Jaims a while ago for shooter games cause it has "aim" in it lol
just never stopped using it
Is Github taking too long to respond, or is it just me?
Works fine for me
you just suck ig
any obvious reasons ./gradlew build would work locally but not on jenkins
error on jenkins -> https://paste.jaims.dev/okizucuboz.makefile
build.gradle -> https://paste.jaims.dev/ogigujexoy.cs
๐ฅฒ
nooo
it takes forever
and half the times it bluescreens
then it takes even longer
Check on task manager for java process
it will fix it ยฏ_(ใ)_/ยฏ
i did :c
And?
Are you sure it's all?
Search more
Kill all what's in Task Manager

omg this is so annoying. my project builds perfectly in a docker container, normally on my pc, but not on jenkins ๐
Anyway so this is rather off-dev, but it's also related to js so I'll ask here: when you use View Page Source in browser, inside <script> tag there are a thousand lines of code which are shorten by ... in tail. How can I actually expand it?
kill System
I can't even find an option to expand
Just either search for the java one or restart (or log out of your account) your pc
And i thought i was lazy
lol
now you're gonna be running 2 servers lmao
O_O
[21:57:07 WARN]: **** FAILED TO BIND TO PORT!
[21:57:07 WARN]: The exception was: java.net.BindException: Address already in use: bind
[21:57:07 WARN]: Perhaps a server is already running on that port?
wtf
i think its intellij's fault or smth
Send a screenshot of your processes
Just restart pc for god sake 
lol
Thanks
lmfao
idk
man sent 2 processes
No java
lol
no matt
theres a lot
Sort it by ram usage
Also it wouldn't be a java process if it's a server likely it's a windows command processor
Unless you're one of those that use the gui
If so, leave
uh
It's a wmi provider host
why am I scared to run commands said in this chat
ok
but it just kills all java processes
There is no time to wait! Ask your question @half harness!
There is no time to wait!
okkk
Ask your question!
how come i have to open my firewall and stuff to let ppl come in my server, but they don't have to open their firewalls?
i believe their firewall is open by default
you can block all of your own outgoing traffic, but that wouldn't make much sense
that's my very basic understanding of it
my intellij is failing me :((
lol
fix? #7777
@old wyvern not to flex, but plenty o'relics
๐ฎ
I'll farm the bp rn
You aren't in the main class scope so you can use this
what do i need to do to use it in this class
you need to pass in your main class instance
Dependency injection
Frosty does
?di
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
Where's dependency injection in haskell :sad:
ty
Partial Application sometimes and other times composition ๐
public void method() {
main.myMethod();
} what is that
okay.
yugi what's your opinion on mixing functional and oop?
Partial application means passing only a few arguments that whats required to return a new function that takes the rest of the arguments to complete the call
for eg:
say :: String -> String -> Integer -> IO ()
say name message time = putStrLn $ intercalate " : " [name, message, time]
Now lets say we need a partially applied version of this that only requires the time stamp, we can do
sayHiToFrosty :: Integer -> IO ()
sayHiToFrosty = say "Frosty" "Hi"
So now you can complete the say call with the new sayHiToFrosty function any number of times, you could assume the first 2 dependencies were "injected".
I think it would be nice. That also seems to be what a lot of languages are somewhat going for now, i.e, taking inspiration from fp ideas, with streams and stuff for eg.
did you read the blog post about the history of oop I sent the other day?
it's an interesting read
talks a little bit about how well functional and oop go together
I dont think I read it, was in class. Ill have a read now
might even learn something
I certainly did
never even heard of message passing before reading that
I kind of get it, but I'm confused
yea from the guy who coined OOP right?
yes
He seems to not like what has currently become of oop
Which part confused you frost?
yeah he's not overly partial to it, especially c++
syntax confuses me a shit ton, but I get what you're trynna say
yea c++ is...well lets just say... a mess. Or atleast seems like a bit. I havent used it enough to tell but from what I've seen, its a bit bloated with features
ah, fair
I believe the article mentions java is heading in the right direction, or maybe I read that elsewhere, but I believe java is the better of the two when it comes to their oop impl
ironically javascript has the impl closest to the original meaning
Wait really?
I guess his version of OOP doesnt really care around encapsulation and stuff
oh it does
Js does allow those tho right?
those?
as in something like access modifers
ofc theres exports are stuff when going into node and all
js has access modifiers
Really?
private, public, protected
hang on I think google is lying to me
Yea the first result from google seems to be talking about data hiding with function closures
my first result was this but actually clicking on stuff gave me different answers
yea but open the page tho
The followings are the access modifiers in most of the object oriented programs.
Private โ Access is limited.
Public โ Can be access from anywhere, access is not restricted.
Privileged/Protected โ Access is limited to the containing class or types derived from the containing class.
Thats what was actually in there
xD
google extracted it out of context
right anyway
Because they share so many features in common, I like to say that JavaScript is Smalltalkโs revenge on the worldโs misunderstanding of OOP. Both Smalltalk and JavaScript support:
"message passing"?
Yea gab
essentially gaby, u send a message to an object, and then the object will determine what to do with it
e.g. running a specific piece of code
OOP was supposed to mean just objects communicating with each other (i.e, message passing) to form a program
java doesn't implement true message passing which is why we're not familiar with it
I see
java's idea of message passing is just calling a method with some arguments
that's not what it's meant to be though
groovy has a better messaging passing impl afaik
or it might be scala
i'm not a professional on this, first time I looked into message passing was yesterday
Not sure, but scala seems to be slighted hated by both oop users and fp users from the people I've heard from ๐ฅฒ
Scala is odd
L
I think he turned off DMs from server members as well
Imagine not having him added
has he always had them off?
because in that case then I must've been removed ๐ฆ
also, why we no friends

Barry good
God I fucking hate people who extract after 1 round
lol
I've opened 10 relics and I still haven't gotten that fucking mirage bp
wat dis
WarFrame
ah right
@hot hull maybe you just trash

only bad players blame their team mates for their failure
What does that have to do with anything
looks like you're blaming your team mates to me

alright, I'll stop bullying you xD
Blaming them for extracting yea cuz then I can steal their good relic rewards
I have 3k health and 1k shields, I can solo most shit
Haskell?
ill complain about u in a minute
ABSOLUTE BEAUTY
the fact that future structures are even stored is just ridiculous in itself
let alone the format they're stored in
I might have to create my own serialisation system for this
Do it
also, gotta love whatever tf this is amirite https://github.com/Kotlin/kotlinx.serialization/blob/master/core/api/kotlinx-serialization-core.api#L6
"public abstract interface annotation class"
It's not that I couldn't do it solo, there's 4 objectives to control, and it'd take forever to do it solo
Cause you know we speedrunning this bitch
kotlinx.serialization is extensible
buzzword
so I could technically write my own serialiser impl for this
oh also BM, guess what else kotlinx.serialization supports
HOCON
Properties
ProtoBuf
CBOR
and there are YAML impls
so I can just write my own NBT impl for this
Stop saying you can and just do it duh
I have such a huge brain
u dont
Press X to doubt
ur brain is most likely around the average size of a human being, assuming u are human
I do have a bigger head than the average person, that is a fact
doesn't mean I have a bigger brain though
I'm just much more logical
yeah wheres the ELON implementation
make an ELON specification first
in full
none of this half-assed shit
thinking if I should bother to make this multiplatform or not
I'll just make it JVM for now I think
totally not just going to copy the structure of the JSON serialiser and make it work for NBT
[ ()*+=&^%$"/.,|#@;:!`?<>{}\[\]'~\\]now that is what you call a regex
๐ฌ
wanna know what that's for?
Question, is possible to importa an IDEA project on Eclipse, right?
:why:
Yes or no, apes
surely eclipse gets a full rework at some point that actually makes it decent
A friend does java this semester and their teacher want to use Eclipse
Yeah
just tell them "IntelliJ better, so I'm using IntelliJ"
Lol
man I should be a comp sci teacher lol
im sure they cant argue with u over which IDE u use
exactly
I think they can just not accept your submissions.
that's not fair though
just because they use a different IDE and they think they know better
just convert it to an eclipse project at the last minute
Did you just call us apes
also, if they reject your assignment because you didn't use a specific tool that is completely personal preference then you can surely report that to the school
Tell the teacher he's a fucking retard
I mean, idk how your system works, but over here, you could get the teacher in trouble for bias I believe (or something like that)
ffs
imagine
unless its in the syllabus surely they cant mark them down on it
I mean, at least you get to use Java
^
if I was doing my programming project at school, I'd be forced to use Python with PyScripter
Im stuck here with VB
Legit just use advanced shit Gaby, I'm betting he won't know what half the shit does
at the end of the day ur getting .java files and then a .jar so
i feel ur pain
:))
no dependency management
Poor bbg
i had to do it for my college too
๐ฅฒ
G code is where it's at
plus ive got a mac lmao so i have to vnc into my home computer and code with like 4000 ping
I've asked for IntelliJ so many times and they just brush it off and don't give a fuck
and they block all EXEs so I can't even run a portable version
lol
Bardy, usb and just transfer it to the pc?
think I've used code::blocks before
would that even work frosty?
yeah because that's gonna work when I can't run any EXE files isn't it genius
yeah
How the fuck do you run other programs then
everything on a blacklist prob
trusted installed programs
cant you just take in ur own laptop
Legit tell them to go fuck themselves if they force you to use dumb shit
thatll go down well
Like okay dinosaur, you use your 40 year old program
legit the sysadmin is a posh arrogant asshole who's barely liked by his own team
asshole I'd pressume?
nice one barry
Only in aussie land
https://vm.tiktok.com/ZMeYjUGTq/
รhole
lmao
java.lang.UnsupportedOperationException
at java.base/java.util.Collections$UnmodifiableList.remove(Collections.java:1318)```
wow
can I tell that to get fucked somehow or nah
Show what u doing
how did u even get that error?
it's called an UnmodifiableList for a reason
itemPanel.model.items.clear()
ah yes
of course it does
where model is this val model: CollectionListModel<AdditionalDependency>
Wow google. Just... wow
Nullable defaults
With that we end up with this ๐
pref.getString("key", "") ?: ""
you know Spigot has that as well right?
it's a hack lol
it means they can return null when the value in the default map is null iirc
I mean, doesn't make any sense why it should be done like that, but it is lol
wdym?
I mean especially bad when google calls kotlin Android's official language ๐
lol
also, ```java
StringBuilder var_0 = new StringBuilder(" ");
int var_1 = 0;
for (int var_2 = 0; var_2 < param_0.length(); ++var_2) {
int var_3 = param_0.charAt(var_2);
if (var_3 == 92) {
var_0.append('\');
} else if (var_3 == 34 || var_3 == 39) {
if (var_1 == 0) {
int n = var_1 = var_3 == 34 ? 39 : 34;
}
if (var_1 == var_3) {
var_0.append('\');
}
}
var_0.append((char)var_3);
}
if (var_1 == 0) {
var_1 = 34;
}
var_0.setCharAt(0, (char)var_1);
var_0.append((char)var_1);
return var_0.toString();
it's the code that Mojang uses to escape any characters that don't match the regex [A-Za-z0-9._+-]+
I know that can be written better
If you got the regex you need to use, why do you need to decode it now?
@old wyvern I got a bp for you, but it's MR 8 again so kek
wdym?
I gotta decode this lol
it's the code that Mojang uses to escape any characters that don't match the regex [A-Za-z0-9._+-]+
escape any characters that don't match the regex [A-Za-z0-9._+-]+
yeah but looking at this builder, we don't actually have to escape everything
we only need to escape 3 characters
so I was wrong
was asking what api it is, but u said to bardy so nvm
had a feeling it was android anyway
ah
Hey, what's the best site to learn java or free?
sololearn is decent
what happened to ur tutorials bm ๐ฆ
"excuses"
๐ฅฒ
no
damn thatss pretty good
public static String quoteAndEscape(String text) {
StringBuilder builder = new StringBuilder(" "); // create new builder to store result
int quoteChar = 0; // initialise a variable to store the char to quote the result in
for (int i = 0; i < text.length(); ++i) { // loop through every character of the text
int currentChar = text.charAt(i); // get the character at the current index
if (currentChar == 92) { // if the current character is 92 (backslash)
builder.append('\\'); // append double backslash (appends a single backslash, one of them is to escape the appended backslash)
} else if (currentChar == 34 || currentChar == 39) { // else if current char is " or '
if (quoteChar == 0) { // if the quote character is 0
quoteChar = currentChar == 34 ? 39 : 34; // set the quote char to the opposite of what this char is
}
if (quoteChar == currentChar) { // if the quote char is the current char
builder.append('\\'); // append backslash
}
}
builder.append((char) currentChar); // append current char, escaped or not
}
if (quoteChar == 0) { // if quote char is none (didn't find an existing quote)
quoteChar = 34; // set quote char to "
}
builder.setCharAt(0, (char) quoteChar); // put quote char at beginning
builder.append((char) quoteChar); // add quote char
return builder.toString(); // return result
}
```in this code (renamed stuff and other what not from the original), won't `setCharAt` down the bottom there set the start char to the quote char, replacing whatever was there before?
ikr
@hot hull perfect for u with that AMAZING website
oh wait... well that's hard to spot
it initialises an SB with a space in it, so it's able to replace the space with the quote char
:)
