#help-development
1 messages · Page 872 of 1
It is, a Mean and Median over time would be valuable, but just Tps is pointless
mspt is probably a bit more useful
if Mean and Median a far different you have a problem
i remember that... 
The other fork also exposes the average MSPT.
nope.. md wanna get and i dont wanna get xd
final double tps = StrictMath.min(plugin.getServer().getTPS()[0], 20.0);
final double mspt = plugin.getServer().getAverageTickTime();
like many others xd
mspt is quite pointless too
not unless you have Mean and Median, or all teh values to come to the average
They might actually provide that.
[INFO] Server tick times (avg/min/max) from last 5s, 10s, 1m:
[INFO] 0.4/0.3/0.6, 0.4/0.3/0.6, 0.4/0.3/1.2
three values 0, 100 and 100 averages (Mean) of 66, (Median) would be 100.
very old pr xd
without both mean and median you can;t tell how it's performing
I think they expose a big array of tick times, so you can calculate whatever you want.
an array would be useful
im trying to compile a plugin but when its compiled its throwing a non nms class in a class
Error java.lang.NoClassDefFoundError: net/minecraft/world/level/ItemLike
afaik this doesnt exist
Did you reobfuscate
any more details... dependency, how build
1.20.4?
and in gradle not custom config for relocate or any?
check the config for build then.. i not know about gradlew then cannot help more xd
?paste the build.gradle
its made for 1.20.4
Why is that build file so overloaded with useless stuff
but why is that ItemLike class being thrown in
it looks like the default mc dev one
but the issue is probably compiling
try and run the reofbJar task directly
All that java version stuff is so useless and the processResources thing is also stupid
the what
the task called reobfJar
tasks>paperweight>reobfJar
Why doesnt build simply depends on reobf lol
who knows
And what about shadowJar
iirc paperweight just uses shadow if its enabled by def
Shouldnt the output of shadow be the input of reobf
reobf automatically uses the output of shadow
If present
all I do is build.dependsOn reobfJar
i'm honestly so confused
why isn't the item updating: https://pastes.dev/mufBbVsqMI
it adds the keys but once i close the GUI it resets the data
yeah meta is a clone, so unless your item.editMeta applies back to teh item it's not being set
yeah but?
shouldn't it automatically set the item meta since im using editMeta instead?
hmm, well the item works up until i close my gui
then it resets them
i can share my other class if you'd like
line 23 in your post seems to just call editMeta without caring if it returns true or false
What do you mean by it resets them?>
let me make a video rq
resets what exactly?
so whenever i close my gui it seems like it doesn't apply the datacontainer correctly?
sorry wifi hella slow
I have no idea whats going on in that video
okay so i'm upgrading which works and updates the correct line
but everytime i close the gui and open it again to upgrade the enchant again it seems to be reset so it creates a new line
which means the data isn't set
every time you mouse over teh pick it looks identical to me
Video is alwasy shit, describe with words.
from what you have said, it sounds like you are calling Inventory#update() when you close the UI
probably overwriting any changes you made
yeah but it should be grabbing the player's held item everytime
and i'm honestly not sure what's wrong
nah i just do player.inventory.setItemInMainHand(item)
you are doing this in teh click event?
yeah i do this:
data.gold -= enchantValue.toInt()
upgradeEnchant(player, heldItem, dataContainer, enchant, i)
newGUI.refresh()```
every click
here let me just send you the whole file
ik its messy i usually write messy code then rewrite some of it
is a in memory database like redis or some kind of messagebroker the only approach when syncing data across multiple minecraft servers?
plugin messaging?
Or use pmc if there is a player on them
redis or a messagebroker is faster than those too approaches tho, right?
no
which one would be good ?
depends on your usecase
i want to sync data across servers
like coins
currently im caching the data from the db when a player joins, but that doesnt work anymore as the servers dont share their memory
if you have more than one item then redis
wdym by more than one item?
If you are just passing a value around then use the simplest method. PMC or direct coms. If you are needing more info like Objects then redis
If you don;t need instant accss to the live values then just a shared MySQL
ie, you can wait while you read the data
wouldnt that be extremely slow tho compared to cached data?
yes
and isnt redis extremely slow compared to on server cached data?
If it's just money you don;t need fast access though
Nothing will be as fast as in memory data
it is, but everything that has to sync to other servers takes time
i mean what if i dont sync it to all the servers and just take it from redis instantly?
then why use redis at all?
it would still be faster than any database, or not?
of course not
why not
but why should accessing redis directly be bad, isnt it what it was made for?
what do you mean by bad?
.
redis is for syncing data between systems with fast memory access
if you are not doing any sync then theres no point in redis
You are forgetting that these servers still have to communicate with redis and not entirely sure if redis can use unix sockets but even if it could only the applications on the same system as redis could use unix sockets
The advantage of in memory cache like redis isnt just the fact it can be fast. The data in memory isnt taking up hdd space and the other advantage is you dont need to increase memory allocation for your application just for in memory cache and instead move such allocations to a centralized application
Not sure why you are so worried about speed when i bet right now you dont even have that issue
Is there a way to change when my plugin loads on server start? Im pulling info from an api and if my plugin loads before it starts up my api is null
i know, but im worried about creating a full data structure based around something that may not be worth it in the end, I've googled like all day but there are like 0 ressources on how to properly sync data across servers or deciding what method would fit the best.
Just have a callback from your API call to enable the rest of your plugin 😄
IE, your request should be async, at the end when you receive something, enable it then (Typically called a callback, some might call it something else)
Because there is literally a million solutions. Stop worry about hypothetical problems you are not encountering and will most likely not encounter
Ok, unfortunately im still kinda new to all this and I dont know how I would set that up. Although I understand what you mean lol
Take a look into CompletableFuture, should be what you need without overcomplicating things
Ok perfect ill look into it.
The approach I'm working on currently is having one Redis Server that caches data from a mongodb and sends it back to mongo when the player leaves the proxy. While the player is on the proxy all the servers just insta access the data through redis. do you think this is fine?
declaration: package: org.bukkit.event.server, class: ServerLoadEvent
Beautiful that might work a lot better
Have no idea because i have no data to say one way or the other. You would most likely be fine without redis because i doubt you are encountering any problems
i need to use redis, how am i supposed to sync data across servers somewhat fast?
pulling directly from the database would be kinda slow
I do it without redis
just pulling it from the database?
Show me your test results on this claim and i will believe you
Any intellij experts here
i have no test results but I heard that you should ALWAYS cache your data
?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!
How can I get rid of the constant conditions warning for a specific method
I am not sure how slow or fast mongodb is. But i can tell you that mysql can easily handle over a million queries in just 1-2 seconds if not less
If you have a good CPU mongo can do similar, requires something decently fast though
You heard so now you are taking this as fact even though yesterday you were told otherwise by quite a few
At present it doesnt sound like you actually have a problem that exists that needs solving. So stop trying to solve imaginary problems you dont have
thats kinda true but building a system that could withstand a lot of force now is better than creating it later if the server may ever struggle
Except its not possible
A setup designed for heavy load typically doesnt do well with smaller ones
From what you explained time ago @inner mulch you would work and sync many data across many servers. So i would go into Redis is your best friend. And i wont make you lost time
okay, do you know if i can change json values in redis without replacing the entire value with the changed version?
Also since speed is what you are wanting even if you currently have no issues. Just know cache doesnt mean real time
much appreciate the help, however since ive split my api stuff from the onEnable method it seems to have a problem with it saying its not a class. But the error doesnt make sense, since the the class its mentioning is in the same method. example to follow
wdym by that?
Is statz your plugin?
No its the api Im grabbing for my plugin. This all worked before I moved it from the onEnable method. so im not sure why it would change. its saying unknown class
https://gyazo.com/c612bd801dfb7773c46c018e446c9ff6
A cache means to hold data so you are not accessing as often where it is stored. But this doesnt mean the data where it is stored cant change. If it does the cache is now outdated. Caching is the opposite of real time access
Make sure you have your imports correct
It should be, this all worked no problem before
Idk what before looked like, dont know the compile errors you have
All you showed me was a method
i dont understand what you mean by that, by "where it is stored"
Wait are you just grabbing API methods from another plugin, or is this a web request for an API? I was under the impression you were getting some web-api
just use plugin.yml's soft-depend/depend and your plugin will always load after that one
Yeah idk what they are doing lol
Yeah i had thought they were doing a web request with the wording they did XD mentioning waiting for an api to load haha
@ashen vessel (sorry wrong ping at first!)
use soft-depend if you want the plugin to continue loading without the plugin/api
Even more of a reason to not be worrying about imaginary problems because you dont fully understand the problems you are trying to solve utilizing systems and mechanisms you dont fully understand. Its almost the same line of thinking just putting a turbo on a motor makes everything better magically
sry wrong ping
its ok
cache = faster than sql query
They are not the same and cant be compared
Ahhhhhh, that would work yeah. Sorry I didnt specify. I didnt want to write a paragraph haha
player joins, cache filled with sql query, player leaves, cache emptied and sql data updated
Reason is this. Where does the data from the cache come from?
sql
How can I get rid of the constant conditions warning for a specific method
Right. So what happens when player changes server? Is the cache still valid? What happens if your application wasnt fast enough to update the stored data before its called by another server?
At what point is the cache no longer valid?
yes thats why we use redis
tahts why im here
With all these questions you can see cache is not real time data
yes, thats why im here, after switching servers my cache did bad stuff because apparently the join event is called before the leave event
Except this is the incorrect way to solve the problem
why would directly getting data from sql be the correct way
Because currently you are not hitting any limitations. The proper way to handle cache stagnating is to actually over time check your cache and if it has changed at some point update the db. The other problems you are not thinking of is what happens when a server crashes? Would the cache still be valid?
Redis doesnt guarantee integrity
In fact it doesnt guarantee your cache being up to date either
why, if all servers access the same redis servers it will always be the data they need to access
Because it isnt redis job to do such things
Leave something in the cache long enough and it will become stale. But anyways this is why you shouldnt be going around solving problems that dont exist and may never exist
Because all you are going to do is waste resources
The more things that need to run the more resources it will consume whether you need it or not
Any intellij experts here
So you should first just make something that works. Improve it in the areas that actually are in fact real problems by profiling and measuring
i made something that works
caching works fine
just not across servers, yet
Most of your problems are going to come from the way you coded it and misconfiguring db software
Alright guess you are one of those who isnt going to bother to learn or understand so i will just go back to doing my work
i want to learn, but you are just telling me to get the data directly from sql which is discouraged.
Discouraged by who? The unsuccesful people?
could someone tell me if im right using this. if a player doesnt have a permission
https://gyazo.com/715f77c45dc037edd7f0d0b171551c49
How much of sql do you even know? Odds are mysql is older then you
lol
how old are you if mysql is younger than you?
isnt mysql like 60 years old or something
Its older then me. I am 33 next month
ok
Nvm i am older then mysql
i cannot tell you as im not sure what it is supposed to do. if you provide more information i can tell you
By 4 years
the currentstate will change depending on which group I want to check. but im trying to see if the user has a permission group.whatevergroup and if they dont I run the code in the if statement
okay but do you want to run the code after the if statement too?
I dont have anything after
Anyways point i am saying is this. You read somewhere by some random that it was discouraged to access the db with no facts to back up the claim. This software has been around longer you been alive and used by billions and you just assume its somehow slow?
my server wont be hypixel, but hypixel for example caches their data too, after a server crash a rollback happens as the cached data couldnt be saved
if they do it, it has to be good
Yeah a rollback happens on vanills mc too
that should work as long as you registered the permission correctly
Because a crash didnt allow it to save
Hmmmmm, odd cause it doesnt seem to running although the stuff is correct
yes but rollback of data like coins cannot happen if coins are stored in a database as the database keeps it safe from the mc server crash
That isnt a claim against directly accessing db though
i guess you need to show the full code, maybe it stops on some earlier point?
https://gyazo.com/be0b17548ec6e903dea2a35d88f4eed8
It runs the consnole message right before the if statement
if hypixel uses cache, cache has to be good
are you op on your server
if this is the case, operators have all permissions by default, if not set otherwise, therfore the code cannot run as you will always have the permission
Yes but it shouldnt matter the command is run through console
wdym
you are checking if(!player.haspermission)
this if statement WILL NEVER work if you are op as you have all permissions
Hmmm, seemed to work previously. Let me try with my alt account that doesnt have op just in case
you can /deop or you remove the "!"
You dont have 200-300 servers with 30k players
But that comment there proves my point on what i have said
Also mysql has query caching
Meaning if something needs what was queried some time ago it is most likely cached and it gets served super quick
But again you lack knowledge and understanding of these systems to the point you believe random online stuff saying mysql is slow or something and isnt. In some scenarios it can be or if you mange to have literal multi million queries
But i digress i guess.
Can someone just point me to a gradle equivalent for mavens provided scope? Everything online is seemingly making this way more complicated than I remember...
Have no idea why i cant find anything online, this use to be just a on-liner... Using the java plugin with gradle + compileOnly ( and implementation )yields no dependency in my final jar ._.
And the MC Java plugin for intellij has been SUPER bad lately, has anyone else noticed this? All these cool features like this ^ are just seemingly gone from any new project i create :/ Shoot sometimes it wont even include the right libraries
compileOnly
Have been pulling my hair out for 20 minutes, that one doesnt work :/
It should if you need to shade things use the shadow plugin
And apply implementation scope to everything you need shadowed
Shadow plugin wants to include everything lib and make a 90MB jar :c
even when i make a task to not include them
like...
tf?
You can relocate and minimize as well as exclude packages eith shadow jar
This is done in the shadow Jar settings you shouldn't need a task for this
When tf did gradle become so overly complex?
I remember just being able to add implementation and build it...
Where did this functionality go? is this some plugin or some shit?
It's still like that?
If you're using mc dev plugin they give you the most god forsaken starting gradle file
yep... ive been noticing that lately
It used to generate really good ones
now any gradle file it generate half works, im lucky it it even imports the right libraies half the damn time
did they like lose a developer or something XD? Even tried a complete re-install of intellij over it and the plugin still doesnt prepare correct gradles for MC environements
?paste
This is what I use works fine for me I generally stay away from mcdev it's always caused me memory leaks and doesn't do anything more than a nice template can do
(Its a forge one, but Ive had this working with forge in the past)
https://paste.md-5.net/qobipugevu.php (spark is the lib im trying to add in)
Even for spigot and velocity it generated the most broken gradle files that barely function (IE, not compiling dependents and provided broken libraries i have to fix)
Could be an issue with the forge plugin
I don't use forge so I wouldn't know but as far as spigot is concerned I've had no such issues making coherent and easy to use gradle files
imma reinstall gradle maybe somethings fucky on my end
even stuff for spigot it doing this (dont have a project open rn for spigot, just velocity atm and this)
forgegradle is also terrible
you're going to have a much better experience with architectury loom
ty for the reccomendation on that, defo will give that a whirl Oh neat the mc dev plugin actually has it built in too
Yeah forge gradle is aweful, but dont really thing it would cause something as simple like this to- yknow imma just shut my mouth there 
honestly i learn more random facts in here then i do at school
i did not know sql was a language
I really don't understand why that events are so unpredictable
💀
Function<Enchantment, ItemStack> eBook = ench -> {
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta meta = (EnchantmentStorageMeta)book.getItemMeta();
assert meta != null;
meta.addStoredEnchant(ench, ench.getMaxLevel(), true);
book.setItemMeta(meta);
return book;
};
i understand now why functions are amazing
val eBook: (Enchantment) -> ItemStack = { ench ->
ItemStack(Material.ENCHANTED_BOOK).apply {
val meta = itemMeta as EnchantmentStorageMeta
meta.addStoredEnchant(ench, ench.maxLevel, true)
itemMeta = meta
}
}

wait what
Just a JVM language
oh ok
Yeah java interop
Sure. Don’t listen to this server though, they like to shit on kotlin for no apparent reason most of the time
Make ur own judgement about it like alex did
i like doing my own research on things anyway
instead of blindly following everyone elses oppinions
kotlin is made by the creators of intellij btw (jetbrains)
gotcha
yeah most of their arguments are 99% bullshit
Not only just random but majority of the time also useful
Unlike school you can learn some facts but there like useless ones lmao
This. This is what people need to do more. Research the stuff make your own opinions and then you will have better informed questions to ask
seriously
you have 0 idea how many people ive ran into who say the stupidest crap
and say "oh well x said y so it must be true"
Its useful to me so yeah
Prime example being earlier some few hours ago lol
The part that irks me the most though other then people not researching is when they are in fact talking to the knowledgeable people who actually use and know the things you are trying to do and then ignore what they have to say lol
I want to learn, I really do, so I research as much as possible
I research not because i dont believe people but sometimes they may leave some details out of course not necessarily on purpose
If I ever feel like "oh something here feels wrong" I do research on what they are talking about
And then there are times where I am wrong
And I take those moments on the cheek obv
This right here is the reason i know so many things. Not only do i research but i actually do try out stuff for myself
Just to see how easy was it to use. How well does it work etc
My issue is I dont know what to search in the first place LMAO
anytime someone drops a word I dont know I search it up
For example 1 thing I want to improve is how im mangaging stuff in my plugin
Right now the hirarchy tree is
Manager < Sub Managers < Objects
And ive never done research directly into trees and hirachys so thats 1 topic I am trying to learn
I cant really count the various types of servers i have set up just because i wanted to see if my system could run it lol. When i hat my 1999 xp gateway with 4gb of ram and a pentium 3. I was able to run 10 different kinds of servers lol
God damn
Honestly i just use shockbyte cause im lazy
But ive hosted servers on rasperry pis
and they work fine
Well if you do stuff like that it goes to show also that these servers dont need a lot of resources to perform either lol
A lot of issues with peoples servers is either garbage memory or really inefficient coding w/ plugins
If you take a vanilla mc server it runs fine
From my personal experience at least this may vary
I had a WoW, pvpgn which is battlenet, pso which is phantasy star online, apache, mysql, ftp, and some others
ill show you my structure later if u want
sure
ive never used sql speaking of
i use yamlconfigs to save user data
which is really bad on my end but it
somehow functions
well
Thats fine, if you havent encountered issues so be it
Its a small server so its nothing I need to worry about right now
Dont fix what isnt broken
If I start to get a heavy playerbase I will change it as I have a feeling that
It will crack under pressure persay
Depends
Essentials uses yml to store economy for players by default
And you dont start having issues until you have like a million files lmao
Becauee it only stores like 2 lines
I havent encountered issues yet but 1 thing I want to do is have a onChanged function that gets fired whenever a value changes
cause in the past I had a mage system w/ mana that slowly increases every tick
That is not hard at all to implement
I assume it isnt I just have very little experience with creating consumers
The last consumer I made was a "Confirm gui" that was callable from anywhere
In fact you can leverage the OS for the api call to detect file changes
didnt you write a function earlier? well the consumer is the same thing just without a return value lol
Just record the modified time, every so often check if it changed
I did yes, that was litterally after reading a single page of a website and deciding to try to implement it
Gotcha
There is an OS api method in File api i think that lets you grab this
I can always go braindead, have a value called lastUpdate in the file with the last currentTimeMillis update
If not there should be something in system api
i think its lastModified
long lastModified = file.lastModified();
yeah it is to grab the last modification date of a file
there exists chest.getBlockInventory(), but I cant seem to find something to set the block inventory
what would it be?
But game has Recovery Compass built into it. Maybe somehow it's possible retreive players last death location from that?
Not sure if API exists though.
Nevermind, getLastDeathLocation is something as well, I'll check that :)
@eternal oxide is there a difference of instantiated itemMeta and non-instiantited
every instance of ItemMeta is an... instance, but they are not all the same instance
Ah wait
every time you getItemMeta you are given a NEW copy of the meta
all the internal values are teh same but it's a completely different instance
I rmemeber some objects shoudlnt be instantiated
if you want to make changes to an Items Meta you MUST always setItemMeta to replace the current Meta on the ItemStack
ItemMeta meta = game.getItemStack().getItemMeta();
meta.setDisplayName("lol");
game.getItemStack().setItemMeta(meta);
yes
What if i just game.getitemstack.getitemmeta.setdisplay("lol");
its lost
nothing would happen
Why tho isnt it returnjng the same object
Its impossible to modify the meta on an ItemStack. You alwys get a copy, modify it and put it back to replace the current
getItemMeta returns a copy of the itemmeta
so modifying the returned copy does nothing by itself
You can make a method that handles item meta changes and applies it after it's done automatically*
or just call the method and move on with your life
public static <T extends ItemMeta> void modifyMeta(ItemStack stack, Class<T> metaClass, Consumer<T> action) {
if(stack == null) {
return;
}
final ItemMeta meta = stack.getItemMeta();
if(!metaClass.isInstance(meta)) {
return;
}
final T casted = metaClass.cast(meta);
action.accept(casted);
stack.setItemMeta(meta);
}
Something like this
good
ItemUtil.modifyMeta(myItemStack, SkullMeta.class, (skullMeta) -> {
...
});
Might need a null check to see if the item even has meta in the first place
But those are minor details
Now just make this an ItemStack method and PR this
just fix ItemMeta 
what's wrong with declaring ItemMeta itemMeta ... itemStack.getItemMeta() and so on. I think this is better and it's clear of whats going on
instead of SkullMeta.class..
.class shouldnt be really used anywhere
I mean, we'll get some helpers once coll's ItemType stuff goes through
Cool kids just use
final ItemStack armor = ItemType.DIAMOND_LEGGINGS.createItemStack(a ->
a.setTrim(new ArmorTrim(TrimMaterial.EMERALD, TrimPattern.COAST))
);

how could I create an anvil GUI and get the text from the text box?
I would recommend
https://github.com/WesJD/AnvilGUI
isn't it possible without NMS?
anvil class was never finished
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/AnvilInventory.html#getRenameText() this doesn't work ?
declaration: package: org.bukkit.inventory, interface: AnvilInventory
Does that work after you take out the item tho ?
I think there were some problems with that.
idk, im asking
You can't create AnvilInvdngory
Unfortunately you have to use nms it's pretty easy nms though lmk if you want it
sure
CraftPlayer player;
ServerPlayer splayer = player.getHandle();
AnvilMenu menu = new AnivlMenu(splayer.nextContainerCounter(), splayer.getInventory(), ContainerAccess.create(splayer.level(), splayer.blockPosition()));
menu.setTitle(Component.literal("thing");
player.openInventory(menu.getBukkitView());
Lol that other test was a copy paste from earlier xD
It was finished ?
The Inventory API simply isn't up to spec with modern requirements
thanks :)
was it
y2k with pink name
Yes
It does everything it was implemented to do there is no unfinished portion
Fr frost hooked me up
so how do you know when someone repairs an item? with a custom anvil gui, created by code
is there an event?
how do you detect clicks and dragging on an anvil gui
You can't make a custom gui
that's exactly my point
That doesn't mean the api isn't unfinished though
Not really it does its best
thats very optimistic
Lemme send you a link to my solution that's currently a PR that allows for this shit behavior to continue
I'm very adamantly against createInventory at this point though
I myself would prefer to just deprecate it tbh, but idk
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftInventoryBuilder.java?at=9ab78ce100d9b0c33b6d789b3fdfa1895b7dbf46. I mean the other option is patching Every single Menu like this
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/subcontainer/CraftMultiCraftResultContainer.java?at=9ab78ce100d9b0c33b6d789b3fdfa1895b7dbf46
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/subcontainer/CraftMultiInventorySubContainer.java?at=9ab78ce100d9b0c33b6d789b3fdfa1895b7dbf46
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/subcontainer/CraftMultiTransientCraftingContainer.java?at=9ab78ce100d9b0c33b6d789b3fdfa1895b7dbf46
this entire thing is held together by the hope and prayers mojang keep it possible
the current implementation is much safer, but you lose out on actual functionality
hm
imho people should just create inventories and menus with this API https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/inventory/MenuType.java?at=75528781e38a29a637f0577a3ed9d4263ae667f0
and we need to ditch the weird shit
damn
you should see the goofy ass schemes I do to transfer cash between paypal and my bank
how to check the itemstack inside the anvil?
you can just use InventoryClickEvent and the other events like you normally do
just make sure its your AnvilInventory
if your confused about this check out this thread.
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
if I put an item inside the slot and it's "Enter an username", I don't want to let the player to edit an item display-name
basically removes it from the gui
I'm not good at explaining, but is there a way to do that?
you have to edit a display name
that's how anvils work
you can just remove access with InventoryClickEvent of putting items in and add a custom item
it can probably just be GRAY_STAINED_GLASS
That's how anvils work internally you can't change that
That's why AnvilInventory doesn't provide setRenameText it's tied to the item name
LIGHT_GRAY_STAINED_GLASS_PANE >>>>
I did!
NameItemPacket
what if darkmode
is there a way to get the last damager of an entity on entity move event without caching it?
that one
but
i dont know how to get the last damager from that
Check if it's an EntityDamageByEntityEvent and then get the damager from that
public void onEnable() {
getServer().getPluginManager().registerEvents(new MyCodes(),this);
}``` Hi , is this code right for registerevents ?
yes
so why i get this error ? Could not pass event PlayerJoinEvent to autologin v1.20
org.bukkit.event.EventException: null
?paste
put the whole error here
but
most likely the error is inside the listener
which means its definelty registered
yeah it is
it throws the error in the code of the listener
its registered alright
show me your listner
i will tell you whats wrong
ok wait
give me your whole error log
ahh
yeah i see
in line 17
you wrote Player player = (Player) event;
correct would be Player player = (Player) event.getPlayer();
oh , i forgot it
no worries
ok thanks
and why when i got ip will say '127.0.0.1' ? while i want getting my public ip
are you using localhost?
yeah but is there any way get my public ip in localhost ?
no
but
as soon as people join
from other networks
it will display their public ip
rn it displays the local one cause you are not connected to the server through the public one
you are connected through localhost
yeah i know this but is intersting
Can you check and say i got error now ? my code is https://paste.md-5.net/utaxekonig.java and my error is https://paste.md-5.net/yigadizowa.cs
how can i get the content of an inventory with the position of the item? (maybe like a Map or something Map<Integer, ItemStack>)
I'm pretty sure you can get a List of the inventory
And a list is basically Map<Integer, ?>
anyone can tell me what is the problem and how to fix it ?
getContents()
true, i forgot about it
returns an array. empty slots will be null
one sec
incorrect url
url should be jdbc:mysql://127....
ah yeah
or whatever you're using, if it's not mysql
is mysql
^this is not how you should use databases though.
make a seperate class
and call methods in that class
ok i will try it
survival was gamemode 0 or gamemode 1?
0
thx
1 was creative, 2 adventure, 3 spectator
spectator didn't use to be a thing :kappa:
Then creative got removed in favour of survival
yeah lol
@eternal oxide didnt work again sir
public void addPlayerToGame(Player p, Game g) {
g.getPlayers().add(p);
ItemMeta meta = g.getIs().getItemMeta();
meta.setDisplayName(g.getName() + " || " + g.getPlayers().size() + "/32");
g.getIs().setItemMeta(meta);
p.sendMessage("Lobiye katıldın..");
}```
sorry to ping
is this in inventory click event?
then you are not calling update on the inventory as I told you yesterday
being able to use + for collections in kotlin is one of the greatest things ever
kotlin is...
java in my heart
kotlin is just java with extra features
Kotlin is just java with shittier syntax
kotlin is just python
but java
The exact reason it has "kot" in it's name
what's weird abut it?
Hi, I'm creating a ball of particles that will then get bigger and bigger. But have a small problem, I don't want to spawn in new particles to make it bigger but just use the particles that are already there and make the particles go further out, is that possible?
Yeah jus resend same one and make it bigger
not even with nms?
I didnt say there's another way
no
okey
Well all im saying bro is i think ur overthinking it
You just need to resend it (same particle variable), instead of creating multiple, you can utilize this same particle but you have no choice but to spawn it again to show another different particle
Anyways why does it matter that you cant send multiple?
huh? I wasn't the person who asked on how to avoid spawning new particles
Hello
Omg apologies
Does anyone know if this is possible?
Read what i said please lol, i accidentally wrote that to wrong person
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#playSound(org.bukkit.entity.Entity,java.lang.String,org.bukkit.SoundCategory,float,float,long) the seed at the end
declaration: package: org.bukkit.entity, interface: Player
Thank you
hm I can't decide whether the short form is better or more complicated
private fun getAllTagResolvers(): Array<TagResolver> {
val defaultResolvers = tagResolverFactory?.getTagResolvers(concerns) ?: emptyList()
return (defaultResolvers + customTagResolvers).takeIf { it.isNotEmpty() }?.toTypedArray() ?: emptyArray()
}
Imo the short form is better but less readable, if you just do one thing it should be better
private fun getAllTagResolvers(): Array<TagResolver> {
val defaultResolvers = tagResolverFactory?.getTagResolvers(concerns) ?: emptyList()
return (defaultResolvers + customTagResolvers).takeIf {
it.isNotEmpty()
}?.toTypedArray() ?: emptyArray()
}
actually fuck it, I'll just return defaultResolvers + customTagResolvers
kek
private fun getAllTagResolvers(): Array<TagResolver> {
val defaultResolvers = tagResolverFactory?.getTagResolvers(concerns) ?: emptyList()
return (defaultResolvers + customTagResolvers).filterNotNull { it.isNotEmpty() }.toTypedArray()
}
I'd write it like this if I correctly understand your intentions
i only have to combine both. I thought it would be easier to just return one of the collections if the other is empty
Ah I see wym
then I decided fuck it, doesn't hurt to combine them anyway, eve nif one or both are empty lol
Yeah that's a +1 for readability lol

Best gamemode
Aha! I found the issue
the concerns(Player) method returned a new Message object but didnt pass customTagResolvers into the constructor and hence it used the default value of null
hm what do you think about these colors for the gamemodes? do they make sense?
survival = crafting, nature = green
creative = idk = blue
adventure = dangerous?? = orange
spectator = passive = gray
I personally think those are more or less the standard gamemode colours out there
idk I only looked at essentials and they always use the same color for each mode lol
&cSURVIVAL
&bCREATIVE
&aADVENTURE
It is probably safer to use NBT api than this:
NBTTagCompound compound = new NBTTagCompound();
entity.a(compound);
compound.setString("asd", "asd");
entity.f(compound);
?
Way safer
Much more readable to use an API
gradients :3
Oh im a 1.8.8 user so i dont have gradient knowledge
Yes. But still bad.
If you use NBT, at least use mojang maps. But why don't you use
- The MetaData API, or
- The PersistentDataHolder API if it shall be persistent
?
Too old! (Click the link to get the exact time)
hello everyone !
Doses anyone know a way to avoid collisiond between entity and player ? Here is a footage of my problem : https://imgur.com/a/00kKHm2, i teleport a mini slime every tick on a player but collisions anoy player movement :/
Setcollision# isn't working with me (1.20.4) :/
Hi , is there any way to check player is mojang user or isn't mojang user ?
on a offline server ?
No i just want to know the code for set a event with a if
a player is always a mojang user
If it's not offline server why would you need to check it
^
"know it !" not give me !
🙏
can I use MetaData in spigot 1.8 for custom tags?
that's one of the few things that were even available back in 1.8, yes
https://helpch.at/docs/1.8.8/org/bukkit/metadata/Metadatable.html
Entity extends Metadatable
but can I assign it to an example itemstack
you'd have to serialize your itemstack to json or sth and use a string i guess
if you're on 1.8 anyway, might as well just use NMS for NBT if they can store ItemStacks directly
yes, do you recommend api or raw deobfuscated nbt from spigot mappings
i'd just use NMS / Spigot mappings, it's not as if 1.8 would change anytime soon lol
ok nms
Is a config.yml the best way to save server wide data. For example, stuff like global tp locations for a TP command. Bc for player individual data, best is using a database, but for something that is global and isnt changed much, should i use a config?
if ur not planning to go cross server i'd say thats what configs are made for ?
Soooo i guess it is a yes
I mean
yea
If you want to save a ton of data SQLite is an option
I use SQLite for player individual data
I needed something for server sided stuff
Yeah you can still use SQLite
Seems like you want warps, sounds like a simple table
name, world, x, y, z
idk if you use translator but it's hard to undestand
In the end these are preset by me, so there wont be more than 10
no need to understand because i found my answer
great, besides it i understood, you wanted to protect your plugins from crack
I just dont feel like i need to make a whole new data base, just to have spawn locations
no because i need iranians and some russians and some countries can uses my plugin because some countries is blocked by mojang or microsoft for united states sanctions
usa?
💀
?paste
https://paste.md-5.net/aruzuceham.java beause dont go?
dont get error
the server block afther enable the plugin
Hi guys, im new to TextComponent
Can someone send me a base that transforms:
TextComponent.fromLegacyText("§cTest")
To a BaseComponent using ComponentBuilder
(Cause fromLegacyText is deprecated)
Obs: Without ChatColor, cause Test can be §cT§be§as§4t too for example
new TextComponent("test", ChatColor.RED);
new ComponentBuilder()
.append("test")
.create();
hello everyone, I had a question:
In my program, I would like the player to swim faster in lava. So, I ended up using 'player.setVelocity()' to carry out the project (it works very well).
However, it can't stop moving whether I put it in a loop or the On Move method.
Is there a way to detect when the player moves (with the keyboard keys for example)
Can i have it without ChatColor?
PlayerMoveEvent check for x y z changes
Cause Test can be multicolored with §
use a parseable format like MineDown
also don't use § most people don't have that on their keyboards
This TextComponent is Plugin -> Player
how can you not have § on your keyboard 😮
huh
Not Player -> Plugin
UK doesn;t have it either
it's Shift+3 for me
£ is shift + 3 here
that's a separate key next to return for me 🥲
and shift+# is '
I know this method, but if the player moves by velocity, does it also work?
PlayerMoveEvent is triggered every time the packet is recieved which iirc is every tick unless they are standing completely still
Is there a way to detect when the player moves (with the keyboard keys for example)
TL;DR: no
thank you, I will try
Even if the player does not move by themselves, the client sends a ServerboundPlayerInputPacket or however it's called (e.g. when pushed by water)
And it's also sent from time to time if the player does not move at all - in those cases, sure you can check if x,y,z changed
but as said, it's also sent for passive movements
vector math time
Guys, if I want to add item that's the same name,lore etc, and want to avoid stacking. What's best way of preventing it?
It's basically the old C03PlayerMovePacket that is sent periodically (once every second even when standing still) + when the player moves
add a nbt tag to make it unique
for example a tag with a random uuid
isnt pdc nbt under the hood
Is it possible to change the default Minecraft player model to a model you have made ?
I don't believe so unless you want to do some packet hacks
you'd have to turn the player invisible on the client and to all other players
and then do hitbox checks yourself
then you can track the player with a Display Entity
the API should actually provide you good enough methods to do this tbh hidePlayer to hide all players and then a texture pack plus display entity should beable to cover the rest
ofcourse their is a lot of event work to do seeing as you need to ensure your bounding box is adhered to
then apply damage etc etc etc
bump 🙏
Would it be easier to model armour, and when someone puts that combination of armour on there appearance will be that model ? @river oracle
imho i'td be tougher with the armor cuz it'd restrict your model size
it'd have to be bigger than the player
plus you wouldn't beable to easily extend the hitbox programatically around that model
@torn shuttle is the ultimate modeling nerd though frfr
hey im just here to ask a simple question: is it bad that im using windows for my network's architecture? like will it make it harder to scale and add new things?
Can I friend you @river oracle
no
for your home network? probably not. If this is a server you might want to consider switching to linux everybody and their mom uses linux servers so it'd be easier for you to obtain help with networking on linux servers
Do you take commissions
depends, but generally I stay away from what you're working with
?services
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/
Aww ok
and btw should i use multiple database instances for storing different data (permissions, punishments, economy and stuff) or just "CREATE DATABASE X;" in a single mysql instance and use that?
in 99.99% of cases the user people will use will not have permissions to create any databases
no
yes
ig I'm now confused what you are making here lol
i meant a database for player permissions like luckperms and stuff
CREATE DATABASE ... will fail on every shared MC hoster
I thought you were talking about home networking xD
because you can't make a minecraft server in "windows architecture" idk what that'd even entail
ig if you only used DOS to code it xD
should it be like:
MYSQL INSTANCE "PERMISSIONS"
- DATABASE "PERMISSIONS"
-
- TABLE ...
-
- TABLE ...
-
- TABLE ...
MYSQL INSTANCE "PUNISHMENTS"
- TABLE ...
- DATABASE "PUNISHMENTS"
-
- TABLE ...
-
- TABLE ...
-
- TABLE ...
or
MYSQL INSTANCE "GLOBAL"
- TABLE ...
- DATABASE "PERMISSIONS"
-
- TABLE ...
-
- TABLE ...
-
- TABLE ...
- DATABASE "PUNISHMENTS"
-
- TABLE ...
-
- TABLE ...
-
- TABLE ...
why do you need multiple tables for punishments
dude neither
also why are we creating new databases instead of just using tables?
you should have one server with one database
like isn't that the whole point of tables
mess
how is it a mess
yeah no shit, SQL data isn't meant to look pretty
its meant to be functional and effective
id much rather prefer all my data to be under 1 database
the more access i give, the more dangerous malware could be
Anyone with big brain? Willing to help me get formula
ig he won't listen anyway and continue to setup one sql server per table
yes but you shouldnt need more than 1 for 1 single server
you pinged me? that's cringe
you're cringe 
no
I only pinged you because I love you
wow I love me too, we have so much in common
we should get together and talk about how awesome I am some day
Yeah but his model system doesn’t use display entities yet
ya could just store it in a int array :P
I agree
lmk when you're free buddy
?
I'll get right on that as soon as I'm done hanging out with myself
I almost had a system with them working
private static final int[] SLOTS = {4, 3, 5, 2, 4, 6, 9, 3, 5, 7, 0, 2, 4, 6, 8};
alrighty
then moujank?
No then me being bad at 3D space
You misunderstood, i don't have 45 slots inventory. I just have 9 and want to set items coressponding to my list size
Just used this photo for ilustrating, every line of this inventory represnts other case
Is it possible to force-open the book editor, have the player write something in it and read the submitted text in the book back to the server? I know how to open a book through a packet, but how do I get the submitted text from the book back?
U should use the number on the slot not whatever at the side
Lol
declaration: package: org.bukkit.inventory.meta, interface: BookMeta
this could help
what?
you oculd simply write a method to capture part of the array based on the number given
1 captures 0
2 captures 1, 2
and so on
I want to open the editor without a book, so BookMeta is not going to work. I'm possibly looking for an NMS (+ packets) solution
Seems like more complexcity
could you show your code of opening book?
sure, but there is no way to do this without some form of loop.
e.g. the power of an equation dictates your amount of answers
There is, each time size gets bigger, items moves to left
you could do an equation that has like 1^rows that way you would get rows answers from your output, but its complex to derive an equation with ^rows answers
I meann, you are already hard coding it so.
nobody likes a rusty spigot
Hi
int slotsPerRow = 9;
int startSlot = slotsPerRow / 2;
public List<Integer> getSlots(int rowAmount) {
List<Integer> slots = new ArrayList<>(rowAmount * slotsPerRow / 3);
for(int row = 0; row < rowAmount; row++) {
int minSlot = startSlot - row;
int maxSlot = startSlot + row;
for(int column = minSlot; column < maxSlot; column += 2) {
int index = (row * slotsPerRow) + column;
slots.add(index);
}
}
return slots;
}
@proper cosmos Something like this
fuck he beat me to it
how can i disable the working of a command for someone who didn't have a permission from another plugin
class PitDamageEvent:
PriorityQueue<PriorityRunnable> actionQueue
DataContainer<Object> data
Is this an OK system cause I am dealing with a lot of priorities and a bunch of aspects add their own data to the event
DataContainer is as simple as DataContainer#get(Class) and #put(Class, ...)
so a map wrapper
I think
if(player.hasPermission(String permission)) {
//command
}
ye but i have to interacti with the another plugin command it will work too?
If its your plugin
i want to interact to another plugin command that the problem
I guess taht wont work
You gotta code it yourself or ask the dev
You can work around it tho
i want to block the command if you don't have the permission
You can listen to the commandpreprocessevent and cancel it under the condition that it is the command and the player doesnt have the permission
oh ok thx <3
Are there any good resources on performance? How much is reasonable to do every tick?
And is there a way to make a player transparent but not invisible?
does anyone have a link to to that forum post about that dependency with saving bukkit objects as json?
I cant find it anywhere
whats wrong with yaml
I found it
idk, I feel like yaml should be used for configs and json should be used for data storage
Hello! i am having problems with building my plugin, it usally takes 3-5 seconds but now its taking 1:08m. its only a couple megabytes, is there anything i can do?
why do you feel like that
maven
idk, my heart
you could try switching to gradle it might help, as it has caching
1.22Mb
yeah thats pretty big, try switching to gradle as gradle has caching
Gradle builds way faster for me usually
its dying already lol
its taking forever to get "repository-haoshoku"
which im guessing is nickapi
amen
i think i found the problem
the haoshoku repo is dying
or my wifi is dying
there we go
its faster now that i added it to system instead of downloading remotely
2 months ago i would have not had any idea what that scentence means
Yaml > Json
Yaml is amazing. No weird formatting issues, quick data extraction, very human readable, no unnecessary symbols, supports lists & arrays, can have empty sections with empty sections with empty sections, SUPPORTS COMMENTS, I could go on and on.
How i can detect if stair is in water?
k
What is the event for picking up an item in the inventory?
Because InventoryClickEvent doesn't work
if you click on it and you pick it up with your cursor
basically, but just holding it with your cursor
well ur doing something wrong then cuz that will work with InventoryClickEvent
did u register the event?
How can I forcefully open a book editor and get the written book back on the server?
pretty sure thats still client side unfortunately
God damn
What would be a good alternative to a text editor?
The chat has a limited character amount. I am looking for something of an alternative
whats got u letting users type in whole paragraphs
notepadd++
?paste
sorry for the stupid question but, why this doesn't work
Bukkit.getPluginCommand("mycommand").setExecutor(new Command());
i put that in the main class, in the on enable method
is "mycommand" in your plugin.yml ?
yes
also why are u using such a scuffed methodf
what version is this for
and
1.16.1
this.getCommand?
i test
dont work
An internal error occurred while attempting to perform this command
then
the error
is probably in the command
not here
show your command
the code for the command
thats where the issue is gonna be
Making a plugin where players can submit reports
I can assume some player/bug reports can be bigger than what the game's chat allows
check dm
Does anyone happen to know how I can set the JDK used to compile a maven project via the command line (or via a settings.xml file)?
Without changing the JAVA_HOME that is.
In Intellij? 
(Has a virtual environment)
Nah, jenkins technically
Hm
Jenkins can set jdk toolchains
Problem is I have no idea how that is done. I don't really remember if I have even set a default
Cant you... create an environment for a pipeline and set its env parameters?
But this will change it for all pipelines
I found something for scripted pipelines:
node {
jdk = tool name: 'JDK17'
env.JAVA_HOME = "${jdk}"
...
}
Welp, md_5s approach worked
slay
Noice
Is there a way to make players transparent instead of hiding them completely?
is there a way i can check for the items on the cursair
give them invisibility?
Inventory click evebt
getItemOnCursor I think
If anything this'll trigger InventoryClickEvent at slot -999 and use InventoryClickEvent#getCursor
without inventory clic event
you don't
Not really, no
or intercepting packets I suppose
transparent with their ghosts visible, and preferably only for a certain player
But you can store the last event so it is persisted so that you can do something with it later on
no, no i dont think so
yh ig
YALL LIED TO ME
I CAN GET IT FROM THE INVENTORY OBJECT
LIARS
NOT EVEN
I CAN EVEN GET IT FROM THE PLAYER OBJECT
Ok
how can i use the config yml outside main class
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
maintenance
Ah right the wiki is part of spigotmc
xd
Either way you just pass it through constructors into other classes