#help-development

1 messages · Page 872 of 1

young knoll
#

That’s literally just what the values are internally

eternal oxide
#

It is, a Mean and Median over time would be valuable, but just Tps is pointless

young knoll
#

mspt is probably a bit more useful

eternal oxide
#

if Mean and Median a far different you have a problem

late sonnet
#

i remember that... SAD

young knoll
#

Did we never settle on a name

#

:p

next plume
#

The other fork also exposes the average MSPT.

late sonnet
young knoll
#

F

#

And thus to PR purgatory it goes

next plume
#
final double tps = StrictMath.min(plugin.getServer().getTPS()[0], 20.0);
final double mspt = plugin.getServer().getAverageTickTime();
late sonnet
eternal oxide
#

mspt is quite pointless too

next plume
#

It's pretty useful.

#

If you see it up around 45, you better watch out.

eternal oxide
#

not unless you have Mean and Median, or all teh values to come to the average

next plume
#

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
eternal oxide
#

three values 0, 100 and 100 averages (Mean) of 66, (Median) would be 100.

late sonnet
#

very old pr xd

young knoll
#

Tbf most of them are waiting on author input

#

But then author goes MIA

eternal oxide
#

without both mean and median you can;t tell how it's performing

next plume
#

I think they expose a big array of tick times, so you can calculate whatever you want.

eternal oxide
#

an array would be useful

atomic swift
#

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

young knoll
#

Did you reobfuscate

atomic swift
#

?

#

no

#

im just compiling a plugin

late sonnet
atomic swift
#

its through ij Gradle builkd

late sonnet
#

1.20.4?
and in gradle not custom config for relocate or any?

atomic swift
#

no 1.20.2 idk what version the plugin is

#

looks liek 1.20.4

late sonnet
#

check the config for build then.. i not know about gradlew then cannot help more xd

atomic swift
#

idk anything about gradle

#

thats why i compile in ij

remote swallow
#

?paste the build.gradle

undone axleBOT
atomic swift
remote swallow
#

its made for 1.20.4

tender shard
#

Why is that build file so overloaded with useless stuff

atomic swift
#

but why is that ItemLike class being thrown in

remote swallow
#

it looks like the default mc dev one

#

but the issue is probably compiling

#

try and run the reofbJar task directly

tender shard
#

All that java version stuff is so useless and the processResources thing is also stupid

atomic swift
remote swallow
#

the task called reobfJar

atomic swift
remote swallow
#

tasks>paperweight>reobfJar

tender shard
#

Why doesnt build simply depends on reobf lol

remote swallow
#

who knows

tender shard
#

And what about shadowJar

remote swallow
#

iirc paperweight just uses shadow if its enabled by def

tender shard
#

Shouldnt the output of shadow be the input of reobf

young knoll
#

reobf automatically uses the output of shadow

#

If present

#

all I do is build.dependsOn reobfJar

tender shard
#

Also why the legacy way for lombok

#

Proper way is the plugin

rare rover
#

i'm honestly so confused

#

it adds the keys but once i close the GUI it resets the data

young knoll
#

Do you can setItemMeta

#

I can’t tell because Kotlin :p

eternal oxide
#

yeah meta is a clone, so unless your item.editMeta applies back to teh item it's not being set

rare rover
#

yeah but?

#

shouldn't it automatically set the item meta since im using editMeta instead?

eternal oxide
#

looks good

#

are you checking the return value of editMeta?

rare rover
#

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

eternal oxide
#

line 23 in your post seems to just call editMeta without caring if it returns true or false

rare rover
#

wdym?

#

the consumer is ItemMeta?

eternal oxide
#

What do you mean by it resets them?>

rare rover
#

let me make a video rq

eternal oxide
#

resets what exactly?

rare rover
#

so whenever i close my gui it seems like it doesn't apply the datacontainer correctly?

#

sorry wifi hella slow

eternal oxide
#

I have no idea whats going on in that video

rare rover
#

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

eternal oxide
#

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

rare rover
#

yeah but it should be grabbing the player's held item everytime

#

and i'm honestly not sure what's wrong

eternal oxide
#

