#dev-general
1 messages ยท Page 219 of 1
problem is that you need to subtract 2 from the overall magnitude
which is uuuh it'll require some fancy math to compensate for orientation
- angle dependent
okay let me try to explain again, so the entities current location is 0, 50, 0 and the player is on 10, 50, 10 so the entity should move to the player, but instead being directly on the player it should stay away 2 blocks, think about this, lets image i want to simulate Social distancing in minecraft, it will require that the entity keeps a specific distance.
Ah
I understand now
which is uuuh it'll require some fancy math to compensate for orientation
@obtuse gale thats what i thought too, but i am shit in maths so i asked here
basically you want to keep a radius from the player
as the center
of a circle
then the circle has radius 2
then you want to find the nearest point on that circle closest
to the player
you can do some math to calculate this
yes he knows what he has to do
yea now you guys understand it ๐ but that still require math and i am shit in math
but how
Well you got two ways. You can be not precise and use a brute force ๐
Or
let me grab it one sec
use this weird shitty formula
from newton or idk fuck
and yeah
well fefo is pretty good with that kind of stuff, so i hope he tells me that the formula is good, as it should happens pretty fast even if the player is moving
uuh
also if i use pathfinding from paper, how can i assure that the entity always goes to the location, i dont want it to have like a queue, that it first walks to one location and from there to the other, is always should have the direct path to the specified location
oh i had once written some code for that problem but i forgot it and i cant look it up now
that made it worse, i understand less then on the first page you send me
oh nvm
it just looked weird
i kinda get it?
Its actually not that hard
double vX = pX - cX;
double vY = pY - cY;
double magV = sqrt(vX*vX + vY*vY);
double aX = cX + vX / magV * R;
double aY = cY + vY / magV * R;
Taken from the first link, this looks good
when looking at a 2nd time
I mean it's as fast as it gets
so i assume R is the radius i want to keep eg 2 blocks
The most expensive operation is the sqrt but the performance impact is negligible
and X and Y should be X and Z correct?
btw magV is just the distance between the two locations
p is the point, i.e. the location of the entity
c is the location of the player
v is the vector between them
and a is the point on the circle
i.e. the target location
should the p and c be the vector itself or just the X value and Z Value?
is this correct? Java public Location calculateNewLocation(KittyPlayer target, int radius){ double vX = entity.getLocation().getX() - target.requestPlayer().getLocation().getX(); double vZ = entity.getLocation().getZ() - target.requestPlayer().getLocation().getZ(); double magV = Math.sqrt(vX*vX + vZ*vZ); double aX = entity.getLocation().getX() + vX / magV * radius; double aZ = entity.getLocation().getZ() + vZ / magV * radius; return new Location(target.requestPlayer().getWorld(), aX, target.requestPlayer().getLocation().getY(), aZ); }
its just temporary the values will be replaced ofcourse
If you only do for x and z you'll basically "draw" a cylinder centered on the player that extends all the way vertically, if you want a sphere around the player you should also account for y
yeah looks good ig
i think i only need x and z, i will try it rn. Fefo are you online in like a few min?
mhm
dont send the packet over to the client
Entity#setVisible
isn't that exclusive to armor stands?
I think so
Pretty sure it is.
hey
what you know how I can do so that on filezilla its transfer only 1 files per 1 files instead of 2 by 2
idk I don't use filezilla
big brain Lemmo
Does anyone know why it says noniDOTio authored and noniDOTio committed 9 hours ago there and displays myself as two different users? I added my GitHub account to IntelliJ and commited from the built-in GUI. This started to happen after I reinstalled windows (and thus reinstalled IntelliJ as well)
https://github.com/NoniDOTio/SMPTweaks/commit/1c5c8d66024fec9892e1eb1f22162f7ecbb32258
It's ok when it's my code though ๐ ๐
Yes bb
Em can I steal ugh I mean inspire from your code? Thanks
Yes ofc
Aw, I was going to post a wiki about a programming language I just heard of today
called Brainfuck
+brainfuck ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
shab, you sometimes make me want to use the suislide
it's no clojure
Dear god
Poor naming
i know
I can only imagine
i lowkey feel like i'm selling my dignity away
katsu
Yes dear
I wanna see what u been up to
elara hopefully
A lot of coding
push push push
You know I'm incapable of learning Go BM
Friday Frosty, friday
Can you hold on that long senorita?
I don't think so
:-
:=
That ^
"-"
It's like python bread with Clojure
My internet is shit
how
Watching wildcat's stream, 10 sec loading, 1 sec watching
:= mr walrus that nobody likes, and I suppose it's like the opposite to clojure since not many brackets
no
But still
Well so is let, var, or val
:= is more concise
So is e for event but Frostiboo has a vendetta against me if I use it
that's too concise
mappedSlice := make([]string, len(otherSlice))
for i, e := range otherSlice {
mappedSlice[i] = e.string()
}
no slice.Map ๐ฆ
imperative everything
Unfortunate
So is machine code but nobody likes writing that
When a youtube you like uses the same theme as you
A little exploration of some of the fundamentals of how computers work. Logic gates, binary, two's complement; all that good stuff!
I see thereโs some interest in getting access to the little simulation tool I made. Itโs not in a very user friendly state at the moment, but Iโ...
If anyone wants some great content
I see 2 nerds
do I spy a cat
You do spy a cat
I dislike him already after seeing that spacing @ocean quartz
When are you gonna just let people do things the way they like? xD
Never.
relocation
How do I unlink a discord account from the spigot linking ?
an admin has to do it i think
And why would you need to link a new account?
The old one got compromised. I have my new one (this one) in the spigot account
In that case, CC: @pallid gale
Okay thanks
@pallid gale would it be possible to unlink the Ruinfox account from =spigot 666004. That account is no longer in use (was compromised) I would like to link this one. Thank you
so I blame @steel heart then
@obtuse gale how dare you blame my holy concotion of wealthy functional interfaces
xD
Imagine having to make an interface for each extra argument
tsk
I miss C++'s template varargs
vararg generics
types eq
well I'm excited for the remarkable elera generics
elarics
it's literally a dynamically typed language, but static
Idk but alex, if you somehow get it to work then all I can say is that your intelligence probably lays somewhat beyond humanity and society
exactly
I started working on the static typer earlier
Kinda lazy this week but ill start soon
it's all of the benefits of dynamic typing, but as a static language
mhm
or save yourself some time by using haskel
tempting
delete the project
when it works
If it works 
pdm is like epic but more epic when no bugs
uh sure
i dont think i have the willpower to do a full rewrite on my own
what do you need?
Well, nor do I but I can make plentiful prs
i like the sound of that
did i hear maven
sadly
well whats the pain? doing it fast or get it to work?
parent poms
they make me want to die
every time i think i've got it working another "unknown placeholder" error comes up
Just make the placeholder known, duh dummy
because these "professional" projects have about 30 different modules with 1 placeholder in each pom
and so it has to be loaded in the right order
fml
that sounds like a total disaster
it is
not to mention the current gradle plugin is a mess of kotlin spaghetti
lemme just write a quick haskell hello world to calm me down
lol
i dont think i have the willpower to do a full rewrite on my own
@prisma wave
Im in
๐
Hello ๐
3 Kotlin projects, 2 Java ones, Github:
It's done by bytes I think
C# be like: You can copy my homework but make sure you change a bit so it doesn't look the same
int[,] is weird
Oh interesting, it's just a 2d array, kinda better than int[][] in a way
That literally was the point of c# though lol
brain cells are lost here
Hey
I'm trying to install JDK-8 on debian 10
But I can't figure how to make it work
Quick question, would it make sense to have a timed cache which stores all recent access of data, (if not present, data get's querried and put into the cache), asking cause some data will never get used so seems pointless to have it loaded
memory is cheap and fast so the answer is usually yes
i usually just store everything in mem, since query sql can be slow if you use mysql that isnt on same server.
I do the same Gasper most of the time, but seems pointless to have data which you'll never use (since there's gonna be plenty of data)
depends on plugin usecase since in my plugin i just have to check if its special crop each time user breaks crop XD
Well yea that would make sense, but in my case it's triggered by a command which will not be used very often/if at all by some users
However this might be tedious to sync data between the cache and the db, so gotta think of that as well
Deluxemenus has a bug, it does not read the item minecraft:dye in any way.
Probably because there are many different types of dye
With JSONMessage#runCommand, does it need a / or nah?
?tryandsee
I think so
what makes sense in minecraft?
Gravity?
Except that they donโt exist ?
u can't implement gravity in mc without mods
In real life
it's straight up impossible
Lol
Yeah true
you can do vectors, but it's laggy af and you can't control strafe
that's why you'll never see a good gravity impl on a server, because it's impossible
just a fun fact
Thatโs sad
Doesn't gravity already exist lol
yeah but you can't modify it
Oh yeah
Except that they donโt exist ?
@steel heart you've rly not seen one irl? I have a zombie pet
Dont think so
Nah.
9 8 7 6 5 4 3 2 1 0
This program is so crappy
It doesnt even say how to print something like that
System.out.println("9 8 7 6 5 4 3 2 1 0");
nvm found out
that didn't work, did it?
that worked
Right..
it said write a program to print this 9 8 7 6 5 4 3 2 1 0
It probably meant a loop to countdown.
no it was basics of java string or something
String result = "";
for (int number = 9; number >= 0; number--) {
result = result + " " + number;
}
println(result);
However, that wouldn't work, cause spaces at the end 
However, that wouldn't work, cause spaces at the end
StringJoiner
shut up weeb
sHuT uP wEeB
@normal talon If you're wanting to learn Java. The Java Mastercard by Tim Burkle or whatever his last name is on Udemy is pretty good.
tim buchalka
I bought that but never actually went over it kek
i think
im on jetbrains academy
Buchalka yes Piggy
Yeah that sounds right. I did start the course. Haven't finished it though. He is really good at teaching though. Explains things well.
Best way is to steal code, and make it yours
Piggy, go bully GH into adding folders, thanks
you're stupid
I have 70 repos, and everytime I try and find something I reeee
oh
I thought you meant like making folders on a repo lol
hence the "you're stupid"
yeah that'd be cool
I'm sitting at 92 repos or something ridiculous
not even my all time high
I had 100+ a while back, deleted some tho
I have 49 public ones, and it's kek
61 public ones 4 me
I don't wanna delete any cause if someone finds anything interesting they can use it
I just deleted empty ones & old forks where I didn't pr anything
Makes sense yea
Gh folders would be cool.
How jucky would this be
No
because iirc you can't change parameters... or can you?
You can
wut
If they aren't final you can
But you shouldn't
oof
You're stupid Conclure 
Can't in Kotlin, cuz Kotlin smart
Nah u r 4head
Very, so any suggestions on my question
ahHhHh I don't get the point of using kotlin when there's java
and groovy for build.gradle
Whatโs your question Frosty?
How jucky would this be
@hot hull
That's the point of Kotlin, so you don't have to use the yucky Java
well kotlin comes with great features and reduction of boilerplate
Why drive a Fiat when you can drive a Lambo
Frosty what is wrong with the code?
Imagine reading omg
Isn't there a Statement#setObject method? That would set it correctly without needing this?
Wouldn't that fuck up the retrieval then?
Well your choice of theme is 
It's amazing fuck off Conclure

