#help-development
1 messages · Page 1022 of 1
wdym
you can add a passenger to a passenger
then if the textdisplay has multiple lines of text they will overlap no?
you have translation
just make multiple for multiple lines, add entities in between as a gap or use a transformation on the displays
these are the 3 options
i already made everything i just need to make it follow the player so id like to do smthn with the code above to get it to move smoothly
okay but you cant
transformations are best as you can smoothly scroll them up
teleportation isnt smooth
passenger or it will not be smooth
uhhh ok thanks
i already made everything and i cant rly redo everything + other plugins i have use passengers so i cant rly do that
im gonna have to find some other way
alr
Or just do one display and manually add in newlines
good luck, but i have tried too, and i couldnt find anything for keeping stuff sync
There is no other way for smooth
yes, but passengers
i was gonna move the textdisplays over x amount of ticks
and see if that made it look any better
What about it?
text overlaps
lag and client predictions will make it not smooth
I have this project and this code to publish to github and locally. The core module includes all modules (except versions and bungee). I want that none of the versions submodules (except adapter) be included in the pom that gets published. How can i do that?
cuz he stacks them
the return doesnt seem to fix my problem (it does return, though)
Which is why I said to just use one and manually add newlines?
huh
just add one on top of the player
and add each line by editing the text
coll had a big brain solution
well im doing chat bubbles so that would look weird having just 1 bubble
Yeah passengers is the ideal solution
Especially if the player themselves don’t need to see it
i would do passengers but the text would overlap + ik some1 said smthn about translation to fix that? but i have no idea how that works
It’s just an offset to the render position
every time you add another passenger you perfomr a translation and all teh bubbles scroll up
ohhhh
https://paste.md-5.net/gukaterene.cpp
[15:45:40] [Server thread/INFO]: CONSOLE issued server command: /eco give winwx 1000000
[15:45:40] [Server thread/INFO]: [0;32;1m$1,000,000 added to [0;31;22mwinwx[0;32;1m account. New balance: $1,304,421.24[m
[15:45:43] [Server thread/INFO]: 1304421.24230656
[15:45:43] [Server thread/INFO]: 1304421.24230656```
So the issue is that for some reason the value mapped in playerBalance is always the same as currentBalance in the handleConversion method, the point of doing this is because the rate is handled based on player balances and I want to prevent them from exploiting that given their balance changes during the interaction of the conversion menu
Perhaps I am cooked and just missing the simplest thing, but I have tried several ways and it still ends up being the same
in javascript i can make a "player" join in 1.20.6 server for stay afk?
I've got a quick question, how do I cancel the scheduler after it's reached the limit?
sc.scheduleSyncRepeatingTask(Relula_AutoGrow.getPlugin(), () -> {
if (ageable.getAge() == ageable.getMaximumAge()) {
e.getPlayer().sendMessage("cancelled.. " + ageable.getAge());;
} else {
ageable.setAge(ageable.getAge()+1); // ^^ Is reading "7", is it reading too early?
e.getBlock().setBlockData(ageable);
}
}, 10L,10L);```
how to get com.mojang.authlib.GameProfile variable, im using gradle
run buildtools, then depend on spigot not spigot-api to have access to authlib
do i need to put spigot into my plugin?
no
or just compileOnly
Naaah, i dont want to write 1000 code for all versions from 1.8 to 1.20.3
I want to get OfflinePlayers inventory, i found a code that do this
do textdisplays not move when being added as a passenger to one another?
They do if the bottom one moves
you translate each one
But the bottom one will never move on its own
I think he means move up to stack
i mean like, i think i have 3 text displays, passengered on top of one another, and they are all overlapping, i assumed they would work like armorstands or no?
no
bump
translate each one by whatver offset it needs
oh ok that makes it very easy then thanks
is there anyway to like spawn a textdisplay and add as a passenger at the same time cuz i can see the textdisplay before its added as a passenger for a second and it looks kinda weird
Use the spawn method with a consumer
forgot that existed ty
TextDisplay display = playerLocation.getWorld().spawn(playerLocation, TextDisplay.class, entity -> {
entity.setText(combined);
entity.setInterpolationDelay(-1);
entity.setBillboard(billboardType);
entity.setSeeThrough(true);
player.addPassenger(entity);
Transformation transformation = new Transformation(
new Vector3f(0, (float) 0.75, 0),
entity.getTransformation().getLeftRotation(),
entity.getTransformation().getScale(),
entity.getTransformation().getRightRotation()
);
entity.setTransformation(transformation);
});```
it still appears in my player for a second then teleports to where it should be, is there anyway to fix that?
Perhaps a bit of an offset at the spawn location? I don't think you can 100% prevent that
Thinking about it, that will mess with your transformation so you'd have to account for that as well
Not once it’s added as a passenger
Ah ok
that worked thanks
Question: How would I throw code back to the main thread once I'm in a Executor thread? I know I can just use the Bukkit schedulers method runTask and it will run on the main thread, but I'm mainly trying to figure out how to accomplish this on my own for a lib I'm doing for some plugins, tried googling this but there is assload's of conflicting statements about it
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I tried using synchronized on an Object from the main class but, it appears it still called on the thread pool thread
you don't without the scheduler
sadge I use that then
bump 😄
i mean you put the value of economy.getBalance
also that putIfAbsent seems dangerous
and wheres handleInteraction?
Bump 🙏🙏
Does that imply the economy.getBalance will always return the current balance
Ie: I need a way to derive the balance?
handleInteraction just modifies the menu
i would assume economy.getBalance returns the current one??
Yes but I need the balance to stay as is in the event their balance changes during the conversion
?paste
https://paste.md-5.net/opezufaxuf.cpp handleInteraction
so you then save the new balance or smth?
The old one as it were
The point is to make sure their rate doesn't change given their balance does whilst trying to convert money -> apples
so these two lines always do the same
double cachedBalance = this.playerBalance.get(player.getUniqueId()); double currentBalance = economy.getBalance(player);
after the player was put in the map
That's what I was thinking so I'm not sure how to figure this
It should be an old balance compared to a new one in the event it actually changes
i mean youre updating the balance (economy.withdraw) and then removing it from mthe map
That's post conversion
then repopulating in the event with two values that are the same
Right
im confused but thats just me
I am too
shouldnt you be putting their balance in the map, the moment the inv opens?
Yeah that'd be smarter
then check when they click smth, compare it with their current balance (ask economy)
I still feel like it's going to return the same amount
Whether I cache on open or click
The map is never modified outside of the click method so
Except to remove the player
so the point was to avoid having a balance change between opening the inv and clicking on an item?
Rather when they click the buy button (case 22)
well ye same thing
private double calculatePlayerRate(Player player){
Economy economy = NormalConversions.getEconomy();
double playerBalance = economy.getBalance(player);
double rate = playerBalance * this.baseRate;
return Math.max(rate, this.rateThreshold);
}```
The rates are decided as a percentage of the players balance
Which would change each time they want to convert apples
Meaning it introduces the fact they can figure a way to lesser their balance / rate in the middle of a conversion which is what I am trying to prevent
so ye just put their current balance in the map the moment they open the inv ig
?tas i suppose
anyways im going to bed
Also regarding putIfAbsent, rather I compute if absent?
dunno what happens with removing
@worthy yarrow the first of CabernetMC's tooling is now on github
Ok
Is it actually though?
YES vineyard-core is now finished
unless I need to make tweaks to the core tooling
I probably need to add more customizability but that's ez
I guess my question was, are you actually going to commit to CabernetMC?
yes I've commited lol well I've been clear from the beginning this is a hobby project I actually wanted to work on
maybe I haven't been clear
but yes its a hobby project I'm very interested in
You've told me several times it was a joke kek
well generally yes
But it's getting more serious now eh?
its not like it'll ever be a viable replacement for bukkit or anything
its just a fun hobby project
yes, but
A. large ecosystem
B. Many developers and single time contributors, and continuous contributors, including myself
I mean, if it's good enough...
its not about viability, moreso learning
Put the effort for cabernet into Bukkit
Ah fairs
Smh
I'm procrastinating writing Commodore
ty for the help fourteen!
miles stop typing here and get back to work
fine
What is epic forcing you to do now
cabernet
you need to pay this guy to get me to do inventory stuff
you can pay y2k who can pay me
its Libby, but can't you just make your own pretty easily?
ig it could be tricky without a bootstrap
libby fork
Yea well I probably do have to end up writing my own
use my fork to save it in /libraries
Smh just use the libraries feature
Just tryina extract every inch of abstraction cuz me lazy :,)
Its for a standalone software application :(
😭
Yea so my plan was to distribute thin and thicc jar
one w all the deps as an uber jar, and one where it downloads em at runtime
Link?
i dont mind it being kotlin
But can you fork Libby so it downloads itself at runtime too
Big brain
the stuff will be on https://repo.epicebic.xyz
Lmao
yea consider it considered
Be careful his oracle vps doesn’t die

that was like a year ago
coll clearly does not easily forgive
Nor do I forget
what did you have for dinner yesterday
Veggie wraps
what about last monday
boom you forgot
Shh
Meant to say pastaaaa
I have this code which regrows either wheat or carrots, but why is carrots not triggering?(when broken)
I have a feeling your if statements aren't quite in the order you want them to be. Or at least is obstructing some logic you want run
If you're trying to replant carrots while you're holding a wooden hoe, it won't ever happen because your follow up condition checking for carrots is an else if
A note by the way - your block type will never be CARROT. That's an item. CARROTS is the block. You don't need to check both
I found it out, thanks
whats the best value to have interpolation at for a text display?
interpolation is how many ticks it takes to move from it's current position to the final transformation
how do i summon a lime dust ploom with 0 speed
i know theres a
double extra;
``` parameter
but its very confusing
or any particle with 0 speed
Does anyone know the opcode for default methods in interfaces? Is it INVOKEVIRTUAL or is it still invoked via INVOKEINTERFACE
I'm like 95% certain its the latter of the two, but I want to be sure
@worldly ingot whats Martin's discord name again
derfrzocker
it's always been invokeinterface
I never insinuated it changed, I just wasn't sure if their was some specifial case for default methods
I just decompiled a class and looked at the bytecode
javap ftw
I just used intellij
no javap usage for me :P maybe intellij did but I didn't
@lone jacinth So, I'm looking at commodore. I'm needing to change the InventoryView abstract class to an interface. I did this before by just checking the owner classpath and then changing the opcode
if (opcode == Opcodes.INVOKEVIRTUAL) {
opcode = Opcodes.INVOKEINTERFACE;
}
However, commodore has changed quite a bit, I'm not quite sure where I'd need to place this. I've noticed their is a visitField and handleMethod methods in Commodore now. I figured I'd try to give it a crack by looking at the ASM you wrote for your other Abstract -> Interface PR, but commodore has changed a lot.
My main question is do I need to handle this for both the handleMethod and the visitFieldInsn override or can I get away with just putting it into handleMethod.
One other question I had was regarding itf boolean in handleMethod what exactly does it mean. I noticed you set it to true for the rewrite from INVOKESTATIC to INVOKEINTERFACE. What does setting it to true do exactly?
Based on your usage of itf in your PR I just ended up throwing itf=true at the bottom of my code in handleMethod
for (final String classPath : ABSTRACTS_TO_INTERFACE) {
if(!owner.equals(classPath)) {
continue;
}
if (opcode == Opcodes.INVOKEVIRTUAL) {
opcode = Opcodes.INVOKEINTERFACE;
}
itf = true;
break;
}```
Being able to view bytecode in eclipse directly is pretty pog
bytecode always looks so fun
yeah I've done a bit of assembly before
sept I'm not familiar with all of the JVM bytecode
stack machine go brrrrrr
declaration: package: org.bukkit.inventory, interface: Inventory
that's backwards
getContents should return everything. idk about 1.8 which is about 20 years out of date
it returns everything for players, getStorageContents only returns main inventory
Not according to the api
Just checked it and thought that too
what? the docs say the opposite
getStorageContents says that it excludes armor
getContents says all
the implementations back that up
Getstorage doesnt say it excludes
Then it should be updated to not be ambiguious
Im looking at the implementations rn, idk why you are arguing the opposite of reality
Anyways on with my day and blocking you
uhhmmm
am I tweaking or is intellij? Invalidated caches and everything but it still say 19 != 19
all modules are set to 19 too 
changing to java 21 fixed it nvm
perfectly summarises the relationship between spigot and paper
can you still add custom enchants to the enchant registry in 1.20.2+? I haven't found a way of freezing/unfreezing the registry and registering the enchant since Enchantment#registerEnchantment is no longer possible
intellij....
I don't even understand why a window would be allowed to be resized to this size, much less somehow open at this size
flexing how compact the new ui is
good luck doing anything productive
wow you need to look at the code while programming?
I bet you also look at the keyboard while typing
and type with a single finger
lol yeah, new feature, the compact compact ui
trash compactor ui
runs fine on 100px by 5 px monitors
well
time to create an entirely new plugin
I'm not looking forward to this one
I'm not even sure if it's a good idea tbh
It also might be a version thing, maybe 1.8 did it differently,
I would encourage building the server source for 1.8 and checking the method implementation yourself.
Hi , i have some problems with data sync bettwen lobby / other servers so in game-1 server the data is stored in mysql , but when i join lobby its 0 kills , 0 wins , but in game-1 its 2 kills , 2 wins ..
sometimes it update sometimes its not ..
here
well. You realize that it’s possible the get data function is sometimes faster than save data
in general you shouldn’t save most data just before the player leaves
save it when acquired
oh ?
so when i kill a player , i save it to mysql?
but does not that cause performance issuses?
i would only do that if its data that changes literally like every 0.5 seconds
mysql is verry fast
so unless you have 10k players
no problem
ok thx
System.out.println(translationString.getText());
What's going on?
[10:55:02] [Server thread/INFO]: [TextComponent{text=, BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=[TranslatableComponent(format=%(?:(\d+)\$)?([A-Za-z%]|$), translate=custom.carrots.in.farmland, with=null, fallback=null), TextComponent{text= , BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=null, clickEvent=null, hoverEvent=null, reset=false)}, TextComponent{text=, BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=[TranslatableComponent(format=%(?:(\d+)\$)?([A-Za-z%]|$), translate=custom.ageable.ripe, with=null, fallback=null)], clickEvent=null, hoverEvent=null, reset=false)}, TextComponent{text=., BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=null, clickEvent=null, hoverEvent=null, reset=false)}], clickEvent=null, hoverEvent=null, reset=false)}]
can you post more code
It can't do recursive calls for TranslatableComponent ?
I can, but it really shouldn't be necessary. It's all there really.
TextComponent translationString = new TextComponent(new TranslatableComponent(translationKey));
// Add a space for ageables.
translationString.addExtra(new TextComponent(" "));
// Check for growth stage and add a suffix message.
TextComponent suffixGrowthMessage = getSuffixGrowthMessage(ageable);
translationString.addExtra(suffixGrowthMessage);
translationString.addExtra(new TextComponent("."));
System.out.println(translationString.getText());
It would seem to me it's getting this.
Instead of this.
But then, that begs the question - what is the proper procedure for such things?
i did that , but it still not loading the new data from lobby 🙂
maybe its loading the cached data?
If I do System.out.println(translationString.toPlainText()); I just get the translation key, not the translation text.
Quick question, if I make a plugin that downloads another plugin (both mine) is this against spigot TOS? I want to make a plugin that manages resource packs (merging, hosting and such) and am wondering if I can make it so when people download some other plugin of mine that benefits from this plugin I can add a prompt to ask if they want to autodownload the rsp management plugin
Have you tried reading the TOS?
yes
nothing particularly specifies whether this is allowable, if it did I wouldn't really question it. Making plugins download other plugins from third party hosts as a feature sounds like it could lead to a lot of questionable situations, so I'm asking if there is a current ruling on it to err on the side of caution
AdvancedSeasons seems to load stuff dynamically.
They had some argument at one point with Spigot. But I don't know the details or whether it was related.
However, if there's nothing that specifically forbits you from doing this with their software - go right ahead.
Be sketchy.
If it makes you happy.
I doubt Spigot has a lot of incentives to sue its users.
I'm not afraid of getting sued, I just want to be in good standing with a platform I've been using for a very long time and enjoy using and developing content for
Okay. I have nothing more to add to the conversation after that. Good luck.
am so confused, is block position in nms now called blockpos? or is it the wrong variable.
Does it give you the correct position when you use it?
maybe its a mapping thing?
super random change, ill check
All time I can remember I've been dealing with nms (mostly modding, not spigot) it was BlockPos
what is translationString
return new BlockPosition(block.getX(), block.getY(), block.getZ());
}``` used to work 😐
Anyone know what happened to the spigot website?
its up for me
nothing?
reload
any browser same thing
its on your side
It has been cancelled.
hmm
Oops sorry I took spigot down 🤷♂️
nuke the browser temp data
Delete chrome
i fixed it
eff nms with confusing variables. going back to protocollibs 😢
by using opera gx
me who uses the confusing lettesr:
Oh boy
Use mappings
i just reset my cache on chrome to no avail
so idk
bro what
the following error occured:
wtf xD
The hiring developers forum is quite dead lol
I would create a portfolio and post, but over the 4 years ive had an account on spigot
i havent managed to post enough to reach 20 message
s
lol
Lmao
itf means interface it is a flag to tell ASM that the method is from an interface. ASM needs this information to build the constant pool correctly.
You only need to change handleMethod.
You can also find an up to date version of commodore with the interface changes here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1315/diff#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Futil%2FCommodore.java
Anyone else having issues with the premium resource placeholders not being replaced?
I mean these placeholders, for example %%__USER__%%.
It happened on the latest update of my plugin, never had issues with that in the recent years.
if you download the resource yourself it won't get replaced
Does enyone have a link to a guide on how to add sql to a plugin?
i know but customers are having this issue
use chat gpt
it's nothing fancy really, you don't need to specify that it's for a plugin
just use the queries and the result set to do what you need
Oh alr ty
Does anyone know why swagger is not respecting custom jackson module for scheme generation ? Seems like quite a few people had this problem but all of them managed to fix it by declaring custom ModelResolver bean which doesn't seem to work with me. Funny part is that swagger is respecting all jackson configurations (for example PropertyNamingStrategy) but only things its not respecting are custom modules.
It took me just a single google search
If you don't know how to create a connection, is the same as if you were doing a standalone java application
DriverManager.getConnection("jdbc:mysql://<host>:<port>/<database>", "sql user", "sql password");
sql user and sql password can be null
If you are planing to use MySQL or perform multiple queries, I would recommend you using HikariCP
dawg 💀
but with hallucinations
HikariCP + JOOQ
just like you would add sql to any other project
well, not if your requests are small
does for me
haven't used it in months tho
it's sometimes good for showing ways to approach solving a problem but not code generation
7/10 times it hallucinates
this one is actually good
how can i add colors to a message defined by a config? afaik if you use escape codes like §c, that could not work in some cases, like printing to console, and the best is to use ChatColor, but how can i use it from a config? any helper method or something to replace placeholders for colors or something like that?
placeholders
Or you could use minimessage
but is there something from the spigot api that does that? so i dont have to implement it myself
like {GREEN} in teh config you parse and replace with ChatCOlor.GREEN
its very simple to do, you do it yourself
valueOf my beloved
ok, and what is the proper way to use translations?
manually? just a yaml file and thats it?
Chatcolor translate from something
translations?
yea, different languages for chat messages and all that stuff
different yml for each language
so manually
great, thats what i wanted
so those are these colors? idk how are they called https://htmlcolorcodes.com/minecraft-color-codes/
yeah
cool
you can use & as a placeholder in config
yea, thats what ive seen used in this game
I usually use a configuration file, in where you can specify a "language", for example
config.yml
Language: "english"
Then in a "lang" folder, I have a file called english.yml, with the messages
In code, when you want to obtain your messages, I would recommend having a class which obtains the correct message file for you
class MyMessagesObtainer {
MyMessagesObject getMyMessage() {
Config config = /*obtain config*/
String lang = config.getString("Language", "english");
File langFile = new File(plugin.getDataFolder() + "/lang", String.format("%s.yml", lang));
if (!langFile.exists()) {
langFile = new File(plugin.getDataFolder() + "/lang", "english.yml");
}
YamlConfiguration yaml = YamlConfiguration.loadConiguration(langFile);
return new MyMessagesObject(yaml);
}
}
I use an enum to store the keys to the translation and then just have a translate function to convert it to string
then I can do GAME_JOIN.translate(player.getDisplayName) for example
The problem with that is that some translations might get too big using enums
But it's also another way of doing it
wdym too big
Some plugins have translation files of more than 3K lines of translations
Imagine an enum of 3K entries
Yes, I mean, if somehow you expect your translations to be really big, don't use enums
me when Material
right I guess
but the rest of my approach would be the same
then id just call translate with the actual translation key
of where its stored in the yml
right
i'd have an enum and an extension function on the player object allowing you to directly send translations with args
kotlin only ofc
I use static like a real champ
🤢
public static void sendDebug(string message, player)
why not just player.sendMessage(message) 😭
because I might have prefixes and stuff
but that is essentially what the function does
though it also supports the components since I use player.spigot()
I’ve managed to abstract my custom library to take adventure components everywhere
And deal with them the best it can
adventure my beloved
Reals and me modify the class bytecode at runtime to inject custom methods
(not)
me when mixins
Me when JavaScript Prototype
except that adventure supports more
like what
audience
wtf is that
who needs that when you already wasted time making it yourself
why waste time on it
well actually not waste
it would likely be the same amount of fime trying to figure out how to refactor it to use Audiences instead
We are devs, we are lazy, but we want to mane things on our own 😎
but mostly because I didnt know it was a thing
like 5 minutes ago I didnt know audiences were a thing for adventure components
My current system is basically
- Adventure Bukkit adapter
- NMS
- Legacy serializer
wdym by legacy serializer?
It serializes it to a legacy string
Do you mean that weird json string?
No, an actual legacy string
yeah this is out of my area, I never used nms and hope to keep it that way
What is it?
that's just serialised components, to json
chat colours
§4Red text wow
components >>>>>
adventure is one of the main reasons i use p*per
i just need components on inventory titles sorry
I dislike paper
That's what NMS is for
wdym
it modifies API alot that breaks many plugins
just use tolegacystring xD
Translatables:
If nms counts there is
well yeah
i don't like having every single one of my interfaces to be dependant on nms
I dont count that haha
Just use cvn or something
but okay, that would be a good usecase I suppose
but besides that I think pretty much anything else supports components
and also have that be version-dependant and have it changed for 1.20.6
Spigot is missing a ton of component stuff
yea
only messages suck

well besides translatable inv titles I still havent heard anything xD
Lynx don't make me hurt you
Any kotlin users here
Ya sure you want to talk about kotlin

Lmao
Obviously you mean "Remove the ban to Games14"
There goes rad
Don't even bring that up
i'm still here
😩
don't want my boost to expire
When will my ban run out? You racist, take him down, I've been waiting for half a year!
I'll make sure your ban never runs out
shut up
ffs
Lol
Rads iconic phrase
Are MyClass::myMethod and (clazz, arg) -> clazz.myMethod(arg) the same
does anyone know why intellij keeps trying to run a generateTemplates task on gradle for some unknown reason
no, first one operator on class level, second one on instance level
Both operate on instance level if it's a non-statoc method
Just that it expects the instance to be passed
Unlike classInstance::myMethod
but the latter implies there are two params
its all the same thing
where clazz.myMethod uses the first param as receiver, not as param
or have i forget how java works again
wtf is a receiver
just use kotlin bro
this
I will send you to kotlin hell mf
Yes + the worst 1992 like formatting
class main {
@JvmStatic
fun Main(Array<String> Args) {
println("fuck rad")
}
}```
Enjoy
but both should receive a parameter then
i totally forgot
please jump off a bridge
Lol
wont compile
Because I fucked up everything
and the param syntax is wrong
Exactly
and you don't even need it to be static and a class
Enjoy
Do you like this
class Main {
@JvmStatic
fun Main(Array<String> args) {
val numbers = arrayOf(1, 2, 3, 4, 5)
val result = mutableListOf<Int>()
for (i in numbers)
{
if (i % 2 == 0) {
result.add(i * 2) }
else { result.add(i * 3) }
}
for (j in result)
println("Value: " + j)
val map = mutableMapOf<String, Int>()
map.put("One", 1)
map.put("Two", 2)
map.put("Three", 3)
for ((key, value) in map)
println(key + ": " + value)
try {
val quotient = 10 / 0
println("Quotient: " + quotient)
}
catch (e: ArithmeticException) {
println("Divide by zero error")
}
}
} ``` (author: chatgpt)
you dont even need a class
actually buildList 🤓
buildList and buildMap my beloved
just use Scala
who are you, steel?
might look into it
is it possible to have certain biome in specific area/block ?
you don't even need the args 😭
like world also generates according to that biome
fun main() {
println("do you like this")
}```
Lol
public class Main {
public static void main(String[] args) {
System.out.println("no you don't");
}
}```
ffs
They're working on a better main method

Well, I usually always had it in a seperate class launching the actual main class

so fucking cursed
Yk how IJ has a convert java to kotlin feature? Lets convert minecraft to kotlin
Lmao
val offhandList = items.toMutableList().also {
removeAll(main)
removeAll(armorList)
}```
🤓
Just feed it into chatgpt
whats the diff betweena pply and also
apply >>>>
i once did kotlin val sharedViewModel by run { val internalVm = viewModel(factory = SharedViewModel.Factory) remember { mutableStateOf(internalVm) } }
why you using a delegate
Is extension function kotlin terminology for method or what
no
cuz android
fun Player.foo() = sendMessage("HELLO")
player.foo()
gotta realize that methods dont exist
everything is a function
player.foo(bar) is literally foo(player, bar)
exactly what an extension function does
Your mom is one too
Could've continued this but I'm not
whats a data class
record
i see
right on time
so its just static methods everywhere then?
I cant seem to figure out how to support multiple java versions with my plugin. I am supporting all of 1.20 NMS versions, and 1.20.5+ requires Java 21, and < 1.20.5 is Java 17. I cant compile the 1.20 dependency without 21, meaning that the NMS module has to be 21, meaning that my core module has to be 21 since it includes the NMS module, and < 1.20.5 doesnt support java 21 (ASM is outdated). What am I doing wrong?
The 1.20.5 and 1.20.6 dependencies dont resolve if I use any version under 21
disableAutoTargetJvm is probably what you want
I just tried that, however it doesnt work how I want
The code which is compiled in 1.17 can now no longer access the NMS code, even though it resolves the depencency, so it still wont compile.
you'd have to a) disableAutoTargetJVM and then also define java 17 as both source and target
it is compiling in 1.17
No
I honestly probably setup my gradle modules wrong
but my main module, which has my generic code, has "nms" modules for each version, which it only imports and uses the one corresponding to the server version
oh wait, the NMS modules hsould also have the disable auto target thing, one sec
Yea I mean,
java {
disableAutoTargetJvm()
toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
should basically work for nearly all your modules
Cann confirm this works
Pineapple 🍍
I cant believe its that simple
I went to a different discord and they wanted me to like completely restructure and recode my entire plugin
They probably interpreted your request as wishing to go with the MRJ route
MRJ?
Multi-Release-Jar
Hi there,
I am having an issue with development of my bungee plugin where it says the following, Cannot invoke "java.util.List.isEmpty()" because the return value of "net.md_5.bungee.api.plugin.PluginDescription.getLibraries()" is null
But I haven’t set the field not was it an issue before the 1.20.5/6 update
is Player#canSee(Entity) also false when the entity is invisible but not hidden?
Does anyone have experience developing faction servers? we got some people working on it but we were looking for suggestions and advices moving forward
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
org.bukkit.plugin.InvalidPluginException: Cannot find main class `cc.catpvp.ArcherUpgrades'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:65) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:113) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:314) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:232) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:311) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(Unknown Source) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(Unknown Source) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_202]
Caused by: java.lang.ClassNotFoundException: cc.catpvp.ArcherUpgrades
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_202]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:100) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:85) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_202]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_202]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_202]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_202]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:63) ~[Spigot.jar:1.8.8-R0.2-SNAPSHOT]
... 7 more```
idk why isnt working
your main class has a different name than you specified in plugin.yml
InvalidPluginException: Cannot find main class `cc.catpvp.ArcherUpgrades'
dude, lookup my plugin.yml
?paste your main class
main: cc.catpvp.ArcherUpgrades
version: 1.0
author: SimplyJC_
description: Archer Upgrades to CatPvP
commands:
togglearcher:
description: Toggles different types of archer effects on or off.
usage: /togglearcher <poison|slowness|wither>
forget it, i already found the problem 🤣
in my plugin.yml y putted cc.catpvp.ArcherUpgrades, but for some reason in my main class the package was cc.catpvp.simplyjc 🤣
Does this no longer work in 1.20.6 ?
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
CompoundTag compound = nmsStack.getTag();
It seems there is no getTag method.
Does DecoratedPot have a container interface implemented? I can't seem to get anything working...
ItemStack objects no longer hold NBT
they use data components now
what are you using nms for anyway?
Because of legacy structure 😄
So i have to migrate the data, right ?
But how can i do that if there is no more NBT data?
do what exactly?
but ideally you should migrate your system away from nms
and use the api instead
https://prnt.sc/uMWDJGEvIFwW
whats the problem here ? i think maven.gamestrike.de is down ?
you postd no error
Yea if nms no longer exits, i have to do that.
But how can i use the new system, if i don't have access to the old data right ?
As example my item has a custom durability as nbt data which i have to migrate to the new system, right ?
ah, it stops to compile at this point
The api isn't fully ideal on spigot
Binary serialization! But its kinda a pain to implement because the ItemStack class
compile took 4 minutes and 20 sec
?paste a log
I don't knew that, so there i no way to migrate the old data right ?
So i have to create migration command or something like that in a old version?
I'm sure you could
Hey i have the problem that im doing a tpa plugin and curently im doing the /tpaccept <player> feature that means i accept the tpa of the 1 arg but my problem is idk how i can do it casue rn im doing it with a hashmap but the hashmap overrides everytime a player executes the command so the player can only have 1 tpa request at the same time
tpa2.put(p, ptp);
this is from the /tpa <player> command and p is the command execute and
can prob someone help me
The old data should be loaded into the CustomData tag or something
well, a map is basically just a list of a=b pairs
yeah it works now, idk what the problem was
so yes, every player can only have a single value, if you use a map
Okay, so i have to do migration command/event to PDC.
Is there a good PDC tutorial/documentation to learn that ?
?pdc
Thanks
ik it and im searching for a solution
You should use the actual custom durability component for 1.20.6 tho
out of my head, i'd say just make it a map that has the player's uuid as key, and a list of requests as value, i might be wrong tho
The custom durability is just one part, there are some options which are saved on the ItemStack 🙂
but i also need a time when the tpa expires
Put that in the list of requests then
yea, just make a "Request" class, that has a number (might be ms, seconds, whatever), and the target's uuid
so i can do a own expireation time for every value?
mhm
i need that every value gets his own experation time
wdym? you make a map that has the player (who runs the command) as key, and a list of requests as value, so Map<UUID, List<TPARequest>> for instance
obviously you will need to manage somehow to decrease the expiration timer every X seconds
That's why you use an instant
but how can i make that the request expire after an amount of time
idk what an instant even is lol
And just check against the instant when they run the accept command
does it automatically count down?
Nah it's just a fancy wrapper for a timestamp
but if i send a tpa earlier than the other the first should expire before
thats my question
?
only one active request per player per time
yea thats exacly the problem
so they don't overlap i assume
when adding to the map, just remove the old request if existing
^
i dont want that the player can only have 1 tpa per time
well
That's what the list is for
then don't remove it?
Map<UUID,** List<TPARequest>**>
yea
but every tpa should havbe his own experation time
thats inside the request
That goes in the TPARequest object
it handles its own expiration
and then youll just have some function that grants the request and checks for a valid one
eg.
public record TPARequest(UUID target, Instant creationTimestamp){}
i hate that you have to add the {}
hate is a strong word
kotlin data classes
yes that's why i use it
but not so much that I switch to another language 
it is
then you have a map of those, eg ```java
private final Map<UUID, List<TPARequest>> requests = new HashMap<>;
what means eg
for example
example given
example given
okay
but you werent right either
it's all semantics
anyway, then whenever you run the tpa command (/tpa <target>), you just add it to the map, with ```java
requests.put(sendingPlayer.getUUID(), new TPARequest(targetPlayer.getUUID(), Instant.now()));
assuming it's "Instant.now()"
never used it
what is Instant.now()
its a timestamp
im doing it like this
System.currentTimeMillis()
and when the player types tpaccept you check if the timestamp is within the time limit of the current time
actually wait
yeah same thing
that's ms
it's a list of requests
basically same thing as instant
instant is just more convenient
yup
List<TPARequest> existing = requests.get(player.getUUID());
existing.add(new TPARequest(targetPlayer.getUUID(), Instant.now()));
requests.put(player.getUUID(), existing);
that should do it
not tested obv
also make sure it's a mutable list
yeah and tpaccept is just removing a request until you find one that hasnt expired or until its empty
why are you messing with records and Lists if it's just a tpa timer?
thats just how i'd do it
umm i dont understand this
im pretty new to java
it's it on the player accepting ANY tpa?
in the map, every player has a list of requests
you get the existing list, add a new request to it, and then put the new modified list into the map
cuz i'm pretty sure modifying the list directly doesnt change it
the first step for a very flexible and robust tpa plugin is using spring boot
and how can i check at tpa accept if the tpa is valied
the first step is finding an IDE 
the first step is getting born
I can't really attest to this, but they will certainly come out of that with a whole different perspective for sure though
so gg, you are already at step 2
first step your parents getting born
tpa is short for "teleport accept" right?
well, its not teleport all >>
yeah its tp accept
tpa is sending some1 a teleport request and /tpaccept is excepting the tpa
the command is usually tpaccept, so a nice way to say it is just tpa
ikr
ye ig
because /tp is already a vanilla command also
uh, check if the list contains requests that have the player as a target.
if not, cancel.
if yes, do your tp shite
makes sense
and how can i remove the tpa after some time from the list
youre my hero❤️
scheduler every tick
We have the scheduler
I have a tick event in my lib so I don't care
fabric my beloved
^
I mean it's literally the same thing
until gradle is loading for 20 minutes just so you can open the project
so how can i remove the tpa from the list after some time and refresh the list in the hashmap?
anyway, then i guess you just create a scheduler when the request is created, and cancel it (and remove the request) after X time
happens literally every single time
gradle moment
From memory so fix any typos
private static Map<UUID, Instant> timeout = new HashMap<>();
public isExpired(UUID id) {
return !timeout.getorDefault(id, Instant.now()).isAfter(Instant.now());
}
public void setTimeout(UUID id) {
timeout.put(id, Instant.now().plus(10, TimeUnit.SECONDS);
}```
i than have to put the new list into the hashmap right?
fastest gradle load time
yea, you essentially do the same as before when adding, but instead you remove it from the list
another issue is when IJ comes up with indexing for 30 minutes
yk what
but I haven't experienced that for a while
lmao
good times
my downloads dir would take longer
i mean, it indexed my whole installed steam library
lol
lmao
about 200gb
Does not every ItemStack has ItemMeta ?
i think some don't
Air doesn't have item meta
whats the requests and TPArequest
"record" is just a class
that automatically does some fancy stuff
In my case its a blaze rod, but i need item meta to use PDC, right ? 😅
yes
where does minecraft store whether a chunk is a slime chunk or not? when working with fabric
But why i get
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because "itemMeta" is null
what
huh
Show your code
create a new record called "TPARequest"
the same way you create a new class, just a record instead
whats a record 💀
?
wait
ij cant create records?
just create a class then, and change the "public class" to "public record"
and replace it with what i sent
IDE knows that
17
mm
it can if you are using the right java version
yea paste what i sent
Records were added in jdk 20
kappa
The itemstack will be passed through a few methods but at all it's this:
ItemStack itemStack = player.getInventory().getItemInMainHand()
ItemMeta itemMeta = itemStack.getItemMeta();
NamespacedKey key = new NamespacedKey(this.plugin, "bw-" + path);
PersistentDataContainer persistentDataContainer = itemMeta.getPersistentDataContainer();
you drunk?
16 take it or leave it
16?
I bet it was somewhere around 15
ya
but the record is red
it dont exsits for me
where can i see this 💀
press ctrl+alt+shift+s
Make sure the item isn't air
It is not air, i have blaze rod in the hand 😄
If your language level is set to any lower than 16, it doesn't matter the java version you are using
both the jdk and lang level should be at least 16
SDK?
JDK
yea i'm confused
the fuck
done i try
17 has it
nah it dont
Check module version
tf
it doesn't
You are probably using a different language level for module
fuck it, ima see what tf ij is doing
i have this
its red tho
That's not it
why
Record is probably a class called Record
@shadow night you will probably have fun with this if you really need to modify the slime chunk stuff
cna you hover over it, an see what it says
it's a keyword it should be lowercase
yea
Try creating a class which extends Record
damn
😳
it has them
Remove my ban from spigotmc