do you call update?

#

anywhere?

rare rover
#

nah i just do player.inventory.setItemInMainHand(item)

eternal oxide
#

you are doing this in teh click event?

rare rover
#

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

eternal oxide
#

I only need that answered

#

ok

#

in the javadocs

rare rover
#

ah, i've also never tried it without editMeta

#

consumer so

inner mulch
#

is a in memory database like redis or some kind of messagebroker the only approach when syncing data across multiple minecraft servers?

young knoll
#

No

#

You could just send raw requests between them

inner mulch
#

plugin messaging?

young knoll
#

Or use pmc if there is a player on them

inner mulch
#

redis or a messagebroker is faster than those too approaches tho, right?

eternal oxide
#

no

inner mulch
#

which one would be good ?

eternal oxide
#

depends on your usecase

inner mulch
#

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

eternal oxide
#

if you have more than one item then redis

inner mulch
eternal oxide
#

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

inner mulch
eternal oxide
#

yes

inner mulch
#

and isnt redis extremely slow compared to on server cached data?

eternal oxide
#

If it's just money you don;t need fast access though

#

Nothing will be as fast as in memory data

inner mulch
#

redis is called a in memory database

#

i thought it would be as fast :(

eternal oxide
#

it is, but everything that has to sync to other servers takes time

inner mulch
#

i mean what if i dont sync it to all the servers and just take it from redis instantly?

eternal oxide
#

then why use redis at all?

inner mulch
#

it would still be faster than any database, or not?

eternal oxide
#

of course not

inner mulch
#

why not

eternal oxide
#

SQLite is fast

#

its a database

inner mulch
#

but why should accessing redis directly be bad, isnt it what it was made for?

eternal oxide
#

what do you mean by bad?

inner mulch
eternal oxide
#

redis is for syncing data between systems with fast memory access

#

if you are not doing any sync then theres no point in redis

quaint mantle
#

It is fast

#

And have persistence

wet breach
#

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

ashen vessel
#

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

inner mulch
noble lantern
#

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)

wet breach
ashen vessel
#

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

noble lantern
ashen vessel
#

Ok perfect ill look into it.

inner mulch
ashen vessel
#

Beautiful that might work a lot better

wet breach
inner mulch
#

pulling directly from the database would be kinda slow

wet breach
#

I do it without redis

inner mulch
wet breach
quaint mantle
#

Any intellij experts here

inner mulch
inner mulch
undone axleBOT
#

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!

quaint mantle
#

How can I get rid of the constant conditions warning for a specific method

wet breach
#

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

noble lantern
#

If you have a good CPU mongo can do similar, requires something decently fast though

wet breach
#

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

inner mulch
wet breach
#

Except its not possible

#

A setup designed for heavy load typically doesnt do well with smaller ones

sterile token
#

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

inner mulch
wet breach
#

Also since speed is what you are wanting even if you currently have no issues. Just know cache doesnt mean real time

ashen vessel
ashen vessel
wet breach
# inner mulch wdym by that?

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

wet breach
ashen vessel
#

It should be, this all worked no problem before

wet breach
#

Idk what before looked like, dont know the compile errors you have

#

All you showed me was a method

inner mulch
noble lantern
#

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

wet breach
noble lantern
#

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

wet breach
noble lantern
#

sry wrong ping

inner mulch
inner mulch
wet breach
#

They are not the same and cant be compared

ashen vessel
inner mulch
#

player joins, cache filled with sql query, player leaves, cache emptied and sql data updated

wet breach
#

Reason is this. Where does the data from the cache come from?

inner mulch
#

sql

quaint mantle
#

How can I get rid of the constant conditions warning for a specific method

wet breach
#

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?

inner mulch
#

tahts why im here

wet breach
#

With all these questions you can see cache is not real time data

inner mulch
wet breach
inner mulch
wet breach
#

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

inner mulch
wet breach
#

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

quaint mantle
#

Any intellij experts here

wet breach
#

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

inner mulch
#

caching works fine

#

just not across servers, yet

wet breach
#

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

inner mulch
wet breach
inner mulch
#

CRUD

ashen vessel
wet breach
#

