#help-development
1 messages · Page 866 of 1
the language is perfect 
I am learning kotlin
Everybody here knows some kotlin lol
Apparently learning faster than Alex
perfectly cursed
Gottem
The people are the problem
I mean, some of the syntax is fucking cursed xD
The english language isn't tho
true
the only thing I find cursed is putting names before types
I'm not smart I just use google
Let's make a new language that combines some good shit from java and some good shit from kotlin and call it a day
so many modern languages do this now though
because baboons invented them!
its annoying, but whatevs
Can we combine good shit from other languages too
And then we'll fuck up and end up with javascript
Yes
can't we just... combine the bad things of all languages and combinethem into one?
oh nvm php already did that
No.
Lmao
I mean, stuff like return@ is a bit funky
Poor php
That's JavaScript
that's actually great
Ł
returning inside of a lambda its kinda cool actually
like
fun foo() {
listOf(1, 2, 3, 4, 5).forEach {
if (it == 3) return
print(it)
}
println("hi there")
}
do you think hi there prints
Uhhh
spoiler it doesn't
spoiler it doesn't
Imma guess no
LOL
it's like a label in java
loop@ for (i in 1..100) {
for (j in 1..100) {
if (...) break@loop
}
}
well, its a lable they need because their lambda syntax for last param just
does a LOT
but it can also be used without assigning names
I like this
I see
Theoretically it should, right? Because a lambda should be handled as a seperate method or something like that I've heard
Kotlin says no
for you'd have to instead do
fun foo() {
listOf(1).forEach {
return@forEach
}
print("hi")
}
like this works again
and its just fucking cancer xD
especially when this goes nested
and then you get absolutely wild syntax if you need to return a value
e.g. retuirn@lable obj
which just
bleach my eyes
omw
Can I please just use java
Sure
🥰
No, don't
it has great shit, I long for their delegation syntax
i want to get a cake on my birthday and somebody of you people here will be responsible for it
Not it
wow that looks cursed in discord
It looks cursed to me in general
in IJ the the colors at least match a bit lol
Yea I mean, syntax highlight makes it a bit better
but yea
cursed as fuck syntax
now this is cursed
i wish kotlin would allow running code in constructors before calling super
and java should allow that too ofc
Isn’t that planned
stupid java default methods don't contain proper javadocs
where's the @params
oh wait, that one is private
why can't i just pass in a file object into a FileNotFoundException D:
how annoying
btw here's another nice kotlin feature: singletons using object
that's basically this
but one can access it just using ModuleJarFileFilter as if it were an object
wasnt it somehow possible to unregister all listeners belonging to a class?
yeah HandlerList or somewhere
aight thx
that's great, then I keep track of all listeners a module has registered in my AbstractModule class and then auto-unregister them
it feels like I'm writing a plugin api for spigot haha
RIP I spent 20 minutes finding out why my regex inventoryholder detection isn't working, even though the console said it worked. I was like "hmmm there must be another event that still sorts the inventory". Then I looked at my code again:
F
return 😈
you know java 21 has enhanced EMOJI support!
finally we can return 😈
Regex 😭
regex are great! Instead of having to add support for 29 different plugins, I can just people to fucking edit their config lol
think if plugins actually propery implemented menu's too you wouldn't even have to do this!
yeah true
usually I always told people that it's the other plugin's jobs to hook into chestsort
but I think this regex list is by far the easiest option
also who knew this?
i wonder which other "tempaltes" github has for markdown
can normal java classes also be referenced as KClass in kotlin?
Or do I hve to use the regular java.lang.Class class for java classes?
nah, Whatever::class will always give a kclass
I'm using Class.forName(...)
there's probably some extension method for j.l.Class to convert to kclass
something something ClassMappingKT
or I think yea
extension method probably
indeed
ah great
thx
then my ModuleJarClassLoader can return a proper KClass instead of a stupid boring Class :3
How much Kotlin adoption would it take for spigot to shade the std lib :p
the library loader already shares that stuff right ?
Well yeah
But we shade SQLite and MySQL drivers!
Oof
spigot's library feature is stupid
because it only supports central
why can't it just support giving custom repos too
libraries:
- id: com.jeff-media:custom-block-data:1.0.2
repo: https://repo.jeff-media.com/public
well then one just downloads the file via code?
His poor hard drive
Yea I mean
being able to use the library feature would be nice as one wouldn't have to rewrite stuff like caching, updating snapshots, etc etc (if it even supports snapshots, idk)
it is kinda a bit weird
Yes I know if it’s shaded it would be on his hard drive anyway
I mean the thing is what stops a plugin from using libby
its another attack vector that isn't too cool
which is legit just the library feature
runtime hacking but it works
For now
not really imho. a plugin can download arbitrary files anyway. Whether you do URL("https://badsite.com").readBytes() or add badsite.com to the libraries doesn't really matter. in fact, when using the libraries, it's even more obvious whether a download is coming from official-looking-site.com or from attacker.ru
I doubt a malicious plugin cares for best practices lol
Well no, I am not saying you are downloading a malicious plugin
I am saying you download a plugin that uses library loader correctly
they link their repo
exactly. not allowing every repo is
- irrelevant for people who upload bad stuff
- annoying for people who don't
their repo password is mfnalex and password123
some fucker gets in
starts replacing their release builds with malicious BS
the plugin isn't malicious
the same thing could happen if my plugins downloads something from my repo manually using java
the author never intended it to be
which is again why I don#t think you downloading things at runtime is a good practice unless you validate that its the correct shit you are getting
well spigot could ofc also raise the upload limit
I mean, downloading isn't the issue.
or people should learn how to upload their stuff to central, I'm tired of seeing jitpack all day lol
The issue is validating that what you get is what you expected
well then libraries.yml could also contain a hashsum
supply chain attacks aren't anything new, andthey are getting a more common attack vector by the day lol
yea
thats what I suggested above
libraries:
- id: com.jeff-media:custom-block-data:1.0.2
repo: https://repo.jeff-media.com/public
sha256: awfiugfwa2972<whatever>
I don’t think I’ve ever come close to the upload limit tbh
haha dude
I mean, there is a reason every competent developer like, pins their docker base image to a checksum
this is without modules 🥲

