#dev-general
1 messages · Page 261 of 1
why does he looks like he's about to judge every line I write lol
because he is
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO_ _
what was that?
How does spigot... "give" its code to the plugins?
programming*
but how
does it have a plugins folder
and give the code to it?
like, how would I do it? (simply put, as I'm not actually going to)
i am so confused as to what ur asking now
lol
basically
in build.gradle I have things like compileOnly
but how does it get the code?!
its available at runtime
but hOw
still confused.
offtopic- but how does sublime text look so... ew
when I do compileOnly where does it get the code from runtime
what code
think of a plugin as an addon to the server. its in the same java runtime environment (not sure if thats the right technical term but thats how i think of it) and so just like you have access to the code of another plugin on the server through its api, you have access to to the spigot code through spigots api
like worldedit api, spigot api, etc
this is better
is sublime text good?
yes
ok
Vscode > sublime
but sublime takes 2 seconds to open up and literally 1 second to install
I did not know an app could install so quickly
Lmao speed
wtf its almost 3am
Ikr
i feel like for just a text editor to edit like single files, sublime is better
gn
There is no difference, it's a text editor lol
Vscode just has nicer plugins imo plus looks better
Gn kali
yea i guess its just personal preference
but vscode is definitely good
i use it for web stuff
There is no time to wait! Ask your question @obtuse gale!
There is no time to wait! Ask your question @obtuse gale!
I have a question
There is no time to wait! Ask your question @obtuse gale!
What?
I mean, if I want to give a item to a player (/give sender item) and the item should be specified in the config, like (Item name: any_item_name), how will the plugin extract "any_item_name" to use it in a command so it can run /give sender any_item_name?
I'm just a beginner please spare me
You'd just input your path and retrieve the data
🤯
Basically, gradle uses the jar's classes but doesn't shade them
Then at runtime, it just searches the classpath for all of the classes
BM can I relocate a package that is non existent so only the imports within my existing classes change
Runtime dependencies
Oh cool, I know a library for that if you're interested
kek
Jokes aside the problem there is that you need to relocate the jar too
Not just your imports
I’m using hdl
So it’s Gucci
Ew, no transitive dependency support
Mh. What's the reason Runtime Dependencies are better than actually shading them inside the jar?
If even there is one
I mean, i took time to learn Maven n shit and now you guys are all using runtime dependency injection
what the heck
reduces jar size mostly
pretty much
basically
Spigot and things have a jar size limit
And if you're uploading every time it's nice to have a smaller jar
Consider shading in every jdk and spigot version
Or at least as runtime dep
;:
)
Good idea
Hmm do you know anything that is bigger?
Weird random ghost ping?
If i want an event to fire before another, i make its priority low right?
you mean an EventHandler?
public static final EventPriority LOWEST```
Event call is of very low importance and should be ran first, to allow other plugins to further customise the outcome
clash of code anyone?
i can do a quick one
sure
it is 2.20am
is it
indeed
oh this one looks like it sucks
it does
:))
i cba to try and do this
i could switch to kotlin
but that would be cheating
another?
yeah ok
What language were u doing it in?
fun main(args : Array<String>) {
val input = Scanner(System.`in`)
for (i in 0 until 5) {
val line = input.nextLine()
val splitLine = line.split(" ")
val left = splitLine[1]
val right = splitLine[2]
val numbers = splitLine[0]
val sb = StringBuilder()
var index = 0
numbers.toCharArray().forEach {
if(it == '0') sb.append(left.toCharArray()[index])
else sb.append(right.toCharArray()[index])
index += 1
}
println(sb.toString())
}
}```
ok
gn
ima try finish this off
yay got it working
open System
for i in 0 .. 5 - 1 do
let LINE = Console.In.ReadLine()
let parts = LINE.Split [| ' ' |]
let (check, a, b) = (parts.[0], parts.[1], parts.[2])
let extract i c = string (if c = '0' then a.[i] else b.[i])
Seq.mapi extract check
|> String.concat ""
|> printfn "%s"
()
hot
nice
Hmm, is there some sort of edit distance between n words, like more than 2
minimum edit distance
?
Levenshtein only works only when comparing 2 right?
Oh right yeah
Or is there some form of addition possible
coc?
Just about to go out lol
Layer
Later*
@old wyvern sounds like it would be undefined
What's the distance between "hello", "hi" and "example"?
hmm good point
Im looking at something like this
ab aa ba ba
same length strings
minimum changes to make them all equal
And take the minimum of those?
Might work I guess altho that may take too much time, ill give it a shot
in kotlin, if i want a constant should i make it in companion object or top level
companion object
any specific reasons why
good question
It kinda depends
Use companion object if you want it namespaced to the class
Otherwise use a constant
What seemed to work was getting the most frequent string in the collection and using that to get distance and sum
That works I guess
Also didnt have to use levenshtein, checking differences in the character seemed to give the right answer
Now im not sure if the question was wrong xD
fun main(args: Array<String>) {
val str = readLine()!!
val k = readLine()!!.toInt()
val size = str.length / k
val sp = str.windowed(size,size)
val selM = sp.groupingBy { it }.eachCount().maxBy { it.value }!!.key
val res = sp.map { distance(selM, it) }.sum()
println(res)
}
fun distance(a: CharSequence, b: CharSequence): Int {
var d = 0
for ((index,c) in a.withIndex()) {
if (c != b[index])d++
}
return d
}```
this is what worked
hideous indeed
Are you taking about skript by any chance?
yes
👀
lol
oh okay
any way I can force a delayed task to run before the server shuts?
BukkitScheduler#getPendingTasks allows you to find the ids of pending tasks but how would I run a task from it's id?
If it's your own plugin then you can make a Map<Integer, Runnable> and whenever you make a BukkitTask you can just do Map#add(taskId, Runnable)
unless
it's possible to get a runnable from task id
figured that might be the only way
that's I'm wondering
I just don't want to have to store a lot of tasks that way if most of the time it won't be accessed
idk what version you're on but pendingTasks returns a List<BukkitTask> for me
but
you can't run that task
you can only do things like check if async or get the id
hmm true
you could probably use reflection to get the underlying Runnable
but that's hacky
huh?
BukkitTask is eventually just a wrapper of a Runnable
BukkitRunnable 
Copy pasta
docs are wrong but you can see the return type is correct
"asynch"
Are you thinking of BukkitRunnable?
xD
BukkitTask is a separate interface
No, I meant BukkitTask - but having looked at the implementations it's not that simple for the repeating / async ones
hm
I'd imagine there would be a hacky way of getting the runnable from the task id but I don't know where to look
hacky
Yea
thats what bm said
Hjallo
yeah CraftTask just wraps it
actually wait no
what is the implementation of BukkitScheduler
they all extend CraftTask 🤣
BM what's that extension function u like to use for events?
oof
CraftScheduler
hm?
you mean like fun Event.handle()?
Yeah
anyname katsu
Thats equvalent to a function that takes the event as argument
Unless you meant something else?
@EventHandler
fun PlayerJoinEvent.handle() {
}
what is the current state of kotlin for spigot plugins? I barely see it used
let handle(PlayerJoinEvent event)
You're not looking in the right places
I use it whenever I can, so do a lot of people here
When making plugins for myself I love using it because it looks so much better and it's faster to write, but unfortunately if i'm making plugins for someone else they usually want java
Only issue would be filesize afaik
Kotlin is epik
Theres no other reason to be specific
Not as epik as Elara though
Ask them why they want java
I think it's because they want other developers to be able to work with the source
Ah, if their team mostly uses java then thats fair
Kotlin isn't that hard to understand
you overestimate the average spigot developer's intelligence
a small price to pay for kotlin
i already do, current client has a very confusing team
kotlin: suffering from success 😔
they want a large plugin, but are getting different developers to make separate plugins with the idea of merging them once they are all finished
😔
god why are people like this
That sounds like a horrible idea
lol
with no core and no central utilities, I don't know how it's going to work
someone is going to have a painful job
that's just...
I have no access to any one elses code either
jeez
i don't understand why you'd want to have everything in 1 plugin?
there's no benefit to it
well I assume that's how it's going to work, because I'm working on 1 half of a gui, and another developer is working on the other half of the very same gui
so they can't be separate plugins
wtf
honestly, not a clue
what the
i hate it here
I don't think anyone has heard of github or any source control tool
lol
of course they havent lmao
just work separately and then someone gets the job of putting them together
🤔
manual merging
🥲
i feel so sorry for whoever has to do that
i'm making sure that's not me
🤣
The person that has to put it together ^
so, what's best
- using reflection to get the pending tasks and running them
- storing block + position info in either a hashmap or db which will get queried before the server shuts down
I have a bunch of tasks that change the type of a block after a certain amount of time
can the first be done without reflection?
Is Gaby being paid for that status or what
thats his
lmao
((CraftTask)Bukkit.getScheduler().getPendingTasks().get(0)).run();
surely it's not this simple
lol
try it
what the frick
im pretty sure that will work
my windows has basically crashed
if it is, why isn't it a part of the spigot api?
why can i access everything but i cant open the start menu or file explorer??????????????
possibly an oversight
windows bad lol
but also because the api usually only provides the interfaces
the scheduler implementation is part of craftbukkit
because it's pretty closely tied to the server
restart computer :))
upgrade your kernel without restarting OH WAIT you can't
Is it possible to return a value for placeholder request which comes from an async database call
i dont think it is
Im tryna grab some database data and return it as placeholder
😦
@onyx loom is there a task bar at bottom
ok then ;-;
database calls in placeholders, very bad
classic windows
bruh this is so weird tho
im not even doing anything
literally windows has just shit itself
🙂
time to switch to linux!
good idea!
no.
guess im not cool
iwanio too iirc
why
😐
😐
is there a task bar
so i should just make a runnable every so often to update a map or smth
then RESTART
no
i only need file explorer so i can do my homework
but i guess thats off the table now 🥲
😐
also open up task manager
😐
get a usb stick, download "Manjaro KDE", flash to the usb, and then boot into that
then double click "Install Manjaro"
great idea bm
then wipe your windows partitions
except for the fact that i dont have a usb stick 🙃
ur solutions were already tried before u even said lol
THEN SAYY
not IGnORE
😐
i mean if you have a second drive could always install to that too
can confirm by the way, it did work, so that was easy
nice
It works
what is home
the working code at home
5=6
thats funny tho
~
the joke here is that he is referring as if he is homeless, this is a comically funny "sad joke" and is enjoyed by many
I legit never know if his questions are joking or not lmao
whos
Dkim's
oh
😐
-300kb/s
cursed
That code is making me want to go down the suislide
🥲
@lunar cypress would you say this is a good resource for learning language theory?
https://github.com/steshaw/plt
Specifically this paper https://www.cs.kent.ac.uk/people/staff/sjt/TTFP/ttfp.pdf
it's pretty complex so far but I think i understand the first few pages lol
yeah nevermind
The fuck is that
XD
i have no idea
im just googling all of the symbols
∨ this is like an and gate i think
¬ is like ! in terms of inverting
ok so the first 2 make sense
this mans solving the unknown questions of the universe rn
I was thrown into all of this in my first week of uni 🥶
So the backwards E means "there exists"
The others you've figured out correctly
And => is an implication, meaning if the left is true the right must be true
yoo type theory and functional programming
Any reason why it's such dumb symbols?
And to answer the question I don't know that particular paper/repo but it looks good to me
wow I'm finally back at my PC again this feels unreal
Yeah I got that one
Backwards E is a bit weird
But I suppose that makes sense
What about the upside down A?
That means "for each"
We call them "quantifiers" although I don't know if that is the correct term for english
The relationship between the two is a bit like the one between and and or
ah yeah they're called quantifiers in english too
oh I just noticed you confused "and" and "or" earlier
v is or
oh yeah it is my bad
¬∀x.¬P(x) ⇒ ∃x.P(x)
so what does the . mean?
i assume P(x) just means a function call?

I assume the dot is just used to separate the quantifier expression from the thing it's quantifying
We use a colon for that but I've heard there are different ways
And yeah you can think of P(x) as a function call, or depending on the context just a paramaterised expression that was introduced earlier
Okay
which is the same in a sense
again don't know the english term but translating directly from german gives me predicate logic
"First Order Logic" is the first thing that came up
seems like that's about right
I'll look into that a bit
yeah
So ¬∀ is "not for each"?
that doesn't really make much sense
Ohh yeah
There you have the connection to the other quantifier
Yeah, allMatch and anyMatch are exactly that
bcs !allMatch test <=> anyMatch !test
Where can i find people that can make plugins for free
So the whole thing would read as something like ```
If there is at least 1 x where P(x) is not true, it is implied that there exists an x where P(x) is true
Is that correct?
im not sure the logic there makes sense so maybe it isn't
no, it's if P(x) is not *not* true for each x, then there exists an x where P(x) is true
yeah, it's one of the fundamental transformations you can make
It's not just an implication, it's an equivalence even
meaning it also goes the other way around
yeah
LMAO it explains it right underneath
which can be given the gloss
If it is contradictory for no object x to have the property P(x),
then there is an object x with the property P(x)
okay
well
That makes sense
and the other 2 are kind of the same thing
tbt my first algebra assignment
3/10
Interesting
Although it seems strange to have such detailed definitions for things that are essentially common sense
come on it's not that bad
🥲
then again didn't someone write a 300 paper proving 1 + 1 = 2?
Yea, for us we had a tilda instead of the dash thing tho
I saw someone do it in Rust's type system lmao
~A
well depends on what you work with as your ground material
Start with the premise that 1 + 1 ≠ 2 and work your way out to disprove that instead
same thing, the important bit is what you start with
turns out there is a lot of different ways to define and derive things in maths
which reminds me, I'm procrastinating the assignment that's due tomorrow 🥲
was the predicate logic fundamental thing part of it?
No it doesn't
I'm not sure
in the next page it said why that principle is flawed lol
so I think that was just the prerequisites
lol
The problem with the principle is that it asserts the existence of an object without giving any indication of what the object is. It is a non-constructive method of proof, in other words.
Oh, yes
That is actually a problem theoretically
because it allows you to construct paradox situations
I'm relieved, I thought it was something else, then my world would have crumbled lol
haha
May I ask what use would you get by learning this?
any examples of a paradox? i can understand why but i can't really think of any examples
Appart from drastically fucking up your brain
apparently it's useful for designing programming languages
I can see why, it's all about Type Theory
although it's a bit advanced for elara lol
possibly
maybe
So there's Russell's paradox for example which is the idea that if you define sets to be a collection of "any objects" you can construct this set: R = { S | S ∉ S }
So this would be a set containing every set that does not contain itself
The paradox happens when you ask the question if R is contained in itself
Because if that were the case, it can't be contained in itself
And if it's not the case, it must be contained in itself
ohh yeah I think I've heard of that
wayback machine is the best
also #794429923698802708 a whole skyblock plugin for free
👀
im losing braincells from this conversation in Code Cave
o
:((
=paste
Please use a paste service to share configs, errors, code and long logs.
• HelpChat Paste
I want see
com.sk89q.worldguard:com.sk89q.worldguard:worldguard-legacy:6.2
yes
that is correct
I need 1.8 😐
😦
I'd switch if I could
ngl BM, language theory is probably easier than understading women, might actually read on that
Lmaoo
please read what I sent
if i am handling user data i wanna load when the login and save when the disconnect right
and just remove it from my maps
This is a quote from 59 year old ALGOL programmer Bob
memory management
Still not working
at the moment my User class stores uuid and about 8 ints
but im expecting to expand to alot more
just wanna make sure the base is all well and good
before i add
Should be fine to have it loaded on enable and saved on disable
Probably more impact if the user keeps rejoining than having it stored all the time
what if there was some sort of time to live that removes it say 5 mintues later
some runnable
and if they rejoin
just cancel it
Could have an expiring cache
May as well right
i mean im working on a custom server i doubt i will ever release, more just for practice
so i may as well try it
@ocean quartz sorry for ping, but what's the best way of making a "dynamic" menu with your gui lib?
I was just gonna use recursion (re-generate and open a new menu whenever the data updates), but that activates the onClose action which I only want to happen when they actually press esc
This didn't work so I tried just re-adding all the GUI items but now none of the actions work.
Is there an easier way?
there is update()
void updateInventory()```
Forces an update of the player's entire inventory.
"Player's entire inventory"
Np
making it for someone else
if im gonna load player data should it be done on the AsyncPlayerPreLoginEvent or PlayerJoinEvent
i assume prelogin
since its async
d;spigot PlayerJoinEvent
public class PlayerJoinEvent
extends PlayerEvent```
PlayerJoinEvent has 5 methods, and 1 extensions.
Called when a player joins a server
d;spigot AsyncPlayerPreLoginEvent
public class AsyncPlayerPreLoginEvent
extends Event```
AsyncPlayerPreLoginEvent has 14 methods, and 1 extensions.
Stores details for players attempting to log in. This event is asynchronous, and not run using main thread.
I'd just suggest loading it in PlayerJoinEvent since you know 100% that the player will be connected at that point
PreLogin the player has started connecting but still isn't even fully authenticated or checked for the ban list so that's a bit premature for loading data in most cases
@winter iron some info ^
if i set to highest priority on the eventhandler and check the login result
would that be good enough tho
if the login result is allowed
should be fine?
btw highest priority = run last
just saying, people usually get it reversed
If you want to prevent the player from joining until your data is loaded for them then yes, listen on the monitor priority and check if the login is allowed, that's pretty much the only use case I can think of for using that event for loading data
Since the event is done in a separate thread it should be safe to run a database query in there or something, it will prevent the player from joining while the data is loading but that's probably what you want
ye
so lets assume its loading the data
and they disconnect as its loading
how would i check for that
Why would you want to check that case?
so im gonna load the data in prelogin and if they disconnect its gonna save the users data and clean up some stuff
It would probably be a better approach to use some expiring cache and save on expiry
which is why i wanna see if there is a way to see if they dc whilst prelogin
ye
ive got it saving periodically whilst player is on
and when they dc
i have a task that waits 5 mins before cleaning up the user
but in case they connect and disconnect same time
before loading
is there a way to check for it
if not ill just run my cleanup task on prelogin too
and check if the player is offline it cleans up fine
They won't be able to connect and disconnect at the same time if you hang the PreLogin thread
it's also extremely unlikely you would run into any issues with that happening anyway, I load data in the join event and have never once seen an issue with somebody disconnecting while the data was still loading
When you login to a server u can cancel it, does that just throw the quit event or smth
PreLogin doesn't start until the connection isn't cancelable anymore I bekieve
After the client authenticates with the server it's no longer cancelable.. I know this because I modified a server to never send world data to the client and it just softlocks them on the Loading world... Screen forever
do not recommend
xd
Yeah either what gaby said or updateItem if it's just one or two things that will change
Found an actually not bad explanation for classes and objects https://www.youtube.com/watch?v=IUqKuGNasdM
If anyone ever asks it again this video might be pretty good
Discord: https://discord.gg/ypFyyWq
Instagram: https://www.instagram.com/keep_on_coding
My Gear: https://amazon.com/shop/keeponcoding
Patreon: https://www.patreon.com/KeepOnCoding
CodeJams is out on all major streaming platforms!
Spotify - https://bit.ly/Code...
Ignore the part where he uses public fields, it's very beginner
@half harness You specially, at the beginning he explains, instance, object, and class
pinging someone specifically when they havent even asked for it 😭 😭
He has asked that many times so yeah worth pinging
lmao
wut
idc 🙂 🙂 🙂
watch the beginning of the video hes saying lol
❓
good video
🙄
What is confusing in that sentence?
anyone know if theres a way to make git branch --list show as just a list in the console instead of the man page format
i have to hit q every time i list something
its not like u have terrabytes of storage! 🌝
(or atleast id hope u have atleast 1tb in 2021)
git branch
lol
still lists it the same way
unless you were just pointing out im a dumbass for using --list
ah my mistake thought --list was enabling that
when you realize your code takes long to execute so you have to use a second thread
🌚
ty intellij
Ms paint IDE
Sounds to me like you would benefit from E L A R A G E N E R I C S
😐 notepad is
no
yall dumbasses obviously paper and pencil is the best ide out there
"infinite possibilities"
just draw a run button
boom you run the program
ez
i cant imagine who wouldnt
omg
i got my plugin to work
the only issue is
it stalls the server
cause it runs on the main thread
👺
sounds like it doesnt work
nah
it just takes so long to run
cause of decoding and everything
so it stalls the server
lol
async
use bukkit async
or completablefuture
ExecutorService 
Coroutines 
one day i need to actually learn how to use coroutines properly
yea ik they are awesome i just have yet to learn them lol
can you use them in place of like the bukkit scheduler?
Just add suspend everywhere until things work
Yeah
There's a library that combines them both
Or they can just replace it
You don't need that, just use normal coroutines
if i have data stored in json files vs a database should getting that be run async as well
Ideally
alr time to learn coroutines then
I was referring to Skedule but that probably works
"Sk" brings me nightmares
🥲
hi
hello there, unmentionable user
@ٴۢ#8153 Freaky name
yea it like flips it lmao
That just happens with certain unicode characters bcs they're read from left to right
Right to left
How do I keep confusing that
That is most commonly in Arabian unicode
Not just that
Not sure where this particular char comes from, but one major language that's read that way is Hebrew for example
@glad tide names need to be mentionable here
oh jeez
yea lol
y so big
😏
didn't say\
yes
does anyone know what operating system server hosting companies use?
im guessing linux
macos
Make a plugin that detects the OS 🙂
or windows xp
Hahahaha sorry
@ocean quartz if i build triumph chat is it ready to use or not yet?
Not yet, some things need to be finished first
I can let you know once it's ready
sounds good 👍
any advice for a tablist
on bedwars
coz on mine its not showing the team colors
okay
this doesn't add up 
Are utils suppose to be static?
Yeah
pro gamers just name all their classes with Util as a suffix to the class name, then make all the methods static
🥲
coc anyone?
good idea
indeed
😦
like 15min ❤️
okay
coc first, assignment later
^
If I wasn't almost finished with it yes, however since I've got like 3 sentences left, coc can wait 
idk what this question is tryna get me to do
:suislide:
shortest time in minutes
I have a server with +- 100 ppl on it.
We have 40k tiled entities when i do /lag
Can this cause lag?
Furthermore:
We have 1500 itemframes loaded at any one time, sometimes up to 2500
I wanna know whats causing the lagg on the server when 150 ppl come the tps drops to 14
We are running this server on a dedicated ryzen 9 3900x
Invite me to the new one, gonna go make sum food rn
are you using minBy by any chance?
because i had the same thing
send your code
yes
fun main(args : Array<String>) {
val input = Scanner(System.`in`)
val N = input.nextInt()
var lowest = 0
for (i in 0 until N) {
val s = input.nextInt()
val d = input.nextInt()
val t = ((d/s) * 60)
if(lowest > t){
lowest = t
}
}
println(lowest)
}``` idk if i even get the question right lol
you need to use floating point division
not ints
lol
unlucky
@hot hull you free now
ping me when forstys here
Oh you guys doing coc?
yup
send the link
waht
Im in for next round
Making food BM, but I ran out of bread, so I had to use toast bread instead
what's the difference
toast is smaller, less girth
i thought toast bread had more girth
^^
It's not
what
Toast is just bread^2
I literally did if(b) println("true) else println("false")
lol Aj
tf is wrong with my logic?
just multiply, subtract, check
Your missing a speech mark Aj
ive done that
let salary = a * 5 * 6 * 4
printfn "%b" (a - c >= b)
oh
shit
ffs
missing () I pressume
oof
Yeah I was confused why you had salary defined but not then used
very smart
It’s fine I’ve accidentally forgot to transcient a variable before and caused myself to stare at code for 2 days wondering why it was moaning about a long
🥲
Yugi dead?
seems like it
Worth the time!!!
ooh haskell