How much of sql do you even know? Odds are mysql is older then you

inner mulch
#

how old are you if mysql is younger than you?

#

isnt mysql like 60 years old or something

wet breach
#

Its older then me. I am 33 next month

inner mulch
#

ok

wet breach
#

Nvm i am older then mysql

inner mulch
wet breach
#

By 4 years

inner mulch
wet breach
#

I said mysql

#

Not sql language

#

Sql itself isnt a db

ashen vessel
inner mulch
ashen vessel
#

I dont have anything after

wet breach
#

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?

inner mulch
#

if they do it, it has to be good

wet breach
inner mulch
wet breach
#

Because a crash didnt allow it to save

ashen vessel
inner mulch
wet breach
#

That isnt a claim against directly accessing db though

inner mulch
ashen vessel
inner mulch
inner mulch
ashen vessel
inner mulch
#

you are checking if(!player.haspermission)

#

this if statement WILL NEVER work if you are op as you have all permissions

ashen vessel
#

Hmmm, seemed to work previously. Let me try with my alt account that doesnt have op just in case

inner mulch
#

you can /deop or you remove the "!"

wet breach
#

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.

noble lantern
#

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

noble lantern
#

Have been pulling my hair out for 20 minutes, that one doesnt work :/

river oracle
#

It should if you need to shade things use the shadow plugin

#

And apply implementation scope to everything you need shadowed

noble lantern
#

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?

river oracle
#

This is done in the shadow Jar settings you shouldn't need a task for this

noble lantern
#

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?

river oracle
#

It's still like that?

#

If you're using mc dev plugin they give you the most god forsaken starting gradle file

noble lantern
#

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

river oracle
#

?paste

undone axleBOT
river oracle
#

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

noble lantern
#

(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)

river oracle
#

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

noble lantern
#

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)

dry hazel
#

forgegradle is also terrible

#

you're going to have a much better experience with architectury loom

noble lantern
#

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 kek

vapid grove
#

honestly i learn more random facts in here then i do at school

#

i did not know sql was a language

noble lantern
#

Wait until you play with the anvil event kek

#

that ones a real nightmare

final monolith
#

💀

vapid grove
#
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

tender shard
#
val eBook: (Enchantment) -> ItemStack = { ench ->
    ItemStack(Material.ENCHANTED_BOOK).apply {
        val meta = itemMeta as EnchantmentStorageMeta
        meta.addStoredEnchant(ench, ench.maxLevel, true)
        itemMeta = meta
    }
}

uwu

rotund ravine
#

So

#

It’s just kotlin

vapid grove
#

oh

#

wait

#

not oh i have 0 idea what kotlin is

rotund ravine
vapid grove
rotund ravine
#

Quite a cool language though

#

Offers a lot of nice extras

vapid grove
#

oh its designed to co-exist with java

#

and i use intellij so

rotund ravine
#

Yeah java interop

vapid grove
#

i might need to do some research into this

#

might be useful in the future

rotund ravine
#

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

vapid grove
#

i like doing my own research on things anyway

#

instead of blindly following everyone elses oppinions

valid burrow
tender shard
wet breach
#

Unlike school you can learn some facts but there like useless ones lmao

wet breach
vapid grove
#

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"

vapid grove
wet breach
#

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

vapid grove
wet breach
#

I research not because i dont believe people but sometimes they may leave some details out of course not necessarily on purpose

vapid grove
#

And then there are times where I am wrong

#

And I take those moments on the cheek obv

wet breach
#

Just to see how easy was it to use. How well does it work etc

vapid grove
#

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

wet breach
#

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

vapid grove
#

Honestly i just use shockbyte cause im lazy

#

But ive hosted servers on rasperry pis

#

and they work fine

wet breach
#

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

vapid grove
#

If you take a vanilla mc server it runs fine

#

From my personal experience at least this may vary

wet breach
#

I had a WoW, pvpgn which is battlenet, pso which is phantasy star online, apache, mysql, ftp, and some others

valid burrow
vapid grove
vapid grove
#

i use yamlconfigs to save user data

#

which is really bad on my end but it

#

somehow functions

