#dev-general
1 messages · Page 169 of 1
jesus christ enough with the material. it doesn't work. All potions have the same material yet different names.
afaik there's no way to get
Iron SwordfromMaterial.IRON_SWORDif that's what you mean
it's client side
[23:10:18] [Server thread/INFO]: [Blocky Debug] | DEBUG | item: {"type":"GRASS_BLOCK","v":2567} | ORIGIN: NmsTestCommand in method parseCommand at line 97
[23:10:18] [Server thread/INFO]: [Blocky Debug] | DEBUG | localized name: | ORIGIN: NmsTestCommand in method parseCommand at line 98
[23:10:18] [Server thread/INFO]: [Blocky Debug] | DEBUG | display name: | ORIGIN: NmsTestCommand in method parseCommand at line 99
it's client side
@prisma wave But the server has to get that info as well somehow, for sure
why would it?
hmm question of the day
should I make my own Essentials?
lol
I mean private server
why would it?
@prisma wave To get the localized name?
Also I have never seen the localized name be anything other than an empty string
Should I reinvent the wheel for my car?
@old wyvern Yes. Make it square and the road bumpy
Good idea
@prisma wave [23:17:14] [Server thread/INFO]: [Blocky Debug] | DEBUG | nms name string: Grass Block
it does have the actual name
on nms side only though
for some godforsaken reason
Why does nms even exist man, can't they just put all those methods in the spigot api as well?
like fuck why do I have to keep track of the damn game version...
well they will
NMS is the base Minecraft server that bukkit is made on
as mojang is gonna release unobsfucated mappings now
nms isnt done by spigot
iirc its pretty soon
We already have maps
@ocean quartz This is about the item name, not the serialization anymore
can't get the name of a potion without nms
like the actual name of the itemstack
https://twitter.com/Dinnerbone/status/1293597326561488897 maybe not releasing those
Heads up Minecraft modders: On Friday we'll change the legal text on our obfuscation mappings. We're hoping that this change will make the legal terms clearer for projects like MCP/Forge/Spigot/etc to operate going forwards, ideally using our maps, and make modding easier for...
261
2203
It's just that the current maps aren't great plus some legal stuff that's why they're changing
Where are those maps published?
How are they used?
Does Spigot handle all that or do we have to?
And does that mean no more NMS?
Also: when`??
They are in the Minecraft folder in the versions there is a version json file with the Link to the mappings
Nms won't change
You can just look up what the names mean
That's all
Well how does that help at all lol
Most of it has already been figured out and de-obfuscated
It helps a whole lot
instead of fieldnames like a it would be something more descriptive
They are in the Minecraft folder in the versions there is a version json file with the Link to the mappings
@ocean quartz Server or Client Minecraft folder?
I don't see a versions folder
oh in the .minecraft folder
^
well mcp exist for older versions
oh man I finally found it https://gist.github.com/DizMizzer/57c60c757643dc7e5a70a9b0e05b7fb6
I think mine was simpler, just too manual xD
yeah
what dis
its a spiral algorithm to find the closest safe block.
now I have to redo my code to integrate it xD
but something is not right
because that algorithm only takes the values 0, 0 right?
oh I'm good.. I think its suppose to be relative coordinates
is it a good thing to make my own essentials plugin? or is it a bad idea?
I mean why tho? If you want some things changed and add some features they don't have yes if not don't think so
I mean what I'm doing is making a Core plugin where I added features like: /giveall, changing of tablist, a new /back command which is better xD
also custom join/leave messages
isn't essentials OS tho?
are the CORE of the CORE
so you could just edit Essentials to work how you like it but then when they update it it would take you a bit to update unless you follow the dev builds.
But as I always say probably wait for responses from more experienced developers as I am not even close to be qualified as a developer.
That is just my opinion.
ok ty
cause I mean.. a plugin like that.. if it fails.. rip server
if it lags... rip server
it's a "nasty" thing to work with
also editing essentials isn't the best idea
cause the code won't still be mine
soo
that kinda sucks
oh I see you want a public plugin
I thought you want a private plugin for yourself. I mean I dk
Just make small plugins that are the best at what they do. I think that's the best idea
anyone knows how to execute a gradle command like gradle -q in the console with a task. There's literally nothing on the internet about this or I am a shitty googler.
@prisma wave do you know
?
uh what
nvm
Ok
I just spent 15 minutes trying to figure why my gradients weren't working just to find i had the same hex in both places..
Oh boy it works now 👀
oh man
Basically
final MessageComponent component = message.parse("**markdown** message");
component.send(player); // sends to player with actions and stuff
component.asString(); // returns it as string for items and etc
easy to use. I like that
I mean it's the same way in Kotlin as in Java
@static zealot
VCS... why is it hidden under a tab that I have no idea what it means
gradle sucks sometimes
you're trying to start a war
no but this build_5n8420bxp70eddllc0ko7eue8$_run_closure1@777a8227
havent been able to solve it like for 2 h
just figured out
String something = {
return "test"
}
println(something) //returns garbage value
and its rly pissing me off
oh wow im dumb as usual
oh man Matt I owe you. You just spared me from another 2 days of scratching my head then hitting it in the wall xD
That thing helps so much, you can even recover deleted files with it
I was talking about the .clone() thing. The deleted thing saved me from like 2 hours of rethinking some shit. so you saved me from 50 hours of wasting time xD
oh
now I just have to understand why .isSolid is not working as I was hoping it should xD
Yeah, i remember doing a crate animation before and the armorstand was doubling in location all the time before of it
like how dumb can one possibly be?
I was hoping that this check !location.block.type.isSolid || (location.block.boundingBox.widthX < 16 || location.block.boundingBox.widthZ < 16) would be true when the location is either air or a solid block that is not a full block.
fkn forgot to close an input stream so it potatofied my pc rly hard
xD
like how dumb can one possibly be?
Well..
I just spent 15 minutes trying to figure why my gradients weren't working just to find i had the same hex in both places..
Me ^
lol
I guess I have to do something like location.block.type.isAir|| (location.block.boundingBox.widthX < 16 || location.block.boundingBox.widthZ < 16) hmm I wonder if this would work for all blocks.
well I'm dumb and thought a Closure would return its type
@prisma wave now try JavaScript https://img.bristermitten.me/L5P97RHmee.gif. I believe Koala/Serayne uses JAvascript plugins on his servers he owns like 20-30 diff servers
u'd need a custom jar/spigot.jar
@ocean quartz How're you getting gradients on itemnames? o.o
Just as string
is that using the MD parser you have
Basically §x§0§0§0§0§0§0
And nah
dang lol
Can you even use regex to match hex on a string?
Yes?
Test it :(
regex bad if it's called a bajillion times
regex bad if it's called a bajillion times
@split talon Nothing is good if it's called a bajillion times except the suicide hotline, that means its working
@lunar cypress https://github.com/Aj3douglas/Map-Minigames/blob/master/src/main/kotlin/org/aj3douglas/mapgames/common/commands/MapTestcommand.kt
Also im having a problem with PDM where everytime I turn on the server I get a class not found exception if I dont delete the plugin libraries folder in /plugins/Plugin Libraries, so if you try and build it then youll have to take that into account
How do I reverse this map:
val nmsToBukkit = mapOf<String, Set<String>>(
"1_12_R1" to setOf("1.12-R0.1-SNAPSHOT", "1.12.1-R0.1-SNAPSHOT", "1.12.2-R0.1-SNAPSHOT"),
"1_13_R1" to setOf("1.13-R0.1-SNAPSHOT"),
"1_13_R2" to setOf("1.13.1-R0.1-SNAPSHOT", "1.13.2-R0.1-SNAPSHOT"),
"1_14_R1" to setOf("1.14-R0.1-SNAPSHOT", "1.14.1-R0.1-SNAPSHOT", "1.14.2-R0.1-SNAPSHOT", "1.14.3-R0.1-SNAPSHOT", "1.14.4-R0.1-SNAPSHOT")
"1_15_R1" to setOf("1.15-R0.1-SNAPSHOT", "1.15.1-R0.1-SNAPSHOT", "1.15.2-R0.1-SNAPSHOT"),
"1_16_R1" to setOf("1.16.1-R0.1-SNAPSHOT"),
"1_16_R2" to setOf("1.16.2-R0.1-SNAPSHOT")
)
to get
val bukkitToNms = mapOf<String, String> (
"1.12-R0.1-SNAPSHOT" to "1_12_R1",
"1.12.1-R0.1-SNAPSHOT" to "1_12_R1",
"1.13-R0.1-SNAPSHOT" to "1_13_R1"
...
)
?
i guess
so basically I want to assign the keys to the sets and then flatten the sets to get multiple keys to the same values
should key be a set of those or the individual values?
individual
(reduce-kv (fn [m k vs] (apply assoc m (interleave vs (repeat k))) {} nms-to-bukkit)
cluster
(reduce-kv (fn [m k vs] (apply assoc m k (interpose k vs)) {} nms-to-bukkit)
@lunar cypress I have no idea what that means, can you explain that code like I'm 5 pls?
Clojure
Huge
A similar approach should be possible in kotlin with fold
I can't read clojure code, have no idea what that does
does what you want
clojure looks gross
...
It performs a reduction by adding each entry to a new map
does what you want
@prisma wave fun isHelpful(): Boolean { return false }
fun isHelpful() = false```
It performs a reduction by adding each entry to a new map
@lunar cypress how do I perform that reduction in kotlin though?
nmsToBukkit.entries.fold(mutableMapOf<String, String>()) { map, (key, values) ->
for (value in values) {
map[value] = key
}
map
}```
Just noticed I made a mistake earlier
Would the type arguments be necessary?
Possibly not if you declare them earlier
Kotlin does not have freeform syntax
I have no idea how folding works
Folding is like accumulating
here you initially passed in a map and return the map everytime
the problem with that you have is for isnt an expression. Just change that into a block and return map at the end
No block needed
I already corrected my snippet
so folding means I create a new object and do stuff with my initial object to manipulate the created object and then return the created object if I want to?=
Not necessarily
It is more abstract than that
I already corrected my snippet
Ah didnt notice
fold/reduce are the same thing and come from functional programming, where this would be called a left fold (lfold). The way it works is you have some sequence and a function, and you take the first two elements of the sequence and apply the function to it, then you take the result of that and the third element and apply the function, than result of that + the fourth element etc.
There is a variant of this where you provide an initial value
Which we do here
So instead of the first two values it's going to use the initial value and the first element
so folding means I create a new object and do stuff with my initial object to manipulate the created object and then return the created object if I want to?=
Could be anything.
Imagine you have a collection {5, 6, 7, 8, 9, 8, 15}
You can sum it by folding
You specify a identity value as the initial value, for addition -> 0
so fold with initial value 0, on every iteration a you can return (initial + current value) and the next iteration would receive that as "initial" and after the last iteration whatever is the returned value from the last iteration will be your result
And all that the function does is manipulate the left value (which is a map) as a side effect
mhm
Literally the same amount of parens as kotlin here lmao
😂
can I define a variable in a gradle parent build script and use it in the child one?
yet another Clojure good moment
Closure*
Clojure*
Pretty sure it says Closure, check your eyes
Putting a variable in
extClosuremaybe does that
Clear W for clojure
¯\_(ツ)_/¯
Ok but why
Why not
clojure in the moon who will he illuminate
all the good people of helpchat that's who
Can you send me an invite to wherever this emote is from
Not that I could use it on this server but anyway
Where in the fuck did this icon come from all of a sudden?!
It's always been like that
Minecraft dev plugin
https://hastebin.com/bedosiciti.coffeescript am I using CompletableFuture for this purpose right? I am giving async programming a shot, so idk..
Reason to add doomful?
do you need a reason? don't accept then, I don't need people like you that think they need a reason
Lmao
lol
Do you guys write any UnitTests for your Plugin implementations?
@deft patrol don't use assert,
Liskov
you shouldn't use string concatenation in a prepared statement, that defeats the point
you might want to use an empty list instead of returning null
@empty flint yes
@empty flint yes
@prisma wave How do you write those tests for stuff that requires a working, running server?
MockBukkit if it's necessary
@prisma wave thank you! but am I using the completable future right?
ok
well you can use string concatenation here
it's nothing you can template with prepared statements
you could collapse the two try with resources blocks
assert is useless
Task 'wrapper' not found in project ':<subproject>:<sub-subproject>'.
What's a 'wrapper' task and why does this subproject need it and no other project does?
I think I got it, it seems as though this one sub-submodule was somehow registered as a project
alex, whats a good way of adding a second gradle build script? would that have to be with moduling or can I put something nice in just my original build.gradle to add tasks and variables from other.gradle
you can make other .gradle files
and it only had the gradle stuff necessary for a module, not a standalone project
and then you can do apply from: 'file.path' iirc
so a fully qualified name?
Does each module have to have a version associated with it?
for instance if I have a root project without any source code, I won't ever need the version of it
but it can be from a parent module
@prisma wave how?
ok nice got it working
subprojects {
group 'me.bristermitten'
version '0.0.20'```
i have this in my parent module's buildscript
so all others share the same group and version
subprojects { subproject ->
subproject.group 'lol.lol'
}
what is the relevancy of the group?
thats how I do
like what does it actually do? Does it have to do with the classpath in any way?
uh I think its for maintainability but there's probably some more logic behind it
it's for artifact resolution
in the same way that maven group id's are
compileOnly "org.spigotmc:spigot-api:blah"
group id is org.spigotmc
Got it. So if multiple subprojects have the same group that's not gonna clash like it would with classpaths?
and the artifact id is defined by the project/module name?
Yes
compileOnly "org.spigotmc:spigot-api:blah"
imo specifying that as compileOnly("org.spigotmc","spigot-api","blah") looks better (that only really works like that in Kotlin DSL)
Whoever invented the kotlin dsl should be shot
Twice
Maybe even 3 times
Although that's a bit extreme if you ask me
Could not resolve: org.bukkit:craftbukkit:1.12.2-R0.1-SNAPSHOT
How do I access that repo?
Have you built the 1.12.2 jar?
maven local
Did you run buildtools?
^
Does buildtools install the appropriate version in my local repo?
Use spigot then?
@steel heartCould not find org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT.Does that contain the craftbukkit stuff as well?
yes
In fact I think 1.16 doesn’t even create a craftbukkit one
Well wouldn’t be an issue for you rn but just fyi
java -jar BuildTools.jar --rev 1.12.2 --compile craftbukkit like this? or do I need anything else?
Just the rev argument should be enough
just ran that command
Could not find org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT.
Nothing
org.bukkit:craftbukkit:1.12.2-R0.1-SNAPSHOT works though
so basically spigot is not placed in the repo, craftbukkit is
It's not saving as UTF-8
In which config
does anyone wanna test my connect four plugin with me
I'm too lazy to download a cracked launcher
I can @lunar cypress
cool
👀
Sexy
Does that work with colors?
kinda
or is that just the default one from brig
Doesn't seem like tabcomplete handles hex colors
ah
Works with normal ones though
Can a plugin detect if it's running on a bungee network or not?
How would this, [ 367, 1537083095 ] result in 1578169576722 the first being the given info, the second being a timestamp of that given info
How would this,
[ 367, 1537083095 ]result in1578169576722the first being the given info, the second being a timestamp of that given info
@hot hull In what context? What kind of information? Are both related to time?
Yes, the first one is the raw data given, the second one is a timestamp of that data, if that makes sense
Hm no idea tbh, where do you get that data from?
Player nbt
what are you doing with that original data?
like how are you getting to the outcome
Exactly what I need to figure out
Holy shit Rider feels so comfy compared to vs
auto converts my K&R to Allman as well ❤️
hot
I wanna test Rider at some point too
How would I go about making one plugin for both bungeecord and spigot where, if it runs on bungee, the frontend/backend communication happens via messages and if the backend is on spigot instead of bungee, the backend manipulates the frontend directly?
Just add a bungee.yml file declaring the main class for the bungee implementation
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
For communication with spigot plugins
val stages = listOf<Stage<Int, Int>>(
Stage { context, i ->
context["double"] = i * 2
i + 1
},
Stage { context, i ->
context.get<Int>("double") + i
},
)
val pipeline = SimplePipeline<Int, Int>(stages)
assertEquals(10, pipeline.process(3))```
on a scale of 1 to 10 how clean is this?
aside from the bad formatting
looks fine 👌
Cool
Just add a bungee.yml file declaring the main class for the bungee implementation
@old wyvern So on a spigot server the plugin.yml file will be checked and its main class instanceated and on bungee the bungee.yml will be checked for the main class?
bungee can use both but checks for bungee.yml first I think
it should ignore plugin.yml if it finds bungee.yml
yup
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
But can I package both the bungee api and spigot api into the same jar file? Would that not fail on Spigot if it can't find the classpath to the bungee api classes?
Or is spigot shaded into the bungee api?
Youd just not have to load any classes that use spigot libs
Spigot is not included in bungee and will result in a ClassNotFoundException
Right...
So in the bungee part I use only bungee api stuff and in spigot I use spigot...
You couldhave the bungee classes not interact with any classes that load spigot libs
Yes
What did you want to do?
I want to structure my plugin into a backend (data storage and validation) and a frontend (user interaction, commands, inventory guis...). When the jar is placed on the central bungee server, it handles the backend and relays the frontend-stuff via messaging to the spigot servers running the plugin. When the jar is on a spigot server though, it checks if there is a bungee backend running and handles only the frontend if so. If there is no other backend, it handles the backend as well.
So basically I have a frontend in spigot and a backend in both spigot and bungee
Sure, the backend shouldnt interact with spigot directly then
exactly
So in the bungee backend I only need to handle the backend and send messages. The spigot backend can have a class for the frontend and receiving messages or a class handling the backend as well as the front end
So the Bungee main class is loaded from the bungee.yml file and sets up without having to check for anything.
the Spigot main class has to check if there is a bungee backend or not
How would that work? Is there a loading order regarding the servers? Is there a guarangee that the plugin on the bungee server is up and running before the spigot server is?
I was thinking of sending a ping message and checking if something comes back.
brb
You could have a handshake listeners on either side
@old wyvern yeah, that
Is that handshake an actual event?
or manual?
Manual
Thanks I think I got it figured out now 🙂
What particle would be good to use for a lazer/beam effect?
I was thinking fire and some end ones
Noice
o
I forgot how to set texture value for head. Do I need to access skull NBT? I got texture like this
ewogICJ0aW1lc3RhbXAiIDogMTU5ODIwMDg4NzEyMCwKICAicHJvZmlsZUlkIiA6ICIyNzBiMGRiZDc1MjI0NDFlODgwZTI5NzQxNjljZWVmNCIsCiAgInByb2ZpbGVOYW1lIiA6ICJIb2VuVG9tIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQwODBhYzRhZDQ4MTA1ODllNTFhYWZjOTRjMTRlYWFjMWI0MGZmMDcxNDgzOWNjODU1M2FlMTcxMTNjOGM2MDkiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ==
base64?
idk
I did it this way:
private static final BiConsumer<SkullMeta, GameProfile> SET_PROFILE = new BiConsumer<SkullMeta, GameProfile>() {
private Field field;
@Override
public void accept(SkullMeta skullMeta, GameProfile gameProfile) {
if (field == null) {
try {
cache(skullMeta);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
try {
field.set(skullMeta, gameProfile);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void cache(SkullMeta skullMeta) throws NoSuchFieldException {
field = skullMeta.getClass().getDeclaredField("profile");
field.setAccessible(true);
}
};
public static void setSkullTexture(SkullMeta meta, String base64) {
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
gameProfile.getProperties().put("textures", new Property("textures", base64));
SET_PROFILE.accept(meta, gameProfile);
}
``` it was a util class btw
Oh cool. I just found topic have same solution. But since I use NBT api, maybe I can put through NBT 🤔
I dont like nbt api because last time I looked the code was kinda meh
maybe they evolved
I'm just too lazy to make my own stuff, since I use it for myself so NBT api is fine
@meager cairn
awesome!
Read the comments
Any ideas how to make gradle replace a string in all .java files on compileJava and before annotationProcessing
can i use the 1.16 api for 1.8 dev?
Use 1.8?
just wondering
You can
How tf do you cast in kotlin?
something as Something
Thanks
Or if you want magic
if (something !is Something) return
// from here on out, something IS Something
Cuz smart casting
Can't for this, but thanks
Question. When I upload a plugin to github. I upload build.gradle and the other files that are in the folder, the src folder and the gradle folder only?
because .gradle and .idea I assume I don't have to actually I think I even can't but don't know about the build folder
I would assume no but its good to be sure
yeah u dont need .gradle or .idea
theres some others u dont need but cant think from the top of my head
kek
I mean I have these files https://i.imgur.com/YEbVuKK.png
the only one that I don't know about is the build folder
yea no need to push the build folder
I'd say this are the main files you need
Ye
dark reader 
It's an extension