Probably wouldn't, retrieving and setting are separate
That makes life easier then
You'll have to test though since i don't remember if it's correct or not
@prisma wave does kt not support ArrayListMultiMap?
wut
using entries().forEach() it is Entry<UUID, Robot> instead of Entry<UUID, Array<Robot>>
Jesus, please change your system โค๏ธ
that's how multimap works
whaaat
smh
RobotProfile object 
shut up
Never!
which was the map type that made the work with list as values easier?
ahh
I thought it will give me the entire list xd
Are you talking about MultiMap?
ye
Clean enough or?
final StatementCreator databaseStatement = new StatementCreator(connection, Statement.DATABASE_CREATION);
databaseStatement.assignObjects(databaseName).execute();
StatementCreator#of sounds better imo
Indeed it does
Why though
Wdym why tho
@forest pecan You need to be sentenced to death.
lol what happened
@prisma wave why not use unsafe whenever possible in java?
unsafe is pretty much C but more verbose
Shouldnโt it be faster or anything ?
unless you have a specific reason, you shouldn't be using it
not to any practical degree
it's faster in that it circumvents all of the benefits of java
memory safety, safe access, etc
๐ฌ
it's called unsafe for a reason
as i demonstrated you can use unsafe to segfault in 2 lines
when that should normally be impossible in java
if you want speed that much, use c++ or c lol
ASSEMBLY
define regular
The fastest would obviously be machine code
Since that's the lowest level you can possibly get
Because it's totally impractical and barely human readable
The fastest would obviously be machine code
@prisma wave
Lets try direct eectricla impulses
Bruh assembly is hard enough to read
electrical*
Damn you're right
gn
Also if anyone has any idea how to use RandomPattern from WE API please ping me
Not to ask to ask, but it isn't working
Only outputs the first value
No randomness
Just curious.. what would happen if you had method a that called method a? ๐
stack overflow
yes, it gives a stackoverflowerror
o
thx
Source analyzer?
nah
just scans javadocs
รถ
only have support for types atm
gotta add methods, constructors, fields, and parameters now
it probably won't work, and you probably won't be able to access that site afterwards.
Nice lol
yeah it's basically a dos tool
if you use it like that
I could probably add some sort of cooldown but I won't, because if it had one it'd take like 10 years to index something
going to have to implement something to save indexes so it doesn't have to do it on every startup
ah shit
I didn't account for the fact that there's duplicate names in bukkit
L
I could use some table design help, so I have two "groups"
Creators Group
uuid | supporters | supportCodeUses | supportCode
Supporters Group
uuid | supportedCreator | supporterSince
However me no likey
smh, okay then, me still no likey
It feels so good to see a stacktrace after debugging something not working for ages
I take that back
:kek:
@quiet depot I need assistance, so I have "user" interfaces/objects, however in the past I named the package as wrapper for them, I don't know if that's approriate tho, suggestions?
show me your code
Code has nothing to do with this eeee
yeah but I don't understand what you're trying to say
sec
"user" as in users, like entities that can see, breath, feel, hear, or "user" as in the user is meant to use these interfaces, they're not internal
and wrapper as in you literally named the package wrapper, or wrapper as in the composition pattern
guessing the former on the latter question, because you said "named the package"
i'm just confused though
that's why it's easier to just see the code
SomeInterface
> A Type Class 1 implementing that interface
> A Type Class 2 implementing that interface
Type classes being "user" classes, let's say creator, or a supporter
ok
You get what I'm trying to say?
I get part of what you're trying to say
a little fuzzy on the actual question though
my interface being outside of that package, correct?
yes
k danke
for "simple" components, where there is only an interface and implementations, I'll do
.
|-- implementations
| |-- Impl1.java
| `-- Impl2.java
`-- Interface.java
for more complicated scenarios, where there might be multiple interfaces, different kind of impls, etc
Another question, what would I call that interface then?
.
|-- framework
| |-- HashSet.java
| |-- LinkedSet.java
| `-- Set.java
`-- implementations
|-- hash
| |-- ConcurrentHashSetImplementation.java
| `-- HashSetImplementation.java
`-- linked
|-- ConcurrentLinkedSetImplementation.java
`-- LinkedSetImplementation.java
It would define the common stuff for both supporters and creators
User is fine
k
however you may want to prefix it, as User is also common in some apis
prefix with what, a letter?
god no
:kek:
I've no clue what would be relevant tho lol
basically have everything in one class
well what are these supporters and creators?
With a broad word, what would you call a Creator and a Supporter
Creator would be let's say a youtuber, supporter would be the user supporting that creator
so
YoutuberUser
creator, supporter
both fit under that title
however that limits your platform to only youtube, thus why I asked specifically what platform this is for
because if it's for multiple, that obviously doesn't work
Let's say it's broad, no specific platform
InfluencerUser, however that doesn't work so nicelly does it?
no and it doesn't make sense
if you can't do anything specific, then do the project name
however just going back to the start
these prefixing shenanigans are only necessary if User is already a taken name
User is not taken, so I can just use that then I guess
@quiet depot Go judge, thanks https://paste.helpch.at/adakefoqeh.java
I don't like the fact that I have to specify the values twice due to the update
but not sure how I'd even approach that
Anyone else wanna judge, since Piggy dead
java
Okay 4head
u talking to me?
Anyone used ngrok before?
I used it once before and its not working for me anymore
basically the paypal api to send test webhooks requires a https url and obviously my localhost doesnt have that, so in past ive used ngrok to like forward it to a secure site first then to my ip, but now the request is coming through, but my spring app isnt picking it up
if I go directly to the URL I get the expected GET method not supported, which is good
but when i chuck it in the paypal webhook simulator the POST request shows up on my ngrok console, but my rest controller doesnt print anything
If I send the webhook to myself locally via postman it does work
so its not a problem with my code, its a problem with this
does spring console show anything?
if its the first time im sending it it does something like this
2020-11-19 22:28:17.627 INFO 7548 --- [io-42069-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-11-19 22:28:17.627 INFO 7548 --- [io-42069-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-11-19 22:28:17.631 INFO 7548 --- [io-42069-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms```
oh wait no it doesnt show that lol
thats from something before
and if I use something like PostMan to send the request to localhost:42069/paypal it works
yeah that fails as well
ngrok.exe http 42069
idk how tls or whatever that works so idk what u mean by that second question
you are using the https url right
yeah ofc
go to localhost:4040 and inspect the requests
and paypal says Your event has been successfully queued at November 19 2020, 22:37:04
nothings coming up in the ngrok console at all now
or localhost:4040
stuff used to come up, it just stopped tho :/
restart ngrok
still nothing
manually going to the URL obviously shows the GET request
hm
now sending it through ngrok via postman works
its just not wokring on the paypal website
๐ฎ
hold up
I just got one from the paypal website
but now no more are coming through :/
hm
according to paypal the webhook is pending
but why....
ugh I need sleep but if I dont finish this now ill lose all motivation to do it
so we got a problem
no, we don't got a problem
you got a problem 
plus paypal is like the whitest website ever
ok now ones saying it got through but it didnt :/
cold shower time 
@hot hull looks fine, but like bm said, orm
Time to use Hibernate then 
rpf >
Shut up, you said you don't recommend it's usage
i will one day
yes
nice thing about papi3 being slow is ecloud can be slow too which fits my needs since time is a spare thing
so I am very happy with you piggy
๐
Okay mr slacker
when is papi 3
Just like with papi3 coming out in 2030
yes I am a slacker @hot hull https://i.lemmotresto.com/2020-11-19--07-35-13am.png
smh
ngrok still no work :((
Its just paypals not working with it
it now works if I send it locally off something like PostMan
for testing?
yeah
nah
doubt that but possible
I never really have this problem since we have test servers for this
but I've used ngrok before and it's useful
ive used it before for pp
pp
big pp
smol pp
smol pp definitely
I love how netstat is telling me there is no service listening on 8090
but docker is like nah bruh there is
oh hey i'm on linux now so I can use docker without weird hacks
probably still won't though, sorry to disappoint you lemmo
smh
why did you need weird hacks tho
cuz i have windows home
and docker only works on windows pro
unless u do fancy stuff
not anymore
localtunnel works it seems
oh
it used to require hyper-v
which is a pro thing only
which I mean you can easily get pro 4 free
how
I made a batch script the other day
which gives enterprise iirc
but you don't need it anymore since it can run on wsl2
tbh i'm just waiting for the department of education in western australia to allow students to download windows education edition from onthehub
was meant to happen ages ago
still hasn't happened
it's just enterprise
well
it's enterprise without cortana
although I'm not sure if enterprise has cortana either
idk I haven't checked for ages
what is cortana I have that too
cortana, please ssh into server1
yeah well I have buttons to do that so nah
ah yeah I don't ;p
I honestly don't get why people use shit like mobaxterm, the cli ssh client is great
I hate cluttering taskbar
windows is already a clusterfuck so I don't see any harm in having them
Windows 10 has twelve editions, all with varying feature sets, use cases, or intended devices. Certain editions are distributed only on devices directly from an original equipment manufacturer (OEM), while editions such as Enterprise and Education are only available through vo...
back when I was trying to get it there was no "pro education"
Windows 10 has twelve editions
it was just education, and it actually had more features than enterprise iirc
what
yeah now enterprise has more features than education
sad
not that any are useful
I only ever wanted it for remote desktop
How could I go about paying someone to make an alteration on an open source plugin or make a sub plugin for that
This of course not being a plugin theyโve likely dealt with
Do people do that sort of thing though
yes
well if they're an actual dev then they can work with code that they've not seen before as long as the code is not actual trasgh
trash*
I have dealt with literal trash code before
Let me look it up lol
if (main.getUils().secondes == 9 || main.getUils().secondes == 8 ||
main.getUils().secondes == 7 || main.getUils().secondes == 6 ||
main.getUils().secondes == 5 || main.getUils().secondes == 2 ||
main.getUils().secondes == 3 || main.getUils().secondes == 4 ||
main.getUils().secondes == 1 || main.getUils().secondes == 0)
I keep that pinned for a reason ๐ฅฒ
beautiful
I was trying to sort a concurrenthashmap because i wanted to perform a binary search on it a couple years ago
lmfao
I love how the dude managed to swap 2 with 4 and still get it working
who made it doe
jon skeet
can't disclose
not me ๐
all I'll say is that it's out there on github.. sadly
ay
Can I get an example of how I should be using the @Contract annotation
show me the repo
oh and it's a paid plugin
why can't you disclose?
Its paid?
I would go into the review section and kick em ass
sad that premium plugins are like this
xD I mean it's nothing serious, I just don't want to go around saying names
nope
Pulse?
@hot hull
@Contract("null -> null")
public String toLowerCase(String param) {
if (param == null) {
return param;
}
return param.toLowerCase();
}```
if the first param is null, the method will return null
!null -> !null :^)
lol
Just say it! I know you want to say it! its BlitzGamer_88 isn't it?
You think my code is trash don't you Fefo? ๐ฆ
Much thanks sir
LOL
fefo there's no shame in shitting on other's code, and publicly calling them out on it
What plugin is it though
He deserves to be shat on
Fefo
let me bring that down
if (main.getUils().secondes == 9 || main.getUils().secondes == 8 ||
main.getUils().secondes == 7 || main.getUils().secondes == 6 ||
main.getUils().secondes == 5 || main.getUils().secondes == 2 ||
main.getUils().secondes == 3 || main.getUils().secondes == 4 ||
main.getUils().secondes == 1 || main.getUils().secondes == 0)
there we go
๐ฅฒ
:what:
replies feature when
https://www.spigotmc.org/resources/on-halt-betterjails.76001/
now THAT is shit
/*
* This file is part of the BetterJails (https://github.com/Fefo6644/BetterJails).
*
* Copyright (c) 2020 Fefo6644 <federico.lopez.1999@outlook.com>
* Copyright (c) 2020 contributors
*
* BetterJails is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* BetterJails is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
I saw a university professor asking on spigot for good projects for his students to pr to, so they can see a codebase with good structure & general quality
\๐
little does he know there's only like 2 projects in the minecraft community that roughly fit that description
yeah but that's for the remake, pulse
the other source didn't have those headers lol
Piggy, got a sec to show me of how you'd use a new keyword in the Contract, the link doesn't go in depth with it, and I'm confused
o lol
@Contract("_ -> new") means "no matter what the argument is, this always returns a new object"
e.g.
@Contract("_ -> new")
public <K, V> Map<K, V> newHashMap(int size) {
return Maps.newHashMap(size);
}```
or @Contract("true -> new; false -> fail") "if the (boolean) argument is true, it'll return a new instance of something, if it's false, it'll throw an exception"
@Contract("null -> null; _ -> new")
public Object newObject(someparam param) {
return param == null ? null : new Object(param);
}
this would be correct then yes?
yes
cool
o
ye
For example, I have these methods
// no matter the value of the two args (null or not), it'll return a new object
@Contract("_, _ -> new")
public static <T, U> @NotNull Pair<T, U> of(@Nullable final T first, @Nullable final U second) {
return new Pair<>(first, second);
}
@Contract("null -> null; !null -> !null")
public static @Nullable String sanitize(@Nullable final String string) {
if (string == null) {
return null;
}
return /* something with the string idk */;
}
no u
but it's inconsistent
I see it as "it'll return a nullable/notnull pair/string"
also do contracts override @Nullable?
not as a "this entire method" thing
also do contracts override @Nullable?
no idea lmfao
I don't think they do, which is why I straight up don't use contracts in my code
partial reason actually
apparently they do
yes finally people using contract annotations
Quick question tho, if I have a param annotated with NotNull, should I still have a contract stating that it'll fail if the param is null, or is that unnecesarry?
Well... it'll be highlighted saying "but the arg is annotated as NotNull"
And I mean, fair enough, it is explicitly annotated as notnull
Sort of implying it'll fail
idk lol
how do you null check
It shouldn't be null, but just in case
Thing is
the varargs itself will never be null
unless you explicitly (Object[]) null
Well yes, but you could still pass in null
but passing no arguments will give a valid array still
For example, I have these methods
// no matter the value of the two args (null or not), it'll return a new object @Contract("_, _ -> new") public static <T, U> @NotNull Pair<T, U> of(@Nullable final T first, @Nullable final U second) { return new Pair<>(first, second); } @Contract("null -> null; !null -> !null") public static @Nullable String sanitize(@Nullable final String string) { if (string == null) { return null; } return /* something with the string idk */; }
@obtuse gale having notnull and nullable there is nice ngl
But that would just be an empty list in the end, with no null objects tho?
or am I missunderstanding
it would be an empty list, yes
Correct
Meaning the contract still stands
basically:
method() == method(new Object[] { }) // no args
method((Object) null) == method(new Object[] { null }) // null args
method((Object[]) null) == method((Object[]) null) // null array
:what: lmao
contracts are horrifying when you have methods with like many params
so basically just notnull or nullable is nice
nicer
sure if you have like a supplier method or just wanna be explicit to the compiler why not
So should I be using both Contracts and NotNull/Nullable, or either or?
I like being pedantic
If you want both
so I just use both lol
make sure they don't overlap each and other then
make sure they don't overlap each and other then
:wat:
but ffs dont have the nullable or notnull above the @neat pawntract it should be before the returning type like fefo tbf
yeah
@Contract("null -> null; !null -> null")
@NotNull T get(T t) {
return null;
}
``` or smtng
_implies null as well
yeah
aa there you go
im just unused to the contracts
they nice
ye
Looks nicer with both ngl
Makes the code look more "advanced"
Well I'm an anti annotation dev
I'm not anti annotation tbh, I just don't like those that define a program's behavior
e.g. acf
lombok
spigot discord fkn glorifying it
I see annotations more like "sticky notes" for both the compiler and the end api user
Yeah ig
And let the actual code do the thing
heck out with lombok
I mean when there is no more convenient way than to use annotations then its fine
cloning databases takes sooo longg
Lemmo, so regarding the todo list, gonna have to delay it for a while
ah yeah take whatever time u need lol, it's not that someone actually needs it
I already know my 2021 new year resolutions. get hired by Lemmo's company so I can bully him
lmao
I have dealt with literal trash code before. Let me look it up lol
@obtuse gale i was told by one of the old devs the coding is a little trash https://github.com/elBukkit/PreciousStones
dunno if anyones able to gauge from quickly looking at it
Opened the first class, already wanna vommit
really lol fkk. odds on me getting someone (payed) to make a small addition?
il ask in the forum part later when ive got more info on it from the dev
basically adding custon wg flags to the wg flag that that fields can use
Depends how much you're spending, and what the addition is
ah ok
il get a better idea of how it can be done from the dev whos on a long term haitus i think.
holy
moly
Another data question boiz, so what would be an optimal way for caching data, should I load all data in a map, even though some data may never get used (let's say a couple thousand objects), or should I have an expiry cache which querries data uppon request, stored them in the cache and if it exists uppon request retrieves from that cache (otherwise it querries and puts into the cache)
So an expiry cache
ye
I mean depends on the size of the objects ig
Not that large, there's just gonna be a lot of them
a couple thousand can be either a few kB or several MB
I feel like it's pointless to have them all loaded since they won't get used (let's say like 30% will ever get used ish)
oh that's fancy
I've got an issue tho ;C
I've got two tables from which the data would be loaded, and it'd be kinda pointless to querry both, since I could just specify from which one, but this mf doesn't allow for multiple params
@steel heart help!
for caching redis can also be used
Elaborate
@frigid badge do you know py?
If you know any other language you pretty much know python
Except if youโre blitz
https://paste.helpch.at/zocitonuri.hs I need help with this ๐คฃ
line 636 ๐
ye ๐ฆ
You're trying to cast None to an int
This lazy mf
shut un frcsty
Why you need a Teams Auto Joiner lmao