#

well

wet breach
#

Thats fine, if you havent encountered issues so be it

vapid grove
#

Its a small server so its nothing I need to worry about right now

wet breach
#

Dont fix what isnt broken

vapid grove
#

If I start to get a heavy playerbase I will change it as I have a feeling that

#

It will crack under pressure persay

wet breach
#

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

vapid grove
#

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

wet breach
#

That is not hard at all to implement

vapid grove
#

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

wet breach
#

In fact you can leverage the OS for the api call to detect file changes

tender shard
wet breach
#

Just record the modified time, every so often check if it changed

vapid grove
wet breach
#

There is an OS api method in File api i think that lets you grab this

vapid grove
#

I can always go braindead, have a value called lastUpdate in the file with the last currentTimeMillis update

wet breach
#

If not there should be something in system api

vapid grove
#
long lastModified = file.lastModified();
#

yeah it is to grab the last modification date of a file

proud badge
#

there exists chest.getBlockInventory(), but I cant seem to find something to set the block inventory

#

what would it be?

chrome beacon
#

You wouldn't do that

#

Modify inventory don't try to replace it

cobalt sphinx
#

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 :)

charred blaze
#

hey

#

where is the resource edit button?

#

i cant see it

#

oh i need to enable 2fa

fallen mirage
#

hello

#

config.set("your.path.to.itemstack", item.serialize());
this is save NBT's?

kindred valley
#

@eternal oxide is there a difference of instantiated itemMeta and non-instiantited

eternal oxide
#

every instance of ItemMeta is an... instance, but they are not all the same instance

kindred valley
#

Ah wait

eternal oxide
#

every time you getItemMeta you are given a NEW copy of the meta

kindred valley
#

So is there any benefits of instantiating it again

#

Evetythime we change it

eternal oxide
#

all the internal values are teh same but it's a completely different instance

kindred valley
#

I rmemeber some objects shoudlnt be instantiated

eternal oxide
#

if you want to make changes to an Items Meta you MUST always setItemMeta to replace the current Meta on the ItemStack

kindred valley
#
ItemMeta meta = game.getItemStack().getItemMeta();
meta.setDisplayName("lol");
game.getItemStack().setItemMeta(meta);
eternal oxide
#

yes

kindred valley
#

What if i just game.getitemstack.getitemmeta.setdisplay("lol");

eternal oxide
#

its lost

tall dragon
#

nothing would happen

kindred valley
#

Why tho isnt it returnjng the same object

eternal oxide
#

Its impossible to modify the meta on an ItemStack. You alwys get a copy, modify it and put it back to replace the current

tall dragon
#

getItemMeta returns a copy of the itemmeta

#

so modifying the returned copy does nothing by itself

sullen wharf
#

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

echo basalt
#
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

sullen wharf
#

good

echo basalt
#
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

smoky anchor
#

Now just make this an ItemStack method and PR this

echo basalt
#

paper has it

#

don't think we'll want it though

eternal night
#

just fix ItemMeta stonks

umbral ridge
#

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

eternal night
#

I mean, we'll get some helpers once coll's ItemType stuff goes through

umbral ridge
#

I think this wouldnt change much though

#

your modifyMeta

#

whats the goal of it?

eternal night
#

Cool kids just use

final ItemStack armor = ItemType.DIAMOND_LEGGINGS.createItemStack(a ->
    a.setTrim(new ArmorTrim(TrimMaterial.EMERALD, TrimPattern.COAST))
);
umbral ridge
#

for me thats like putting apples and bananas together

#

i prefer the longer way

topaz kestrel
#

how could I create an anvil GUI and get the text from the text box?

topaz kestrel
#

isn't it possible without NMS?

umbral ridge
#

anvil class was never finished

hazy parrot
smoky anchor
#

Does that work after you take out the item tho ?
I think there were some problems with that.

hazy parrot
#

idk, im asking

river oracle
river oracle
river oracle
#
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

river oracle
#

The Inventory API simply isn't up to spec with modern requirements

umbral ridge
echo basalt
#

y2k with pink name

river oracle
#

It does everything it was implemented to do there is no unfinished portion