Kotlin stdlib
bro

stalin is about 4.7 mb
LMAO
Yeah but that could break other kotlin plugins
So not really
Wut
You kinda have to shade
with minimizing, stalin is down to less than 1mb
although I can't tell for sure as it probably also got rid of a few other classes outside of stalinlib
tho I think like, the library loader is consulted before asking the global plugin classloader
I believe so
so should be fine ™️
yeah it is obviously not as glorious and great as my custom classloader cough
I mean
yeah well is it supposed to just die if a plugin doesn't use depends?
yes
and paper also killed the opportunity to use softdepend properly
Is it not better to take the shot in the dark than just go /shrug idk good luck
Well no because taking the shot in the dark might mean you load something you don't wanna load
if two plugins softdepend on each other, paper fails to load them, doesnt it?
The alternative is nothing though
they are not dependent on each other
aight
they only "softdepend" on each other to avoid the warning in console
I love seeing paper-help posts with like a 10 plugin dependency loop
let me boil that down
plugin A soft depends on plugin B and does logic A1 if plugin B exists onEnable, otherwise A2
plugin B softdepends on plugin A and does logic B2 if plugin A exists onEnable otherwise B2
if both plugins exists, one has to be loaded first
which one is it
the classloader should accept plugins loading classes from other plugins without complaining, then softdepend can continue to fail for cycling dependencies.
or the plugin manager should not fail for cyclic dependencies, which makes little sense for softdepend as it literally means "the other plugin is not required anyway", so why fail if they both softdepend each other?
it has. people add all plugins they use classes from to their softdepend
you can share a classloader no issue
but that is not what softdepends promises
soft depends promises that you enable after the soft dependency if its available
loaded arbitrarily != just failing
it is literally worse than failing
no it's not
I-
your skull sometimes is rather thick
This like, might depend on the file system
might depend on the jar name
if two plugins depend on each other, then ofc it shall fail. if they only softdepend on each other, then what's the issue with simply loading one of them first? after all both plugins would also have loaded if the other one weren't there?
this might change by literally just changing the jar file name
because the behaviour can change for 0 apparent reason for the end user
so the only alternative is to not use softdepend at all. and that leads to the issue that a plugin must be able to access classes from other plugins that are not depends
the alternative is to properly split apart the concept of a load before and load after
and a shared classloader
What are we, forge?
we hope to be
Oh
yes. but the docs currently say otherwise and hence any implementation should behave like the docs say
service-loading java.lang.Runnable
okay ?
sounds like you should be using spigot then
I thought about redoing the spigot loader
idk why it was never touched tbh
then fix it i nyour paper-plugin.yml and stop messing with bukkit's version
Then I thought about how to correctly resolve dependency chains and my brain hurted a bit
bukkit's behaviour was left untouched, paper-plugins loading needs not to follow the same rules
also it does not need fixing. it would be nice to add a loadafter but that does not mean that softdepend is broken. It says "softdepend = required to have full functionality" and that it's loaded after these plugins, if possible
nothing broken with that all
again
it's only broken if one considers this to be a loadafter
which it never promised to be
arbitrary anything is fucking dumb
smart
Done
how does paper load plugins? sort the files by name?
by their dependecy tree ?
mhm
so, you are pointing out the thing to fix: load order and dependency are two separate concepts
which one is loaded first
A.jar or B.jar
do you just use the result of listFiles?
because that's arbitrary
Yea, no depdencies exist, plugin loading can be done in alphabetical order
can be done or is done?
I believe it should be ?
pretty sure it just loops over listFiles
not that it matters, the plugins do not declare a depdency
By jar name or plugin.yml name
¯_(ツ)_/¯
:p
ofc it doesnt matter, but it's arbitrary, and you said that's always bad
What if we go the other way
Load plugins in a random order every startup
TL;DR not loading a plugin because they have themselves as "OPTIONAL" dependencies makes 0 sense