I remember using it but I think on Opera its a bit broken and I stoped using it
I don't like dark reader, it messes up some websites
I use this one https://github.com/StylishThemes/GitHub-Dark
pick up the material atom icons extension while ur at it 
how the hell do I install this? xD https://raw.githubusercontent.com/StylishThemes/GitHub-Dark/master/github-dark.user.css
You need this first https://addons.opera.com/en-gb/extensions/details/stylus/
Was there no action bars in 1.8?
There was
^
I guess it's a different packet?
Check FJ if you wanna copy paste 
Yh iirc
Oh it uses the chat packet what

lmao
@hot hull what is this https://github.com/Frcsty/FrozenJoin/blob/master/src/main/java/com/github/frcsty/Handler.java
this is a mixed-language project smh
That's the thing I was going mad about a few days ago
It's a kotlin lib, and for some reason I can't access it from kotlin
So I had to do some shenanigans
you mean try using ActionHandler within Kotlin code
Either or
Could not find com.github.frcsty:FrozenActions:1.0.0.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
```🤔
please don't tell me this comes from mavenLocal()
Yea it does cause jitpack was being a bitch
Just throw FrozenActions to your maven local
how exactly do you expect me to do that?
By clonining my FrozenActions project and throwing it in maven local
What are you on about?
If you don't know how to throw a jar into maven local, don't sweat it 
usually, you use the maven-publish plugin to push to a Maven repo
and that includes Maven Local
and ofc I don't know how you put a JAR in Maven Local, I rarely ever use Maven Local because I do the smart thing and use dependencies from repos
and when I do use Maven Local, I use the maven-publish plugin
building the project will install it to your local repo anyway
okay
still won't import, probably because it can't find it
(it won't import in the Handler class)
God, so i need checks for 1.8-1.11, 1.12-1.15, 1.16, lovely nms changes
@jovial warren Bardy, considering jitpack is being a bitch, and I don't really care about putting it in an actual maven repo, it's fine 
no it isn't
since having to compile a separate dependency and manually put that in maven local is a pain in the ass
somebody tell me how tf I'm supposed to manually put a JAR in to maven local
because gradle build doesn't seem to be doing it for me
gradle build isnt supposed to add to maven local
yeah I thought that, but from what I understood, that's what @frigid badge was implying
Use the maven plugin and install task or maven-publish and publishToMavenLocal
With the jar
okay
also how tf does the maven publish plugin work in regular Gradle?
because I'm doing what the guide says and it's just yellow underlining it
I'm literally reading that
my bad, I expected he would’ve had publishToMavenLocal in his build file.
ah
Ayy all versions working now, no more errors
gg
This class is a mess though
@frigid badge yeah I would've expected that too tbh
why is Groovy Gradle so shit with the maven publish plugin
like that's one of those times where Kotlin DSL triumphs without question
Gradle isn't great with maven publish in general
@old wyvern what
They give us vertices of a polygon and ask us to find the total vertexes
thing is
We didnt need the vertices
we jsut needed n apparently
I ws just randomly trying it xD
for (int i = 0; i < n; i++) sc.nextLine();```
Skipped all point data xD
lol
also can anyone else agree that: ```kotlin
create<MavenPublication>("name") {
}
is better than groovy
name(MavenPublication) {
}
No
I don't agree either, it's just more to achieve the same lol
but the second one literally makes no sense
@jovial warren PR or Shut Up 
okay then I won't bother
😂
Meaning you can't say shit if you aren't willing to PR, stop bullying me weeb
I'm not gonna even try and work on your code until you fix that maven local bullshit
at least configure the maven publish plugin so people can properly build and publish to maven local if you're not gonna put it on a public repo
Yeye I gotta learn how to use an actual maven repo
alright I'll leave ya to it
ez bintray or gh packages or smth
Gh packages ewwwww
I mean who even uses non-dockerized applications?
an application which has not been dockerized
so yes not running in a docker container
Oh yea I was gonna ask something, is there an IJ plugin that just tracks how much overall time you spend on a project, like idc about details just how much time I spend on it
wakatime
wakatime
Only 2 weeks
prob sells all the data too lol
really?
idk never used it
I really don't care about stats like that
welp
I need something that's perma time not just 2 weeks
i mean it doesnt matter if they sell that I guess
🍬
you receive money for your work?
I work at a software company
ah okay
I never do any bukkit stuff
I spent 60 hours for 40€ @frigid badge be jealous ||I wanna cri||
oh god, I hope you learned something atleast?
like a new lib or framework or language or some stuff
Nope
F
I've spent at least 100+ hours working over time for fuck all lol
but I program because it's a fun hobby for me, not because I want money out of it
Not even gonna respond since that's a shit argument 
Anyhow Lemmo, I learned that spigot is even more gae than I thought
Frosty knows how to boilerplatify a code
is WakaTime premium worth it btw guys?
because $9/month seems like a bit of a rip off just to see more than 2 weeks of history
It's not worth Bardy
That's why I was asking if anyone knows of any other IJ plugins that track time
I could just make my own plugin which uses prometheus metrics
its free
it's Free* @old wyvern (free with a catch)
Yugi, 2 weeks data history is free
?
You can view 2 weeks of wakatime history for free
Its mails it to you
I swear that expiry date is 2 weeks from the date you receive that
and also, that's only weekly
Whats the issue exactly?
that you need premium to view more than 2 weeks' history
If you have your entire history in your email does it matter tho?
Yes lol, I'm not about to go counting up the time
^
🤷♂️
If I wanted that I can just use a stopwatch and time myself
you do you my guy
What do you think this is the middle ages smh
well, guess it's time to learn how the JetBrains plugin API works and make a custom alternative that uses prometheus then
¯_(ツ)_/¯
actually, https://github.com/muety/wakapi
what's that
idk
wrong channel, no context, no stack trace
@true grail we need more info than that, and also, not in here
which channel then?
it's too powerful
@lunar cypress very nice indeed
I thought "wow only 5 files" and then I saw the contents lmao
😔
:clojurepensive:
I tried around with core.async concurrency and it worked out quite well
with the scheduler?
Events, mostly
but I also needed the scheduler for server thread actions
that was simple though, I just wrote this lil macro
(defmacro runsync
"Executes the given body on the server thread and returns a channel that receives the result when it's done."
[plugin & body]
`(let [result-channel# (chan)]
(run-task
(Bukkit/getScheduler)
~plugin
(fn []
(if-let [result# (do ~@body)]
(put! result-channel# result#)
(close! result-channel#))))
result-channel#))
For events there is just a function that pipes all events of a given type on a channel and you can take them off sequentially
I also made an item stack "dsl" in a couple of lines
Looks like this in practice
(def drop-item
{:type Material/STAINED_GLASS_PANE
:durability 8
:meta {:display-name "Drop a disc"
:lore ["Click to drop a disc here"]}})
that's envy speaking
o
go write "classes" and create "objects"
See, you call it stupid and it starts working 
Probably the api is having problems
Is there a naming convention in Kotlin for Interfaces and their Implementations?
I really hate the IInterface and InterfaceImpl naming convention
Same, i'd just go with what you like
?jdk
I actually like the way bukkit does it, like Player interface, CraftPlayer implementation
when i try to test my first code using intellij i see
There is no such thing as a best jdk
Cannot run program "C:\Users\mynamel.jdks\openjdk-14.0.2\bin\java.exe" (in directory "C:\Users\myname\AppData\Local\JetBrains\IdeaIC2020.2\compile-server"): CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher
i typed code right but whats wrong here i use win 10 32x bit
can someone help me
please
I usually use IInterface for instance if the name would be Enchantment, I don't want an interface name to be the same as the bukkit class and therefore I'd name it as IEnchantment. I use Impl when the implementation is kind of standalone like the interface SingleFactory I don't want to name its implementation to something more specific else than SingleFactoryImpl where as a List has more implementations like LinkedList and ArrayList and in that case I wouldn't use -Impl suffix. @empty flint well I think its most preferences
I actually like the way bukkit does it, like Player interface, CraftPlayer implementation
@ocean quartz Me too but I can't think of a name for my NMSInterface implementations
There is no such thing as a best jdk
@ocean quartz orcale jdk can used in intellij idea ce
?
I have the NMSInterface that defines which methods each namespaced implementation needs and then I have an injector for that interface that gets me whatever implementation I need
I need names for both
@slow jewel Yeah?
aw
i made intellij install jdk auto so do i need to re select a 32x bit jdk to order to solve this problem @ocean quartz and sorry for ping
kk
@empty flint if I specifically can't think of an implementation name I'd just do SimpleInterface
anyone know if Kotlin coroutines has its own version of ScheduledThreadPoolExecutor (SES)?
you can make CoroutineDispatchers from Executors
yeah but how would I schedule tasks with it?
You'd use something like delay()
Direct scheduling is not an idiomatic concept to coroutines
Not in the way you're thinking anyway
ah okay
should I just use SES then instead of coroutines?
since it's only a single thread executor anyway
That's up to you
and it's only used for scheduleWithFixedDelay I think
Why don't Java classes get a companion object from Kotlin?
Can't extend them statically 😦
fun ItemStack(serializedItem: String): ItemStack = NMSInjector.deserializeItem(serializedItem) Ayyy don't need a workaround for that though 🤣
yeah
you can extend a KotlinClass.Companion but not a JavaClass.Companion because they do not exist
Well you've answered your own question then lol
Yeah it was more of a rant than a question
but I got the bright idea to make the static deserialize() method I planned to create into a constructor
The entire language of clojure
just looks
fucking trashy and garbage
i aint even mad if i get crusaded for it
its fuckin dumb
it straightup looks like python
ok
Well that's one way to admit you have no idea what you're talking about
how does it look like python 
i dont know python
but thats what comes to mind when i see clojure
its also just
looks incredibly stupid
You're in good company
People like bashing Lisp even though they couldn't say anything substantial about it
classic
I don't get reflexion in Kotlin
In Kotlin class references aren't the same as in Java
People hating on clojure when they're out here writing stateful OOP spaghetti garbage
how do I call a class constructor via the classpath?
With kotlin-reflect?
dynamic. I only have the classpath of the class
so java.lang.String for example. how do I get the Constructor for that class
You could do Class#kotlin or there might be KClass.forName?
@lunar cypress I think he means the FQCN
Very different meaning
No not classpath
Classpath is the classes that are available at runtime (loosely don't correct me pls)
fuck my life
Yeah that's package
I just brainfarted and didn't smell it before you didn't point it out
my bad
I meant the package + name
as a string
Anyway. KClass.forName?
I will check
Is there a dev build of Deluxemenus?
sorry
@empty flint not sure if it exists or not, if not just use Class#kotlin (or Java reflection which is faster for the record)
np
@empty flint not sure if it exists or not, if not just use Class#kotlin (or Java reflection which is faster for the record)
@prisma wave Oh is it? How so?
from what i can see, clojure just arrow codes
arrow code isn't a problem in clojure
It's more idiomatic to write longer lines than to try and hack your way around it
Since curly brackets aren't a thing
this starts to look like arrow code
and the same thing in kotlin would be at least double the size
Idk enough about Clojure to say
@ johnny
Some sort of list transformation I think
one of its main features 😎
Yes 😎 lets make a shitty language that no one can read other than developer to tackle the need for obfuscation
😎 😎 😎
I can read it
I just don't know what the functions do
It's like asking someone who's barely used kotlin to know what fun O.t(closure: G.() -> Unit) means
well yes but the entire of clojure is like that
the code literally just looks like a mess
not really
it doesn't matter how 'small' the code is
the code just looks like a mess of words thrown together
Clojure is pure functional right?
Is clojure good when doing simple I/O tasks as well?
I mean
In FP IO is classed as a side effect
I'm not an expert but afaik they have a fairly elegant workaround
Yh
Clojure is not pure
Functional programming is encouraged and all the default data structures are immutable but it does not put any restrictions on you
ah my bad
No problem
It's just that haskell and ml are usually what's considered pure because they don't allow for side effects and the likes regurlarly
Clojure is very different from that
And no worries if you don't understand macros. Most of the confusing stuff is evaluation rules which are a major mindfuck
Oh do macros have a special syntax?
No
Yeah it's not typical but it's nothing macro-exclusive
The two basic things you need to know are quote and unquote
quote aka ' means "treat this as data, do not evaluate it"
You can, although you should mostly use vectors instead
Because stopping evaluation means the contents of the list are not evaluated either
And that's where unquote aka ~ comes in
Say you have this: '(foo bar)
foo and bar are two symbols you bound in that scope to some value
And you want the list to contain those values
But since they aren't evaluated you get a list of literally two symbols
'(~foo ~bar) that way you would resolve them
that's both messy and elegant
And this can be nested arbitrarily
Now what you often see instead of ' in macros is ` which is virtually the same but it fully qualifies symbols you use
So clj `(map identity ~list)
becomes clj (clojure.core/map clojure.core/identity whatever-the-value-is)
This is useful because it ensures that the semantics stay the same across namespaces
When you declare a macro in one namespace the symbols used may be bound differently in another
Ohh yeah that makes sense
And honestly there's not much more to it
The only thing left would be ~@ which "unfolds" sequences
Forgot what it's called exactly
Is it like the kotlin spread operator?
So if I had this:
(let [body `((println "one") (println "two"))]
`(do ~@body))```
It would result in ```clj
(do (println "one") (println "two"))```
Yeah kinda but not just for such a specific usage
And well to explain the cond-doto macro: it takes an input value and a sequence of tests and actions
It results in a do form where each action is executed with the input value as its first argument if the test evaluates to true
I use this for the item stack stuff (if a durability is specified, set the durability, if an amount is specified, set the amount, etc etc)
It could have been more specific to the use case but I thought I might as well make it generally applicable
Because this macro doesn't exist in core for some reason
whats the best monthly crate plugin? someone dm me please?
There is -> which inserts the result of each action into the next, cond-> which does the same but with a test for each action, doto which only uses the initial value and is for side effects, but no cond-doto
@limber stream #minecraft is where you wanna ask. this is a channel to talk about dev stuff
But as I said, don't worry about macros too much. They used to give me headaches like nothing else but recently I felt like I finally got the hang of it
Just ask Suskey over at discljord, who wrote a meta-macro for other macros that should ensure that all values are only evaluated once
He said that took him like a day and it ended up being a couple lines of code
Also @onyx loom because you said you do not understand a single thing
it be like that sometimes
inline fun <R> executeAndMeasureTime(block: () -> R, method: () -> Long = { System.currentTimeMillis() }): Pair<R, Long> {
val start = method()
val result = block()
return result to (method() - start)
}
inline fun <R> executeAndPrintTime(block: () -> R,
timeMethod: () -> Long = { System.currentTimeMillis() },
timePrintTransform: (msg: String) -> String = { it },
printMethod: (msg: String) -> Unit = { println(it) }): R {
val start = timeMethod()
val result = block()
val time = timeMethod() - start
printMethod(timePrintTransform("$time"))
return result;
}
What do you guys think of these methods to execute code and track the time it took?
Formatting is a bit screwed up but I think it's legible
measureTimeMillis { }
measureNanoTime { } @empty flint
measureTimeMillis { }
measureNanoTime { }@empty flint
@surreal quarry Can't get the result of a method via those though
wdym by that
if you have a method that returns something
they both return a long
say you want to measure how long it takes to retrieve something from the database
you retrieve it, but then you gotta return it and the time
measureTimeMillis { }
measureNanoTime { }
are similar but not equal to my methods
im not quite sure what you are getting at, but i think this is what you are looking for
val i = measureTimeMillis {
(1..3000).forEach { print("$it ") }
}
println("\nTook $i ms.")```
that prints each number and then `Took 12 ms.`
executeAndPrintTime(fetchDataFromTable(table), timePrintTransform = { Logger.log("Table retrieval took $it milliseconds") })
im not quite sure what you are getting at, but i think this is what you are looking for
val i = measureTimeMillis { (1..3000).forEach { print("$it ") } } println("\nTook $i ms.")``` that prints each number and then `Took 12 ms.`
@surreal quarry I am looking for exactly what I made.
What would you do if you wanted the sum of 1..3000?
and the time it took to calculate it
Sum is 4501500```
```kotlin
fun main() {
var sum = 0
val i = measureTimeMillis {
(1..3000).forEach { sum += it }
}
println("Took $i ms. \nSum is $sum")
}```
No @surreal quarry
but i guess i see your point
val (value, duration) = measureTimedValue {
sqlQuery()
}
what the fuck
@empty flint measureTimedValue
@prisma wave Why do you have to ruin everything? 😄
Alright I guess measure timed value...

There's something very satisfying about suggesting 1 liners after someone has got a really complicated fix
actually I thought it was a rather elegant fix to that particular problem
and my solution wasn't so far off the actual one
Duration.milliseconds or something
@ExperimentalTime blah
pretty sure it is
I am in 1.4 🤔
Oh
im using 1.4 and i had to have it
how do I get this to compile
Or rather how do I annotate those values in the string as experimental?
@ExperimentalTime
val timedVal = measureTimedValue { "This is being timed." }
println("${timedVal.duration.inSeconds}")
This declaration is experimental and its usage must be marked with '@kotlin.time.ExperimentalTime' or '@OptIn(kotlin.time.ExperimentalTime::class)'
Annotatr the whole function?
@prisma wave I'm asking how
annotate the println maube
Is that a scratch file?
yes
annotate the println maube
@surreal quarry
@file:ExperimentalTime maybe
@prisma wave where do I put that annotation? after the imports?
Anywhere at the top I think
try just making it a who;le fun and annotating that
@surreal quarry That works but now I can't call it 🤣
Anywhere at the top I think
@prisma wave no dice
This annotation is not applicable to target 'file' and use site target '@file'
just try to open a new file maybe
yeah I think I'll stick to my methods xD
and make a main method
what's that now?
This declaration is experimental and its usage must be marked with '@kotlin.time.ExperimentalTime' or '@OptIn(kotlin.time.ExperimentalTime::class)'
I'd need the compiler arg Opt in or something
scratch files are weird
And I have managed to get some circular dependency going now...
fuck
It's late
@prisma wave Amen, thanks for this little adventure in the world of experimental features I'm not touching anymore.
Works fine without
@prisma wave Oh yeah ur right
@OptIn(kotlin.time.ExperimentalTime::class)
experiment()
worked
but that's disgusting af so I'm still sticking to my methods
I love the timedVal.duration.inSeconds part though...
At least clean it up to allow destructuring
@prisma wave How do you mean?
the val (a, b) = blah
Actually nvm you probably can already if you're returning a Pair
Pdm
ye but not in this case
How long
Alrighty been waiting 2 months I guess I can wait another
lol true
I guess I can turn my methods into TimeUnits as well instead of Pairs
makes more sense
and I don't need the second one actually
cuz measureTimeMillis() already does everything I do there
zomfg Kotlin has typealiasing
I love this language more and more every day
Thanks for showing me the light, Mitten
And thanks for all the help with my annoying questions
yo so idk any other person was here when I asked but is it a good idea to create my own essentials with only the things I need for my private server?
Sure, why not
I think so @pastel imp. It gives you total control of the plugin and the things it does, which makes it easy to fix bugs for users, track the stats on your players you need, add core features, etc.
Well you control and can therefore understand and monitor any data stores
I found it incredibly interesting to watch how eco was balanced by viewing gains per day and what activities each person did.
Plus as they said you have full control so you never have that issue of going I wish it was done like this instead.
wdym by track the stats on my players
@pastel imp well for example, when i was doing a core plugin, i setup an extensive playtime thing so i could see statistics on what gamemodes were most popular, how many people were playing the server, etc. I also did things like supporting offline things about players like teleporting to them, getting info about what their character was doing when they logged off, etc.
having your own core allows for stuff like that
welp I am not that good of a dev
yea but you will be eventually
you start with the basics of a core plugin
and you can add stuff like that as you go
I suppose you use mysql or sqlite to store that specific data?
yea mysql



🇲
🌚