river oracle
umbral ridge
#

is there an event?

#

how do you detect clicks and dragging on an anvil gui

umbral ridge
#

that's exactly my point

river oracle
#

That doesn't mean the api isn't unfinished though

umbral ridge
#

XD

#

it means the api is an ass

river oracle
#

Not really it does its best

umbral ridge
#

thats very optimistic

river oracle
#

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

river oracle
#
#

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

umbral ridge
#

hm

river oracle
#

and we need to ditch the weird shit

echo basalt
#

you should see the goofy ass schemes I do to transfer cash between paypal and my bank

topaz kestrel
river oracle
#

just make sure its your AnvilInventory

topaz kestrel
#

basically removes it from the gui

#

I'm not good at explaining, but is there a way to do that?

river oracle
#

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

river oracle
#

That's why AnvilInventory doesn't provide setRenameText it's tied to the item name

young knoll
#

Yeah you gotta have somethin in there

#

I just use paper

river oracle
topaz kestrel
#

NameItemPacket

remote swallow
valid burrow
#

is there a way to get the last damager of an entity on entity move event without caching it?

young knoll
#

Doesn't entity have a getLastDamager

#

or getLastDamageCause

valid burrow
#

but

#

i dont know how to get the last damager from that

young knoll
#

Check if it's an EntityDamageByEntityEvent and then get the damager from that