again
the fact that my plugin execution logic can change because of arbitrary reasons is the issue
if two plugins remain isolated, they can load in whatever order they want
but that is not the case?
this only happens in paper when a plugin suddenly stops working because you installed another one
in onEnable(), both plugins will exist
as they're obviously all loaded at once, and only after that get enabled
and plugins will obviously check getPlugin(...) != null and not otherPlugin.isEnabled
and getPlugin will obv return notnull even for disabled plugins
mhm yea sure plugins will only do that
tbf, even fucking worse
What if plugin A expects B to be in a specific state
and B expects A to be
the current solution to be able to support paper is to simply not use softdepend at all
or just use the flag
or properly design your plugins
it's bad design to have features only available when other plugins installed?
How is that bad design lmao
I'm still confused on in what natural reasonable way a dependency loop would happen why is this a problem? Are developers too stupid to not have cyclic dependencies
A cyclic dependency is literally just bad design
that is not at all what i said
like
You’d be surprised
this is not something you can remotely argue
Often its long loops and who knows where the blame falls
I guess technically to all of them but yeah
I think you have a problem understanding what a softdepend is. It is NOT a dependency. It does NOT mean A requires B. It simpy means, as the docs say:
it's a "nice to have", not a "required to have"
it is treated as such
we are not arguing the definition of softdepend
you are avoiding the fact that there is a cyclic dependency
if you don't care about the docs, then there's no point talking about it at all. You simply claim that your definitino of softdepend is the only correct one, completely ignoring what the official docs as pe the wiki is, and then you claim that it should behave differently. If you would just stick to the definition from the wiki, there'd be no issue
Are we just gonna ignore that no matter what you do any form of cyclic depenendencies will just break shit
it isn't about a definition
my brother in christ
,
you can publically define soft depends to whatever the fuck you want
Docs don't matter if implementation doesn't follow it
when it RUNS it is a cyclic dependncy
but if you absichtlich ignore the official definition of softdepend, then what's the point of talking about this in the first place? This discussion is pointless if you just make up random definitions for things that are officially defined as sth else
?????????????
spigot impl does follow it
no, there is not. There are simply two plugins saying they have additional features if the other plugin is present
it cheeses out with an "oh but shit might just be abitrary"
that is not a definition
🍿
that is a "fuck, concept is flawed, lets put it there"
Well not really it effects load order when applicable if it was a meaningless list of plugins it would be a useless entry
cyclic dependency = both need each other. softdepend does not say "need each other" but only "gives additional features if other plugin is also there"
i
so your whole idea of saying softdepend between two plugins is a cyclic dependency is already wrong
okay 👍
if two plugins would have each other as depend, then obv it's a cyclic dependency
okay 👍
glad that you understand it now
okay 👍
okay, and what happen if many plugins depends on the same soft depend. Which is loaded first?
what?

