#development
1 messages · Page 60 of 1
🙃
there's the actual correct answer
yikes that looks nasty
update gradle
I do not believe so
private repo
make sure ur on latest version of the dependency too
🥶
whats ur shadow plugin version
bich old af
7.0.0
time to hop on 8.0.0 train
well
what do you know
it works
thanks, I will try that after I switched my build scripts to kotlin. I still however feel like there must be an easier solution - I mean, publishing stuff to maven central e.g. is pretty common and they expect a list of all transitive dependencies, I doubt that gradle can't do this on its own :/
gradle handles transitive dependencies
aka the compile scope ones
i think those are the transitive ones?
idk
but
it handles the compile scope ones
and i think the implementation() one too
real
the problem is that I need a working pom.xml though for maven users. I also noticed that gradle doesn't include the repositories I use into the generated pom. That means that e.g. when I use PlaceholderAPI as implementation dependency (which results in a runtime dependency in the generated pom), that maven then complains it can't find PlaceholderAPI when using my project as dependency, because the extendedclip repository isn't declared in the pom
hmm
do you have like a full maven pom example with what you're mentioning? (since I don't have any projects built with maven that publish artifacts)
if not its ok but I'm just curious since I don't really look into the pom
but I feel like that might be a different issue
kinda like the typo issue from before 🥲 🥲
might be some other unrelated issue because I've never had this issue
Quick question. I am trying to add unicodes and hex support to my plugin. I found this methode to replace the unicodes and the hex:
public static String colorize(String message) {
Pattern unicode = Pattern.compile("\\\\u\\+[a-fA-F0-9]{4}");
Matcher match = unicode.matcher(message);
while (match.find()) {
String code = message.substring(match.start(), match.end());
message = message.replace(code, Character.toString((char) Integer.parseInt(code.replace("\\u+",""),16)));
match = unicode.matcher(message);
}
Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
match = pattern.matcher(message);
while (match.find()) {
String color = message.substring(match.start(), match.end());
message = message.replace(color, ChatColor.of(color.replace("&", "")) + "");
match = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&',message);
}
If I try to use this with this string &f\u+4E86&r&#FB2407, I get this output §f了§r§x§F§B§2§4§0§7
So the unicode works but the hex dissapears and the color is gray (from the §7)
Can anyone help me and explain what my problem is?
When using TriumphGui I have a kit selection gui, where the lore of the items, depend on if the player has access to the kit. Should every player have their own gui or can I have one global that gets updated whenever it's opened? What would you guys recommend? Hope it makes sense
Every player have their own gui
Should they be made from some template or just from scratch every time? Like this for instance https://paste.helpch.at/epetofetoz.csharp
wdym?
the way you're doing it should be fine tho
That is fine
and the update() isn't needed since you haven't shown it to a player yet
Ah alright, so basically only update when a gui item has been changed after creation?
Also does gui.disableItemTake(); prevent people taking items out of the gui or how does it work? Like event.setCancelled(true) on left click for example
And would that mean disableAllInteractions() also makes handling the interact event impossible? To change what happens when the player clicks an item in the gui
Sorry for all the questions lol
Has anybody here used the velocity fork of ACF? I can't seem to able to import it into my project
Oh for gods sake I've gone and commented out the repository
ignore me
what would i set as the ip and database? these are the default values for the plugin config btw
ip: 127.0.0.1:3306
username: username
password: password
database: mc```
why does block changing have to be on main thread :(
most configs are if that helps
host: 127.0.0.1
port: 3306
cuz no thread safe
"why", complicated answer, read read the jls and jvms 
Do unsafe operations, ignore the rules, go wild 
be gay do crime
"do like fawe and synchronize on random objects" - @sterile hinge probably
but yeah the game doesn't expect shit to be modified from an async context and it'll totally shit the bed if the wrong thing happens
I generally tend to split block modifications across ticks in the 16x16x16 sections
but also the bukkit API is slow as fuck by itself for world operations
I do not hold back when I need to use worldedit lol
im mentally not there enough to even attempt to comprehend how that's done
so i think
im gonna have a branch for it
rotting away on the project and touch it in approximetly a month, 3 weeks and 2 days
lol
i also really do not like working with worldedit for anything that isnt schematic placing
the issue is of skill
If you disable physics update then it's pretty fast
At least for me

https://github.com/Fisher2911/BlockSetter
You can copy stuff from this if you want, be warned it’s from over 2 years ago though so it’s definitely awful
should be an option to disable physics update D:
or only enable it on the edge of the region since there isn't any reason to have physics updates inside
It’s from over 2 years ago lol
Also I’m pretty sure it doesn’t do physics updates
oh ok
You deleted the .idea folder lol
🥲
such a great contributor
There is a thread on spigot that shows how to use NMS to modify like 5M blocks in a second
Discover custom-block-data in the com.jeff-media namespace. Explore metadata, contributors, the Maven POM file, and more.
Does anyone know how I can add javadoc links to my javadoc task? Online I've seen stuff like this
javadoc {
options {
links 'https://docs.oracle.com/javase/8/docs/api/'
}
}
but I'm using kotlin and there is no "links" option there
it's probably links.add() or links.get().add() or something like that
the issue is that options is a MinimalJavadocOptions and not StandardJavadocDocletOptions - if I cast it, I can add the links just fine
tasks.javadoc {
if (options is StandardJavadocDocletOptions) {
(options as StandardJavadocDocletOptions).links("https://hub.spigotmc.org/javadocs/bukkit/")
}
}
but this doesn't seem to be the correct solution
hmmm so they cast it too
alright, thanks
there should be a buildtool that combines the advantages of gradle and maven lol
gradle is such a pain for some easy things
ant 
🥲
coding challenge: Everyone codes a <something> plugin, but gradle users have to use maven, maven users have to use gradle, and people who like both gradle/maven have to use ant
trivial for a guy like me
then you have to write a python program that generates makefiles for javac
and the python program has to be a quine
Doing it with python sounds harder than just writing the makefile by hand lmao
yeah the idea is to make everyone uncomfortable lol
python is defo uncomfortable
btw does anyone know a fix for the "double" type annotations using jetbrains:annotations?
This doesn't happen using annotations-java5 but I want to be able to also annotate type params
that's a "bug" with type_use annotations
I know, but spigot somehow fixed it
or did choco lie to me and they did switch back to java5 annotations
how can this still not be fixed after like 5 years D:
related issue is open for 6.5 years now 🥲
I don't want to decide between having proper type annotations, and having readable javadocs, this sucks
let a tool create a copy of your source code and strip the annotations, then run javadoc on that
seems like they're using the ones for java 5
I want to have the annotations, just not twice
or create a custom doclet plugin 
very funny lol
then replace it with your own annotations
then it won't properly work in IJ etc
yeah anyway, that's not very important. I got almost everything working now for my basic setup, except "aggregating" javadocs. Let me explain quickly, one sec pls
I have this project ( https://github.com/mfnalex/cesspool ) that consists of (currently 2) subprojects.
My goal is to provide one dependency per subproject, so they can be used individually, but also one "all-in-one" dependency that includes all submodules.
I got this working fine by simply applying shadow on the parent build.gradke.kts.
Now the issue is that the javadocs are only created "per module", but I'd ofc also like to have one "aggregated javadocs" - basically like I got a shadow .jar for the parent project, I'd like to also have a "shadow javadoc". Does anyone know how this is possible?
in maven there's the aggregate-javadoc plugin for that
generally you don't publish fat jars for libraries (or if you do, what you're shading isn't exposed as API)
I don't actually need a fat .jar, I only need a proper pom for the "fat version"
however what I do need is a fat/aggragated javadoc thingy
maybe I'll explain again what my goal is - I want to rewrite my JeffLib library, which is a huge mess. You can find it here https://github.com/mfnalex/JeffLib
It consists of thousands of things which I'd like to refactor into smaller modules, e.g. yaml-commands, papi-replacer, etc etc etc
However I don't want people to have to add 17 dependencies to their pom, that's why I thought I'll just make my parent build.gradle.kts depend on all the submodules, so the resulting pom has them all as <scope>compile</scope> - this should work fine.
The only issue I'm left with is that I'd end up with 17 different javadoc htmls, which would be very annoying for people to look at ain a browser, hence I'd like to get a combined version
but what's the problem with combining all the modules into a "fat library"?
I mean - why not?
the idea is that someone who only wants to use one module only adds that one module, while a plugin that uses like 10 modules can intead just add the "complete version" (and let minimizeJar / shadow's minimize() get rid of the unused things)
the user should be the one to decide how to consume the library(ies) rather than imposing the solution on them, you could just as easily have an "mything-all" artifact with no content that depends on all the other modules instead so they're exposed in the pom, that is for example what Netty does
as for your main problem, maybe this? https://stackoverflow.com/a/47480432 note the source/classpath config in the "alljavadoc" task (then pack into a jar), I never fiddled with javadoc really other than for crossdoc iirc
Hello for Holographics displays, hum did someone know why I have this:
Cannot resolve method 'createHologram(NeptaliaCore, Location)'
public CombatListener(NeptaliaCore plugin) {
this.plugin = plugin;
}
HolographicDisplaysAPI api = HolographicDisplaysAPI.get(plugin);
Hologram hologram = api.createHologram(plugin, kills);
in my main class I put this
public void onEnable() {
useHolographicDisplays = Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays");
private void initializeListeners() {
getServer().getPluginManager().registerEvents(new PlayerManager(), this);
getServer().getPluginManager().registerEvents(new CombatListener(this), this);
yep, that is currently my idea, a "main artifact" that only provides a pom with all modules as "api" / <scope>compile. Thx, I'll check out the javadocs thingy
I assume instead of task alljavadoc(type: Javadoc) { I'd so sth like tasks.create<Javadoc>("alljavadoc") { right?
I think so yeah
er, register instead of create, idk if create adds it to the task list or rather simply creates it
hmmmm
I also still cannot figure out how I can add something with <scope>provided to the generated pom D:
If I add jetbrains annotations with compileOnly, it doesn't show up in the pom at all, which leads to users of my dependency not being to resolve them
if I add it as compileOnlyApi, it ends up as <scope>compile which means end-users would end up shading jetbrains annotations
closest I can get is using implementation, then it ends up as <scope>runtime
Someone Have an Idea?
NeptaliaCore is what extends JavaPlugin, right?
yup
public final class NeptaliaCore extends JavaPlugin {
https://github.com/filoghost/HolographicDisplays/blob/master/api/src/main/java/me/filoghost/holographicdisplays/api/HolographicDisplaysAPI.java you have to pass a plugin instance only once, on get()
Yup It's works fine know thanks
Weird
Their docs claim you also need to pass the plugin into createHologram
It is probably outdated
It is
ok everyone, just for the record. I again tried to aggregate my javadocs when github copilot randomly came up with a working solution lmao
thank u
since I'm new to gradle: is it true that build files easily break on every new gradle version? or do only build files break that already used deprecated features for years?
no
maybe from each major version (ex v7 to v8) but for me, v7 to v8 hasn't really broken anything either
I'd just stick to latest
ok, that's good to know lol. thanks
yeah I'm currently on 8.3 so I guess I should be fine for at least a year or so
well when something deprecates, there's prob gonna be an alternative
ex compile got removed a while ago in favor of implementation
let's imagine I have a buildSrc script, e.g. java-conventions, and another buildSrc script that uses java-conventions as plugin, let's call it "spigot-module".
Now if a subproject declares both "java-conventions" and "spigot-module" as plugins, will the java-conventions script be called twice, or only once?
uhh
probably once since u said "as plugin", and gradle won't load plugins twice
I haven't used buildSrc stuff before tho so idk
Hi, how are you? Where can i see detailed documentations about the placeholder expansion objects? Where mainly can read about configurable, chacheable, etc. All those objects related to help while coding custom expansions
most, if not all, expansions found in the ecloud have a "source code link", although granted some of them are pretty badly coded, if that's what you mean?
is that you, VERANO?!
So i am trying to calculate the tps of the server like this, the problem is that it logs weird and not in a 20.00 displayed way, here is where i got the original code: https://bukkit.org/threads/get-server-tps.143410/
This is my code now:
private String getTPS() {
int ticks = 100;
if (TICK_COUNT < ticks) {
return "20.00";
}
int target = (TICK_COUNT - 1 - ticks) % TICKS.length;
long elapsed = System.currentTimeMillis() - TICKS[target];
double tps = (ticks * 1000.0) / (elapsed * 0.001);
return String.format("%.2f", tps);
}
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
Runnable tpsCalculator = new Runnable() {
@Override
public void run() {
TICKS[(TICK_COUNT% TICKS.length)] = System.currentTimeMillis();
TICK_COUNT+= 1;
}
};
executor.scheduleAtFixedRate(tpsCalculator, 0, 1L, TimeUnit.MILLISECONDS);
int TICK_COUNT = 0;
long[] TICKS = new long[600];
what does it log?
lol
lmao
990099.01
990099.01
990099.01
990099.01
990099.01
990099.01
1000000.00
990099.01``` here are some logs
what if you change ticks to 20
¯_(ツ)_/¯
you mean this part right? int ticks = 20;
1000000.00
952380.95
952380.95
1000000.00
1000000.00
1000000.00``` so i changed that and now its this
lol ok nvm
but theres no reference to like "20" in there
wait
why are you using a java executorservice
that's gonna run every millisecond
or 1000 times per second
try just doing a ctrl c ctrl v from the bukkit post
and modifying/testing from there
you mean using a bukkit runnable?
no, you're not using a bukkit runnable
try doing this
So now i changed it to this:
Bukkit.getScheduler().scheduleSyncRepeatingTask(Taakstraf.getInstance(), new Runnable() {
@Override
public void run() {
TICKS[(TICK_COUNT% TICKS.length)] = System.currentTimeMillis();
TICK_COUNT+= 1;
}
}, 100, 1L);
private double getTPS(int ticks) {
if (TICK_COUNT< ticks) {
return 20.0D;
}
int target = (TICK_COUNT- 1 - ticks) % TICKS.length;
long elapsed = System.currentTimeMillis() - TICKS[target];
return ticks / (elapsed / 1000.0D);
}
oh seems to be working when i exactly copied it:
Will this change the item inside the gui? Or do I need to call gui.update() before it updates? It just says for all inventory views, but I just need it to be updated next time inventory is opened. Using TriumphGui
for (GuiItem iconGuiItem : selectionGui.getGuiItems().values()) {
ItemStack icon = iconGuiItem.getItemStack();
// Code that changes the icon (lore etc.)
iconGuiItem.setItemStack(icon);
}
literally stolen from nicole🙄
who
deez
Anyone know how to change the args in /help for acf?
i have something really really weird. String#startsWith is not working properly on the server, but it is working just fine on my computer. As you can see this returns false for the id "b:3:1"
but when testing it locally on just a basic project on my computer, intellij says it returns true and indeed it does!
whats id?
here IJ doesn't give the "Result of ... is always true" thing
so you can't say that it's the same
argument 3, for some odd reason my minecraft client and console is showing "3:5" when executing the command
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
(its auto tab complete)
can u show the code
what cmd lib is this?
do you do some interesting color stuff in ur command library 🥲
no
whats the box?
i have no god damn idea
i've been using my library for years
it literally just grabs the args from plain bukkit and puts it in the object, dont touch anything
can u try getting it from console, or if that doesn't work, print out the number value or base64?
I thought it'd just be the color code symbol thing
well its grabbing all the business' names, from tab complete
so i'll check the business database and see
huh, its the same in the database
3:1
okay, there is a plugin on the server that is modifying the arguments on the command. just not quite sure what
ig u can just filter it to like the regular ascii
like if its not between 33 and 126 ignore
(google ascii chart for reference)
yeah if i do like /broadcast b:3:1
it prints out weird shit
its def a plugin
oh
its itemsadder....???
font images on itemsadder
is this the one
aye it works
xd
can u tell me why it doesnt work with ,,extends JavaPlugin'' but when i delete it everything is ok
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
does kotlin have any equivalent of java's records?
i believe u can use data class and annotate with @JvmRecord to make it fully equivalent
hmmm ok well so I wanna use kotlin for a tiny fun project to get used to it. I thought about a chess engine. I'm thinking of e.g. a class to describe a "location" on the field, it'll basically only have an x and z coordinate
in java I'd use a record for that
public record Position(int x, int z) { }
from what I figured, this would roughly be quivalent to using the following in kotlin:
yeah it would pretty much be the same in kotlin
@DataClass
data calss Positio(val x: Int, val z: Int)
right?
well except for the typo ofc lol
not that annotation
u wont even need an annotation tbh
my bad, I meant to use JvmRecord
not @DataClass but @JvmRecord
shit
sorry for ping bro
You don't need the annotation either
data class Positio(val x: Int, val z: Int)
would also be perfectly acceptable
There is no point in making it a jvm record for that
yeah
what is the purpose of that annotation?
I have googled and it told me "Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods"
that's exactly what I want?
it would just make it exactly the same as a java record
But a data class on its own will automatically generate the toString/equals methods for u already
just slight differences when using the annotations thats all, but no need to overcomplicate it
it would just make it exactly the same as a java record
yes that's what I want to do
I want my class to have 2 fields, int x and z coordinates, should be final ofc, and provide getters()
and yes, it should automatically create equals and hashcode
a data class will already do that for u
same x,z = same "Position" object
hm then I don't really understand what the annotation is for, if the "data class" keyword already does all that
I have to add: I know absolutely nothing about kotlin, I have (so far) only used it for gradle build files
ah
I thought coding a simple chess engine would be a nice way to learn kotlin, because I'd 100% know how I'd do it in java
usually the @JvmSomething annotations are for extra java compat, e.g. it'll make it extend java.lang.Record and such
You'd only use jvm record if you need Java interop
yeah that's what I figured too, howeeeever
why is a data class not a record by default?
or for companion objects you can annotate functions and properties with @JvmStatic and they will be ACC_STATIC rather than an instance field/method in the companion object's class which is a singleton
well data classes in kt have existed for many more years than java records
cuz they can have mutable fields
and they also compile down to like jvm 6 or whatever
what'd happen if I would write a data class that has a mutable field, and then annotate with JvmStatic?
Data classes were introduced before Records were, they have slightly different functionality as well
you mean @JvmRecord?
Oh yeah sorry
the compiler would error
I just came back from a birthday and I'm a little bit drunk, my bad. I meant JvmRecord when I said JvmStatic
you don't need an excuse for being drunk, you're german
So imagine I wanna have a class that represents the position on the chess field. In java I'd have 2 options:
- A normal class with final int x, final int z fields
- A record, ofc also with int x and int z fields
Which wuold be the best kotlin equivalent for this?
well
technically in java, a record doesn't ahve fields but record components
oh and that class would have a method like getColor() for each field, which would return like an enum WHITE or BLACK for each field
A data class
aight, let's try
emily please never say "technically", otherwise my inner lawyer wants to scream and is then upset about things that are not related to the problem lol
Good answer https://stackoverflow.com/a/66807237
data class Position(val horizontal: Int, val vertical: Int) { }
class TestPosition {
fun testEquals() {
val first_1_2 = Position(1, 2)
val second_1_2 = Position(1, 2)
val first_2_1 = Position(2, 1)
assert(first_1_2 == second_1_2)
assert(first_1_2 != first_2_1)
}
}```
this runs fine, so I guess that's what I was looking for
Both are great for reducing the code bloat.
bleh, that is not something exclusive of data classes in kotlin, but that is also not the reason why records exist in java either to begin with
I mean that's why it says both, both of them are good for that
what's your people opinions's a bout lombok? I don't wanna start a war but I'd love to have a normal discussion about pros/cons of using lombok
Haven't used it so very biased but I believe it's pointless if you use kotlin
imho, lombok's Data, Getter and Setter are both great and cursed:
- big plus: It allows me use pseudo-records in java versions that don't support them yet
- It's shit. I cannot even write javadocs for the generated methods, and I got no control about how exactly equals(), hashCode() and toString() are implemeneted
Theres Alt insert
In intellij
Apparently it also makes intellij show a red banner when viewing the source since it won't match byte code but idk if that was fixed yet
to auto generate those methods? Sure, that exists, But what if I now add a third field (e.g. in my chess example, isWhiteField or isBlackField or FieldType (enum) which is either WHITE or BLACK
In Lombok?
in lombok, that wouldn't be an issue
without lombok, I'd have to tell IJ again to create an equals/hashcode/toString method
Why would u have is Whitefield tho
yeah that was just a bad example. every "Position" would have a "getColor()" method thatÄd return "Black" or "White"
Ye but it's only a couple seconds and is customizable
Also
yes but I might forget to run it again, you know
Why is Lombok bad?
- It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
- It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
- Lombok'd code won't show in Javadocs
- The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
- Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
- While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
- Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
Note this
Haven't used lombok myself so I can't comment much
Or just use java 17.
Records smh
Oh
Well technically like 14 i think
Also @light pendant when u finish the project, feel free to ping me so I can take a look at ur code :))
But thats not an lts
Yea
And idk if some have been fixed by now
Since it's been a long time
It's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse
hm not sure about that. it's a normal plugin to the compiler. It was made for allowing plugins to be used .That's a bit like saying "LuckPerms is a hack. Bukkit API wasn't designed to modify code, ...."
It requires an IDE plugin, so unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
that is 100% false. Lombok does work fine without having to use ANY ide. Both maven and gradle have their respective integrations for lombok, the IDE doesn't care about it (well except to be abe to show the generated methods or sth)
Lombok'd code won't show in Javadocs
Yeah, that's indeed a problem. That does suck.
The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
idk, it's not less predicitable than what IJ's "generate hashcode" thingy would do.
While IDEs support it with a plugin, it's usually more difficult to find specific things, like usages of a getter because they don't exist in the source code
See nr. 2 above ^
Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
That is true, but the bytecode will also not match the source code if e.g. you're using paperweight or any other thingy that changes the bytecode
Ohhhh my
Btw for the predictability thing, it means that u can't see what lombok is really doing
I think
But IJ u can
I don't really understand what you mean with that
And paperweight also produces a dev jar
But yeah
I stated the disclaimer for this purpose :))
Like with IJ, u can see exactly what it's doing and how it works
Also idk if u saw this while typing but
I'd be happy to review :))))))
are fields in a data class generated by kotlin automatically immutable? and does it automatically add getters/setters for those fields?
Val = cannot be changed, var = can
All kotlin properties have generated getters and/or setters
It doesn't automatically add getters and setters but u can make it into a property
I just hope you are talking about using lombok in Java and not Kotlin lol
It doesn't need them by default since the code is the same
But in kotlin u just access then howcu do a normal field like in jqva
Whereas with Java u have to call a desperate message
Seperate
I'm trying to type fast before sparky answers it all 😭 (on mobile)
the chess engine? Sure, no problem. It will probably not be very good though, my goal is simply to get something working in kotlin that I could easily do in java. This project is neither meant to say "kotlin is shit" nor to say "writing a chess engine is so much easier in java", it's just there for me to learn more about kotlin while also doing sth useful
Ye
Kt has a lot of nice features that aren't really shown at first
So I wanna let u know abt them
There's still a LOT that I myself don't know
Both about Java and kotlin
OK my thumb needs a break for a min
I probably have to add the following displaimer:
mfnalex sometimes is a bit upset about things that are unknown to him. He's looking at things he already knows, and if suddently he switches to a new language (/ or whatver), then sometimes things don't work as mfnalex expected them to be. That is not the fault of the targeted language, but the fault of mfnalex thinking that e.g."kotlin is like java + additions" while obv it's not as easy as that
and that's the reason why I ask like 10 annyoing questions here every day - not t hate on gradle or kotlin, but to be able to understand how to do it correctly in "their language"
Just switch to Skript
pleaes always keep in mind that I didn't study CS or anything close to that, I'm a self-taught developer, my actual job is being a lawyer so please go slow on me when I got questions haha
I'm in HS 🥲
Most of us are prob self taught as well
just for
hm not sure about that. it's a normal plugin to the compiler. It was made for allowing plugins to be used .That's a bit like saying "LuckPerms is a hack. Bukkit API wasn't designed to modify code, ...."
no its not. the annotation processing api doesnt allow source code to be modified. they do some naughty stuff to use javac compiler plugin apis which are specific to some jdks
Oh I missed that part but plugins are an api in Java (class loader things?)
Not specifically plugins
But loading new classes
yeah you're right on that ofc. But since javac allows to use plugins, then what's the problem in actually using them sometime?
Isn't it a gradle/maven plugin?
Not javac
Unless Javac does
I never used Javac by itself 💀
lombok has a special plugin that hooks into javac's API, if I'm not mistaken
Interesting
I am not 100% sure though, maybe I'm talking bullshit
honestly i dont think its too big of an issue, but theres no guarantee that it wont be deprecated or removed in the future
sure, but argueing like "well it's 100% supported right now, who knows what happens tuesday" is a very weird argument imho
i dont think its too big of an issue
but it is actually becoming more likely
java is making it harder to access internal apis
yeah and I also don't even "fanboy" on lombok. I just think its useful (sometimes), but some people hate against it for no obvious reason at all.
Lombok does have many issues, I never deny that
the only "real" issues on the list imo are
- Lombok'd code won't show in Javadocs
- The code generation is often unpredictable and difficult to debug, and often you'll have to do it "the hard way" anyway
- Java is supposed to be explicit, Lombok hides a lot of key functionality into a subtle annotation which can be easy to miss
It requires an IDE plugin, so unless you've properly configured [your IDE]
- configuration ur ide isnt an issue, nor is it hard. the lombok plugin is installed by default in ij and i cant imagine its too hard in eclipse
unless you've properly configured Maven, Gradle and your IDE, you'll get hundreds of compilation errors. This process takes time too, it's not easy
- configuration lombok with gradle or maven is very simple
Finally, Lombok'd bytecode doesn't match the source code, so it causes a pretty annoying warning in IntelliJ
- red bar in ij when viewing external code? oh no!
- Yes, the javadoc thing is a big issue, I agree
- THe generated is imho not unpredictable at all, imho the opposite is true
- That's an argumentum ad absurdum - neither does lombok "hide" any key functionaly, but it's more like the other way around - if I have 3 fiels and I annotate the class with @ToString, then I exactly know what it's going to generate outta that
ides arent an issue, the lombok plugin is installed by default in ij and no one uses eclipse but i cant imagine its too hard
well yeah but that's an issue caused by the IDE and not lombok itself. The same argument could be used for ANY code generating annotation thingy
thats not an issue
im saying its fine
gradle and maven configurations are very simple
Oh well that's a highly debatable topic. Imho maven build files are 100 % straightforward, while gradle fies are not and never were supposed to be - the big difference between mavne and gradle is
- maven claims to be "explicit"
- gradle claims to be the opposite (both have absolutely valid use cases, ofc)
red bar in ij when viewing external code? oh no!
?
oh you're talking about gradle not being able to use <scope>provided I guess
yeah that indeed makes me very angry sometimes
Lombok is widely used, I personally don't like it, but it's fine if you do
I have seen some issues with it, compile/runtime issues due to it's funky generated code
And I have seen issue with stacktraces showing widely different lines, that's about it
I wanna add: I don't "like" lombok. It does very weird things sometimes. Howver, some parts of lombok are totally fine, e.g @Getter on a field generates a getter - that's handy and has no issues (except the missing javadocs)
And I have seen issue with stacktraces showing widely different lines, that's about it
Yep that's also a huge issue but IIRC that was fixed like 5 major versiosn before the current version? Maybe I'm confusing it with something else though, so yeah maybe I#m wrong on that
just for the record, I'm not a lombok fanboy, and many things they do are very weird, but some things are also just straightforward and working fine - e.g. (All/No/Required)ArgsConsturcor, EqualsAndHashCode, ToString, etc
if kotlin would have records, yeah I would do that lol
Why? Just use a data class lol
but r u using lombok in kotlin??
no, I'm not
I hope your answer is no
so why does it matter if kotlin does or doesnt have records
it does not matter. I was never trying to start a discussion about lombok vs kotlin. I only asked "how can I mimic a java lombok'd Data class in kotlin"
eh this is not exactly relevant to the topic, I don't know all the things lombok does (it might be replacing internal fields in the compiler and such) but that is exposed as supported API, jdk.compiler module, and plugins are loaded via service discovery in the classpath, but it isn't part of Java SE, compiler plugins are much more powerful than annotation processors, see manifold project for example
manifold should really fix their docs
I opened an issue about an, I guess, not very-uncommon problem and they basically ignored it completely
anyway maybe I gotta clarify again - neither was my previous messages' intent to be to hate on kotlin nor was I going to glorify lombok. I know very little about kotlin and hence all the questions I asked were not to be understood as "lol but in lombok I can just do it like this", but rather an honest question about "in lombok I do it like this, what's the kotlin equivalent for that?"
I'm here to learn stuff, not to fanboy about anything or sth lol. Mb if it came over differently
smh i said that
am I stupid or why does none of this work lol
I thought that val is the default?
theres no default
data class Position(private val x: Int, private val z: Int, private val figure: ChessFigure)
was bouta say that
thats just special syntax for declaring a constructor and properties together
ok I made the x and z "val" (which should mean final, right?) but it still complains
Kotlin's constructors aren't the same as Java
constructors are declared with constructor but use what matt sent
huh? why is the constructor's name prefixed with "class"?
that's the entire source file
yeah you have inline constructors
The primary constructor is declared in the class declaration
similar to Java Records
If you go into it with the mentality of "why isn't this like Java" then you won't like it, it's a different language
ths does not make sense whatsoever
um actually theyre called primary constructors 🤓
Remove the properties lol
yeah you don't do both lol
and turn the parameters into properties
but now my class does not have any fields?
you need val in the parameters to make them into properties
This
as Matt showed above
so a parameter for a construcotr randomly becomes a field in the whole class by adding a keyword to the constructor's parameter?
what if my class has more than one constructor?
yes, that is true
yeah it's just a sum of all the constructors lol
that just so happens to be the primary ctor and you can put fields so it auto-assigns them n shit
erm, "properties" 🤓 not fields
i am sorry MATT
i know i'm not the daughter you ever wanted me to be
ok maybe this will help me understading kotlin: How would the following java class look like in kotlin?
public class Position {
private final int x, z;
@Nullable private Figure figure;
public Position(int x, int z) {
this.x = x;
this.z = z;
}
public Position(int x, int z, Figure figure) {
this.x = x;
this.z = z;
this.figure = figure;
}
}
intellij has a "convert to kotlin" action 
class Position(x: Int, z: Int)
Equivalent to
public class Postion {
public Position(final int x, final int z) {
}
}
class Position(private val x: Int, private val z: Int)
Equivalent to
public class Postion {
private final int x;
private final int z;
public Position(final int x, final int z) {
this.x = x;
this.z = z;
}
}
class Position(private val x: Int, private val z: Int, private val figure: Figure?) {
constructor(x: Int, z: Int) : this(x, z, null)
}
^
yea good point
oh true true
wtf
so the "all args constructor" is worth more than the one that only requires int x, int z?
class Position(private val x: Int, private val z: Int, private val figure: Figure? = null) {}
or why is that one in the "top level" thing, while the othe rone isnt?
google primary constructors
The {} at the end 😠
class Position(private val x: Int, private val z: Int, private val figure: Figure? = null)
No
classic, love kotlin
my whole chess engine would have been finished by now if I didn't click "kotlin" in the project wizard I guess
i'm sure they think the same about you too matt
"i have to learn a new language, why is this so difficult and weird"
like come on man
Very true 😔
yeah but in java youll always need a body
cuz we have something called no null safety
Which is ugly :)
for now !!!!!
valhalla looking good
yea i saw valhalla
anyway, thank you all you all for your pacient attempts to help me, but for me, kotlin is still just java with extra-added useless caveats that makes things more complicated iwthout adding any benefits.
Maybe I'll change my mind about this someday, but definitely not today
oh man I love kotlin data classes, I wish Java had a library that could deserialize config files like Kotlin does
yeah uh, jackson, gson,
can you just do nested records?
yes
i thought gson couldn't do records since it needed a no-args constructor
but for me, kotlin is still just java with extra-added
That's where you're wrong, and going about it wrong, it's a completely different language
aren't records final?
it has support for records
they have support specifically for recrods
maybe i should try it out
You don't even have to use JVM, you can do JS, WASM, Objective C, etc
cuz parameters in record constructors have names by default
objective c 
ye
rm -rf src/kotlin && mkdir src/java
good bye pain, hello home
yikes
idk maybe you hate yourself
It's so good to use kotlinx serialization and stuff just working like magic
Ofc there are times the lib is a pain in the ass but most of the time, so good
oh yeah defo
this is such a bad attitude
i hope you're joking
My guy tries to write a single class in a new language and decides it sucks 
I hope so too. But i am serious. I have tried to get into kotlin like, many times before. Sure, I can do easy things like, declare a useless method that I'd never actually reaylly use. However once I actually need to get stuff done, all those kotlin syntax is in my way
you need to think about it like learning a new language, since it is
the mindset of "it's java but a little spicier" is doing nothing but hurting your ability to learn and experience new things
i sincerely hope you never try to learn another language and approach it like that
yes, that's probably my issue. I don't want to use a totally new language
Then why are you trying to? lol
yeah then just stick with Java
well you're out of luck cuz it is
if you're not prepared to learn something new, you definitely shouldn't try doing that
because if you don't at least try to do things, you're stuck forever at where you already are
Looks like you just went back to step in the glue of where you already are
You didn't go for it wanting to do something new, you went for it wanting to do "something old + extras"
And immediately reverted at the most minimal sign of change
I'm constantly trying to learn new things, hence I force myself to use gradle for all new projects, even though gradle is a fucking pain compared to maven for most things. But kotlin, that's next level
Gradle offers many new possibilities compared to maven, so it's worth learning it imho.
Kotlin however is just "different" but doesn't really add any useful new things.
It adds a lot of useful things, you're just never going to experience them because you couldn't get past the first 5 minutes without gawking, acting completely horrified, and going back to Java
Got any sauce for that? I wanna take a look at the null safety 
if you can name just one thing that I'm missing out in java, I'd be totally hyped again to give kotlin another try, no matter how long it'd take for me to learn it
iirc one of the parts of Valhalla was basically Kotlin nullable types in Java natively
well non null types
Coroutines is a big one, terseness, null safety, first-class functional everything, extension functions, etc.
Kotlin however is just "different" but doesn't really add any useful new things.
Extension functions
Coroutines
Destructuring
A giant library of useful utils
Boilerplate reduction
Null safety
.. etc .. etc
So unfortuante that it adds nothing useful
It's a different language with many different benefits!
that is imho a huge disadvantage
💀
I like Kotlin xD, mostly because of the libs that make using it so much easier like Kord, KSpigot (SilkMC), Ktor and serialization
performance + safety
how is that a disadvantage
bro loves NullPointerExceptions
Something something is obviously not per se a something. It's just an address to something that might either be there, or not.
which uh isnt great
bro just invented the java.lang.Optional but implicitly in everything
No, but adding a ton of ??? isn't going to fix things being null. There's like so many valid reasons for things to be null
I am so happy I use Kotlin at work, using a language that I love to work with and getting paid
"When was the date you filed your latest tax returns"?
the point is that you know with certainty if something is null or not
Never?
ok the date is null
yeah then make your date nullable
what's the issue with that?
but then you are forced to check for that/deal with it in some way
there is no issue with that
I think you have a fundamental misunderstanding of Kotlin's null safety
Also very nice for APIs since you defo know they are non nullable without it having to be in the docs
theyre not even adding a bunch of ???? cuz that would break a ton of existing code
you're also forced to do that in kotlin by using ? or ! operators
That's the whole point
It makes your program immune to NPEs (pretty much)
which is a whole class of errors just gone, out the window
with minimal effort and lots of niceties and syntax sugar to make it easy to deal with
except if you overuse ! and ?
the point of null safety embedded in the type system is to leverage the task of dealing with null checking to the language level rather than you going "oh, but i need to remember it can be null" and you might forget one or another time
yeah but you shouldn't really be using ! basically at all
sure you can be a really good programmer and "i never forget to null-check", but erring is human and you are bound to
um actually its !! 🤓
leveraging that to the language and you forget about it is a good thing
wait a fucking second
TexReturn lastTaxReturns;
if(taxee != null) {
// taxee is null, they cannot have tax returns
lastTaxReturns = taxee.getTaxReturns(0); // their last tax returns
If however I'd now do whatever: TaxReturn = taxee?lastTaxReturns?get(0) then I wouldn't even know which of those were null?
why would you do that then
if you cared which one was null, just do it the old fashioned way
or use an elvis operator
the whole point is that it's in the type system
don't you care whether taxee is nul, or taxee.getTaxReturns(0) or TaxReturns.get(0)?
whatever: TaxReturn = taxee?lastTaxReturns?get(0)
This would be a IDE and compile error becasue you're trying to assign a nullable value to a non null type
also, you are quite literally the person who made a PAPI PR to add @NotNull annotations to some API methods
guess what Kotlin's type system does
EXACTLY THAT
obviously I don't know the correct syntax, but you get the idea....

so you obviously understand the benefits of having this kind of null safety, enough that you use a tacked-on method to handle that in Java
so why are you so against having it as part of the language natively?
this aholw a?b?c thing completely ignores the fail-fast principle
you don't have to do that
a?b?c isnt correct syntax still and that ^^
where would something fail exactly?
you can keep blaming my syntax as often as you want, I am still pretty sure that you all know what I'm trying to say
because kotlin adds null-throws in a function if a parameter is not-nullable
val lastTextReturns: TexReturn = taxee?.getTaxReturns(0) ?: return
// ^ will never NPE
It's not hard to understand it
I don't understand your fixation on the ?. operator
There's nothing forcing you to use it
ofc that part wouldnt NPE, it's just a declaration?
Worst case scenario, you can do exactly as you do in Java, it will just not compile if you forget to deal with a null somewhere
jfc
"will never" implies in the future, when you use that variable it'll never NPE, it's not null, will never be null, was never null
It's "safe" you can say
I never said that, no
TaxReturn lastTaxReturns = taxee.getTaxReturns(0); would be an NPE in Java
if taxee is null
if I would just do lastTexReturns = .....?...?...?
then I wouldn't even know WHICH of those fields/methds was null
well if getTaxReturns does not return a nullable type then you do
^
and given the example, it wouldn't
or you do kt taxee?.let { lastTaxReturn = it.getLastTaxReturn(0) ?: return // lastTaxReturn is non nullable }
what if it was actually null though, because whatever you called it on is from a normal java lib?
the language inserts null-check-throw
but if it's from a regular lib it would just return nullable
unless annotated with NotNull
Bad >:(
Let shouldn't be used to apply to something else
It's a transformative function
huh no, it wouldn't? It would just see "first element? is null, so everything else is null too"
doesnt it return Type! which is neither non null or nullable
You then use .apply?
I should not go to sleep, I should rather stop talking about kotlin things I don't 100% understand
idk i never understood the difference
I am totally aware about my lack of knowledge about kotlin
Hyperskill is free for a few problems a day ^^
Pretty sure it's free forever for kt
Kotlin Basics
Apply modifies the it, let gives the it and anticipates a new value
The correct syntax there would be
lastTaxReturn = taxee?.let {
it.getLastTaxReturn(0)
} ?: return
it isn't specific to kotlin, it's about leveraging null-safety into the type system itself
in that situation would u use .run?
Also mfnalex idk if u changed ur mind (from the beginning of when I left) but plz make at least some kind of project in kt so I can help u see what u can change :))
imagine if we had a language where null literally did not exist
Has anyone thought of that before
Rust
No
lmao
sucks
👍
Not that
genius
yes, that'd be great. thanks
Which the smart IDE would tell you to just lastTaxReturn = taxee?.getLastTaxReturn(0) ?: return lol
It must have no nulls AND higher kinded polymorphism
rust only has one of the two sadly
Ergo fail
tomorrow thogh
what next, it has to tuck me in and read me a lullaby?!?!
Yay
Also I was referring to the message where u said u were gonna quit kt or smth 😭
but then you again dont know which is null
if you ask nicely, maybe
Alr
awww, maybe I will get back into F# lmao
Or anytime
also would be the appropriate if you want to assign to something else incase it's not null
Once again my ludicrous propaganda proves successful
I prefer kotlin over rust tbh but I gotta learn a native lang
I've snacked too much diazepam and other benzos to be able to give proper arguments today. I am pretty sure that kotlin is a fine language and they got their reason for many things that are however pretty weird to jave users
they aren't very comparable lmao
they are comparable in that both SUCK 😂😂
You just need to open your mind my friend
Type-level null safety is not a Kotlin-only thing
Well, if you have a brain cell or two, you know that if the return of the function is not nullable then taxee was the null
But like, in what universe you need to figure which one is null lol
Maybe but I'm prob also biased since I know more kt
I can do Cocs fine with rust now tho
With Google sometimes
And a lot of compile errors with its borrow checker thingy
One day you will be able to do Coc with Coq
CoC with Ada when?!?!?!?
Well
Rust is fine, its easy to loose yourself in the process if you dont know it perfectly sadly
Oh also code wars is an awesome clash of code but single player kind of thing
Im really working on that. I used to hate gradle (and I still think it's a very annoying buildtool compared to maven) but I've been using it for like 2 weeks now and I learn new things every day. On the other hand, gradle is sometimes a huge fucking jerk because it rquires so much configuration for things where you'd only add one line to your pom in maven and it'd just work
Same is probably true for kotlin vs java
Lmao i think the same every time i use Maven
I'd recommend it if you're learning a new lang and don't know what to make or want to learn the basics first
Yeah that's just more of a "i have more experience with X tool, why is Y so difficult and weird?" moment
exactly
I'm on 24% gotta save battery tho so cya
Don't give up on kotlin 👍
yeah I guess that's the usual stereotype people have abot things they don't fully understand yet (ofc that's my problem, not a kotlin/gradle problem)
That's a very interesting take, because most of the times it's the opposite lol
I mean even adding a dependency in maven it's at least 5 lines, while in gradle it's just 1
don't open that can of worms lmao
weak
1% or nothing
Laptop is at 32% I can go for a while longer
we all know XML as a configuration language was a mistake lmao
Spring is still learning that the hard way 😔
ive a piano player some sheets and he'll play the notes. give the same sheets to a guitar player and he'll be like "lol wtf I only have 6 strings, how am I supposed to play 8 tones at the same time".
piano players be like "only 8 notes? Sure, no problem".
But then tell them to play the 7/th overtone of the A2 key and they'll be like "duude, impossible"
different tools = different approaches to do stuff
I don't give up on kotlin per se, but I give up on kotlin for today
Which part of spring are you using that has xml?
The project we have doesn't, the application file is a yaml one 
oh just all the legacy Spring stuff uses XML configuration
Good, next time don't try to use it like "java + extra" go for it like it's meant to, a new language (because it is)
obviously you can use like annotations and everything, just like half the docs and examples I find are like "now open your application.xml and add this database resolver or whatever with <DatabaseResolver>blah</DatabaseResolver"
anyway, thank you all for your time in trying to explain kotlin to me, but I still think will learn NOTHING in this way. I should rather just buy a prope book about kotlin
Huh yeah we have application.yml instead
what is wrong with you
even then, not a big fan of configuration formats used for that kind of stuff
configuration-as-code is so nice
if anybody knows a good book about kotlin, please let me know - preferrably a book that eplains the differenes between java and kotlin, instead of a generic "lets learn kotlin today" book
eh, problem with books is that they get outdated fast
just skim through the docs
Atomic Kotlin
oh you have that one, don't ya
But yeah the docs are very good
i rember
I do :D
I fond these books, the third one is from jan 2022
can't be "that much outdated" I guess?
sure but languages evolve
and i hear kotlin has some nice changes coming along with k2 👀
or at least planned
Heavily cropped for reasons, but :D
mmm k2
can't wait for java 21 too, would be so cool to use some of the new stuff in kotlin JVM
hot
did you guys see they are working on Wayland support for IJ-based IDEs
Kotlin code doesn't get outdated fast, it just gets many new features fast
so idk
I wanto to add one thing: I have really hated gradle to the core, only like 4 weeks ago. Meanwhile all my new projects are using gradle, even though I still have severe issues with gradle for doing simplet things sometimes. However I'm trying to learn why/how these issues can be fixed.
So yeah, I tend to claim "XYZ is shit" because I haven'T fully understood it yet. Sorry about that. Sometimes I'm just angry. In any case though, I would really like to learn "proper kotlin" and I think buying a book would be a good step into the rigth direction.
So if anyone knows a proper book about kotlin, please let me know, thanks ❤️
Again, I can recommend the Hyperskill course
which means they'll actually like work well on WSL and Linux distros that use Wayland!
naisu
also, fuck youtube tutorials lol
Bro ignored my suggestion 😔
my kotlin journy will start with a proper book, or it won't start at all
if you're referencing to me, then sorry, I must have overseen what ou suggested
Atomic Kotlin
(or Hyperskill)
Or just look at the Kotlin docs they are very good
I thinky my best choice to learn kotiln properly is to make someone turn one of my existing prokects into 100% kotin #1135819519303098429 message
€100 for that? If I remember it when I wake up then count me in lol
how would that help you learn if someone else is doing it all for you
Shhh don't make me lose 100 bucks
why
because its calling itself when the event is called
i think its meant to call another event
not the same one
at least thats the only thing that would make sense
welp imported wrong event
yes
blud never tried his lib on paper
Kotlin has a "Kotlin tour"
Never used it but u could prob look at it (although you'll prob know a lot from java)
There's also a small Java to kotlin comparison on the docs as well
¯_(ツ)_/¯
Woah
@light pendant there's a converter in IntelliJ
Also why do you want to convert it to Kotlin?
Wants to learn kotlin
Oh
i think their mind is a lil borked rn so i wouldnt apply for it
Still why not use the converter
oh it pretty much sucks if you use it for a whole project
This thing sucks btw
Its good to start but you're gonna have multiple errors in each file
yeah
With code that's not exactly good
Errors are good though
It helps the code build
Iirc if you don't use nonnull it marks everything as nullable
I think I even did like a replace all question mark thing before lol
bro the converter is shit
I'm also kinda against this request
A lot of the things can be preference
And so u can ask, get multiple ppls opinions, and decide what's brst
my converter:
compile java
decompile kotlin
?? profit
Specifically I'm thinking of extension and top level functions but there's others
@light pendant I'd consider... Rethinking your latest request
Why not use that to learn kotlin?
Plus, you want to get ppls opinions as you ask questions and convert the project
It can be a nice learning method... For 100 pounds less :))
¯_(ツ)_/¯
My lib is a lot smaller but I also converted it to kotlin
🙃
Just my thought tho
I also made a lib but literally never used it lmao
its so hard to keep it updated
Meanwhile me with DkimCore, DkimBukkitCore, DkimJDAUtils, and DkimGradle
🥲
I just take code that I notice is in a lot of my projects
Do you guys have motivation tips xD????
Hmm
Have you tried making gui desktop applications
I know what I want to make etc but i just cant get myself to open the idea and have at it and learn
im also excited about that project but
i have another project i have to finish but i dont want to before i can start working on that
iygwim
It should help if there's a specific reason you need the project
Ex if there's something you or a family/friend needs (not for money) then that could help
That's why Im also trying to learn android dev
I gotta focus on one thing lol
Learning android, rust, and cpp
All for different reasons
if you do it then I'll give you $10,000
i do many things i want
that might or might not be a lie

I have an update I have to finish before I can start working on the stuff I want to work on, but the update is very painful to do so i dont want to xD
Just don't do public plugins ez
Yeah I can abandon free plugins, but not paid ones 
What kotlin decompiler do u have
How to load another world if there is no player in it to spawn mobs? 1.12.2 paper.
what
If I am in a different world than the one where the boss should spawn, then the boss entity will not spawn.
Since the world where the entity should spawn is not loaded.
Heh
Loading chunks where the boss should spawn does not help.
yes that is probably true
I'll think about it 😄
how can i open a page to a player when they click on a button in the gui?
Spigot has a wiki page for that https://www.spigotmc.org/wiki/interactive-books/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thanks ill check it
@dawn viper after creating the book , how can i open it to a player?
declaration: package: org.bukkit.entity, interface: Player
yeah that's what I just sent
i found it from there
it didnt show for me for some reason
anyways i made teh book but
when i open it it says * Invalid book tag *
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
i fixed it
this is my build.gradle.kts ```
plugins {
java-library
id("io.papermc.paperweight.userdev") version "1.5.5"
id("xyz.jpenilla.run-paper") version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing
}
group = "com.hockey.proxyplaceholder"
version = "1.0.0"
description = ""
java {
// Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
dependencies {
paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
implementation ("redis.clients:jedis:4.3.1")
implementation("me.clip:placeholderapi:2.10.10")
}
repositories {
maven {
url = "https://repo.extendedclip.com/content/repositories/placeholderapi/"
}
}
tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.20"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
/*
reobfJar {
// This is an example of how you might change the output location for reobfJar. It's recommended not to do this
// for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here.
outputJar.set(layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar"))
}
*/
}```
at line 24 url= ... it says type mismatch required uri found string
any ideas?
i made this code here
https://paste.learnspigot.com/ikobedusah.java
but im wondering , how can i make it so the next pages after page 1 only show if a player has a certain level? i assume i need to make a level system which i haven't done before so if anyone has a good guide please send it over 🙏
chunk?::class.java
How do I make this work? I'm trying Kotlin
you make multiple book itemstacks
do i make a new book for each level?
pretty much
how do i open each book depending on what level the player has?
idk? make a list, select the book based on their level, open that book
i dunno how to make a level detection system or a level system on its own
can the spigot api open book guis for a player?
well then thats up to you to figure it out
or do you need nms
im very new to coding
yeah
do you have a guide i can use?
oh then that's super ez
Player#openBook(Itemstack)
well, its time for you to use some google fu and figure out how to make a level system yourself
since a level system isnt a specific concept that only applies to minecraft
i'll also offer advice in the form of you should only be giving players one (non-functional) book item and just detecting when they try to click it
and intercepting it
you could google xp level system rpg programming and find something related
thats not really what i want to do
you dont have to give a player a book to open the book ui
i would send a picture but i dont have embed perms
you can just force them to open it
right but he probably wants a book in their inventory for them to click
for the realism
i have tried googling a level system but all i find is super complicated plugins that have over 30 classes
which i dont even understand
30 classes isnt complicated tbh
imo this is your best option, your alternative is to have to manage multiple books going in and out of the player inventory which seems significantly worse
are you actually reading what they are doing?
yes
or have already done
their code generates a book item and they want it to change based on 'level'
yes but the player doesnt receive the book
it just creates the book to open it for the player
oh
they have a chest gui, click a button in that gui and its supposed to open up a book gui that had pages for each level
i see
for a simple level system, two variables for each player, one an xp value, one a level value, then create a formula for the increase of xp per level and a loop that generates a list of values, each representing a level and their value to aquire said level, then a method that checks the player's current xp and if on gain if they are ready to level up and then if they are increase their level counter
there isnt gonna be an xp level
yeah then i have no idea what you are even wanting
let me explaij
im working on an adventure map and i want to make a lore system for it. basically you explore the map and there are gonna be waypoints. when you stand on a waypoint it will add it to the waypoint menu and it will also give you an extra page in the lore book
trying to add papi to my bukkit project
build.gradle (kts) ```
plugins {
java-library
id("io.papermc.paperweight.userdev") version "1.5.5"
id("xyz.jpenilla.run-paper") version "2.1.0" // Adds runServer and runMojangMappedServer tasks for testing
}
group = "com.hockey.proxyplaceholder"
version = "1.0.0"
description = ""
java {
// Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
dependencies {
paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
implementation ("redis.clients:jedis:4.3.1")
implementation("me.clip:placeholderapi:2.10.10")
compileOnly ("net.md-5:bungeecord-api:1.20-R0.2-SNAPSHOT")
}
repositories {
mavenCentral()
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven ("https://oss.sonatype.org/content/repositories/snapshots")
}
tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.20"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
/*
reobfJar {
// This is an example of how you might change the output location for reobfJar. It's recommended not to do this
// for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here.
outputJar.set(layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar"))
}
*/
}
ProxyPlaceholder:main: Could not find net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/adventure-platform-bukkit-4.0.0-SNAPSHOT.pom
- https://repo.extendedclip.com/content/repositories/placeholderapi/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/maven-metadata.xml
- https://repo.extendedclip.com/content/repositories/placeholderapi/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/adventure-platform-bukkit-4.0.0-SNAPSHOT.pom
- https://oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/maven-metadata.xml
- https://oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/adventure-platform-bukkit-4.0.0-SNAPSHOT.pom
- https://repo.papermc.io/repository/maven-public/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/maven-metadata.xml
- https://repo.papermc.io/repository/maven-public/net/kyori/adventure-platform-bukkit/4.0.0-SNAPSHOT/adventure-platform-bukkit-4.0.0-20210914.041527-93.pom
Required by:
project : > me.clip:placeholderapi:2.10.10
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
any ideas?
so when you say level, you mean as in an area linear level, like in mario games where its level 1-1, etc
pretty much
but i thought of a better system
that i can actually code
does papi need net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT??
i'll try to make it
any ideas on how to fix my issue?
sorry im new to coding , i dont understand a single line of what you sent
i added the dependency following the docs and its not working lmao
if a person isnt responding to your issue either directly or in responce to someone elses comment on your issue then its very likely they have nothing to contribute to helping you kekw
do you have anything to contribute
my html anchor tag isnt working right, any ideas?
<a class="clickable" onclick="fetch('/assets/text/xmr.txt').then(e => e.text()).then(e => navigator.clipboard.writeText(e))" href="">copy</a>
/s
Try excluding the adventure dependency
From papi
repositories {
mavenCentral()
maven {
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots"")
}
}
also your using quite an old version of paper, since 2.10.10 is from july 10 2021
try using a more recent one
lemme try
since ive been using 2.11.1 and not had it complain of that for myself
same error
tho i should probs update it to use 2.11.3 but im lazy
where would i change?
im trying rn
also shouldnt it be compileOnly and not implementation
yea that works thanks
Yes
1 more issue
public String getProxyName(ProxiedPlayer player) {
JedisPool jedisPool = proxyServer.getPluginManager().getPlugin("RedisBungee").getJedisPool();
String serverName = jedisPool.getResource().get("uuid:" + player.getUniqueId().toString());
return PlaceholderAPI.setPlaceholders(player, "%proxy_name%", serverName);
for return PlaceholderAPI.setPlaceholders(player, "%proxy_name%", serverName);
This is prob why
yea but im making this a bukkit plugin
You can't use ProxiedPlayer
Isn't that a bungee class?
yea
looks like it tbh
you can add bungee api to a bukkit plugin no?
Uh
probs something to do with redisbungee
yea
bungeeapi only exists in spigot for its chat coloring and stuff like that
im using this to grab the name of the server using the name of the server i have in the redisbungee config the plugin i use to link the servers since velocity doesn’t have a thing to choose name for it and then display that in a placeholder so players can see what server they are connected through in tab
would that not work?
sorry, bungeecord-chat is included in spigot afaik
what?
im using redisbungee tho
the full bungeecord api isnt included in spigot or paper or any other forks
like
how would i do this then