quaint mantle
#
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new MyCodes(),this);
    }``` Hi , is this code right for registerevents ?
quaint mantle
# valid burrow yes

so why i get this error ? Could not pass event PlayerJoinEvent to autologin v1.20
org.bukkit.event.EventException: null

undone axleBOT
valid burrow
#

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

quaint mantle
valid burrow
#

give me your whole error log

valid burrow
#

ahh

#

yeah i see

#

in line 17

#

you wrote Player player = (Player) event;

#

correct would be Player player = (Player) event.getPlayer();

quaint mantle
#

oh , i forgot it

valid burrow
#

no worries

quaint mantle
quaint mantle
quaint mantle
valid burrow
#

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

quaint mantle
quaint mantle
hollow oxide
#

how can i get the content of an inventory with the position of the item? (maybe like a Map or something Map<Integer, ItemStack>)

shadow night
#

I'm pretty sure you can get a List of the inventory

#

And a list is basically Map<Integer, ?>

quaint mantle
hollow oxide
tender shard
#

returns an array. empty slots will be null

tender shard
#

url should be jdbc:mysql://127....

valid burrow
#

ah yeah

tender shard
quaint mantle
valid burrow
#

^this is not how you should use databases though.

#

make a seperate class

#

and call methods in that class

quaint mantle
tender shard
#

survival was gamemode 0 or gamemode 1?

young knoll
#

0

tender shard
#

thx

young knoll
#

1 was creative, 2 adventure, 3 spectator

slender elbow
#

spectator didn't use to be a thing :kappa:

young knoll
#

I mean

#

Adventure and creative also didn't use to be a thing

tender shard
#

fun fact: at first, survival wasnt a thing

#

only creative

shadow night
#

Then creative got removed in favour of survival

tender shard
#

yeah lol

kindred valley
#

@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

eternal oxide
#

is this in inventory click event?

kindred valley
#

yep

#

?paste

undone axleBOT
eternal oxide
#

then you are not calling update on the inventory as I told you yesterday

kindred valley
#

how can i update it

kindred valley
#

uh okay

#

tried setCurrentItem

#

and did work for me thank you elgar

tender shard
#

being able to use + for collections in kotlin is one of the greatest things ever

proper cosmos
#

java in my heart

tender shard
#

kotlin is just java with extra features

shadow night
#

Kotlin is just java with shittier syntax

proper cosmos
#

but java

shadow night
tender shard
slate tinsel
#

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?

young knoll
#

No

#

You can't modify particles that have already been spawned

quaint mantle
quaint mantle
#

Lol ur not listening

#

U have no choice

slate tinsel
tender shard
tender shard
slate tinsel
#

okey

quaint mantle
#

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

quaint mantle
tender shard
#

huh? I wasn't the person who asked on how to avoid spawning new particles

slate tinsel
#

Hello

sand spire
#

Does anyone know if this is possible?

quaint mantle
sand spire
#

Thank you

tender shard
#

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()
}
icy beacon
tender shard
#

actually fuck it, I'll just return defaultResolvers + customTagResolvers

icy beacon
#

Oh also, why takeIf and not filter?

#

Curious

tender shard
icy beacon
#
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

tender shard
#

i only have to combine both. I thought it would be easier to just return one of the collections if the other is empty

icy beacon
#

Ah I see wym

tender shard
#

then I decided fuck it, doesn't hurt to combine them anyway, eve nif one or both are empty lol

icy beacon
#

Yeah that's a +1 for readability lol

tender shard
#

uuugh 🥲

#

stop saying <new-gamemode> duh

late sonnet
young knoll
#

Best gamemode

tender shard
#

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

tender shard
#

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

quiet ice
#

I personally think those are more or less the standard gamemode colours out there

tender shard
#

idk I only looked at essentials and they always use the same color for each mode lol

quaint mantle
#

&cSURVIVAL
&bCREATIVE
&aADVENTURE

mellow edge
#

It is probably safer to use NBT api than this:

        NBTTagCompound compound = new NBTTagCompound();
        entity.a(compound);
        compound.setString("asd", "asd");
        entity.f(compound);

?

quaint mantle
#

Much more readable to use an API

tender shard
quaint mantle
#

Oh im a 1.8.8 user so i dont have gradient knowledge

tender shard
mellow edge
#

because of:

#

?1.8

undone axleBOT
mellow edge
#

and on this version there are only mappings provided by spigot

#

(iirc)

raw epoch
#

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) :/

quaint mantle
#

Hi , is there any way to check player is mojang user or isn't mojang user ?

quaint mantle
raw epoch
#

a player is always a mojang user

proper cosmos
proper cosmos
raw epoch
#

crack players can't connect on a "online = true" server

#

i don't have it, sorry

quaint mantle
#

"know it !" not give me !

mellow edge
tender shard
mellow edge
#

but can I assign it to an example itemstack

tender shard
#

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

mellow edge
#

yes, do you recommend api or raw deobfuscated nbt from spigot mappings

tender shard
#

i'd just use NMS / Spigot mappings, it's not as if 1.8 would change anytime soon lol

mellow edge
#

ok nms

icy monolith
#

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?

tall dragon
#

if ur not planning to go cross server i'd say thats what configs are made for ?

icy monolith
#

Soooo i guess it is a yes

young knoll
#

I mean

tall dragon
#

yea

young knoll
#

If you want to save a ton of data SQLite is an option

icy monolith
#

I needed something for server sided stuff

young knoll
#

Yeah you can still use SQLite

#

Seems like you want warps, sounds like a simple table

#

name, world, x, y, z

proper cosmos
#

idk if you use translator but it's hard to undestand

icy monolith
quaint mantle
proper cosmos
icy monolith
remote swallow
#

all it is is 1 table

#

you can use the already existing db

quaint mantle
lean pumice
#

?paste

undone axleBOT
lean pumice
#

dont get error

#

the server block afther enable the plugin

heavy void
#

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)

heavy void
river oracle
rough oak
#

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)

heavy void
river oracle
heavy void
#

Cause Test can be multicolored with §

river oracle
#

also don't use § most people don't have that on their keyboards

heavy void
#

This TextComponent is Plugin -> Player

tender shard
#

how can you not have § on your keyboard 😮

river oracle
#

standard american keyboard ^

tender shard
#

huh

heavy void
eternal oxide
#

UK doesn;t have it either

tender shard
#

it's Shift+3 for me

river oracle
#

nor do any spanish speaking countries afaik

#

shift + 3 is # for us US peoples

eternal oxide
#

£ is shift + 3 here

tender shard
#

and shift+# is '

rough oak
river oracle
tender shard
#

Is there a way to detect when the player moves (with the keyboard keys for example)
TL;DR: no

tender shard
#

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

river oracle
proper cosmos
#

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?

minor junco
tall dragon
#

for example a tag with a random uuid

river oracle
#

this can be done with PDC

#

?pdc

tall dragon
#

isnt pdc nbt under the hood

river oracle
#

yeah

#

which is why it'll work perfeclty without having to use NMS

fossil fractal
#

Is it possible to change the default Minecraft player model to a model you have made ?

river oracle
#

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

fossil fractal
#

Would it be easier to model armour, and when someone puts that combination of armour on there appearance will be that model ? @river oracle

river oracle
#

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

spare hazel
#

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?

fossil fractal
#

Can I friend you @river oracle

river oracle
#

no

river oracle
fossil fractal
#

Do you take commissions

river oracle
rotund ravine
#

?services

undone axleBOT
fossil fractal
#

Aww ok

spare hazel
tender shard
#

in 99.99% of cases the user people will use will not have permissions to create any databases

spare hazel
#

no

tender shard
#

yes

river oracle
#

ig I'm now confused what you are making here lol

spare hazel
#

i meant a database for player permissions like luckperms and stuff

tender shard
#

CREATE DATABASE ... will fail on every shared MC hoster

river oracle
#

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

spare hazel
#

should it be like:
MYSQL INSTANCE "PERMISSIONS"

  • DATABASE "PERMISSIONS"
    • TABLE ...
    • TABLE ...
    • TABLE ...
      MYSQL INSTANCE "PUNISHMENTS"
  • DATABASE "PUNISHMENTS"
    • TABLE ...
    • TABLE ...
    • TABLE ...
      or
      MYSQL INSTANCE "GLOBAL"
  • DATABASE "PERMISSIONS"
    • TABLE ...
    • TABLE ...
    • TABLE ...
  • DATABASE "PUNISHMENTS"
    • TABLE ...
    • TABLE ...
    • TABLE ...
remote swallow
#

why do you need multiple tables for punishments

river oracle
#

also why are we creating new databases instead of just using tables?

tender shard
#

you should have one server with one database

river oracle
#

like isn't that the whole point of tables

remote swallow
#

how is it a mess

river oracle
#

yeah no shit, SQL data isn't meant to look pretty

#

its meant to be functional and effective

remote swallow
#

id much rather prefer all my data to be under 1 database

#

the more access i give, the more dangerous malware could be

proper cosmos
#

Anyone with big brain? Willing to help me get formula

tender shard
spare hazel
#

no not a whole sql server

#

you can have a sql server and a bunch of databases

remote swallow
#

yes but you shouldnt need more than 1 for 1 single server

torn shuttle
river oracle
torn shuttle
river oracle
#

I only pinged you because I love you

torn shuttle
#

wow I love me too, we have so much in common

#

we should get together and talk about how awesome I am some day

young knoll
#

Yeah but his model system doesn’t use display entities yet

river oracle
young knoll
#

0/10

#

:p

river oracle
#

lmk when you're free buddy

proper cosmos
torn shuttle
#

I'll get right on that as soon as I'm done hanging out with myself

young knoll
#

I almost had a system with them working

river oracle
# proper cosmos ?
private static final int[] SLOTS = {4, 3, 5, 2, 4, 6, 9, 3, 5, 7, 0, 2, 4, 6, 8};
remote swallow
young knoll
#

No then me being bad at 3D space

proper cosmos
#

Just used this photo for ilustrating, every line of this inventory represnts other case

elder harness
#

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?

rotund ravine
river oracle
# rotund ravine Lol

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

elder harness
proper cosmos
river oracle
#

e.g. the power of an equation dictates your amount of answers

proper cosmos
river oracle
#

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

proper cosmos
#

and then just set item with i

#

i got it

rotund ravine
tender shard
#

nobody likes a rusty spigot

quaint mantle
#

Hi

echo basalt
#
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

river oracle
#

fuck he beat me to it

agile hollow
#

how can i disable the working of a command for someone who didn't have a permission from another plugin

quaint mantle
#

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, ...)

echo basalt
#

so a map wrapper

quaint mantle
#

I think

inner mulch
quaint mantle
#

Yeah it is

#

but uses generics

agile hollow
agile hollow
inner mulch
#

I guess taht wont work

#

You gotta code it yourself or ask the dev

#

You can work around it tho

agile hollow
inner mulch
#

You can listen to the commandpreprocessevent and cancel it under the condition that it is the command and the player doesnt have the permission

agile hollow
#

oh ok thx <3

bright dawn
#

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?

proud badge
#

does anyone have a link to to that forum post about that dependency with saving bukkit objects as json?

#

I cant find it anywhere

sullen marlin
#

whats wrong with yaml

river oracle
#

Not enough [ and { you feel me

#

A little to much \t or <space>

proud badge
#

I found it

proud badge
umbral marsh
#

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?

proud badge
#

maven or gradle?

#

and how large is the plugin

sullen marlin
#

why do you feel like that

umbral marsh
proud badge
proud badge
umbral marsh
proud badge
#

Gradle builds way faster for me usually

umbral marsh
#

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

tall furnace
#

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.

opal carbon
#

and here i thought you were a man of god

#

comic sans :frown:

glad prawn
#

How i can detect if stair is in water?

opal carbon
#

have fun

glad prawn
#

k

pliant topaz
#

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

tall dragon
#

well ur doing something wrong then cuz that will work with InventoryClickEvent

#

did u register the event?

pliant topaz
#

prob is a creative issue

#

bc it works just fine in survival now xd

#

thx

elder harness
#

How can I forcefully open a book editor and get the written book back on the server?

tall dragon
elder harness
#

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

tall dragon
#

whats got u letting users type in whole paragraphs

remote swallow
#

notepadd++

lean pumice
#

?paste

undone axleBOT
limber nacelle
#

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

tall dragon
#

is "mycommand" in your plugin.yml ?

limber nacelle
valid burrow
#

what version is this for

#

and

limber nacelle
valid burrow
#

should be

#

getCommand("x")...

#

not Bukkit.getPluginCommand

limber nacelle
#

this.getCommand?

valid burrow
#

you dont need to type thi

#

this

#

if its in the main

#

it should just work

limber nacelle
#

i test

limber nacelle
#

An internal error occurred while attempting to perform this command

valid burrow
#

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

elder harness
#

I can assume some player/bug reports can be bigger than what the game's chat allows

valid burrow
#

whats the issue

#

maybe i can help

limber nacelle
quiet ice
#

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.

lost matrix
#

In Intellij? smileybolb
(Has a virtual environment)

quiet ice
#

Nah, jenkins technically

lost matrix
#

Hm

sullen marlin
#

Jenkins can set jdk toolchains

quiet ice
#

Problem is I have no idea how that is done. I don't really remember if I have even set a default

lost matrix
#

Cant you... create an environment for a pipeline and set its env parameters?

sullen marlin
#

Jenkins settings - global toolchains

#

And then in individual maven job settings

lost matrix
#

But this will change it for all pipelines

#

I found something for scripted pipelines:

node {
  jdk = tool name: 'JDK17'
  env.JAVA_HOME = "${jdk}"
  ...
}
quiet ice
#

Welp, md_5s approach worked

sullen marlin
#

slay

lost matrix
#

Noice

bright dawn
#

Is there a way to make players transparent instead of hiding them completely?

valid burrow
#

is there a way i can check for the items on the cursair

minor junco
#

getItemOnCursor I think

river oracle
valid burrow
river oracle
valid burrow
#

or well

#

okay

minor junco
#

Not really, no

river oracle
#

or intercepting packets I suppose

bright dawn
#

transparent with their ghosts visible, and preferably only for a certain player

minor junco
valid burrow
#

no, no i dont think so

valid burrow
#

YALL LIED TO ME

#

I CAN GET IT FROM THE INVENTORY OBJECT

#

LIARS

#

NOT EVEN

#

I CAN EVEN GET IT FROM THE PLAYER OBJECT

inner mulch
#

Ok

winter galleon
#

how can i use the config yml outside main class

young knoll
#

?di

undone axleBOT
winter galleon
#

maintenance

young knoll
#

Ah right the wiki is part of spigotmc

winter galleon
#

xd

young knoll
#

Either way you just pass it through constructors into other classes