mixins
das the solution
who needs dependencies when you can just fuck with the internals
The real solution is nuking everyone and going raw on nms
perfect
Raw dog the NMS
Maybe I’ll look in to redoing the plugin loader one day
Partially because I want registry api :(

tbf, the new enchantment tag stuff looks promising
I wonder how many more releases we get
It does
till enchantment reg is synced
Just to summarize again. The name "softdepend" is misleading, as it's not meant to describe things actually "depending" on each other. a better name would be "profits-from" or sth.
idc, please just drop it
k
thanks 👍
chrome should have an option to have a second line for tabs
does somebody know how i get the full amount exp points a player has, the methods that im aware of (player.getExp && player.getExpToLevels) arent useful in this case
that's nothing
no. when I search for a specific tab I just use @tab in the search bar

Imagine not having tab stacks + workspaces. Couldn't be me.
thx

My internet slow. D:
interesting name
yk what's weird, on my PC i only get ~400mbit but on my macbook throgh WIFI I get over 1 gbit
how the hell can that happen
it's a CAT7 cable and my ethernet card says 1gbit
and another computer that's also connected through LAN does get 1gbit
Difference in drivers more than likely
tasks.shadowJar {
minimize {
include(libs.kotlin.stdlib)
}
}
If I do this but I also depend on another dependency that also depends on stdlib, does shadow still minimize stdlib or not?
@river oracle our classloaders are currently cmopletely independent, do you think we'd ever need to allow a module to access another module's classes? and if yes, I guess we should probably add some kind of interface registration system instead of just arbitrarily loading classes from the other classloaders?
That’s so many tabs wtf
unused ram is wasted ram
How often do you actually go back to some of them
sometimes
i just switch tabs like this
on mac it's even easier, just do cmd+space
i think I'll get an m3 imac when I move to my new place
wtf imac only goes up to 24GB RAM?!
guess I'll not be getting an imac then
no we probably shouldn't
the point of the modules is the independence as soon as we have modules depending on other modules thing will go to shit everything that needs to be a core dependency should go in core
What about third party stuff
third party modules should also be independent besides depending on the core and spigot
if you don't like the configurations of a default module you can always replace it type deal
Mmm just thinking of a case where a module wants to be an addon to another module
ocelots and cats don't share a common super class? 😮
we could do that, but i'd take the stance of only allowing hard dependencies
hm yeah in that case we should probably do sth similar to spigot with depend
again i'd be hard against something like soft-depend or something
shouldn't be hard, we'll just create another classloader that combines the two existing ones
if you wanna extend something depend is good enough further than that replace the dependency
we could just add an option to basics-module.yml to "open the classpath" to those modules
classpath:
- basics:tpa
e.g. this would then allow to access all classes from the builtin tpa module
it will however not check if that module is actually running or anything. It's only purpose would be to add those classes to the modules classloader?
meh I'd be inclined to have depend but only hard depend. Any circular dependencies just turn off the modules and say circular dependencies etc
the modules themselves should tend to be small features etc so we really shouldn't need to ball out on an advanced loading system that accounts for a lot of logic
yes I fully agree that it shouldn't be needed anyway
but if we ever had to add sth like this, I would opt for a simple list of modules which classes one wants to access and those will get added to the classloader then
hm I wonder, if I got a classloader, I can ofc set a parent classloader.
But let's imagine I got two classloaders, both are URLClassloaders:
A.jar and B.jar
Now I want to have a classloader that combines both - would I just create a new ClassLoader from scratch that just delegates findClass(...) to both, and returns whatever of the underlying classloaders returns for findClass?
or is there a better way?
@worldly ingot you might know more about this maybe?
sry for ping
otherwise I'll have to ping geol
No clue. Not done much class loading, personally
I'm going to load your class into Wisconsin if you're not careful
@quiet ice you are my bytecode buddy, you must know this
oh yeah? that's what you're going to do? huh?!
Make you eat cheese
And culvers
oh btw we still need to figure one thing out:
I'll give an example
@CommandAlias("test")
@CommandPermission("test")
class Hello{
@SubCommand("hello")
fun hello(p: Player) { p.sendMessage("hello") }
}
// in another class:
@CommandAlias("test")
class World{
@SubCommand("world")
fun world(p: Player) { p.sendMessage("world") }
}
Both commands are "test", but only the first one has CommandPermission set. I know that declaring subcommands like this works fine, but I wonder if now /test world also requires the test permission
if someone is bored, maybe try it out? I'm again rewriting the module loading logic rn because I'm still unhappy with how it was split up between plugin and core
also I'll make it much easier and more straightforward
it should
that's what ACF example insinuated
you mean it would require the perms for both commands, or only require them for what's in Hello?
perm would be required in both
i mean, we could easily test it out, but I'm currently on my branch that doesn't have working module loading logic lol
hmmm
I don't know whether I like this, or not
you should otherwise it'd be inconsistent
for eample test hello requires test perm so should test world
they are both a subset of "test"
true
yeah anyway, both possibilities wouldnt be an issue as one usually declares perms per subcommand anyway, and the main command would simply show a help message with @foggy boughssage and @Default
oh hello HelpMe
btw we can enable per player locales and automatic help generation in ACF but I currently dont remember how
That's later problem xD
Can also try their brig support
It's old asf with no updates I doubt it'll work well
Could try but like skull emoji
😩
java plebs be like: "oh nooo, I have to print out a file, it's so annoying, uuugh D:"
public class FileReadingJava {
public static void main(String[] args) {
try (BufferedReader br = new BufferedReader(new FileReader("example.txt"))) {
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
kotlin superiors be like: ok
fun main() {
File("example.txt").forEachLine { println(it) }
}
Kotlin simp now aye
Java nio >>>>>
Takes a break from spigot
Comes back
Alex is a kotlin enjoyer now
Wtf?
also have you seen my great gradle skillzzz=
gradle is
though
https://github.com/SpigotBasics/basics look at this fancy gradlyness
especialy buildSrc
100% gonna fork that for the copyPluginToTestServer I really need to get with the times and start doing this
im still drag and dropping in 2024 
Gotta be real gigachad and force a reload command
well all you need for that is just
tasks.register("copyToTestServer", Copy::class) {
group = "testserver"
description = "Copies the plugin to the test server"
from(tasks.shadowJar.archiveFile)
into(yourDestination)
}```
it will automatically depend on shadowJar because it uses its outputs
if you don't use shadow, just replace the from part to use tasks.jar instead of tasks.shadowJar
can it do it to external servers? Mainly to something like my dedi
or only local files
always assumed that was strictly local
You can make winscp sync a directory
ooo not a bad idea
if you got an SSH key setup that doesn't require a passkey, I'm sure you could just create an URI like ssh://user@server:/home/minecraft/ and turn that into a file or sth?
but I'm not sure
i mean it's 100% possible, the qeustion is just whether it's one line or 7
in the worst case you'd just have to throw it into scp
I also hereby wanna publicly apologize and admit i was ignorant earlier: gradle is superior to maven and kotlin is superior to java
Blink twice if you are being forced to say this
kek
https://stackoverflow.com/questions/13183433/how-to-copy-directory-via-scp-within-gradle-task this unfortunately is for groovy but the idea is the same
What is a clean and elegant way to copy a bunch of files via scp with Gradle?
Two ways I currently see are:
Using Apache Wagon, as described here: http://markmail.org/message/2tmtaffayhq25g4s
Exe...
oh wait, their solution is horrible
I'll write a blog post about how to properly do it tomorrow. it's much easier than creating random ant tasks
for example with the SSH plugin: https://gradle-ssh-plugin.github.io/
but instead of using from: "filename.jar" I'd rather use an output of an existing task, e.g.
plugins {
id 'org.hidetake.ssh' version 'x.y.z'
}
remotes {
webServer {
host = '192.168.1.101'
user = 'jenkins'
identity = file('id_rsa')
}
}
task deploy {
doLast {
ssh.run {
session(remotes.webServer) {
put from: tasks.shadowJar.archiveFile, into: '/remoteDir/'
}
}
}
}
that will also properly set the outputs so gradle can cache it etc
i can accept the first part, but youll never gain support for kotlin > java 
ooo yes another alex blog post
i got a whole bookmark tab for em XD
I will show one kotlin > java snippet per day.
object ModuleJarFileFilter : FileFilter {
override fun accept(pathname: File?): Boolean {
return pathname?.name?.lowercase()?.endsWith(".jar") ?: false
}
}
Usage: ```kotlin
myDIrectory.listFiles(ModuleJarFileFilter)
Java:
```java
public class ModuleJarFileFilter implements FileFilter {
public static final ModuleJarFileFilter INSTANCE = new ModuleJarFileFilter();
@Override
public boolean accept(File file) {
return file == null ? false : file.getName().endsWith(".jar");
}
}
usage: ```java
myDirectory.listFiles(ModuleJarFileFilter.INSTANCE);
the object keyword basically is a singleton and one can access the instance using just the class name. One also doesn't have to worry about creating the instance
What I see there is that if you only have 4KB of storage space left and need to prioritise the code length over readability you should use Kotlin
if you worry about 4kb, then you should much rather use java lol
the kotlin stdlib is like 5MB
and the compiler is also slower
also I dont think that kotlin is less readable
only thing that bothers me is that it uses names before types
but that's valid because usually you don't need to specify types
var and val automatically detect the types
why for example would you need to do final String name = "asd"? Obviously it's a string. In kotlin you just do val name = "asd"
what does bother me though is the lack of a proper static keyword
however in 99% of cases, static methods can be replaced with extension functions, and for the remaining stuff, the companion object basically is the same as declaring a static method
another example
U shud starting using var in Java Alex :P
Tbh java shoulda also just added Val but it's whatevs
final var string = "fun"
Java
public class NumbersToString {
private static final Map<Integer, String> NUMBERS_TO_STRING = new HashMap<Integer, String>() {
{
put(0, "zero");
put(1, "one");
put(2, "two");
put(3, "three");
put(4, "four");
put(5, "five");
put(6, "six");
put(7, "seven");
put(8, "eight");
put(9, "nine");
}
};
public static String replaceNumbersToStrings(String input) {
for (Map.Entry<Integer, String> entry : NUMBERS_TO_STRING.entrySet()) {
input = input.replaceAll(entry.getKey().toString(), entry.getValue());
}
return input;
}
public static void main(String[] args) {
System.out.println(replaceNumbersToStrings("I am 5 years old."));
}
}
Kotlin
val NUMBERS_TO_STRING = mapOf(
0 to "zero",
1 to "one",
2 to "two",
3 to "three",
4 to "four",
5 to "five",
6 to "six",
7 to "seven",
8 to "eight",
9 to "nine"
)
fun String.replaceNumbersToStrings(): String {
return map { NUMBERS_TO_STRING.getOrDefault(it.code, it) }.joinToString { "" }
}
fun main() {
println("I am 5 years old.".replaceNumbersToStrings())
}
can't, I'm always using java 8
Oof
Java 8 is so ild
I'll never be a Java hater it's such a great language obv doesn't mean it's perfect but it's def not horrible
sure, java is great
I could be coding in C++ or something
kotlin is just java with extra cool features
oh shit it's 5.30 am and my bf comes back home in 12 hours
maybe I should snack a clonazepam and go to bed
fake, you're not even bi
wtf my paperless is now using german forbidden msgs even though the rest of the app is in engish lmao
why tf do you have so many tabs open
https://stackoverflow.com/a/27521360
Rip a kitten
because I consume lots of information
i don't understand 🥲
i only see 1 brace used
time to use double brace initialisation
but i dont use java anymore so thats irrelevant ig
I'm a dog person so I'll start spamming these
#kill kittens!!!
Hell yeah
Im trying using a custom command with setblock ~ ~ ~ minecraft:dirt 0 replace {nbt} how can i manage to do it in code without calling the command with the exact result?
if only there'd be a similar language that'd avoid all these things... OH WAIT
Typescript
weve lost alex
"We have lost the battle, but not the war" - No idea who said that tbh
what language
kotlin?
never tried it
and horrible readibility
And an extra amount of clutter for no reason
🫠
No
Kotlin >>>>>> Java in all aspects except being bad
Kotlin readibility is quite good, it's not bad, it's just that Java readibility is too good.
Which isn't that good itself since this just makes shit more verbose
How to set Jukebox's has_record value to true?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/Jukebox.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Jukebox.html
declaration: package: org.bukkit.block.data.type, interface: Jukebox
declaration: package: org.bukkit.block, interface: Jukebox
there is no way jetbrains is not losing money with the way they're currently doing their AI stuff
I know for a fact that if you're going by the normal api rates I am costing them at least $20 a day in queries, even if they're incredibly discounted for some reason their yearly ai plan is still just $10/mo
Damn
and I pray for that
Is it possible to create a custom system for melting objects in the furnace like craft system
?
Add a record
added my mixtape, now the jukebox is on fire, send help
me using github copilot for free
the intellij ai integration is straight up wacky
it's really, really good
I recommend trying it
I have the github copilot chat
you actually think I'm gonna update my ide?
hell no
I was using 2016 intellij until like 2021
hey past me, wtf did u write this line for?
I used intellij community during the start of my Java dev journey
Got GitHub edu pack
Switched to intellij ultimate
Then also had webstorm, pycharm and datagrip
Now I dont really program but when I get back I'll start doing stuff in go or rust, so will either install the Go or rust jetbrain ides
Or neovim with nv Chad which is straight up ultra smaxing
incase its a fake player
This is crazy
what if the player... isn't a player????
We're going into a paradoz
now this is what I call a certified website
i wonder if i caught some bizarre edge case or something, or was just genuinely braindead when i wrote it
among all the websites this is the one
Thanks for the reply, but I found that I can use debugstick to change its value to true without adding record. How do I make has_record true in the plugin?
Now do u know what will happen?
U will remove it, with some other changes, and ur code will stop working, after a few hours you will realize it was that it statement and add it back
its like tf2 pineapple.jpg
The value doesn’t do anything though
what game had the coconut.png
oh was it coconut
Md I have a question.
When u started spigot, what was ur mindset, did u ever expect it to be as big as it is rn, and were there any other members with you in the starting days.
Also with spigot are u able to make a living out of it or do u still work on other stuff
tf2 coconut.png then yeah
ahh
If this value is set to true, player cannot place record inside
cancel the interact event instead
I am making a plugin to replace debugstick. I hope this plugin can have all the functions of debugstick.
hey, does anybody know how to add UTF-8 to my plugin?
Lectern has a similar problem
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/Lectern.html
declaration: package: org.bukkit.block.data.type, interface: Lectern
You mean replace existing UTF-8 characters?
Or just use them
Like that it doesn't give me a strange symbol when i print "é"
Make sure your plugin is compiled using UTF-8 as a file encoding
How do i compile my plugin with UTF-8?
What build system are you using ? maven ? gradle ?
^
Gradle
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release = 17
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
pretty much
Thx
ew gradle kotlin

Java pros be like:
public class FileReadingJava {
public static void main(String[] args) throws Throwable {
Files.readAllLines(Path.of("example.txt"), StandardCharsets.UTF_8).forEach(System.out::println);
}
}
The charset is technically even optional
if it is not present, will it automatically recognize the charset or will it just default to something?
The default is UTF8
okay but
At least according to the Java 20 javadocs
in java 21 you could also just drop the public class and public static void
just void main() it
Yep, but I stayed with Java 7 java code
Well java 8
Keep your scripting language features away from by beautifully verbose java

Well Java 11, for Java 7 you'd use Paths#get instead of Path#of
ah
lmao
true
Open a feature request then please
?jira
also, anybody ever encountered a Scanner(System.in) with a while loop being slow as fuck? It just happened to me randomly and it takes like two seconds for the scanner to put out a string
I'd honestly just copy minestom's hierarchical classloader (https://github.com/Starloader-project/Starloader/tree/54310449fcb963ceeef5cba83ef50bbd10eabd1e/src/main/java/net/minestom/server/extras/selfmodification) and remove all the features you don't need or want.
Otherwise if you really want to do it from scratch you'd probably be better of overriding loadClass. After querying findLoadedClass and the system (under Java 8 or below) or the platform (under Java 9+) classloader [and then the parent classloader, if you wish to support that], you can call the loadClass method of the child loaders. The only real catch is that if the child classloaders have your parent classloader as their parent set (without any further logic, that is the child loaders are bog standard URL classloaders) a stack overflow will occur as the child loader will first query the parent loader, then itself - such conditions could be mitigated via ThreadLocals that will NOP attempts to load a class in twice.
no way its fourteen brush
How do I make something only execute on the first run of a plugin?
I want to have it run a command to disable some default minecraft stuff on first run but only the first time it's run
cant he just do URLClassLoader(loaderA.urLs + loaderB.urLs), so just combining the urls into a new classloader
set a flag in teh World PDC
at startup, if the flag is there your plugin has been run before with this world
you could, but in that case the classloaders are not isolated
mye
This could pose problems in case of shaded dependencies - although now that you mention it these problems would still be present for as long as the child classloaders are stock URLClassLoaders
Has anyone done protection against incorrectly configured config values in the plugin? Can anyone else add anything else to this class who has done this?
https://paste.md-5.net/qimiveyero.java
wdym?
What is the best way to store a list of killed players in MySQL for a player, while still having the ability to add and remove them (for example, for 2000 players at once). Or should I come up with some other way to solve my problem?
Why do you need to store killed players?
I'm making a bounty hunter plugin, when I kill a player I need to save the head in the "case with heads", and then I will need to hand over this head to the NPC, and remove the head from all players
do not quite understand
It seems to me the only one who needs a full list would be the NPC
player kills someone, takes head to NPC and gets bounty if there is a bounty to be paid
the player writes the command /case, and an inventory is generated with heads that are in mySQL, in the format "Elgar MrTvist ..."
I just did this before, but now I plan to rewrite the plugin for optimization purposes
the plugin has not been adequately tested
Doing it your way I'd not give the heads to each player
Make an inventory in your plugin which has the heads, and open it for the player upon command
that way teh player never has the heads inventory so you only have one inventory to update
I meams. if you have to end up persisting the data anyway inventory would be a meh idea
you will still need to create a database or file to save inventory after shutdown
giving out heads to every player is a bad idea
you don;t need to save inventory, you nly need a list of UUIDs
you can't take them from there
Which is what they were asking to begin with 
you can't take them from there
They aren't 😭
create an inventory to hold them, which the players can all open.
when a player kills someone, give them a head of that player.
they take that head to the NPC, and exchange the head for a reward.
You then remove that UUID from your db, and remove the head from your inventory
how you store the UUIDs is upto you, be it as Longs or VARCHAR(36).
Yo, some time ago someone posted a link to a website I think.
There was a description of how to do one big thing over several ticks in smaller parts. (For example placing a lot of blocks)
Anyone knows where I can find that ?
remembered 😉
ah thankyou very much
apparently this is the IP that the player used to connect from
like play.server.com
not the players IP
where can I access the Player's IP? (this is bungeecord btw)
no it doesn't 👀
apparently this is the problem
Connection class btw
okay so how do i blacklist linux players
lmao
./hack.sh
nah, too illegal
linux players ? xD
On unix systems like linux processes can communicate via domain sockets
which is a problem cuz
there is no ip involved
Yea but that is on the server
Well, I still cannot blacklist Unix based connections like that
your server is the one that would have to bind to a unix socket
clients cannot just magically use a socket on your system
That's most likely the case w/ bungeecord though
Hey guys, how can I set player the shaking animation, like shivering?
microsoft edge : hello, you wanna try me?
me : sure!
me : goes to brave and clicks on download
microsoft edge : you sure you don't love me anymore?
me : shut the f-up
that was true with IE
and a little bit true with Edge
Like, this would make sense if you e.g. have HAProxy running infront of a set of bungeecord instances.
HAProxy could forward via unix socket so you can skip the whole TCP layer as there is no benefit
but you'd have to be the one that sets that up
it is by far not a common thing
yeah i run Linux (Windows) see i have a package manager
i need to wait for my account to be deleted
ill just add an option to disallow Unix-Based connections
Sure yea
bro why can't websites just make a fucking button "delete my account" ?
yeah i run linux (wsl) and have a package manager on both
jk
its probably the fact xf is like over 10 years old
A directory of direct links to delete your account from web services.
if getAddress throws an error , it's a unix connection
thats kinda exactly what this does
.
I’m making a private system in chunks, the principle of operation is:
the player creates a city through a command, I start private from this chunk by chunk, I made a system for expanding private, but there is a very main problem, how to save it all, so that the next time you turn it on, everything loads stably, because this is an entity. I came to the conclusion that with EntitiesLoadEvent, I create a CityChunk for each chunk, and in it I create entities that are stored in the pdc of the chunk (if side == true - create a wall). The problem is that it does not restore correctly, can you give me some advice? What if we can somehow avoid creating entities every time? Initially, I wanted to save the UUID entity in the pdc, and then turn on/off their visibility, but they were always null
does anyone happen to have a reliable Player#isOnGround() alternative
isonground is deprecated because its client defined
even if I think about it and decide to abandon the entity, I will still need each chunk when creating CityChunk, which doesn’t seem very cool to me. I don’t think Towny/Kingdoms did this
Towny maintains it's own database
???
nothing is in the world for Towny
Are the coordinates of chunks stored in the database?
yes
that is, I won’t be able to come to such a system if I have entities?
I want to store a string in an item using NBT. but I didn't find much info about it. can anyone help me?
yup
?pdc
got this
if (meta != null && meta.getPersistentDataContainer().has(new NamespacedKey(Wamasterv3.plugin, "command"), PersistentDataType.STRING)) {
String valeurCommande = meta.getPersistentDataContainer().get(new NamespacedKey(Wamasterv3.plugin, "command"), PersistentDataType.STRING);
Bukkit.broadcastMessage("La valeur de la balise 'command' est : " + valeurCommande);
} else {
Bukkit.broadcastMessage("L'ItemStack ne contient pas la balise 'command' ou la valeur est null.");
}
but i can't get the plugin to give me the string, its always null
how are you setting it ?
first you should define the namespacedkey separately and not make a new one every time you're accessing the pdc
and yeah how are you setting the value to the item
/give @s minecraft:ladder{command:"String"}
that isnt how pdc looks like
pdc isn't custom NBT
i dont remember what it exactly is but its like PersistentBukkitValues {k:v}
Yea but like, just code in spawning this via your plugin
hm idk maybe you just need glasses
can you give me an example of what exactly you cannot read?
redstone output
is still this still required? 🥲
why is this not just the default
I mean, it uses the system default
ah that explains why I only have to change it on windows
yeah but tbf why does gradle not use UTF8 by default?
¯_(ツ)_/¯
it's about "reproducible builds" and stuff and hence should not even take a look at what's the systems default
yeah sure but it could also just use utf8 as default if not specified
maven has the same stupid problem
If you need it to be utf 8 specifying it as such is a good idea
like, if you need java 17 to compile, you define it too
yeah but imagine a life where utf8 is considered the default because why not
Yea would be nice xD
but like, then you argue for utf 16
or something
and yea
its a never ending escalation with the "make something the default"
as long as the default is not windows-bullshit, I'm good lol
Like, e.g. eastern asian chars are a lot better in utf 16
so arriving at the "best" default is just, kinda hard
idk what the fuck windows does tho
like, the fuck is CP1250
im seeing that it's possible to use PlayerStatisticIncrementEvent with Statistic.JUMP to effectively make a playerjumpevent happen, is there any reason I should avoid using that? like is it maybe also defined by the client or something
Well, statistic increment event is rather hot
Yea
I mean, statistic is fine ™️
technically you can hack around with EntityExhaustionEvent
are you serious
I presume it is also called for like
if you just return if the statistic is not JUMP, it's fine
Yea I mean, complain to mojang xD
I use this to detect jumps: https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/events/PlayerJumpEvent.java
And if on paper, it uses this instead: https://github.com/mfnalex/JeffLib/blob/master/paper-hacks/src/main/java/com/jeff_media/jefflib/events/PaperPlayerJumpEventListener.java
Yea, stat even probably is fine xD
or yea, on paper, the respetive event
with that said tho, the onGround stuff is kinda meh
it is client controlled, so hack clients can cheat around there
is there some way i can force a Player to use the Entity implementation of isOnGround though
I don't think so xD
god damn it
you can use reflection to get the method from entity and then invoke it
try {
// Use reflection to get the isOnGround method from the Entity class
Method method = Entity.class.getDeclaredMethod("isOnGround");
// Invoke the method on the Player object
boolean result = (boolean) method.invoke(player);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
obviously you should cache the method instead of getting it everytime
gotta love the Scheduler interface 
How do you ban someone infinitely, the ban function only takes in duration, instants or date and im not sure how to set these to 0
declaration: package: org.bukkit, interface: BanList
yep
Everything is nullable besides the player
okay thanks 👍
and CMarco's opinion of himself
hmm
Cast the null to date or instant
(Date) null
You have a date with nothing
Isnt there any way to make a block unique without db
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
how do I get the amount of experience that will fall from the ore?
Isn’t it available in the break event
ye
day 2 of me trying to get libs working
but like, that is reactive. I read their message as a proactive "how much would that drop"
IT ACTUALLY WORKS OMG
thanks matt from helpchat!
Hey that rhymes
not allowed
gradle rhymes with pain
what exactly?
the amount of XP the block would have dropped?
how do I get experience from the block? Maybe there is some interface to which I need to instanceof?
yes
Wouldn't you need a Map for this
hm I don't think you can get the vanilla XP amount for blocks
You could mark the block and then listen for the break event
And then callback after the event
hm
will you call me on my birthday coll
will you be my callboi?
it's on 22nd feb btw
I'll call you. I don't believe it's the 22nd. I think you are lying.
oooh
that's what you're saying, aha
yeah well
joke's on you then
Eat this @eternal oxide
faked 😛
Soup? I can send you soup, but it may be cold by the time it gets there, and spilled
Wrong channel mfnalex
Not sure ur supposed the share the passport number
I was going to comment I would CSI magnify the reflection on his thumb to get the number. Then I realized he hadn't covered it up.
Cutting the MRZ .
is there a way to change console_sender to command_block_sender (like a fake command block)?
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),cmd);```
@ivory sleet need you help here, wouldn't it be smarter to just use a hashmap? I mean EnumMap allocates an array based off of the size of the Material enumeration, which is huge considering how many enum fields there are. So only having a couple ores there wouldn't make much sense no? It's like allocating a huge buffer, from which you only use 10 or so fields
could probably use CommandSender#sendMessage("/mycommand"
what is hash, what is enum, in my case there is no difference
¯_(ツ)_/¯
why not just store a Map<Material, int[]> or sth
tbh i like the functional approach more
ThreadLocalRandom allows you to transfer the LED to itself in order to reproduce the entire random from the beginning, which allows you to sort out some problems, and the array will not be very good
the array was meant to be used just for min and max value




